aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2005-10-29 01:10:35 -0400
committerArnaldo Carvalho de Melo <acme@mandriva.com>2005-10-29 01:10:35 -0400
commitfc228a04a4c01bbb2f898e180a14f9a976001f79 (patch)
treec6015f399aac7f0566dfadb984d843fe67175329
parent9fcc2e8a752f7d3d889114221b67c459557823e9 (diff)
parent8a212ab6b8a4ccc6f3c3d1beba5f92655c576404 (diff)
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
-rw-r--r--Documentation/DocBook/usb.tmpl2
-rw-r--r--Documentation/input/yealink.txt19
-rw-r--r--Documentation/kernel-parameters.txt2
-rw-r--r--MAINTAINERS20
-rw-r--r--arch/ia64/Kconfig98
-rw-r--r--arch/ia64/configs/bigsur_defconfig395
-rw-r--r--arch/ia64/configs/gensparse_defconfig1319
-rw-r--r--arch/ia64/configs/tiger_defconfig86
-rw-r--r--arch/ia64/configs/zx1_defconfig92
-rw-r--r--arch/ia64/defconfig265
-rw-r--r--arch/ia64/hp/common/hwsw_iommu.c13
-rw-r--r--arch/ia64/hp/common/sba_iommu.c45
-rw-r--r--arch/ia64/hp/sim/simscsi.c13
-rw-r--r--arch/ia64/kernel/acpi.c13
-rw-r--r--arch/ia64/kernel/efi.c510
-rw-r--r--arch/ia64/kernel/irq.c12
-rw-r--r--arch/ia64/kernel/mca.c4
-rw-r--r--arch/ia64/kernel/module.c6
-rw-r--r--arch/ia64/kernel/patch.c16
-rw-r--r--arch/ia64/kernel/ptrace.c28
-rw-r--r--arch/ia64/kernel/setup.c63
-rw-r--r--arch/ia64/kernel/smp.c10
-rw-r--r--arch/ia64/kernel/smpboot.c6
-rw-r--r--arch/ia64/kernel/uncached.c17
-rw-r--r--arch/ia64/lib/swiotlb.c102
-rw-r--r--arch/ia64/mm/Makefile5
-rw-r--r--arch/ia64/mm/contig.c4
-rw-r--r--arch/ia64/mm/discontig.c43
-rw-r--r--arch/ia64/mm/init.c2
-rw-r--r--arch/ia64/mm/numa.c24
-rw-r--r--arch/ia64/mm/tlb.c21
-rw-r--r--arch/ia64/pci/pci.c58
-rw-r--r--arch/ia64/sn/kernel/bte.c2
-rw-r--r--arch/ia64/sn/kernel/io_init.c4
-rw-r--r--arch/ia64/sn/kernel/setup.c160
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c31
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c4
-rw-r--r--arch/ia64/sn/kernel/tiocx.c67
-rw-r--r--arch/ia64/sn/kernel/xpc.h366
-rw-r--r--arch/ia64/sn/kernel/xpc_channel.c329
-rw-r--r--arch/ia64/sn/kernel/xpc_main.c330
-rw-r--r--arch/ia64/sn/kernel/xpc_partition.c475
-rw-r--r--arch/ia64/sn/pci/pci_dma.c46
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_reg.c59
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c32
-rw-r--r--arch/ia64/sn/pci/tioce_provider.c30
-rw-r--r--drivers/Makefile2
-rw-r--r--drivers/base/power/main.c26
-rw-r--r--drivers/base/power/power.h13
-rw-r--r--drivers/base/power/runtime.c1
-rw-r--r--drivers/block/ub.c4
-rw-r--r--drivers/char/agp/sgi-agp.c1
-rw-r--r--drivers/char/mmtimer.c4
-rw-r--r--drivers/char/snsc.c4
-rw-r--r--drivers/pci/quirks.c253
-rw-r--r--drivers/usb/Makefile2
-rw-r--r--drivers/usb/class/Kconfig23
-rw-r--r--drivers/usb/class/Makefile1
-rw-r--r--drivers/usb/class/bluetty.c1279
-rw-r--r--drivers/usb/class/cdc-acm.c5
-rw-r--r--drivers/usb/class/usblp.c3
-rw-r--r--drivers/usb/core/Kconfig11
-rw-r--r--drivers/usb/core/Makefile2
-rw-r--r--drivers/usb/core/config.c22
-rw-r--r--drivers/usb/core/devio.c190
-rw-r--r--drivers/usb/core/file.c19
-rw-r--r--drivers/usb/core/hcd-pci.c106
-rw-r--r--drivers/usb/core/hcd.c151
-rw-r--r--drivers/usb/core/hcd.h69
-rw-r--r--drivers/usb/core/hub.c410
-rw-r--r--drivers/usb/core/hub.h2
-rw-r--r--drivers/usb/core/inode.c44
-rw-r--r--drivers/usb/core/message.c88
-rw-r--r--drivers/usb/core/notify.c120
-rw-r--r--drivers/usb/core/sysfs.c319
-rw-r--r--drivers/usb/core/urb.c3
-rw-r--r--drivers/usb/core/usb.c165
-rw-r--r--drivers/usb/core/usb.h33
-rw-r--r--drivers/usb/gadget/dummy_hcd.c24
-rw-r--r--drivers/usb/gadget/ether.c1
-rw-r--r--drivers/usb/gadget/file_storage.c52
-rw-r--r--drivers/usb/gadget/goku_udc.c1
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c1
-rw-r--r--drivers/usb/gadget/net2280.c1
-rw-r--r--drivers/usb/gadget/omap_udc.c13
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c1
-rw-r--r--drivers/usb/gadget/zero.c1
-rw-r--r--drivers/usb/host/Makefile5
-rw-r--r--drivers/usb/host/ehci-hcd.c543
-rw-r--r--drivers/usb/host/ehci-hub.c8
-rw-r--r--drivers/usb/host/ehci-pci.c415
-rw-r--r--drivers/usb/host/ehci.h1
-rw-r--r--drivers/usb/host/isp116x-hcd.c41
-rw-r--r--drivers/usb/host/isp116x.h1
-rw-r--r--drivers/usb/host/ohci-au1xxx.c6
-rw-r--r--drivers/usb/host/ohci-dbg.c4
-rw-r--r--drivers/usb/host/ohci-hcd.c4
-rw-r--r--drivers/usb/host/ohci-hub.c52
-rw-r--r--drivers/usb/host/ohci-lh7a404.c6
-rw-r--r--drivers/usb/host/ohci-mem.c1
-rw-r--r--drivers/usb/host/ohci-omap.c45
-rw-r--r--drivers/usb/host/ohci-pci.c47
-rw-r--r--drivers/usb/host/ohci-ppc-soc.c9
-rw-r--r--drivers/usb/host/ohci-pxa27x.c7
-rw-r--r--drivers/usb/host/ohci-s3c2410.c9
-rw-r--r--drivers/usb/host/ohci-sa1111.c7
-rw-r--r--drivers/usb/host/ohci.h1
-rw-r--r--drivers/usb/host/pci-quirks.c296
-rw-r--r--drivers/usb/host/sl811-hcd.c17
-rw-r--r--drivers/usb/host/uhci-debug.c5
-rw-r--r--drivers/usb/host/uhci-hcd.c178
-rw-r--r--drivers/usb/host/uhci-hcd.h98
-rw-r--r--drivers/usb/host/uhci-q.c62
-rw-r--r--drivers/usb/image/mdc800.c33
-rw-r--r--drivers/usb/image/microtek.c3
-rw-r--r--drivers/usb/input/aiptek.c2
-rw-r--r--drivers/usb/input/hid-core.c5
-rw-r--r--drivers/usb/input/hiddev.c3
-rw-r--r--drivers/usb/input/map_to_7segment.h2
-rw-r--r--drivers/usb/input/touchkitusb.c2
-rw-r--r--drivers/usb/media/dabusb.c3
-rw-r--r--drivers/usb/misc/auerswald.c3
-rw-r--r--drivers/usb/misc/idmouse.c5
-rw-r--r--drivers/usb/misc/legousbtower.c5
-rw-r--r--drivers/usb/misc/rio500.c3
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c7
-rw-r--r--drivers/usb/misc/usblcd.c9
-rw-r--r--drivers/usb/misc/usbtest.c11
-rw-r--r--drivers/usb/mon/mon_main.c23
-rw-r--r--drivers/usb/net/Kconfig2
-rw-r--r--drivers/usb/net/kaweth.c2
-rw-r--r--drivers/usb/net/pegasus.c2
-rw-r--r--drivers/usb/net/pegasus.h2
-rw-r--r--drivers/usb/net/rtl8150.c1
-rw-r--r--drivers/usb/net/usbnet.c2
-rw-r--r--drivers/usb/serial/ChangeLog.old730
-rw-r--r--drivers/usb/serial/Kconfig9
-rw-r--r--drivers/usb/serial/Makefile1
-rw-r--r--drivers/usb/serial/airprime.c8
-rw-r--r--drivers/usb/serial/belkin_sa.c10
-rw-r--r--drivers/usb/serial/bus.c37
-rw-r--r--drivers/usb/serial/cp2101.c10
-rw-r--r--drivers/usb/serial/cyberjack.c10
-rw-r--r--drivers/usb/serial/cypress_m8.c20
-rw-r--r--drivers/usb/serial/digi_acceleport.c20
-rw-r--r--drivers/usb/serial/empeg.c8
-rw-r--r--drivers/usb/serial/ftdi_sio.c16
-rw-r--r--drivers/usb/serial/ftdi_sio.h16
-rw-r--r--drivers/usb/serial/garmin_gps.c15
-rw-r--r--drivers/usb/serial/generic.c9
-rw-r--r--drivers/usb/serial/hp4x.c10
-rw-r--r--drivers/usb/serial/io_edgeport.c219
-rw-r--r--drivers/usb/serial/io_tables.h30
-rw-r--r--drivers/usb/serial/io_ti.c20
-rw-r--r--drivers/usb/serial/ipaq.c247
-rw-r--r--drivers/usb/serial/ipw.c10
-rw-r--r--drivers/usb/serial/ir-usb.c9
-rw-r--r--drivers/usb/serial/keyspan.h40
-rw-r--r--drivers/usb/serial/keyspan_pda.c30
-rw-r--r--drivers/usb/serial/kl5kusb105.c10
-rw-r--r--drivers/usb/serial/kobil_sct.c9
-rw-r--r--drivers/usb/serial/mct_u232.c10
-rw-r--r--drivers/usb/serial/nokia_dku2.c142
-rw-r--r--drivers/usb/serial/omninet.c10
-rw-r--r--drivers/usb/serial/option.c10
-rw-r--r--drivers/usb/serial/pl2303.c35
-rw-r--r--drivers/usb/serial/safe_serial.c10
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c18
-rw-r--r--drivers/usb/serial/usb-serial.c378
-rw-r--r--drivers/usb/serial/usb-serial.h81
-rw-r--r--drivers/usb/serial/visor.c170
-rw-r--r--drivers/usb/serial/whiteheat.c42
-rw-r--r--drivers/usb/storage/Kconfig3
-rw-r--r--drivers/usb/storage/shuttle_usbat.c314
-rw-r--r--drivers/usb/storage/shuttle_usbat.h66
-rw-r--r--drivers/usb/storage/transport.c6
-rw-r--r--drivers/usb/storage/transport.h2
-rw-r--r--drivers/usb/storage/unusual_devs.h44
-rw-r--r--drivers/usb/storage/usb.c163
-rw-r--r--drivers/usb/storage/usb.h5
-rw-r--r--drivers/usb/usb-skeleton.c3
-rw-r--r--fs/compat_ioctl.c1
-rw-r--r--include/asm-i386/mach-summit/mach_mpparse.h3
-rw-r--r--include/asm-ia64/machvec.h2
-rw-r--r--include/asm-ia64/machvec_hpzx1.h21
-rw-r--r--include/asm-ia64/machvec_hpzx1_swiotlb.h3
-rw-r--r--include/asm-ia64/meminit.h6
-rw-r--r--include/asm-ia64/mmzone.h10
-rw-r--r--include/asm-ia64/nodedata.h4
-rw-r--r--include/asm-ia64/page.h6
-rw-r--r--include/asm-ia64/sn/arch.h36
-rw-r--r--include/asm-ia64/sn/io.h11
-rw-r--r--include/asm-ia64/sn/klconfig.h34
-rw-r--r--include/asm-ia64/sn/l1.h12
-rw-r--r--include/asm-ia64/sn/nodepda.h1
-rw-r--r--include/asm-ia64/sn/sn_cpuid.h3
-rw-r--r--include/asm-ia64/sn/sn_sal.h59
-rw-r--r--include/asm-ia64/sn/tioca_provider.h14
-rw-r--r--include/asm-ia64/sn/tiocx.h3
-rw-r--r--include/asm-ia64/sn/xp.h16
-rw-r--r--include/asm-ia64/sparsemem.h20
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/pm.h14
-rw-r--r--include/linux/usb.h163
-rw-r--r--include/linux/usb_otg.h13
-rw-r--r--include/linux/usbdevice_fs.h7
206 files changed, 8362 insertions, 5884 deletions
diff --git a/Documentation/DocBook/usb.tmpl b/Documentation/DocBook/usb.tmpl
index 705c442c7bf4..15ce0f21e5e0 100644
--- a/Documentation/DocBook/usb.tmpl
+++ b/Documentation/DocBook/usb.tmpl
@@ -291,7 +291,7 @@
291 291
292!Edrivers/usb/core/hcd.c 292!Edrivers/usb/core/hcd.c
293!Edrivers/usb/core/hcd-pci.c 293!Edrivers/usb/core/hcd-pci.c
294!Edrivers/usb/core/buffer.c 294!Idrivers/usb/core/buffer.c
295 </chapter> 295 </chapter>
296 296
297 <chapter> 297 <chapter>
diff --git a/Documentation/input/yealink.txt b/Documentation/input/yealink.txt
index 85f095a7ad04..0962c5c948be 100644
--- a/Documentation/input/yealink.txt
+++ b/Documentation/input/yealink.txt
@@ -2,7 +2,6 @@ Driver documentation for yealink usb-p1k phones
2 2
30. Status 30. Status
4~~~~~~~~~ 4~~~~~~~~~
5
6The p1k is a relatively cheap usb 1.1 phone with: 5The p1k is a relatively cheap usb 1.1 phone with:
7 - keyboard full support, yealink.ko / input event API 6 - keyboard full support, yealink.ko / input event API
8 - LCD full support, yealink.ko / sysfs API 7 - LCD full support, yealink.ko / sysfs API
@@ -17,9 +16,8 @@ For vendor documentation see http://www.yealink.com
17 16
181. Compilation (stand alone version) 171. Compilation (stand alone version)
19~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20
21Currently only kernel 2.6.x.y versions are supported. 19Currently only kernel 2.6.x.y versions are supported.
22In order to build the yealink.ko module do: 20In order to build the yealink.ko module do
23 21
24 make 22 make
25 23
@@ -28,6 +26,21 @@ the Makefile is pointing to the location where your kernel sources
28are located, default /usr/src/linux. 26are located, default /usr/src/linux.
29 27
30 28
291.1 Troubleshooting
30~~~~~~~~~~~~~~~~~~~
31Q: Module yealink compiled and installed without any problem but phone
32 is not initialized and does not react to any actions.
33A: If you see something like:
34 hiddev0: USB HID v1.00 Device [Yealink Network Technology Ltd. VOIP USB Phone
35 in dmesg, it means that the hid driver has grabbed the device first. Try to
36 load module yealink before any other usb hid driver. Please see the
37 instructions provided by your distribution on module configuration.
38
39Q: Phone is working now (displays version and accepts keypad input) but I can't
40 find the sysfs files.
41A: The sysfs files are located on the particular usb endpoint. On most
42 distributions you can do: "find /sys/ -name get_icons" for a hint.
43
31 44
322. keyboard features 452. keyboard features
33~~~~~~~~~~~~~~~~~~~~ 46~~~~~~~~~~~~~~~~~~~~
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 971589a9752d..90766b75d1b7 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1517,8 +1517,6 @@ running once the system is up.
1517 uart6850= [HW,OSS] 1517 uart6850= [HW,OSS]
1518 Format: <io>,<irq> 1518 Format: <io>,<irq>
1519 1519
1520 usb-handoff [HW] Enable early USB BIOS -> OS handoff
1521
1522 usbhid.mousepoll= 1520 usbhid.mousepoll=
1523 [USBHID] The interval which mice are to be polled at. 1521 [USBHID] The interval which mice are to be polled at.
1524 1522
diff --git a/MAINTAINERS b/MAINTAINERS
index 3928dc7d6ea9..770155a01523 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -116,12 +116,6 @@ M: ajk@iehk.rwth-aachen.de
116L: linux-hams@vger.kernel.org 116L: linux-hams@vger.kernel.org
117S: Maintained 117S: Maintained
118 118
119YEALINK PHONE DRIVER
120P: Henk Vergonet
121M: Henk.Vergonet@gmail.com
122L: usbb2k-api-dev@nongnu.org
123S: Maintained
124
1258139CP 10/100 FAST ETHERNET DRIVER 1198139CP 10/100 FAST ETHERNET DRIVER
126P: Jeff Garzik 120P: Jeff Garzik
127M: jgarzik@pobox.com 121M: jgarzik@pobox.com
@@ -2495,14 +2489,6 @@ L: linux-kernel@vger.kernel.org
2495L: linux-usb-devel@lists.sourceforge.net 2489L: linux-usb-devel@lists.sourceforge.net
2496S: Supported 2490S: Supported
2497 2491
2498USB BLUETOOTH TTY CONVERTER DRIVER
2499P: Greg Kroah-Hartman
2500M: greg@kroah.com
2501L: linux-usb-users@lists.sourceforge.net
2502L: linux-usb-devel@lists.sourceforge.net
2503S: Maintained
2504W: http://www.kroah.com/linux-usb/
2505
2506USB CDC ETHERNET DRIVER 2492USB CDC ETHERNET DRIVER
2507P: Greg Kroah-Hartman 2493P: Greg Kroah-Hartman
2508M: greg@kroah.com 2494M: greg@kroah.com
@@ -2863,6 +2849,12 @@ M: jpr@f6fbb.org
2863L: linux-hams@vger.kernel.org 2849L: linux-hams@vger.kernel.org
2864S: Maintained 2850S: Maintained
2865 2851
2852YEALINK PHONE DRIVER
2853P: Henk Vergonet
2854M: Henk.Vergonet@gmail.com
2855L: usbb2k-api-dev@nongnu.org
2856S: Maintained
2857
2866YMFPCI YAMAHA PCI SOUND (Use ALSA instead) 2858YMFPCI YAMAHA PCI SOUND (Use ALSA instead)
2867P: Pete Zaitcev 2859P: Pete Zaitcev
2868M: zaitcev@yahoo.com 2860M: zaitcev@yahoo.com
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 945c15a0722b..1642375fb14e 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -63,8 +63,6 @@ config IA64_GENERIC
63 select ACPI 63 select ACPI
64 select NUMA 64 select NUMA
65 select ACPI_NUMA 65 select ACPI_NUMA
66 select VIRTUAL_MEM_MAP
67 select DISCONTIGMEM
68 help 66 help
69 This selects the system type of your hardware. A "generic" kernel 67 This selects the system type of your hardware. A "generic" kernel
70 will run on any supported IA-64 system. However, if you configure 68 will run on any supported IA-64 system. However, if you configure
@@ -176,40 +174,6 @@ config IA64_L1_CACHE_SHIFT
176 default "6" if ITANIUM 174 default "6" if ITANIUM
177 175
178# align cache-sensitive data to 64 bytes 176# align cache-sensitive data to 64 bytes
179config NUMA
180 bool "NUMA support"
181 depends on !IA64_HP_SIM
182 default y if IA64_SGI_SN2
183 select ACPI_NUMA
184 help
185 Say Y to compile the kernel to support NUMA (Non-Uniform Memory
186 Access). This option is for configuring high-end multiprocessor
187 server systems. If in doubt, say N.
188
189config VIRTUAL_MEM_MAP
190 bool "Virtual mem map"
191 default y if !IA64_HP_SIM
192 help
193 Say Y to compile the kernel with support for a virtual mem map.
194 This code also only takes effect if a memory hole of greater than
195 1 Gb is found during boot. You must turn this option on if you
196 require the DISCONTIGMEM option for your machine. If you are
197 unsure, say Y.
198
199config HOLES_IN_ZONE
200 bool
201 default y if VIRTUAL_MEM_MAP
202
203config ARCH_DISCONTIGMEM_ENABLE
204 bool "Discontiguous memory support"
205 depends on (IA64_DIG || IA64_SGI_SN2 || IA64_GENERIC || IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB) && NUMA && VIRTUAL_MEM_MAP
206 default y if (IA64_SGI_SN2 || IA64_GENERIC) && NUMA
207 help
208 Say Y to support efficient handling of discontiguous physical memory,
209 for architectures which are either NUMA (Non-Uniform Memory Access)
210 or have huge holes in the physical address space for other reasons.
211 See <file:Documentation/vm/numa> for more.
212
213config IA64_CYCLONE 177config IA64_CYCLONE
214 bool "Cyclone (EXA) Time Source support" 178 bool "Cyclone (EXA) Time Source support"
215 help 179 help
@@ -232,8 +196,10 @@ config IA64_SGI_SN_XP
232 based on a network adapter and DMA messaging. 196 based on a network adapter and DMA messaging.
233 197
234config FORCE_MAX_ZONEORDER 198config FORCE_MAX_ZONEORDER
235 int 199 int "MAX_ORDER (11 - 17)" if !HUGETLB_PAGE
236 default "18" 200 range 11 17 if !HUGETLB_PAGE
201 default "17" if HUGETLB_PAGE
202 default "11"
237 203
238config SMP 204config SMP
239 bool "Symmetric multi-processing support" 205 bool "Symmetric multi-processing support"
@@ -254,8 +220,8 @@ config SMP
254 If you don't know what to do here, say N. 220 If you don't know what to do here, say N.
255 221
256config NR_CPUS 222config NR_CPUS
257 int "Maximum number of CPUs (2-512)" 223 int "Maximum number of CPUs (2-1024)"
258 range 2 512 224 range 2 1024
259 depends on SMP 225 depends on SMP
260 default "64" 226 default "64"
261 help 227 help
@@ -298,6 +264,58 @@ config PREEMPT
298 264
299source "mm/Kconfig" 265source "mm/Kconfig"
300 266
267config ARCH_SELECT_MEMORY_MODEL
268 def_bool y
269
270config ARCH_DISCONTIGMEM_ENABLE
271 def_bool y
272 help
273 Say Y to support efficient handling of discontiguous physical memory,
274 for architectures which are either NUMA (Non-Uniform Memory Access)
275 or have huge holes in the physical address space for other reasons.
276 See <file:Documentation/vm/numa> for more.
277
278config ARCH_FLATMEM_ENABLE
279 def_bool y
280
281config ARCH_SPARSEMEM_ENABLE
282 def_bool y
283 depends on ARCH_DISCONTIGMEM_ENABLE
284
285config ARCH_DISCONTIGMEM_DEFAULT
286 def_bool y if (IA64_SGI_SN2 || IA64_GENERIC || IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB)
287 depends on ARCH_DISCONTIGMEM_ENABLE
288
289config NUMA
290 bool "NUMA support"
291 depends on !IA64_HP_SIM && !FLATMEM
292 default y if IA64_SGI_SN2
293 help
294 Say Y to compile the kernel to support NUMA (Non-Uniform Memory
295 Access). This option is for configuring high-end multiprocessor
296 server systems. If in doubt, say N.
297
298# VIRTUAL_MEM_MAP and FLAT_NODE_MEM_MAP are functionally equivalent.
299# VIRTUAL_MEM_MAP has been retained for historical reasons.
300config VIRTUAL_MEM_MAP
301 bool "Virtual mem map"
302 depends on !SPARSEMEM
303 default y if !IA64_HP_SIM
304 help
305 Say Y to compile the kernel with support for a virtual mem map.
306 This code also only takes effect if a memory hole of greater than
307 1 Gb is found during boot. You must turn this option on if you
308 require the DISCONTIGMEM option for your machine. If you are
309 unsure, say Y.
310
311config HOLES_IN_ZONE
312 bool
313 default y if VIRTUAL_MEM_MAP
314
315config HAVE_ARCH_EARLY_PFN_TO_NID
316 def_bool y
317 depends on NEED_MULTIPLE_NODES
318
301config IA32_SUPPORT 319config IA32_SUPPORT
302 bool "Support for Linux/x86 binaries" 320 bool "Support for Linux/x86 binaries"
303 help 321 help
diff --git a/arch/ia64/configs/bigsur_defconfig b/arch/ia64/configs/bigsur_defconfig
index 3b65cbb31b1d..b40672bb3ab0 100644
--- a/arch/ia64/configs/bigsur_defconfig
+++ b/arch/ia64/configs/bigsur_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.10-rc2 3# Linux kernel version: 2.6.14-rc1
4# Mon Nov 29 13:27:48 2004 4# Wed Sep 14 15:18:49 2005
5# 5#
6 6
7# 7#
@@ -10,34 +10,40 @@
10CONFIG_EXPERIMENTAL=y 10CONFIG_EXPERIMENTAL=y
11CONFIG_CLEAN_COMPILE=y 11CONFIG_CLEAN_COMPILE=y
12CONFIG_LOCK_KERNEL=y 12CONFIG_LOCK_KERNEL=y
13CONFIG_INIT_ENV_ARG_LIMIT=32
13 14
14# 15#
15# General setup 16# General setup
16# 17#
17CONFIG_LOCALVERSION="" 18CONFIG_LOCALVERSION=""
19CONFIG_LOCALVERSION_AUTO=y
18CONFIG_SWAP=y 20CONFIG_SWAP=y
19CONFIG_SYSVIPC=y 21CONFIG_SYSVIPC=y
20CONFIG_POSIX_MQUEUE=y 22CONFIG_POSIX_MQUEUE=y
21# CONFIG_BSD_PROCESS_ACCT is not set 23# CONFIG_BSD_PROCESS_ACCT is not set
22CONFIG_SYSCTL=y 24CONFIG_SYSCTL=y
23# CONFIG_AUDIT is not set 25# CONFIG_AUDIT is not set
24CONFIG_LOG_BUF_SHIFT=16
25CONFIG_HOTPLUG=y 26CONFIG_HOTPLUG=y
26CONFIG_KOBJECT_UEVENT=y 27CONFIG_KOBJECT_UEVENT=y
27# CONFIG_IKCONFIG is not set 28# CONFIG_IKCONFIG is not set
29# CONFIG_CPUSETS is not set
30CONFIG_INITRAMFS_SOURCE=""
28# CONFIG_EMBEDDED is not set 31# CONFIG_EMBEDDED is not set
29CONFIG_KALLSYMS=y 32CONFIG_KALLSYMS=y
30# CONFIG_KALLSYMS_ALL is not set 33# CONFIG_KALLSYMS_ALL is not set
31# CONFIG_KALLSYMS_EXTRA_PASS is not set 34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
32CONFIG_FUTEX=y 38CONFIG_FUTEX=y
33CONFIG_EPOLL=y 39CONFIG_EPOLL=y
34# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
35CONFIG_SHMEM=y 40CONFIG_SHMEM=y
36CONFIG_CC_ALIGN_FUNCTIONS=0 41CONFIG_CC_ALIGN_FUNCTIONS=0
37CONFIG_CC_ALIGN_LABELS=0 42CONFIG_CC_ALIGN_LABELS=0
38CONFIG_CC_ALIGN_LOOPS=0 43CONFIG_CC_ALIGN_LOOPS=0
39CONFIG_CC_ALIGN_JUMPS=0 44CONFIG_CC_ALIGN_JUMPS=0
40# CONFIG_TINY_SHMEM is not set 45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
41 47
42# 48#
43# Loadable module support 49# Loadable module support
@@ -58,12 +64,15 @@ CONFIG_IA64=y
58CONFIG_64BIT=y 64CONFIG_64BIT=y
59CONFIG_MMU=y 65CONFIG_MMU=y
60CONFIG_RWSEM_XCHGADD_ALGORITHM=y 66CONFIG_RWSEM_XCHGADD_ALGORITHM=y
67CONFIG_GENERIC_CALIBRATE_DELAY=y
61CONFIG_TIME_INTERPOLATION=y 68CONFIG_TIME_INTERPOLATION=y
62CONFIG_EFI=y 69CONFIG_EFI=y
63CONFIG_GENERIC_IOMAP=y 70CONFIG_GENERIC_IOMAP=y
71CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
64# CONFIG_IA64_GENERIC is not set 72# CONFIG_IA64_GENERIC is not set
65CONFIG_IA64_DIG=y 73CONFIG_IA64_DIG=y
66# CONFIG_IA64_HP_ZX1 is not set 74# CONFIG_IA64_HP_ZX1 is not set
75# CONFIG_IA64_HP_ZX1_SWIOTLB is not set
67# CONFIG_IA64_SGI_SN2 is not set 76# CONFIG_IA64_SGI_SN2 is not set
68# CONFIG_IA64_HP_SIM is not set 77# CONFIG_IA64_HP_SIM is not set
69CONFIG_ITANIUM=y 78CONFIG_ITANIUM=y
@@ -72,17 +81,30 @@ CONFIG_ITANIUM=y
72# CONFIG_IA64_PAGE_SIZE_8KB is not set 81# CONFIG_IA64_PAGE_SIZE_8KB is not set
73CONFIG_IA64_PAGE_SIZE_16KB=y 82CONFIG_IA64_PAGE_SIZE_16KB=y
74# CONFIG_IA64_PAGE_SIZE_64KB is not set 83# CONFIG_IA64_PAGE_SIZE_64KB is not set
84# CONFIG_HZ_100 is not set
85CONFIG_HZ_250=y
86# CONFIG_HZ_1000 is not set
87CONFIG_HZ=250
75CONFIG_IA64_BRL_EMU=y 88CONFIG_IA64_BRL_EMU=y
76CONFIG_IA64_L1_CACHE_SHIFT=6 89CONFIG_IA64_L1_CACHE_SHIFT=6
77# CONFIG_NUMA is not set 90# CONFIG_NUMA is not set
78# CONFIG_VIRTUAL_MEM_MAP is not set 91# CONFIG_VIRTUAL_MEM_MAP is not set
79# CONFIG_IA64_CYCLONE is not set 92# CONFIG_IA64_CYCLONE is not set
80CONFIG_IOSAPIC=y 93CONFIG_IOSAPIC=y
94# CONFIG_IA64_SGI_SN_XP is not set
81CONFIG_FORCE_MAX_ZONEORDER=18 95CONFIG_FORCE_MAX_ZONEORDER=18
82CONFIG_SMP=y 96CONFIG_SMP=y
83CONFIG_NR_CPUS=2 97CONFIG_NR_CPUS=2
84# CONFIG_HOTPLUG_CPU is not set 98# CONFIG_HOTPLUG_CPU is not set
99# CONFIG_SCHED_SMT is not set
85CONFIG_PREEMPT=y 100CONFIG_PREEMPT=y
101CONFIG_SELECT_MEMORY_MODEL=y
102CONFIG_FLATMEM_MANUAL=y
103# CONFIG_DISCONTIGMEM_MANUAL is not set
104# CONFIG_SPARSEMEM_MANUAL is not set
105CONFIG_FLATMEM=y
106CONFIG_FLAT_NODE_MEM_MAP=y
107# CONFIG_SPARSEMEM_STATIC is not set
86CONFIG_HAVE_DEC_LOCK=y 108CONFIG_HAVE_DEC_LOCK=y
87CONFIG_IA32_SUPPORT=y 109CONFIG_IA32_SUPPORT=y
88CONFIG_COMPAT=y 110CONFIG_COMPAT=y
@@ -95,6 +117,7 @@ CONFIG_IA64_PALINFO=y
95# 117#
96CONFIG_EFI_VARS=y 118CONFIG_EFI_VARS=y
97CONFIG_EFI_PCDP=y 119CONFIG_EFI_PCDP=y
120# CONFIG_DELL_RBU is not set
98CONFIG_BINFMT_ELF=y 121CONFIG_BINFMT_ELF=y
99CONFIG_BINFMT_MISC=m 122CONFIG_BINFMT_MISC=m
100 123
@@ -102,18 +125,26 @@ CONFIG_BINFMT_MISC=m
102# Power management and ACPI 125# Power management and ACPI
103# 126#
104CONFIG_PM=y 127CONFIG_PM=y
105CONFIG_ACPI=y 128# CONFIG_PM_DEBUG is not set
106 129
107# 130#
108# ACPI (Advanced Configuration and Power Interface) Support 131# ACPI (Advanced Configuration and Power Interface) Support
109# 132#
133CONFIG_ACPI=y
110CONFIG_ACPI_BUTTON=m 134CONFIG_ACPI_BUTTON=m
111CONFIG_ACPI_FAN=m 135CONFIG_ACPI_FAN=m
112CONFIG_ACPI_PROCESSOR=m 136CONFIG_ACPI_PROCESSOR=m
113CONFIG_ACPI_THERMAL=m 137CONFIG_ACPI_THERMAL=m
138CONFIG_ACPI_BLACKLIST_YEAR=0
114# CONFIG_ACPI_DEBUG is not set 139# CONFIG_ACPI_DEBUG is not set
115CONFIG_ACPI_POWER=y 140CONFIG_ACPI_POWER=y
116CONFIG_ACPI_SYSTEM=y 141CONFIG_ACPI_SYSTEM=y
142# CONFIG_ACPI_CONTAINER is not set
143
144#
145# CPU Frequency scaling
146#
147# CONFIG_CPU_FREQ is not set
117 148
118# 149#
119# Bus options (PCI, PCMCIA) 150# Bus options (PCI, PCMCIA)
@@ -122,7 +153,7 @@ CONFIG_PCI=y
122CONFIG_PCI_DOMAINS=y 153CONFIG_PCI_DOMAINS=y
123# CONFIG_PCI_MSI is not set 154# CONFIG_PCI_MSI is not set
124CONFIG_PCI_LEGACY_PROC=y 155CONFIG_PCI_LEGACY_PROC=y
125CONFIG_PCI_NAMES=y 156# CONFIG_PCI_DEBUG is not set
126 157
127# 158#
128# PCI Hotplug Support 159# PCI Hotplug Support
@@ -135,8 +166,70 @@ CONFIG_PCI_NAMES=y
135# CONFIG_PCCARD is not set 166# CONFIG_PCCARD is not set
136 167
137# 168#
138# PC-card bridges 169# Networking
170#
171CONFIG_NET=y
172
173#
174# Networking options
175#
176CONFIG_PACKET=y
177CONFIG_PACKET_MMAP=y
178CONFIG_UNIX=y
179# CONFIG_NET_KEY is not set
180CONFIG_INET=y
181# CONFIG_IP_MULTICAST is not set
182# CONFIG_IP_ADVANCED_ROUTER is not set
183CONFIG_IP_FIB_HASH=y
184# CONFIG_IP_PNP is not set
185# CONFIG_NET_IPIP is not set
186# CONFIG_NET_IPGRE is not set
187# CONFIG_ARPD is not set
188# CONFIG_SYN_COOKIES is not set
189# CONFIG_INET_AH is not set
190# CONFIG_INET_ESP is not set
191# CONFIG_INET_IPCOMP is not set
192# CONFIG_INET_TUNNEL is not set
193CONFIG_INET_DIAG=y
194CONFIG_INET_TCP_DIAG=y
195# CONFIG_TCP_CONG_ADVANCED is not set
196CONFIG_TCP_CONG_BIC=y
197# CONFIG_IPV6 is not set
198# CONFIG_NETFILTER is not set
199
200#
201# DCCP Configuration (EXPERIMENTAL)
202#
203# CONFIG_IP_DCCP is not set
204
205#
206# SCTP Configuration (EXPERIMENTAL)
207#
208# CONFIG_IP_SCTP is not set
209# CONFIG_ATM is not set
210# CONFIG_BRIDGE is not set
211# CONFIG_VLAN_8021Q is not set
212# CONFIG_DECNET is not set
213# CONFIG_LLC2 is not set
214# CONFIG_IPX is not set
215# CONFIG_ATALK is not set
216# CONFIG_X25 is not set
217# CONFIG_LAPB is not set
218# CONFIG_NET_DIVERT is not set
219# CONFIG_ECONET is not set
220# CONFIG_WAN_ROUTER is not set
221# CONFIG_NET_SCHED is not set
222# CONFIG_NET_CLS_ROUTE is not set
223
224#
225# Network testing
139# 226#
227# CONFIG_NET_PKTGEN is not set
228# CONFIG_NETFILTER_NETLINK is not set
229# CONFIG_HAMRADIO is not set
230# CONFIG_IRDA is not set
231# CONFIG_BT is not set
232# CONFIG_IEEE80211 is not set
140 233
141# 234#
142# Device Drivers 235# Device Drivers
@@ -151,6 +244,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
151# CONFIG_DEBUG_DRIVER is not set 244# CONFIG_DEBUG_DRIVER is not set
152 245
153# 246#
247# Connector - unified userspace <-> kernelspace linker
248#
249# CONFIG_CONNECTOR is not set
250
251#
154# Memory Technology Devices (MTD) 252# Memory Technology Devices (MTD)
155# 253#
156# CONFIG_MTD is not set 254# CONFIG_MTD is not set
@@ -163,7 +261,13 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
163# 261#
164# Plug and Play support 262# Plug and Play support
165# 263#
166# CONFIG_PNP is not set 264CONFIG_PNP=y
265# CONFIG_PNP_DEBUG is not set
266
267#
268# Protocols
269#
270CONFIG_PNPACPI=y
167 271
168# 272#
169# Block devices 273# Block devices
@@ -172,14 +276,15 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
172# CONFIG_BLK_CPQ_CISS_DA is not set 276# CONFIG_BLK_CPQ_CISS_DA is not set
173# CONFIG_BLK_DEV_DAC960 is not set 277# CONFIG_BLK_DEV_DAC960 is not set
174# CONFIG_BLK_DEV_UMEM is not set 278# CONFIG_BLK_DEV_UMEM is not set
279# CONFIG_BLK_DEV_COW_COMMON is not set
175CONFIG_BLK_DEV_LOOP=m 280CONFIG_BLK_DEV_LOOP=m
176CONFIG_BLK_DEV_CRYPTOLOOP=m 281CONFIG_BLK_DEV_CRYPTOLOOP=m
177CONFIG_BLK_DEV_NBD=m 282CONFIG_BLK_DEV_NBD=m
178# CONFIG_BLK_DEV_SX8 is not set 283# CONFIG_BLK_DEV_SX8 is not set
179# CONFIG_BLK_DEV_UB is not set 284# CONFIG_BLK_DEV_UB is not set
180CONFIG_BLK_DEV_RAM=m 285CONFIG_BLK_DEV_RAM=m
286CONFIG_BLK_DEV_RAM_COUNT=16
181CONFIG_BLK_DEV_RAM_SIZE=4096 287CONFIG_BLK_DEV_RAM_SIZE=4096
182CONFIG_INITRAMFS_SOURCE=""
183# CONFIG_CDROM_PKTCDVD is not set 288# CONFIG_CDROM_PKTCDVD is not set
184 289
185# 290#
@@ -189,6 +294,7 @@ CONFIG_IOSCHED_NOOP=y
189CONFIG_IOSCHED_AS=y 294CONFIG_IOSCHED_AS=y
190CONFIG_IOSCHED_DEADLINE=y 295CONFIG_IOSCHED_DEADLINE=y
191CONFIG_IOSCHED_CFQ=y 296CONFIG_IOSCHED_CFQ=y
297# CONFIG_ATA_OVER_ETH is not set
192 298
193# 299#
194# ATA/ATAPI/MFM/RLL support 300# ATA/ATAPI/MFM/RLL support
@@ -211,7 +317,8 @@ CONFIG_BLK_DEV_IDEFLOPPY=m
211# 317#
212# IDE chipset support/bugfixes 318# IDE chipset support/bugfixes
213# 319#
214CONFIG_IDE_GENERIC=m 320# CONFIG_IDE_GENERIC is not set
321# CONFIG_BLK_DEV_IDEPNP is not set
215CONFIG_BLK_DEV_IDEPCI=y 322CONFIG_BLK_DEV_IDEPCI=y
216CONFIG_IDEPCI_SHARE_IRQ=y 323CONFIG_IDEPCI_SHARE_IRQ=y
217# CONFIG_BLK_DEV_OFFBOARD is not set 324# CONFIG_BLK_DEV_OFFBOARD is not set
@@ -233,6 +340,7 @@ CONFIG_IDEDMA_PCI_AUTO=y
233# CONFIG_BLK_DEV_HPT366 is not set 340# CONFIG_BLK_DEV_HPT366 is not set
234# CONFIG_BLK_DEV_SC1200 is not set 341# CONFIG_BLK_DEV_SC1200 is not set
235CONFIG_BLK_DEV_PIIX=m 342CONFIG_BLK_DEV_PIIX=m
343# CONFIG_BLK_DEV_IT821X is not set
236# CONFIG_BLK_DEV_NS87415 is not set 344# CONFIG_BLK_DEV_NS87415 is not set
237# CONFIG_BLK_DEV_PDC202XX_OLD is not set 345# CONFIG_BLK_DEV_PDC202XX_OLD is not set
238# CONFIG_BLK_DEV_PDC202XX_NEW is not set 346# CONFIG_BLK_DEV_PDC202XX_NEW is not set
@@ -250,6 +358,7 @@ CONFIG_IDEDMA_AUTO=y
250# 358#
251# SCSI device support 359# SCSI device support
252# 360#
361# CONFIG_RAID_ATTRS is not set
253CONFIG_SCSI=y 362CONFIG_SCSI=y
254CONFIG_SCSI_PROC_FS=y 363CONFIG_SCSI_PROC_FS=y
255 364
@@ -261,6 +370,7 @@ CONFIG_BLK_DEV_SD=y
261# CONFIG_CHR_DEV_OSST is not set 370# CONFIG_CHR_DEV_OSST is not set
262# CONFIG_BLK_DEV_SR is not set 371# CONFIG_BLK_DEV_SR is not set
263# CONFIG_CHR_DEV_SG is not set 372# CONFIG_CHR_DEV_SG is not set
373# CONFIG_CHR_DEV_SCH is not set
264 374
265# 375#
266# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 376# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -274,6 +384,8 @@ CONFIG_SCSI_LOGGING=y
274# 384#
275CONFIG_SCSI_SPI_ATTRS=m 385CONFIG_SCSI_SPI_ATTRS=m
276# CONFIG_SCSI_FC_ATTRS is not set 386# CONFIG_SCSI_FC_ATTRS is not set
387# CONFIG_SCSI_ISCSI_ATTRS is not set
388# CONFIG_SCSI_SAS_ATTRS is not set
277 389
278# 390#
279# SCSI low-level drivers 391# SCSI low-level drivers
@@ -288,18 +400,13 @@ CONFIG_SCSI_SPI_ATTRS=m
288# CONFIG_MEGARAID_NEWGEN is not set 400# CONFIG_MEGARAID_NEWGEN is not set
289# CONFIG_MEGARAID_LEGACY is not set 401# CONFIG_MEGARAID_LEGACY is not set
290# CONFIG_SCSI_SATA is not set 402# CONFIG_SCSI_SATA is not set
291# CONFIG_SCSI_BUSLOGIC is not set
292# CONFIG_SCSI_DMX3191D is not set 403# CONFIG_SCSI_DMX3191D is not set
293# CONFIG_SCSI_EATA is not set
294# CONFIG_SCSI_EATA_PIO is not set
295# CONFIG_SCSI_FUTURE_DOMAIN is not set 404# CONFIG_SCSI_FUTURE_DOMAIN is not set
296# CONFIG_SCSI_GDTH is not set
297# CONFIG_SCSI_IPS is not set 405# CONFIG_SCSI_IPS is not set
298# CONFIG_SCSI_INITIO is not set 406# CONFIG_SCSI_INITIO is not set
299# CONFIG_SCSI_INIA100 is not set 407# CONFIG_SCSI_INIA100 is not set
300# CONFIG_SCSI_SYM53C8XX_2 is not set 408# CONFIG_SCSI_SYM53C8XX_2 is not set
301# CONFIG_SCSI_IPR is not set 409# CONFIG_SCSI_IPR is not set
302# CONFIG_SCSI_QLOGIC_ISP is not set
303# CONFIG_SCSI_QLOGIC_FC is not set 410# CONFIG_SCSI_QLOGIC_FC is not set
304CONFIG_SCSI_QLOGIC_1280=y 411CONFIG_SCSI_QLOGIC_1280=y
305# CONFIG_SCSI_QLOGIC_1280_1040 is not set 412# CONFIG_SCSI_QLOGIC_1280_1040 is not set
@@ -309,7 +416,8 @@ CONFIG_SCSI_QLA2XXX=y
309# CONFIG_SCSI_QLA2300 is not set 416# CONFIG_SCSI_QLA2300 is not set
310# CONFIG_SCSI_QLA2322 is not set 417# CONFIG_SCSI_QLA2322 is not set
311# CONFIG_SCSI_QLA6312 is not set 418# CONFIG_SCSI_QLA6312 is not set
312# CONFIG_SCSI_QLA6322 is not set 419# CONFIG_SCSI_QLA24XX is not set
420# CONFIG_SCSI_LPFC is not set
313# CONFIG_SCSI_DC395x is not set 421# CONFIG_SCSI_DC395x is not set
314# CONFIG_SCSI_DC390T is not set 422# CONFIG_SCSI_DC390T is not set
315# CONFIG_SCSI_DEBUG is not set 423# CONFIG_SCSI_DEBUG is not set
@@ -332,11 +440,14 @@ CONFIG_DM_CRYPT=m
332CONFIG_DM_SNAPSHOT=m 440CONFIG_DM_SNAPSHOT=m
333CONFIG_DM_MIRROR=m 441CONFIG_DM_MIRROR=m
334CONFIG_DM_ZERO=m 442CONFIG_DM_ZERO=m
443# CONFIG_DM_MULTIPATH is not set
335 444
336# 445#
337# Fusion MPT device support 446# Fusion MPT device support
338# 447#
339# CONFIG_FUSION is not set 448# CONFIG_FUSION is not set
449# CONFIG_FUSION_SPI is not set
450# CONFIG_FUSION_FC is not set
340 451
341# 452#
342# IEEE 1394 (FireWire) support 453# IEEE 1394 (FireWire) support
@@ -349,72 +460,14 @@ CONFIG_DM_ZERO=m
349# CONFIG_I2O is not set 460# CONFIG_I2O is not set
350 461
351# 462#
352# Networking support 463# Network device support
353# 464#
354CONFIG_NET=y
355
356#
357# Networking options
358#
359CONFIG_PACKET=y
360CONFIG_PACKET_MMAP=y
361# CONFIG_NETLINK_DEV is not set
362CONFIG_UNIX=y
363# CONFIG_NET_KEY is not set
364CONFIG_INET=y
365# CONFIG_IP_MULTICAST is not set
366# CONFIG_IP_ADVANCED_ROUTER is not set
367# CONFIG_IP_PNP is not set
368# CONFIG_NET_IPIP is not set
369# CONFIG_NET_IPGRE is not set
370# CONFIG_ARPD is not set
371# CONFIG_SYN_COOKIES is not set
372# CONFIG_INET_AH is not set
373# CONFIG_INET_ESP is not set
374# CONFIG_INET_IPCOMP is not set
375# CONFIG_INET_TUNNEL is not set
376CONFIG_IP_TCPDIAG=y
377# CONFIG_IP_TCPDIAG_IPV6 is not set
378# CONFIG_IPV6 is not set
379# CONFIG_NETFILTER is not set
380
381#
382# SCTP Configuration (EXPERIMENTAL)
383#
384# CONFIG_IP_SCTP is not set
385# CONFIG_ATM is not set
386# CONFIG_BRIDGE is not set
387# CONFIG_VLAN_8021Q is not set
388# CONFIG_DECNET is not set
389# CONFIG_LLC2 is not set
390# CONFIG_IPX is not set
391# CONFIG_ATALK is not set
392# CONFIG_X25 is not set
393# CONFIG_LAPB is not set
394# CONFIG_NET_DIVERT is not set
395# CONFIG_ECONET is not set
396# CONFIG_WAN_ROUTER is not set
397
398#
399# QoS and/or fair queueing
400#
401# CONFIG_NET_SCHED is not set
402# CONFIG_NET_CLS_ROUTE is not set
403
404#
405# Network testing
406#
407# CONFIG_NET_PKTGEN is not set
408# CONFIG_NETPOLL is not set
409# CONFIG_NET_POLL_CONTROLLER is not set
410# CONFIG_HAMRADIO is not set
411# CONFIG_IRDA is not set
412# CONFIG_BT is not set
413CONFIG_NETDEVICES=y 465CONFIG_NETDEVICES=y
414CONFIG_DUMMY=y 466CONFIG_DUMMY=y
415# CONFIG_BONDING is not set 467# CONFIG_BONDING is not set
416# CONFIG_EQUALIZER is not set 468# CONFIG_EQUALIZER is not set
417# CONFIG_TUN is not set 469# CONFIG_TUN is not set
470# CONFIG_NET_SB1000 is not set
418 471
419# 472#
420# ARCnet devices 473# ARCnet devices
@@ -422,6 +475,11 @@ CONFIG_DUMMY=y
422# CONFIG_ARCNET is not set 475# CONFIG_ARCNET is not set
423 476
424# 477#
478# PHY device support
479#
480# CONFIG_PHYLIB is not set
481
482#
425# Ethernet (10 or 100Mbit) 483# Ethernet (10 or 100Mbit)
426# 484#
427CONFIG_NET_ETHERNET=y 485CONFIG_NET_ETHERNET=y
@@ -443,7 +501,6 @@ CONFIG_NET_PCI=y
443# CONFIG_FORCEDETH is not set 501# CONFIG_FORCEDETH is not set
444# CONFIG_DGRS is not set 502# CONFIG_DGRS is not set
445CONFIG_EEPRO100=y 503CONFIG_EEPRO100=y
446# CONFIG_EEPRO100_PIO is not set
447# CONFIG_E100 is not set 504# CONFIG_E100 is not set
448# CONFIG_FEALNX is not set 505# CONFIG_FEALNX is not set
449# CONFIG_NATSEMI is not set 506# CONFIG_NATSEMI is not set
@@ -465,13 +522,17 @@ CONFIG_EEPRO100=y
465# CONFIG_HAMACHI is not set 522# CONFIG_HAMACHI is not set
466# CONFIG_YELLOWFIN is not set 523# CONFIG_YELLOWFIN is not set
467# CONFIG_R8169 is not set 524# CONFIG_R8169 is not set
525# CONFIG_SIS190 is not set
526# CONFIG_SKGE is not set
468# CONFIG_SK98LIN is not set 527# CONFIG_SK98LIN is not set
469# CONFIG_VIA_VELOCITY is not set 528# CONFIG_VIA_VELOCITY is not set
470# CONFIG_TIGON3 is not set 529# CONFIG_TIGON3 is not set
530# CONFIG_BNX2 is not set
471 531
472# 532#
473# Ethernet (10000 Mbit) 533# Ethernet (10000 Mbit)
474# 534#
535# CONFIG_CHELSIO_T1 is not set
475# CONFIG_IXGB is not set 536# CONFIG_IXGB is not set
476# CONFIG_S2IO is not set 537# CONFIG_S2IO is not set
477 538
@@ -496,6 +557,8 @@ CONFIG_EEPRO100=y
496# CONFIG_NET_FC is not set 557# CONFIG_NET_FC is not set
497# CONFIG_SHAPER is not set 558# CONFIG_SHAPER is not set
498# CONFIG_NETCONSOLE is not set 559# CONFIG_NETCONSOLE is not set
560# CONFIG_NETPOLL is not set
561# CONFIG_NET_POLL_CONTROLLER is not set
499 562
500# 563#
501# ISDN subsystem 564# ISDN subsystem
@@ -525,18 +588,6 @@ CONFIG_INPUT_EVDEV=y
525# CONFIG_INPUT_EVBUG is not set 588# CONFIG_INPUT_EVBUG is not set
526 589
527# 590#
528# Input I/O drivers
529#
530# CONFIG_GAMEPORT is not set
531CONFIG_SOUND_GAMEPORT=y
532CONFIG_SERIO=y
533CONFIG_SERIO_I8042=y
534CONFIG_SERIO_SERPORT=y
535# CONFIG_SERIO_CT82C710 is not set
536# CONFIG_SERIO_PCIPS2 is not set
537# CONFIG_SERIO_RAW is not set
538
539#
540# Input Device Drivers 591# Input Device Drivers
541# 592#
542CONFIG_INPUT_KEYBOARD=y 593CONFIG_INPUT_KEYBOARD=y
@@ -554,6 +605,17 @@ CONFIG_MOUSE_PS2=y
554# CONFIG_INPUT_MISC is not set 605# CONFIG_INPUT_MISC is not set
555 606
556# 607#
608# Hardware I/O ports
609#
610CONFIG_SERIO=y
611CONFIG_SERIO_I8042=y
612CONFIG_SERIO_SERPORT=y
613# CONFIG_SERIO_PCIPS2 is not set
614CONFIG_SERIO_LIBPS2=y
615# CONFIG_SERIO_RAW is not set
616# CONFIG_GAMEPORT is not set
617
618#
557# Character devices 619# Character devices
558# 620#
559CONFIG_VT=y 621CONFIG_VT=y
@@ -571,7 +633,6 @@ CONFIG_SERIAL_8250_NR_UARTS=4
571CONFIG_SERIAL_8250_EXTENDED=y 633CONFIG_SERIAL_8250_EXTENDED=y
572CONFIG_SERIAL_8250_SHARE_IRQ=y 634CONFIG_SERIAL_8250_SHARE_IRQ=y
573# CONFIG_SERIAL_8250_DETECT_IRQ is not set 635# CONFIG_SERIAL_8250_DETECT_IRQ is not set
574# CONFIG_SERIAL_8250_MULTIPORT is not set
575# CONFIG_SERIAL_8250_RSA is not set 636# CONFIG_SERIAL_8250_RSA is not set
576 637
577# 638#
@@ -579,6 +640,7 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
579# 640#
580CONFIG_SERIAL_CORE=y 641CONFIG_SERIAL_CORE=y
581CONFIG_SERIAL_CORE_CONSOLE=y 642CONFIG_SERIAL_CORE_CONSOLE=y
643# CONFIG_SERIAL_JSM is not set
582CONFIG_UNIX98_PTYS=y 644CONFIG_UNIX98_PTYS=y
583CONFIG_LEGACY_PTYS=y 645CONFIG_LEGACY_PTYS=y
584CONFIG_LEGACY_PTY_COUNT=256 646CONFIG_LEGACY_PTY_COUNT=256
@@ -603,14 +665,22 @@ CONFIG_EFI_RTC=y
603# 665#
604CONFIG_AGP=m 666CONFIG_AGP=m
605CONFIG_AGP_I460=m 667CONFIG_AGP_I460=m
606CONFIG_DRM=y 668CONFIG_DRM=m
607# CONFIG_DRM_TDFX is not set 669# CONFIG_DRM_TDFX is not set
608CONFIG_DRM_R128=m 670CONFIG_DRM_R128=m
609# CONFIG_DRM_RADEON is not set 671# CONFIG_DRM_RADEON is not set
610# CONFIG_DRM_MGA is not set 672# CONFIG_DRM_MGA is not set
611# CONFIG_DRM_SIS is not set 673# CONFIG_DRM_SIS is not set
674# CONFIG_DRM_VIA is not set
675# CONFIG_DRM_SAVAGE is not set
612# CONFIG_RAW_DRIVER is not set 676# CONFIG_RAW_DRIVER is not set
613# CONFIG_HPET is not set 677# CONFIG_HPET is not set
678# CONFIG_HANGCHECK_TIMER is not set
679
680#
681# TPM devices
682#
683# CONFIG_TCG_TPM is not set
614 684
615# 685#
616# I2C support 686# I2C support
@@ -635,7 +705,7 @@ CONFIG_I2C_ALGOBIT=y
635# CONFIG_I2C_AMD8111 is not set 705# CONFIG_I2C_AMD8111 is not set
636# CONFIG_I2C_I801 is not set 706# CONFIG_I2C_I801 is not set
637# CONFIG_I2C_I810 is not set 707# CONFIG_I2C_I810 is not set
638# CONFIG_I2C_ISA is not set 708# CONFIG_I2C_PIIX4 is not set
639# CONFIG_I2C_NFORCE2 is not set 709# CONFIG_I2C_NFORCE2 is not set
640# CONFIG_I2C_PARPORT_LIGHT is not set 710# CONFIG_I2C_PARPORT_LIGHT is not set
641# CONFIG_I2C_PROSAVAGE is not set 711# CONFIG_I2C_PROSAVAGE is not set
@@ -651,16 +721,43 @@ CONFIG_I2C_ALGOBIT=y
651# CONFIG_I2C_PCA_ISA is not set 721# CONFIG_I2C_PCA_ISA is not set
652 722
653# 723#
654# Hardware Sensors Chip support 724# Miscellaneous I2C Chip support
655# 725#
656# CONFIG_I2C_SENSOR is not set 726# CONFIG_SENSORS_DS1337 is not set
727# CONFIG_SENSORS_DS1374 is not set
728# CONFIG_SENSORS_EEPROM is not set
729# CONFIG_SENSORS_PCF8574 is not set
730# CONFIG_SENSORS_PCA9539 is not set
731# CONFIG_SENSORS_PCF8591 is not set
732# CONFIG_SENSORS_RTC8564 is not set
733# CONFIG_SENSORS_MAX6875 is not set
734# CONFIG_I2C_DEBUG_CORE is not set
735# CONFIG_I2C_DEBUG_ALGO is not set
736# CONFIG_I2C_DEBUG_BUS is not set
737# CONFIG_I2C_DEBUG_CHIP is not set
738
739#
740# Dallas's 1-wire bus
741#
742# CONFIG_W1 is not set
743
744#
745# Hardware Monitoring support
746#
747CONFIG_HWMON=y
748# CONFIG_HWMON_VID is not set
657# CONFIG_SENSORS_ADM1021 is not set 749# CONFIG_SENSORS_ADM1021 is not set
658# CONFIG_SENSORS_ADM1025 is not set 750# CONFIG_SENSORS_ADM1025 is not set
751# CONFIG_SENSORS_ADM1026 is not set
659# CONFIG_SENSORS_ADM1031 is not set 752# CONFIG_SENSORS_ADM1031 is not set
753# CONFIG_SENSORS_ADM9240 is not set
660# CONFIG_SENSORS_ASB100 is not set 754# CONFIG_SENSORS_ASB100 is not set
755# CONFIG_SENSORS_ATXP1 is not set
661# CONFIG_SENSORS_DS1621 is not set 756# CONFIG_SENSORS_DS1621 is not set
662# CONFIG_SENSORS_FSCHER is not set 757# CONFIG_SENSORS_FSCHER is not set
758# CONFIG_SENSORS_FSCPOS is not set
663# CONFIG_SENSORS_GL518SM is not set 759# CONFIG_SENSORS_GL518SM is not set
760# CONFIG_SENSORS_GL520SM is not set
664# CONFIG_SENSORS_IT87 is not set 761# CONFIG_SENSORS_IT87 is not set
665# CONFIG_SENSORS_LM63 is not set 762# CONFIG_SENSORS_LM63 is not set
666# CONFIG_SENSORS_LM75 is not set 763# CONFIG_SENSORS_LM75 is not set
@@ -671,33 +768,26 @@ CONFIG_I2C_ALGOBIT=y
671# CONFIG_SENSORS_LM85 is not set 768# CONFIG_SENSORS_LM85 is not set
672# CONFIG_SENSORS_LM87 is not set 769# CONFIG_SENSORS_LM87 is not set
673# CONFIG_SENSORS_LM90 is not set 770# CONFIG_SENSORS_LM90 is not set
771# CONFIG_SENSORS_LM92 is not set
674# CONFIG_SENSORS_MAX1619 is not set 772# CONFIG_SENSORS_MAX1619 is not set
675# CONFIG_SENSORS_PC87360 is not set 773# CONFIG_SENSORS_PC87360 is not set
774# CONFIG_SENSORS_SIS5595 is not set
676# CONFIG_SENSORS_SMSC47M1 is not set 775# CONFIG_SENSORS_SMSC47M1 is not set
776# CONFIG_SENSORS_SMSC47B397 is not set
677# CONFIG_SENSORS_VIA686A is not set 777# CONFIG_SENSORS_VIA686A is not set
678# CONFIG_SENSORS_W83781D is not set 778# CONFIG_SENSORS_W83781D is not set
779# CONFIG_SENSORS_W83792D is not set
679# CONFIG_SENSORS_W83L785TS is not set 780# CONFIG_SENSORS_W83L785TS is not set
680# CONFIG_SENSORS_W83627HF is not set 781# CONFIG_SENSORS_W83627HF is not set
782# CONFIG_SENSORS_W83627EHF is not set
783# CONFIG_HWMON_DEBUG_CHIP is not set
681 784
682# 785#
683# Other I2C Chip support 786# Misc devices
684#
685# CONFIG_SENSORS_EEPROM is not set
686# CONFIG_SENSORS_PCF8574 is not set
687# CONFIG_SENSORS_PCF8591 is not set
688# CONFIG_SENSORS_RTC8564 is not set
689# CONFIG_I2C_DEBUG_CORE is not set
690# CONFIG_I2C_DEBUG_ALGO is not set
691# CONFIG_I2C_DEBUG_BUS is not set
692# CONFIG_I2C_DEBUG_CHIP is not set
693
694#
695# Dallas's 1-wire bus
696# 787#
697# CONFIG_W1 is not set
698 788
699# 789#
700# Misc devices 790# Multimedia Capabilities Port drivers
701# 791#
702 792
703# 793#
@@ -752,11 +842,12 @@ CONFIG_SND_OPL3_LIB=m
752# CONFIG_SND_MTPAV is not set 842# CONFIG_SND_MTPAV is not set
753# CONFIG_SND_SERIAL_U16550 is not set 843# CONFIG_SND_SERIAL_U16550 is not set
754# CONFIG_SND_MPU401 is not set 844# CONFIG_SND_MPU401 is not set
845CONFIG_SND_AC97_CODEC=m
846CONFIG_SND_AC97_BUS=m
755 847
756# 848#
757# PCI devices 849# PCI devices
758# 850#
759CONFIG_SND_AC97_CODEC=m
760# CONFIG_SND_ALI5451 is not set 851# CONFIG_SND_ALI5451 is not set
761# CONFIG_SND_ATIIXP is not set 852# CONFIG_SND_ATIIXP is not set
762# CONFIG_SND_ATIIXP_MODEM is not set 853# CONFIG_SND_ATIIXP_MODEM is not set
@@ -768,6 +859,8 @@ CONFIG_SND_AC97_CODEC=m
768# CONFIG_SND_CS46XX is not set 859# CONFIG_SND_CS46XX is not set
769CONFIG_SND_CS4281=m 860CONFIG_SND_CS4281=m
770# CONFIG_SND_EMU10K1 is not set 861# CONFIG_SND_EMU10K1 is not set
862# CONFIG_SND_EMU10K1X is not set
863# CONFIG_SND_CA0106 is not set
771# CONFIG_SND_KORG1212 is not set 864# CONFIG_SND_KORG1212 is not set
772# CONFIG_SND_MIXART is not set 865# CONFIG_SND_MIXART is not set
773# CONFIG_SND_NM256 is not set 866# CONFIG_SND_NM256 is not set
@@ -775,9 +868,10 @@ CONFIG_SND_CS4281=m
775# CONFIG_SND_RME96 is not set 868# CONFIG_SND_RME96 is not set
776# CONFIG_SND_RME9652 is not set 869# CONFIG_SND_RME9652 is not set
777# CONFIG_SND_HDSP is not set 870# CONFIG_SND_HDSP is not set
871# CONFIG_SND_HDSPM is not set
778# CONFIG_SND_TRIDENT is not set 872# CONFIG_SND_TRIDENT is not set
779# CONFIG_SND_YMFPCI is not set 873# CONFIG_SND_YMFPCI is not set
780# CONFIG_SND_ALS4000 is not set 874# CONFIG_SND_AD1889 is not set
781# CONFIG_SND_CMIPCI is not set 875# CONFIG_SND_CMIPCI is not set
782# CONFIG_SND_ENS1370 is not set 876# CONFIG_SND_ENS1370 is not set
783# CONFIG_SND_ENS1371 is not set 877# CONFIG_SND_ENS1371 is not set
@@ -791,13 +885,14 @@ CONFIG_SND_CS4281=m
791# CONFIG_SND_INTEL8X0M is not set 885# CONFIG_SND_INTEL8X0M is not set
792# CONFIG_SND_SONICVIBES is not set 886# CONFIG_SND_SONICVIBES is not set
793# CONFIG_SND_VIA82XX is not set 887# CONFIG_SND_VIA82XX is not set
888# CONFIG_SND_VIA82XX_MODEM is not set
794# CONFIG_SND_VX222 is not set 889# CONFIG_SND_VX222 is not set
890# CONFIG_SND_HDA_INTEL is not set
795 891
796# 892#
797# USB devices 893# USB devices
798# 894#
799# CONFIG_SND_USB_AUDIO is not set 895# CONFIG_SND_USB_AUDIO is not set
800# CONFIG_SND_USB_USX2Y is not set
801 896
802# 897#
803# Open Sound System 898# Open Sound System
@@ -807,6 +902,8 @@ CONFIG_SND_CS4281=m
807# 902#
808# USB support 903# USB support
809# 904#
905CONFIG_USB_ARCH_HAS_HCD=y
906CONFIG_USB_ARCH_HAS_OHCI=y
810CONFIG_USB=m 907CONFIG_USB=m
811# CONFIG_USB_DEBUG is not set 908# CONFIG_USB_DEBUG is not set
812 909
@@ -818,35 +915,38 @@ CONFIG_USB_DEVICEFS=y
818# CONFIG_USB_DYNAMIC_MINORS is not set 915# CONFIG_USB_DYNAMIC_MINORS is not set
819# CONFIG_USB_SUSPEND is not set 916# CONFIG_USB_SUSPEND is not set
820# CONFIG_USB_OTG is not set 917# CONFIG_USB_OTG is not set
821CONFIG_USB_ARCH_HAS_HCD=y
822CONFIG_USB_ARCH_HAS_OHCI=y
823 918
824# 919#
825# USB Host Controller Drivers 920# USB Host Controller Drivers
826# 921#
827# CONFIG_USB_EHCI_HCD is not set 922# CONFIG_USB_EHCI_HCD is not set
923# CONFIG_USB_ISP116X_HCD is not set
828# CONFIG_USB_OHCI_HCD is not set 924# CONFIG_USB_OHCI_HCD is not set
829CONFIG_USB_UHCI_HCD=m 925CONFIG_USB_UHCI_HCD=m
926# CONFIG_USB_SL811_HCD is not set
830 927
831# 928#
832# USB Device Class drivers 929# USB Device Class drivers
833# 930#
834CONFIG_USB_AUDIO=m 931# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
835CONFIG_USB_BLUETOOTH_TTY=m 932CONFIG_USB_BLUETOOTH_TTY=m
836CONFIG_USB_MIDI=m
837CONFIG_USB_ACM=m 933CONFIG_USB_ACM=m
838CONFIG_USB_PRINTER=m 934CONFIG_USB_PRINTER=m
935
936#
937# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
938#
839CONFIG_USB_STORAGE=m 939CONFIG_USB_STORAGE=m
840# CONFIG_USB_STORAGE_DEBUG is not set 940# CONFIG_USB_STORAGE_DEBUG is not set
841# CONFIG_USB_STORAGE_RW_DETECT is not set
842# CONFIG_USB_STORAGE_DATAFAB is not set 941# CONFIG_USB_STORAGE_DATAFAB is not set
843# CONFIG_USB_STORAGE_FREECOM is not set 942# CONFIG_USB_STORAGE_FREECOM is not set
844# CONFIG_USB_STORAGE_ISD200 is not set 943# CONFIG_USB_STORAGE_ISD200 is not set
845# CONFIG_USB_STORAGE_DPCM is not set 944# CONFIG_USB_STORAGE_DPCM is not set
846# CONFIG_USB_STORAGE_HP8200e is not set 945# CONFIG_USB_STORAGE_USBAT is not set
847# CONFIG_USB_STORAGE_SDDR09 is not set 946# CONFIG_USB_STORAGE_SDDR09 is not set
848# CONFIG_USB_STORAGE_SDDR55 is not set 947# CONFIG_USB_STORAGE_SDDR55 is not set
849# CONFIG_USB_STORAGE_JUMPSHOT is not set 948# CONFIG_USB_STORAGE_JUMPSHOT is not set
949# CONFIG_USB_STORAGE_ONETOUCH is not set
850 950
851# 951#
852# USB Input Devices 952# USB Input Devices
@@ -863,19 +963,23 @@ CONFIG_USB_HIDDEV=y
863# CONFIG_USB_MOUSE is not set 963# CONFIG_USB_MOUSE is not set
864# CONFIG_USB_AIPTEK is not set 964# CONFIG_USB_AIPTEK is not set
865# CONFIG_USB_WACOM is not set 965# CONFIG_USB_WACOM is not set
966# CONFIG_USB_ACECAD is not set
866# CONFIG_USB_KBTAB is not set 967# CONFIG_USB_KBTAB is not set
867# CONFIG_USB_POWERMATE is not set 968# CONFIG_USB_POWERMATE is not set
868# CONFIG_USB_MTOUCH is not set 969# CONFIG_USB_MTOUCH is not set
970# CONFIG_USB_ITMTOUCH is not set
869# CONFIG_USB_EGALAX is not set 971# CONFIG_USB_EGALAX is not set
972# CONFIG_USB_YEALINK is not set
870# CONFIG_USB_XPAD is not set 973# CONFIG_USB_XPAD is not set
871# CONFIG_USB_ATI_REMOTE is not set 974# CONFIG_USB_ATI_REMOTE is not set
975# CONFIG_USB_KEYSPAN_REMOTE is not set
976# CONFIG_USB_APPLETOUCH is not set
872 977
873# 978#
874# USB Imaging devices 979# USB Imaging devices
875# 980#
876# CONFIG_USB_MDC800 is not set 981# CONFIG_USB_MDC800 is not set
877# CONFIG_USB_MICROTEK is not set 982# CONFIG_USB_MICROTEK is not set
878# CONFIG_USB_HPUSBSCSI is not set
879 983
880# 984#
881# USB Multimedia devices 985# USB Multimedia devices
@@ -894,6 +998,7 @@ CONFIG_USB_HIDDEV=y
894# CONFIG_USB_PEGASUS is not set 998# CONFIG_USB_PEGASUS is not set
895# CONFIG_USB_RTL8150 is not set 999# CONFIG_USB_RTL8150 is not set
896# CONFIG_USB_USBNET is not set 1000# CONFIG_USB_USBNET is not set
1001CONFIG_USB_MON=y
897 1002
898# 1003#
899# USB port drivers 1004# USB port drivers
@@ -909,7 +1014,6 @@ CONFIG_USB_HIDDEV=y
909# 1014#
910# CONFIG_USB_EMI62 is not set 1015# CONFIG_USB_EMI62 is not set
911# CONFIG_USB_EMI26 is not set 1016# CONFIG_USB_EMI26 is not set
912# CONFIG_USB_TIGL is not set
913# CONFIG_USB_AUERSWALD is not set 1017# CONFIG_USB_AUERSWALD is not set
914# CONFIG_USB_RIO500 is not set 1018# CONFIG_USB_RIO500 is not set
915# CONFIG_USB_LEGOTOWER is not set 1019# CONFIG_USB_LEGOTOWER is not set
@@ -918,10 +1022,12 @@ CONFIG_USB_HIDDEV=y
918# CONFIG_USB_CYTHERM is not set 1022# CONFIG_USB_CYTHERM is not set
919# CONFIG_USB_PHIDGETKIT is not set 1023# CONFIG_USB_PHIDGETKIT is not set
920# CONFIG_USB_PHIDGETSERVO is not set 1024# CONFIG_USB_PHIDGETSERVO is not set
1025# CONFIG_USB_IDMOUSE is not set
1026# CONFIG_USB_LD is not set
921# CONFIG_USB_TEST is not set 1027# CONFIG_USB_TEST is not set
922 1028
923# 1029#
924# USB ATM/DSL drivers 1030# USB DSL modem support
925# 1031#
926 1032
927# 1033#
@@ -930,10 +1036,25 @@ CONFIG_USB_HIDDEV=y
930# CONFIG_USB_GADGET is not set 1036# CONFIG_USB_GADGET is not set
931 1037
932# 1038#
1039# MMC/SD Card support
1040#
1041# CONFIG_MMC is not set
1042
1043#
1044# InfiniBand support
1045#
1046# CONFIG_INFINIBAND is not set
1047
1048#
1049# SN Devices
1050#
1051
1052#
933# File systems 1053# File systems
934# 1054#
935CONFIG_EXT2_FS=y 1055CONFIG_EXT2_FS=y
936# CONFIG_EXT2_FS_XATTR is not set 1056# CONFIG_EXT2_FS_XATTR is not set
1057# CONFIG_EXT2_FS_XIP is not set
937CONFIG_EXT3_FS=y 1058CONFIG_EXT3_FS=y
938CONFIG_EXT3_FS_XATTR=y 1059CONFIG_EXT3_FS_XATTR=y
939# CONFIG_EXT3_FS_POSIX_ACL is not set 1060# CONFIG_EXT3_FS_POSIX_ACL is not set
@@ -945,17 +1066,20 @@ CONFIG_FS_MBCACHE=y
945# CONFIG_JFS_FS is not set 1066# CONFIG_JFS_FS is not set
946CONFIG_FS_POSIX_ACL=y 1067CONFIG_FS_POSIX_ACL=y
947CONFIG_XFS_FS=y 1068CONFIG_XFS_FS=y
948# CONFIG_XFS_RT is not set 1069CONFIG_XFS_EXPORT=y
949CONFIG_XFS_QUOTA=y 1070CONFIG_XFS_QUOTA=y
950CONFIG_XFS_SECURITY=y 1071CONFIG_XFS_SECURITY=y
951CONFIG_XFS_POSIX_ACL=y 1072CONFIG_XFS_POSIX_ACL=y
1073# CONFIG_XFS_RT is not set
952# CONFIG_MINIX_FS is not set 1074# CONFIG_MINIX_FS is not set
953# CONFIG_ROMFS_FS is not set 1075# CONFIG_ROMFS_FS is not set
1076CONFIG_INOTIFY=y
954# CONFIG_QUOTA is not set 1077# CONFIG_QUOTA is not set
955CONFIG_QUOTACTL=y 1078CONFIG_QUOTACTL=y
956CONFIG_DNOTIFY=y 1079CONFIG_DNOTIFY=y
957CONFIG_AUTOFS_FS=m 1080CONFIG_AUTOFS_FS=m
958CONFIG_AUTOFS4_FS=m 1081CONFIG_AUTOFS4_FS=m
1082# CONFIG_FUSE_FS is not set
959 1083
960# 1084#
961# CD-ROM/DVD Filesystems 1085# CD-ROM/DVD Filesystems
@@ -982,14 +1106,11 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
982CONFIG_PROC_FS=y 1106CONFIG_PROC_FS=y
983CONFIG_PROC_KCORE=y 1107CONFIG_PROC_KCORE=y
984CONFIG_SYSFS=y 1108CONFIG_SYSFS=y
985# CONFIG_DEVFS_FS is not set
986CONFIG_DEVPTS_FS_XATTR=y
987CONFIG_DEVPTS_FS_SECURITY=y
988CONFIG_TMPFS=y 1109CONFIG_TMPFS=y
989# CONFIG_TMPFS_XATTR is not set
990CONFIG_HUGETLBFS=y 1110CONFIG_HUGETLBFS=y
991CONFIG_HUGETLB_PAGE=y 1111CONFIG_HUGETLB_PAGE=y
992CONFIG_RAMFS=y 1112CONFIG_RAMFS=y
1113# CONFIG_RELAYFS_FS is not set
993 1114
994# 1115#
995# Miscellaneous filesystems 1116# Miscellaneous filesystems
@@ -1013,15 +1134,18 @@ CONFIG_RAMFS=y
1013# 1134#
1014CONFIG_NFS_FS=m 1135CONFIG_NFS_FS=m
1015CONFIG_NFS_V3=y 1136CONFIG_NFS_V3=y
1137# CONFIG_NFS_V3_ACL is not set
1016CONFIG_NFS_V4=y 1138CONFIG_NFS_V4=y
1017# CONFIG_NFS_DIRECTIO is not set 1139# CONFIG_NFS_DIRECTIO is not set
1018CONFIG_NFSD=m 1140CONFIG_NFSD=m
1019CONFIG_NFSD_V3=y 1141CONFIG_NFSD_V3=y
1142# CONFIG_NFSD_V3_ACL is not set
1020CONFIG_NFSD_V4=y 1143CONFIG_NFSD_V4=y
1021CONFIG_NFSD_TCP=y 1144CONFIG_NFSD_TCP=y
1022CONFIG_LOCKD=m 1145CONFIG_LOCKD=m
1023CONFIG_LOCKD_V4=y 1146CONFIG_LOCKD_V4=y
1024CONFIG_EXPORTFS=m 1147CONFIG_EXPORTFS=y
1148CONFIG_NFS_COMMON=y
1025CONFIG_SUNRPC=m 1149CONFIG_SUNRPC=m
1026CONFIG_SUNRPC_GSS=m 1150CONFIG_SUNRPC_GSS=m
1027CONFIG_RPCSEC_GSS_KRB5=m 1151CONFIG_RPCSEC_GSS_KRB5=m
@@ -1031,9 +1155,11 @@ CONFIG_CIFS=m
1031CONFIG_CIFS_STATS=y 1155CONFIG_CIFS_STATS=y
1032CONFIG_CIFS_XATTR=y 1156CONFIG_CIFS_XATTR=y
1033CONFIG_CIFS_POSIX=y 1157CONFIG_CIFS_POSIX=y
1158# CONFIG_CIFS_EXPERIMENTAL is not set
1034# CONFIG_NCP_FS is not set 1159# CONFIG_NCP_FS is not set
1035# CONFIG_CODA_FS is not set 1160# CONFIG_CODA_FS is not set
1036# CONFIG_AFS_FS is not set 1161# CONFIG_AFS_FS is not set
1162# CONFIG_9P_FS is not set
1037 1163
1038# 1164#
1039# Partition Types 1165# Partition Types
@@ -1103,8 +1229,12 @@ CONFIG_NLS_UTF8=m
1103# Library routines 1229# Library routines
1104# 1230#
1105# CONFIG_CRC_CCITT is not set 1231# CONFIG_CRC_CCITT is not set
1232# CONFIG_CRC16 is not set
1106CONFIG_CRC32=y 1233CONFIG_CRC32=y
1107# CONFIG_LIBCRC32C is not set 1234# CONFIG_LIBCRC32C is not set
1235CONFIG_GENERIC_HARDIRQS=y
1236CONFIG_GENERIC_IRQ_PROBE=y
1237CONFIG_GENERIC_PENDING_IRQ=y
1108 1238
1109# 1239#
1110# Profiling support 1240# Profiling support
@@ -1115,14 +1245,20 @@ CONFIG_OPROFILE=y
1115# 1245#
1116# Kernel hacking 1246# Kernel hacking
1117# 1247#
1248# CONFIG_PRINTK_TIME is not set
1118CONFIG_DEBUG_KERNEL=y 1249CONFIG_DEBUG_KERNEL=y
1119CONFIG_MAGIC_SYSRQ=y 1250CONFIG_MAGIC_SYSRQ=y
1251CONFIG_LOG_BUF_SHIFT=16
1252CONFIG_DETECT_SOFTLOCKUP=y
1120# CONFIG_SCHEDSTATS is not set 1253# CONFIG_SCHEDSTATS is not set
1121# CONFIG_DEBUG_SLAB is not set 1254# CONFIG_DEBUG_SLAB is not set
1255CONFIG_DEBUG_PREEMPT=y
1122# CONFIG_DEBUG_SPINLOCK is not set 1256# CONFIG_DEBUG_SPINLOCK is not set
1123# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1257# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1124# CONFIG_DEBUG_KOBJECT is not set 1258# CONFIG_DEBUG_KOBJECT is not set
1125# CONFIG_DEBUG_INFO is not set 1259# CONFIG_DEBUG_INFO is not set
1260# CONFIG_DEBUG_FS is not set
1261# CONFIG_KPROBES is not set
1126# CONFIG_IA64_GRANULE_16MB is not set 1262# CONFIG_IA64_GRANULE_16MB is not set
1127CONFIG_IA64_GRANULE_64MB=y 1263CONFIG_IA64_GRANULE_64MB=y
1128# CONFIG_IA64_PRINT_HAZARDS is not set 1264# CONFIG_IA64_PRINT_HAZARDS is not set
@@ -1149,6 +1285,7 @@ CONFIG_CRYPTO_MD5=y
1149# CONFIG_CRYPTO_SHA256 is not set 1285# CONFIG_CRYPTO_SHA256 is not set
1150# CONFIG_CRYPTO_SHA512 is not set 1286# CONFIG_CRYPTO_SHA512 is not set
1151# CONFIG_CRYPTO_WP512 is not set 1287# CONFIG_CRYPTO_WP512 is not set
1288# CONFIG_CRYPTO_TGR192 is not set
1152CONFIG_CRYPTO_DES=y 1289CONFIG_CRYPTO_DES=y
1153# CONFIG_CRYPTO_BLOWFISH is not set 1290# CONFIG_CRYPTO_BLOWFISH is not set
1154# CONFIG_CRYPTO_TWOFISH is not set 1291# CONFIG_CRYPTO_TWOFISH is not set
@@ -1164,3 +1301,7 @@ CONFIG_CRYPTO_DES=y
1164# CONFIG_CRYPTO_MICHAEL_MIC is not set 1301# CONFIG_CRYPTO_MICHAEL_MIC is not set
1165# CONFIG_CRYPTO_CRC32C is not set 1302# CONFIG_CRYPTO_CRC32C is not set
1166# CONFIG_CRYPTO_TEST is not set 1303# CONFIG_CRYPTO_TEST is not set
1304
1305#
1306# Hardware crypto devices
1307#
diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig
new file mode 100644
index 000000000000..80f8663bc6d9
--- /dev/null
+++ b/arch/ia64/configs/gensparse_defconfig
@@ -0,0 +1,1319 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14-rc2
4# Wed Sep 28 08:27:29 2005
5#
6
7#
8# Code maturity level options
9#
10CONFIG_EXPERIMENTAL=y
11CONFIG_CLEAN_COMPILE=y
12CONFIG_LOCK_KERNEL=y
13CONFIG_INIT_ENV_ARG_LIMIT=32
14
15#
16# General setup
17#
18CONFIG_LOCALVERSION=""
19CONFIG_LOCALVERSION_AUTO=y
20CONFIG_SWAP=y
21CONFIG_SYSVIPC=y
22CONFIG_POSIX_MQUEUE=y
23# CONFIG_BSD_PROCESS_ACCT is not set
24CONFIG_SYSCTL=y
25# CONFIG_AUDIT is not set
26CONFIG_HOTPLUG=y
27CONFIG_KOBJECT_UEVENT=y
28CONFIG_IKCONFIG=y
29CONFIG_IKCONFIG_PROC=y
30# CONFIG_CPUSETS is not set
31CONFIG_INITRAMFS_SOURCE=""
32# CONFIG_EMBEDDED is not set
33CONFIG_KALLSYMS=y
34CONFIG_KALLSYMS_ALL=y
35# CONFIG_KALLSYMS_EXTRA_PASS is not set
36CONFIG_PRINTK=y
37CONFIG_BUG=y
38CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y
40CONFIG_EPOLL=y
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y
54# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y
57# CONFIG_MODULE_SRCVERSION_ALL is not set
58CONFIG_KMOD=y
59CONFIG_STOP_MACHINE=y
60
61#
62# Processor type and features
63#
64CONFIG_IA64=y
65CONFIG_64BIT=y
66CONFIG_MMU=y
67CONFIG_RWSEM_XCHGADD_ALGORITHM=y
68CONFIG_GENERIC_CALIBRATE_DELAY=y
69CONFIG_TIME_INTERPOLATION=y
70CONFIG_EFI=y
71CONFIG_GENERIC_IOMAP=y
72CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
73CONFIG_IA64_GENERIC=y
74# CONFIG_IA64_DIG is not set
75# CONFIG_IA64_HP_ZX1 is not set
76# CONFIG_IA64_HP_ZX1_SWIOTLB is not set
77# CONFIG_IA64_SGI_SN2 is not set
78# CONFIG_IA64_HP_SIM is not set
79# CONFIG_ITANIUM is not set
80CONFIG_MCKINLEY=y
81# CONFIG_IA64_PAGE_SIZE_4KB is not set
82# CONFIG_IA64_PAGE_SIZE_8KB is not set
83CONFIG_IA64_PAGE_SIZE_16KB=y
84# CONFIG_IA64_PAGE_SIZE_64KB is not set
85# CONFIG_HZ_100 is not set
86CONFIG_HZ_250=y
87# CONFIG_HZ_1000 is not set
88CONFIG_HZ=250
89CONFIG_IA64_L1_CACHE_SHIFT=7
90CONFIG_IA64_CYCLONE=y
91CONFIG_IOSAPIC=y
92# CONFIG_IA64_SGI_SN_XP is not set
93CONFIG_FORCE_MAX_ZONEORDER=17
94CONFIG_SMP=y
95CONFIG_NR_CPUS=512
96CONFIG_HOTPLUG_CPU=y
97# CONFIG_SCHED_SMT is not set
98# CONFIG_PREEMPT is not set
99CONFIG_SELECT_MEMORY_MODEL=y
100# CONFIG_FLATMEM_MANUAL is not set
101# CONFIG_DISCONTIGMEM_MANUAL is not set
102CONFIG_SPARSEMEM_MANUAL=y
103CONFIG_SPARSEMEM=y
104CONFIG_NEED_MULTIPLE_NODES=y
105CONFIG_HAVE_MEMORY_PRESENT=y
106# CONFIG_SPARSEMEM_STATIC is not set
107CONFIG_SPARSEMEM_EXTREME=y
108CONFIG_ARCH_SELECT_MEMORY_MODEL=y
109CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
110CONFIG_ARCH_FLATMEM_ENABLE=y
111CONFIG_ARCH_SPARSEMEM_ENABLE=y
112CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
113CONFIG_NUMA=y
114CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
115CONFIG_IA32_SUPPORT=y
116CONFIG_COMPAT=y
117CONFIG_IA64_MCA_RECOVERY=y
118CONFIG_PERFMON=y
119CONFIG_IA64_PALINFO=y
120
121#
122# Firmware Drivers
123#
124CONFIG_EFI_VARS=y
125CONFIG_EFI_PCDP=y
126# CONFIG_DELL_RBU is not set
127CONFIG_BINFMT_ELF=y
128CONFIG_BINFMT_MISC=m
129
130#
131# Power management and ACPI
132#
133CONFIG_PM=y
134# CONFIG_PM_DEBUG is not set
135
136#
137# ACPI (Advanced Configuration and Power Interface) Support
138#
139CONFIG_ACPI=y
140CONFIG_ACPI_BUTTON=m
141CONFIG_ACPI_FAN=m
142CONFIG_ACPI_PROCESSOR=m
143CONFIG_ACPI_HOTPLUG_CPU=y
144CONFIG_ACPI_THERMAL=m
145CONFIG_ACPI_NUMA=y
146CONFIG_ACPI_BLACKLIST_YEAR=0
147# CONFIG_ACPI_DEBUG is not set
148CONFIG_ACPI_POWER=y
149CONFIG_ACPI_SYSTEM=y
150CONFIG_ACPI_CONTAINER=m
151
152#
153# CPU Frequency scaling
154#
155# CONFIG_CPU_FREQ is not set
156
157#
158# Bus options (PCI, PCMCIA)
159#
160CONFIG_PCI=y
161CONFIG_PCI_DOMAINS=y
162# CONFIG_PCI_MSI is not set
163CONFIG_PCI_LEGACY_PROC=y
164# CONFIG_PCI_DEBUG is not set
165
166#
167# PCI Hotplug Support
168#
169CONFIG_HOTPLUG_PCI=m
170# CONFIG_HOTPLUG_PCI_FAKE is not set
171CONFIG_HOTPLUG_PCI_ACPI=m
172# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set
173# CONFIG_HOTPLUG_PCI_CPCI is not set
174# CONFIG_HOTPLUG_PCI_SHPC is not set
175# CONFIG_HOTPLUG_PCI_SGI is not set
176
177#
178# PCCARD (PCMCIA/CardBus) support
179#
180# CONFIG_PCCARD is not set
181
182#
183# Networking
184#
185CONFIG_NET=y
186
187#
188# Networking options
189#
190CONFIG_PACKET=y
191# CONFIG_PACKET_MMAP is not set
192CONFIG_UNIX=y
193# CONFIG_NET_KEY is not set
194CONFIG_INET=y
195CONFIG_IP_MULTICAST=y
196# CONFIG_IP_ADVANCED_ROUTER is not set
197CONFIG_IP_FIB_HASH=y
198# CONFIG_IP_PNP is not set
199# CONFIG_NET_IPIP is not set
200# CONFIG_NET_IPGRE is not set
201# CONFIG_IP_MROUTE is not set
202CONFIG_ARPD=y
203CONFIG_SYN_COOKIES=y
204# CONFIG_INET_AH is not set
205# CONFIG_INET_ESP is not set
206# CONFIG_INET_IPCOMP is not set
207# CONFIG_INET_TUNNEL is not set
208CONFIG_INET_DIAG=y
209CONFIG_INET_TCP_DIAG=y
210# CONFIG_TCP_CONG_ADVANCED is not set
211CONFIG_TCP_CONG_BIC=y
212# CONFIG_IPV6 is not set
213# CONFIG_NETFILTER is not set
214
215#
216# DCCP Configuration (EXPERIMENTAL)
217#
218# CONFIG_IP_DCCP is not set
219
220#
221# SCTP Configuration (EXPERIMENTAL)
222#
223# CONFIG_IP_SCTP is not set
224# CONFIG_ATM is not set
225# CONFIG_BRIDGE is not set
226# CONFIG_VLAN_8021Q is not set
227# CONFIG_DECNET is not set
228# CONFIG_LLC2 is not set
229# CONFIG_IPX is not set
230# CONFIG_ATALK is not set
231# CONFIG_X25 is not set
232# CONFIG_LAPB is not set
233# CONFIG_NET_DIVERT is not set
234# CONFIG_ECONET is not set
235# CONFIG_WAN_ROUTER is not set
236# CONFIG_NET_SCHED is not set
237# CONFIG_NET_CLS_ROUTE is not set
238
239#
240# Network testing
241#
242# CONFIG_NET_PKTGEN is not set
243# CONFIG_HAMRADIO is not set
244# CONFIG_IRDA is not set
245# CONFIG_BT is not set
246# CONFIG_IEEE80211 is not set
247
248#
249# Device Drivers
250#
251
252#
253# Generic Driver Options
254#
255CONFIG_STANDALONE=y
256CONFIG_PREVENT_FIRMWARE_BUILD=y
257CONFIG_FW_LOADER=m
258# CONFIG_DEBUG_DRIVER is not set
259
260#
261# Connector - unified userspace <-> kernelspace linker
262#
263# CONFIG_CONNECTOR is not set
264
265#
266# Memory Technology Devices (MTD)
267#
268# CONFIG_MTD is not set
269
270#
271# Parallel port support
272#
273# CONFIG_PARPORT is not set
274
275#
276# Plug and Play support
277#
278# CONFIG_PNP is not set
279
280#
281# Block devices
282#
283# CONFIG_BLK_CPQ_DA is not set
284# CONFIG_BLK_CPQ_CISS_DA is not set
285# CONFIG_BLK_DEV_DAC960 is not set
286# CONFIG_BLK_DEV_UMEM is not set
287# CONFIG_BLK_DEV_COW_COMMON is not set
288CONFIG_BLK_DEV_LOOP=m
289CONFIG_BLK_DEV_CRYPTOLOOP=m
290CONFIG_BLK_DEV_NBD=m
291# CONFIG_BLK_DEV_SX8 is not set
292# CONFIG_BLK_DEV_UB is not set
293CONFIG_BLK_DEV_RAM=y
294CONFIG_BLK_DEV_RAM_COUNT=16
295CONFIG_BLK_DEV_RAM_SIZE=4096
296CONFIG_BLK_DEV_INITRD=y
297# CONFIG_CDROM_PKTCDVD is not set
298
299#
300# IO Schedulers
301#
302CONFIG_IOSCHED_NOOP=y
303CONFIG_IOSCHED_AS=y
304CONFIG_IOSCHED_DEADLINE=y
305CONFIG_IOSCHED_CFQ=y
306# CONFIG_ATA_OVER_ETH is not set
307
308#
309# ATA/ATAPI/MFM/RLL support
310#
311CONFIG_IDE=y
312CONFIG_BLK_DEV_IDE=y
313
314#
315# Please see Documentation/ide.txt for help/info on IDE drives
316#
317# CONFIG_BLK_DEV_IDE_SATA is not set
318CONFIG_BLK_DEV_IDEDISK=y
319# CONFIG_IDEDISK_MULTI_MODE is not set
320CONFIG_BLK_DEV_IDECD=y
321# CONFIG_BLK_DEV_IDETAPE is not set
322CONFIG_BLK_DEV_IDEFLOPPY=y
323CONFIG_BLK_DEV_IDESCSI=m
324# CONFIG_IDE_TASK_IOCTL is not set
325
326#
327# IDE chipset support/bugfixes
328#
329CONFIG_IDE_GENERIC=y
330CONFIG_BLK_DEV_IDEPCI=y
331# CONFIG_IDEPCI_SHARE_IRQ is not set
332# CONFIG_BLK_DEV_OFFBOARD is not set
333CONFIG_BLK_DEV_GENERIC=y
334# CONFIG_BLK_DEV_OPTI621 is not set
335CONFIG_BLK_DEV_IDEDMA_PCI=y
336# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
337CONFIG_IDEDMA_PCI_AUTO=y
338# CONFIG_IDEDMA_ONLYDISK is not set
339# CONFIG_BLK_DEV_AEC62XX is not set
340# CONFIG_BLK_DEV_ALI15X3 is not set
341# CONFIG_BLK_DEV_AMD74XX is not set
342CONFIG_BLK_DEV_CMD64X=y
343# CONFIG_BLK_DEV_TRIFLEX is not set
344# CONFIG_BLK_DEV_CY82C693 is not set
345# CONFIG_BLK_DEV_CS5520 is not set
346# CONFIG_BLK_DEV_CS5530 is not set
347# CONFIG_BLK_DEV_HPT34X is not set
348# CONFIG_BLK_DEV_HPT366 is not set
349# CONFIG_BLK_DEV_SC1200 is not set
350CONFIG_BLK_DEV_PIIX=y
351# CONFIG_BLK_DEV_IT821X is not set
352# CONFIG_BLK_DEV_NS87415 is not set
353# CONFIG_BLK_DEV_PDC202XX_OLD is not set
354# CONFIG_BLK_DEV_PDC202XX_NEW is not set
355# CONFIG_BLK_DEV_SVWKS is not set
356CONFIG_BLK_DEV_SGIIOC4=y
357# CONFIG_BLK_DEV_SIIMAGE is not set
358# CONFIG_BLK_DEV_SLC90E66 is not set
359# CONFIG_BLK_DEV_TRM290 is not set
360# CONFIG_BLK_DEV_VIA82CXXX is not set
361# CONFIG_IDE_ARM is not set
362CONFIG_BLK_DEV_IDEDMA=y
363# CONFIG_IDEDMA_IVB is not set
364CONFIG_IDEDMA_AUTO=y
365# CONFIG_BLK_DEV_HD is not set
366
367#
368# SCSI device support
369#
370# CONFIG_RAID_ATTRS is not set
371CONFIG_SCSI=y
372CONFIG_SCSI_PROC_FS=y
373
374#
375# SCSI support type (disk, tape, CD-ROM)
376#
377CONFIG_BLK_DEV_SD=y
378CONFIG_CHR_DEV_ST=m
379# CONFIG_CHR_DEV_OSST is not set
380CONFIG_BLK_DEV_SR=m
381# CONFIG_BLK_DEV_SR_VENDOR is not set
382CONFIG_CHR_DEV_SG=m
383# CONFIG_CHR_DEV_SCH is not set
384
385#
386# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
387#
388# CONFIG_SCSI_MULTI_LUN is not set
389# CONFIG_SCSI_CONSTANTS is not set
390# CONFIG_SCSI_LOGGING is not set
391
392#
393# SCSI Transport Attributes
394#
395CONFIG_SCSI_SPI_ATTRS=y
396CONFIG_SCSI_FC_ATTRS=y
397# CONFIG_SCSI_ISCSI_ATTRS is not set
398# CONFIG_SCSI_SAS_ATTRS is not set
399
400#
401# SCSI low-level drivers
402#
403# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
404# CONFIG_SCSI_3W_9XXX is not set
405# CONFIG_SCSI_ACARD is not set
406# CONFIG_SCSI_AACRAID is not set
407# CONFIG_SCSI_AIC7XXX is not set
408# CONFIG_SCSI_AIC7XXX_OLD is not set
409# CONFIG_SCSI_AIC79XX is not set
410# CONFIG_MEGARAID_NEWGEN is not set
411# CONFIG_MEGARAID_LEGACY is not set
412CONFIG_SCSI_SATA=y
413# CONFIG_SCSI_SATA_AHCI is not set
414# CONFIG_SCSI_SATA_SVW is not set
415# CONFIG_SCSI_ATA_PIIX is not set
416# CONFIG_SCSI_SATA_MV is not set
417# CONFIG_SCSI_SATA_NV is not set
418# CONFIG_SCSI_SATA_PROMISE is not set
419# CONFIG_SCSI_SATA_QSTOR is not set
420# CONFIG_SCSI_SATA_SX4 is not set
421# CONFIG_SCSI_SATA_SIL is not set
422# CONFIG_SCSI_SATA_SIS is not set
423# CONFIG_SCSI_SATA_ULI is not set
424# CONFIG_SCSI_SATA_VIA is not set
425CONFIG_SCSI_SATA_VITESSE=y
426# CONFIG_SCSI_DMX3191D is not set
427# CONFIG_SCSI_FUTURE_DOMAIN is not set
428# CONFIG_SCSI_IPS is not set
429# CONFIG_SCSI_INITIO is not set
430# CONFIG_SCSI_INIA100 is not set
431CONFIG_SCSI_SYM53C8XX_2=y
432CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
433CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
434CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
435# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
436# CONFIG_SCSI_IPR is not set
437# CONFIG_SCSI_QLOGIC_FC is not set
438CONFIG_SCSI_QLOGIC_1280=y
439# CONFIG_SCSI_QLOGIC_1280_1040 is not set
440CONFIG_SCSI_QLA2XXX=y
441CONFIG_SCSI_QLA21XX=m
442CONFIG_SCSI_QLA22XX=m
443CONFIG_SCSI_QLA2300=m
444CONFIG_SCSI_QLA2322=m
445# CONFIG_SCSI_QLA6312 is not set
446# CONFIG_SCSI_QLA24XX is not set
447# CONFIG_SCSI_LPFC is not set
448# CONFIG_SCSI_DC395x is not set
449# CONFIG_SCSI_DC390T is not set
450# CONFIG_SCSI_DEBUG is not set
451
452#
453# Multi-device support (RAID and LVM)
454#
455CONFIG_MD=y
456CONFIG_BLK_DEV_MD=m
457CONFIG_MD_LINEAR=m
458CONFIG_MD_RAID0=m
459CONFIG_MD_RAID1=m
460# CONFIG_MD_RAID10 is not set
461CONFIG_MD_RAID5=m
462CONFIG_MD_RAID6=m
463CONFIG_MD_MULTIPATH=m
464# CONFIG_MD_FAULTY is not set
465CONFIG_BLK_DEV_DM=m
466CONFIG_DM_CRYPT=m
467CONFIG_DM_SNAPSHOT=m
468CONFIG_DM_MIRROR=m
469CONFIG_DM_ZERO=m
470CONFIG_DM_MULTIPATH=m
471# CONFIG_DM_MULTIPATH_EMC is not set
472
473#
474# Fusion MPT device support
475#
476CONFIG_FUSION=y
477CONFIG_FUSION_SPI=y
478CONFIG_FUSION_FC=m
479CONFIG_FUSION_MAX_SGE=128
480# CONFIG_FUSION_CTL is not set
481
482#
483# IEEE 1394 (FireWire) support
484#
485# CONFIG_IEEE1394 is not set
486
487#
488# I2O device support
489#
490# CONFIG_I2O is not set
491
492#
493# Network device support
494#
495CONFIG_NETDEVICES=y
496CONFIG_DUMMY=m
497# CONFIG_BONDING is not set
498# CONFIG_EQUALIZER is not set
499# CONFIG_TUN is not set
500
501#
502# ARCnet devices
503#
504# CONFIG_ARCNET is not set
505
506#
507# PHY device support
508#
509# CONFIG_PHYLIB is not set
510
511#
512# Ethernet (10 or 100Mbit)
513#
514CONFIG_NET_ETHERNET=y
515CONFIG_MII=m
516# CONFIG_HAPPYMEAL is not set
517# CONFIG_SUNGEM is not set
518# CONFIG_NET_VENDOR_3COM is not set
519
520#
521# Tulip family network device support
522#
523CONFIG_NET_TULIP=y
524# CONFIG_DE2104X is not set
525CONFIG_TULIP=m
526# CONFIG_TULIP_MWI is not set
527# CONFIG_TULIP_MMIO is not set
528# CONFIG_TULIP_NAPI is not set
529# CONFIG_DE4X5 is not set
530# CONFIG_WINBOND_840 is not set
531# CONFIG_DM9102 is not set
532# CONFIG_ULI526X is not set
533# CONFIG_HP100 is not set
534CONFIG_NET_PCI=y
535# CONFIG_PCNET32 is not set
536# CONFIG_AMD8111_ETH is not set
537# CONFIG_ADAPTEC_STARFIRE is not set
538# CONFIG_B44 is not set
539# CONFIG_FORCEDETH is not set
540# CONFIG_DGRS is not set
541CONFIG_EEPRO100=m
542CONFIG_E100=m
543# CONFIG_FEALNX is not set
544# CONFIG_NATSEMI is not set
545# CONFIG_NE2K_PCI is not set
546# CONFIG_8139CP is not set
547# CONFIG_8139TOO is not set
548# CONFIG_SIS900 is not set
549# CONFIG_EPIC100 is not set
550# CONFIG_SUNDANCE is not set
551# CONFIG_VIA_RHINE is not set
552
553#
554# Ethernet (1000 Mbit)
555#
556# CONFIG_ACENIC is not set
557# CONFIG_DL2K is not set
558CONFIG_E1000=y
559# CONFIG_E1000_NAPI is not set
560# CONFIG_NS83820 is not set
561# CONFIG_HAMACHI is not set
562# CONFIG_YELLOWFIN is not set
563# CONFIG_R8169 is not set
564# CONFIG_SIS190 is not set
565# CONFIG_SKGE is not set
566# CONFIG_SK98LIN is not set
567# CONFIG_VIA_VELOCITY is not set
568CONFIG_TIGON3=y
569# CONFIG_BNX2 is not set
570
571#
572# Ethernet (10000 Mbit)
573#
574# CONFIG_CHELSIO_T1 is not set
575# CONFIG_IXGB is not set
576# CONFIG_S2IO is not set
577
578#
579# Token Ring devices
580#
581# CONFIG_TR is not set
582
583#
584# Wireless LAN (non-hamradio)
585#
586# CONFIG_NET_RADIO is not set
587
588#
589# Wan interfaces
590#
591# CONFIG_WAN is not set
592# CONFIG_FDDI is not set
593# CONFIG_HIPPI is not set
594# CONFIG_PPP is not set
595# CONFIG_SLIP is not set
596# CONFIG_NET_FC is not set
597# CONFIG_SHAPER is not set
598CONFIG_NETCONSOLE=y
599CONFIG_NETPOLL=y
600# CONFIG_NETPOLL_RX is not set
601# CONFIG_NETPOLL_TRAP is not set
602CONFIG_NET_POLL_CONTROLLER=y
603
604#
605# ISDN subsystem
606#
607# CONFIG_ISDN is not set
608
609#
610# Telephony Support
611#
612# CONFIG_PHONE is not set
613
614#
615# Input device support
616#
617CONFIG_INPUT=y
618
619#
620# Userland interfaces
621#
622CONFIG_INPUT_MOUSEDEV=y
623CONFIG_INPUT_MOUSEDEV_PSAUX=y
624CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
625CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
626# CONFIG_INPUT_JOYDEV is not set
627# CONFIG_INPUT_TSDEV is not set
628# CONFIG_INPUT_EVDEV is not set
629# CONFIG_INPUT_EVBUG is not set
630
631#
632# Input Device Drivers
633#
634CONFIG_INPUT_KEYBOARD=y
635CONFIG_KEYBOARD_ATKBD=y
636# CONFIG_KEYBOARD_SUNKBD is not set
637# CONFIG_KEYBOARD_LKKBD is not set
638# CONFIG_KEYBOARD_XTKBD is not set
639# CONFIG_KEYBOARD_NEWTON is not set
640CONFIG_INPUT_MOUSE=y
641CONFIG_MOUSE_PS2=y
642# CONFIG_MOUSE_SERIAL is not set
643# CONFIG_MOUSE_VSXXXAA is not set
644# CONFIG_INPUT_JOYSTICK is not set
645# CONFIG_INPUT_TOUCHSCREEN is not set
646# CONFIG_INPUT_MISC is not set
647
648#
649# Hardware I/O ports
650#
651CONFIG_SERIO=y
652CONFIG_SERIO_I8042=y
653# CONFIG_SERIO_SERPORT is not set
654# CONFIG_SERIO_PCIPS2 is not set
655CONFIG_SERIO_LIBPS2=y
656# CONFIG_SERIO_RAW is not set
657CONFIG_GAMEPORT=m
658# CONFIG_GAMEPORT_NS558 is not set
659# CONFIG_GAMEPORT_L4 is not set
660# CONFIG_GAMEPORT_EMU10K1 is not set
661# CONFIG_GAMEPORT_FM801 is not set
662
663#
664# Character devices
665#
666CONFIG_VT=y
667CONFIG_VT_CONSOLE=y
668CONFIG_HW_CONSOLE=y
669CONFIG_SERIAL_NONSTANDARD=y
670# CONFIG_ROCKETPORT is not set
671# CONFIG_CYCLADES is not set
672# CONFIG_DIGIEPCA is not set
673# CONFIG_MOXA_SMARTIO is not set
674# CONFIG_ISI is not set
675# CONFIG_SYNCLINKMP is not set
676# CONFIG_N_HDLC is not set
677# CONFIG_SPECIALIX is not set
678# CONFIG_SX is not set
679# CONFIG_STALDRV is not set
680CONFIG_SGI_SNSC=y
681CONFIG_SGI_TIOCX=y
682CONFIG_SGI_MBCS=m
683
684#
685# Serial drivers
686#
687CONFIG_SERIAL_8250=y
688CONFIG_SERIAL_8250_CONSOLE=y
689CONFIG_SERIAL_8250_ACPI=y
690CONFIG_SERIAL_8250_NR_UARTS=6
691CONFIG_SERIAL_8250_EXTENDED=y
692CONFIG_SERIAL_8250_SHARE_IRQ=y
693# CONFIG_SERIAL_8250_DETECT_IRQ is not set
694# CONFIG_SERIAL_8250_RSA is not set
695
696#
697# Non-8250 serial port support
698#
699CONFIG_SERIAL_CORE=y
700CONFIG_SERIAL_CORE_CONSOLE=y
701CONFIG_SERIAL_SGI_L1_CONSOLE=y
702# CONFIG_SERIAL_JSM is not set
703CONFIG_SERIAL_SGI_IOC4=y
704CONFIG_UNIX98_PTYS=y
705CONFIG_LEGACY_PTYS=y
706CONFIG_LEGACY_PTY_COUNT=256
707
708#
709# IPMI
710#
711# CONFIG_IPMI_HANDLER is not set
712
713#
714# Watchdog Cards
715#
716# CONFIG_WATCHDOG is not set
717# CONFIG_HW_RANDOM is not set
718CONFIG_EFI_RTC=y
719# CONFIG_DTLK is not set
720# CONFIG_R3964 is not set
721# CONFIG_APPLICOM is not set
722
723#
724# Ftape, the floppy tape device driver
725#
726CONFIG_AGP=m
727CONFIG_AGP_I460=m
728CONFIG_AGP_HP_ZX1=m
729CONFIG_AGP_SGI_TIOCA=m
730CONFIG_DRM=m
731CONFIG_DRM_TDFX=m
732CONFIG_DRM_R128=m
733CONFIG_DRM_RADEON=m
734CONFIG_DRM_MGA=m
735CONFIG_DRM_SIS=m
736# CONFIG_DRM_VIA is not set
737# CONFIG_DRM_SAVAGE is not set
738CONFIG_RAW_DRIVER=m
739CONFIG_HPET=y
740# CONFIG_HPET_RTC_IRQ is not set
741CONFIG_HPET_MMAP=y
742CONFIG_MAX_RAW_DEVS=256
743# CONFIG_HANGCHECK_TIMER is not set
744CONFIG_MMTIMER=y
745
746#
747# TPM devices
748#
749# CONFIG_TCG_TPM is not set
750
751#
752# I2C support
753#
754# CONFIG_I2C is not set
755
756#
757# Dallas's 1-wire bus
758#
759# CONFIG_W1 is not set
760
761#
762# Hardware Monitoring support
763#
764CONFIG_HWMON=y
765# CONFIG_HWMON_VID is not set
766# CONFIG_HWMON_DEBUG_CHIP is not set
767
768#
769# Misc devices
770#
771
772#
773# Multimedia Capabilities Port drivers
774#
775
776#
777# Multimedia devices
778#
779# CONFIG_VIDEO_DEV is not set
780
781#
782# Digital Video Broadcasting Devices
783#
784# CONFIG_DVB is not set
785
786#
787# Graphics support
788#
789# CONFIG_FB is not set
790
791#
792# Console display driver support
793#
794CONFIG_VGA_CONSOLE=y
795CONFIG_DUMMY_CONSOLE=y
796
797#
798# Sound
799#
800CONFIG_SOUND=m
801
802#
803# Advanced Linux Sound Architecture
804#
805CONFIG_SND=m
806CONFIG_SND_TIMER=m
807CONFIG_SND_PCM=m
808CONFIG_SND_HWDEP=m
809CONFIG_SND_RAWMIDI=m
810CONFIG_SND_SEQUENCER=m
811CONFIG_SND_SEQ_DUMMY=m
812CONFIG_SND_OSSEMUL=y
813CONFIG_SND_MIXER_OSS=m
814CONFIG_SND_PCM_OSS=m
815CONFIG_SND_SEQUENCER_OSS=y
816CONFIG_SND_VERBOSE_PRINTK=y
817# CONFIG_SND_DEBUG is not set
818CONFIG_SND_GENERIC_DRIVER=y
819
820#
821# Generic devices
822#
823CONFIG_SND_MPU401_UART=m
824CONFIG_SND_OPL3_LIB=m
825CONFIG_SND_DUMMY=m
826CONFIG_SND_VIRMIDI=m
827CONFIG_SND_MTPAV=m
828CONFIG_SND_SERIAL_U16550=m
829CONFIG_SND_MPU401=m
830CONFIG_SND_AC97_CODEC=m
831CONFIG_SND_AC97_BUS=m
832
833#
834# PCI devices
835#
836# CONFIG_SND_ALI5451 is not set
837# CONFIG_SND_ATIIXP is not set
838# CONFIG_SND_ATIIXP_MODEM is not set
839# CONFIG_SND_AU8810 is not set
840# CONFIG_SND_AU8820 is not set
841# CONFIG_SND_AU8830 is not set
842# CONFIG_SND_AZT3328 is not set
843# CONFIG_SND_BT87X is not set
844CONFIG_SND_CS46XX=m
845CONFIG_SND_CS46XX_NEW_DSP=y
846CONFIG_SND_CS4281=m
847CONFIG_SND_EMU10K1=m
848# CONFIG_SND_EMU10K1X is not set
849# CONFIG_SND_CA0106 is not set
850# CONFIG_SND_KORG1212 is not set
851# CONFIG_SND_MIXART is not set
852# CONFIG_SND_NM256 is not set
853# CONFIG_SND_RME32 is not set
854# CONFIG_SND_RME96 is not set
855# CONFIG_SND_RME9652 is not set
856# CONFIG_SND_HDSP is not set
857# CONFIG_SND_HDSPM is not set
858# CONFIG_SND_TRIDENT is not set
859# CONFIG_SND_YMFPCI is not set
860# CONFIG_SND_AD1889 is not set
861# CONFIG_SND_CMIPCI is not set
862# CONFIG_SND_ENS1370 is not set
863# CONFIG_SND_ENS1371 is not set
864# CONFIG_SND_ES1938 is not set
865# CONFIG_SND_ES1968 is not set
866# CONFIG_SND_MAESTRO3 is not set
867CONFIG_SND_FM801=m
868# CONFIG_SND_FM801_TEA575X is not set
869# CONFIG_SND_ICE1712 is not set
870# CONFIG_SND_ICE1724 is not set
871# CONFIG_SND_INTEL8X0 is not set
872# CONFIG_SND_INTEL8X0M is not set
873# CONFIG_SND_SONICVIBES is not set
874# CONFIG_SND_VIA82XX is not set
875# CONFIG_SND_VIA82XX_MODEM is not set
876# CONFIG_SND_VX222 is not set
877# CONFIG_SND_HDA_INTEL is not set
878
879#
880# USB devices
881#
882# CONFIG_SND_USB_AUDIO is not set
883
884#
885# Open Sound System
886#
887# CONFIG_SOUND_PRIME is not set
888
889#
890# USB support
891#
892CONFIG_USB_ARCH_HAS_HCD=y
893CONFIG_USB_ARCH_HAS_OHCI=y
894CONFIG_USB=m
895# CONFIG_USB_DEBUG is not set
896
897#
898# Miscellaneous USB options
899#
900CONFIG_USB_DEVICEFS=y
901# CONFIG_USB_BANDWIDTH is not set
902# CONFIG_USB_DYNAMIC_MINORS is not set
903# CONFIG_USB_SUSPEND is not set
904# CONFIG_USB_OTG is not set
905
906#
907# USB Host Controller Drivers
908#
909CONFIG_USB_EHCI_HCD=m
910# CONFIG_USB_EHCI_SPLIT_ISO is not set
911# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
912# CONFIG_USB_ISP116X_HCD is not set
913CONFIG_USB_OHCI_HCD=m
914# CONFIG_USB_OHCI_BIG_ENDIAN is not set
915CONFIG_USB_OHCI_LITTLE_ENDIAN=y
916CONFIG_USB_UHCI_HCD=m
917# CONFIG_USB_SL811_HCD is not set
918
919#
920# USB Device Class drivers
921#
922# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
923# CONFIG_USB_BLUETOOTH_TTY is not set
924# CONFIG_USB_ACM is not set
925# CONFIG_USB_PRINTER is not set
926
927#
928# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
929#
930CONFIG_USB_STORAGE=m
931# CONFIG_USB_STORAGE_DEBUG is not set
932# CONFIG_USB_STORAGE_DATAFAB is not set
933# CONFIG_USB_STORAGE_FREECOM is not set
934# CONFIG_USB_STORAGE_ISD200 is not set
935# CONFIG_USB_STORAGE_DPCM is not set
936# CONFIG_USB_STORAGE_USBAT is not set
937# CONFIG_USB_STORAGE_SDDR09 is not set
938# CONFIG_USB_STORAGE_SDDR55 is not set
939# CONFIG_USB_STORAGE_JUMPSHOT is not set
940
941#
942# USB Input Devices
943#
944CONFIG_USB_HID=m
945CONFIG_USB_HIDINPUT=y
946# CONFIG_HID_FF is not set
947# CONFIG_USB_HIDDEV is not set
948
949#
950# USB HID Boot Protocol drivers
951#
952# CONFIG_USB_KBD is not set
953# CONFIG_USB_MOUSE is not set
954# CONFIG_USB_AIPTEK is not set
955# CONFIG_USB_WACOM is not set
956# CONFIG_USB_ACECAD is not set
957# CONFIG_USB_KBTAB is not set
958# CONFIG_USB_POWERMATE is not set
959# CONFIG_USB_MTOUCH is not set
960# CONFIG_USB_ITMTOUCH is not set
961# CONFIG_USB_EGALAX is not set
962# CONFIG_USB_YEALINK is not set
963# CONFIG_USB_XPAD is not set
964# CONFIG_USB_ATI_REMOTE is not set
965# CONFIG_USB_KEYSPAN_REMOTE is not set
966# CONFIG_USB_APPLETOUCH is not set
967
968#
969# USB Imaging devices
970#
971# CONFIG_USB_MDC800 is not set
972# CONFIG_USB_MICROTEK is not set
973
974#
975# USB Multimedia devices
976#
977# CONFIG_USB_DABUSB is not set
978
979#
980# Video4Linux support is needed for USB Multimedia device support
981#
982
983#
984# USB Network Adapters
985#
986# CONFIG_USB_CATC is not set
987# CONFIG_USB_KAWETH is not set
988# CONFIG_USB_PEGASUS is not set
989# CONFIG_USB_RTL8150 is not set
990# CONFIG_USB_USBNET is not set
991CONFIG_USB_MON=y
992
993#
994# USB port drivers
995#
996
997#
998# USB Serial Converter support
999#
1000# CONFIG_USB_SERIAL is not set
1001
1002#
1003# USB Miscellaneous drivers
1004#
1005# CONFIG_USB_EMI62 is not set
1006# CONFIG_USB_EMI26 is not set
1007# CONFIG_USB_AUERSWALD is not set
1008# CONFIG_USB_RIO500 is not set
1009# CONFIG_USB_LEGOTOWER is not set
1010# CONFIG_USB_LCD is not set
1011# CONFIG_USB_LED is not set
1012# CONFIG_USB_CYTHERM is not set
1013# CONFIG_USB_PHIDGETKIT is not set
1014# CONFIG_USB_PHIDGETSERVO is not set
1015# CONFIG_USB_IDMOUSE is not set
1016# CONFIG_USB_SISUSBVGA is not set
1017# CONFIG_USB_LD is not set
1018# CONFIG_USB_TEST is not set
1019
1020#
1021# USB DSL modem support
1022#
1023
1024#
1025# USB Gadget Support
1026#
1027# CONFIG_USB_GADGET is not set
1028
1029#
1030# MMC/SD Card support
1031#
1032# CONFIG_MMC is not set
1033
1034#
1035# InfiniBand support
1036#
1037CONFIG_INFINIBAND=m
1038# CONFIG_INFINIBAND_USER_MAD is not set
1039# CONFIG_INFINIBAND_USER_ACCESS is not set
1040CONFIG_INFINIBAND_MTHCA=m
1041# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
1042CONFIG_INFINIBAND_IPOIB=m
1043# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
1044
1045#
1046# SN Devices
1047#
1048CONFIG_SGI_IOC4=y
1049
1050#
1051# File systems
1052#
1053CONFIG_EXT2_FS=y
1054CONFIG_EXT2_FS_XATTR=y
1055CONFIG_EXT2_FS_POSIX_ACL=y
1056CONFIG_EXT2_FS_SECURITY=y
1057# CONFIG_EXT2_FS_XIP is not set
1058CONFIG_EXT3_FS=y
1059CONFIG_EXT3_FS_XATTR=y
1060CONFIG_EXT3_FS_POSIX_ACL=y
1061CONFIG_EXT3_FS_SECURITY=y
1062CONFIG_JBD=y
1063# CONFIG_JBD_DEBUG is not set
1064CONFIG_FS_MBCACHE=y
1065CONFIG_REISERFS_FS=y
1066# CONFIG_REISERFS_CHECK is not set
1067# CONFIG_REISERFS_PROC_INFO is not set
1068CONFIG_REISERFS_FS_XATTR=y
1069CONFIG_REISERFS_FS_POSIX_ACL=y
1070CONFIG_REISERFS_FS_SECURITY=y
1071# CONFIG_JFS_FS is not set
1072CONFIG_FS_POSIX_ACL=y
1073CONFIG_XFS_FS=y
1074CONFIG_XFS_EXPORT=y
1075# CONFIG_XFS_QUOTA is not set
1076# CONFIG_XFS_SECURITY is not set
1077# CONFIG_XFS_POSIX_ACL is not set
1078# CONFIG_XFS_RT is not set
1079# CONFIG_MINIX_FS is not set
1080# CONFIG_ROMFS_FS is not set
1081CONFIG_INOTIFY=y
1082# CONFIG_QUOTA is not set
1083CONFIG_DNOTIFY=y
1084CONFIG_AUTOFS_FS=y
1085CONFIG_AUTOFS4_FS=y
1086# CONFIG_FUSE_FS is not set
1087
1088#
1089# CD-ROM/DVD Filesystems
1090#
1091CONFIG_ISO9660_FS=m
1092CONFIG_JOLIET=y
1093# CONFIG_ZISOFS is not set
1094CONFIG_UDF_FS=m
1095CONFIG_UDF_NLS=y
1096
1097#
1098# DOS/FAT/NT Filesystems
1099#
1100CONFIG_FAT_FS=y
1101# CONFIG_MSDOS_FS is not set
1102CONFIG_VFAT_FS=y
1103CONFIG_FAT_DEFAULT_CODEPAGE=437
1104CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1105CONFIG_NTFS_FS=m
1106# CONFIG_NTFS_DEBUG is not set
1107# CONFIG_NTFS_RW is not set
1108
1109#
1110# Pseudo filesystems
1111#
1112CONFIG_PROC_FS=y
1113CONFIG_PROC_KCORE=y
1114CONFIG_SYSFS=y
1115CONFIG_TMPFS=y
1116CONFIG_HUGETLBFS=y
1117CONFIG_HUGETLB_PAGE=y
1118CONFIG_RAMFS=y
1119# CONFIG_RELAYFS_FS is not set
1120
1121#
1122# Miscellaneous filesystems
1123#
1124# CONFIG_ADFS_FS is not set
1125# CONFIG_AFFS_FS is not set
1126# CONFIG_HFS_FS is not set
1127# CONFIG_HFSPLUS_FS is not set
1128# CONFIG_BEFS_FS is not set
1129# CONFIG_BFS_FS is not set
1130# CONFIG_EFS_FS is not set
1131# CONFIG_CRAMFS is not set
1132# CONFIG_VXFS_FS is not set
1133# CONFIG_HPFS_FS is not set
1134# CONFIG_QNX4FS_FS is not set
1135# CONFIG_SYSV_FS is not set
1136# CONFIG_UFS_FS is not set
1137
1138#
1139# Network File Systems
1140#
1141CONFIG_NFS_FS=m
1142CONFIG_NFS_V3=y
1143# CONFIG_NFS_V3_ACL is not set
1144CONFIG_NFS_V4=y
1145CONFIG_NFS_DIRECTIO=y
1146CONFIG_NFSD=m
1147CONFIG_NFSD_V3=y
1148# CONFIG_NFSD_V3_ACL is not set
1149CONFIG_NFSD_V4=y
1150CONFIG_NFSD_TCP=y
1151CONFIG_LOCKD=m
1152CONFIG_LOCKD_V4=y
1153CONFIG_EXPORTFS=y
1154CONFIG_NFS_COMMON=y
1155CONFIG_SUNRPC=m
1156CONFIG_SUNRPC_GSS=m
1157CONFIG_RPCSEC_GSS_KRB5=m
1158# CONFIG_RPCSEC_GSS_SPKM3 is not set
1159CONFIG_SMB_FS=m
1160CONFIG_SMB_NLS_DEFAULT=y
1161CONFIG_SMB_NLS_REMOTE="cp437"
1162CONFIG_CIFS=m
1163# CONFIG_CIFS_STATS is not set
1164# CONFIG_CIFS_XATTR is not set
1165# CONFIG_CIFS_EXPERIMENTAL is not set
1166# CONFIG_NCP_FS is not set
1167# CONFIG_CODA_FS is not set
1168# CONFIG_AFS_FS is not set
1169# CONFIG_9P_FS is not set
1170
1171#
1172# Partition Types
1173#
1174CONFIG_PARTITION_ADVANCED=y
1175# CONFIG_ACORN_PARTITION is not set
1176# CONFIG_OSF_PARTITION is not set
1177# CONFIG_AMIGA_PARTITION is not set
1178# CONFIG_ATARI_PARTITION is not set
1179# CONFIG_MAC_PARTITION is not set
1180CONFIG_MSDOS_PARTITION=y
1181# CONFIG_BSD_DISKLABEL is not set
1182# CONFIG_MINIX_SUBPARTITION is not set
1183# CONFIG_SOLARIS_X86_PARTITION is not set
1184# CONFIG_UNIXWARE_DISKLABEL is not set
1185# CONFIG_LDM_PARTITION is not set
1186CONFIG_SGI_PARTITION=y
1187# CONFIG_ULTRIX_PARTITION is not set
1188# CONFIG_SUN_PARTITION is not set
1189CONFIG_EFI_PARTITION=y
1190
1191#
1192# Native Language Support
1193#
1194CONFIG_NLS=y
1195CONFIG_NLS_DEFAULT="iso8859-1"
1196CONFIG_NLS_CODEPAGE_437=y
1197CONFIG_NLS_CODEPAGE_737=m
1198CONFIG_NLS_CODEPAGE_775=m
1199CONFIG_NLS_CODEPAGE_850=m
1200CONFIG_NLS_CODEPAGE_852=m
1201CONFIG_NLS_CODEPAGE_855=m
1202CONFIG_NLS_CODEPAGE_857=m
1203CONFIG_NLS_CODEPAGE_860=m
1204CONFIG_NLS_CODEPAGE_861=m
1205CONFIG_NLS_CODEPAGE_862=m
1206CONFIG_NLS_CODEPAGE_863=m
1207CONFIG_NLS_CODEPAGE_864=m
1208CONFIG_NLS_CODEPAGE_865=m
1209CONFIG_NLS_CODEPAGE_866=m
1210CONFIG_NLS_CODEPAGE_869=m
1211CONFIG_NLS_CODEPAGE_936=m
1212CONFIG_NLS_CODEPAGE_950=m
1213CONFIG_NLS_CODEPAGE_932=m
1214CONFIG_NLS_CODEPAGE_949=m
1215CONFIG_NLS_CODEPAGE_874=m
1216CONFIG_NLS_ISO8859_8=m
1217CONFIG_NLS_CODEPAGE_1250=m
1218CONFIG_NLS_CODEPAGE_1251=m
1219# CONFIG_NLS_ASCII is not set
1220CONFIG_NLS_ISO8859_1=y
1221CONFIG_NLS_ISO8859_2=m
1222CONFIG_NLS_ISO8859_3=m
1223CONFIG_NLS_ISO8859_4=m
1224CONFIG_NLS_ISO8859_5=m
1225CONFIG_NLS_ISO8859_6=m
1226CONFIG_NLS_ISO8859_7=m
1227CONFIG_NLS_ISO8859_9=m
1228CONFIG_NLS_ISO8859_13=m
1229CONFIG_NLS_ISO8859_14=m
1230CONFIG_NLS_ISO8859_15=m
1231CONFIG_NLS_KOI8_R=m
1232CONFIG_NLS_KOI8_U=m
1233CONFIG_NLS_UTF8=m
1234
1235#
1236# Library routines
1237#
1238# CONFIG_CRC_CCITT is not set
1239# CONFIG_CRC16 is not set
1240CONFIG_CRC32=y
1241# CONFIG_LIBCRC32C is not set
1242CONFIG_GENERIC_HARDIRQS=y
1243CONFIG_GENERIC_IRQ_PROBE=y
1244CONFIG_GENERIC_PENDING_IRQ=y
1245
1246#
1247# HP Simulator drivers
1248#
1249# CONFIG_HP_SIMETH is not set
1250# CONFIG_HP_SIMSERIAL is not set
1251# CONFIG_HP_SIMSCSI is not set
1252
1253#
1254# Profiling support
1255#
1256# CONFIG_PROFILING is not set
1257
1258#
1259# Kernel hacking
1260#
1261# CONFIG_PRINTK_TIME is not set
1262CONFIG_DEBUG_KERNEL=y
1263CONFIG_MAGIC_SYSRQ=y
1264CONFIG_LOG_BUF_SHIFT=20
1265CONFIG_DETECT_SOFTLOCKUP=y
1266# CONFIG_SCHEDSTATS is not set
1267# CONFIG_DEBUG_SLAB is not set
1268# CONFIG_DEBUG_SPINLOCK is not set
1269# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1270# CONFIG_DEBUG_KOBJECT is not set
1271# CONFIG_DEBUG_INFO is not set
1272# CONFIG_DEBUG_FS is not set
1273# CONFIG_KPROBES is not set
1274CONFIG_IA64_GRANULE_16MB=y
1275# CONFIG_IA64_GRANULE_64MB is not set
1276# CONFIG_IA64_PRINT_HAZARDS is not set
1277# CONFIG_DISABLE_VHPT is not set
1278# CONFIG_IA64_DEBUG_CMPXCHG is not set
1279# CONFIG_IA64_DEBUG_IRQ is not set
1280CONFIG_SYSVIPC_COMPAT=y
1281
1282#
1283# Security options
1284#
1285# CONFIG_KEYS is not set
1286# CONFIG_SECURITY is not set
1287
1288#
1289# Cryptographic options
1290#
1291CONFIG_CRYPTO=y
1292# CONFIG_CRYPTO_HMAC is not set
1293# CONFIG_CRYPTO_NULL is not set
1294# CONFIG_CRYPTO_MD4 is not set
1295CONFIG_CRYPTO_MD5=y
1296# CONFIG_CRYPTO_SHA1 is not set
1297# CONFIG_CRYPTO_SHA256 is not set
1298# CONFIG_CRYPTO_SHA512 is not set
1299# CONFIG_CRYPTO_WP512 is not set
1300# CONFIG_CRYPTO_TGR192 is not set
1301CONFIG_CRYPTO_DES=m
1302# CONFIG_CRYPTO_BLOWFISH is not set
1303# CONFIG_CRYPTO_TWOFISH is not set
1304# CONFIG_CRYPTO_SERPENT is not set
1305# CONFIG_CRYPTO_AES is not set
1306# CONFIG_CRYPTO_CAST5 is not set
1307# CONFIG_CRYPTO_CAST6 is not set
1308# CONFIG_CRYPTO_TEA is not set
1309# CONFIG_CRYPTO_ARC4 is not set
1310# CONFIG_CRYPTO_KHAZAD is not set
1311# CONFIG_CRYPTO_ANUBIS is not set
1312# CONFIG_CRYPTO_DEFLATE is not set
1313# CONFIG_CRYPTO_MICHAEL_MIC is not set
1314# CONFIG_CRYPTO_CRC32C is not set
1315# CONFIG_CRYPTO_TEST is not set
1316
1317#
1318# Hardware crypto devices
1319#
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index d452e18ac494..9bc8bcafc905 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.13-rc6-tiger-smp 3# Linux kernel version: 2.6.14-rc1
4# Wed Aug 17 10:19:51 2005 4# Wed Sep 14 15:17:57 2005
5# 5#
6 6
7# 7#
@@ -16,6 +16,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
16# General setup 16# General setup
17# 17#
18CONFIG_LOCALVERSION="" 18CONFIG_LOCALVERSION=""
19CONFIG_LOCALVERSION_AUTO=y
19CONFIG_SWAP=y 20CONFIG_SWAP=y
20CONFIG_SYSVIPC=y 21CONFIG_SYSVIPC=y
21CONFIG_POSIX_MQUEUE=y 22CONFIG_POSIX_MQUEUE=y
@@ -27,6 +28,7 @@ CONFIG_KOBJECT_UEVENT=y
27CONFIG_IKCONFIG=y 28CONFIG_IKCONFIG=y
28CONFIG_IKCONFIG_PROC=y 29CONFIG_IKCONFIG_PROC=y
29# CONFIG_CPUSETS is not set 30# CONFIG_CPUSETS is not set
31CONFIG_INITRAMFS_SOURCE=""
30# CONFIG_EMBEDDED is not set 32# CONFIG_EMBEDDED is not set
31CONFIG_KALLSYMS=y 33CONFIG_KALLSYMS=y
32CONFIG_KALLSYMS_ALL=y 34CONFIG_KALLSYMS_ALL=y
@@ -103,6 +105,7 @@ CONFIG_FLATMEM_MANUAL=y
103# CONFIG_SPARSEMEM_MANUAL is not set 105# CONFIG_SPARSEMEM_MANUAL is not set
104CONFIG_FLATMEM=y 106CONFIG_FLATMEM=y
105CONFIG_FLAT_NODE_MEM_MAP=y 107CONFIG_FLAT_NODE_MEM_MAP=y
108# CONFIG_SPARSEMEM_STATIC is not set
106CONFIG_HAVE_DEC_LOCK=y 109CONFIG_HAVE_DEC_LOCK=y
107CONFIG_IA32_SUPPORT=y 110CONFIG_IA32_SUPPORT=y
108CONFIG_COMPAT=y 111CONFIG_COMPAT=y
@@ -115,6 +118,7 @@ CONFIG_IA64_PALINFO=y
115# 118#
116CONFIG_EFI_VARS=y 119CONFIG_EFI_VARS=y
117CONFIG_EFI_PCDP=y 120CONFIG_EFI_PCDP=y
121# CONFIG_DELL_RBU is not set
118CONFIG_BINFMT_ELF=y 122CONFIG_BINFMT_ELF=y
119CONFIG_BINFMT_MISC=m 123CONFIG_BINFMT_MISC=m
120 124
@@ -122,20 +126,27 @@ CONFIG_BINFMT_MISC=m
122# Power management and ACPI 126# Power management and ACPI
123# 127#
124CONFIG_PM=y 128CONFIG_PM=y
125CONFIG_ACPI=y 129# CONFIG_PM_DEBUG is not set
126 130
127# 131#
128# ACPI (Advanced Configuration and Power Interface) Support 132# ACPI (Advanced Configuration and Power Interface) Support
129# 133#
134CONFIG_ACPI=y
130CONFIG_ACPI_BUTTON=m 135CONFIG_ACPI_BUTTON=m
131CONFIG_ACPI_FAN=m 136CONFIG_ACPI_FAN=m
132CONFIG_ACPI_PROCESSOR=m 137CONFIG_ACPI_PROCESSOR=m
133# CONFIG_ACPI_HOTPLUG_CPU is not set 138CONFIG_ACPI_HOTPLUG_CPU=y
134CONFIG_ACPI_THERMAL=m 139CONFIG_ACPI_THERMAL=m
140CONFIG_ACPI_BLACKLIST_YEAR=0
135# CONFIG_ACPI_DEBUG is not set 141# CONFIG_ACPI_DEBUG is not set
136CONFIG_ACPI_POWER=y 142CONFIG_ACPI_POWER=y
137CONFIG_ACPI_SYSTEM=y 143CONFIG_ACPI_SYSTEM=y
138# CONFIG_ACPI_CONTAINER is not set 144CONFIG_ACPI_CONTAINER=m
145
146#
147# CPU Frequency scaling
148#
149# CONFIG_CPU_FREQ is not set
139 150
140# 151#
141# Bus options (PCI, PCMCIA) 152# Bus options (PCI, PCMCIA)
@@ -144,7 +155,6 @@ CONFIG_PCI=y
144CONFIG_PCI_DOMAINS=y 155CONFIG_PCI_DOMAINS=y
145# CONFIG_PCI_MSI is not set 156# CONFIG_PCI_MSI is not set
146CONFIG_PCI_LEGACY_PROC=y 157CONFIG_PCI_LEGACY_PROC=y
147CONFIG_PCI_NAMES=y
148# CONFIG_PCI_DEBUG is not set 158# CONFIG_PCI_DEBUG is not set
149 159
150# 160#
@@ -188,14 +198,19 @@ CONFIG_SYN_COOKIES=y
188# CONFIG_INET_ESP is not set 198# CONFIG_INET_ESP is not set
189# CONFIG_INET_IPCOMP is not set 199# CONFIG_INET_IPCOMP is not set
190# CONFIG_INET_TUNNEL is not set 200# CONFIG_INET_TUNNEL is not set
191CONFIG_IP_TCPDIAG=y 201CONFIG_INET_DIAG=y
192# CONFIG_IP_TCPDIAG_IPV6 is not set 202CONFIG_INET_TCP_DIAG=y
193# CONFIG_TCP_CONG_ADVANCED is not set 203# CONFIG_TCP_CONG_ADVANCED is not set
194CONFIG_TCP_CONG_BIC=y 204CONFIG_TCP_CONG_BIC=y
195# CONFIG_IPV6 is not set 205# CONFIG_IPV6 is not set
196# CONFIG_NETFILTER is not set 206# CONFIG_NETFILTER is not set
197 207
198# 208#
209# DCCP Configuration (EXPERIMENTAL)
210#
211# CONFIG_IP_DCCP is not set
212
213#
199# SCTP Configuration (EXPERIMENTAL) 214# SCTP Configuration (EXPERIMENTAL)
200# 215#
201# CONFIG_IP_SCTP is not set 216# CONFIG_IP_SCTP is not set
@@ -218,9 +233,11 @@ CONFIG_TCP_CONG_BIC=y
218# Network testing 233# Network testing
219# 234#
220# CONFIG_NET_PKTGEN is not set 235# CONFIG_NET_PKTGEN is not set
236# CONFIG_NETFILTER_NETLINK is not set
221# CONFIG_HAMRADIO is not set 237# CONFIG_HAMRADIO is not set
222# CONFIG_IRDA is not set 238# CONFIG_IRDA is not set
223# CONFIG_BT is not set 239# CONFIG_BT is not set
240# CONFIG_IEEE80211 is not set
224 241
225# 242#
226# Device Drivers 243# Device Drivers
@@ -235,6 +252,11 @@ CONFIG_FW_LOADER=m
235# CONFIG_DEBUG_DRIVER is not set 252# CONFIG_DEBUG_DRIVER is not set
236 253
237# 254#
255# Connector - unified userspace <-> kernelspace linker
256#
257# CONFIG_CONNECTOR is not set
258
259#
238# Memory Technology Devices (MTD) 260# Memory Technology Devices (MTD)
239# 261#
240# CONFIG_MTD is not set 262# CONFIG_MTD is not set
@@ -247,7 +269,13 @@ CONFIG_FW_LOADER=m
247# 269#
248# Plug and Play support 270# Plug and Play support
249# 271#
250# CONFIG_PNP is not set 272CONFIG_PNP=y
273# CONFIG_PNP_DEBUG is not set
274
275#
276# Protocols
277#
278CONFIG_PNPACPI=y
251 279
252# 280#
253# Block devices 281# Block devices
@@ -266,7 +294,6 @@ CONFIG_BLK_DEV_RAM=y
266CONFIG_BLK_DEV_RAM_COUNT=16 294CONFIG_BLK_DEV_RAM_COUNT=16
267CONFIG_BLK_DEV_RAM_SIZE=4096 295CONFIG_BLK_DEV_RAM_SIZE=4096
268CONFIG_BLK_DEV_INITRD=y 296CONFIG_BLK_DEV_INITRD=y
269CONFIG_INITRAMFS_SOURCE=""
270# CONFIG_CDROM_PKTCDVD is not set 297# CONFIG_CDROM_PKTCDVD is not set
271 298
272# 299#
@@ -299,7 +326,8 @@ CONFIG_BLK_DEV_IDESCSI=m
299# 326#
300# IDE chipset support/bugfixes 327# IDE chipset support/bugfixes
301# 328#
302CONFIG_IDE_GENERIC=y 329# CONFIG_IDE_GENERIC is not set
330# CONFIG_BLK_DEV_IDEPNP is not set
303CONFIG_BLK_DEV_IDEPCI=y 331CONFIG_BLK_DEV_IDEPCI=y
304# CONFIG_IDEPCI_SHARE_IRQ is not set 332# CONFIG_IDEPCI_SHARE_IRQ is not set
305# CONFIG_BLK_DEV_OFFBOARD is not set 333# CONFIG_BLK_DEV_OFFBOARD is not set
@@ -339,6 +367,7 @@ CONFIG_IDEDMA_AUTO=y
339# 367#
340# SCSI device support 368# SCSI device support
341# 369#
370# CONFIG_RAID_ATTRS is not set
342CONFIG_SCSI=y 371CONFIG_SCSI=y
343CONFIG_SCSI_PROC_FS=y 372CONFIG_SCSI_PROC_FS=y
344 373
@@ -366,6 +395,7 @@ CONFIG_CHR_DEV_SG=m
366CONFIG_SCSI_SPI_ATTRS=y 395CONFIG_SCSI_SPI_ATTRS=y
367CONFIG_SCSI_FC_ATTRS=y 396CONFIG_SCSI_FC_ATTRS=y
368# CONFIG_SCSI_ISCSI_ATTRS is not set 397# CONFIG_SCSI_ISCSI_ATTRS is not set
398# CONFIG_SCSI_SAS_ATTRS is not set
369 399
370# 400#
371# SCSI low-level drivers 401# SCSI low-level drivers
@@ -454,6 +484,7 @@ CONFIG_DUMMY=m
454# CONFIG_BONDING is not set 484# CONFIG_BONDING is not set
455# CONFIG_EQUALIZER is not set 485# CONFIG_EQUALIZER is not set
456# CONFIG_TUN is not set 486# CONFIG_TUN is not set
487# CONFIG_NET_SB1000 is not set
457 488
458# 489#
459# ARCnet devices 490# ARCnet devices
@@ -461,6 +492,11 @@ CONFIG_DUMMY=m
461# CONFIG_ARCNET is not set 492# CONFIG_ARCNET is not set
462 493
463# 494#
495# PHY device support
496#
497# CONFIG_PHYLIB is not set
498
499#
464# Ethernet (10 or 100Mbit) 500# Ethernet (10 or 100Mbit)
465# 501#
466CONFIG_NET_ETHERNET=y 502CONFIG_NET_ETHERNET=y
@@ -481,6 +517,7 @@ CONFIG_TULIP=m
481# CONFIG_DE4X5 is not set 517# CONFIG_DE4X5 is not set
482# CONFIG_WINBOND_840 is not set 518# CONFIG_WINBOND_840 is not set
483# CONFIG_DM9102 is not set 519# CONFIG_DM9102 is not set
520# CONFIG_ULI526X is not set
484# CONFIG_HP100 is not set 521# CONFIG_HP100 is not set
485CONFIG_NET_PCI=y 522CONFIG_NET_PCI=y
486# CONFIG_PCNET32 is not set 523# CONFIG_PCNET32 is not set
@@ -512,6 +549,7 @@ CONFIG_E1000=y
512# CONFIG_HAMACHI is not set 549# CONFIG_HAMACHI is not set
513# CONFIG_YELLOWFIN is not set 550# CONFIG_YELLOWFIN is not set
514# CONFIG_R8169 is not set 551# CONFIG_R8169 is not set
552# CONFIG_SIS190 is not set
515# CONFIG_SKGE is not set 553# CONFIG_SKGE is not set
516# CONFIG_SK98LIN is not set 554# CONFIG_SK98LIN is not set
517# CONFIG_VIA_VELOCITY is not set 555# CONFIG_VIA_VELOCITY is not set
@@ -521,6 +559,7 @@ CONFIG_TIGON3=y
521# 559#
522# Ethernet (10000 Mbit) 560# Ethernet (10000 Mbit)
523# 561#
562# CONFIG_CHELSIO_T1 is not set
524# CONFIG_IXGB is not set 563# CONFIG_IXGB is not set
525# CONFIG_S2IO is not set 564# CONFIG_S2IO is not set
526 565
@@ -618,6 +657,7 @@ CONFIG_HW_CONSOLE=y
618CONFIG_SERIAL_NONSTANDARD=y 657CONFIG_SERIAL_NONSTANDARD=y
619# CONFIG_ROCKETPORT is not set 658# CONFIG_ROCKETPORT is not set
620# CONFIG_CYCLADES is not set 659# CONFIG_CYCLADES is not set
660# CONFIG_DIGIEPCA is not set
621# CONFIG_MOXA_SMARTIO is not set 661# CONFIG_MOXA_SMARTIO is not set
622# CONFIG_ISI is not set 662# CONFIG_ISI is not set
623# CONFIG_SYNCLINKMP is not set 663# CONFIG_SYNCLINKMP is not set
@@ -675,6 +715,7 @@ CONFIG_DRM_RADEON=m
675CONFIG_DRM_MGA=m 715CONFIG_DRM_MGA=m
676CONFIG_DRM_SIS=m 716CONFIG_DRM_SIS=m
677# CONFIG_DRM_VIA is not set 717# CONFIG_DRM_VIA is not set
718# CONFIG_DRM_SAVAGE is not set
678CONFIG_RAW_DRIVER=m 719CONFIG_RAW_DRIVER=m
679CONFIG_HPET=y 720CONFIG_HPET=y
680# CONFIG_HPET_RTC_IRQ is not set 721# CONFIG_HPET_RTC_IRQ is not set
@@ -691,7 +732,6 @@ CONFIG_MAX_RAW_DEVS=256
691# I2C support 732# I2C support
692# 733#
693# CONFIG_I2C is not set 734# CONFIG_I2C is not set
694# CONFIG_I2C_SENSOR is not set
695 735
696# 736#
697# Dallas's 1-wire bus 737# Dallas's 1-wire bus
@@ -702,6 +742,7 @@ CONFIG_MAX_RAW_DEVS=256
702# Hardware Monitoring support 742# Hardware Monitoring support
703# 743#
704CONFIG_HWMON=y 744CONFIG_HWMON=y
745# CONFIG_HWMON_VID is not set
705# CONFIG_HWMON_DEBUG_CHIP is not set 746# CONFIG_HWMON_DEBUG_CHIP is not set
706 747
707# 748#
@@ -709,6 +750,10 @@ CONFIG_HWMON=y
709# 750#
710 751
711# 752#
753# Multimedia Capabilities Port drivers
754#
755
756#
712# Multimedia devices 757# Multimedia devices
713# 758#
714# CONFIG_VIDEO_DEV is not set 759# CONFIG_VIDEO_DEV is not set
@@ -800,9 +845,11 @@ CONFIG_USB_HIDINPUT=y
800# CONFIG_USB_MTOUCH is not set 845# CONFIG_USB_MTOUCH is not set
801# CONFIG_USB_ITMTOUCH is not set 846# CONFIG_USB_ITMTOUCH is not set
802# CONFIG_USB_EGALAX is not set 847# CONFIG_USB_EGALAX is not set
848# CONFIG_USB_YEALINK is not set
803# CONFIG_USB_XPAD is not set 849# CONFIG_USB_XPAD is not set
804# CONFIG_USB_ATI_REMOTE is not set 850# CONFIG_USB_ATI_REMOTE is not set
805# CONFIG_USB_KEYSPAN_REMOTE is not set 851# CONFIG_USB_KEYSPAN_REMOTE is not set
852# CONFIG_USB_APPLETOUCH is not set
806 853
807# 854#
808# USB Imaging devices 855# USB Imaging devices
@@ -902,16 +949,12 @@ CONFIG_REISERFS_FS_POSIX_ACL=y
902CONFIG_REISERFS_FS_SECURITY=y 949CONFIG_REISERFS_FS_SECURITY=y
903# CONFIG_JFS_FS is not set 950# CONFIG_JFS_FS is not set
904CONFIG_FS_POSIX_ACL=y 951CONFIG_FS_POSIX_ACL=y
905
906#
907# XFS support
908#
909CONFIG_XFS_FS=y 952CONFIG_XFS_FS=y
910CONFIG_XFS_EXPORT=y 953CONFIG_XFS_EXPORT=y
911# CONFIG_XFS_RT is not set
912# CONFIG_XFS_QUOTA is not set 954# CONFIG_XFS_QUOTA is not set
913# CONFIG_XFS_SECURITY is not set 955# CONFIG_XFS_SECURITY is not set
914# CONFIG_XFS_POSIX_ACL is not set 956# CONFIG_XFS_POSIX_ACL is not set
957# CONFIG_XFS_RT is not set
915# CONFIG_MINIX_FS is not set 958# CONFIG_MINIX_FS is not set
916# CONFIG_ROMFS_FS is not set 959# CONFIG_ROMFS_FS is not set
917CONFIG_INOTIFY=y 960CONFIG_INOTIFY=y
@@ -919,6 +962,7 @@ CONFIG_INOTIFY=y
919CONFIG_DNOTIFY=y 962CONFIG_DNOTIFY=y
920CONFIG_AUTOFS_FS=y 963CONFIG_AUTOFS_FS=y
921CONFIG_AUTOFS4_FS=y 964CONFIG_AUTOFS4_FS=y
965# CONFIG_FUSE_FS is not set
922 966
923# 967#
924# CD-ROM/DVD Filesystems 968# CD-ROM/DVD Filesystems
@@ -947,13 +991,11 @@ CONFIG_NTFS_FS=m
947CONFIG_PROC_FS=y 991CONFIG_PROC_FS=y
948CONFIG_PROC_KCORE=y 992CONFIG_PROC_KCORE=y
949CONFIG_SYSFS=y 993CONFIG_SYSFS=y
950# CONFIG_DEVPTS_FS_XATTR is not set
951CONFIG_TMPFS=y 994CONFIG_TMPFS=y
952CONFIG_TMPFS_XATTR=y
953CONFIG_TMPFS_SECURITY=y
954CONFIG_HUGETLBFS=y 995CONFIG_HUGETLBFS=y
955CONFIG_HUGETLB_PAGE=y 996CONFIG_HUGETLB_PAGE=y
956CONFIG_RAMFS=y 997CONFIG_RAMFS=y
998# CONFIG_RELAYFS_FS is not set
957 999
958# 1000#
959# Miscellaneous filesystems 1001# Miscellaneous filesystems
@@ -1003,6 +1045,7 @@ CONFIG_CIFS=m
1003# CONFIG_NCP_FS is not set 1045# CONFIG_NCP_FS is not set
1004# CONFIG_CODA_FS is not set 1046# CONFIG_CODA_FS is not set
1005# CONFIG_AFS_FS is not set 1047# CONFIG_AFS_FS is not set
1048# CONFIG_9P_FS is not set
1006 1049
1007# 1050#
1008# Partition Types 1051# Partition Types
@@ -1072,10 +1115,12 @@ CONFIG_NLS_UTF8=m
1072# Library routines 1115# Library routines
1073# 1116#
1074# CONFIG_CRC_CCITT is not set 1117# CONFIG_CRC_CCITT is not set
1118# CONFIG_CRC16 is not set
1075CONFIG_CRC32=y 1119CONFIG_CRC32=y
1076# CONFIG_LIBCRC32C is not set 1120# CONFIG_LIBCRC32C is not set
1077CONFIG_GENERIC_HARDIRQS=y 1121CONFIG_GENERIC_HARDIRQS=y
1078CONFIG_GENERIC_IRQ_PROBE=y 1122CONFIG_GENERIC_IRQ_PROBE=y
1123CONFIG_GENERIC_PENDING_IRQ=y
1079 1124
1080# 1125#
1081# Profiling support 1126# Profiling support
@@ -1089,6 +1134,7 @@ CONFIG_GENERIC_IRQ_PROBE=y
1089CONFIG_DEBUG_KERNEL=y 1134CONFIG_DEBUG_KERNEL=y
1090CONFIG_MAGIC_SYSRQ=y 1135CONFIG_MAGIC_SYSRQ=y
1091CONFIG_LOG_BUF_SHIFT=20 1136CONFIG_LOG_BUF_SHIFT=20
1137CONFIG_DETECT_SOFTLOCKUP=y
1092# CONFIG_SCHEDSTATS is not set 1138# CONFIG_SCHEDSTATS is not set
1093# CONFIG_DEBUG_SLAB is not set 1139# CONFIG_DEBUG_SLAB is not set
1094# CONFIG_DEBUG_SPINLOCK is not set 1140# CONFIG_DEBUG_SPINLOCK is not set
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index 80b0e9eb7fb3..0856ca67dd50 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.13-rc6 3# Linux kernel version: 2.6.14-rc1
4# Wed Aug 17 10:02:43 2005 4# Wed Sep 14 15:15:01 2005
5# 5#
6 6
7# 7#
@@ -18,6 +18,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
18# General setup 18# General setup
19# 19#
20CONFIG_LOCALVERSION="" 20CONFIG_LOCALVERSION=""
21CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y 22CONFIG_SWAP=y
22CONFIG_SYSVIPC=y 23CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set 24# CONFIG_POSIX_MQUEUE is not set
@@ -29,6 +30,7 @@ CONFIG_HOTPLUG=y
29CONFIG_KOBJECT_UEVENT=y 30CONFIG_KOBJECT_UEVENT=y
30# CONFIG_IKCONFIG is not set 31# CONFIG_IKCONFIG is not set
31# CONFIG_CPUSETS is not set 32# CONFIG_CPUSETS is not set
33CONFIG_INITRAMFS_SOURCE=""
32# CONFIG_EMBEDDED is not set 34# CONFIG_EMBEDDED is not set
33CONFIG_KALLSYMS=y 35CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_ALL is not set 36# CONFIG_KALLSYMS_ALL is not set
@@ -103,6 +105,7 @@ CONFIG_FLATMEM_MANUAL=y
103# CONFIG_SPARSEMEM_MANUAL is not set 105# CONFIG_SPARSEMEM_MANUAL is not set
104CONFIG_FLATMEM=y 106CONFIG_FLATMEM=y
105CONFIG_FLAT_NODE_MEM_MAP=y 107CONFIG_FLAT_NODE_MEM_MAP=y
108# CONFIG_SPARSEMEM_STATIC is not set
106CONFIG_HAVE_DEC_LOCK=y 109CONFIG_HAVE_DEC_LOCK=y
107CONFIG_IA32_SUPPORT=y 110CONFIG_IA32_SUPPORT=y
108CONFIG_COMPAT=y 111CONFIG_COMPAT=y
@@ -115,6 +118,7 @@ CONFIG_IA64_PALINFO=y
115# 118#
116CONFIG_EFI_VARS=y 119CONFIG_EFI_VARS=y
117CONFIG_EFI_PCDP=y 120CONFIG_EFI_PCDP=y
121# CONFIG_DELL_RBU is not set
118CONFIG_BINFMT_ELF=y 122CONFIG_BINFMT_ELF=y
119CONFIG_BINFMT_MISC=y 123CONFIG_BINFMT_MISC=y
120 124
@@ -122,28 +126,34 @@ CONFIG_BINFMT_MISC=y
122# Power management and ACPI 126# Power management and ACPI
123# 127#
124CONFIG_PM=y 128CONFIG_PM=y
125CONFIG_ACPI=y 129# CONFIG_PM_DEBUG is not set
126 130
127# 131#
128# ACPI (Advanced Configuration and Power Interface) Support 132# ACPI (Advanced Configuration and Power Interface) Support
129# 133#
134CONFIG_ACPI=y
130CONFIG_ACPI_BUTTON=y 135CONFIG_ACPI_BUTTON=y
131CONFIG_ACPI_FAN=y 136CONFIG_ACPI_FAN=y
132CONFIG_ACPI_PROCESSOR=y 137CONFIG_ACPI_PROCESSOR=y
133CONFIG_ACPI_THERMAL=y 138CONFIG_ACPI_THERMAL=y
139CONFIG_ACPI_BLACKLIST_YEAR=0
134# CONFIG_ACPI_DEBUG is not set 140# CONFIG_ACPI_DEBUG is not set
135CONFIG_ACPI_POWER=y 141CONFIG_ACPI_POWER=y
136CONFIG_ACPI_SYSTEM=y 142CONFIG_ACPI_SYSTEM=y
137# CONFIG_ACPI_CONTAINER is not set 143# CONFIG_ACPI_CONTAINER is not set
138 144
139# 145#
146# CPU Frequency scaling
147#
148# CONFIG_CPU_FREQ is not set
149
150#
140# Bus options (PCI, PCMCIA) 151# Bus options (PCI, PCMCIA)
141# 152#
142CONFIG_PCI=y 153CONFIG_PCI=y
143CONFIG_PCI_DOMAINS=y 154CONFIG_PCI_DOMAINS=y
144# CONFIG_PCI_MSI is not set 155# CONFIG_PCI_MSI is not set
145CONFIG_PCI_LEGACY_PROC=y 156CONFIG_PCI_LEGACY_PROC=y
146CONFIG_PCI_NAMES=y
147# CONFIG_PCI_DEBUG is not set 157# CONFIG_PCI_DEBUG is not set
148 158
149# 159#
@@ -187,8 +197,8 @@ CONFIG_IP_FIB_HASH=y
187# CONFIG_INET_ESP is not set 197# CONFIG_INET_ESP is not set
188# CONFIG_INET_IPCOMP is not set 198# CONFIG_INET_IPCOMP is not set
189# CONFIG_INET_TUNNEL is not set 199# CONFIG_INET_TUNNEL is not set
190# CONFIG_IP_TCPDIAG is not set 200CONFIG_INET_DIAG=y
191# CONFIG_IP_TCPDIAG_IPV6 is not set 201CONFIG_INET_TCP_DIAG=y
192# CONFIG_TCP_CONG_ADVANCED is not set 202# CONFIG_TCP_CONG_ADVANCED is not set
193CONFIG_TCP_CONG_BIC=y 203CONFIG_TCP_CONG_BIC=y
194 204
@@ -204,7 +214,6 @@ CONFIG_NETFILTER=y
204# IP: Netfilter Configuration 214# IP: Netfilter Configuration
205# 215#
206# CONFIG_IP_NF_CONNTRACK is not set 216# CONFIG_IP_NF_CONNTRACK is not set
207# CONFIG_IP_NF_CONNTRACK_MARK is not set
208# CONFIG_IP_NF_QUEUE is not set 217# CONFIG_IP_NF_QUEUE is not set
209# CONFIG_IP_NF_IPTABLES is not set 218# CONFIG_IP_NF_IPTABLES is not set
210CONFIG_IP_NF_ARPTABLES=y 219CONFIG_IP_NF_ARPTABLES=y
@@ -212,6 +221,11 @@ CONFIG_IP_NF_ARPTABLES=y
212# CONFIG_IP_NF_ARP_MANGLE is not set 221# CONFIG_IP_NF_ARP_MANGLE is not set
213 222
214# 223#
224# DCCP Configuration (EXPERIMENTAL)
225#
226# CONFIG_IP_DCCP is not set
227
228#
215# SCTP Configuration (EXPERIMENTAL) 229# SCTP Configuration (EXPERIMENTAL)
216# 230#
217# CONFIG_IP_SCTP is not set 231# CONFIG_IP_SCTP is not set
@@ -234,9 +248,11 @@ CONFIG_IP_NF_ARPTABLES=y
234# Network testing 248# Network testing
235# 249#
236# CONFIG_NET_PKTGEN is not set 250# CONFIG_NET_PKTGEN is not set
251# CONFIG_NETFILTER_NETLINK is not set
237# CONFIG_HAMRADIO is not set 252# CONFIG_HAMRADIO is not set
238# CONFIG_IRDA is not set 253# CONFIG_IRDA is not set
239# CONFIG_BT is not set 254# CONFIG_BT is not set
255# CONFIG_IEEE80211 is not set
240 256
241# 257#
242# Device Drivers 258# Device Drivers
@@ -251,6 +267,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
251# CONFIG_DEBUG_DRIVER is not set 267# CONFIG_DEBUG_DRIVER is not set
252 268
253# 269#
270# Connector - unified userspace <-> kernelspace linker
271#
272# CONFIG_CONNECTOR is not set
273
274#
254# Memory Technology Devices (MTD) 275# Memory Technology Devices (MTD)
255# 276#
256# CONFIG_MTD is not set 277# CONFIG_MTD is not set
@@ -263,7 +284,13 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
263# 284#
264# Plug and Play support 285# Plug and Play support
265# 286#
266# CONFIG_PNP is not set 287CONFIG_PNP=y
288# CONFIG_PNP_DEBUG is not set
289
290#
291# Protocols
292#
293CONFIG_PNPACPI=y
267 294
268# 295#
269# Block devices 296# Block devices
@@ -282,7 +309,6 @@ CONFIG_BLK_DEV_RAM=y
282CONFIG_BLK_DEV_RAM_COUNT=16 309CONFIG_BLK_DEV_RAM_COUNT=16
283CONFIG_BLK_DEV_RAM_SIZE=4096 310CONFIG_BLK_DEV_RAM_SIZE=4096
284CONFIG_BLK_DEV_INITRD=y 311CONFIG_BLK_DEV_INITRD=y
285CONFIG_INITRAMFS_SOURCE=""
286# CONFIG_CDROM_PKTCDVD is not set 312# CONFIG_CDROM_PKTCDVD is not set
287 313
288# 314#
@@ -315,7 +341,8 @@ CONFIG_BLK_DEV_IDECD=y
315# 341#
316# IDE chipset support/bugfixes 342# IDE chipset support/bugfixes
317# 343#
318CONFIG_IDE_GENERIC=y 344# CONFIG_IDE_GENERIC is not set
345# CONFIG_BLK_DEV_IDEPNP is not set
319CONFIG_BLK_DEV_IDEPCI=y 346CONFIG_BLK_DEV_IDEPCI=y
320CONFIG_IDEPCI_SHARE_IRQ=y 347CONFIG_IDEPCI_SHARE_IRQ=y
321# CONFIG_BLK_DEV_OFFBOARD is not set 348# CONFIG_BLK_DEV_OFFBOARD is not set
@@ -354,6 +381,7 @@ CONFIG_BLK_DEV_IDEDMA=y
354# 381#
355# SCSI device support 382# SCSI device support
356# 383#
384# CONFIG_RAID_ATTRS is not set
357CONFIG_SCSI=y 385CONFIG_SCSI=y
358CONFIG_SCSI_PROC_FS=y 386CONFIG_SCSI_PROC_FS=y
359 387
@@ -381,6 +409,7 @@ CONFIG_SCSI_LOGGING=y
381CONFIG_SCSI_SPI_ATTRS=y 409CONFIG_SCSI_SPI_ATTRS=y
382# CONFIG_SCSI_FC_ATTRS is not set 410# CONFIG_SCSI_FC_ATTRS is not set
383# CONFIG_SCSI_ISCSI_ATTRS is not set 411# CONFIG_SCSI_ISCSI_ATTRS is not set
412# CONFIG_SCSI_SAS_ATTRS is not set
384 413
385# 414#
386# SCSI low-level drivers 415# SCSI low-level drivers
@@ -457,6 +486,7 @@ CONFIG_DUMMY=y
457# CONFIG_BONDING is not set 486# CONFIG_BONDING is not set
458# CONFIG_EQUALIZER is not set 487# CONFIG_EQUALIZER is not set
459# CONFIG_TUN is not set 488# CONFIG_TUN is not set
489# CONFIG_NET_SB1000 is not set
460 490
461# 491#
462# ARCnet devices 492# ARCnet devices
@@ -464,6 +494,11 @@ CONFIG_DUMMY=y
464# CONFIG_ARCNET is not set 494# CONFIG_ARCNET is not set
465 495
466# 496#
497# PHY device support
498#
499# CONFIG_PHYLIB is not set
500
501#
467# Ethernet (10 or 100Mbit) 502# Ethernet (10 or 100Mbit)
468# 503#
469CONFIG_NET_ETHERNET=y 504CONFIG_NET_ETHERNET=y
@@ -485,6 +520,7 @@ CONFIG_TULIP_NAPI_HW_MITIGATION=y
485# CONFIG_DE4X5 is not set 520# CONFIG_DE4X5 is not set
486# CONFIG_WINBOND_840 is not set 521# CONFIG_WINBOND_840 is not set
487# CONFIG_DM9102 is not set 522# CONFIG_DM9102 is not set
523# CONFIG_ULI526X is not set
488# CONFIG_HP100 is not set 524# CONFIG_HP100 is not set
489CONFIG_NET_PCI=y 525CONFIG_NET_PCI=y
490# CONFIG_PCNET32 is not set 526# CONFIG_PCNET32 is not set
@@ -516,6 +552,7 @@ CONFIG_E1000=y
516# CONFIG_HAMACHI is not set 552# CONFIG_HAMACHI is not set
517# CONFIG_YELLOWFIN is not set 553# CONFIG_YELLOWFIN is not set
518# CONFIG_R8169 is not set 554# CONFIG_R8169 is not set
555# CONFIG_SIS190 is not set
519# CONFIG_SKGE is not set 556# CONFIG_SKGE is not set
520# CONFIG_SK98LIN is not set 557# CONFIG_SK98LIN is not set
521# CONFIG_VIA_VELOCITY is not set 558# CONFIG_VIA_VELOCITY is not set
@@ -525,6 +562,7 @@ CONFIG_TIGON3=y
525# 562#
526# Ethernet (10000 Mbit) 563# Ethernet (10000 Mbit)
527# 564#
565# CONFIG_CHELSIO_T1 is not set
528# CONFIG_IXGB is not set 566# CONFIG_IXGB is not set
529# CONFIG_S2IO is not set 567# CONFIG_S2IO is not set
530 568
@@ -650,12 +688,12 @@ CONFIG_AGP=y
650CONFIG_AGP_HP_ZX1=y 688CONFIG_AGP_HP_ZX1=y
651CONFIG_DRM=y 689CONFIG_DRM=y
652# CONFIG_DRM_TDFX is not set 690# CONFIG_DRM_TDFX is not set
653# CONFIG_DRM_GAMMA is not set
654# CONFIG_DRM_R128 is not set 691# CONFIG_DRM_R128 is not set
655CONFIG_DRM_RADEON=y 692CONFIG_DRM_RADEON=y
656# CONFIG_DRM_MGA is not set 693# CONFIG_DRM_MGA is not set
657# CONFIG_DRM_SIS is not set 694# CONFIG_DRM_SIS is not set
658# CONFIG_DRM_VIA is not set 695# CONFIG_DRM_VIA is not set
696# CONFIG_DRM_SAVAGE is not set
659# CONFIG_RAW_DRIVER is not set 697# CONFIG_RAW_DRIVER is not set
660# CONFIG_HPET is not set 698# CONFIG_HPET is not set
661# CONFIG_HANGCHECK_TIMER is not set 699# CONFIG_HANGCHECK_TIMER is not set
@@ -689,7 +727,6 @@ CONFIG_I2C_ALGOPCF=y
689# CONFIG_I2C_I801 is not set 727# CONFIG_I2C_I801 is not set
690# CONFIG_I2C_I810 is not set 728# CONFIG_I2C_I810 is not set
691# CONFIG_I2C_PIIX4 is not set 729# CONFIG_I2C_PIIX4 is not set
692# CONFIG_I2C_ISA is not set
693# CONFIG_I2C_NFORCE2 is not set 730# CONFIG_I2C_NFORCE2 is not set
694# CONFIG_I2C_PARPORT_LIGHT is not set 731# CONFIG_I2C_PARPORT_LIGHT is not set
695# CONFIG_I2C_PROSAVAGE is not set 732# CONFIG_I2C_PROSAVAGE is not set
@@ -703,7 +740,6 @@ CONFIG_I2C_ALGOPCF=y
703# CONFIG_I2C_VIAPRO is not set 740# CONFIG_I2C_VIAPRO is not set
704# CONFIG_I2C_VOODOO3 is not set 741# CONFIG_I2C_VOODOO3 is not set
705# CONFIG_I2C_PCA_ISA is not set 742# CONFIG_I2C_PCA_ISA is not set
706# CONFIG_I2C_SENSOR is not set
707 743
708# 744#
709# Miscellaneous I2C Chip support 745# Miscellaneous I2C Chip support
@@ -730,12 +766,17 @@ CONFIG_I2C_ALGOPCF=y
730# Hardware Monitoring support 766# Hardware Monitoring support
731# 767#
732# CONFIG_HWMON is not set 768# CONFIG_HWMON is not set
769# CONFIG_HWMON_VID is not set
733 770
734# 771#
735# Misc devices 772# Misc devices
736# 773#
737 774
738# 775#
776# Multimedia Capabilities Port drivers
777#
778
779#
739# Multimedia devices 780# Multimedia devices
740# 781#
741CONFIG_VIDEO_DEV=y 782CONFIG_VIDEO_DEV=y
@@ -806,6 +847,7 @@ CONFIG_FB_RADEON_DEBUG=y
806# CONFIG_FB_KYRO is not set 847# CONFIG_FB_KYRO is not set
807# CONFIG_FB_3DFX is not set 848# CONFIG_FB_3DFX is not set
808# CONFIG_FB_VOODOO1 is not set 849# CONFIG_FB_VOODOO1 is not set
850# CONFIG_FB_CYBLA is not set
809# CONFIG_FB_TRIDENT is not set 851# CONFIG_FB_TRIDENT is not set
810# CONFIG_FB_PM3 is not set 852# CONFIG_FB_PM3 is not set
811# CONFIG_FB_S1D13XXX is not set 853# CONFIG_FB_S1D13XXX is not set
@@ -862,11 +904,12 @@ CONFIG_SND_OPL3_LIB=y
862# CONFIG_SND_MTPAV is not set 904# CONFIG_SND_MTPAV is not set
863# CONFIG_SND_SERIAL_U16550 is not set 905# CONFIG_SND_SERIAL_U16550 is not set
864# CONFIG_SND_MPU401 is not set 906# CONFIG_SND_MPU401 is not set
907CONFIG_SND_AC97_CODEC=y
908CONFIG_SND_AC97_BUS=y
865 909
866# 910#
867# PCI devices 911# PCI devices
868# 912#
869CONFIG_SND_AC97_CODEC=y
870# CONFIG_SND_ALI5451 is not set 913# CONFIG_SND_ALI5451 is not set
871# CONFIG_SND_ATIIXP is not set 914# CONFIG_SND_ATIIXP is not set
872# CONFIG_SND_ATIIXP_MODEM is not set 915# CONFIG_SND_ATIIXP_MODEM is not set
@@ -890,7 +933,7 @@ CONFIG_SND_AC97_CODEC=y
890# CONFIG_SND_HDSPM is not set 933# CONFIG_SND_HDSPM is not set
891# CONFIG_SND_TRIDENT is not set 934# CONFIG_SND_TRIDENT is not set
892# CONFIG_SND_YMFPCI is not set 935# CONFIG_SND_YMFPCI is not set
893# CONFIG_SND_ALS4000 is not set 936# CONFIG_SND_AD1889 is not set
894# CONFIG_SND_CMIPCI is not set 937# CONFIG_SND_CMIPCI is not set
895# CONFIG_SND_ENS1370 is not set 938# CONFIG_SND_ENS1370 is not set
896# CONFIG_SND_ENS1371 is not set 939# CONFIG_SND_ENS1371 is not set
@@ -952,9 +995,8 @@ CONFIG_USB_UHCI_HCD=y
952# 995#
953# USB Device Class drivers 996# USB Device Class drivers
954# 997#
955# CONFIG_USB_AUDIO is not set 998# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
956# CONFIG_USB_BLUETOOTH_TTY is not set 999# CONFIG_USB_BLUETOOTH_TTY is not set
957# CONFIG_USB_MIDI is not set
958# CONFIG_USB_ACM is not set 1000# CONFIG_USB_ACM is not set
959# CONFIG_USB_PRINTER is not set 1001# CONFIG_USB_PRINTER is not set
960 1002
@@ -971,6 +1013,7 @@ CONFIG_USB_STORAGE=y
971# CONFIG_USB_STORAGE_SDDR09 is not set 1013# CONFIG_USB_STORAGE_SDDR09 is not set
972# CONFIG_USB_STORAGE_SDDR55 is not set 1014# CONFIG_USB_STORAGE_SDDR55 is not set
973# CONFIG_USB_STORAGE_JUMPSHOT is not set 1015# CONFIG_USB_STORAGE_JUMPSHOT is not set
1016# CONFIG_USB_STORAGE_ONETOUCH is not set
974 1017
975# 1018#
976# USB Input Devices 1019# USB Input Devices
@@ -987,9 +1030,11 @@ CONFIG_USB_HIDDEV=y
987# CONFIG_USB_MTOUCH is not set 1030# CONFIG_USB_MTOUCH is not set
988# CONFIG_USB_ITMTOUCH is not set 1031# CONFIG_USB_ITMTOUCH is not set
989# CONFIG_USB_EGALAX is not set 1032# CONFIG_USB_EGALAX is not set
1033# CONFIG_USB_YEALINK is not set
990# CONFIG_USB_XPAD is not set 1034# CONFIG_USB_XPAD is not set
991# CONFIG_USB_ATI_REMOTE is not set 1035# CONFIG_USB_ATI_REMOTE is not set
992# CONFIG_USB_KEYSPAN_REMOTE is not set 1036# CONFIG_USB_KEYSPAN_REMOTE is not set
1037# CONFIG_USB_APPLETOUCH is not set
993 1038
994# 1039#
995# USB Imaging devices 1040# USB Imaging devices
@@ -1088,10 +1133,6 @@ CONFIG_FS_MBCACHE=y
1088# CONFIG_REISERFS_FS is not set 1133# CONFIG_REISERFS_FS is not set
1089# CONFIG_JFS_FS is not set 1134# CONFIG_JFS_FS is not set
1090# CONFIG_FS_POSIX_ACL is not set 1135# CONFIG_FS_POSIX_ACL is not set
1091
1092#
1093# XFS support
1094#
1095# CONFIG_XFS_FS is not set 1136# CONFIG_XFS_FS is not set
1096# CONFIG_MINIX_FS is not set 1137# CONFIG_MINIX_FS is not set
1097# CONFIG_ROMFS_FS is not set 1138# CONFIG_ROMFS_FS is not set
@@ -1100,6 +1141,7 @@ CONFIG_FS_MBCACHE=y
1100CONFIG_DNOTIFY=y 1141CONFIG_DNOTIFY=y
1101CONFIG_AUTOFS_FS=y 1142CONFIG_AUTOFS_FS=y
1102# CONFIG_AUTOFS4_FS is not set 1143# CONFIG_AUTOFS4_FS is not set
1144# CONFIG_FUSE_FS is not set
1103 1145
1104# 1146#
1105# CD-ROM/DVD Filesystems 1147# CD-ROM/DVD Filesystems
@@ -1126,13 +1168,11 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1126CONFIG_PROC_FS=y 1168CONFIG_PROC_FS=y
1127CONFIG_PROC_KCORE=y 1169CONFIG_PROC_KCORE=y
1128CONFIG_SYSFS=y 1170CONFIG_SYSFS=y
1129# CONFIG_DEVPTS_FS_XATTR is not set
1130CONFIG_TMPFS=y 1171CONFIG_TMPFS=y
1131CONFIG_TMPFS_XATTR=y
1132CONFIG_TMPFS_SECURITY=y
1133CONFIG_HUGETLBFS=y 1172CONFIG_HUGETLBFS=y
1134CONFIG_HUGETLB_PAGE=y 1173CONFIG_HUGETLB_PAGE=y
1135CONFIG_RAMFS=y 1174CONFIG_RAMFS=y
1175# CONFIG_RELAYFS_FS is not set
1136 1176
1137# 1177#
1138# Miscellaneous filesystems 1178# Miscellaneous filesystems
@@ -1177,6 +1217,7 @@ CONFIG_RPCSEC_GSS_KRB5=y
1177# CONFIG_NCP_FS is not set 1217# CONFIG_NCP_FS is not set
1178# CONFIG_CODA_FS is not set 1218# CONFIG_CODA_FS is not set
1179# CONFIG_AFS_FS is not set 1219# CONFIG_AFS_FS is not set
1220# CONFIG_9P_FS is not set
1180 1221
1181# 1222#
1182# Partition Types 1223# Partition Types
@@ -1246,10 +1287,12 @@ CONFIG_NLS_UTF8=y
1246# Library routines 1287# Library routines
1247# 1288#
1248# CONFIG_CRC_CCITT is not set 1289# CONFIG_CRC_CCITT is not set
1290# CONFIG_CRC16 is not set
1249CONFIG_CRC32=y 1291CONFIG_CRC32=y
1250# CONFIG_LIBCRC32C is not set 1292# CONFIG_LIBCRC32C is not set
1251CONFIG_GENERIC_HARDIRQS=y 1293CONFIG_GENERIC_HARDIRQS=y
1252CONFIG_GENERIC_IRQ_PROBE=y 1294CONFIG_GENERIC_IRQ_PROBE=y
1295CONFIG_GENERIC_PENDING_IRQ=y
1253 1296
1254# 1297#
1255# Profiling support 1298# Profiling support
@@ -1263,6 +1306,7 @@ CONFIG_GENERIC_IRQ_PROBE=y
1263CONFIG_DEBUG_KERNEL=y 1306CONFIG_DEBUG_KERNEL=y
1264CONFIG_MAGIC_SYSRQ=y 1307CONFIG_MAGIC_SYSRQ=y
1265CONFIG_LOG_BUF_SHIFT=17 1308CONFIG_LOG_BUF_SHIFT=17
1309CONFIG_DETECT_SOFTLOCKUP=y
1266# CONFIG_SCHEDSTATS is not set 1310# CONFIG_SCHEDSTATS is not set
1267# CONFIG_DEBUG_SLAB is not set 1311# CONFIG_DEBUG_SLAB is not set
1268# CONFIG_DEBUG_SPINLOCK is not set 1312# CONFIG_DEBUG_SPINLOCK is not set
diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig
index 5da208115ea1..6e3f147e03e5 100644
--- a/arch/ia64/defconfig
+++ b/arch/ia64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12 3# Linux kernel version: 2.6.14-rc1
4# Tue Jun 21 11:30:42 2005 4# Wed Sep 14 15:13:03 2005
5# 5#
6 6
7# 7#
@@ -16,6 +16,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
16# General setup 16# General setup
17# 17#
18CONFIG_LOCALVERSION="" 18CONFIG_LOCALVERSION=""
19CONFIG_LOCALVERSION_AUTO=y
19CONFIG_SWAP=y 20CONFIG_SWAP=y
20CONFIG_SYSVIPC=y 21CONFIG_SYSVIPC=y
21CONFIG_POSIX_MQUEUE=y 22CONFIG_POSIX_MQUEUE=y
@@ -27,6 +28,7 @@ CONFIG_KOBJECT_UEVENT=y
27CONFIG_IKCONFIG=y 28CONFIG_IKCONFIG=y
28CONFIG_IKCONFIG_PROC=y 29CONFIG_IKCONFIG_PROC=y
29# CONFIG_CPUSETS is not set 30# CONFIG_CPUSETS is not set
31CONFIG_INITRAMFS_SOURCE=""
30# CONFIG_EMBEDDED is not set 32# CONFIG_EMBEDDED is not set
31CONFIG_KALLSYMS=y 33CONFIG_KALLSYMS=y
32CONFIG_KALLSYMS_ALL=y 34CONFIG_KALLSYMS_ALL=y
@@ -80,6 +82,10 @@ CONFIG_MCKINLEY=y
80# CONFIG_IA64_PAGE_SIZE_8KB is not set 82# CONFIG_IA64_PAGE_SIZE_8KB is not set
81CONFIG_IA64_PAGE_SIZE_16KB=y 83CONFIG_IA64_PAGE_SIZE_16KB=y
82# CONFIG_IA64_PAGE_SIZE_64KB is not set 84# CONFIG_IA64_PAGE_SIZE_64KB is not set
85# CONFIG_HZ_100 is not set
86CONFIG_HZ_250=y
87# CONFIG_HZ_1000 is not set
88CONFIG_HZ=250
83CONFIG_IA64_L1_CACHE_SHIFT=7 89CONFIG_IA64_L1_CACHE_SHIFT=7
84CONFIG_NUMA=y 90CONFIG_NUMA=y
85CONFIG_VIRTUAL_MEM_MAP=y 91CONFIG_VIRTUAL_MEM_MAP=y
@@ -87,12 +93,21 @@ CONFIG_HOLES_IN_ZONE=y
87CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 93CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
88CONFIG_IA64_CYCLONE=y 94CONFIG_IA64_CYCLONE=y
89CONFIG_IOSAPIC=y 95CONFIG_IOSAPIC=y
96# CONFIG_IA64_SGI_SN_XP is not set
90CONFIG_FORCE_MAX_ZONEORDER=18 97CONFIG_FORCE_MAX_ZONEORDER=18
91CONFIG_SMP=y 98CONFIG_SMP=y
92CONFIG_NR_CPUS=512 99CONFIG_NR_CPUS=512
93CONFIG_HOTPLUG_CPU=y 100CONFIG_HOTPLUG_CPU=y
94# CONFIG_SCHED_SMT is not set 101# CONFIG_SCHED_SMT is not set
95# CONFIG_PREEMPT is not set 102# CONFIG_PREEMPT is not set
103CONFIG_SELECT_MEMORY_MODEL=y
104# CONFIG_FLATMEM_MANUAL is not set
105CONFIG_DISCONTIGMEM_MANUAL=y
106# CONFIG_SPARSEMEM_MANUAL is not set
107CONFIG_DISCONTIGMEM=y
108CONFIG_FLAT_NODE_MEM_MAP=y
109CONFIG_NEED_MULTIPLE_NODES=y
110# CONFIG_SPARSEMEM_STATIC is not set
96CONFIG_HAVE_DEC_LOCK=y 111CONFIG_HAVE_DEC_LOCK=y
97CONFIG_IA32_SUPPORT=y 112CONFIG_IA32_SUPPORT=y
98CONFIG_COMPAT=y 113CONFIG_COMPAT=y
@@ -105,6 +120,7 @@ CONFIG_IA64_PALINFO=y
105# 120#
106CONFIG_EFI_VARS=y 121CONFIG_EFI_VARS=y
107CONFIG_EFI_PCDP=y 122CONFIG_EFI_PCDP=y
123# CONFIG_DELL_RBU is not set
108CONFIG_BINFMT_ELF=y 124CONFIG_BINFMT_ELF=y
109CONFIG_BINFMT_MISC=m 125CONFIG_BINFMT_MISC=m
110 126
@@ -112,30 +128,36 @@ CONFIG_BINFMT_MISC=m
112# Power management and ACPI 128# Power management and ACPI
113# 129#
114CONFIG_PM=y 130CONFIG_PM=y
115CONFIG_ACPI=y 131# CONFIG_PM_DEBUG is not set
116 132
117# 133#
118# ACPI (Advanced Configuration and Power Interface) Support 134# ACPI (Advanced Configuration and Power Interface) Support
119# 135#
136CONFIG_ACPI=y
120CONFIG_ACPI_BUTTON=m 137CONFIG_ACPI_BUTTON=m
121CONFIG_ACPI_FAN=m 138CONFIG_ACPI_FAN=m
122CONFIG_ACPI_PROCESSOR=m 139CONFIG_ACPI_PROCESSOR=m
123CONFIG_ACPI_HOTPLUG_CPU=y 140CONFIG_ACPI_HOTPLUG_CPU=y
124CONFIG_ACPI_THERMAL=m 141CONFIG_ACPI_THERMAL=m
125CONFIG_ACPI_NUMA=y 142CONFIG_ACPI_NUMA=y
143CONFIG_ACPI_BLACKLIST_YEAR=0
126# CONFIG_ACPI_DEBUG is not set 144# CONFIG_ACPI_DEBUG is not set
127CONFIG_ACPI_POWER=y 145CONFIG_ACPI_POWER=y
128CONFIG_ACPI_SYSTEM=y 146CONFIG_ACPI_SYSTEM=y
129CONFIG_ACPI_CONTAINER=m 147CONFIG_ACPI_CONTAINER=m
130 148
131# 149#
150# CPU Frequency scaling
151#
152# CONFIG_CPU_FREQ is not set
153
154#
132# Bus options (PCI, PCMCIA) 155# Bus options (PCI, PCMCIA)
133# 156#
134CONFIG_PCI=y 157CONFIG_PCI=y
135CONFIG_PCI_DOMAINS=y 158CONFIG_PCI_DOMAINS=y
136# CONFIG_PCI_MSI is not set 159# CONFIG_PCI_MSI is not set
137CONFIG_PCI_LEGACY_PROC=y 160CONFIG_PCI_LEGACY_PROC=y
138CONFIG_PCI_NAMES=y
139# CONFIG_PCI_DEBUG is not set 161# CONFIG_PCI_DEBUG is not set
140 162
141# 163#
@@ -147,6 +169,7 @@ CONFIG_HOTPLUG_PCI_ACPI=m
147# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set 169# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set
148# CONFIG_HOTPLUG_PCI_CPCI is not set 170# CONFIG_HOTPLUG_PCI_CPCI is not set
149# CONFIG_HOTPLUG_PCI_SHPC is not set 171# CONFIG_HOTPLUG_PCI_SHPC is not set
172# CONFIG_HOTPLUG_PCI_SGI is not set
150 173
151# 174#
152# PCCARD (PCMCIA/CardBus) support 175# PCCARD (PCMCIA/CardBus) support
@@ -154,6 +177,73 @@ CONFIG_HOTPLUG_PCI_ACPI=m
154# CONFIG_PCCARD is not set 177# CONFIG_PCCARD is not set
155 178
156# 179#
180# Networking
181#
182CONFIG_NET=y
183
184#
185# Networking options
186#
187CONFIG_PACKET=y
188# CONFIG_PACKET_MMAP is not set
189CONFIG_UNIX=y
190# CONFIG_NET_KEY is not set
191CONFIG_INET=y
192CONFIG_IP_MULTICAST=y
193# CONFIG_IP_ADVANCED_ROUTER is not set
194CONFIG_IP_FIB_HASH=y
195# CONFIG_IP_PNP is not set
196# CONFIG_NET_IPIP is not set
197# CONFIG_NET_IPGRE is not set
198# CONFIG_IP_MROUTE is not set
199CONFIG_ARPD=y
200CONFIG_SYN_COOKIES=y
201# CONFIG_INET_AH is not set
202# CONFIG_INET_ESP is not set
203# CONFIG_INET_IPCOMP is not set
204# CONFIG_INET_TUNNEL is not set
205CONFIG_INET_DIAG=y
206CONFIG_INET_TCP_DIAG=y
207# CONFIG_TCP_CONG_ADVANCED is not set
208CONFIG_TCP_CONG_BIC=y
209# CONFIG_IPV6 is not set
210# CONFIG_NETFILTER is not set
211
212#
213# DCCP Configuration (EXPERIMENTAL)
214#
215# CONFIG_IP_DCCP is not set
216
217#
218# SCTP Configuration (EXPERIMENTAL)
219#
220# CONFIG_IP_SCTP is not set
221# CONFIG_ATM is not set
222# CONFIG_BRIDGE is not set
223# CONFIG_VLAN_8021Q is not set
224# CONFIG_DECNET is not set
225# CONFIG_LLC2 is not set
226# CONFIG_IPX is not set
227# CONFIG_ATALK is not set
228# CONFIG_X25 is not set
229# CONFIG_LAPB is not set
230# CONFIG_NET_DIVERT is not set
231# CONFIG_ECONET is not set
232# CONFIG_WAN_ROUTER is not set
233# CONFIG_NET_SCHED is not set
234# CONFIG_NET_CLS_ROUTE is not set
235
236#
237# Network testing
238#
239# CONFIG_NET_PKTGEN is not set
240# CONFIG_NETFILTER_NETLINK is not set
241# CONFIG_HAMRADIO is not set
242# CONFIG_IRDA is not set
243# CONFIG_BT is not set
244# CONFIG_IEEE80211 is not set
245
246#
157# Device Drivers 247# Device Drivers
158# 248#
159 249
@@ -162,10 +252,15 @@ CONFIG_HOTPLUG_PCI_ACPI=m
162# 252#
163CONFIG_STANDALONE=y 253CONFIG_STANDALONE=y
164CONFIG_PREVENT_FIRMWARE_BUILD=y 254CONFIG_PREVENT_FIRMWARE_BUILD=y
165# CONFIG_FW_LOADER is not set 255CONFIG_FW_LOADER=m
166# CONFIG_DEBUG_DRIVER is not set 256# CONFIG_DEBUG_DRIVER is not set
167 257
168# 258#
259# Connector - unified userspace <-> kernelspace linker
260#
261# CONFIG_CONNECTOR is not set
262
263#
169# Memory Technology Devices (MTD) 264# Memory Technology Devices (MTD)
170# 265#
171# CONFIG_MTD is not set 266# CONFIG_MTD is not set
@@ -178,7 +273,13 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
178# 273#
179# Plug and Play support 274# Plug and Play support
180# 275#
181# CONFIG_PNP is not set 276CONFIG_PNP=y
277# CONFIG_PNP_DEBUG is not set
278
279#
280# Protocols
281#
282CONFIG_PNPACPI=y
182 283
183# 284#
184# Block devices 285# Block devices
@@ -197,7 +298,6 @@ CONFIG_BLK_DEV_RAM=y
197CONFIG_BLK_DEV_RAM_COUNT=16 298CONFIG_BLK_DEV_RAM_COUNT=16
198CONFIG_BLK_DEV_RAM_SIZE=4096 299CONFIG_BLK_DEV_RAM_SIZE=4096
199CONFIG_BLK_DEV_INITRD=y 300CONFIG_BLK_DEV_INITRD=y
200CONFIG_INITRAMFS_SOURCE=""
201# CONFIG_CDROM_PKTCDVD is not set 301# CONFIG_CDROM_PKTCDVD is not set
202 302
203# 303#
@@ -230,7 +330,8 @@ CONFIG_BLK_DEV_IDESCSI=m
230# 330#
231# IDE chipset support/bugfixes 331# IDE chipset support/bugfixes
232# 332#
233CONFIG_IDE_GENERIC=y 333# CONFIG_IDE_GENERIC is not set
334# CONFIG_BLK_DEV_IDEPNP is not set
234CONFIG_BLK_DEV_IDEPCI=y 335CONFIG_BLK_DEV_IDEPCI=y
235# CONFIG_IDEPCI_SHARE_IRQ is not set 336# CONFIG_IDEPCI_SHARE_IRQ is not set
236# CONFIG_BLK_DEV_OFFBOARD is not set 337# CONFIG_BLK_DEV_OFFBOARD is not set
@@ -252,6 +353,7 @@ CONFIG_BLK_DEV_CMD64X=y
252# CONFIG_BLK_DEV_HPT366 is not set 353# CONFIG_BLK_DEV_HPT366 is not set
253# CONFIG_BLK_DEV_SC1200 is not set 354# CONFIG_BLK_DEV_SC1200 is not set
254CONFIG_BLK_DEV_PIIX=y 355CONFIG_BLK_DEV_PIIX=y
356# CONFIG_BLK_DEV_IT821X is not set
255# CONFIG_BLK_DEV_NS87415 is not set 357# CONFIG_BLK_DEV_NS87415 is not set
256# CONFIG_BLK_DEV_PDC202XX_OLD is not set 358# CONFIG_BLK_DEV_PDC202XX_OLD is not set
257# CONFIG_BLK_DEV_PDC202XX_NEW is not set 359# CONFIG_BLK_DEV_PDC202XX_NEW is not set
@@ -270,6 +372,7 @@ CONFIG_IDEDMA_AUTO=y
270# 372#
271# SCSI device support 373# SCSI device support
272# 374#
375# CONFIG_RAID_ATTRS is not set
273CONFIG_SCSI=y 376CONFIG_SCSI=y
274CONFIG_SCSI_PROC_FS=y 377CONFIG_SCSI_PROC_FS=y
275 378
@@ -297,6 +400,7 @@ CONFIG_CHR_DEV_SG=m
297CONFIG_SCSI_SPI_ATTRS=y 400CONFIG_SCSI_SPI_ATTRS=y
298CONFIG_SCSI_FC_ATTRS=y 401CONFIG_SCSI_FC_ATTRS=y
299# CONFIG_SCSI_ISCSI_ATTRS is not set 402# CONFIG_SCSI_ISCSI_ATTRS is not set
403# CONFIG_SCSI_SAS_ATTRS is not set
300 404
301# 405#
302# SCSI low-level drivers 406# SCSI low-level drivers
@@ -314,6 +418,7 @@ CONFIG_SCSI_SATA=y
314# CONFIG_SCSI_SATA_AHCI is not set 418# CONFIG_SCSI_SATA_AHCI is not set
315# CONFIG_SCSI_SATA_SVW is not set 419# CONFIG_SCSI_SATA_SVW is not set
316# CONFIG_SCSI_ATA_PIIX is not set 420# CONFIG_SCSI_ATA_PIIX is not set
421# CONFIG_SCSI_SATA_MV is not set
317# CONFIG_SCSI_SATA_NV is not set 422# CONFIG_SCSI_SATA_NV is not set
318# CONFIG_SCSI_SATA_PROMISE is not set 423# CONFIG_SCSI_SATA_PROMISE is not set
319# CONFIG_SCSI_SATA_QSTOR is not set 424# CONFIG_SCSI_SATA_QSTOR is not set
@@ -335,7 +440,6 @@ CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
335# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 440# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
336# CONFIG_SCSI_IPR is not set 441# CONFIG_SCSI_IPR is not set
337# CONFIG_SCSI_QLOGIC_FC is not set 442# CONFIG_SCSI_QLOGIC_FC is not set
338# CONFIG_SCSI_QLOGIC_FC_FIRMWARE is not set
339CONFIG_SCSI_QLOGIC_1280=y 443CONFIG_SCSI_QLOGIC_1280=y
340# CONFIG_SCSI_QLOGIC_1280_1040 is not set 444# CONFIG_SCSI_QLOGIC_1280_1040 is not set
341CONFIG_SCSI_QLA2XXX=y 445CONFIG_SCSI_QLA2XXX=y
@@ -344,6 +448,7 @@ CONFIG_SCSI_QLA22XX=m
344CONFIG_SCSI_QLA2300=m 448CONFIG_SCSI_QLA2300=m
345CONFIG_SCSI_QLA2322=m 449CONFIG_SCSI_QLA2322=m
346# CONFIG_SCSI_QLA6312 is not set 450# CONFIG_SCSI_QLA6312 is not set
451# CONFIG_SCSI_QLA24XX is not set
347# CONFIG_SCSI_LPFC is not set 452# CONFIG_SCSI_LPFC is not set
348# CONFIG_SCSI_DC395x is not set 453# CONFIG_SCSI_DC395x is not set
349# CONFIG_SCSI_DC390T is not set 454# CONFIG_SCSI_DC390T is not set
@@ -390,74 +495,14 @@ CONFIG_FUSION_MAX_SGE=128
390# CONFIG_I2O is not set 495# CONFIG_I2O is not set
391 496
392# 497#
393# Networking support 498# Network device support
394#
395CONFIG_NET=y
396
397#
398# Networking options
399#
400CONFIG_PACKET=y
401# CONFIG_PACKET_MMAP is not set
402CONFIG_UNIX=y
403# CONFIG_NET_KEY is not set
404CONFIG_INET=y
405CONFIG_IP_MULTICAST=y
406# CONFIG_IP_ADVANCED_ROUTER is not set
407# CONFIG_IP_PNP is not set
408# CONFIG_NET_IPIP is not set
409# CONFIG_NET_IPGRE is not set
410# CONFIG_IP_MROUTE is not set
411CONFIG_ARPD=y
412CONFIG_SYN_COOKIES=y
413# CONFIG_INET_AH is not set
414# CONFIG_INET_ESP is not set
415# CONFIG_INET_IPCOMP is not set
416# CONFIG_INET_TUNNEL is not set
417CONFIG_IP_TCPDIAG=y
418# CONFIG_IP_TCPDIAG_IPV6 is not set
419# CONFIG_IPV6 is not set
420# CONFIG_NETFILTER is not set
421
422#
423# SCTP Configuration (EXPERIMENTAL)
424#
425# CONFIG_IP_SCTP is not set
426# CONFIG_ATM is not set
427# CONFIG_BRIDGE is not set
428# CONFIG_VLAN_8021Q is not set
429# CONFIG_DECNET is not set
430# CONFIG_LLC2 is not set
431# CONFIG_IPX is not set
432# CONFIG_ATALK is not set
433# CONFIG_X25 is not set
434# CONFIG_LAPB is not set
435# CONFIG_NET_DIVERT is not set
436# CONFIG_ECONET is not set
437# CONFIG_WAN_ROUTER is not set
438
439# 499#
440# QoS and/or fair queueing
441#
442# CONFIG_NET_SCHED is not set
443# CONFIG_NET_CLS_ROUTE is not set
444
445#
446# Network testing
447#
448# CONFIG_NET_PKTGEN is not set
449CONFIG_NETPOLL=y
450# CONFIG_NETPOLL_RX is not set
451# CONFIG_NETPOLL_TRAP is not set
452CONFIG_NET_POLL_CONTROLLER=y
453# CONFIG_HAMRADIO is not set
454# CONFIG_IRDA is not set
455# CONFIG_BT is not set
456CONFIG_NETDEVICES=y 500CONFIG_NETDEVICES=y
457CONFIG_DUMMY=m 501CONFIG_DUMMY=m
458# CONFIG_BONDING is not set 502# CONFIG_BONDING is not set
459# CONFIG_EQUALIZER is not set 503# CONFIG_EQUALIZER is not set
460# CONFIG_TUN is not set 504# CONFIG_TUN is not set
505# CONFIG_NET_SB1000 is not set
461 506
462# 507#
463# ARCnet devices 508# ARCnet devices
@@ -465,6 +510,11 @@ CONFIG_DUMMY=m
465# CONFIG_ARCNET is not set 510# CONFIG_ARCNET is not set
466 511
467# 512#
513# PHY device support
514#
515# CONFIG_PHYLIB is not set
516
517#
468# Ethernet (10 or 100Mbit) 518# Ethernet (10 or 100Mbit)
469# 519#
470CONFIG_NET_ETHERNET=y 520CONFIG_NET_ETHERNET=y
@@ -485,6 +535,7 @@ CONFIG_TULIP=m
485# CONFIG_DE4X5 is not set 535# CONFIG_DE4X5 is not set
486# CONFIG_WINBOND_840 is not set 536# CONFIG_WINBOND_840 is not set
487# CONFIG_DM9102 is not set 537# CONFIG_DM9102 is not set
538# CONFIG_ULI526X is not set
488# CONFIG_HP100 is not set 539# CONFIG_HP100 is not set
489CONFIG_NET_PCI=y 540CONFIG_NET_PCI=y
490# CONFIG_PCNET32 is not set 541# CONFIG_PCNET32 is not set
@@ -516,6 +567,7 @@ CONFIG_E1000=y
516# CONFIG_HAMACHI is not set 567# CONFIG_HAMACHI is not set
517# CONFIG_YELLOWFIN is not set 568# CONFIG_YELLOWFIN is not set
518# CONFIG_R8169 is not set 569# CONFIG_R8169 is not set
570# CONFIG_SIS190 is not set
519# CONFIG_SKGE is not set 571# CONFIG_SKGE is not set
520# CONFIG_SK98LIN is not set 572# CONFIG_SK98LIN is not set
521# CONFIG_VIA_VELOCITY is not set 573# CONFIG_VIA_VELOCITY is not set
@@ -525,6 +577,7 @@ CONFIG_TIGON3=y
525# 577#
526# Ethernet (10000 Mbit) 578# Ethernet (10000 Mbit)
527# 579#
580# CONFIG_CHELSIO_T1 is not set
528# CONFIG_IXGB is not set 581# CONFIG_IXGB is not set
529# CONFIG_S2IO is not set 582# CONFIG_S2IO is not set
530 583
@@ -549,6 +602,10 @@ CONFIG_TIGON3=y
549# CONFIG_NET_FC is not set 602# CONFIG_NET_FC is not set
550# CONFIG_SHAPER is not set 603# CONFIG_SHAPER is not set
551CONFIG_NETCONSOLE=y 604CONFIG_NETCONSOLE=y
605CONFIG_NETPOLL=y
606# CONFIG_NETPOLL_RX is not set
607# CONFIG_NETPOLL_TRAP is not set
608CONFIG_NET_POLL_CONTROLLER=y
552 609
553# 610#
554# ISDN subsystem 611# ISDN subsystem
@@ -607,9 +664,7 @@ CONFIG_GAMEPORT=m
607# CONFIG_GAMEPORT_NS558 is not set 664# CONFIG_GAMEPORT_NS558 is not set
608# CONFIG_GAMEPORT_L4 is not set 665# CONFIG_GAMEPORT_L4 is not set
609# CONFIG_GAMEPORT_EMU10K1 is not set 666# CONFIG_GAMEPORT_EMU10K1 is not set
610# CONFIG_GAMEPORT_VORTEX is not set
611# CONFIG_GAMEPORT_FM801 is not set 667# CONFIG_GAMEPORT_FM801 is not set
612# CONFIG_GAMEPORT_CS461X is not set
613 668
614# 669#
615# Character devices 670# Character devices
@@ -620,6 +675,7 @@ CONFIG_HW_CONSOLE=y
620CONFIG_SERIAL_NONSTANDARD=y 675CONFIG_SERIAL_NONSTANDARD=y
621# CONFIG_ROCKETPORT is not set 676# CONFIG_ROCKETPORT is not set
622# CONFIG_CYCLADES is not set 677# CONFIG_CYCLADES is not set
678# CONFIG_DIGIEPCA is not set
623# CONFIG_MOXA_SMARTIO is not set 679# CONFIG_MOXA_SMARTIO is not set
624# CONFIG_ISI is not set 680# CONFIG_ISI is not set
625# CONFIG_SYNCLINKMP is not set 681# CONFIG_SYNCLINKMP is not set
@@ -641,7 +697,6 @@ CONFIG_SERIAL_8250_NR_UARTS=6
641CONFIG_SERIAL_8250_EXTENDED=y 697CONFIG_SERIAL_8250_EXTENDED=y
642CONFIG_SERIAL_8250_SHARE_IRQ=y 698CONFIG_SERIAL_8250_SHARE_IRQ=y
643# CONFIG_SERIAL_8250_DETECT_IRQ is not set 699# CONFIG_SERIAL_8250_DETECT_IRQ is not set
644# CONFIG_SERIAL_8250_MULTIPORT is not set
645# CONFIG_SERIAL_8250_RSA is not set 700# CONFIG_SERIAL_8250_RSA is not set
646 701
647# 702#
@@ -650,8 +705,8 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
650CONFIG_SERIAL_CORE=y 705CONFIG_SERIAL_CORE=y
651CONFIG_SERIAL_CORE_CONSOLE=y 706CONFIG_SERIAL_CORE_CONSOLE=y
652CONFIG_SERIAL_SGI_L1_CONSOLE=y 707CONFIG_SERIAL_SGI_L1_CONSOLE=y
653CONFIG_SERIAL_SGI_IOC4=y
654# CONFIG_SERIAL_JSM is not set 708# CONFIG_SERIAL_JSM is not set
709CONFIG_SERIAL_SGI_IOC4=y
655CONFIG_UNIX98_PTYS=y 710CONFIG_UNIX98_PTYS=y
656CONFIG_LEGACY_PTYS=y 711CONFIG_LEGACY_PTYS=y
657CONFIG_LEGACY_PTY_COUNT=256 712CONFIG_LEGACY_PTY_COUNT=256
@@ -684,6 +739,8 @@ CONFIG_DRM_R128=m
684CONFIG_DRM_RADEON=m 739CONFIG_DRM_RADEON=m
685CONFIG_DRM_MGA=m 740CONFIG_DRM_MGA=m
686CONFIG_DRM_SIS=m 741CONFIG_DRM_SIS=m
742# CONFIG_DRM_VIA is not set
743# CONFIG_DRM_SAVAGE is not set
687CONFIG_RAW_DRIVER=m 744CONFIG_RAW_DRIVER=m
688CONFIG_HPET=y 745CONFIG_HPET=y
689# CONFIG_HPET_RTC_IRQ is not set 746# CONFIG_HPET_RTC_IRQ is not set
@@ -708,10 +765,21 @@ CONFIG_MMTIMER=y
708# CONFIG_W1 is not set 765# CONFIG_W1 is not set
709 766
710# 767#
768# Hardware Monitoring support
769#
770CONFIG_HWMON=y
771# CONFIG_HWMON_VID is not set
772# CONFIG_HWMON_DEBUG_CHIP is not set
773
774#
711# Misc devices 775# Misc devices
712# 776#
713 777
714# 778#
779# Multimedia Capabilities Port drivers
780#
781
782#
715# Multimedia devices 783# Multimedia devices
716# 784#
717# CONFIG_VIDEO_DEV is not set 785# CONFIG_VIDEO_DEV is not set
@@ -753,6 +821,7 @@ CONFIG_SND_PCM_OSS=m
753CONFIG_SND_SEQUENCER_OSS=y 821CONFIG_SND_SEQUENCER_OSS=y
754CONFIG_SND_VERBOSE_PRINTK=y 822CONFIG_SND_VERBOSE_PRINTK=y
755# CONFIG_SND_DEBUG is not set 823# CONFIG_SND_DEBUG is not set
824CONFIG_SND_GENERIC_DRIVER=y
756 825
757# 826#
758# Generic devices 827# Generic devices
@@ -764,11 +833,12 @@ CONFIG_SND_VIRMIDI=m
764CONFIG_SND_MTPAV=m 833CONFIG_SND_MTPAV=m
765CONFIG_SND_SERIAL_U16550=m 834CONFIG_SND_SERIAL_U16550=m
766CONFIG_SND_MPU401=m 835CONFIG_SND_MPU401=m
836CONFIG_SND_AC97_CODEC=m
837CONFIG_SND_AC97_BUS=m
767 838
768# 839#
769# PCI devices 840# PCI devices
770# 841#
771CONFIG_SND_AC97_CODEC=m
772# CONFIG_SND_ALI5451 is not set 842# CONFIG_SND_ALI5451 is not set
773# CONFIG_SND_ATIIXP is not set 843# CONFIG_SND_ATIIXP is not set
774# CONFIG_SND_ATIIXP_MODEM is not set 844# CONFIG_SND_ATIIXP_MODEM is not set
@@ -790,9 +860,10 @@ CONFIG_SND_EMU10K1=m
790# CONFIG_SND_RME96 is not set 860# CONFIG_SND_RME96 is not set
791# CONFIG_SND_RME9652 is not set 861# CONFIG_SND_RME9652 is not set
792# CONFIG_SND_HDSP is not set 862# CONFIG_SND_HDSP is not set
863# CONFIG_SND_HDSPM is not set
793# CONFIG_SND_TRIDENT is not set 864# CONFIG_SND_TRIDENT is not set
794# CONFIG_SND_YMFPCI is not set 865# CONFIG_SND_YMFPCI is not set
795# CONFIG_SND_ALS4000 is not set 866# CONFIG_SND_AD1889 is not set
796# CONFIG_SND_CMIPCI is not set 867# CONFIG_SND_CMIPCI is not set
797# CONFIG_SND_ENS1370 is not set 868# CONFIG_SND_ENS1370 is not set
798# CONFIG_SND_ENS1371 is not set 869# CONFIG_SND_ENS1371 is not set
@@ -844,6 +915,7 @@ CONFIG_USB_DEVICEFS=y
844CONFIG_USB_EHCI_HCD=m 915CONFIG_USB_EHCI_HCD=m
845# CONFIG_USB_EHCI_SPLIT_ISO is not set 916# CONFIG_USB_EHCI_SPLIT_ISO is not set
846# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 917# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
918# CONFIG_USB_ISP116X_HCD is not set
847CONFIG_USB_OHCI_HCD=m 919CONFIG_USB_OHCI_HCD=m
848# CONFIG_USB_OHCI_BIG_ENDIAN is not set 920# CONFIG_USB_OHCI_BIG_ENDIAN is not set
849CONFIG_USB_OHCI_LITTLE_ENDIAN=y 921CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -853,9 +925,8 @@ CONFIG_USB_UHCI_HCD=m
853# 925#
854# USB Device Class drivers 926# USB Device Class drivers
855# 927#
856# CONFIG_USB_AUDIO is not set 928# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
857# CONFIG_USB_BLUETOOTH_TTY is not set 929# CONFIG_USB_BLUETOOTH_TTY is not set
858# CONFIG_USB_MIDI is not set
859# CONFIG_USB_ACM is not set 930# CONFIG_USB_ACM is not set
860# CONFIG_USB_PRINTER is not set 931# CONFIG_USB_PRINTER is not set
861 932
@@ -888,12 +959,17 @@ CONFIG_USB_HIDINPUT=y
888# CONFIG_USB_MOUSE is not set 959# CONFIG_USB_MOUSE is not set
889# CONFIG_USB_AIPTEK is not set 960# CONFIG_USB_AIPTEK is not set
890# CONFIG_USB_WACOM is not set 961# CONFIG_USB_WACOM is not set
962# CONFIG_USB_ACECAD is not set
891# CONFIG_USB_KBTAB is not set 963# CONFIG_USB_KBTAB is not set
892# CONFIG_USB_POWERMATE is not set 964# CONFIG_USB_POWERMATE is not set
893# CONFIG_USB_MTOUCH is not set 965# CONFIG_USB_MTOUCH is not set
966# CONFIG_USB_ITMTOUCH is not set
894# CONFIG_USB_EGALAX is not set 967# CONFIG_USB_EGALAX is not set
968# CONFIG_USB_YEALINK is not set
895# CONFIG_USB_XPAD is not set 969# CONFIG_USB_XPAD is not set
896# CONFIG_USB_ATI_REMOTE is not set 970# CONFIG_USB_ATI_REMOTE is not set
971# CONFIG_USB_KEYSPAN_REMOTE is not set
972# CONFIG_USB_APPLETOUCH is not set
897 973
898# 974#
899# USB Imaging devices 975# USB Imaging devices
@@ -918,7 +994,7 @@ CONFIG_USB_HIDINPUT=y
918# CONFIG_USB_PEGASUS is not set 994# CONFIG_USB_PEGASUS is not set
919# CONFIG_USB_RTL8150 is not set 995# CONFIG_USB_RTL8150 is not set
920# CONFIG_USB_USBNET is not set 996# CONFIG_USB_USBNET is not set
921CONFIG_USB_MON=m 997CONFIG_USB_MON=y
922 998
923# 999#
924# USB port drivers 1000# USB port drivers
@@ -944,10 +1020,11 @@ CONFIG_USB_MON=m
944# CONFIG_USB_PHIDGETSERVO is not set 1020# CONFIG_USB_PHIDGETSERVO is not set
945# CONFIG_USB_IDMOUSE is not set 1021# CONFIG_USB_IDMOUSE is not set
946# CONFIG_USB_SISUSBVGA is not set 1022# CONFIG_USB_SISUSBVGA is not set
1023# CONFIG_USB_LD is not set
947# CONFIG_USB_TEST is not set 1024# CONFIG_USB_TEST is not set
948 1025
949# 1026#
950# USB ATM/DSL drivers 1027# USB DSL modem support
951# 1028#
952 1029
953# 1030#
@@ -964,6 +1041,8 @@ CONFIG_USB_MON=m
964# InfiniBand support 1041# InfiniBand support
965# 1042#
966CONFIG_INFINIBAND=m 1043CONFIG_INFINIBAND=m
1044# CONFIG_INFINIBAND_USER_MAD is not set
1045# CONFIG_INFINIBAND_USER_ACCESS is not set
967CONFIG_INFINIBAND_MTHCA=m 1046CONFIG_INFINIBAND_MTHCA=m
968# CONFIG_INFINIBAND_MTHCA_DEBUG is not set 1047# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
969CONFIG_INFINIBAND_IPOIB=m 1048CONFIG_INFINIBAND_IPOIB=m
@@ -981,6 +1060,7 @@ CONFIG_EXT2_FS=y
981CONFIG_EXT2_FS_XATTR=y 1060CONFIG_EXT2_FS_XATTR=y
982CONFIG_EXT2_FS_POSIX_ACL=y 1061CONFIG_EXT2_FS_POSIX_ACL=y
983CONFIG_EXT2_FS_SECURITY=y 1062CONFIG_EXT2_FS_SECURITY=y
1063# CONFIG_EXT2_FS_XIP is not set
984CONFIG_EXT3_FS=y 1064CONFIG_EXT3_FS=y
985CONFIG_EXT3_FS_XATTR=y 1065CONFIG_EXT3_FS_XATTR=y
986CONFIG_EXT3_FS_POSIX_ACL=y 1066CONFIG_EXT3_FS_POSIX_ACL=y
@@ -996,22 +1076,20 @@ CONFIG_REISERFS_FS_POSIX_ACL=y
996CONFIG_REISERFS_FS_SECURITY=y 1076CONFIG_REISERFS_FS_SECURITY=y
997# CONFIG_JFS_FS is not set 1077# CONFIG_JFS_FS is not set
998CONFIG_FS_POSIX_ACL=y 1078CONFIG_FS_POSIX_ACL=y
999
1000#
1001# XFS support
1002#
1003CONFIG_XFS_FS=y 1079CONFIG_XFS_FS=y
1004CONFIG_XFS_EXPORT=y 1080CONFIG_XFS_EXPORT=y
1005# CONFIG_XFS_RT is not set
1006# CONFIG_XFS_QUOTA is not set 1081# CONFIG_XFS_QUOTA is not set
1007# CONFIG_XFS_SECURITY is not set 1082# CONFIG_XFS_SECURITY is not set
1008# CONFIG_XFS_POSIX_ACL is not set 1083# CONFIG_XFS_POSIX_ACL is not set
1084# CONFIG_XFS_RT is not set
1009# CONFIG_MINIX_FS is not set 1085# CONFIG_MINIX_FS is not set
1010# CONFIG_ROMFS_FS is not set 1086# CONFIG_ROMFS_FS is not set
1087CONFIG_INOTIFY=y
1011# CONFIG_QUOTA is not set 1088# CONFIG_QUOTA is not set
1012CONFIG_DNOTIFY=y 1089CONFIG_DNOTIFY=y
1013CONFIG_AUTOFS_FS=y 1090CONFIG_AUTOFS_FS=y
1014CONFIG_AUTOFS4_FS=y 1091CONFIG_AUTOFS4_FS=y
1092# CONFIG_FUSE_FS is not set
1015 1093
1016# 1094#
1017# CD-ROM/DVD Filesystems 1095# CD-ROM/DVD Filesystems
@@ -1040,14 +1118,11 @@ CONFIG_NTFS_FS=m
1040CONFIG_PROC_FS=y 1118CONFIG_PROC_FS=y
1041CONFIG_PROC_KCORE=y 1119CONFIG_PROC_KCORE=y
1042CONFIG_SYSFS=y 1120CONFIG_SYSFS=y
1043# CONFIG_DEVFS_FS is not set
1044# CONFIG_DEVPTS_FS_XATTR is not set
1045CONFIG_TMPFS=y 1121CONFIG_TMPFS=y
1046CONFIG_TMPFS_XATTR=y
1047CONFIG_TMPFS_SECURITY=y
1048CONFIG_HUGETLBFS=y 1122CONFIG_HUGETLBFS=y
1049CONFIG_HUGETLB_PAGE=y 1123CONFIG_HUGETLB_PAGE=y
1050CONFIG_RAMFS=y 1124CONFIG_RAMFS=y
1125# CONFIG_RELAYFS_FS is not set
1051 1126
1052# 1127#
1053# Miscellaneous filesystems 1128# Miscellaneous filesystems
@@ -1071,15 +1146,18 @@ CONFIG_RAMFS=y
1071# 1146#
1072CONFIG_NFS_FS=m 1147CONFIG_NFS_FS=m
1073CONFIG_NFS_V3=y 1148CONFIG_NFS_V3=y
1149# CONFIG_NFS_V3_ACL is not set
1074CONFIG_NFS_V4=y 1150CONFIG_NFS_V4=y
1075CONFIG_NFS_DIRECTIO=y 1151CONFIG_NFS_DIRECTIO=y
1076CONFIG_NFSD=m 1152CONFIG_NFSD=m
1077CONFIG_NFSD_V3=y 1153CONFIG_NFSD_V3=y
1154# CONFIG_NFSD_V3_ACL is not set
1078CONFIG_NFSD_V4=y 1155CONFIG_NFSD_V4=y
1079CONFIG_NFSD_TCP=y 1156CONFIG_NFSD_TCP=y
1080CONFIG_LOCKD=m 1157CONFIG_LOCKD=m
1081CONFIG_LOCKD_V4=y 1158CONFIG_LOCKD_V4=y
1082CONFIG_EXPORTFS=y 1159CONFIG_EXPORTFS=y
1160CONFIG_NFS_COMMON=y
1083CONFIG_SUNRPC=m 1161CONFIG_SUNRPC=m
1084CONFIG_SUNRPC_GSS=m 1162CONFIG_SUNRPC_GSS=m
1085CONFIG_RPCSEC_GSS_KRB5=m 1163CONFIG_RPCSEC_GSS_KRB5=m
@@ -1094,6 +1172,7 @@ CONFIG_CIFS=m
1094# CONFIG_NCP_FS is not set 1172# CONFIG_NCP_FS is not set
1095# CONFIG_CODA_FS is not set 1173# CONFIG_CODA_FS is not set
1096# CONFIG_AFS_FS is not set 1174# CONFIG_AFS_FS is not set
1175# CONFIG_9P_FS is not set
1097 1176
1098# 1177#
1099# Partition Types 1178# Partition Types
@@ -1163,10 +1242,12 @@ CONFIG_NLS_UTF8=m
1163# Library routines 1242# Library routines
1164# 1243#
1165# CONFIG_CRC_CCITT is not set 1244# CONFIG_CRC_CCITT is not set
1245# CONFIG_CRC16 is not set
1166CONFIG_CRC32=y 1246CONFIG_CRC32=y
1167# CONFIG_LIBCRC32C is not set 1247# CONFIG_LIBCRC32C is not set
1168CONFIG_GENERIC_HARDIRQS=y 1248CONFIG_GENERIC_HARDIRQS=y
1169CONFIG_GENERIC_IRQ_PROBE=y 1249CONFIG_GENERIC_IRQ_PROBE=y
1250CONFIG_GENERIC_PENDING_IRQ=y
1170 1251
1171# 1252#
1172# HP Simulator drivers 1253# HP Simulator drivers
@@ -1187,6 +1268,7 @@ CONFIG_GENERIC_IRQ_PROBE=y
1187CONFIG_DEBUG_KERNEL=y 1268CONFIG_DEBUG_KERNEL=y
1188CONFIG_MAGIC_SYSRQ=y 1269CONFIG_MAGIC_SYSRQ=y
1189CONFIG_LOG_BUF_SHIFT=20 1270CONFIG_LOG_BUF_SHIFT=20
1271CONFIG_DETECT_SOFTLOCKUP=y
1190# CONFIG_SCHEDSTATS is not set 1272# CONFIG_SCHEDSTATS is not set
1191# CONFIG_DEBUG_SLAB is not set 1273# CONFIG_DEBUG_SLAB is not set
1192# CONFIG_DEBUG_SPINLOCK is not set 1274# CONFIG_DEBUG_SPINLOCK is not set
@@ -1194,6 +1276,7 @@ CONFIG_LOG_BUF_SHIFT=20
1194# CONFIG_DEBUG_KOBJECT is not set 1276# CONFIG_DEBUG_KOBJECT is not set
1195# CONFIG_DEBUG_INFO is not set 1277# CONFIG_DEBUG_INFO is not set
1196# CONFIG_DEBUG_FS is not set 1278# CONFIG_DEBUG_FS is not set
1279# CONFIG_KPROBES is not set
1197CONFIG_IA64_GRANULE_16MB=y 1280CONFIG_IA64_GRANULE_16MB=y
1198# CONFIG_IA64_GRANULE_64MB is not set 1281# CONFIG_IA64_GRANULE_64MB is not set
1199# CONFIG_IA64_PRINT_HAZARDS is not set 1282# CONFIG_IA64_PRINT_HAZARDS is not set
@@ -1215,7 +1298,7 @@ CONFIG_CRYPTO=y
1215# CONFIG_CRYPTO_HMAC is not set 1298# CONFIG_CRYPTO_HMAC is not set
1216# CONFIG_CRYPTO_NULL is not set 1299# CONFIG_CRYPTO_NULL is not set
1217# CONFIG_CRYPTO_MD4 is not set 1300# CONFIG_CRYPTO_MD4 is not set
1218CONFIG_CRYPTO_MD5=m 1301CONFIG_CRYPTO_MD5=y
1219# CONFIG_CRYPTO_SHA1 is not set 1302# CONFIG_CRYPTO_SHA1 is not set
1220# CONFIG_CRYPTO_SHA256 is not set 1303# CONFIG_CRYPTO_SHA256 is not set
1221# CONFIG_CRYPTO_SHA512 is not set 1304# CONFIG_CRYPTO_SHA512 is not set
diff --git a/arch/ia64/hp/common/hwsw_iommu.c b/arch/ia64/hp/common/hwsw_iommu.c
index 1ba02baf2f94..a5a5637507be 100644
--- a/arch/ia64/hp/common/hwsw_iommu.c
+++ b/arch/ia64/hp/common/hwsw_iommu.c
@@ -17,7 +17,7 @@
17#include <asm/machvec.h> 17#include <asm/machvec.h>
18 18
19/* swiotlb declarations & definitions: */ 19/* swiotlb declarations & definitions: */
20extern void swiotlb_init_with_default_size (size_t size); 20extern int swiotlb_late_init_with_default_size (size_t size);
21extern ia64_mv_dma_alloc_coherent swiotlb_alloc_coherent; 21extern ia64_mv_dma_alloc_coherent swiotlb_alloc_coherent;
22extern ia64_mv_dma_free_coherent swiotlb_free_coherent; 22extern ia64_mv_dma_free_coherent swiotlb_free_coherent;
23extern ia64_mv_dma_map_single swiotlb_map_single; 23extern ia64_mv_dma_map_single swiotlb_map_single;
@@ -67,7 +67,16 @@ void
67hwsw_init (void) 67hwsw_init (void)
68{ 68{
69 /* default to a smallish 2MB sw I/O TLB */ 69 /* default to a smallish 2MB sw I/O TLB */
70 swiotlb_init_with_default_size (2 * (1<<20)); 70 if (swiotlb_late_init_with_default_size (2 * (1<<20)) != 0) {
71#ifdef CONFIG_IA64_GENERIC
72 /* Better to have normal DMA than panic */
73 printk(KERN_WARNING "%s: Failed to initialize software I/O TLB,"
74 " reverting to hpzx1 platform vector\n", __FUNCTION__);
75 machvec_init("hpzx1");
76#else
77 panic("Unable to initialize software I/O TLB services");
78#endif
79 }
71} 80}
72 81
73void * 82void *
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 21bffba78b6d..bdccd0b1eb60 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -2028,9 +2028,40 @@ static struct acpi_driver acpi_sba_ioc_driver = {
2028static int __init 2028static int __init
2029sba_init(void) 2029sba_init(void)
2030{ 2030{
2031 if (!ia64_platform_is("hpzx1") && !ia64_platform_is("hpzx1_swiotlb"))
2032 return 0;
2033
2031 acpi_bus_register_driver(&acpi_sba_ioc_driver); 2034 acpi_bus_register_driver(&acpi_sba_ioc_driver);
2032 if (!ioc_list) 2035 if (!ioc_list) {
2036#ifdef CONFIG_IA64_GENERIC
2037 extern int swiotlb_late_init_with_default_size (size_t size);
2038
2039 /*
2040 * If we didn't find something sba_iommu can claim, we
2041 * need to setup the swiotlb and switch to the dig machvec.
2042 */
2043 if (swiotlb_late_init_with_default_size(64 * (1<<20)) != 0)
2044 panic("Unable to find SBA IOMMU or initialize "
2045 "software I/O TLB: Try machvec=dig boot option");
2046 machvec_init("dig");
2047#else
2048 panic("Unable to find SBA IOMMU: Try a generic or DIG kernel");
2049#endif
2033 return 0; 2050 return 0;
2051 }
2052
2053#if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_HP_ZX1_SWIOTLB)
2054 /*
2055 * hpzx1_swiotlb needs to have a fairly small swiotlb bounce
2056 * buffer setup to support devices with smaller DMA masks than
2057 * sba_iommu can handle.
2058 */
2059 if (ia64_platform_is("hpzx1_swiotlb")) {
2060 extern void hwsw_init(void);
2061
2062 hwsw_init();
2063 }
2064#endif
2034 2065
2035#ifdef CONFIG_PCI 2066#ifdef CONFIG_PCI
2036 { 2067 {
@@ -2048,18 +2079,6 @@ sba_init(void)
2048 2079
2049subsys_initcall(sba_init); /* must be initialized after ACPI etc., but before any drivers... */ 2080subsys_initcall(sba_init); /* must be initialized after ACPI etc., but before any drivers... */
2050 2081
2051extern void dig_setup(char**);
2052/*
2053 * MAX_DMA_ADDRESS needs to be setup prior to paging_init to do any good,
2054 * so we use the platform_setup hook to fix it up.
2055 */
2056void __init
2057sba_setup(char **cmdline_p)
2058{
2059 MAX_DMA_ADDRESS = ~0UL;
2060 dig_setup(cmdline_p);
2061}
2062
2063static int __init 2082static int __init
2064nosbagart(char *str) 2083nosbagart(char *str)
2065{ 2084{
diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c
index a18983a3c934..a3fe97531134 100644
--- a/arch/ia64/hp/sim/simscsi.c
+++ b/arch/ia64/hp/sim/simscsi.c
@@ -205,10 +205,11 @@ simscsi_get_disk_size (int fd)
205 char buf[512]; 205 char buf[512];
206 206
207 /* 207 /*
208 * This is a bit kludgey: the simulator doesn't provide a direct way of determining 208 * This is a bit kludgey: the simulator doesn't provide a
209 * the disk size, so we do a binary search, assuming a maximum disk size of 4GB. 209 * direct way of determining the disk size, so we do a binary
210 * search, assuming a maximum disk size of 128GB.
210 */ 211 */
211 for (bit = (4UL << 30)/512; bit != 0; bit >>= 1) { 212 for (bit = (128UL << 30)/512; bit != 0; bit >>= 1) {
212 req.addr = __pa(&buf); 213 req.addr = __pa(&buf);
213 req.len = sizeof(buf); 214 req.len = sizeof(buf);
214 ia64_ssc(fd, 1, __pa(&req), ((sectors | bit) - 1)*512, SSC_READ); 215 ia64_ssc(fd, 1, __pa(&req), ((sectors | bit) - 1)*512, SSC_READ);
@@ -225,8 +226,10 @@ simscsi_readwrite10 (struct scsi_cmnd *sc, int mode)
225{ 226{
226 unsigned long offset; 227 unsigned long offset;
227 228
228 offset = ( (sc->cmnd[2] << 24) | (sc->cmnd[3] << 16) 229 offset = (((unsigned long)sc->cmnd[2] << 24)
229 | (sc->cmnd[4] << 8) | (sc->cmnd[5] << 0))*512; 230 | ((unsigned long)sc->cmnd[3] << 16)
231 | ((unsigned long)sc->cmnd[4] << 8)
232 | ((unsigned long)sc->cmnd[5] << 0))*512UL;
230 if (sc->use_sg > 0) 233 if (sc->use_sg > 0)
231 simscsi_sg_readwrite(sc, mode, offset); 234 simscsi_sg_readwrite(sc, mode, offset);
232 else 235 else
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 7e926471e4ec..9ad94ddf6687 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -838,7 +838,7 @@ EXPORT_SYMBOL(acpi_unmap_lsapic);
838#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 838#endif /* CONFIG_ACPI_HOTPLUG_CPU */
839 839
840#ifdef CONFIG_ACPI_NUMA 840#ifdef CONFIG_ACPI_NUMA
841acpi_status __devinit 841static acpi_status __devinit
842acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret) 842acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
843{ 843{
844 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 844 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -890,7 +890,16 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
890 map_iosapic_to_node(gsi_base, node); 890 map_iosapic_to_node(gsi_base, node);
891 return AE_OK; 891 return AE_OK;
892} 892}
893#endif /* CONFIG_NUMA */ 893
894static int __init
895acpi_map_iosapics (void)
896{
897 acpi_get_devices(NULL, acpi_map_iosapic, NULL, NULL);
898 return 0;
899}
900
901fs_initcall(acpi_map_iosapics);
902#endif /* CONFIG_ACPI_NUMA */
894 903
895int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base) 904int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
896{ 905{
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 179f230816ed..f72ea6aebcb1 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -239,57 +239,30 @@ is_available_memory (efi_memory_desc_t *md)
239 return 0; 239 return 0;
240} 240}
241 241
242/* 242typedef struct kern_memdesc {
243 * Trim descriptor MD so its starts at address START_ADDR. If the descriptor covers 243 u64 attribute;
244 * memory that is normally available to the kernel, issue a warning that some memory 244 u64 start;
245 * is being ignored. 245 u64 num_pages;
246 */ 246} kern_memdesc_t;
247static void
248trim_bottom (efi_memory_desc_t *md, u64 start_addr)
249{
250 u64 num_skipped_pages;
251 247
252 if (md->phys_addr >= start_addr || !md->num_pages) 248static kern_memdesc_t *kern_memmap;
253 return;
254
255 num_skipped_pages = (start_addr - md->phys_addr) >> EFI_PAGE_SHIFT;
256 if (num_skipped_pages > md->num_pages)
257 num_skipped_pages = md->num_pages;
258
259 if (is_available_memory(md))
260 printk(KERN_NOTICE "efi.%s: ignoring %luKB of memory at 0x%lx due to granule hole "
261 "at 0x%lx\n", __FUNCTION__,
262 (num_skipped_pages << EFI_PAGE_SHIFT) >> 10,
263 md->phys_addr, start_addr - IA64_GRANULE_SIZE);
264 /*
265 * NOTE: Don't set md->phys_addr to START_ADDR because that could cause the memory
266 * descriptor list to become unsorted. In such a case, md->num_pages will be
267 * zero, so the Right Thing will happen.
268 */
269 md->phys_addr += num_skipped_pages << EFI_PAGE_SHIFT;
270 md->num_pages -= num_skipped_pages;
271}
272 249
273static void 250static void
274trim_top (efi_memory_desc_t *md, u64 end_addr) 251walk (efi_freemem_callback_t callback, void *arg, u64 attr)
275{ 252{
276 u64 num_dropped_pages, md_end_addr; 253 kern_memdesc_t *k;
277 254 u64 start, end, voff;
278 md_end_addr = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
279
280 if (md_end_addr <= end_addr || !md->num_pages)
281 return;
282 255
283 num_dropped_pages = (md_end_addr - end_addr) >> EFI_PAGE_SHIFT; 256 voff = (attr == EFI_MEMORY_WB) ? PAGE_OFFSET : __IA64_UNCACHED_OFFSET;
284 if (num_dropped_pages > md->num_pages) 257 for (k = kern_memmap; k->start != ~0UL; k++) {
285 num_dropped_pages = md->num_pages; 258 if (k->attribute != attr)
286 259 continue;
287 if (is_available_memory(md)) 260 start = PAGE_ALIGN(k->start);
288 printk(KERN_NOTICE "efi.%s: ignoring %luKB of memory at 0x%lx due to granule hole " 261 end = (k->start + (k->num_pages << EFI_PAGE_SHIFT)) & PAGE_MASK;
289 "at 0x%lx\n", __FUNCTION__, 262 if (start < end)
290 (num_dropped_pages << EFI_PAGE_SHIFT) >> 10, 263 if ((*callback)(start + voff, end + voff, arg) < 0)
291 md->phys_addr, end_addr); 264 return;
292 md->num_pages -= num_dropped_pages; 265 }
293} 266}
294 267
295/* 268/*
@@ -299,148 +272,19 @@ trim_top (efi_memory_desc_t *md, u64 end_addr)
299void 272void
300efi_memmap_walk (efi_freemem_callback_t callback, void *arg) 273efi_memmap_walk (efi_freemem_callback_t callback, void *arg)
301{ 274{
302 int prev_valid = 0; 275 walk(callback, arg, EFI_MEMORY_WB);
303 struct range {
304 u64 start;
305 u64 end;
306 } prev, curr;
307 void *efi_map_start, *efi_map_end, *p, *q;
308 efi_memory_desc_t *md, *check_md;
309 u64 efi_desc_size, start, end, granule_addr, last_granule_addr, first_non_wb_addr = 0;
310 unsigned long total_mem = 0;
311
312 efi_map_start = __va(ia64_boot_param->efi_memmap);
313 efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
314 efi_desc_size = ia64_boot_param->efi_memdesc_size;
315
316 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
317 md = p;
318
319 /* skip over non-WB memory descriptors; that's all we're interested in... */
320 if (!(md->attribute & EFI_MEMORY_WB))
321 continue;
322
323 /*
324 * granule_addr is the base of md's first granule.
325 * [granule_addr - first_non_wb_addr) is guaranteed to
326 * be contiguous WB memory.
327 */
328 granule_addr = GRANULEROUNDDOWN(md->phys_addr);
329 first_non_wb_addr = max(first_non_wb_addr, granule_addr);
330
331 if (first_non_wb_addr < md->phys_addr) {
332 trim_bottom(md, granule_addr + IA64_GRANULE_SIZE);
333 granule_addr = GRANULEROUNDDOWN(md->phys_addr);
334 first_non_wb_addr = max(first_non_wb_addr, granule_addr);
335 }
336
337 for (q = p; q < efi_map_end; q += efi_desc_size) {
338 check_md = q;
339
340 if ((check_md->attribute & EFI_MEMORY_WB) &&
341 (check_md->phys_addr == first_non_wb_addr))
342 first_non_wb_addr += check_md->num_pages << EFI_PAGE_SHIFT;
343 else
344 break; /* non-WB or hole */
345 }
346
347 last_granule_addr = GRANULEROUNDDOWN(first_non_wb_addr);
348 if (last_granule_addr < md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT))
349 trim_top(md, last_granule_addr);
350
351 if (is_available_memory(md)) {
352 if (md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) >= max_addr) {
353 if (md->phys_addr >= max_addr)
354 continue;
355 md->num_pages = (max_addr - md->phys_addr) >> EFI_PAGE_SHIFT;
356 first_non_wb_addr = max_addr;
357 }
358
359 if (total_mem >= mem_limit)
360 continue;
361
362 if (total_mem + (md->num_pages << EFI_PAGE_SHIFT) > mem_limit) {
363 unsigned long limit_addr = md->phys_addr;
364
365 limit_addr += mem_limit - total_mem;
366 limit_addr = GRANULEROUNDDOWN(limit_addr);
367
368 if (md->phys_addr > limit_addr)
369 continue;
370
371 md->num_pages = (limit_addr - md->phys_addr) >>
372 EFI_PAGE_SHIFT;
373 first_non_wb_addr = max_addr = md->phys_addr +
374 (md->num_pages << EFI_PAGE_SHIFT);
375 }
376 total_mem += (md->num_pages << EFI_PAGE_SHIFT);
377
378 if (md->num_pages == 0)
379 continue;
380
381 curr.start = PAGE_OFFSET + md->phys_addr;
382 curr.end = curr.start + (md->num_pages << EFI_PAGE_SHIFT);
383
384 if (!prev_valid) {
385 prev = curr;
386 prev_valid = 1;
387 } else {
388 if (curr.start < prev.start)
389 printk(KERN_ERR "Oops: EFI memory table not ordered!\n");
390
391 if (prev.end == curr.start) {
392 /* merge two consecutive memory ranges */
393 prev.end = curr.end;
394 } else {
395 start = PAGE_ALIGN(prev.start);
396 end = prev.end & PAGE_MASK;
397 if ((end > start) && (*callback)(start, end, arg) < 0)
398 return;
399 prev = curr;
400 }
401 }
402 }
403 }
404 if (prev_valid) {
405 start = PAGE_ALIGN(prev.start);
406 end = prev.end & PAGE_MASK;
407 if (end > start)
408 (*callback)(start, end, arg);
409 }
410} 276}
411 277
412/* 278/*
413 * Walk the EFI memory map to pull out leftover pages in the lower 279 * Walks the EFI memory map and calls CALLBACK once for each EFI memory descriptor that
414 * memory regions which do not end up in the regular memory map and 280 * has memory that is available for uncached allocator.
415 * stick them into the uncached allocator
416 *
417 * The regular walk function is significantly more complex than the
418 * uncached walk which means it really doesn't make sense to try and
419 * marge the two.
420 */ 281 */
421void __init 282void
422efi_memmap_walk_uc (efi_freemem_callback_t callback) 283efi_memmap_walk_uc (efi_freemem_callback_t callback, void *arg)
423{ 284{
424 void *efi_map_start, *efi_map_end, *p; 285 walk(callback, arg, EFI_MEMORY_UC);
425 efi_memory_desc_t *md;
426 u64 efi_desc_size, start, end;
427
428 efi_map_start = __va(ia64_boot_param->efi_memmap);
429 efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
430 efi_desc_size = ia64_boot_param->efi_memdesc_size;
431
432 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
433 md = p;
434 if (md->attribute == EFI_MEMORY_UC) {
435 start = PAGE_ALIGN(md->phys_addr);
436 end = PAGE_ALIGN((md->phys_addr+(md->num_pages << EFI_PAGE_SHIFT)) & PAGE_MASK);
437 if ((*callback)(start, end, NULL) < 0)
438 return;
439 }
440 }
441} 286}
442 287
443
444/* 288/*
445 * Look for the PAL_CODE region reported by EFI and maps it using an 289 * Look for the PAL_CODE region reported by EFI and maps it using an
446 * ITR to enable safe PAL calls in virtual mode. See IA-64 Processor 290 * ITR to enable safe PAL calls in virtual mode. See IA-64 Processor
@@ -862,3 +706,307 @@ efi_uart_console_only(void)
862 printk(KERN_ERR "Malformed %s value\n", name); 706 printk(KERN_ERR "Malformed %s value\n", name);
863 return 0; 707 return 0;
864} 708}
709
710#define efi_md_size(md) (md->num_pages << EFI_PAGE_SHIFT)
711
712static inline u64
713kmd_end(kern_memdesc_t *kmd)
714{
715 return (kmd->start + (kmd->num_pages << EFI_PAGE_SHIFT));
716}
717
718static inline u64
719efi_md_end(efi_memory_desc_t *md)
720{
721 return (md->phys_addr + efi_md_size(md));
722}
723
724static inline int
725efi_wb(efi_memory_desc_t *md)
726{
727 return (md->attribute & EFI_MEMORY_WB);
728}
729
730static inline int
731efi_uc(efi_memory_desc_t *md)
732{
733 return (md->attribute & EFI_MEMORY_UC);
734}
735
736/*
737 * Look for the first granule aligned memory descriptor memory
738 * that is big enough to hold EFI memory map. Make sure this
739 * descriptor is atleast granule sized so it does not get trimmed
740 */
741struct kern_memdesc *
742find_memmap_space (void)
743{
744 u64 contig_low=0, contig_high=0;
745 u64 as = 0, ae;
746 void *efi_map_start, *efi_map_end, *p, *q;
747 efi_memory_desc_t *md, *pmd = NULL, *check_md;
748 u64 space_needed, efi_desc_size;
749 unsigned long total_mem = 0;
750
751 efi_map_start = __va(ia64_boot_param->efi_memmap);
752 efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
753 efi_desc_size = ia64_boot_param->efi_memdesc_size;
754
755 /*
756 * Worst case: we need 3 kernel descriptors for each efi descriptor
757 * (if every entry has a WB part in the middle, and UC head and tail),
758 * plus one for the end marker.
759 */
760 space_needed = sizeof(kern_memdesc_t) *
761 (3 * (ia64_boot_param->efi_memmap_size/efi_desc_size) + 1);
762
763 for (p = efi_map_start; p < efi_map_end; pmd = md, p += efi_desc_size) {
764 md = p;
765 if (!efi_wb(md)) {
766 continue;
767 }
768 if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != md->phys_addr) {
769 contig_low = GRANULEROUNDUP(md->phys_addr);
770 contig_high = efi_md_end(md);
771 for (q = p + efi_desc_size; q < efi_map_end; q += efi_desc_size) {
772 check_md = q;
773 if (!efi_wb(check_md))
774 break;
775 if (contig_high != check_md->phys_addr)
776 break;
777 contig_high = efi_md_end(check_md);
778 }
779 contig_high = GRANULEROUNDDOWN(contig_high);
780 }
781 if (!is_available_memory(md) || md->type == EFI_LOADER_DATA)
782 continue;
783
784 /* Round ends inward to granule boundaries */
785 as = max(contig_low, md->phys_addr);
786 ae = min(contig_high, efi_md_end(md));
787
788 /* keep within max_addr= command line arg */
789 ae = min(ae, max_addr);
790 if (ae <= as)
791 continue;
792
793 /* avoid going over mem= command line arg */
794 if (total_mem + (ae - as) > mem_limit)
795 ae -= total_mem + (ae - as) - mem_limit;
796
797 if (ae <= as)
798 continue;
799
800 if (ae - as > space_needed)
801 break;
802 }
803 if (p >= efi_map_end)
804 panic("Can't allocate space for kernel memory descriptors");
805
806 return __va(as);
807}
808
809/*
810 * Walk the EFI memory map and gather all memory available for kernel
811 * to use. We can allocate partial granules only if the unavailable
812 * parts exist, and are WB.
813 */
814void
815efi_memmap_init(unsigned long *s, unsigned long *e)
816{
817 struct kern_memdesc *k, *prev = 0;
818 u64 contig_low=0, contig_high=0;
819 u64 as, ae, lim;
820 void *efi_map_start, *efi_map_end, *p, *q;
821 efi_memory_desc_t *md, *pmd = NULL, *check_md;
822 u64 efi_desc_size;
823 unsigned long total_mem = 0;
824
825 k = kern_memmap = find_memmap_space();
826
827 efi_map_start = __va(ia64_boot_param->efi_memmap);
828 efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
829 efi_desc_size = ia64_boot_param->efi_memdesc_size;
830
831 for (p = efi_map_start; p < efi_map_end; pmd = md, p += efi_desc_size) {
832 md = p;
833 if (!efi_wb(md)) {
834 if (efi_uc(md) && (md->type == EFI_CONVENTIONAL_MEMORY ||
835 md->type == EFI_BOOT_SERVICES_DATA)) {
836 k->attribute = EFI_MEMORY_UC;
837 k->start = md->phys_addr;
838 k->num_pages = md->num_pages;
839 k++;
840 }
841 continue;
842 }
843 if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != md->phys_addr) {
844 contig_low = GRANULEROUNDUP(md->phys_addr);
845 contig_high = efi_md_end(md);
846 for (q = p + efi_desc_size; q < efi_map_end; q += efi_desc_size) {
847 check_md = q;
848 if (!efi_wb(check_md))
849 break;
850 if (contig_high != check_md->phys_addr)
851 break;
852 contig_high = efi_md_end(check_md);
853 }
854 contig_high = GRANULEROUNDDOWN(contig_high);
855 }
856 if (!is_available_memory(md))
857 continue;
858
859 /*
860 * Round ends inward to granule boundaries
861 * Give trimmings to uncached allocator
862 */
863 if (md->phys_addr < contig_low) {
864 lim = min(efi_md_end(md), contig_low);
865 if (efi_uc(md)) {
866 if (k > kern_memmap && (k-1)->attribute == EFI_MEMORY_UC &&
867 kmd_end(k-1) == md->phys_addr) {
868 (k-1)->num_pages += (lim - md->phys_addr) >> EFI_PAGE_SHIFT;
869 } else {
870 k->attribute = EFI_MEMORY_UC;
871 k->start = md->phys_addr;
872 k->num_pages = (lim - md->phys_addr) >> EFI_PAGE_SHIFT;
873 k++;
874 }
875 }
876 as = contig_low;
877 } else
878 as = md->phys_addr;
879
880 if (efi_md_end(md) > contig_high) {
881 lim = max(md->phys_addr, contig_high);
882 if (efi_uc(md)) {
883 if (lim == md->phys_addr && k > kern_memmap &&
884 (k-1)->attribute == EFI_MEMORY_UC &&
885 kmd_end(k-1) == md->phys_addr) {
886 (k-1)->num_pages += md->num_pages;
887 } else {
888 k->attribute = EFI_MEMORY_UC;
889 k->start = lim;
890 k->num_pages = (efi_md_end(md) - lim) >> EFI_PAGE_SHIFT;
891 k++;
892 }
893 }
894 ae = contig_high;
895 } else
896 ae = efi_md_end(md);
897
898 /* keep within max_addr= command line arg */
899 ae = min(ae, max_addr);
900 if (ae <= as)
901 continue;
902
903 /* avoid going over mem= command line arg */
904 if (total_mem + (ae - as) > mem_limit)
905 ae -= total_mem + (ae - as) - mem_limit;
906
907 if (ae <= as)
908 continue;
909 if (prev && kmd_end(prev) == md->phys_addr) {
910 prev->num_pages += (ae - as) >> EFI_PAGE_SHIFT;
911 total_mem += ae - as;
912 continue;
913 }
914 k->attribute = EFI_MEMORY_WB;
915 k->start = as;
916 k->num_pages = (ae - as) >> EFI_PAGE_SHIFT;
917 total_mem += ae - as;
918 prev = k++;
919 }
920 k->start = ~0L; /* end-marker */
921
922 /* reserve the memory we are using for kern_memmap */
923 *s = (u64)kern_memmap;
924 *e = (u64)++k;
925}
926
927void
928efi_initialize_iomem_resources(struct resource *code_resource,
929 struct resource *data_resource)
930{
931 struct resource *res;
932 void *efi_map_start, *efi_map_end, *p;
933 efi_memory_desc_t *md;
934 u64 efi_desc_size;
935 char *name;
936 unsigned long flags;
937
938 efi_map_start = __va(ia64_boot_param->efi_memmap);
939 efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
940 efi_desc_size = ia64_boot_param->efi_memdesc_size;
941
942 res = NULL;
943
944 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
945 md = p;
946
947 if (md->num_pages == 0) /* should not happen */
948 continue;
949
950 flags = IORESOURCE_MEM;
951 switch (md->type) {
952
953 case EFI_MEMORY_MAPPED_IO:
954 case EFI_MEMORY_MAPPED_IO_PORT_SPACE:
955 continue;
956
957 case EFI_LOADER_CODE:
958 case EFI_LOADER_DATA:
959 case EFI_BOOT_SERVICES_DATA:
960 case EFI_BOOT_SERVICES_CODE:
961 case EFI_CONVENTIONAL_MEMORY:
962 if (md->attribute & EFI_MEMORY_WP) {
963 name = "System ROM";
964 flags |= IORESOURCE_READONLY;
965 } else {
966 name = "System RAM";
967 }
968 break;
969
970 case EFI_ACPI_MEMORY_NVS:
971 name = "ACPI Non-volatile Storage";
972 flags |= IORESOURCE_BUSY;
973 break;
974
975 case EFI_UNUSABLE_MEMORY:
976 name = "reserved";
977 flags |= IORESOURCE_BUSY | IORESOURCE_DISABLED;
978 break;
979
980 case EFI_RESERVED_TYPE:
981 case EFI_RUNTIME_SERVICES_CODE:
982 case EFI_RUNTIME_SERVICES_DATA:
983 case EFI_ACPI_RECLAIM_MEMORY:
984 default:
985 name = "reserved";
986 flags |= IORESOURCE_BUSY;
987 break;
988 }
989
990 if ((res = kcalloc(1, sizeof(struct resource), GFP_KERNEL)) == NULL) {
991 printk(KERN_ERR "failed to alocate resource for iomem\n");
992 return;
993 }
994
995 res->name = name;
996 res->start = md->phys_addr;
997 res->end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) - 1;
998 res->flags = flags;
999
1000 if (insert_resource(&iomem_resource, res) < 0)
1001 kfree(res);
1002 else {
1003 /*
1004 * We don't know which region contains
1005 * kernel data so we try it repeatedly and
1006 * let the resource manager test it.
1007 */
1008 insert_resource(res, code_resource);
1009 insert_resource(res, data_resource);
1010 }
1011 }
1012}
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index 205d98028261..d33244c32759 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -57,9 +57,9 @@ int show_interrupts(struct seq_file *p, void *v)
57 57
58 if (i == 0) { 58 if (i == 0) {
59 seq_printf(p, " "); 59 seq_printf(p, " ");
60 for (j=0; j<NR_CPUS; j++) 60 for_each_online_cpu(j) {
61 if (cpu_online(j)) 61 seq_printf(p, "CPU%d ",j);
62 seq_printf(p, "CPU%d ",j); 62 }
63 seq_putc(p, '\n'); 63 seq_putc(p, '\n');
64 } 64 }
65 65
@@ -72,9 +72,9 @@ int show_interrupts(struct seq_file *p, void *v)
72#ifndef CONFIG_SMP 72#ifndef CONFIG_SMP
73 seq_printf(p, "%10u ", kstat_irqs(i)); 73 seq_printf(p, "%10u ", kstat_irqs(i));
74#else 74#else
75 for (j = 0; j < NR_CPUS; j++) 75 for_each_online_cpu(j) {
76 if (cpu_online(j)) 76 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
77 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); 77 }
78#endif 78#endif
79 seq_printf(p, " %14s", irq_desc[i].handler->typename); 79 seq_printf(p, " %14s", irq_desc[i].handler->typename);
80 seq_printf(p, " %s", action->name); 80 seq_printf(p, " %s", action->name);
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index d0a5106fba24..52c47da17246 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -508,9 +508,7 @@ ia64_mca_wakeup_all(void)
508 int cpu; 508 int cpu;
509 509
510 /* Clear the Rendez checkin flag for all cpus */ 510 /* Clear the Rendez checkin flag for all cpus */
511 for(cpu = 0; cpu < NR_CPUS; cpu++) { 511 for_each_online_cpu(cpu) {
512 if (!cpu_online(cpu))
513 continue;
514 if (ia64_mc_info.imi_rendez_checkin[cpu] == IA64_MCA_RENDEZ_CHECKIN_DONE) 512 if (ia64_mc_info.imi_rendez_checkin[cpu] == IA64_MCA_RENDEZ_CHECKIN_DONE)
515 ia64_mca_wakeup(cpu); 513 ia64_mca_wakeup(cpu);
516 } 514 }
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index f1aca7cffd12..7a2f0a798d12 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -947,8 +947,8 @@ void
947percpu_modcopy (void *pcpudst, const void *src, unsigned long size) 947percpu_modcopy (void *pcpudst, const void *src, unsigned long size)
948{ 948{
949 unsigned int i; 949 unsigned int i;
950 for (i = 0; i < NR_CPUS; i++) 950 for_each_cpu(i) {
951 if (cpu_possible(i)) 951 memcpy(pcpudst + __per_cpu_offset[i], src, size);
952 memcpy(pcpudst + __per_cpu_offset[i], src, size); 952 }
953} 953}
954#endif /* CONFIG_SMP */ 954#endif /* CONFIG_SMP */
diff --git a/arch/ia64/kernel/patch.c b/arch/ia64/kernel/patch.c
index 367804a605fa..6a4ac7d70b35 100644
--- a/arch/ia64/kernel/patch.c
+++ b/arch/ia64/kernel/patch.c
@@ -64,22 +64,30 @@ ia64_patch (u64 insn_addr, u64 mask, u64 val)
64void 64void
65ia64_patch_imm64 (u64 insn_addr, u64 val) 65ia64_patch_imm64 (u64 insn_addr, u64 val)
66{ 66{
67 ia64_patch(insn_addr, 67 /* The assembler may generate offset pointing to either slot 1
68 or slot 2 for a long (2-slot) instruction, occupying slots 1
69 and 2. */
70 insn_addr &= -16UL;
71 ia64_patch(insn_addr + 2,
68 0x01fffefe000UL, ( ((val & 0x8000000000000000UL) >> 27) /* bit 63 -> 36 */ 72 0x01fffefe000UL, ( ((val & 0x8000000000000000UL) >> 27) /* bit 63 -> 36 */
69 | ((val & 0x0000000000200000UL) << 0) /* bit 21 -> 21 */ 73 | ((val & 0x0000000000200000UL) << 0) /* bit 21 -> 21 */
70 | ((val & 0x00000000001f0000UL) << 6) /* bit 16 -> 22 */ 74 | ((val & 0x00000000001f0000UL) << 6) /* bit 16 -> 22 */
71 | ((val & 0x000000000000ff80UL) << 20) /* bit 7 -> 27 */ 75 | ((val & 0x000000000000ff80UL) << 20) /* bit 7 -> 27 */
72 | ((val & 0x000000000000007fUL) << 13) /* bit 0 -> 13 */)); 76 | ((val & 0x000000000000007fUL) << 13) /* bit 0 -> 13 */));
73 ia64_patch(insn_addr - 1, 0x1ffffffffffUL, val >> 22); 77 ia64_patch(insn_addr + 1, 0x1ffffffffffUL, val >> 22);
74} 78}
75 79
76void 80void
77ia64_patch_imm60 (u64 insn_addr, u64 val) 81ia64_patch_imm60 (u64 insn_addr, u64 val)
78{ 82{
79 ia64_patch(insn_addr, 83 /* The assembler may generate offset pointing to either slot 1
84 or slot 2 for a long (2-slot) instruction, occupying slots 1
85 and 2. */
86 insn_addr &= -16UL;
87 ia64_patch(insn_addr + 2,
80 0x011ffffe000UL, ( ((val & 0x0800000000000000UL) >> 23) /* bit 59 -> 36 */ 88 0x011ffffe000UL, ( ((val & 0x0800000000000000UL) >> 23) /* bit 59 -> 36 */
81 | ((val & 0x00000000000fffffUL) << 13) /* bit 0 -> 13 */)); 89 | ((val & 0x00000000000fffffUL) << 13) /* bit 0 -> 13 */));
82 ia64_patch(insn_addr - 1, 0x1fffffffffcUL, val >> 18); 90 ia64_patch(insn_addr + 1, 0x1fffffffffcUL, val >> 18);
83} 91}
84 92
85/* 93/*
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index bbb8bc7c0552..4b19d0410632 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -587,8 +587,9 @@ thread_matches (struct task_struct *thread, unsigned long addr)
587static struct task_struct * 587static struct task_struct *
588find_thread_for_addr (struct task_struct *child, unsigned long addr) 588find_thread_for_addr (struct task_struct *child, unsigned long addr)
589{ 589{
590 struct task_struct *g, *p; 590 struct task_struct *p;
591 struct mm_struct *mm; 591 struct mm_struct *mm;
592 struct list_head *this, *next;
592 int mm_users; 593 int mm_users;
593 594
594 if (!(mm = get_task_mm(child))) 595 if (!(mm = get_task_mm(child)))
@@ -600,28 +601,21 @@ find_thread_for_addr (struct task_struct *child, unsigned long addr)
600 goto out; /* not multi-threaded */ 601 goto out; /* not multi-threaded */
601 602
602 /* 603 /*
603 * First, traverse the child's thread-list. Good for scalability with 604 * Traverse the current process' children list. Every task that
604 * NPTL-threads. 605 * one attaches to becomes a child. And it is only attached children
606 * of the debugger that are of interest (ptrace_check_attach checks
607 * for this).
605 */ 608 */
606 p = child; 609 list_for_each_safe(this, next, &current->children) {
607 do { 610 p = list_entry(this, struct task_struct, sibling);
608 if (thread_matches(p, addr)) { 611 if (p->mm != mm)
609 child = p;
610 goto out;
611 }
612 if (mm_users-- <= 1)
613 goto out;
614 } while ((p = next_thread(p)) != child);
615
616 do_each_thread(g, p) {
617 if (child->mm != mm)
618 continue; 612 continue;
619
620 if (thread_matches(p, addr)) { 613 if (thread_matches(p, addr)) {
621 child = p; 614 child = p;
622 goto out; 615 goto out;
623 } 616 }
624 } while_each_thread(g, p); 617 }
618
625 out: 619 out:
626 mmput(mm); 620 mmput(mm);
627 return child; 621 return child;
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 1f5c26dbe705..fc56ca2da358 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -78,6 +78,19 @@ struct screen_info screen_info;
78unsigned long vga_console_iobase; 78unsigned long vga_console_iobase;
79unsigned long vga_console_membase; 79unsigned long vga_console_membase;
80 80
81static struct resource data_resource = {
82 .name = "Kernel data",
83 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
84};
85
86static struct resource code_resource = {
87 .name = "Kernel code",
88 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
89};
90extern void efi_initialize_iomem_resources(struct resource *,
91 struct resource *);
92extern char _text[], _end[], _etext[];
93
81unsigned long ia64_max_cacheline_size; 94unsigned long ia64_max_cacheline_size;
82unsigned long ia64_iobase; /* virtual address for I/O accesses */ 95unsigned long ia64_iobase; /* virtual address for I/O accesses */
83EXPORT_SYMBOL(ia64_iobase); 96EXPORT_SYMBOL(ia64_iobase);
@@ -171,6 +184,22 @@ sort_regions (struct rsvd_region *rsvd_region, int max)
171 } 184 }
172} 185}
173 186
187/*
188 * Request address space for all standard resources
189 */
190static int __init register_memory(void)
191{
192 code_resource.start = ia64_tpa(_text);
193 code_resource.end = ia64_tpa(_etext) - 1;
194 data_resource.start = ia64_tpa(_etext);
195 data_resource.end = ia64_tpa(_end) - 1;
196 efi_initialize_iomem_resources(&code_resource, &data_resource);
197
198 return 0;
199}
200
201__initcall(register_memory);
202
174/** 203/**
175 * reserve_memory - setup reserved memory areas 204 * reserve_memory - setup reserved memory areas
176 * 205 *
@@ -211,6 +240,9 @@ reserve_memory (void)
211 } 240 }
212#endif 241#endif
213 242
243 efi_memmap_init(&rsvd_region[n].start, &rsvd_region[n].end);
244 n++;
245
214 /* end of memory marker */ 246 /* end of memory marker */
215 rsvd_region[n].start = ~0UL; 247 rsvd_region[n].start = ~0UL;
216 rsvd_region[n].end = ~0UL; 248 rsvd_region[n].end = ~0UL;
@@ -244,28 +276,31 @@ find_initrd (void)
244static void __init 276static void __init
245io_port_init (void) 277io_port_init (void)
246{ 278{
247 extern unsigned long ia64_iobase;
248 unsigned long phys_iobase; 279 unsigned long phys_iobase;
249 280
250 /* 281 /*
251 * Set `iobase' to the appropriate address in region 6 (uncached access range). 282 * Set `iobase' based on the EFI memory map or, failing that, the
283 * value firmware left in ar.k0.
252 * 284 *
253 * The EFI memory map is the "preferred" location to get the I/O port space base, 285 * Note that in ia32 mode, IN/OUT instructions use ar.k0 to compute
254 * rather the relying on AR.KR0. This should become more clear in future SAL 286 * the port's virtual address, so ia32_load_state() loads it with a
255 * specs. We'll fall back to getting it out of AR.KR0 if no appropriate entry is 287 * user virtual address. But in ia64 mode, glibc uses the
256 * found in the memory map. 288 * *physical* address in ar.k0 to mmap the appropriate area from
289 * /dev/mem, and the inX()/outX() interfaces use MMIO. In both
290 * cases, user-mode can only use the legacy 0-64K I/O port space.
291 *
292 * ar.k0 is not involved in kernel I/O port accesses, which can use
293 * any of the I/O port spaces and are done via MMIO using the
294 * virtual mmio_base from the appropriate io_space[].
257 */ 295 */
258 phys_iobase = efi_get_iobase(); 296 phys_iobase = efi_get_iobase();
259 if (phys_iobase) 297 if (!phys_iobase) {
260 /* set AR.KR0 since this is all we use it for anyway */
261 ia64_set_kr(IA64_KR_IO_BASE, phys_iobase);
262 else {
263 phys_iobase = ia64_get_kr(IA64_KR_IO_BASE); 298 phys_iobase = ia64_get_kr(IA64_KR_IO_BASE);
264 printk(KERN_INFO "No I/O port range found in EFI memory map, falling back " 299 printk(KERN_INFO "No I/O port range found in EFI memory map, "
265 "to AR.KR0\n"); 300 "falling back to AR.KR0 (0x%lx)\n", phys_iobase);
266 printk(KERN_INFO "I/O port base = 0x%lx\n", phys_iobase);
267 } 301 }
268 ia64_iobase = (unsigned long) ioremap(phys_iobase, 0); 302 ia64_iobase = (unsigned long) ioremap(phys_iobase, 0);
303 ia64_set_kr(IA64_KR_IO_BASE, __pa(ia64_iobase));
269 304
270 /* setup legacy IO port space */ 305 /* setup legacy IO port space */
271 io_space[0].mmio_base = ia64_iobase; 306 io_space[0].mmio_base = ia64_iobase;
@@ -526,7 +561,7 @@ show_cpuinfo (struct seq_file *m, void *v)
526 c->itc_freq / 1000000, c->itc_freq % 1000000, 561 c->itc_freq / 1000000, c->itc_freq % 1000000,
527 lpj*HZ/500000, (lpj*HZ/5000) % 100); 562 lpj*HZ/500000, (lpj*HZ/5000) % 100);
528#ifdef CONFIG_SMP 563#ifdef CONFIG_SMP
529 seq_printf(m, "siblings : %u\n", c->num_log); 564 seq_printf(m, "siblings : %u\n", cpus_weight(cpu_core_map[cpunum]));
530 if (c->threads_per_core > 1 || c->cores_per_socket > 1) 565 if (c->threads_per_core > 1 || c->cores_per_socket > 1)
531 seq_printf(m, 566 seq_printf(m,
532 "physical id: %u\n" 567 "physical id: %u\n"
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index 0166a9847095..657ac99a451c 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -185,8 +185,8 @@ send_IPI_allbutself (int op)
185{ 185{
186 unsigned int i; 186 unsigned int i;
187 187
188 for (i = 0; i < NR_CPUS; i++) { 188 for_each_online_cpu(i) {
189 if (cpu_online(i) && i != smp_processor_id()) 189 if (i != smp_processor_id())
190 send_IPI_single(i, op); 190 send_IPI_single(i, op);
191 } 191 }
192} 192}
@@ -199,9 +199,9 @@ send_IPI_all (int op)
199{ 199{
200 int i; 200 int i;
201 201
202 for (i = 0; i < NR_CPUS; i++) 202 for_each_online_cpu(i) {
203 if (cpu_online(i)) 203 send_IPI_single(i, op);
204 send_IPI_single(i, op); 204 }
205} 205}
206 206
207/* 207/*
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 7d72c0d872b3..400a48987124 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -694,9 +694,9 @@ smp_cpus_done (unsigned int dummy)
694 * Allow the user to impress friends. 694 * Allow the user to impress friends.
695 */ 695 */
696 696
697 for (cpu = 0; cpu < NR_CPUS; cpu++) 697 for_each_online_cpu(cpu) {
698 if (cpu_online(cpu)) 698 bogosum += cpu_data(cpu)->loops_per_jiffy;
699 bogosum += cpu_data(cpu)->loops_per_jiffy; 699 }
700 700
701 printk(KERN_INFO "Total of %d processors activated (%lu.%02lu BogoMIPS).\n", 701 printk(KERN_INFO "Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
702 (int)num_online_cpus(), bogosum/(500000/HZ), (bogosum/(5000/HZ))%100); 702 (int)num_online_cpus(), bogosum/(500000/HZ), (bogosum/(5000/HZ))%100);
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index 4e9d06c48a8b..c6d40446c2c4 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -205,23 +205,18 @@ EXPORT_SYMBOL(uncached_free_page);
205static int __init 205static int __init
206uncached_build_memmap(unsigned long start, unsigned long end, void *arg) 206uncached_build_memmap(unsigned long start, unsigned long end, void *arg)
207{ 207{
208 long length; 208 long length = end - start;
209 unsigned long vstart, vend;
210 int node; 209 int node;
211 210
212 length = end - start;
213 vstart = start + __IA64_UNCACHED_OFFSET;
214 vend = end + __IA64_UNCACHED_OFFSET;
215
216 dprintk(KERN_ERR "uncached_build_memmap(%lx %lx)\n", start, end); 211 dprintk(KERN_ERR "uncached_build_memmap(%lx %lx)\n", start, end);
217 212
218 memset((char *)vstart, 0, length); 213 memset((char *)start, 0, length);
219 214
220 node = paddr_to_nid(start); 215 node = paddr_to_nid(start - __IA64_UNCACHED_OFFSET);
221 216
222 for (; vstart < vend ; vstart += PAGE_SIZE) { 217 for (; start < end ; start += PAGE_SIZE) {
223 dprintk(KERN_INFO "sticking %lx into the pool!\n", vstart); 218 dprintk(KERN_INFO "sticking %lx into the pool!\n", start);
224 gen_pool_free(uncached_pool[node], vstart, PAGE_SIZE); 219 gen_pool_free(uncached_pool[node], start, PAGE_SIZE);
225 } 220 }
226 221
227 return 0; 222 return 0;
diff --git a/arch/ia64/lib/swiotlb.c b/arch/ia64/lib/swiotlb.c
index 3ebbb3c8ba36..96edcc0fdcd9 100644
--- a/arch/ia64/lib/swiotlb.c
+++ b/arch/ia64/lib/swiotlb.c
@@ -49,6 +49,15 @@
49 */ 49 */
50#define IO_TLB_SHIFT 11 50#define IO_TLB_SHIFT 11
51 51
52#define SLABS_PER_PAGE (1 << (PAGE_SHIFT - IO_TLB_SHIFT))
53
54/*
55 * Minimum IO TLB size to bother booting with. Systems with mainly
56 * 64bit capable cards will only lightly use the swiotlb. If we can't
57 * allocate a contiguous 1MB, we're probably in trouble anyway.
58 */
59#define IO_TLB_MIN_SLABS ((1<<20) >> IO_TLB_SHIFT)
60
52int swiotlb_force; 61int swiotlb_force;
53 62
54/* 63/*
@@ -154,6 +163,99 @@ swiotlb_init (void)
154 swiotlb_init_with_default_size(64 * (1<<20)); /* default to 64MB */ 163 swiotlb_init_with_default_size(64 * (1<<20)); /* default to 64MB */
155} 164}
156 165
166/*
167 * Systems with larger DMA zones (those that don't support ISA) can
168 * initialize the swiotlb later using the slab allocator if needed.
169 * This should be just like above, but with some error catching.
170 */
171int
172swiotlb_late_init_with_default_size (size_t default_size)
173{
174 unsigned long i, req_nslabs = io_tlb_nslabs;
175 unsigned int order;
176
177 if (!io_tlb_nslabs) {
178 io_tlb_nslabs = (default_size >> IO_TLB_SHIFT);
179 io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE);
180 }
181
182 /*
183 * Get IO TLB memory from the low pages
184 */
185 order = get_order(io_tlb_nslabs * (1 << IO_TLB_SHIFT));
186 io_tlb_nslabs = SLABS_PER_PAGE << order;
187
188 while ((SLABS_PER_PAGE << order) > IO_TLB_MIN_SLABS) {
189 io_tlb_start = (char *)__get_free_pages(GFP_DMA | __GFP_NOWARN,
190 order);
191 if (io_tlb_start)
192 break;
193 order--;
194 }
195
196 if (!io_tlb_start)
197 goto cleanup1;
198
199 if (order != get_order(io_tlb_nslabs * (1 << IO_TLB_SHIFT))) {
200 printk(KERN_WARNING "Warning: only able to allocate %ld MB "
201 "for software IO TLB\n", (PAGE_SIZE << order) >> 20);
202 io_tlb_nslabs = SLABS_PER_PAGE << order;
203 }
204 io_tlb_end = io_tlb_start + io_tlb_nslabs * (1 << IO_TLB_SHIFT);
205 memset(io_tlb_start, 0, io_tlb_nslabs * (1 << IO_TLB_SHIFT));
206
207 /*
208 * Allocate and initialize the free list array. This array is used
209 * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE
210 * between io_tlb_start and io_tlb_end.
211 */
212 io_tlb_list = (unsigned int *)__get_free_pages(GFP_KERNEL,
213 get_order(io_tlb_nslabs * sizeof(int)));
214 if (!io_tlb_list)
215 goto cleanup2;
216
217 for (i = 0; i < io_tlb_nslabs; i++)
218 io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE);
219 io_tlb_index = 0;
220
221 io_tlb_orig_addr = (unsigned char **)__get_free_pages(GFP_KERNEL,
222 get_order(io_tlb_nslabs * sizeof(char *)));
223 if (!io_tlb_orig_addr)
224 goto cleanup3;
225
226 memset(io_tlb_orig_addr, 0, io_tlb_nslabs * sizeof(char *));
227
228 /*
229 * Get the overflow emergency buffer
230 */
231 io_tlb_overflow_buffer = (void *)__get_free_pages(GFP_DMA,
232 get_order(io_tlb_overflow));
233 if (!io_tlb_overflow_buffer)
234 goto cleanup4;
235
236 printk(KERN_INFO "Placing %ldMB software IO TLB between 0x%lx - "
237 "0x%lx\n", (io_tlb_nslabs * (1 << IO_TLB_SHIFT)) >> 20,
238 virt_to_phys(io_tlb_start), virt_to_phys(io_tlb_end));
239
240 return 0;
241
242cleanup4:
243 free_pages((unsigned long)io_tlb_orig_addr, get_order(io_tlb_nslabs *
244 sizeof(char *)));
245 io_tlb_orig_addr = NULL;
246cleanup3:
247 free_pages((unsigned long)io_tlb_list, get_order(io_tlb_nslabs *
248 sizeof(int)));
249 io_tlb_list = NULL;
250 io_tlb_end = NULL;
251cleanup2:
252 free_pages((unsigned long)io_tlb_start, order);
253 io_tlb_start = NULL;
254cleanup1:
255 io_tlb_nslabs = req_nslabs;
256 return -ENOMEM;
257}
258
157static inline int 259static inline int
158address_needs_mapping(struct device *hwdev, dma_addr_t addr) 260address_needs_mapping(struct device *hwdev, dma_addr_t addr)
159{ 261{
diff --git a/arch/ia64/mm/Makefile b/arch/ia64/mm/Makefile
index 7078f67887ec..d78d20f0a0f0 100644
--- a/arch/ia64/mm/Makefile
+++ b/arch/ia64/mm/Makefile
@@ -7,6 +7,5 @@ obj-y := init.o fault.o tlb.o extable.o
7obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 7obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
8obj-$(CONFIG_NUMA) += numa.o 8obj-$(CONFIG_NUMA) += numa.o
9obj-$(CONFIG_DISCONTIGMEM) += discontig.o 9obj-$(CONFIG_DISCONTIGMEM) += discontig.o
10ifndef CONFIG_DISCONTIGMEM 10obj-$(CONFIG_SPARSEMEM) += discontig.o
11obj-y += contig.o 11obj-$(CONFIG_FLATMEM) += contig.o
12endif
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 91a055f5731f..acaaec4e4681 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -269,7 +269,7 @@ paging_init (void)
269 efi_memmap_walk(find_largest_hole, (u64 *)&max_gap); 269 efi_memmap_walk(find_largest_hole, (u64 *)&max_gap);
270 if (max_gap < LARGE_GAP) { 270 if (max_gap < LARGE_GAP) {
271 vmem_map = (struct page *) 0; 271 vmem_map = (struct page *) 0;
272 free_area_init_node(0, &contig_page_data, zones_size, 0, 272 free_area_init_node(0, NODE_DATA(0), zones_size, 0,
273 zholes_size); 273 zholes_size);
274 } else { 274 } else {
275 unsigned long map_size; 275 unsigned long map_size;
@@ -282,7 +282,7 @@ paging_init (void)
282 efi_memmap_walk(create_mem_map_page_table, NULL); 282 efi_memmap_walk(create_mem_map_page_table, NULL);
283 283
284 NODE_DATA(0)->node_mem_map = vmem_map; 284 NODE_DATA(0)->node_mem_map = vmem_map;
285 free_area_init_node(0, &contig_page_data, zones_size, 285 free_area_init_node(0, NODE_DATA(0), zones_size,
286 0, zholes_size); 286 0, zholes_size);
287 287
288 printk("Virtual mem_map starts at 0x%p\n", mem_map); 288 printk("Virtual mem_map starts at 0x%p\n", mem_map);
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index b5c90e548195..a3788fb84809 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -421,6 +421,37 @@ static void __init memory_less_nodes(void)
421 return; 421 return;
422} 422}
423 423
424#ifdef CONFIG_SPARSEMEM
425/**
426 * register_sparse_mem - notify SPARSEMEM that this memory range exists.
427 * @start: physical start of range
428 * @end: physical end of range
429 * @arg: unused
430 *
431 * Simply calls SPARSEMEM to register memory section(s).
432 */
433static int __init register_sparse_mem(unsigned long start, unsigned long end,
434 void *arg)
435{
436 int nid;
437
438 start = __pa(start) >> PAGE_SHIFT;
439 end = __pa(end) >> PAGE_SHIFT;
440 nid = early_pfn_to_nid(start);
441 memory_present(nid, start, end);
442
443 return 0;
444}
445
446static void __init arch_sparse_init(void)
447{
448 efi_memmap_walk(register_sparse_mem, NULL);
449 sparse_init();
450}
451#else
452#define arch_sparse_init() do {} while (0)
453#endif
454
424/** 455/**
425 * find_memory - walk the EFI memory map and setup the bootmem allocator 456 * find_memory - walk the EFI memory map and setup the bootmem allocator
426 * 457 *
@@ -528,8 +559,10 @@ void show_mem(void)
528 int shared = 0, cached = 0, reserved = 0; 559 int shared = 0, cached = 0, reserved = 0;
529 printk("Node ID: %d\n", pgdat->node_id); 560 printk("Node ID: %d\n", pgdat->node_id);
530 for(i = 0; i < pgdat->node_spanned_pages; i++) { 561 for(i = 0; i < pgdat->node_spanned_pages; i++) {
531 struct page *page = pgdat_page_nr(pgdat, i); 562 struct page *page;
532 if (!ia64_pfn_valid(pgdat->node_start_pfn+i)) 563 if (pfn_valid(pgdat->node_start_pfn + i))
564 page = pfn_to_page(pgdat->node_start_pfn + i);
565 else
533 continue; 566 continue;
534 if (PageReserved(page)) 567 if (PageReserved(page))
535 reserved++; 568 reserved++;
@@ -648,12 +681,16 @@ void __init paging_init(void)
648 681
649 max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT; 682 max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
650 683
684 arch_sparse_init();
685
651 efi_memmap_walk(filter_rsvd_memory, count_node_pages); 686 efi_memmap_walk(filter_rsvd_memory, count_node_pages);
652 687
688#ifdef CONFIG_VIRTUAL_MEM_MAP
653 vmalloc_end -= PAGE_ALIGN(max_low_pfn * sizeof(struct page)); 689 vmalloc_end -= PAGE_ALIGN(max_low_pfn * sizeof(struct page));
654 vmem_map = (struct page *) vmalloc_end; 690 vmem_map = (struct page *) vmalloc_end;
655 efi_memmap_walk(create_mem_map_page_table, NULL); 691 efi_memmap_walk(create_mem_map_page_table, NULL);
656 printk("Virtual mem_map starts at 0x%p\n", vmem_map); 692 printk("Virtual mem_map starts at 0x%p\n", vmem_map);
693#endif
657 694
658 for_each_online_node(node) { 695 for_each_online_node(node) {
659 memset(zones_size, 0, sizeof(zones_size)); 696 memset(zones_size, 0, sizeof(zones_size));
@@ -690,7 +727,9 @@ void __init paging_init(void)
690 727
691 pfn_offset = mem_data[node].min_pfn; 728 pfn_offset = mem_data[node].min_pfn;
692 729
730#ifdef CONFIG_VIRTUAL_MEM_MAP
693 NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset; 731 NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset;
732#endif
694 free_area_init_node(node, NODE_DATA(node), zones_size, 733 free_area_init_node(node, NODE_DATA(node), zones_size,
695 pfn_offset, zholes_size); 734 pfn_offset, zholes_size);
696 } 735 }
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 1281c609ee98..98246acd4991 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -593,7 +593,7 @@ mem_init (void)
593 platform_dma_init(); 593 platform_dma_init();
594#endif 594#endif
595 595
596#ifndef CONFIG_DISCONTIGMEM 596#ifdef CONFIG_FLATMEM
597 if (!mem_map) 597 if (!mem_map)
598 BUG(); 598 BUG();
599 max_mapnr = max_low_pfn; 599 max_mapnr = max_low_pfn;
diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
index 77118bbf3d8b..4e5c8b36ad93 100644
--- a/arch/ia64/mm/numa.c
+++ b/arch/ia64/mm/numa.c
@@ -47,3 +47,27 @@ paddr_to_nid(unsigned long paddr)
47 47
48 return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0); 48 return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0);
49} 49}
50
51#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_NUMA)
52/*
53 * Because of holes evaluate on section limits.
54 * If the section of memory exists, then return the node where the section
55 * resides. Otherwise return node 0 as the default. This is used by
56 * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where
57 * the section resides.
58 */
59int early_pfn_to_nid(unsigned long pfn)
60{
61 int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec;
62
63 for (i = 0; i < num_node_memblks; i++) {
64 ssec = node_memblk[i].start_paddr >> PA_SECTION_SHIFT;
65 esec = (node_memblk[i].start_paddr + node_memblk[i].size +
66 ((1L << PA_SECTION_SHIFT) - 1)) >> PA_SECTION_SHIFT;
67 if (section >= ssec && section < esec)
68 return node_memblk[i].nid;
69 }
70
71 return 0;
72}
73#endif
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index 464557e4ed82..c93e0f2b5fea 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -77,19 +77,25 @@ wrap_mmu_context (struct mm_struct *mm)
77 /* can't call flush_tlb_all() here because of race condition with O(1) scheduler [EF] */ 77 /* can't call flush_tlb_all() here because of race condition with O(1) scheduler [EF] */
78 { 78 {
79 int cpu = get_cpu(); /* prevent preemption/migration */ 79 int cpu = get_cpu(); /* prevent preemption/migration */
80 for (i = 0; i < NR_CPUS; ++i) 80 for_each_online_cpu(i) {
81 if (cpu_online(i) && (i != cpu)) 81 if (i != cpu)
82 per_cpu(ia64_need_tlb_flush, i) = 1; 82 per_cpu(ia64_need_tlb_flush, i) = 1;
83 }
83 put_cpu(); 84 put_cpu();
84 } 85 }
85 local_flush_tlb_all(); 86 local_flush_tlb_all();
86} 87}
87 88
88void 89void
89ia64_global_tlb_purge (unsigned long start, unsigned long end, unsigned long nbits) 90ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start, unsigned long end, unsigned long nbits)
90{ 91{
91 static DEFINE_SPINLOCK(ptcg_lock); 92 static DEFINE_SPINLOCK(ptcg_lock);
92 93
94 if (mm != current->active_mm) {
95 flush_tlb_all();
96 return;
97 }
98
93 /* HW requires global serialization of ptc.ga. */ 99 /* HW requires global serialization of ptc.ga. */
94 spin_lock(&ptcg_lock); 100 spin_lock(&ptcg_lock);
95 { 101 {
@@ -135,15 +141,12 @@ flush_tlb_range (struct vm_area_struct *vma, unsigned long start, unsigned long
135 unsigned long size = end - start; 141 unsigned long size = end - start;
136 unsigned long nbits; 142 unsigned long nbits;
137 143
144#ifndef CONFIG_SMP
138 if (mm != current->active_mm) { 145 if (mm != current->active_mm) {
139 /* this does happen, but perhaps it's not worth optimizing for? */
140#ifdef CONFIG_SMP
141 flush_tlb_all();
142#else
143 mm->context = 0; 146 mm->context = 0;
144#endif
145 return; 147 return;
146 } 148 }
149#endif
147 150
148 nbits = ia64_fls(size + 0xfff); 151 nbits = ia64_fls(size + 0xfff);
149 while (unlikely (((1UL << nbits) & purge.mask) == 0) && (nbits < purge.max_bits)) 152 while (unlikely (((1UL << nbits) & purge.mask) == 0) && (nbits < purge.max_bits))
@@ -153,7 +156,7 @@ flush_tlb_range (struct vm_area_struct *vma, unsigned long start, unsigned long
153 start &= ~((1UL << nbits) - 1); 156 start &= ~((1UL << nbits) - 1);
154 157
155# ifdef CONFIG_SMP 158# ifdef CONFIG_SMP
156 platform_global_tlb_purge(start, end, nbits); 159 platform_global_tlb_purge(mm, start, end, nbits);
157# else 160# else
158 do { 161 do {
159 ia64_ptcl(start, (nbits<<2)); 162 ia64_ptcl(start, (nbits<<2));
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 9b5de589b82f..017cfc3f4789 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -120,29 +120,6 @@ struct pci_ops pci_root_ops = {
120 .write = pci_write, 120 .write = pci_write,
121}; 121};
122 122
123#ifdef CONFIG_NUMA
124extern acpi_status acpi_map_iosapic(acpi_handle, u32, void *, void **);
125static void acpi_map_iosapics(void)
126{
127 acpi_get_devices(NULL, acpi_map_iosapic, NULL, NULL);
128}
129#else
130static void acpi_map_iosapics(void)
131{
132 return;
133}
134#endif /* CONFIG_NUMA */
135
136static int __init
137pci_acpi_init (void)
138{
139 acpi_map_iosapics();
140
141 return 0;
142}
143
144subsys_initcall(pci_acpi_init);
145
146/* Called by ACPI when it finds a new root bus. */ 123/* Called by ACPI when it finds a new root bus. */
147 124
148static struct pci_controller * __devinit 125static struct pci_controller * __devinit
@@ -191,6 +168,29 @@ add_io_space (struct acpi_resource_address64 *addr)
191 return IO_SPACE_BASE(i); 168 return IO_SPACE_BASE(i);
192} 169}
193 170
171static acpi_status __devinit resource_to_window(struct acpi_resource *resource,
172 struct acpi_resource_address64 *addr)
173{
174 acpi_status status;
175
176 /*
177 * We're only interested in _CRS descriptors that are
178 * - address space descriptors for memory or I/O space
179 * - non-zero size
180 * - producers, i.e., the address space is routed downstream,
181 * not consumed by the bridge itself
182 */
183 status = acpi_resource_to_address64(resource, addr);
184 if (ACPI_SUCCESS(status) &&
185 (addr->resource_type == ACPI_MEMORY_RANGE ||
186 addr->resource_type == ACPI_IO_RANGE) &&
187 addr->address_length &&
188 addr->producer_consumer == ACPI_PRODUCER)
189 return AE_OK;
190
191 return AE_ERROR;
192}
193
194static acpi_status __devinit 194static acpi_status __devinit
195count_window (struct acpi_resource *resource, void *data) 195count_window (struct acpi_resource *resource, void *data)
196{ 196{
@@ -198,11 +198,9 @@ count_window (struct acpi_resource *resource, void *data)
198 struct acpi_resource_address64 addr; 198 struct acpi_resource_address64 addr;
199 acpi_status status; 199 acpi_status status;
200 200
201 status = acpi_resource_to_address64(resource, &addr); 201 status = resource_to_window(resource, &addr);
202 if (ACPI_SUCCESS(status)) 202 if (ACPI_SUCCESS(status))
203 if (addr.resource_type == ACPI_MEMORY_RANGE || 203 (*windows)++;
204 addr.resource_type == ACPI_IO_RANGE)
205 (*windows)++;
206 204
207 return AE_OK; 205 return AE_OK;
208} 206}
@@ -221,13 +219,11 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
221 unsigned long flags, offset = 0; 219 unsigned long flags, offset = 0;
222 struct resource *root; 220 struct resource *root;
223 221
224 status = acpi_resource_to_address64(res, &addr); 222 /* Return AE_OK for non-window resources to keep scanning for more */
223 status = resource_to_window(res, &addr);
225 if (!ACPI_SUCCESS(status)) 224 if (!ACPI_SUCCESS(status))
226 return AE_OK; 225 return AE_OK;
227 226
228 if (!addr.address_length)
229 return AE_OK;
230
231 if (addr.resource_type == ACPI_MEMORY_RANGE) { 227 if (addr.resource_type == ACPI_MEMORY_RANGE) {
232 flags = IORESOURCE_MEM; 228 flags = IORESOURCE_MEM;
233 root = &iomem_resource; 229 root = &iomem_resource;
diff --git a/arch/ia64/sn/kernel/bte.c b/arch/ia64/sn/kernel/bte.c
index 45854c637e9c..d71f4de44f79 100644
--- a/arch/ia64/sn/kernel/bte.c
+++ b/arch/ia64/sn/kernel/bte.c
@@ -87,7 +87,7 @@ bte_result_t bte_copy(u64 src, u64 dest, u64 len, u64 mode, void *notification)
87 unsigned long irq_flags; 87 unsigned long irq_flags;
88 unsigned long itc_end = 0; 88 unsigned long itc_end = 0;
89 int nasid_to_try[MAX_NODES_TO_TRY]; 89 int nasid_to_try[MAX_NODES_TO_TRY];
90 int my_nasid = get_nasid(); 90 int my_nasid = cpuid_to_nasid(raw_smp_processor_id());
91 int bte_if_index, nasid_index; 91 int bte_if_index, nasid_index;
92 int bte_first, btes_per_node = BTES_PER_NODE; 92 int bte_first, btes_per_node = BTES_PER_NODE;
93 93
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 906622d9f933..b4f5053f5e1b 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -22,8 +22,6 @@
22#include "xtalk/hubdev.h" 22#include "xtalk/hubdev.h"
23#include "xtalk/xwidgetdev.h" 23#include "xtalk/xwidgetdev.h"
24 24
25nasid_t master_nasid = INVALID_NASID; /* Partition Master */
26
27static struct list_head sn_sysdata_list; 25static struct list_head sn_sysdata_list;
28 26
29/* sysdata list struct */ 27/* sysdata list struct */
@@ -165,7 +163,7 @@ static void sn_fixup_ionodes(void)
165 * Get SGI Specific HUB chipset information. 163 * Get SGI Specific HUB chipset information.
166 * Inform Prom that this kernel can support domain bus numbering. 164 * Inform Prom that this kernel can support domain bus numbering.
167 */ 165 */
168 for (i = 0; i < numionodes; i++) { 166 for (i = 0; i < num_cnodes; i++) {
169 hubdev = (struct hubdev_info *)(NODEPDA(i)->pdinfo); 167 hubdev = (struct hubdev_info *)(NODEPDA(i)->pdinfo);
170 nasid = cnodeid_to_nasid(i); 168 nasid = cnodeid_to_nasid(i);
171 hubdev->max_segment_number = 0xffffffff; 169 hubdev->max_segment_number = 0xffffffff;
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 6f8c5883716b..0fb579ef18c2 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -59,8 +59,6 @@ DEFINE_PER_CPU(struct pda_s, pda_percpu);
59 59
60#define MAX_PHYS_MEMORY (1UL << IA64_MAX_PHYS_BITS) /* Max physical address supported */ 60#define MAX_PHYS_MEMORY (1UL << IA64_MAX_PHYS_BITS) /* Max physical address supported */
61 61
62lboard_t *root_lboard[MAX_COMPACT_NODES];
63
64extern void bte_init_node(nodepda_t *, cnodeid_t); 62extern void bte_init_node(nodepda_t *, cnodeid_t);
65 63
66extern void sn_timer_init(void); 64extern void sn_timer_init(void);
@@ -97,15 +95,15 @@ u8 sn_region_size;
97EXPORT_SYMBOL(sn_region_size); 95EXPORT_SYMBOL(sn_region_size);
98int sn_prom_type; /* 0=hardware, 1=medusa/realprom, 2=medusa/fakeprom */ 96int sn_prom_type; /* 0=hardware, 1=medusa/realprom, 2=medusa/fakeprom */
99 97
100short physical_node_map[MAX_PHYSNODE_ID]; 98short physical_node_map[MAX_NUMALINK_NODES];
101static unsigned long sn_prom_features[MAX_PROM_FEATURE_SETS]; 99static unsigned long sn_prom_features[MAX_PROM_FEATURE_SETS];
102 100
103EXPORT_SYMBOL(physical_node_map); 101EXPORT_SYMBOL(physical_node_map);
104 102
105int numionodes; 103int num_cnodes;
106 104
107static void sn_init_pdas(char **); 105static void sn_init_pdas(char **);
108static void scan_for_ionodes(void); 106static void build_cnode_tables(void);
109 107
110static nodepda_t *nodepdaindr[MAX_COMPACT_NODES]; 108static nodepda_t *nodepdaindr[MAX_COMPACT_NODES];
111 109
@@ -140,19 +138,6 @@ char drive_info[4 * 16];
140#endif 138#endif
141 139
142/* 140/*
143 * Get nasid of current cpu early in boot before nodepda is initialized
144 */
145static int
146boot_get_nasid(void)
147{
148 int nasid;
149
150 if (ia64_sn_get_sapic_info(get_sapicid(), &nasid, NULL, NULL))
151 BUG();
152 return nasid;
153}
154
155/*
156 * This routine can only be used during init, since 141 * This routine can only be used during init, since
157 * smp_boot_data is an init data structure. 142 * smp_boot_data is an init data structure.
158 * We have to use smp_boot_data.cpu_phys_id to find 143 * We have to use smp_boot_data.cpu_phys_id to find
@@ -223,7 +208,6 @@ void __init early_sn_setup(void)
223} 208}
224 209
225extern int platform_intr_list[]; 210extern int platform_intr_list[];
226extern nasid_t master_nasid;
227static int __initdata shub_1_1_found = 0; 211static int __initdata shub_1_1_found = 0;
228 212
229/* 213/*
@@ -269,7 +253,6 @@ static void __init sn_check_for_wars(void)
269void __init sn_setup(char **cmdline_p) 253void __init sn_setup(char **cmdline_p)
270{ 254{
271 long status, ticks_per_sec, drift; 255 long status, ticks_per_sec, drift;
272 int pxm;
273 u32 version = sn_sal_rev(); 256 u32 version = sn_sal_rev();
274 extern void sn_cpu_init(void); 257 extern void sn_cpu_init(void);
275 258
@@ -300,11 +283,10 @@ void __init sn_setup(char **cmdline_p)
300 283
301 MAX_DMA_ADDRESS = PAGE_OFFSET + MAX_PHYS_MEMORY; 284 MAX_DMA_ADDRESS = PAGE_OFFSET + MAX_PHYS_MEMORY;
302 285
303 memset(physical_node_map, -1, sizeof(physical_node_map)); 286 /*
304 for (pxm = 0; pxm < MAX_PXM_DOMAINS; pxm++) 287 * Build the tables for managing cnodes.
305 if (pxm_to_nid_map[pxm] != -1) 288 */
306 physical_node_map[pxm_to_nasid(pxm)] = 289 build_cnode_tables();
307 pxm_to_nid_map[pxm];
308 290
309 /* 291 /*
310 * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard 292 * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard
@@ -319,8 +301,6 @@ void __init sn_setup(char **cmdline_p)
319 301
320 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF); 302 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);
321 303
322 master_nasid = boot_get_nasid();
323
324 status = 304 status =
325 ia64_sal_freq_base(SAL_FREQ_BASE_REALTIME_CLOCK, &ticks_per_sec, 305 ia64_sal_freq_base(SAL_FREQ_BASE_REALTIME_CLOCK, &ticks_per_sec,
326 &drift); 306 &drift);
@@ -378,15 +358,6 @@ static void __init sn_init_pdas(char **cmdline_p)
378{ 358{
379 cnodeid_t cnode; 359 cnodeid_t cnode;
380 360
381 memset(sn_cnodeid_to_nasid, -1,
382 sizeof(__ia64_per_cpu_var(__sn_cnodeid_to_nasid)));
383 for_each_online_node(cnode)
384 sn_cnodeid_to_nasid[cnode] =
385 pxm_to_nasid(nid_to_pxm_map[cnode]);
386
387 numionodes = num_online_nodes();
388 scan_for_ionodes();
389
390 /* 361 /*
391 * Allocate & initalize the nodepda for each node. 362 * Allocate & initalize the nodepda for each node.
392 */ 363 */
@@ -402,7 +373,7 @@ static void __init sn_init_pdas(char **cmdline_p)
402 /* 373 /*
403 * Allocate & initialize nodepda for TIOs. For now, put them on node 0. 374 * Allocate & initialize nodepda for TIOs. For now, put them on node 0.
404 */ 375 */
405 for (cnode = num_online_nodes(); cnode < numionodes; cnode++) { 376 for (cnode = num_online_nodes(); cnode < num_cnodes; cnode++) {
406 nodepdaindr[cnode] = 377 nodepdaindr[cnode] =
407 alloc_bootmem_node(NODE_DATA(0), sizeof(nodepda_t)); 378 alloc_bootmem_node(NODE_DATA(0), sizeof(nodepda_t));
408 memset(nodepdaindr[cnode], 0, sizeof(nodepda_t)); 379 memset(nodepdaindr[cnode], 0, sizeof(nodepda_t));
@@ -411,7 +382,7 @@ static void __init sn_init_pdas(char **cmdline_p)
411 /* 382 /*
412 * Now copy the array of nodepda pointers to each nodepda. 383 * Now copy the array of nodepda pointers to each nodepda.
413 */ 384 */
414 for (cnode = 0; cnode < numionodes; cnode++) 385 for (cnode = 0; cnode < num_cnodes; cnode++)
415 memcpy(nodepdaindr[cnode]->pernode_pdaindr, nodepdaindr, 386 memcpy(nodepdaindr[cnode]->pernode_pdaindr, nodepdaindr,
416 sizeof(nodepdaindr)); 387 sizeof(nodepdaindr));
417 388
@@ -428,7 +399,7 @@ static void __init sn_init_pdas(char **cmdline_p)
428 * Initialize the per node hubdev. This includes IO Nodes and 399 * Initialize the per node hubdev. This includes IO Nodes and
429 * headless/memless nodes. 400 * headless/memless nodes.
430 */ 401 */
431 for (cnode = 0; cnode < numionodes; cnode++) { 402 for (cnode = 0; cnode < num_cnodes; cnode++) {
432 hubdev_init_node(nodepdaindr[cnode], cnode); 403 hubdev_init_node(nodepdaindr[cnode], cnode);
433 } 404 }
434} 405}
@@ -553,87 +524,58 @@ void __init sn_cpu_init(void)
553} 524}
554 525
555/* 526/*
556 * Scan klconfig for ionodes. Add the nasids to the 527 * Build tables for converting between NASIDs and cnodes.
557 * physical_node_map and the pda and increment numionodes.
558 */ 528 */
529static inline int __init board_needs_cnode(int type)
530{
531 return (type == KLTYPE_SNIA || type == KLTYPE_TIO);
532}
559 533
560static void __init scan_for_ionodes(void) 534void __init build_cnode_tables(void)
561{ 535{
562 int nasid = 0; 536 int nasid;
537 int node;
563 lboard_t *brd; 538 lboard_t *brd;
564 539
565 /* fakeprom does not support klgraph */ 540 memset(physical_node_map, -1, sizeof(physical_node_map));
566 if (IS_RUNNING_ON_FAKE_PROM()) 541 memset(sn_cnodeid_to_nasid, -1,
567 return; 542 sizeof(__ia64_per_cpu_var(__sn_cnodeid_to_nasid)));
568
569 /* Setup ionodes with memory */
570 for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) {
571 char *klgraph_header;
572 cnodeid_t cnodeid;
573
574 if (physical_node_map[nasid] == -1)
575 continue;
576 543
577 cnodeid = -1; 544 /*
578 klgraph_header = __va(ia64_sn_get_klconfig_addr(nasid)); 545 * First populate the tables with C/M bricks. This ensures that
579 if (!klgraph_header) { 546 * cnode == node for all C & M bricks.
580 BUG(); /* All nodes must have klconfig tables! */ 547 */
581 } 548 for_each_online_node(node) {
582 cnodeid = nasid_to_cnodeid(nasid); 549 nasid = pxm_to_nasid(nid_to_pxm_map[node]);
583 root_lboard[cnodeid] = (lboard_t *) 550 sn_cnodeid_to_nasid[node] = nasid;
584 NODE_OFFSET_TO_LBOARD((nasid), 551 physical_node_map[nasid] = node;
585 ((kl_config_hdr_t
586 *) (klgraph_header))->
587 ch_board_info);
588 } 552 }
589 553
590 /* Scan headless/memless IO Nodes. */ 554 /*
591 for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) { 555 * num_cnodes is total number of C/M/TIO bricks. Because of the 256 node
592 /* if there's no nasid, don't try to read the klconfig on the node */ 556 * limit on the number of nodes, we can't use the generic node numbers
593 if (physical_node_map[nasid] == -1) 557 * for this. Note that num_cnodes is incremented below as TIOs or
594 continue; 558 * headless/memoryless nodes are discovered.
595 brd = find_lboard_any((lboard_t *) 559 */
596 root_lboard[nasid_to_cnodeid(nasid)], 560 num_cnodes = num_online_nodes();
597 KLTYPE_SNIA);
598 if (brd) {
599 brd = KLCF_NEXT_ANY(brd); /* Skip this node's lboard */
600 if (!brd)
601 continue;
602 }
603
604 brd = find_lboard_any(brd, KLTYPE_SNIA);
605 561
606 while (brd) { 562 /* fakeprom does not support klgraph */
607 sn_cnodeid_to_nasid[numionodes] = brd->brd_nasid; 563 if (IS_RUNNING_ON_FAKE_PROM())
608 physical_node_map[brd->brd_nasid] = numionodes; 564 return;
609 root_lboard[numionodes] = brd;
610 numionodes++;
611 brd = KLCF_NEXT_ANY(brd);
612 if (!brd)
613 break;
614
615 brd = find_lboard_any(brd, KLTYPE_SNIA);
616 }
617 }
618 565
619 /* Scan for TIO nodes. */ 566 /* Find TIOs & headless/memoryless nodes and add them to the tables */
620 for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid += 2) { 567 for_each_online_node(node) {
621 /* if there's no nasid, don't try to read the klconfig on the node */ 568 kl_config_hdr_t *klgraph_header;
622 if (physical_node_map[nasid] == -1) 569 nasid = cnodeid_to_nasid(node);
623 continue; 570 if ((klgraph_header = ia64_sn_get_klconfig_addr(nasid)) == NULL)
624 brd = find_lboard_any((lboard_t *) 571 BUG();
625 root_lboard[nasid_to_cnodeid(nasid)], 572 brd = NODE_OFFSET_TO_LBOARD(nasid, klgraph_header->ch_board_info);
626 KLTYPE_TIO);
627 while (brd) { 573 while (brd) {
628 sn_cnodeid_to_nasid[numionodes] = brd->brd_nasid; 574 if (board_needs_cnode(brd->brd_type) && physical_node_map[brd->brd_nasid] < 0) {
629 physical_node_map[brd->brd_nasid] = numionodes; 575 sn_cnodeid_to_nasid[num_cnodes] = brd->brd_nasid;
630 root_lboard[numionodes] = brd; 576 physical_node_map[brd->brd_nasid] = num_cnodes++;
631 numionodes++; 577 }
632 brd = KLCF_NEXT_ANY(brd); 578 brd = find_lboard_next(brd);
633 if (!brd)
634 break;
635
636 brd = find_lboard_any(brd, KLTYPE_TIO);
637 } 579 }
638 } 580 }
639} 581}
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index 0a4ee50c302f..49b530c39a42 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -177,6 +177,7 @@ void sn_tlb_migrate_finish(struct mm_struct *mm)
177 177
178/** 178/**
179 * sn2_global_tlb_purge - globally purge translation cache of virtual address range 179 * sn2_global_tlb_purge - globally purge translation cache of virtual address range
180 * @mm: mm_struct containing virtual address range
180 * @start: start of virtual address range 181 * @start: start of virtual address range
181 * @end: end of virtual address range 182 * @end: end of virtual address range
182 * @nbits: specifies number of bytes to purge per instruction (num = 1<<(nbits & 0xfc)) 183 * @nbits: specifies number of bytes to purge per instruction (num = 1<<(nbits & 0xfc))
@@ -188,21 +189,22 @@ void sn_tlb_migrate_finish(struct mm_struct *mm)
188 * - cpu_vm_mask is a bit mask that indicates which cpus have loaded the context. 189 * - cpu_vm_mask is a bit mask that indicates which cpus have loaded the context.
189 * - cpu_vm_mask is converted into a nodemask of the nodes containing the 190 * - cpu_vm_mask is converted into a nodemask of the nodes containing the
190 * cpus in cpu_vm_mask. 191 * cpus in cpu_vm_mask.
191 * - if only one bit is set in cpu_vm_mask & it is the current cpu, 192 * - if only one bit is set in cpu_vm_mask & it is the current cpu & the
192 * then only the local TLB needs to be flushed. This flushing can be done 193 * process is purging its own virtual address range, then only the
193 * using ptc.l. This is the common case & avoids the global spinlock. 194 * local TLB needs to be flushed. This flushing can be done using
195 * ptc.l. This is the common case & avoids the global spinlock.
194 * - if multiple cpus have loaded the context, then flushing has to be 196 * - if multiple cpus have loaded the context, then flushing has to be
195 * done with ptc.g/MMRs under protection of the global ptc_lock. 197 * done with ptc.g/MMRs under protection of the global ptc_lock.
196 */ 198 */
197 199
198void 200void
199sn2_global_tlb_purge(unsigned long start, unsigned long end, 201sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
200 unsigned long nbits) 202 unsigned long end, unsigned long nbits)
201{ 203{
202 int i, opt, shub1, cnode, mynasid, cpu, lcpu = 0, nasid, flushed = 0; 204 int i, opt, shub1, cnode, mynasid, cpu, lcpu = 0, nasid, flushed = 0;
205 int mymm = (mm == current->active_mm);
203 volatile unsigned long *ptc0, *ptc1; 206 volatile unsigned long *ptc0, *ptc1;
204 unsigned long itc, itc2, flags, data0 = 0, data1 = 0; 207 unsigned long itc, itc2, flags, data0 = 0, data1 = 0, rr_value;
205 struct mm_struct *mm = current->active_mm;
206 short nasids[MAX_NUMNODES], nix; 208 short nasids[MAX_NUMNODES], nix;
207 nodemask_t nodes_flushed; 209 nodemask_t nodes_flushed;
208 210
@@ -216,9 +218,12 @@ sn2_global_tlb_purge(unsigned long start, unsigned long end,
216 i++; 218 i++;
217 } 219 }
218 220
221 if (i == 0)
222 return;
223
219 preempt_disable(); 224 preempt_disable();
220 225
221 if (likely(i == 1 && lcpu == smp_processor_id())) { 226 if (likely(i == 1 && lcpu == smp_processor_id() && mymm)) {
222 do { 227 do {
223 ia64_ptcl(start, nbits << 2); 228 ia64_ptcl(start, nbits << 2);
224 start += (1UL << nbits); 229 start += (1UL << nbits);
@@ -229,7 +234,7 @@ sn2_global_tlb_purge(unsigned long start, unsigned long end,
229 return; 234 return;
230 } 235 }
231 236
232 if (atomic_read(&mm->mm_users) == 1) { 237 if (atomic_read(&mm->mm_users) == 1 && mymm) {
233 flush_tlb_mm(mm); 238 flush_tlb_mm(mm);
234 __get_cpu_var(ptcstats).change_rid++; 239 __get_cpu_var(ptcstats).change_rid++;
235 preempt_enable(); 240 preempt_enable();
@@ -241,11 +246,13 @@ sn2_global_tlb_purge(unsigned long start, unsigned long end,
241 for_each_node_mask(cnode, nodes_flushed) 246 for_each_node_mask(cnode, nodes_flushed)
242 nasids[nix++] = cnodeid_to_nasid(cnode); 247 nasids[nix++] = cnodeid_to_nasid(cnode);
243 248
249 rr_value = (mm->context << 3) | REGION_NUMBER(start);
250
244 shub1 = is_shub1(); 251 shub1 = is_shub1();
245 if (shub1) { 252 if (shub1) {
246 data0 = (1UL << SH1_PTC_0_A_SHFT) | 253 data0 = (1UL << SH1_PTC_0_A_SHFT) |
247 (nbits << SH1_PTC_0_PS_SHFT) | 254 (nbits << SH1_PTC_0_PS_SHFT) |
248 ((ia64_get_rr(start) >> 8) << SH1_PTC_0_RID_SHFT) | 255 (rr_value << SH1_PTC_0_RID_SHFT) |
249 (1UL << SH1_PTC_0_START_SHFT); 256 (1UL << SH1_PTC_0_START_SHFT);
250 ptc0 = (long *)GLOBAL_MMR_PHYS_ADDR(0, SH1_PTC_0); 257 ptc0 = (long *)GLOBAL_MMR_PHYS_ADDR(0, SH1_PTC_0);
251 ptc1 = (long *)GLOBAL_MMR_PHYS_ADDR(0, SH1_PTC_1); 258 ptc1 = (long *)GLOBAL_MMR_PHYS_ADDR(0, SH1_PTC_1);
@@ -254,7 +261,7 @@ sn2_global_tlb_purge(unsigned long start, unsigned long end,
254 (nbits << SH2_PTC_PS_SHFT) | 261 (nbits << SH2_PTC_PS_SHFT) |
255 (1UL << SH2_PTC_START_SHFT); 262 (1UL << SH2_PTC_START_SHFT);
256 ptc0 = (long *)GLOBAL_MMR_PHYS_ADDR(0, SH2_PTC + 263 ptc0 = (long *)GLOBAL_MMR_PHYS_ADDR(0, SH2_PTC +
257 ((ia64_get_rr(start) >> 8) << SH2_PTC_RID_SHFT) ); 264 (rr_value << SH2_PTC_RID_SHFT));
258 ptc1 = NULL; 265 ptc1 = NULL;
259 } 266 }
260 267
@@ -275,7 +282,7 @@ sn2_global_tlb_purge(unsigned long start, unsigned long end,
275 data0 = (data0 & ~SH2_PTC_ADDR_MASK) | (start & SH2_PTC_ADDR_MASK); 282 data0 = (data0 & ~SH2_PTC_ADDR_MASK) | (start & SH2_PTC_ADDR_MASK);
276 for (i = 0; i < nix; i++) { 283 for (i = 0; i < nix; i++) {
277 nasid = nasids[i]; 284 nasid = nasids[i];
278 if ((!(sn2_ptctest & 3)) && unlikely(nasid == mynasid)) { 285 if ((!(sn2_ptctest & 3)) && unlikely(nasid == mynasid && mymm)) {
279 ia64_ptcga(start, nbits << 2); 286 ia64_ptcga(start, nbits << 2);
280 ia64_srlz_i(); 287 ia64_srlz_i();
281 } else { 288 } else {
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 0513aacac8c1..6c6fbca3229c 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -476,8 +476,8 @@ static int sn_topology_show(struct seq_file *s, void *d)
476 for_each_online_cpu(j) { 476 for_each_online_cpu(j) {
477 seq_printf(s, j ? ":%d" : ", dist %d", 477 seq_printf(s, j ? ":%d" : ", dist %d",
478 node_distance( 478 node_distance(
479 cpuid_to_cnodeid(i), 479 cpu_to_node(i),
480 cpuid_to_cnodeid(j))); 480 cpu_to_node(j)));
481 } 481 }
482 seq_putc(s, '\n'); 482 seq_putc(s, '\n');
483 } 483 }
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index b45db5133f55..0d8592a745a7 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -183,11 +183,12 @@ int cx_driver_unregister(struct cx_drv *cx_driver)
183 * @part_num: device's part number 183 * @part_num: device's part number
184 * @mfg_num: device's manufacturer number 184 * @mfg_num: device's manufacturer number
185 * @hubdev: hub info associated with this device 185 * @hubdev: hub info associated with this device
186 * @bt: board type of the device
186 * 187 *
187 */ 188 */
188int 189int
189cx_device_register(nasid_t nasid, int part_num, int mfg_num, 190cx_device_register(nasid_t nasid, int part_num, int mfg_num,
190 struct hubdev_info *hubdev) 191 struct hubdev_info *hubdev, int bt)
191{ 192{
192 struct cx_dev *cx_dev; 193 struct cx_dev *cx_dev;
193 194
@@ -200,6 +201,7 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
200 cx_dev->cx_id.mfg_num = mfg_num; 201 cx_dev->cx_id.mfg_num = mfg_num;
201 cx_dev->cx_id.nasid = nasid; 202 cx_dev->cx_id.nasid = nasid;
202 cx_dev->hubdev = hubdev; 203 cx_dev->hubdev = hubdev;
204 cx_dev->bt = bt;
203 205
204 cx_dev->dev.parent = NULL; 206 cx_dev->dev.parent = NULL;
205 cx_dev->dev.bus = &tiocx_bus_type; 207 cx_dev->dev.bus = &tiocx_bus_type;
@@ -238,7 +240,8 @@ static int cx_device_reload(struct cx_dev *cx_dev)
238{ 240{
239 cx_device_unregister(cx_dev); 241 cx_device_unregister(cx_dev);
240 return cx_device_register(cx_dev->cx_id.nasid, cx_dev->cx_id.part_num, 242 return cx_device_register(cx_dev->cx_id.nasid, cx_dev->cx_id.part_num,
241 cx_dev->cx_id.mfg_num, cx_dev->hubdev); 243 cx_dev->cx_id.mfg_num, cx_dev->hubdev,
244 cx_dev->bt);
242} 245}
243 246
244static inline uint64_t tiocx_intr_alloc(nasid_t nasid, int widget, 247static inline uint64_t tiocx_intr_alloc(nasid_t nasid, int widget,
@@ -365,26 +368,20 @@ static void tio_corelet_reset(nasid_t nasid, int corelet)
365 udelay(2000); 368 udelay(2000);
366} 369}
367 370
368static int tiocx_btchar_get(int nasid) 371static int is_fpga_tio(int nasid, int *bt)
369{ 372{
370 moduleid_t module_id; 373 int ioboard_type;
371 geoid_t geoid;
372 int cnodeid;
373
374 cnodeid = nasid_to_cnodeid(nasid);
375 geoid = cnodeid_get_geoid(cnodeid);
376 module_id = geo_module(geoid);
377 return MODULE_GET_BTCHAR(module_id);
378}
379 374
380static int is_fpga_brick(int nasid) 375 ioboard_type = ia64_sn_sysctl_ioboard_get(nasid);
381{ 376
382 switch (tiocx_btchar_get(nasid)) { 377 switch (ioboard_type) {
383 case L1_BRICKTYPE_SA: 378 case L1_BRICKTYPE_SA:
384 case L1_BRICKTYPE_ATHENA: 379 case L1_BRICKTYPE_ATHENA:
385 case L1_BRICKTYPE_DAYTONA: 380 case L1_BOARDTYPE_DAYTONA:
381 *bt = ioboard_type;
386 return 1; 382 return 1;
387 } 383 }
384
388 return 0; 385 return 0;
389} 386}
390 387
@@ -407,16 +404,22 @@ static int tiocx_reload(struct cx_dev *cx_dev)
407 404
408 if (bitstream_loaded(nasid)) { 405 if (bitstream_loaded(nasid)) {
409 uint64_t cx_id; 406 uint64_t cx_id;
410 407 int rv;
411 cx_id = 408
412 *(volatile uint64_t *)(TIO_SWIN_BASE(nasid, TIOCX_CORELET) + 409 rv = ia64_sn_sysctl_tio_clock_reset(nasid);
410 if (rv) {
411 printk(KERN_ALERT "CX port JTAG reset failed.\n");
412 } else {
413 cx_id = *(volatile uint64_t *)
414 (TIO_SWIN_BASE(nasid, TIOCX_CORELET) +
413 WIDGET_ID); 415 WIDGET_ID);
414 part_num = XWIDGET_PART_NUM(cx_id); 416 part_num = XWIDGET_PART_NUM(cx_id);
415 mfg_num = XWIDGET_MFG_NUM(cx_id); 417 mfg_num = XWIDGET_MFG_NUM(cx_id);
416 DBG("part= 0x%x, mfg= 0x%x\n", part_num, mfg_num); 418 DBG("part= 0x%x, mfg= 0x%x\n", part_num, mfg_num);
417 /* just ignore it if it's a CE */ 419 /* just ignore it if it's a CE */
418 if (part_num == TIO_CE_ASIC_PARTNUM) 420 if (part_num == TIO_CE_ASIC_PARTNUM)
419 return 0; 421 return 0;
422 }
420 } 423 }
421 424
422 cx_dev->cx_id.part_num = part_num; 425 cx_dev->cx_id.part_num = part_num;
@@ -436,10 +439,10 @@ static ssize_t show_cxdev_control(struct device *dev, struct device_attribute *a
436{ 439{
437 struct cx_dev *cx_dev = to_cx_dev(dev); 440 struct cx_dev *cx_dev = to_cx_dev(dev);
438 441
439 return sprintf(buf, "0x%x 0x%x 0x%x %d\n", 442 return sprintf(buf, "0x%x 0x%x 0x%x 0x%x\n",
440 cx_dev->cx_id.nasid, 443 cx_dev->cx_id.nasid,
441 cx_dev->cx_id.part_num, cx_dev->cx_id.mfg_num, 444 cx_dev->cx_id.part_num, cx_dev->cx_id.mfg_num,
442 tiocx_btchar_get(cx_dev->cx_id.nasid)); 445 cx_dev->bt);
443} 446}
444 447
445static ssize_t store_cxdev_control(struct device *dev, struct device_attribute *attr, const char *buf, 448static ssize_t store_cxdev_control(struct device *dev, struct device_attribute *attr, const char *buf,
@@ -486,13 +489,13 @@ static int __init tiocx_init(void)
486 489
487 bus_register(&tiocx_bus_type); 490 bus_register(&tiocx_bus_type);
488 491
489 for (cnodeid = 0; cnodeid < MAX_COMPACT_NODES; cnodeid++) { 492 for (cnodeid = 0; cnodeid < num_cnodes; cnodeid++) {
490 nasid_t nasid; 493 nasid_t nasid;
494 int bt;
491 495
492 if ((nasid = cnodeid_to_nasid(cnodeid)) < 0) 496 nasid = cnodeid_to_nasid(cnodeid);
493 break; /* No more nasids .. bail out of loop */
494 497
495 if ((nasid & 0x1) && is_fpga_brick(nasid)) { 498 if ((nasid & 0x1) && is_fpga_tio(nasid, &bt)) {
496 struct hubdev_info *hubdev; 499 struct hubdev_info *hubdev;
497 struct xwidget_info *widgetp; 500 struct xwidget_info *widgetp;
498 501
@@ -512,7 +515,7 @@ static int __init tiocx_init(void)
512 515
513 if (cx_device_register 516 if (cx_device_register
514 (nasid, widgetp->xwi_hwid.part_num, 517 (nasid, widgetp->xwi_hwid.part_num,
515 widgetp->xwi_hwid.mfg_num, hubdev) < 0) 518 widgetp->xwi_hwid.mfg_num, hubdev, bt) < 0)
516 return -ENXIO; 519 return -ENXIO;
517 else 520 else
518 found_tiocx_device++; 521 found_tiocx_device++;
diff --git a/arch/ia64/sn/kernel/xpc.h b/arch/ia64/sn/kernel/xpc.h
index e5f5a4e51f70..fbcedc7c27fa 100644
--- a/arch/ia64/sn/kernel/xpc.h
+++ b/arch/ia64/sn/kernel/xpc.h
@@ -57,7 +57,7 @@
57#define XPC_NASID_FROM_W_B(_w, _b) (((_w) * 64 + (_b)) * 2) 57#define XPC_NASID_FROM_W_B(_w, _b) (((_w) * 64 + (_b)) * 2)
58 58
59#define XPC_HB_DEFAULT_INTERVAL 5 /* incr HB every x secs */ 59#define XPC_HB_DEFAULT_INTERVAL 5 /* incr HB every x secs */
60#define XPC_HB_CHECK_DEFAULT_TIMEOUT 20 /* check HB every x secs */ 60#define XPC_HB_CHECK_DEFAULT_INTERVAL 20 /* check HB every x secs */
61 61
62/* define the process name of HB checker and the CPU it is pinned to */ 62/* define the process name of HB checker and the CPU it is pinned to */
63#define XPC_HB_CHECK_THREAD_NAME "xpc_hb" 63#define XPC_HB_CHECK_THREAD_NAME "xpc_hb"
@@ -67,34 +67,82 @@
67#define XPC_DISCOVERY_THREAD_NAME "xpc_discovery" 67#define XPC_DISCOVERY_THREAD_NAME "xpc_discovery"
68 68
69 69
70#define XPC_HB_ALLOWED(_p, _v) ((_v)->heartbeating_to_mask & (1UL << (_p)))
71#define XPC_ALLOW_HB(_p, _v) (_v)->heartbeating_to_mask |= (1UL << (_p))
72#define XPC_DISALLOW_HB(_p, _v) (_v)->heartbeating_to_mask &= (~(1UL << (_p)))
73
74
75/* 70/*
76 * Reserved Page provided by SAL. 71 * the reserved page
72 *
73 * SAL reserves one page of memory per partition for XPC. Though a full page
74 * in length (16384 bytes), its starting address is not page aligned, but it
75 * is cacheline aligned. The reserved page consists of the following:
76 *
77 * reserved page header
78 *
79 * The first cacheline of the reserved page contains the header
80 * (struct xpc_rsvd_page). Before SAL initialization has completed,
81 * SAL has set up the following fields of the reserved page header:
82 * SAL_signature, SAL_version, partid, and nasids_size. The other
83 * fields are set up by XPC. (xpc_rsvd_page points to the local
84 * partition's reserved page.)
77 * 85 *
78 * SAL provides one page per partition of reserved memory. When SAL 86 * part_nasids mask
79 * initialization is complete, SAL_signature, SAL_version, partid, 87 * mach_nasids mask
80 * part_nasids, and mach_nasids are set. 88 *
89 * SAL also sets up two bitmaps (or masks), one that reflects the actual
90 * nasids in this partition (part_nasids), and the other that reflects
91 * the actual nasids in the entire machine (mach_nasids). We're only
92 * interested in the even numbered nasids (which contain the processors
93 * and/or memory), so we only need half as many bits to represent the
94 * nasids. The part_nasids mask is located starting at the first cacheline
95 * following the reserved page header. The mach_nasids mask follows right
96 * after the part_nasids mask. The size in bytes of each mask is reflected
97 * by the reserved page header field 'nasids_size'. (Local partition's
98 * mask pointers are xpc_part_nasids and xpc_mach_nasids.)
99 *
100 * vars
101 * vars part
102 *
103 * Immediately following the mach_nasids mask are the XPC variables
104 * required by other partitions. First are those that are generic to all
105 * partitions (vars), followed on the next available cacheline by those
106 * which are partition specific (vars part). These are setup by XPC.
107 * (Local partition's vars pointers are xpc_vars and xpc_vars_part.)
81 * 108 *
82 * Note: Until vars_pa is set, the partition XPC code has not been initialized. 109 * Note: Until vars_pa is set, the partition XPC code has not been initialized.
83 */ 110 */
84struct xpc_rsvd_page { 111struct xpc_rsvd_page {
85 u64 SAL_signature; /* SAL unique signature */ 112 u64 SAL_signature; /* SAL: unique signature */
86 u64 SAL_version; /* SAL specified version */ 113 u64 SAL_version; /* SAL: version */
87 u8 partid; /* partition ID from SAL */ 114 u8 partid; /* SAL: partition ID */
88 u8 version; 115 u8 version;
89 u8 pad[6]; /* pad to u64 align */ 116 u8 pad1[6]; /* align to next u64 in cacheline */
90 volatile u64 vars_pa; 117 volatile u64 vars_pa;
91 u64 part_nasids[XP_NASID_MASK_WORDS] ____cacheline_aligned; 118 struct timespec stamp; /* time when reserved page was setup by XPC */
92 u64 mach_nasids[XP_NASID_MASK_WORDS] ____cacheline_aligned; 119 u64 pad2[9]; /* align to last u64 in cacheline */
120 u64 nasids_size; /* SAL: size of each nasid mask in bytes */
93}; 121};
94#define XPC_RP_VERSION _XPC_VERSION(1,0) /* version 1.0 of the reserved page */
95 122
96#define XPC_RSVD_PAGE_ALIGNED_SIZE \ 123#define XPC_RP_VERSION _XPC_VERSION(1,1) /* version 1.1 of the reserved page */
97 (L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page))) 124
125#define XPC_SUPPORTS_RP_STAMP(_version) \
126 (_version >= _XPC_VERSION(1,1))
127
128/*
129 * compare stamps - the return value is:
130 *
131 * < 0, if stamp1 < stamp2
132 * = 0, if stamp1 == stamp2
133 * > 0, if stamp1 > stamp2
134 */
135static inline int
136xpc_compare_stamps(struct timespec *stamp1, struct timespec *stamp2)
137{
138 int ret;
139
140
141 if ((ret = stamp1->tv_sec - stamp2->tv_sec) == 0) {
142 ret = stamp1->tv_nsec - stamp2->tv_nsec;
143 }
144 return ret;
145}
98 146
99 147
100/* 148/*
@@ -121,11 +169,58 @@ struct xpc_vars {
121 u64 vars_part_pa; 169 u64 vars_part_pa;
122 u64 amos_page_pa; /* paddr of page of AMOs from MSPEC driver */ 170 u64 amos_page_pa; /* paddr of page of AMOs from MSPEC driver */
123 AMO_t *amos_page; /* vaddr of page of AMOs from MSPEC driver */ 171 AMO_t *amos_page; /* vaddr of page of AMOs from MSPEC driver */
124 AMO_t *act_amos; /* pointer to the first activation AMO */
125}; 172};
126#define XPC_V_VERSION _XPC_VERSION(3,0) /* version 3.0 of the cross vars */
127 173
128#define XPC_VARS_ALIGNED_SIZE (L1_CACHE_ALIGN(sizeof(struct xpc_vars))) 174#define XPC_V_VERSION _XPC_VERSION(3,1) /* version 3.1 of the cross vars */
175
176#define XPC_SUPPORTS_DISENGAGE_REQUEST(_version) \
177 (_version >= _XPC_VERSION(3,1))
178
179
180static inline int
181xpc_hb_allowed(partid_t partid, struct xpc_vars *vars)
182{
183 return ((vars->heartbeating_to_mask & (1UL << partid)) != 0);
184}
185
186static inline void
187xpc_allow_hb(partid_t partid, struct xpc_vars *vars)
188{
189 u64 old_mask, new_mask;
190
191 do {
192 old_mask = vars->heartbeating_to_mask;
193 new_mask = (old_mask | (1UL << partid));
194 } while (cmpxchg(&vars->heartbeating_to_mask, old_mask, new_mask) !=
195 old_mask);
196}
197
198static inline void
199xpc_disallow_hb(partid_t partid, struct xpc_vars *vars)
200{
201 u64 old_mask, new_mask;
202
203 do {
204 old_mask = vars->heartbeating_to_mask;
205 new_mask = (old_mask & ~(1UL << partid));
206 } while (cmpxchg(&vars->heartbeating_to_mask, old_mask, new_mask) !=
207 old_mask);
208}
209
210
211/*
212 * The AMOs page consists of a number of AMO variables which are divided into
213 * four groups, The first two groups are used to identify an IRQ's sender.
214 * These two groups consist of 64 and 128 AMO variables respectively. The last
215 * two groups, consisting of just one AMO variable each, are used to identify
216 * the remote partitions that are currently engaged (from the viewpoint of
217 * the XPC running on the remote partition).
218 */
219#define XPC_NOTIFY_IRQ_AMOS 0
220#define XPC_ACTIVATE_IRQ_AMOS (XPC_NOTIFY_IRQ_AMOS + XP_MAX_PARTITIONS)
221#define XPC_ENGAGED_PARTITIONS_AMO (XPC_ACTIVATE_IRQ_AMOS + XP_NASID_MASK_WORDS)
222#define XPC_DISENGAGE_REQUEST_AMO (XPC_ENGAGED_PARTITIONS_AMO + 1)
223
129 224
130/* 225/*
131 * The following structure describes the per partition specific variables. 226 * The following structure describes the per partition specific variables.
@@ -165,6 +260,16 @@ struct xpc_vars_part {
165#define XPC_VP_MAGIC2 0x0073726176435058L /* 'XPCvars\0'L (little endian) */ 260#define XPC_VP_MAGIC2 0x0073726176435058L /* 'XPCvars\0'L (little endian) */
166 261
167 262
263/* the reserved page sizes and offsets */
264
265#define XPC_RP_HEADER_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page))
266#define XPC_RP_VARS_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_vars))
267
268#define XPC_RP_PART_NASIDS(_rp) (u64 *) ((u8 *) _rp + XPC_RP_HEADER_SIZE)
269#define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + xp_nasid_mask_words)
270#define XPC_RP_VARS(_rp) ((struct xpc_vars *) XPC_RP_MACH_NASIDS(_rp) + xp_nasid_mask_words)
271#define XPC_RP_VARS_PART(_rp) (struct xpc_vars_part *) ((u8 *) XPC_RP_VARS(rp) + XPC_RP_VARS_SIZE)
272
168 273
169/* 274/*
170 * Functions registered by add_timer() or called by kernel_thread() only 275 * Functions registered by add_timer() or called by kernel_thread() only
@@ -349,6 +454,9 @@ struct xpc_channel {
349 atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */ 454 atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */
350 wait_queue_head_t msg_allocate_wq; /* msg allocation wait queue */ 455 wait_queue_head_t msg_allocate_wq; /* msg allocation wait queue */
351 456
457 u8 delayed_IPI_flags; /* IPI flags received, but delayed */
458 /* action until channel disconnected */
459
352 /* queue of msg senders who want to be notified when msg received */ 460 /* queue of msg senders who want to be notified when msg received */
353 461
354 atomic_t n_to_notify; /* #of msg senders to notify */ 462 atomic_t n_to_notify; /* #of msg senders to notify */
@@ -358,7 +466,7 @@ struct xpc_channel {
358 void *key; /* pointer to user's key */ 466 void *key; /* pointer to user's key */
359 467
360 struct semaphore msg_to_pull_sema; /* next msg to pull serialization */ 468 struct semaphore msg_to_pull_sema; /* next msg to pull serialization */
361 struct semaphore teardown_sema; /* wait for teardown completion */ 469 struct semaphore wdisconnect_sema; /* wait for channel disconnect */
362 470
363 struct xpc_openclose_args *local_openclose_args; /* args passed on */ 471 struct xpc_openclose_args *local_openclose_args; /* args passed on */
364 /* opening or closing of channel */ 472 /* opening or closing of channel */
@@ -410,6 +518,8 @@ struct xpc_channel {
410 518
411#define XPC_C_DISCONNECTED 0x00002000 /* channel is disconnected */ 519#define XPC_C_DISCONNECTED 0x00002000 /* channel is disconnected */
412#define XPC_C_DISCONNECTING 0x00004000 /* channel is being disconnected */ 520#define XPC_C_DISCONNECTING 0x00004000 /* channel is being disconnected */
521#define XPC_C_DISCONNECTCALLOUT 0x00008000 /* chan disconnected callout made */
522#define XPC_C_WDISCONNECT 0x00010000 /* waiting for channel disconnect */
413 523
414 524
415 525
@@ -422,6 +532,8 @@ struct xpc_partition {
422 532
423 /* XPC HB infrastructure */ 533 /* XPC HB infrastructure */
424 534
535 u8 remote_rp_version; /* version# of partition's rsvd pg */
536 struct timespec remote_rp_stamp;/* time when rsvd pg was initialized */
425 u64 remote_rp_pa; /* phys addr of partition's rsvd pg */ 537 u64 remote_rp_pa; /* phys addr of partition's rsvd pg */
426 u64 remote_vars_pa; /* phys addr of partition's vars */ 538 u64 remote_vars_pa; /* phys addr of partition's vars */
427 u64 remote_vars_part_pa; /* phys addr of partition's vars part */ 539 u64 remote_vars_part_pa; /* phys addr of partition's vars part */
@@ -432,14 +544,18 @@ struct xpc_partition {
432 u32 act_IRQ_rcvd; /* IRQs since activation */ 544 u32 act_IRQ_rcvd; /* IRQs since activation */
433 spinlock_t act_lock; /* protect updating of act_state */ 545 spinlock_t act_lock; /* protect updating of act_state */
434 u8 act_state; /* from XPC HB viewpoint */ 546 u8 act_state; /* from XPC HB viewpoint */
547 u8 remote_vars_version; /* version# of partition's vars */
435 enum xpc_retval reason; /* reason partition is deactivating */ 548 enum xpc_retval reason; /* reason partition is deactivating */
436 int reason_line; /* line# deactivation initiated from */ 549 int reason_line; /* line# deactivation initiated from */
437 int reactivate_nasid; /* nasid in partition to reactivate */ 550 int reactivate_nasid; /* nasid in partition to reactivate */
438 551
552 unsigned long disengage_request_timeout; /* timeout in jiffies */
553 struct timer_list disengage_request_timer;
554
439 555
440 /* XPC infrastructure referencing and teardown control */ 556 /* XPC infrastructure referencing and teardown control */
441 557
442 volatile u8 setup_state; /* infrastructure setup state */ 558 volatile u8 setup_state; /* infrastructure setup state */
443 wait_queue_head_t teardown_wq; /* kthread waiting to teardown infra */ 559 wait_queue_head_t teardown_wq; /* kthread waiting to teardown infra */
444 atomic_t references; /* #of references to infrastructure */ 560 atomic_t references; /* #of references to infrastructure */
445 561
@@ -454,6 +570,7 @@ struct xpc_partition {
454 570
455 u8 nchannels; /* #of defined channels supported */ 571 u8 nchannels; /* #of defined channels supported */
456 atomic_t nchannels_active; /* #of channels that are not DISCONNECTED */ 572 atomic_t nchannels_active; /* #of channels that are not DISCONNECTED */
573 atomic_t nchannels_engaged;/* #of channels engaged with remote part */
457 struct xpc_channel *channels;/* array of channel structures */ 574 struct xpc_channel *channels;/* array of channel structures */
458 575
459 void *local_GPs_base; /* base address of kmalloc'd space */ 576 void *local_GPs_base; /* base address of kmalloc'd space */
@@ -518,6 +635,7 @@ struct xpc_partition {
518#define XPC_P_TORNDOWN 0x03 /* infrastructure is torndown */ 635#define XPC_P_TORNDOWN 0x03 /* infrastructure is torndown */
519 636
520 637
638
521/* 639/*
522 * struct xpc_partition IPI_timer #of seconds to wait before checking for 640 * struct xpc_partition IPI_timer #of seconds to wait before checking for
523 * dropped IPIs. These occur whenever an IPI amo write doesn't complete until 641 * dropped IPIs. These occur whenever an IPI amo write doesn't complete until
@@ -526,6 +644,13 @@ struct xpc_partition {
526#define XPC_P_DROPPED_IPI_WAIT (0.25 * HZ) 644#define XPC_P_DROPPED_IPI_WAIT (0.25 * HZ)
527 645
528 646
647/* number of seconds to wait for other partitions to disengage */
648#define XPC_DISENGAGE_REQUEST_DEFAULT_TIMELIMIT 90
649
650/* interval in seconds to print 'waiting disengagement' messages */
651#define XPC_DISENGAGE_PRINTMSG_INTERVAL 10
652
653
529#define XPC_PARTID(_p) ((partid_t) ((_p) - &xpc_partitions[0])) 654#define XPC_PARTID(_p) ((partid_t) ((_p) - &xpc_partitions[0]))
530 655
531 656
@@ -534,24 +659,20 @@ struct xpc_partition {
534extern struct xpc_registration xpc_registrations[]; 659extern struct xpc_registration xpc_registrations[];
535 660
536 661
537/* >>> found in xpc_main.c only */ 662/* found in xpc_main.c */
538extern struct device *xpc_part; 663extern struct device *xpc_part;
539extern struct device *xpc_chan; 664extern struct device *xpc_chan;
665extern int xpc_disengage_request_timelimit;
540extern irqreturn_t xpc_notify_IRQ_handler(int, void *, struct pt_regs *); 666extern irqreturn_t xpc_notify_IRQ_handler(int, void *, struct pt_regs *);
541extern void xpc_dropped_IPI_check(struct xpc_partition *); 667extern void xpc_dropped_IPI_check(struct xpc_partition *);
668extern void xpc_activate_partition(struct xpc_partition *);
542extern void xpc_activate_kthreads(struct xpc_channel *, int); 669extern void xpc_activate_kthreads(struct xpc_channel *, int);
543extern void xpc_create_kthreads(struct xpc_channel *, int); 670extern void xpc_create_kthreads(struct xpc_channel *, int);
544extern void xpc_disconnect_wait(int); 671extern void xpc_disconnect_wait(int);
545 672
546 673
547/* found in xpc_main.c and efi-xpc.c */
548extern void xpc_activate_partition(struct xpc_partition *);
549
550
551/* found in xpc_partition.c */ 674/* found in xpc_partition.c */
552extern int xpc_exiting; 675extern int xpc_exiting;
553extern int xpc_hb_interval;
554extern int xpc_hb_check_interval;
555extern struct xpc_vars *xpc_vars; 676extern struct xpc_vars *xpc_vars;
556extern struct xpc_rsvd_page *xpc_rsvd_page; 677extern struct xpc_rsvd_page *xpc_rsvd_page;
557extern struct xpc_vars_part *xpc_vars_part; 678extern struct xpc_vars_part *xpc_vars_part;
@@ -561,6 +682,7 @@ extern struct xpc_rsvd_page *xpc_rsvd_page_init(void);
561extern void xpc_allow_IPI_ops(void); 682extern void xpc_allow_IPI_ops(void);
562extern void xpc_restrict_IPI_ops(void); 683extern void xpc_restrict_IPI_ops(void);
563extern int xpc_identify_act_IRQ_sender(void); 684extern int xpc_identify_act_IRQ_sender(void);
685extern int xpc_partition_disengaged(struct xpc_partition *);
564extern enum xpc_retval xpc_mark_partition_active(struct xpc_partition *); 686extern enum xpc_retval xpc_mark_partition_active(struct xpc_partition *);
565extern void xpc_mark_partition_inactive(struct xpc_partition *); 687extern void xpc_mark_partition_inactive(struct xpc_partition *);
566extern void xpc_discovery(void); 688extern void xpc_discovery(void);
@@ -585,8 +707,8 @@ extern void xpc_connected_callout(struct xpc_channel *);
585extern void xpc_deliver_msg(struct xpc_channel *); 707extern void xpc_deliver_msg(struct xpc_channel *);
586extern void xpc_disconnect_channel(const int, struct xpc_channel *, 708extern void xpc_disconnect_channel(const int, struct xpc_channel *,
587 enum xpc_retval, unsigned long *); 709 enum xpc_retval, unsigned long *);
588extern void xpc_disconnected_callout(struct xpc_channel *); 710extern void xpc_disconnecting_callout(struct xpc_channel *);
589extern void xpc_partition_down(struct xpc_partition *, enum xpc_retval); 711extern void xpc_partition_going_down(struct xpc_partition *, enum xpc_retval);
590extern void xpc_teardown_infrastructure(struct xpc_partition *); 712extern void xpc_teardown_infrastructure(struct xpc_partition *);
591 713
592 714
@@ -674,6 +796,157 @@ xpc_part_ref(struct xpc_partition *part)
674 796
675 797
676/* 798/*
799 * This next set of inlines are used to keep track of when a partition is
800 * potentially engaged in accessing memory belonging to another partition.
801 */
802
803static inline void
804xpc_mark_partition_engaged(struct xpc_partition *part)
805{
806 unsigned long irq_flags;
807 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
808 (XPC_ENGAGED_PARTITIONS_AMO * sizeof(AMO_t)));
809
810
811 local_irq_save(irq_flags);
812
813 /* set bit corresponding to our partid in remote partition's AMO */
814 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_OR,
815 (1UL << sn_partition_id));
816 /*
817 * We must always use the nofault function regardless of whether we
818 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
819 * didn't, we'd never know that the other partition is down and would
820 * keep sending IPIs and AMOs to it until the heartbeat times out.
821 */
822 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
823 variable), xp_nofault_PIOR_target));
824
825 local_irq_restore(irq_flags);
826}
827
828static inline void
829xpc_mark_partition_disengaged(struct xpc_partition *part)
830{
831 unsigned long irq_flags;
832 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
833 (XPC_ENGAGED_PARTITIONS_AMO * sizeof(AMO_t)));
834
835
836 local_irq_save(irq_flags);
837
838 /* clear bit corresponding to our partid in remote partition's AMO */
839 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
840 ~(1UL << sn_partition_id));
841 /*
842 * We must always use the nofault function regardless of whether we
843 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
844 * didn't, we'd never know that the other partition is down and would
845 * keep sending IPIs and AMOs to it until the heartbeat times out.
846 */
847 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
848 variable), xp_nofault_PIOR_target));
849
850 local_irq_restore(irq_flags);
851}
852
853static inline void
854xpc_request_partition_disengage(struct xpc_partition *part)
855{
856 unsigned long irq_flags;
857 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
858 (XPC_DISENGAGE_REQUEST_AMO * sizeof(AMO_t)));
859
860
861 local_irq_save(irq_flags);
862
863 /* set bit corresponding to our partid in remote partition's AMO */
864 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_OR,
865 (1UL << sn_partition_id));
866 /*
867 * We must always use the nofault function regardless of whether we
868 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
869 * didn't, we'd never know that the other partition is down and would
870 * keep sending IPIs and AMOs to it until the heartbeat times out.
871 */
872 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
873 variable), xp_nofault_PIOR_target));
874
875 local_irq_restore(irq_flags);
876}
877
878static inline void
879xpc_cancel_partition_disengage_request(struct xpc_partition *part)
880{
881 unsigned long irq_flags;
882 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
883 (XPC_DISENGAGE_REQUEST_AMO * sizeof(AMO_t)));
884
885
886 local_irq_save(irq_flags);
887
888 /* clear bit corresponding to our partid in remote partition's AMO */
889 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
890 ~(1UL << sn_partition_id));
891 /*
892 * We must always use the nofault function regardless of whether we
893 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
894 * didn't, we'd never know that the other partition is down and would
895 * keep sending IPIs and AMOs to it until the heartbeat times out.
896 */
897 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
898 variable), xp_nofault_PIOR_target));
899
900 local_irq_restore(irq_flags);
901}
902
903static inline u64
904xpc_partition_engaged(u64 partid_mask)
905{
906 AMO_t *amo = xpc_vars->amos_page + XPC_ENGAGED_PARTITIONS_AMO;
907
908
909 /* return our partition's AMO variable ANDed with partid_mask */
910 return (FETCHOP_LOAD_OP(TO_AMO((u64) &amo->variable), FETCHOP_LOAD) &
911 partid_mask);
912}
913
914static inline u64
915xpc_partition_disengage_requested(u64 partid_mask)
916{
917 AMO_t *amo = xpc_vars->amos_page + XPC_DISENGAGE_REQUEST_AMO;
918
919
920 /* return our partition's AMO variable ANDed with partid_mask */
921 return (FETCHOP_LOAD_OP(TO_AMO((u64) &amo->variable), FETCHOP_LOAD) &
922 partid_mask);
923}
924
925static inline void
926xpc_clear_partition_engaged(u64 partid_mask)
927{
928 AMO_t *amo = xpc_vars->amos_page + XPC_ENGAGED_PARTITIONS_AMO;
929
930
931 /* clear bit(s) based on partid_mask in our partition's AMO */
932 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
933 ~partid_mask);
934}
935
936static inline void
937xpc_clear_partition_disengage_request(u64 partid_mask)
938{
939 AMO_t *amo = xpc_vars->amos_page + XPC_DISENGAGE_REQUEST_AMO;
940
941
942 /* clear bit(s) based on partid_mask in our partition's AMO */
943 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
944 ~partid_mask);
945}
946
947
948
949/*
677 * The following set of macros and inlines are used for the sending and 950 * The following set of macros and inlines are used for the sending and
678 * receiving of IPIs (also known as IRQs). There are two flavors of IPIs, 951 * receiving of IPIs (also known as IRQs). There are two flavors of IPIs,
679 * one that is associated with partition activity (SGI_XPC_ACTIVATE) and 952 * one that is associated with partition activity (SGI_XPC_ACTIVATE) and
@@ -722,13 +995,13 @@ xpc_IPI_send(AMO_t *amo, u64 flag, int nasid, int phys_cpuid, int vector)
722 * Flag the appropriate AMO variable and send an IPI to the specified node. 995 * Flag the appropriate AMO variable and send an IPI to the specified node.
723 */ 996 */
724static inline void 997static inline void
725xpc_activate_IRQ_send(u64 amos_page, int from_nasid, int to_nasid, 998xpc_activate_IRQ_send(u64 amos_page_pa, int from_nasid, int to_nasid,
726 int to_phys_cpuid) 999 int to_phys_cpuid)
727{ 1000{
728 int w_index = XPC_NASID_W_INDEX(from_nasid); 1001 int w_index = XPC_NASID_W_INDEX(from_nasid);
729 int b_index = XPC_NASID_B_INDEX(from_nasid); 1002 int b_index = XPC_NASID_B_INDEX(from_nasid);
730 AMO_t *amos = (AMO_t *) __va(amos_page + 1003 AMO_t *amos = (AMO_t *) __va(amos_page_pa +
731 (XP_MAX_PARTITIONS * sizeof(AMO_t))); 1004 (XPC_ACTIVATE_IRQ_AMOS * sizeof(AMO_t)));
732 1005
733 1006
734 (void) xpc_IPI_send(&amos[w_index], (1UL << b_index), to_nasid, 1007 (void) xpc_IPI_send(&amos[w_index], (1UL << b_index), to_nasid,
@@ -756,6 +1029,13 @@ xpc_IPI_send_reactivate(struct xpc_partition *part)
756 xpc_vars->act_nasid, xpc_vars->act_phys_cpuid); 1029 xpc_vars->act_nasid, xpc_vars->act_phys_cpuid);
757} 1030}
758 1031
1032static inline void
1033xpc_IPI_send_disengage(struct xpc_partition *part)
1034{
1035 xpc_activate_IRQ_send(part->remote_amos_page_pa, cnodeid_to_nasid(0),
1036 part->remote_act_nasid, part->remote_act_phys_cpuid);
1037}
1038
759 1039
760/* 1040/*
761 * IPIs associated with SGI_XPC_NOTIFY IRQ. 1041 * IPIs associated with SGI_XPC_NOTIFY IRQ.
@@ -836,6 +1116,7 @@ xpc_notify_IRQ_send_local(struct xpc_channel *ch, u8 ipi_flag,
836 1116
837/* given an AMO variable and a channel#, get its associated IPI flags */ 1117/* given an AMO variable and a channel#, get its associated IPI flags */
838#define XPC_GET_IPI_FLAGS(_amo, _c) ((u8) (((_amo) >> ((_c) * 8)) & 0xff)) 1118#define XPC_GET_IPI_FLAGS(_amo, _c) ((u8) (((_amo) >> ((_c) * 8)) & 0xff))
1119#define XPC_SET_IPI_FLAGS(_amo, _c, _f) (_amo) |= ((u64) (_f) << ((_c) * 8))
839 1120
840#define XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & 0x0f0f0f0f0f0f0f0f) 1121#define XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & 0x0f0f0f0f0f0f0f0f)
841#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo) ((_amo) & 0x1010101010101010) 1122#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo) ((_amo) & 0x1010101010101010)
@@ -903,17 +1184,18 @@ xpc_IPI_send_local_msgrequest(struct xpc_channel *ch)
903 * cacheable mapping for the entire region. This will prevent speculative 1184 * cacheable mapping for the entire region. This will prevent speculative
904 * reading of cached copies of our lines from being issued which will cause 1185 * reading of cached copies of our lines from being issued which will cause
905 * a PI FSB Protocol error to be generated by the SHUB. For XPC, we need 64 1186 * a PI FSB Protocol error to be generated by the SHUB. For XPC, we need 64
906 * (XP_MAX_PARTITIONS) AMO variables for message notification (xpc_main.c) 1187 * AMO variables (based on XP_MAX_PARTITIONS) for message notification and an
907 * and an additional 16 AMO variables for partition activation (xpc_hb.c). 1188 * additional 128 AMO variables (based on XP_NASID_MASK_WORDS) for partition
1189 * activation and 2 AMO variables for partition deactivation.
908 */ 1190 */
909static inline AMO_t * 1191static inline AMO_t *
910xpc_IPI_init(partid_t partid) 1192xpc_IPI_init(int index)
911{ 1193{
912 AMO_t *part_amo = xpc_vars->amos_page + partid; 1194 AMO_t *amo = xpc_vars->amos_page + index;
913 1195
914 1196
915 xpc_IPI_receive(part_amo); 1197 (void) xpc_IPI_receive(amo); /* clear AMO variable */
916 return part_amo; 1198 return amo;
917} 1199}
918 1200
919 1201
diff --git a/arch/ia64/sn/kernel/xpc_channel.c b/arch/ia64/sn/kernel/xpc_channel.c
index 94698bea7be0..abf4fc2a87bb 100644
--- a/arch/ia64/sn/kernel/xpc_channel.c
+++ b/arch/ia64/sn/kernel/xpc_channel.c
@@ -57,6 +57,7 @@ xpc_initialize_channels(struct xpc_partition *part, partid_t partid)
57 57
58 spin_lock_init(&ch->lock); 58 spin_lock_init(&ch->lock);
59 sema_init(&ch->msg_to_pull_sema, 1); /* mutex */ 59 sema_init(&ch->msg_to_pull_sema, 1); /* mutex */
60 sema_init(&ch->wdisconnect_sema, 0); /* event wait */
60 61
61 atomic_set(&ch->n_on_msg_allocate_wq, 0); 62 atomic_set(&ch->n_on_msg_allocate_wq, 0);
62 init_waitqueue_head(&ch->msg_allocate_wq); 63 init_waitqueue_head(&ch->msg_allocate_wq);
@@ -166,6 +167,7 @@ xpc_setup_infrastructure(struct xpc_partition *part)
166 xpc_initialize_channels(part, partid); 167 xpc_initialize_channels(part, partid);
167 168
168 atomic_set(&part->nchannels_active, 0); 169 atomic_set(&part->nchannels_active, 0);
170 atomic_set(&part->nchannels_engaged, 0);
169 171
170 172
171 /* local_IPI_amo were set to 0 by an earlier memset() */ 173 /* local_IPI_amo were set to 0 by an earlier memset() */
@@ -555,8 +557,6 @@ xpc_allocate_msgqueues(struct xpc_channel *ch)
555 sema_init(&ch->notify_queue[i].sema, 0); 557 sema_init(&ch->notify_queue[i].sema, 0);
556 } 558 }
557 559
558 sema_init(&ch->teardown_sema, 0); /* event wait */
559
560 spin_lock_irqsave(&ch->lock, irq_flags); 560 spin_lock_irqsave(&ch->lock, irq_flags);
561 ch->flags |= XPC_C_SETUP; 561 ch->flags |= XPC_C_SETUP;
562 spin_unlock_irqrestore(&ch->lock, irq_flags); 562 spin_unlock_irqrestore(&ch->lock, irq_flags);
@@ -626,6 +626,55 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
626 626
627 627
628/* 628/*
629 * Notify those who wanted to be notified upon delivery of their message.
630 */
631static void
632xpc_notify_senders(struct xpc_channel *ch, enum xpc_retval reason, s64 put)
633{
634 struct xpc_notify *notify;
635 u8 notify_type;
636 s64 get = ch->w_remote_GP.get - 1;
637
638
639 while (++get < put && atomic_read(&ch->n_to_notify) > 0) {
640
641 notify = &ch->notify_queue[get % ch->local_nentries];
642
643 /*
644 * See if the notify entry indicates it was associated with
645 * a message who's sender wants to be notified. It is possible
646 * that it is, but someone else is doing or has done the
647 * notification.
648 */
649 notify_type = notify->type;
650 if (notify_type == 0 ||
651 cmpxchg(&notify->type, notify_type, 0) !=
652 notify_type) {
653 continue;
654 }
655
656 DBUG_ON(notify_type != XPC_N_CALL);
657
658 atomic_dec(&ch->n_to_notify);
659
660 if (notify->func != NULL) {
661 dev_dbg(xpc_chan, "notify->func() called, notify=0x%p, "
662 "msg_number=%ld, partid=%d, channel=%d\n",
663 (void *) notify, get, ch->partid, ch->number);
664
665 notify->func(reason, ch->partid, ch->number,
666 notify->key);
667
668 dev_dbg(xpc_chan, "notify->func() returned, "
669 "notify=0x%p, msg_number=%ld, partid=%d, "
670 "channel=%d\n", (void *) notify, get,
671 ch->partid, ch->number);
672 }
673 }
674}
675
676
677/*
629 * Free up message queues and other stuff that were allocated for the specified 678 * Free up message queues and other stuff that were allocated for the specified
630 * channel. 679 * channel.
631 * 680 *
@@ -669,9 +718,6 @@ xpc_free_msgqueues(struct xpc_channel *ch)
669 ch->remote_msgqueue = NULL; 718 ch->remote_msgqueue = NULL;
670 kfree(ch->notify_queue); 719 kfree(ch->notify_queue);
671 ch->notify_queue = NULL; 720 ch->notify_queue = NULL;
672
673 /* in case someone is waiting for the teardown to complete */
674 up(&ch->teardown_sema);
675 } 721 }
676} 722}
677 723
@@ -683,7 +729,7 @@ static void
683xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags) 729xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
684{ 730{
685 struct xpc_partition *part = &xpc_partitions[ch->partid]; 731 struct xpc_partition *part = &xpc_partitions[ch->partid];
686 u32 ch_flags = ch->flags; 732 u32 channel_was_connected = (ch->flags & XPC_C_WASCONNECTED);
687 733
688 734
689 DBUG_ON(!spin_is_locked(&ch->lock)); 735 DBUG_ON(!spin_is_locked(&ch->lock));
@@ -701,12 +747,13 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
701 } 747 }
702 DBUG_ON(atomic_read(&ch->kthreads_assigned) != 0); 748 DBUG_ON(atomic_read(&ch->kthreads_assigned) != 0);
703 749
704 /* it's now safe to free the channel's message queues */ 750 if (part->act_state == XPC_P_DEACTIVATING) {
705 751 /* can't proceed until the other side disengages from us */
706 xpc_free_msgqueues(ch); 752 if (xpc_partition_engaged(1UL << ch->partid)) {
707 DBUG_ON(ch->flags & XPC_C_SETUP); 753 return;
754 }
708 755
709 if (part->act_state != XPC_P_DEACTIVATING) { 756 } else {
710 757
711 /* as long as the other side is up do the full protocol */ 758 /* as long as the other side is up do the full protocol */
712 759
@@ -724,16 +771,42 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
724 } 771 }
725 } 772 }
726 773
774 /* wake those waiting for notify completion */
775 if (atomic_read(&ch->n_to_notify) > 0) {
776 /* >>> we do callout while holding ch->lock */
777 xpc_notify_senders(ch, ch->reason, ch->w_local_GP.put);
778 }
779
727 /* both sides are disconnected now */ 780 /* both sides are disconnected now */
728 781
729 ch->flags = XPC_C_DISCONNECTED; /* clear all flags, but this one */ 782 /* it's now safe to free the channel's message queues */
783 xpc_free_msgqueues(ch);
784
785 /* mark disconnected, clear all other flags except XPC_C_WDISCONNECT */
786 ch->flags = (XPC_C_DISCONNECTED | (ch->flags & XPC_C_WDISCONNECT));
730 787
731 atomic_dec(&part->nchannels_active); 788 atomic_dec(&part->nchannels_active);
732 789
733 if (ch_flags & XPC_C_WASCONNECTED) { 790 if (channel_was_connected) {
734 dev_info(xpc_chan, "channel %d to partition %d disconnected, " 791 dev_info(xpc_chan, "channel %d to partition %d disconnected, "
735 "reason=%d\n", ch->number, ch->partid, ch->reason); 792 "reason=%d\n", ch->number, ch->partid, ch->reason);
736 } 793 }
794
795 if (ch->flags & XPC_C_WDISCONNECT) {
796 spin_unlock_irqrestore(&ch->lock, *irq_flags);
797 up(&ch->wdisconnect_sema);
798 spin_lock_irqsave(&ch->lock, *irq_flags);
799
800 } else if (ch->delayed_IPI_flags) {
801 if (part->act_state != XPC_P_DEACTIVATING) {
802 /* time to take action on any delayed IPI flags */
803 spin_lock(&part->IPI_lock);
804 XPC_SET_IPI_FLAGS(part->local_IPI_amo, ch->number,
805 ch->delayed_IPI_flags);
806 spin_unlock(&part->IPI_lock);
807 }
808 ch->delayed_IPI_flags = 0;
809 }
737} 810}
738 811
739 812
@@ -754,6 +827,19 @@ xpc_process_openclose_IPI(struct xpc_partition *part, int ch_number,
754 827
755 spin_lock_irqsave(&ch->lock, irq_flags); 828 spin_lock_irqsave(&ch->lock, irq_flags);
756 829
830again:
831
832 if ((ch->flags & XPC_C_DISCONNECTED) &&
833 (ch->flags & XPC_C_WDISCONNECT)) {
834 /*
835 * Delay processing IPI flags until thread waiting disconnect
836 * has had a chance to see that the channel is disconnected.
837 */
838 ch->delayed_IPI_flags |= IPI_flags;
839 spin_unlock_irqrestore(&ch->lock, irq_flags);
840 return;
841 }
842
757 843
758 if (IPI_flags & XPC_IPI_CLOSEREQUEST) { 844 if (IPI_flags & XPC_IPI_CLOSEREQUEST) {
759 845
@@ -764,7 +850,7 @@ xpc_process_openclose_IPI(struct xpc_partition *part, int ch_number,
764 /* 850 /*
765 * If RCLOSEREQUEST is set, we're probably waiting for 851 * If RCLOSEREQUEST is set, we're probably waiting for
766 * RCLOSEREPLY. We should find it and a ROPENREQUEST packed 852 * RCLOSEREPLY. We should find it and a ROPENREQUEST packed
767 * with this RCLOSEQREUQEST in the IPI_flags. 853 * with this RCLOSEREQUEST in the IPI_flags.
768 */ 854 */
769 855
770 if (ch->flags & XPC_C_RCLOSEREQUEST) { 856 if (ch->flags & XPC_C_RCLOSEREQUEST) {
@@ -779,14 +865,22 @@ xpc_process_openclose_IPI(struct xpc_partition *part, int ch_number,
779 865
780 /* both sides have finished disconnecting */ 866 /* both sides have finished disconnecting */
781 xpc_process_disconnect(ch, &irq_flags); 867 xpc_process_disconnect(ch, &irq_flags);
868 DBUG_ON(!(ch->flags & XPC_C_DISCONNECTED));
869 goto again;
782 } 870 }
783 871
784 if (ch->flags & XPC_C_DISCONNECTED) { 872 if (ch->flags & XPC_C_DISCONNECTED) {
785 // >>> explain this section
786
787 if (!(IPI_flags & XPC_IPI_OPENREQUEST)) { 873 if (!(IPI_flags & XPC_IPI_OPENREQUEST)) {
788 DBUG_ON(part->act_state != 874 if ((XPC_GET_IPI_FLAGS(part->local_IPI_amo,
789 XPC_P_DEACTIVATING); 875 ch_number) & XPC_IPI_OPENREQUEST)) {
876
877 DBUG_ON(ch->delayed_IPI_flags != 0);
878 spin_lock(&part->IPI_lock);
879 XPC_SET_IPI_FLAGS(part->local_IPI_amo,
880 ch_number,
881 XPC_IPI_CLOSEREQUEST);
882 spin_unlock(&part->IPI_lock);
883 }
790 spin_unlock_irqrestore(&ch->lock, irq_flags); 884 spin_unlock_irqrestore(&ch->lock, irq_flags);
791 return; 885 return;
792 } 886 }
@@ -816,9 +910,13 @@ xpc_process_openclose_IPI(struct xpc_partition *part, int ch_number,
816 } 910 }
817 911
818 XPC_DISCONNECT_CHANNEL(ch, reason, &irq_flags); 912 XPC_DISCONNECT_CHANNEL(ch, reason, &irq_flags);
819 } else { 913
820 xpc_process_disconnect(ch, &irq_flags); 914 DBUG_ON(IPI_flags & XPC_IPI_CLOSEREPLY);
915 spin_unlock_irqrestore(&ch->lock, irq_flags);
916 return;
821 } 917 }
918
919 xpc_process_disconnect(ch, &irq_flags);
822 } 920 }
823 921
824 922
@@ -834,7 +932,20 @@ xpc_process_openclose_IPI(struct xpc_partition *part, int ch_number,
834 } 932 }
835 933
836 DBUG_ON(!(ch->flags & XPC_C_CLOSEREQUEST)); 934 DBUG_ON(!(ch->flags & XPC_C_CLOSEREQUEST));
837 DBUG_ON(!(ch->flags & XPC_C_RCLOSEREQUEST)); 935
936 if (!(ch->flags & XPC_C_RCLOSEREQUEST)) {
937 if ((XPC_GET_IPI_FLAGS(part->local_IPI_amo, ch_number)
938 & XPC_IPI_CLOSEREQUEST)) {
939
940 DBUG_ON(ch->delayed_IPI_flags != 0);
941 spin_lock(&part->IPI_lock);
942 XPC_SET_IPI_FLAGS(part->local_IPI_amo,
943 ch_number, XPC_IPI_CLOSEREPLY);
944 spin_unlock(&part->IPI_lock);
945 }
946 spin_unlock_irqrestore(&ch->lock, irq_flags);
947 return;
948 }
838 949
839 ch->flags |= XPC_C_RCLOSEREPLY; 950 ch->flags |= XPC_C_RCLOSEREPLY;
840 951
@@ -852,8 +963,14 @@ xpc_process_openclose_IPI(struct xpc_partition *part, int ch_number,
852 "channel=%d\n", args->msg_size, args->local_nentries, 963 "channel=%d\n", args->msg_size, args->local_nentries,
853 ch->partid, ch->number); 964 ch->partid, ch->number);
854 965
855 if ((ch->flags & XPC_C_DISCONNECTING) || 966 if (part->act_state == XPC_P_DEACTIVATING ||
856 part->act_state == XPC_P_DEACTIVATING) { 967 (ch->flags & XPC_C_ROPENREQUEST)) {
968 spin_unlock_irqrestore(&ch->lock, irq_flags);
969 return;
970 }
971
972 if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_WDISCONNECT)) {
973 ch->delayed_IPI_flags |= XPC_IPI_OPENREQUEST;
857 spin_unlock_irqrestore(&ch->lock, irq_flags); 974 spin_unlock_irqrestore(&ch->lock, irq_flags);
858 return; 975 return;
859 } 976 }
@@ -867,8 +984,11 @@ xpc_process_openclose_IPI(struct xpc_partition *part, int ch_number,
867 * msg_size = size of channel's messages in bytes 984 * msg_size = size of channel's messages in bytes
868 * local_nentries = remote partition's local_nentries 985 * local_nentries = remote partition's local_nentries
869 */ 986 */
870 DBUG_ON(args->msg_size == 0); 987 if (args->msg_size == 0 || args->local_nentries == 0) {
871 DBUG_ON(args->local_nentries == 0); 988 /* assume OPENREQUEST was delayed by mistake */
989 spin_unlock_irqrestore(&ch->lock, irq_flags);
990 return;
991 }
872 992
873 ch->flags |= (XPC_C_ROPENREQUEST | XPC_C_CONNECTING); 993 ch->flags |= (XPC_C_ROPENREQUEST | XPC_C_CONNECTING);
874 ch->remote_nentries = args->local_nentries; 994 ch->remote_nentries = args->local_nentries;
@@ -906,7 +1026,13 @@ xpc_process_openclose_IPI(struct xpc_partition *part, int ch_number,
906 spin_unlock_irqrestore(&ch->lock, irq_flags); 1026 spin_unlock_irqrestore(&ch->lock, irq_flags);
907 return; 1027 return;
908 } 1028 }
909 DBUG_ON(!(ch->flags & XPC_C_OPENREQUEST)); 1029 if (!(ch->flags & XPC_C_OPENREQUEST)) {
1030 XPC_DISCONNECT_CHANNEL(ch, xpcOpenCloseError,
1031 &irq_flags);
1032 spin_unlock_irqrestore(&ch->lock, irq_flags);
1033 return;
1034 }
1035
910 DBUG_ON(!(ch->flags & XPC_C_ROPENREQUEST)); 1036 DBUG_ON(!(ch->flags & XPC_C_ROPENREQUEST));
911 DBUG_ON(ch->flags & XPC_C_CONNECTED); 1037 DBUG_ON(ch->flags & XPC_C_CONNECTED);
912 1038
@@ -960,8 +1086,8 @@ xpc_connect_channel(struct xpc_channel *ch)
960 struct xpc_registration *registration = &xpc_registrations[ch->number]; 1086 struct xpc_registration *registration = &xpc_registrations[ch->number];
961 1087
962 1088
963 if (down_interruptible(&registration->sema) != 0) { 1089 if (down_trylock(&registration->sema) != 0) {
964 return xpcInterrupted; 1090 return xpcRetry;
965 } 1091 }
966 1092
967 if (!XPC_CHANNEL_REGISTERED(ch->number)) { 1093 if (!XPC_CHANNEL_REGISTERED(ch->number)) {
@@ -1040,55 +1166,6 @@ xpc_connect_channel(struct xpc_channel *ch)
1040 1166
1041 1167
1042/* 1168/*
1043 * Notify those who wanted to be notified upon delivery of their message.
1044 */
1045static void
1046xpc_notify_senders(struct xpc_channel *ch, enum xpc_retval reason, s64 put)
1047{
1048 struct xpc_notify *notify;
1049 u8 notify_type;
1050 s64 get = ch->w_remote_GP.get - 1;
1051
1052
1053 while (++get < put && atomic_read(&ch->n_to_notify) > 0) {
1054
1055 notify = &ch->notify_queue[get % ch->local_nentries];
1056
1057 /*
1058 * See if the notify entry indicates it was associated with
1059 * a message who's sender wants to be notified. It is possible
1060 * that it is, but someone else is doing or has done the
1061 * notification.
1062 */
1063 notify_type = notify->type;
1064 if (notify_type == 0 ||
1065 cmpxchg(&notify->type, notify_type, 0) !=
1066 notify_type) {
1067 continue;
1068 }
1069
1070 DBUG_ON(notify_type != XPC_N_CALL);
1071
1072 atomic_dec(&ch->n_to_notify);
1073
1074 if (notify->func != NULL) {
1075 dev_dbg(xpc_chan, "notify->func() called, notify=0x%p, "
1076 "msg_number=%ld, partid=%d, channel=%d\n",
1077 (void *) notify, get, ch->partid, ch->number);
1078
1079 notify->func(reason, ch->partid, ch->number,
1080 notify->key);
1081
1082 dev_dbg(xpc_chan, "notify->func() returned, "
1083 "notify=0x%p, msg_number=%ld, partid=%d, "
1084 "channel=%d\n", (void *) notify, get,
1085 ch->partid, ch->number);
1086 }
1087 }
1088}
1089
1090
1091/*
1092 * Clear some of the msg flags in the local message queue. 1169 * Clear some of the msg flags in the local message queue.
1093 */ 1170 */
1094static inline void 1171static inline void
@@ -1240,6 +1317,7 @@ xpc_process_channel_activity(struct xpc_partition *part)
1240 u64 IPI_amo, IPI_flags; 1317 u64 IPI_amo, IPI_flags;
1241 struct xpc_channel *ch; 1318 struct xpc_channel *ch;
1242 int ch_number; 1319 int ch_number;
1320 u32 ch_flags;
1243 1321
1244 1322
1245 IPI_amo = xpc_get_IPI_flags(part); 1323 IPI_amo = xpc_get_IPI_flags(part);
@@ -1266,8 +1344,9 @@ xpc_process_channel_activity(struct xpc_partition *part)
1266 xpc_process_openclose_IPI(part, ch_number, IPI_flags); 1344 xpc_process_openclose_IPI(part, ch_number, IPI_flags);
1267 } 1345 }
1268 1346
1347 ch_flags = ch->flags; /* need an atomic snapshot of flags */
1269 1348
1270 if (ch->flags & XPC_C_DISCONNECTING) { 1349 if (ch_flags & XPC_C_DISCONNECTING) {
1271 spin_lock_irqsave(&ch->lock, irq_flags); 1350 spin_lock_irqsave(&ch->lock, irq_flags);
1272 xpc_process_disconnect(ch, &irq_flags); 1351 xpc_process_disconnect(ch, &irq_flags);
1273 spin_unlock_irqrestore(&ch->lock, irq_flags); 1352 spin_unlock_irqrestore(&ch->lock, irq_flags);
@@ -1278,9 +1357,9 @@ xpc_process_channel_activity(struct xpc_partition *part)
1278 continue; 1357 continue;
1279 } 1358 }
1280 1359
1281 if (!(ch->flags & XPC_C_CONNECTED)) { 1360 if (!(ch_flags & XPC_C_CONNECTED)) {
1282 if (!(ch->flags & XPC_C_OPENREQUEST)) { 1361 if (!(ch_flags & XPC_C_OPENREQUEST)) {
1283 DBUG_ON(ch->flags & XPC_C_SETUP); 1362 DBUG_ON(ch_flags & XPC_C_SETUP);
1284 (void) xpc_connect_channel(ch); 1363 (void) xpc_connect_channel(ch);
1285 } else { 1364 } else {
1286 spin_lock_irqsave(&ch->lock, irq_flags); 1365 spin_lock_irqsave(&ch->lock, irq_flags);
@@ -1305,8 +1384,8 @@ xpc_process_channel_activity(struct xpc_partition *part)
1305 1384
1306 1385
1307/* 1386/*
1308 * XPC's heartbeat code calls this function to inform XPC that a partition has 1387 * XPC's heartbeat code calls this function to inform XPC that a partition is
1309 * gone down. XPC responds by tearing down the XPartition Communication 1388 * going down. XPC responds by tearing down the XPartition Communication
1310 * infrastructure used for the just downed partition. 1389 * infrastructure used for the just downed partition.
1311 * 1390 *
1312 * XPC's heartbeat code will never call this function and xpc_partition_up() 1391 * XPC's heartbeat code will never call this function and xpc_partition_up()
@@ -1314,7 +1393,7 @@ xpc_process_channel_activity(struct xpc_partition *part)
1314 * at the same time. 1393 * at the same time.
1315 */ 1394 */
1316void 1395void
1317xpc_partition_down(struct xpc_partition *part, enum xpc_retval reason) 1396xpc_partition_going_down(struct xpc_partition *part, enum xpc_retval reason)
1318{ 1397{
1319 unsigned long irq_flags; 1398 unsigned long irq_flags;
1320 int ch_number; 1399 int ch_number;
@@ -1330,12 +1409,11 @@ xpc_partition_down(struct xpc_partition *part, enum xpc_retval reason)
1330 } 1409 }
1331 1410
1332 1411
1333 /* disconnect all channels associated with the downed partition */ 1412 /* disconnect channels associated with the partition going down */
1334 1413
1335 for (ch_number = 0; ch_number < part->nchannels; ch_number++) { 1414 for (ch_number = 0; ch_number < part->nchannels; ch_number++) {
1336 ch = &part->channels[ch_number]; 1415 ch = &part->channels[ch_number];
1337 1416
1338
1339 xpc_msgqueue_ref(ch); 1417 xpc_msgqueue_ref(ch);
1340 spin_lock_irqsave(&ch->lock, irq_flags); 1418 spin_lock_irqsave(&ch->lock, irq_flags);
1341 1419
@@ -1370,6 +1448,7 @@ xpc_teardown_infrastructure(struct xpc_partition *part)
1370 * this partition. 1448 * this partition.
1371 */ 1449 */
1372 1450
1451 DBUG_ON(atomic_read(&part->nchannels_engaged) != 0);
1373 DBUG_ON(atomic_read(&part->nchannels_active) != 0); 1452 DBUG_ON(atomic_read(&part->nchannels_active) != 0);
1374 DBUG_ON(part->setup_state != XPC_P_SETUP); 1453 DBUG_ON(part->setup_state != XPC_P_SETUP);
1375 part->setup_state = XPC_P_WTEARDOWN; 1454 part->setup_state = XPC_P_WTEARDOWN;
@@ -1428,19 +1507,11 @@ xpc_initiate_connect(int ch_number)
1428 if (xpc_part_ref(part)) { 1507 if (xpc_part_ref(part)) {
1429 ch = &part->channels[ch_number]; 1508 ch = &part->channels[ch_number];
1430 1509
1431 if (!(ch->flags & XPC_C_DISCONNECTING)) { 1510 /*
1432 DBUG_ON(ch->flags & XPC_C_OPENREQUEST); 1511 * Initiate the establishment of a connection on the
1433 DBUG_ON(ch->flags & XPC_C_CONNECTED); 1512 * newly registered channel to the remote partition.
1434 DBUG_ON(ch->flags & XPC_C_SETUP); 1513 */
1435 1514 xpc_wakeup_channel_mgr(part);
1436 /*
1437 * Initiate the establishment of a connection
1438 * on the newly registered channel to the
1439 * remote partition.
1440 */
1441 xpc_wakeup_channel_mgr(part);
1442 }
1443
1444 xpc_part_deref(part); 1515 xpc_part_deref(part);
1445 } 1516 }
1446 } 1517 }
@@ -1450,9 +1521,6 @@ xpc_initiate_connect(int ch_number)
1450void 1521void
1451xpc_connected_callout(struct xpc_channel *ch) 1522xpc_connected_callout(struct xpc_channel *ch)
1452{ 1523{
1453 unsigned long irq_flags;
1454
1455
1456 /* let the registerer know that a connection has been established */ 1524 /* let the registerer know that a connection has been established */
1457 1525
1458 if (ch->func != NULL) { 1526 if (ch->func != NULL) {
@@ -1465,10 +1533,6 @@ xpc_connected_callout(struct xpc_channel *ch)
1465 dev_dbg(xpc_chan, "ch->func() returned, reason=xpcConnected, " 1533 dev_dbg(xpc_chan, "ch->func() returned, reason=xpcConnected, "
1466 "partid=%d, channel=%d\n", ch->partid, ch->number); 1534 "partid=%d, channel=%d\n", ch->partid, ch->number);
1467 } 1535 }
1468
1469 spin_lock_irqsave(&ch->lock, irq_flags);
1470 ch->flags |= XPC_C_CONNECTCALLOUT;
1471 spin_unlock_irqrestore(&ch->lock, irq_flags);
1472} 1536}
1473 1537
1474 1538
@@ -1506,8 +1570,12 @@ xpc_initiate_disconnect(int ch_number)
1506 1570
1507 spin_lock_irqsave(&ch->lock, irq_flags); 1571 spin_lock_irqsave(&ch->lock, irq_flags);
1508 1572
1509 XPC_DISCONNECT_CHANNEL(ch, xpcUnregistering, 1573 if (!(ch->flags & XPC_C_DISCONNECTED)) {
1574 ch->flags |= XPC_C_WDISCONNECT;
1575
1576 XPC_DISCONNECT_CHANNEL(ch, xpcUnregistering,
1510 &irq_flags); 1577 &irq_flags);
1578 }
1511 1579
1512 spin_unlock_irqrestore(&ch->lock, irq_flags); 1580 spin_unlock_irqrestore(&ch->lock, irq_flags);
1513 1581
@@ -1523,8 +1591,9 @@ xpc_initiate_disconnect(int ch_number)
1523/* 1591/*
1524 * To disconnect a channel, and reflect it back to all who may be waiting. 1592 * To disconnect a channel, and reflect it back to all who may be waiting.
1525 * 1593 *
1526 * >>> An OPEN is not allowed until XPC_C_DISCONNECTING is cleared by 1594 * An OPEN is not allowed until XPC_C_DISCONNECTING is cleared by
1527 * >>> xpc_free_msgqueues(). 1595 * xpc_process_disconnect(), and if set, XPC_C_WDISCONNECT is cleared by
1596 * xpc_disconnect_wait().
1528 * 1597 *
1529 * THE CHANNEL IS TO BE LOCKED BY THE CALLER AND WILL REMAIN LOCKED UPON RETURN. 1598 * THE CHANNEL IS TO BE LOCKED BY THE CALLER AND WILL REMAIN LOCKED UPON RETURN.
1530 */ 1599 */
@@ -1532,7 +1601,7 @@ void
1532xpc_disconnect_channel(const int line, struct xpc_channel *ch, 1601xpc_disconnect_channel(const int line, struct xpc_channel *ch,
1533 enum xpc_retval reason, unsigned long *irq_flags) 1602 enum xpc_retval reason, unsigned long *irq_flags)
1534{ 1603{
1535 u32 flags; 1604 u32 channel_was_connected = (ch->flags & XPC_C_CONNECTED);
1536 1605
1537 1606
1538 DBUG_ON(!spin_is_locked(&ch->lock)); 1607 DBUG_ON(!spin_is_locked(&ch->lock));
@@ -1547,61 +1616,53 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch,
1547 1616
1548 XPC_SET_REASON(ch, reason, line); 1617 XPC_SET_REASON(ch, reason, line);
1549 1618
1550 flags = ch->flags; 1619 ch->flags |= (XPC_C_CLOSEREQUEST | XPC_C_DISCONNECTING);
1551 /* some of these may not have been set */ 1620 /* some of these may not have been set */
1552 ch->flags &= ~(XPC_C_OPENREQUEST | XPC_C_OPENREPLY | 1621 ch->flags &= ~(XPC_C_OPENREQUEST | XPC_C_OPENREPLY |
1553 XPC_C_ROPENREQUEST | XPC_C_ROPENREPLY | 1622 XPC_C_ROPENREQUEST | XPC_C_ROPENREPLY |
1554 XPC_C_CONNECTING | XPC_C_CONNECTED); 1623 XPC_C_CONNECTING | XPC_C_CONNECTED);
1555 1624
1556 ch->flags |= (XPC_C_CLOSEREQUEST | XPC_C_DISCONNECTING);
1557 xpc_IPI_send_closerequest(ch, irq_flags); 1625 xpc_IPI_send_closerequest(ch, irq_flags);
1558 1626
1559 if (flags & XPC_C_CONNECTED) { 1627 if (channel_was_connected) {
1560 ch->flags |= XPC_C_WASCONNECTED; 1628 ch->flags |= XPC_C_WASCONNECTED;
1561 } 1629 }
1562 1630
1631 spin_unlock_irqrestore(&ch->lock, *irq_flags);
1632
1633 /* wake all idle kthreads so they can exit */
1563 if (atomic_read(&ch->kthreads_idle) > 0) { 1634 if (atomic_read(&ch->kthreads_idle) > 0) {
1564 /* wake all idle kthreads so they can exit */
1565 wake_up_all(&ch->idle_wq); 1635 wake_up_all(&ch->idle_wq);
1566 } 1636 }
1567 1637
1568 spin_unlock_irqrestore(&ch->lock, *irq_flags);
1569
1570
1571 /* wake those waiting to allocate an entry from the local msg queue */ 1638 /* wake those waiting to allocate an entry from the local msg queue */
1572
1573 if (atomic_read(&ch->n_on_msg_allocate_wq) > 0) { 1639 if (atomic_read(&ch->n_on_msg_allocate_wq) > 0) {
1574 wake_up(&ch->msg_allocate_wq); 1640 wake_up(&ch->msg_allocate_wq);
1575 } 1641 }
1576 1642
1577 /* wake those waiting for notify completion */
1578
1579 if (atomic_read(&ch->n_to_notify) > 0) {
1580 xpc_notify_senders(ch, reason, ch->w_local_GP.put);
1581 }
1582
1583 spin_lock_irqsave(&ch->lock, *irq_flags); 1643 spin_lock_irqsave(&ch->lock, *irq_flags);
1584} 1644}
1585 1645
1586 1646
1587void 1647void
1588xpc_disconnected_callout(struct xpc_channel *ch) 1648xpc_disconnecting_callout(struct xpc_channel *ch)
1589{ 1649{
1590 /* 1650 /*
1591 * Let the channel's registerer know that the channel is now 1651 * Let the channel's registerer know that the channel is being
1592 * disconnected. We don't want to do this if the registerer was never 1652 * disconnected. We don't want to do this if the registerer was never
1593 * informed of a connection being made, unless the disconnect was for 1653 * informed of a connection being made.
1594 * abnormal reasons.
1595 */ 1654 */
1596 1655
1597 if (ch->func != NULL) { 1656 if (ch->func != NULL) {
1598 dev_dbg(xpc_chan, "ch->func() called, reason=%d, partid=%d, " 1657 dev_dbg(xpc_chan, "ch->func() called, reason=xpcDisconnecting,"
1599 "channel=%d\n", ch->reason, ch->partid, ch->number); 1658 " partid=%d, channel=%d\n", ch->partid, ch->number);
1600 1659
1601 ch->func(ch->reason, ch->partid, ch->number, NULL, ch->key); 1660 ch->func(xpcDisconnecting, ch->partid, ch->number, NULL,
1661 ch->key);
1602 1662
1603 dev_dbg(xpc_chan, "ch->func() returned, reason=%d, partid=%d, " 1663 dev_dbg(xpc_chan, "ch->func() returned, reason="
1604 "channel=%d\n", ch->reason, ch->partid, ch->number); 1664 "xpcDisconnecting, partid=%d, channel=%d\n",
1665 ch->partid, ch->number);
1605 } 1666 }
1606} 1667}
1607 1668
@@ -1848,7 +1909,7 @@ xpc_send_msg(struct xpc_channel *ch, struct xpc_msg *msg, u8 notify_type,
1848 xpc_notify_func func, void *key) 1909 xpc_notify_func func, void *key)
1849{ 1910{
1850 enum xpc_retval ret = xpcSuccess; 1911 enum xpc_retval ret = xpcSuccess;
1851 struct xpc_notify *notify = NULL; // >>> to keep the compiler happy!! 1912 struct xpc_notify *notify = notify;
1852 s64 put, msg_number = msg->number; 1913 s64 put, msg_number = msg->number;
1853 1914
1854 1915
diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
index ed7c21586e98..cece3c7c69be 100644
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -54,6 +54,7 @@
54#include <linux/interrupt.h> 54#include <linux/interrupt.h>
55#include <linux/slab.h> 55#include <linux/slab.h>
56#include <linux/delay.h> 56#include <linux/delay.h>
57#include <linux/reboot.h>
57#include <asm/sn/intr.h> 58#include <asm/sn/intr.h>
58#include <asm/sn/sn_sal.h> 59#include <asm/sn/sn_sal.h>
59#include <asm/uaccess.h> 60#include <asm/uaccess.h>
@@ -82,11 +83,17 @@ struct device *xpc_chan = &xpc_chan_dbg_subname;
82 83
83/* systune related variables for /proc/sys directories */ 84/* systune related variables for /proc/sys directories */
84 85
85static int xpc_hb_min = 1; 86static int xpc_hb_interval = XPC_HB_DEFAULT_INTERVAL;
86static int xpc_hb_max = 10; 87static int xpc_hb_min_interval = 1;
88static int xpc_hb_max_interval = 10;
87 89
88static int xpc_hb_check_min = 10; 90static int xpc_hb_check_interval = XPC_HB_CHECK_DEFAULT_INTERVAL;
89static int xpc_hb_check_max = 120; 91static int xpc_hb_check_min_interval = 10;
92static int xpc_hb_check_max_interval = 120;
93
94int xpc_disengage_request_timelimit = XPC_DISENGAGE_REQUEST_DEFAULT_TIMELIMIT;
95static int xpc_disengage_request_min_timelimit = 0;
96static int xpc_disengage_request_max_timelimit = 120;
90 97
91static ctl_table xpc_sys_xpc_hb_dir[] = { 98static ctl_table xpc_sys_xpc_hb_dir[] = {
92 { 99 {
@@ -99,7 +106,8 @@ static ctl_table xpc_sys_xpc_hb_dir[] = {
99 &proc_dointvec_minmax, 106 &proc_dointvec_minmax,
100 &sysctl_intvec, 107 &sysctl_intvec,
101 NULL, 108 NULL,
102 &xpc_hb_min, &xpc_hb_max 109 &xpc_hb_min_interval,
110 &xpc_hb_max_interval
103 }, 111 },
104 { 112 {
105 2, 113 2,
@@ -111,7 +119,8 @@ static ctl_table xpc_sys_xpc_hb_dir[] = {
111 &proc_dointvec_minmax, 119 &proc_dointvec_minmax,
112 &sysctl_intvec, 120 &sysctl_intvec,
113 NULL, 121 NULL,
114 &xpc_hb_check_min, &xpc_hb_check_max 122 &xpc_hb_check_min_interval,
123 &xpc_hb_check_max_interval
115 }, 124 },
116 {0} 125 {0}
117}; 126};
@@ -124,6 +133,19 @@ static ctl_table xpc_sys_xpc_dir[] = {
124 0555, 133 0555,
125 xpc_sys_xpc_hb_dir 134 xpc_sys_xpc_hb_dir
126 }, 135 },
136 {
137 2,
138 "disengage_request_timelimit",
139 &xpc_disengage_request_timelimit,
140 sizeof(int),
141 0644,
142 NULL,
143 &proc_dointvec_minmax,
144 &sysctl_intvec,
145 NULL,
146 &xpc_disengage_request_min_timelimit,
147 &xpc_disengage_request_max_timelimit
148 },
127 {0} 149 {0}
128}; 150};
129static ctl_table xpc_sys_dir[] = { 151static ctl_table xpc_sys_dir[] = {
@@ -148,10 +170,10 @@ static DECLARE_WAIT_QUEUE_HEAD(xpc_act_IRQ_wq);
148 170
149static unsigned long xpc_hb_check_timeout; 171static unsigned long xpc_hb_check_timeout;
150 172
151/* xpc_hb_checker thread exited notification */ 173/* notification that the xpc_hb_checker thread has exited */
152static DECLARE_MUTEX_LOCKED(xpc_hb_checker_exited); 174static DECLARE_MUTEX_LOCKED(xpc_hb_checker_exited);
153 175
154/* xpc_discovery thread exited notification */ 176/* notification that the xpc_discovery thread has exited */
155static DECLARE_MUTEX_LOCKED(xpc_discovery_exited); 177static DECLARE_MUTEX_LOCKED(xpc_discovery_exited);
156 178
157 179
@@ -161,6 +183,30 @@ static struct timer_list xpc_hb_timer;
161static void xpc_kthread_waitmsgs(struct xpc_partition *, struct xpc_channel *); 183static void xpc_kthread_waitmsgs(struct xpc_partition *, struct xpc_channel *);
162 184
163 185
186static int xpc_system_reboot(struct notifier_block *, unsigned long, void *);
187static struct notifier_block xpc_reboot_notifier = {
188 .notifier_call = xpc_system_reboot,
189};
190
191
192/*
193 * Timer function to enforce the timelimit on the partition disengage request.
194 */
195static void
196xpc_timeout_partition_disengage_request(unsigned long data)
197{
198 struct xpc_partition *part = (struct xpc_partition *) data;
199
200
201 DBUG_ON(jiffies < part->disengage_request_timeout);
202
203 (void) xpc_partition_disengaged(part);
204
205 DBUG_ON(part->disengage_request_timeout != 0);
206 DBUG_ON(xpc_partition_engaged(1UL << XPC_PARTID(part)) != 0);
207}
208
209
164/* 210/*
165 * Notify the heartbeat check thread that an IRQ has been received. 211 * Notify the heartbeat check thread that an IRQ has been received.
166 */ 212 */
@@ -214,12 +260,6 @@ xpc_hb_checker(void *ignore)
214 260
215 while (!(volatile int) xpc_exiting) { 261 while (!(volatile int) xpc_exiting) {
216 262
217 /* wait for IRQ or timeout */
218 (void) wait_event_interruptible(xpc_act_IRQ_wq,
219 (last_IRQ_count < atomic_read(&xpc_act_IRQ_rcvd) ||
220 jiffies >= xpc_hb_check_timeout ||
221 (volatile int) xpc_exiting));
222
223 dev_dbg(xpc_part, "woke up with %d ticks rem; %d IRQs have " 263 dev_dbg(xpc_part, "woke up with %d ticks rem; %d IRQs have "
224 "been received\n", 264 "been received\n",
225 (int) (xpc_hb_check_timeout - jiffies), 265 (int) (xpc_hb_check_timeout - jiffies),
@@ -240,6 +280,7 @@ xpc_hb_checker(void *ignore)
240 } 280 }
241 281
242 282
283 /* check for outstanding IRQs */
243 new_IRQ_count = atomic_read(&xpc_act_IRQ_rcvd); 284 new_IRQ_count = atomic_read(&xpc_act_IRQ_rcvd);
244 if (last_IRQ_count < new_IRQ_count || force_IRQ != 0) { 285 if (last_IRQ_count < new_IRQ_count || force_IRQ != 0) {
245 force_IRQ = 0; 286 force_IRQ = 0;
@@ -257,12 +298,18 @@ xpc_hb_checker(void *ignore)
257 xpc_hb_check_timeout = jiffies + 298 xpc_hb_check_timeout = jiffies +
258 (xpc_hb_check_interval * HZ); 299 (xpc_hb_check_interval * HZ);
259 } 300 }
301
302 /* wait for IRQ or timeout */
303 (void) wait_event_interruptible(xpc_act_IRQ_wq,
304 (last_IRQ_count < atomic_read(&xpc_act_IRQ_rcvd) ||
305 jiffies >= xpc_hb_check_timeout ||
306 (volatile int) xpc_exiting));
260 } 307 }
261 308
262 dev_dbg(xpc_part, "heartbeat checker is exiting\n"); 309 dev_dbg(xpc_part, "heartbeat checker is exiting\n");
263 310
264 311
265 /* mark this thread as inactive */ 312 /* mark this thread as having exited */
266 up(&xpc_hb_checker_exited); 313 up(&xpc_hb_checker_exited);
267 return 0; 314 return 0;
268} 315}
@@ -282,7 +329,7 @@ xpc_initiate_discovery(void *ignore)
282 329
283 dev_dbg(xpc_part, "discovery thread is exiting\n"); 330 dev_dbg(xpc_part, "discovery thread is exiting\n");
284 331
285 /* mark this thread as inactive */ 332 /* mark this thread as having exited */
286 up(&xpc_discovery_exited); 333 up(&xpc_discovery_exited);
287 return 0; 334 return 0;
288} 335}
@@ -309,7 +356,7 @@ xpc_make_first_contact(struct xpc_partition *part)
309 "partition %d\n", XPC_PARTID(part)); 356 "partition %d\n", XPC_PARTID(part));
310 357
311 /* wait a 1/4 of a second or so */ 358 /* wait a 1/4 of a second or so */
312 msleep_interruptible(250); 359 (void) msleep_interruptible(250);
313 360
314 if (part->act_state == XPC_P_DEACTIVATING) { 361 if (part->act_state == XPC_P_DEACTIVATING) {
315 return part->reason; 362 return part->reason;
@@ -336,7 +383,8 @@ static void
336xpc_channel_mgr(struct xpc_partition *part) 383xpc_channel_mgr(struct xpc_partition *part)
337{ 384{
338 while (part->act_state != XPC_P_DEACTIVATING || 385 while (part->act_state != XPC_P_DEACTIVATING ||
339 atomic_read(&part->nchannels_active) > 0) { 386 atomic_read(&part->nchannels_active) > 0 ||
387 !xpc_partition_disengaged(part)) {
340 388
341 xpc_process_channel_activity(part); 389 xpc_process_channel_activity(part);
342 390
@@ -360,7 +408,8 @@ xpc_channel_mgr(struct xpc_partition *part)
360 (volatile u64) part->local_IPI_amo != 0 || 408 (volatile u64) part->local_IPI_amo != 0 ||
361 ((volatile u8) part->act_state == 409 ((volatile u8) part->act_state ==
362 XPC_P_DEACTIVATING && 410 XPC_P_DEACTIVATING &&
363 atomic_read(&part->nchannels_active) == 0))); 411 atomic_read(&part->nchannels_active) == 0 &&
412 xpc_partition_disengaged(part))));
364 atomic_set(&part->channel_mgr_requests, 1); 413 atomic_set(&part->channel_mgr_requests, 1);
365 414
366 // >>> Does it need to wakeup periodically as well? In case we 415 // >>> Does it need to wakeup periodically as well? In case we
@@ -482,7 +531,7 @@ xpc_activating(void *__partid)
482 return 0; 531 return 0;
483 } 532 }
484 533
485 XPC_ALLOW_HB(partid, xpc_vars); 534 xpc_allow_hb(partid, xpc_vars);
486 xpc_IPI_send_activated(part); 535 xpc_IPI_send_activated(part);
487 536
488 537
@@ -492,6 +541,7 @@ xpc_activating(void *__partid)
492 */ 541 */
493 (void) xpc_partition_up(part); 542 (void) xpc_partition_up(part);
494 543
544 xpc_disallow_hb(partid, xpc_vars);
495 xpc_mark_partition_inactive(part); 545 xpc_mark_partition_inactive(part);
496 546
497 if (part->reason == xpcReactivating) { 547 if (part->reason == xpcReactivating) {
@@ -670,6 +720,7 @@ xpc_daemonize_kthread(void *args)
670 struct xpc_partition *part = &xpc_partitions[partid]; 720 struct xpc_partition *part = &xpc_partitions[partid];
671 struct xpc_channel *ch; 721 struct xpc_channel *ch;
672 int n_needed; 722 int n_needed;
723 unsigned long irq_flags;
673 724
674 725
675 daemonize("xpc%02dc%d", partid, ch_number); 726 daemonize("xpc%02dc%d", partid, ch_number);
@@ -680,11 +731,14 @@ xpc_daemonize_kthread(void *args)
680 ch = &part->channels[ch_number]; 731 ch = &part->channels[ch_number];
681 732
682 if (!(ch->flags & XPC_C_DISCONNECTING)) { 733 if (!(ch->flags & XPC_C_DISCONNECTING)) {
683 DBUG_ON(!(ch->flags & XPC_C_CONNECTED));
684 734
685 /* let registerer know that connection has been established */ 735 /* let registerer know that connection has been established */
686 736
687 if (atomic_read(&ch->kthreads_assigned) == 1) { 737 spin_lock_irqsave(&ch->lock, irq_flags);
738 if (!(ch->flags & XPC_C_CONNECTCALLOUT)) {
739 ch->flags |= XPC_C_CONNECTCALLOUT;
740 spin_unlock_irqrestore(&ch->lock, irq_flags);
741
688 xpc_connected_callout(ch); 742 xpc_connected_callout(ch);
689 743
690 /* 744 /*
@@ -699,16 +753,28 @@ xpc_daemonize_kthread(void *args)
699 !(ch->flags & XPC_C_DISCONNECTING)) { 753 !(ch->flags & XPC_C_DISCONNECTING)) {
700 xpc_activate_kthreads(ch, n_needed); 754 xpc_activate_kthreads(ch, n_needed);
701 } 755 }
756 } else {
757 spin_unlock_irqrestore(&ch->lock, irq_flags);
702 } 758 }
703 759
704 xpc_kthread_waitmsgs(part, ch); 760 xpc_kthread_waitmsgs(part, ch);
705 } 761 }
706 762
707 if (atomic_dec_return(&ch->kthreads_assigned) == 0 && 763 if (atomic_dec_return(&ch->kthreads_assigned) == 0) {
708 ((ch->flags & XPC_C_CONNECTCALLOUT) || 764 spin_lock_irqsave(&ch->lock, irq_flags);
709 (ch->reason != xpcUnregistering && 765 if ((ch->flags & XPC_C_CONNECTCALLOUT) &&
710 ch->reason != xpcOtherUnregistering))) { 766 !(ch->flags & XPC_C_DISCONNECTCALLOUT)) {
711 xpc_disconnected_callout(ch); 767 ch->flags |= XPC_C_DISCONNECTCALLOUT;
768 spin_unlock_irqrestore(&ch->lock, irq_flags);
769
770 xpc_disconnecting_callout(ch);
771 } else {
772 spin_unlock_irqrestore(&ch->lock, irq_flags);
773 }
774 if (atomic_dec_return(&part->nchannels_engaged) == 0) {
775 xpc_mark_partition_disengaged(part);
776 xpc_IPI_send_disengage(part);
777 }
712 } 778 }
713 779
714 780
@@ -740,12 +806,33 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed)
740 unsigned long irq_flags; 806 unsigned long irq_flags;
741 pid_t pid; 807 pid_t pid;
742 u64 args = XPC_PACK_ARGS(ch->partid, ch->number); 808 u64 args = XPC_PACK_ARGS(ch->partid, ch->number);
809 struct xpc_partition *part = &xpc_partitions[ch->partid];
743 810
744 811
745 while (needed-- > 0) { 812 while (needed-- > 0) {
813
814 /*
815 * The following is done on behalf of the newly created
816 * kthread. That kthread is responsible for doing the
817 * counterpart to the following before it exits.
818 */
819 (void) xpc_part_ref(part);
820 xpc_msgqueue_ref(ch);
821 if (atomic_inc_return(&ch->kthreads_assigned) == 1 &&
822 atomic_inc_return(&part->nchannels_engaged) == 1) {
823 xpc_mark_partition_engaged(part);
824 }
825
746 pid = kernel_thread(xpc_daemonize_kthread, (void *) args, 0); 826 pid = kernel_thread(xpc_daemonize_kthread, (void *) args, 0);
747 if (pid < 0) { 827 if (pid < 0) {
748 /* the fork failed */ 828 /* the fork failed */
829 if (atomic_dec_return(&ch->kthreads_assigned) == 0 &&
830 atomic_dec_return(&part->nchannels_engaged) == 0) {
831 xpc_mark_partition_disengaged(part);
832 xpc_IPI_send_disengage(part);
833 }
834 xpc_msgqueue_deref(ch);
835 xpc_part_deref(part);
749 836
750 if (atomic_read(&ch->kthreads_assigned) < 837 if (atomic_read(&ch->kthreads_assigned) <
751 ch->kthreads_idle_limit) { 838 ch->kthreads_idle_limit) {
@@ -765,14 +852,6 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed)
765 break; 852 break;
766 } 853 }
767 854
768 /*
769 * The following is done on behalf of the newly created
770 * kthread. That kthread is responsible for doing the
771 * counterpart to the following before it exits.
772 */
773 (void) xpc_part_ref(&xpc_partitions[ch->partid]);
774 xpc_msgqueue_ref(ch);
775 atomic_inc(&ch->kthreads_assigned);
776 ch->kthreads_created++; // >>> temporary debug only!!! 855 ch->kthreads_created++; // >>> temporary debug only!!!
777 } 856 }
778} 857}
@@ -781,87 +860,142 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed)
781void 860void
782xpc_disconnect_wait(int ch_number) 861xpc_disconnect_wait(int ch_number)
783{ 862{
863 unsigned long irq_flags;
784 partid_t partid; 864 partid_t partid;
785 struct xpc_partition *part; 865 struct xpc_partition *part;
786 struct xpc_channel *ch; 866 struct xpc_channel *ch;
867 int wakeup_channel_mgr;
787 868
788 869
789 /* now wait for all callouts to the caller's function to cease */ 870 /* now wait for all callouts to the caller's function to cease */
790 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) { 871 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
791 part = &xpc_partitions[partid]; 872 part = &xpc_partitions[partid];
792 873
793 if (xpc_part_ref(part)) { 874 if (!xpc_part_ref(part)) {
794 ch = &part->channels[ch_number]; 875 continue;
876 }
795 877
796// >>> how do we keep from falling into the window between our check and going 878 ch = &part->channels[ch_number];
797// >>> down and coming back up where sema is re-inited?
798 if (ch->flags & XPC_C_SETUP) {
799 (void) down(&ch->teardown_sema);
800 }
801 879
880 if (!(ch->flags & XPC_C_WDISCONNECT)) {
802 xpc_part_deref(part); 881 xpc_part_deref(part);
882 continue;
883 }
884
885 (void) down(&ch->wdisconnect_sema);
886
887 spin_lock_irqsave(&ch->lock, irq_flags);
888 DBUG_ON(!(ch->flags & XPC_C_DISCONNECTED));
889 wakeup_channel_mgr = 0;
890
891 if (ch->delayed_IPI_flags) {
892 if (part->act_state != XPC_P_DEACTIVATING) {
893 spin_lock(&part->IPI_lock);
894 XPC_SET_IPI_FLAGS(part->local_IPI_amo,
895 ch->number, ch->delayed_IPI_flags);
896 spin_unlock(&part->IPI_lock);
897 wakeup_channel_mgr = 1;
898 }
899 ch->delayed_IPI_flags = 0;
803 } 900 }
901
902 ch->flags &= ~XPC_C_WDISCONNECT;
903 spin_unlock_irqrestore(&ch->lock, irq_flags);
904
905 if (wakeup_channel_mgr) {
906 xpc_wakeup_channel_mgr(part);
907 }
908
909 xpc_part_deref(part);
804 } 910 }
805} 911}
806 912
807 913
808static void 914static void
809xpc_do_exit(void) 915xpc_do_exit(enum xpc_retval reason)
810{ 916{
811 partid_t partid; 917 partid_t partid;
812 int active_part_count; 918 int active_part_count;
813 struct xpc_partition *part; 919 struct xpc_partition *part;
920 unsigned long printmsg_time;
814 921
815 922
816 /* now it's time to eliminate our heartbeat */ 923 /* a 'rmmod XPC' and a 'reboot' cannot both end up here together */
817 del_timer_sync(&xpc_hb_timer); 924 DBUG_ON(xpc_exiting == 1);
818 xpc_vars->heartbeating_to_mask = 0;
819
820 /* indicate to others that our reserved page is uninitialized */
821 xpc_rsvd_page->vars_pa = 0;
822
823 /*
824 * Ignore all incoming interrupts. Without interupts the heartbeat
825 * checker won't activate any new partitions that may come up.
826 */
827 free_irq(SGI_XPC_ACTIVATE, NULL);
828 925
829 /* 926 /*
830 * Cause the heartbeat checker and the discovery threads to exit. 927 * Let the heartbeat checker thread and the discovery thread
831 * We don't want them attempting to activate new partitions as we 928 * (if one is running) know that they should exit. Also wake up
832 * try to deactivate the existing ones. 929 * the heartbeat checker thread in case it's sleeping.
833 */ 930 */
834 xpc_exiting = 1; 931 xpc_exiting = 1;
835 wake_up_interruptible(&xpc_act_IRQ_wq); 932 wake_up_interruptible(&xpc_act_IRQ_wq);
836 933
837 /* wait for the heartbeat checker thread to mark itself inactive */ 934 /* ignore all incoming interrupts */
838 down(&xpc_hb_checker_exited); 935 free_irq(SGI_XPC_ACTIVATE, NULL);
839 936
840 /* wait for the discovery thread to mark itself inactive */ 937 /* wait for the discovery thread to exit */
841 down(&xpc_discovery_exited); 938 down(&xpc_discovery_exited);
842 939
940 /* wait for the heartbeat checker thread to exit */
941 down(&xpc_hb_checker_exited);
843 942
844 msleep_interruptible(300); 943
944 /* sleep for a 1/3 of a second or so */
945 (void) msleep_interruptible(300);
845 946
846 947
847 /* wait for all partitions to become inactive */ 948 /* wait for all partitions to become inactive */
848 949
950 printmsg_time = jiffies;
951
849 do { 952 do {
850 active_part_count = 0; 953 active_part_count = 0;
851 954
852 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) { 955 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
853 part = &xpc_partitions[partid]; 956 part = &xpc_partitions[partid];
854 if (part->act_state != XPC_P_INACTIVE) {
855 active_part_count++;
856 957
857 XPC_DEACTIVATE_PARTITION(part, xpcUnloading); 958 if (xpc_partition_disengaged(part) &&
959 part->act_state == XPC_P_INACTIVE) {
960 continue;
858 } 961 }
962
963 active_part_count++;
964
965 XPC_DEACTIVATE_PARTITION(part, reason);
859 } 966 }
860 967
861 if (active_part_count) 968 if (active_part_count == 0) {
862 msleep_interruptible(300); 969 break;
863 } while (active_part_count > 0); 970 }
864 971
972 if (jiffies >= printmsg_time) {
973 dev_info(xpc_part, "waiting for partitions to "
974 "deactivate/disengage, active count=%d, remote "
975 "engaged=0x%lx\n", active_part_count,
976 xpc_partition_engaged(1UL << partid));
977
978 printmsg_time = jiffies +
979 (XPC_DISENGAGE_PRINTMSG_INTERVAL * HZ);
980 }
981
982 /* sleep for a 1/3 of a second or so */
983 (void) msleep_interruptible(300);
984
985 } while (1);
986
987 DBUG_ON(xpc_partition_engaged(-1UL));
988
989
990 /* indicate to others that our reserved page is uninitialized */
991 xpc_rsvd_page->vars_pa = 0;
992
993 /* now it's time to eliminate our heartbeat */
994 del_timer_sync(&xpc_hb_timer);
995 DBUG_ON(xpc_vars->heartbeating_to_mask != 0);
996
997 /* take ourselves off of the reboot_notifier_list */
998 (void) unregister_reboot_notifier(&xpc_reboot_notifier);
865 999
866 /* close down protections for IPI operations */ 1000 /* close down protections for IPI operations */
867 xpc_restrict_IPI_ops(); 1001 xpc_restrict_IPI_ops();
@@ -876,6 +1010,34 @@ xpc_do_exit(void)
876} 1010}
877 1011
878 1012
1013/*
1014 * This function is called when the system is being rebooted.
1015 */
1016static int
1017xpc_system_reboot(struct notifier_block *nb, unsigned long event, void *unused)
1018{
1019 enum xpc_retval reason;
1020
1021
1022 switch (event) {
1023 case SYS_RESTART:
1024 reason = xpcSystemReboot;
1025 break;
1026 case SYS_HALT:
1027 reason = xpcSystemHalt;
1028 break;
1029 case SYS_POWER_OFF:
1030 reason = xpcSystemPoweroff;
1031 break;
1032 default:
1033 reason = xpcSystemGoingDown;
1034 }
1035
1036 xpc_do_exit(reason);
1037 return NOTIFY_DONE;
1038}
1039
1040
879int __init 1041int __init
880xpc_init(void) 1042xpc_init(void)
881{ 1043{
@@ -891,11 +1053,11 @@ xpc_init(void)
891 1053
892 /* 1054 /*
893 * xpc_remote_copy_buffer is used as a temporary buffer for bte_copy'ng 1055 * xpc_remote_copy_buffer is used as a temporary buffer for bte_copy'ng
894 * both a partition's reserved page and its XPC variables. Its size was 1056 * various portions of a partition's reserved page. Its size is based
895 * based on the size of a reserved page. So we need to ensure that the 1057 * on the size of the reserved page header and part_nasids mask. So we
896 * XPC variables will fit as well. 1058 * need to ensure that the other items will fit as well.
897 */ 1059 */
898 if (XPC_VARS_ALIGNED_SIZE > XPC_RSVD_PAGE_ALIGNED_SIZE) { 1060 if (XPC_RP_VARS_SIZE > XPC_RP_HEADER_SIZE + XP_NASID_MASK_BYTES) {
899 dev_err(xpc_part, "xpc_remote_copy_buffer is not big enough\n"); 1061 dev_err(xpc_part, "xpc_remote_copy_buffer is not big enough\n");
900 return -EPERM; 1062 return -EPERM;
901 } 1063 }
@@ -924,6 +1086,12 @@ xpc_init(void)
924 spin_lock_init(&part->act_lock); 1086 spin_lock_init(&part->act_lock);
925 part->act_state = XPC_P_INACTIVE; 1087 part->act_state = XPC_P_INACTIVE;
926 XPC_SET_REASON(part, 0, 0); 1088 XPC_SET_REASON(part, 0, 0);
1089
1090 init_timer(&part->disengage_request_timer);
1091 part->disengage_request_timer.function =
1092 xpc_timeout_partition_disengage_request;
1093 part->disengage_request_timer.data = (unsigned long) part;
1094
927 part->setup_state = XPC_P_UNSET; 1095 part->setup_state = XPC_P_UNSET;
928 init_waitqueue_head(&part->teardown_wq); 1096 init_waitqueue_head(&part->teardown_wq);
929 atomic_set(&part->references, 0); 1097 atomic_set(&part->references, 0);
@@ -980,6 +1148,13 @@ xpc_init(void)
980 } 1148 }
981 1149
982 1150
1151 /* add ourselves to the reboot_notifier_list */
1152 ret = register_reboot_notifier(&xpc_reboot_notifier);
1153 if (ret != 0) {
1154 dev_warn(xpc_part, "can't register reboot notifier\n");
1155 }
1156
1157
983 /* 1158 /*
984 * Set the beating to other partitions into motion. This is 1159 * Set the beating to other partitions into motion. This is
985 * the last requirement for other partitions' discovery to 1160 * the last requirement for other partitions' discovery to
@@ -1001,6 +1176,9 @@ xpc_init(void)
1001 /* indicate to others that our reserved page is uninitialized */ 1176 /* indicate to others that our reserved page is uninitialized */
1002 xpc_rsvd_page->vars_pa = 0; 1177 xpc_rsvd_page->vars_pa = 0;
1003 1178
1179 /* take ourselves off of the reboot_notifier_list */
1180 (void) unregister_reboot_notifier(&xpc_reboot_notifier);
1181
1004 del_timer_sync(&xpc_hb_timer); 1182 del_timer_sync(&xpc_hb_timer);
1005 free_irq(SGI_XPC_ACTIVATE, NULL); 1183 free_irq(SGI_XPC_ACTIVATE, NULL);
1006 xpc_restrict_IPI_ops(); 1184 xpc_restrict_IPI_ops();
@@ -1024,7 +1202,7 @@ xpc_init(void)
1024 /* mark this new thread as a non-starter */ 1202 /* mark this new thread as a non-starter */
1025 up(&xpc_discovery_exited); 1203 up(&xpc_discovery_exited);
1026 1204
1027 xpc_do_exit(); 1205 xpc_do_exit(xpcUnloading);
1028 return -EBUSY; 1206 return -EBUSY;
1029 } 1207 }
1030 1208
@@ -1043,7 +1221,7 @@ module_init(xpc_init);
1043void __exit 1221void __exit
1044xpc_exit(void) 1222xpc_exit(void)
1045{ 1223{
1046 xpc_do_exit(); 1224 xpc_do_exit(xpcUnloading);
1047} 1225}
1048module_exit(xpc_exit); 1226module_exit(xpc_exit);
1049 1227
@@ -1060,3 +1238,7 @@ module_param(xpc_hb_check_interval, int, 0);
1060MODULE_PARM_DESC(xpc_hb_check_interval, "Number of seconds between " 1238MODULE_PARM_DESC(xpc_hb_check_interval, "Number of seconds between "
1061 "heartbeat checks."); 1239 "heartbeat checks.");
1062 1240
1241module_param(xpc_disengage_request_timelimit, int, 0);
1242MODULE_PARM_DESC(xpc_disengage_request_timelimit, "Number of seconds to wait "
1243 "for disengage request to complete.");
1244
diff --git a/arch/ia64/sn/kernel/xpc_partition.c b/arch/ia64/sn/kernel/xpc_partition.c
index 578265ea9e67..581e113d2d37 100644
--- a/arch/ia64/sn/kernel/xpc_partition.c
+++ b/arch/ia64/sn/kernel/xpc_partition.c
@@ -44,16 +44,19 @@ static u64 xpc_sh2_IPI_access3;
44 44
45 45
46/* original protection values for each node */ 46/* original protection values for each node */
47u64 xpc_prot_vec[MAX_COMPACT_NODES]; 47u64 xpc_prot_vec[MAX_NUMNODES];
48 48
49 49
50/* this partition's reserved page */ 50/* this partition's reserved page pointers */
51struct xpc_rsvd_page *xpc_rsvd_page; 51struct xpc_rsvd_page *xpc_rsvd_page;
52 52static u64 *xpc_part_nasids;
53/* this partition's XPC variables (within the reserved page) */ 53static u64 *xpc_mach_nasids;
54struct xpc_vars *xpc_vars; 54struct xpc_vars *xpc_vars;
55struct xpc_vars_part *xpc_vars_part; 55struct xpc_vars_part *xpc_vars_part;
56 56
57static int xp_nasid_mask_bytes; /* actual size in bytes of nasid mask */
58static int xp_nasid_mask_words; /* actual size in words of nasid mask */
59
57 60
58/* 61/*
59 * For performance reasons, each entry of xpc_partitions[] is cacheline 62 * For performance reasons, each entry of xpc_partitions[] is cacheline
@@ -65,20 +68,16 @@ struct xpc_partition xpc_partitions[XP_MAX_PARTITIONS + 1];
65 68
66 69
67/* 70/*
68 * Generic buffer used to store a local copy of the remote partitions 71 * Generic buffer used to store a local copy of portions of a remote
69 * reserved page or XPC variables. 72 * partition's reserved page (either its header and part_nasids mask,
73 * or its vars).
70 * 74 *
71 * xpc_discovery runs only once and is a seperate thread that is 75 * xpc_discovery runs only once and is a seperate thread that is
72 * very likely going to be processing in parallel with receiving 76 * very likely going to be processing in parallel with receiving
73 * interrupts. 77 * interrupts.
74 */ 78 */
75char ____cacheline_aligned 79char ____cacheline_aligned xpc_remote_copy_buffer[XPC_RP_HEADER_SIZE +
76 xpc_remote_copy_buffer[XPC_RSVD_PAGE_ALIGNED_SIZE]; 80 XP_NASID_MASK_BYTES];
77
78
79/* systune related variables */
80int xpc_hb_interval = XPC_HB_DEFAULT_INTERVAL;
81int xpc_hb_check_interval = XPC_HB_CHECK_DEFAULT_TIMEOUT;
82 81
83 82
84/* 83/*
@@ -86,13 +85,16 @@ int xpc_hb_check_interval = XPC_HB_CHECK_DEFAULT_TIMEOUT;
86 * for that nasid. This function returns 0 on any error. 85 * for that nasid. This function returns 0 on any error.
87 */ 86 */
88static u64 87static u64
89xpc_get_rsvd_page_pa(int nasid, u64 buf, u64 buf_size) 88xpc_get_rsvd_page_pa(int nasid)
90{ 89{
91 bte_result_t bte_res; 90 bte_result_t bte_res;
92 s64 status; 91 s64 status;
93 u64 cookie = 0; 92 u64 cookie = 0;
94 u64 rp_pa = nasid; /* seed with nasid */ 93 u64 rp_pa = nasid; /* seed with nasid */
95 u64 len = 0; 94 u64 len = 0;
95 u64 buf = buf;
96 u64 buf_len = 0;
97 void *buf_base = NULL;
96 98
97 99
98 while (1) { 100 while (1) {
@@ -108,13 +110,22 @@ xpc_get_rsvd_page_pa(int nasid, u64 buf, u64 buf_size)
108 break; 110 break;
109 } 111 }
110 112
111 if (len > buf_size) { 113 if (L1_CACHE_ALIGN(len) > buf_len) {
112 dev_err(xpc_part, "len (=0x%016lx) > buf_size\n", len); 114 if (buf_base != NULL) {
113 status = SALRET_ERROR; 115 kfree(buf_base);
114 break; 116 }
117 buf_len = L1_CACHE_ALIGN(len);
118 buf = (u64) xpc_kmalloc_cacheline_aligned(buf_len,
119 GFP_KERNEL, &buf_base);
120 if (buf_base == NULL) {
121 dev_err(xpc_part, "unable to kmalloc "
122 "len=0x%016lx\n", buf_len);
123 status = SALRET_ERROR;
124 break;
125 }
115 } 126 }
116 127
117 bte_res = xp_bte_copy(rp_pa, ia64_tpa(buf), buf_size, 128 bte_res = xp_bte_copy(rp_pa, ia64_tpa(buf), buf_len,
118 (BTE_NOTIFY | BTE_WACQUIRE), NULL); 129 (BTE_NOTIFY | BTE_WACQUIRE), NULL);
119 if (bte_res != BTE_SUCCESS) { 130 if (bte_res != BTE_SUCCESS) {
120 dev_dbg(xpc_part, "xp_bte_copy failed %i\n", bte_res); 131 dev_dbg(xpc_part, "xp_bte_copy failed %i\n", bte_res);
@@ -123,6 +134,10 @@ xpc_get_rsvd_page_pa(int nasid, u64 buf, u64 buf_size)
123 } 134 }
124 } 135 }
125 136
137 if (buf_base != NULL) {
138 kfree(buf_base);
139 }
140
126 if (status != SALRET_OK) { 141 if (status != SALRET_OK) {
127 rp_pa = 0; 142 rp_pa = 0;
128 } 143 }
@@ -141,15 +156,15 @@ xpc_rsvd_page_init(void)
141{ 156{
142 struct xpc_rsvd_page *rp; 157 struct xpc_rsvd_page *rp;
143 AMO_t *amos_page; 158 AMO_t *amos_page;
144 u64 rp_pa, next_cl, nasid_array = 0; 159 u64 rp_pa, nasid_array = 0;
145 int i, ret; 160 int i, ret;
146 161
147 162
148 /* get the local reserved page's address */ 163 /* get the local reserved page's address */
149 164
150 rp_pa = xpc_get_rsvd_page_pa(cnodeid_to_nasid(0), 165 preempt_disable();
151 (u64) xpc_remote_copy_buffer, 166 rp_pa = xpc_get_rsvd_page_pa(cpuid_to_nasid(smp_processor_id()));
152 XPC_RSVD_PAGE_ALIGNED_SIZE); 167 preempt_enable();
153 if (rp_pa == 0) { 168 if (rp_pa == 0) {
154 dev_err(xpc_part, "SAL failed to locate the reserved page\n"); 169 dev_err(xpc_part, "SAL failed to locate the reserved page\n");
155 return NULL; 170 return NULL;
@@ -164,12 +179,19 @@ xpc_rsvd_page_init(void)
164 179
165 rp->version = XPC_RP_VERSION; 180 rp->version = XPC_RP_VERSION;
166 181
167 /* 182 /* establish the actual sizes of the nasid masks */
168 * Place the XPC variables on the cache line following the 183 if (rp->SAL_version == 1) {
169 * reserved page structure. 184 /* SAL_version 1 didn't set the nasids_size field */
170 */ 185 rp->nasids_size = 128;
171 next_cl = (u64) rp + XPC_RSVD_PAGE_ALIGNED_SIZE; 186 }
172 xpc_vars = (struct xpc_vars *) next_cl; 187 xp_nasid_mask_bytes = rp->nasids_size;
188 xp_nasid_mask_words = xp_nasid_mask_bytes / 8;
189
190 /* setup the pointers to the various items in the reserved page */
191 xpc_part_nasids = XPC_RP_PART_NASIDS(rp);
192 xpc_mach_nasids = XPC_RP_MACH_NASIDS(rp);
193 xpc_vars = XPC_RP_VARS(rp);
194 xpc_vars_part = XPC_RP_VARS_PART(rp);
173 195
174 /* 196 /*
175 * Before clearing xpc_vars, see if a page of AMOs had been previously 197 * Before clearing xpc_vars, see if a page of AMOs had been previously
@@ -221,33 +243,32 @@ xpc_rsvd_page_init(void)
221 amos_page = (AMO_t *) TO_AMO((u64) amos_page); 243 amos_page = (AMO_t *) TO_AMO((u64) amos_page);
222 } 244 }
223 245
246 /* clear xpc_vars */
224 memset(xpc_vars, 0, sizeof(struct xpc_vars)); 247 memset(xpc_vars, 0, sizeof(struct xpc_vars));
225 248
226 /*
227 * Place the XPC per partition specific variables on the cache line
228 * following the XPC variables structure.
229 */
230 next_cl += XPC_VARS_ALIGNED_SIZE;
231 memset((u64 *) next_cl, 0, sizeof(struct xpc_vars_part) *
232 XP_MAX_PARTITIONS);
233 xpc_vars_part = (struct xpc_vars_part *) next_cl;
234 xpc_vars->vars_part_pa = __pa(next_cl);
235
236 xpc_vars->version = XPC_V_VERSION; 249 xpc_vars->version = XPC_V_VERSION;
237 xpc_vars->act_nasid = cpuid_to_nasid(0); 250 xpc_vars->act_nasid = cpuid_to_nasid(0);
238 xpc_vars->act_phys_cpuid = cpu_physical_id(0); 251 xpc_vars->act_phys_cpuid = cpu_physical_id(0);
252 xpc_vars->vars_part_pa = __pa(xpc_vars_part);
253 xpc_vars->amos_page_pa = ia64_tpa((u64) amos_page);
239 xpc_vars->amos_page = amos_page; /* save for next load of XPC */ 254 xpc_vars->amos_page = amos_page; /* save for next load of XPC */
240 255
241 256
242 /* 257 /* clear xpc_vars_part */
243 * Initialize the activation related AMO variables. 258 memset((u64 *) xpc_vars_part, 0, sizeof(struct xpc_vars_part) *
244 */ 259 XP_MAX_PARTITIONS);
245 xpc_vars->act_amos = xpc_IPI_init(XP_MAX_PARTITIONS); 260
246 for (i = 1; i < XP_NASID_MASK_WORDS; i++) { 261 /* initialize the activate IRQ related AMO variables */
247 xpc_IPI_init(i + XP_MAX_PARTITIONS); 262 for (i = 0; i < xp_nasid_mask_words; i++) {
263 (void) xpc_IPI_init(XPC_ACTIVATE_IRQ_AMOS + i);
248 } 264 }
249 /* export AMO page's physical address to other partitions */ 265
250 xpc_vars->amos_page_pa = ia64_tpa((u64) xpc_vars->amos_page); 266 /* initialize the engaged remote partitions related AMO variables */
267 (void) xpc_IPI_init(XPC_ENGAGED_PARTITIONS_AMO);
268 (void) xpc_IPI_init(XPC_DISENGAGE_REQUEST_AMO);
269
270 /* timestamp of when reserved page was setup by XPC */
271 rp->stamp = CURRENT_TIME;
251 272
252 /* 273 /*
253 * This signifies to the remote partition that our reserved 274 * This signifies to the remote partition that our reserved
@@ -387,6 +408,11 @@ xpc_check_remote_hb(void)
387 remote_vars = (struct xpc_vars *) xpc_remote_copy_buffer; 408 remote_vars = (struct xpc_vars *) xpc_remote_copy_buffer;
388 409
389 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) { 410 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
411
412 if (xpc_exiting) {
413 break;
414 }
415
390 if (partid == sn_partition_id) { 416 if (partid == sn_partition_id) {
391 continue; 417 continue;
392 } 418 }
@@ -401,7 +427,7 @@ xpc_check_remote_hb(void)
401 /* pull the remote_hb cache line */ 427 /* pull the remote_hb cache line */
402 bres = xp_bte_copy(part->remote_vars_pa, 428 bres = xp_bte_copy(part->remote_vars_pa,
403 ia64_tpa((u64) remote_vars), 429 ia64_tpa((u64) remote_vars),
404 XPC_VARS_ALIGNED_SIZE, 430 XPC_RP_VARS_SIZE,
405 (BTE_NOTIFY | BTE_WACQUIRE), NULL); 431 (BTE_NOTIFY | BTE_WACQUIRE), NULL);
406 if (bres != BTE_SUCCESS) { 432 if (bres != BTE_SUCCESS) {
407 XPC_DEACTIVATE_PARTITION(part, 433 XPC_DEACTIVATE_PARTITION(part,
@@ -417,7 +443,7 @@ xpc_check_remote_hb(void)
417 443
418 if (((remote_vars->heartbeat == part->last_heartbeat) && 444 if (((remote_vars->heartbeat == part->last_heartbeat) &&
419 (remote_vars->kdb_status == 0)) || 445 (remote_vars->kdb_status == 0)) ||
420 !XPC_HB_ALLOWED(sn_partition_id, remote_vars)) { 446 !xpc_hb_allowed(sn_partition_id, remote_vars)) {
421 447
422 XPC_DEACTIVATE_PARTITION(part, xpcNoHeartbeat); 448 XPC_DEACTIVATE_PARTITION(part, xpcNoHeartbeat);
423 continue; 449 continue;
@@ -429,31 +455,31 @@ xpc_check_remote_hb(void)
429 455
430 456
431/* 457/*
432 * Get a copy of the remote partition's rsvd page. 458 * Get a copy of a portion of the remote partition's rsvd page.
433 * 459 *
434 * remote_rp points to a buffer that is cacheline aligned for BTE copies and 460 * remote_rp points to a buffer that is cacheline aligned for BTE copies and
435 * assumed to be of size XPC_RSVD_PAGE_ALIGNED_SIZE. 461 * is large enough to contain a copy of their reserved page header and
462 * part_nasids mask.
436 */ 463 */
437static enum xpc_retval 464static enum xpc_retval
438xpc_get_remote_rp(int nasid, u64 *discovered_nasids, 465xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
439 struct xpc_rsvd_page *remote_rp, u64 *remote_rsvd_page_pa) 466 struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa)
440{ 467{
441 int bres, i; 468 int bres, i;
442 469
443 470
444 /* get the reserved page's physical address */ 471 /* get the reserved page's physical address */
445 472
446 *remote_rsvd_page_pa = xpc_get_rsvd_page_pa(nasid, (u64) remote_rp, 473 *remote_rp_pa = xpc_get_rsvd_page_pa(nasid);
447 XPC_RSVD_PAGE_ALIGNED_SIZE); 474 if (*remote_rp_pa == 0) {
448 if (*remote_rsvd_page_pa == 0) {
449 return xpcNoRsvdPageAddr; 475 return xpcNoRsvdPageAddr;
450 } 476 }
451 477
452 478
453 /* pull over the reserved page structure */ 479 /* pull over the reserved page header and part_nasids mask */
454 480
455 bres = xp_bte_copy(*remote_rsvd_page_pa, ia64_tpa((u64) remote_rp), 481 bres = xp_bte_copy(*remote_rp_pa, ia64_tpa((u64) remote_rp),
456 XPC_RSVD_PAGE_ALIGNED_SIZE, 482 XPC_RP_HEADER_SIZE + xp_nasid_mask_bytes,
457 (BTE_NOTIFY | BTE_WACQUIRE), NULL); 483 (BTE_NOTIFY | BTE_WACQUIRE), NULL);
458 if (bres != BTE_SUCCESS) { 484 if (bres != BTE_SUCCESS) {
459 return xpc_map_bte_errors(bres); 485 return xpc_map_bte_errors(bres);
@@ -461,8 +487,11 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
461 487
462 488
463 if (discovered_nasids != NULL) { 489 if (discovered_nasids != NULL) {
464 for (i = 0; i < XP_NASID_MASK_WORDS; i++) { 490 u64 *remote_part_nasids = XPC_RP_PART_NASIDS(remote_rp);
465 discovered_nasids[i] |= remote_rp->part_nasids[i]; 491
492
493 for (i = 0; i < xp_nasid_mask_words; i++) {
494 discovered_nasids[i] |= remote_part_nasids[i];
466 } 495 }
467 } 496 }
468 497
@@ -489,10 +518,10 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
489 518
490 519
491/* 520/*
492 * Get a copy of the remote partition's XPC variables. 521 * Get a copy of the remote partition's XPC variables from the reserved page.
493 * 522 *
494 * remote_vars points to a buffer that is cacheline aligned for BTE copies and 523 * remote_vars points to a buffer that is cacheline aligned for BTE copies and
495 * assumed to be of size XPC_VARS_ALIGNED_SIZE. 524 * assumed to be of size XPC_RP_VARS_SIZE.
496 */ 525 */
497static enum xpc_retval 526static enum xpc_retval
498xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars) 527xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars)
@@ -508,7 +537,7 @@ xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars)
508 /* pull over the cross partition variables */ 537 /* pull over the cross partition variables */
509 538
510 bres = xp_bte_copy(remote_vars_pa, ia64_tpa((u64) remote_vars), 539 bres = xp_bte_copy(remote_vars_pa, ia64_tpa((u64) remote_vars),
511 XPC_VARS_ALIGNED_SIZE, 540 XPC_RP_VARS_SIZE,
512 (BTE_NOTIFY | BTE_WACQUIRE), NULL); 541 (BTE_NOTIFY | BTE_WACQUIRE), NULL);
513 if (bres != BTE_SUCCESS) { 542 if (bres != BTE_SUCCESS) {
514 return xpc_map_bte_errors(bres); 543 return xpc_map_bte_errors(bres);
@@ -524,7 +553,56 @@ xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars)
524 553
525 554
526/* 555/*
527 * Prior code has determine the nasid which generated an IPI. Inspect 556 * Update the remote partition's info.
557 */
558static void
559xpc_update_partition_info(struct xpc_partition *part, u8 remote_rp_version,
560 struct timespec *remote_rp_stamp, u64 remote_rp_pa,
561 u64 remote_vars_pa, struct xpc_vars *remote_vars)
562{
563 part->remote_rp_version = remote_rp_version;
564 dev_dbg(xpc_part, " remote_rp_version = 0x%016lx\n",
565 part->remote_rp_version);
566
567 part->remote_rp_stamp = *remote_rp_stamp;
568 dev_dbg(xpc_part, " remote_rp_stamp (tv_sec = 0x%lx tv_nsec = 0x%lx\n",
569 part->remote_rp_stamp.tv_sec, part->remote_rp_stamp.tv_nsec);
570
571 part->remote_rp_pa = remote_rp_pa;
572 dev_dbg(xpc_part, " remote_rp_pa = 0x%016lx\n", part->remote_rp_pa);
573
574 part->remote_vars_pa = remote_vars_pa;
575 dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n",
576 part->remote_vars_pa);
577
578 part->last_heartbeat = remote_vars->heartbeat;
579 dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n",
580 part->last_heartbeat);
581
582 part->remote_vars_part_pa = remote_vars->vars_part_pa;
583 dev_dbg(xpc_part, " remote_vars_part_pa = 0x%016lx\n",
584 part->remote_vars_part_pa);
585
586 part->remote_act_nasid = remote_vars->act_nasid;
587 dev_dbg(xpc_part, " remote_act_nasid = 0x%x\n",
588 part->remote_act_nasid);
589
590 part->remote_act_phys_cpuid = remote_vars->act_phys_cpuid;
591 dev_dbg(xpc_part, " remote_act_phys_cpuid = 0x%x\n",
592 part->remote_act_phys_cpuid);
593
594 part->remote_amos_page_pa = remote_vars->amos_page_pa;
595 dev_dbg(xpc_part, " remote_amos_page_pa = 0x%lx\n",
596 part->remote_amos_page_pa);
597
598 part->remote_vars_version = remote_vars->version;
599 dev_dbg(xpc_part, " remote_vars_version = 0x%x\n",
600 part->remote_vars_version);
601}
602
603
604/*
605 * Prior code has determined the nasid which generated an IPI. Inspect
528 * that nasid to determine if its partition needs to be activated or 606 * that nasid to determine if its partition needs to be activated or
529 * deactivated. 607 * deactivated.
530 * 608 *
@@ -542,8 +620,12 @@ xpc_identify_act_IRQ_req(int nasid)
542{ 620{
543 struct xpc_rsvd_page *remote_rp; 621 struct xpc_rsvd_page *remote_rp;
544 struct xpc_vars *remote_vars; 622 struct xpc_vars *remote_vars;
545 u64 remote_rsvd_page_pa; 623 u64 remote_rp_pa;
546 u64 remote_vars_pa; 624 u64 remote_vars_pa;
625 int remote_rp_version;
626 int reactivate = 0;
627 int stamp_diff;
628 struct timespec remote_rp_stamp = { 0, 0 };
547 partid_t partid; 629 partid_t partid;
548 struct xpc_partition *part; 630 struct xpc_partition *part;
549 enum xpc_retval ret; 631 enum xpc_retval ret;
@@ -553,7 +635,7 @@ xpc_identify_act_IRQ_req(int nasid)
553 635
554 remote_rp = (struct xpc_rsvd_page *) xpc_remote_copy_buffer; 636 remote_rp = (struct xpc_rsvd_page *) xpc_remote_copy_buffer;
555 637
556 ret = xpc_get_remote_rp(nasid, NULL, remote_rp, &remote_rsvd_page_pa); 638 ret = xpc_get_remote_rp(nasid, NULL, remote_rp, &remote_rp_pa);
557 if (ret != xpcSuccess) { 639 if (ret != xpcSuccess) {
558 dev_warn(xpc_part, "unable to get reserved page from nasid %d, " 640 dev_warn(xpc_part, "unable to get reserved page from nasid %d, "
559 "which sent interrupt, reason=%d\n", nasid, ret); 641 "which sent interrupt, reason=%d\n", nasid, ret);
@@ -561,6 +643,10 @@ xpc_identify_act_IRQ_req(int nasid)
561 } 643 }
562 644
563 remote_vars_pa = remote_rp->vars_pa; 645 remote_vars_pa = remote_rp->vars_pa;
646 remote_rp_version = remote_rp->version;
647 if (XPC_SUPPORTS_RP_STAMP(remote_rp_version)) {
648 remote_rp_stamp = remote_rp->stamp;
649 }
564 partid = remote_rp->partid; 650 partid = remote_rp->partid;
565 part = &xpc_partitions[partid]; 651 part = &xpc_partitions[partid];
566 652
@@ -586,44 +672,117 @@ xpc_identify_act_IRQ_req(int nasid)
586 "%ld:0x%lx\n", (int) nasid, (int) partid, part->act_IRQ_rcvd, 672 "%ld:0x%lx\n", (int) nasid, (int) partid, part->act_IRQ_rcvd,
587 remote_vars->heartbeat, remote_vars->heartbeating_to_mask); 673 remote_vars->heartbeat, remote_vars->heartbeating_to_mask);
588 674
675 if (xpc_partition_disengaged(part) &&
676 part->act_state == XPC_P_INACTIVE) {
589 677
590 if (part->act_state == XPC_P_INACTIVE) { 678 xpc_update_partition_info(part, remote_rp_version,
679 &remote_rp_stamp, remote_rp_pa,
680 remote_vars_pa, remote_vars);
591 681
592 part->remote_rp_pa = remote_rsvd_page_pa; 682 if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version)) {
593 dev_dbg(xpc_part, " remote_rp_pa = 0x%016lx\n", 683 if (xpc_partition_disengage_requested(1UL << partid)) {
594 part->remote_rp_pa); 684 /*
685 * Other side is waiting on us to disengage,
686 * even though we already have.
687 */
688 return;
689 }
690 } else {
691 /* other side doesn't support disengage requests */
692 xpc_clear_partition_disengage_request(1UL << partid);
693 }
595 694
596 part->remote_vars_pa = remote_vars_pa; 695 xpc_activate_partition(part);
597 dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n", 696 return;
598 part->remote_vars_pa); 697 }
599 698
600 part->last_heartbeat = remote_vars->heartbeat; 699 DBUG_ON(part->remote_rp_version == 0);
601 dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n", 700 DBUG_ON(part->remote_vars_version == 0);
602 part->last_heartbeat); 701
702 if (!XPC_SUPPORTS_RP_STAMP(part->remote_rp_version)) {
703 DBUG_ON(XPC_SUPPORTS_DISENGAGE_REQUEST(part->
704 remote_vars_version));
705
706 if (!XPC_SUPPORTS_RP_STAMP(remote_rp_version)) {
707 DBUG_ON(XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->
708 version));
709 /* see if the other side rebooted */
710 if (part->remote_amos_page_pa ==
711 remote_vars->amos_page_pa &&
712 xpc_hb_allowed(sn_partition_id,
713 remote_vars)) {
714 /* doesn't look that way, so ignore the IPI */
715 return;
716 }
717 }
603 718
604 part->remote_vars_part_pa = remote_vars->vars_part_pa; 719 /*
605 dev_dbg(xpc_part, " remote_vars_part_pa = 0x%016lx\n", 720 * Other side rebooted and previous XPC didn't support the
606 part->remote_vars_part_pa); 721 * disengage request, so we don't need to do anything special.
722 */
607 723
608 part->remote_act_nasid = remote_vars->act_nasid; 724 xpc_update_partition_info(part, remote_rp_version,
609 dev_dbg(xpc_part, " remote_act_nasid = 0x%x\n", 725 &remote_rp_stamp, remote_rp_pa,
610 part->remote_act_nasid); 726 remote_vars_pa, remote_vars);
727 part->reactivate_nasid = nasid;
728 XPC_DEACTIVATE_PARTITION(part, xpcReactivating);
729 return;
730 }
611 731
612 part->remote_act_phys_cpuid = remote_vars->act_phys_cpuid; 732 DBUG_ON(!XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version));
613 dev_dbg(xpc_part, " remote_act_phys_cpuid = 0x%x\n",
614 part->remote_act_phys_cpuid);
615 733
616 part->remote_amos_page_pa = remote_vars->amos_page_pa; 734 if (!XPC_SUPPORTS_RP_STAMP(remote_rp_version)) {
617 dev_dbg(xpc_part, " remote_amos_page_pa = 0x%lx\n", 735 DBUG_ON(!XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->version));
618 part->remote_amos_page_pa);
619 736
620 xpc_activate_partition(part); 737 /*
738 * Other side rebooted and previous XPC did support the
739 * disengage request, but the new one doesn't.
740 */
741
742 xpc_clear_partition_engaged(1UL << partid);
743 xpc_clear_partition_disengage_request(1UL << partid);
621 744
622 } else if (part->remote_amos_page_pa != remote_vars->amos_page_pa || 745 xpc_update_partition_info(part, remote_rp_version,
623 !XPC_HB_ALLOWED(sn_partition_id, remote_vars)) { 746 &remote_rp_stamp, remote_rp_pa,
747 remote_vars_pa, remote_vars);
748 reactivate = 1;
749
750 } else {
751 DBUG_ON(!XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->version));
624 752
753 stamp_diff = xpc_compare_stamps(&part->remote_rp_stamp,
754 &remote_rp_stamp);
755 if (stamp_diff != 0) {
756 DBUG_ON(stamp_diff >= 0);
757
758 /*
759 * Other side rebooted and the previous XPC did support
760 * the disengage request, as does the new one.
761 */
762
763 DBUG_ON(xpc_partition_engaged(1UL << partid));
764 DBUG_ON(xpc_partition_disengage_requested(1UL <<
765 partid));
766
767 xpc_update_partition_info(part, remote_rp_version,
768 &remote_rp_stamp, remote_rp_pa,
769 remote_vars_pa, remote_vars);
770 reactivate = 1;
771 }
772 }
773
774 if (!xpc_partition_disengaged(part)) {
775 /* still waiting on other side to disengage from us */
776 return;
777 }
778
779 if (reactivate) {
625 part->reactivate_nasid = nasid; 780 part->reactivate_nasid = nasid;
626 XPC_DEACTIVATE_PARTITION(part, xpcReactivating); 781 XPC_DEACTIVATE_PARTITION(part, xpcReactivating);
782
783 } else if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version) &&
784 xpc_partition_disengage_requested(1UL << partid)) {
785 XPC_DEACTIVATE_PARTITION(part, xpcOtherGoingDown);
627 } 786 }
628} 787}
629 788
@@ -643,14 +802,17 @@ xpc_identify_act_IRQ_sender(void)
643 u64 nasid; /* remote nasid */ 802 u64 nasid; /* remote nasid */
644 int n_IRQs_detected = 0; 803 int n_IRQs_detected = 0;
645 AMO_t *act_amos; 804 AMO_t *act_amos;
646 struct xpc_rsvd_page *rp = (struct xpc_rsvd_page *) xpc_rsvd_page;
647 805
648 806
649 act_amos = xpc_vars->act_amos; 807 act_amos = xpc_vars->amos_page + XPC_ACTIVATE_IRQ_AMOS;
650 808
651 809
652 /* scan through act AMO variable looking for non-zero entries */ 810 /* scan through act AMO variable looking for non-zero entries */
653 for (word = 0; word < XP_NASID_MASK_WORDS; word++) { 811 for (word = 0; word < xp_nasid_mask_words; word++) {
812
813 if (xpc_exiting) {
814 break;
815 }
654 816
655 nasid_mask = xpc_IPI_receive(&act_amos[word]); 817 nasid_mask = xpc_IPI_receive(&act_amos[word]);
656 if (nasid_mask == 0) { 818 if (nasid_mask == 0) {
@@ -668,7 +830,7 @@ xpc_identify_act_IRQ_sender(void)
668 * remote nasid in our reserved pages machine mask. 830 * remote nasid in our reserved pages machine mask.
669 * This is used in the event of module reload. 831 * This is used in the event of module reload.
670 */ 832 */
671 rp->mach_nasids[word] |= nasid_mask; 833 xpc_mach_nasids[word] |= nasid_mask;
672 834
673 835
674 /* locate the nasid(s) which sent interrupts */ 836 /* locate the nasid(s) which sent interrupts */
@@ -688,6 +850,55 @@ xpc_identify_act_IRQ_sender(void)
688 850
689 851
690/* 852/*
853 * See if the other side has responded to a partition disengage request
854 * from us.
855 */
856int
857xpc_partition_disengaged(struct xpc_partition *part)
858{
859 partid_t partid = XPC_PARTID(part);
860 int disengaged;
861
862
863 disengaged = (xpc_partition_engaged(1UL << partid) == 0);
864 if (part->disengage_request_timeout) {
865 if (!disengaged) {
866 if (jiffies < part->disengage_request_timeout) {
867 /* timelimit hasn't been reached yet */
868 return 0;
869 }
870
871 /*
872 * Other side hasn't responded to our disengage
873 * request in a timely fashion, so assume it's dead.
874 */
875
876 xpc_clear_partition_engaged(1UL << partid);
877 disengaged = 1;
878 }
879 part->disengage_request_timeout = 0;
880
881 /* cancel the timer function, provided it's not us */
882 if (!in_interrupt()) {
883 del_singleshot_timer_sync(&part->
884 disengage_request_timer);
885 }
886
887 DBUG_ON(part->act_state != XPC_P_DEACTIVATING &&
888 part->act_state != XPC_P_INACTIVE);
889 if (part->act_state != XPC_P_INACTIVE) {
890 xpc_wakeup_channel_mgr(part);
891 }
892
893 if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version)) {
894 xpc_cancel_partition_disengage_request(part);
895 }
896 }
897 return disengaged;
898}
899
900
901/*
691 * Mark specified partition as active. 902 * Mark specified partition as active.
692 */ 903 */
693enum xpc_retval 904enum xpc_retval
@@ -721,7 +932,6 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
721 enum xpc_retval reason) 932 enum xpc_retval reason)
722{ 933{
723 unsigned long irq_flags; 934 unsigned long irq_flags;
724 partid_t partid = XPC_PARTID(part);
725 935
726 936
727 spin_lock_irqsave(&part->act_lock, irq_flags); 937 spin_lock_irqsave(&part->act_lock, irq_flags);
@@ -749,17 +959,27 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
749 959
750 spin_unlock_irqrestore(&part->act_lock, irq_flags); 960 spin_unlock_irqrestore(&part->act_lock, irq_flags);
751 961
752 XPC_DISALLOW_HB(partid, xpc_vars); 962 if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version)) {
963 xpc_request_partition_disengage(part);
964 xpc_IPI_send_disengage(part);
753 965
754 dev_dbg(xpc_part, "bringing partition %d down, reason = %d\n", partid, 966 /* set a timelimit on the disengage request */
755 reason); 967 part->disengage_request_timeout = jiffies +
968 (xpc_disengage_request_timelimit * HZ);
969 part->disengage_request_timer.expires =
970 part->disengage_request_timeout;
971 add_timer(&part->disengage_request_timer);
972 }
973
974 dev_dbg(xpc_part, "bringing partition %d down, reason = %d\n",
975 XPC_PARTID(part), reason);
756 976
757 xpc_partition_down(part, reason); 977 xpc_partition_going_down(part, reason);
758} 978}
759 979
760 980
761/* 981/*
762 * Mark specified partition as active. 982 * Mark specified partition as inactive.
763 */ 983 */
764void 984void
765xpc_mark_partition_inactive(struct xpc_partition *part) 985xpc_mark_partition_inactive(struct xpc_partition *part)
@@ -792,9 +1012,10 @@ xpc_discovery(void)
792 void *remote_rp_base; 1012 void *remote_rp_base;
793 struct xpc_rsvd_page *remote_rp; 1013 struct xpc_rsvd_page *remote_rp;
794 struct xpc_vars *remote_vars; 1014 struct xpc_vars *remote_vars;
795 u64 remote_rsvd_page_pa; 1015 u64 remote_rp_pa;
796 u64 remote_vars_pa; 1016 u64 remote_vars_pa;
797 int region; 1017 int region;
1018 int region_size;
798 int max_regions; 1019 int max_regions;
799 int nasid; 1020 int nasid;
800 struct xpc_rsvd_page *rp; 1021 struct xpc_rsvd_page *rp;
@@ -804,7 +1025,8 @@ xpc_discovery(void)
804 enum xpc_retval ret; 1025 enum xpc_retval ret;
805 1026
806 1027
807 remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RSVD_PAGE_ALIGNED_SIZE, 1028 remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RP_HEADER_SIZE +
1029 xp_nasid_mask_bytes,
808 GFP_KERNEL, &remote_rp_base); 1030 GFP_KERNEL, &remote_rp_base);
809 if (remote_rp == NULL) { 1031 if (remote_rp == NULL) {
810 return; 1032 return;
@@ -812,13 +1034,13 @@ xpc_discovery(void)
812 remote_vars = (struct xpc_vars *) remote_rp; 1034 remote_vars = (struct xpc_vars *) remote_rp;
813 1035
814 1036
815 discovered_nasids = kmalloc(sizeof(u64) * XP_NASID_MASK_WORDS, 1037 discovered_nasids = kmalloc(sizeof(u64) * xp_nasid_mask_words,
816 GFP_KERNEL); 1038 GFP_KERNEL);
817 if (discovered_nasids == NULL) { 1039 if (discovered_nasids == NULL) {
818 kfree(remote_rp_base); 1040 kfree(remote_rp_base);
819 return; 1041 return;
820 } 1042 }
821 memset(discovered_nasids, 0, sizeof(u64) * XP_NASID_MASK_WORDS); 1043 memset(discovered_nasids, 0, sizeof(u64) * xp_nasid_mask_words);
822 1044
823 rp = (struct xpc_rsvd_page *) xpc_rsvd_page; 1045 rp = (struct xpc_rsvd_page *) xpc_rsvd_page;
824 1046
@@ -827,11 +1049,19 @@ xpc_discovery(void)
827 * nodes that can comprise an access protection grouping. The access 1049 * nodes that can comprise an access protection grouping. The access
828 * protection is in regards to memory, IOI and IPI. 1050 * protection is in regards to memory, IOI and IPI.
829 */ 1051 */
830//>>> move the next two #defines into either include/asm-ia64/sn/arch.h or 1052 max_regions = 64;
831//>>> include/asm-ia64/sn/addrs.h 1053 region_size = sn_region_size;
832#define SH1_MAX_REGIONS 64 1054
833#define SH2_MAX_REGIONS 256 1055 switch (region_size) {
834 max_regions = is_shub2() ? SH2_MAX_REGIONS : SH1_MAX_REGIONS; 1056 case 128:
1057 max_regions *= 2;
1058 case 64:
1059 max_regions *= 2;
1060 case 32:
1061 max_regions *= 2;
1062 region_size = 16;
1063 DBUG_ON(!is_shub2());
1064 }
835 1065
836 for (region = 0; region < max_regions; region++) { 1066 for (region = 0; region < max_regions; region++) {
837 1067
@@ -841,8 +1071,8 @@ xpc_discovery(void)
841 1071
842 dev_dbg(xpc_part, "searching region %d\n", region); 1072 dev_dbg(xpc_part, "searching region %d\n", region);
843 1073
844 for (nasid = (region * sn_region_size * 2); 1074 for (nasid = (region * region_size * 2);
845 nasid < ((region + 1) * sn_region_size * 2); 1075 nasid < ((region + 1) * region_size * 2);
846 nasid += 2) { 1076 nasid += 2) {
847 1077
848 if ((volatile int) xpc_exiting) { 1078 if ((volatile int) xpc_exiting) {
@@ -852,14 +1082,14 @@ xpc_discovery(void)
852 dev_dbg(xpc_part, "checking nasid %d\n", nasid); 1082 dev_dbg(xpc_part, "checking nasid %d\n", nasid);
853 1083
854 1084
855 if (XPC_NASID_IN_ARRAY(nasid, rp->part_nasids)) { 1085 if (XPC_NASID_IN_ARRAY(nasid, xpc_part_nasids)) {
856 dev_dbg(xpc_part, "PROM indicates Nasid %d is " 1086 dev_dbg(xpc_part, "PROM indicates Nasid %d is "
857 "part of the local partition; skipping " 1087 "part of the local partition; skipping "
858 "region\n", nasid); 1088 "region\n", nasid);
859 break; 1089 break;
860 } 1090 }
861 1091
862 if (!(XPC_NASID_IN_ARRAY(nasid, rp->mach_nasids))) { 1092 if (!(XPC_NASID_IN_ARRAY(nasid, xpc_mach_nasids))) {
863 dev_dbg(xpc_part, "PROM indicates Nasid %d was " 1093 dev_dbg(xpc_part, "PROM indicates Nasid %d was "
864 "not on Numa-Link network at reset\n", 1094 "not on Numa-Link network at reset\n",
865 nasid); 1095 nasid);
@@ -877,7 +1107,7 @@ xpc_discovery(void)
877 /* pull over the reserved page structure */ 1107 /* pull over the reserved page structure */
878 1108
879 ret = xpc_get_remote_rp(nasid, discovered_nasids, 1109 ret = xpc_get_remote_rp(nasid, discovered_nasids,
880 remote_rp, &remote_rsvd_page_pa); 1110 remote_rp, &remote_rp_pa);
881 if (ret != xpcSuccess) { 1111 if (ret != xpcSuccess) {
882 dev_dbg(xpc_part, "unable to get reserved page " 1112 dev_dbg(xpc_part, "unable to get reserved page "
883 "from nasid %d, reason=%d\n", nasid, 1113 "from nasid %d, reason=%d\n", nasid,
@@ -948,6 +1178,13 @@ xpc_discovery(void)
948 remote_vars->act_nasid, 1178 remote_vars->act_nasid,
949 remote_vars->act_phys_cpuid); 1179 remote_vars->act_phys_cpuid);
950 1180
1181 if (XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->
1182 version)) {
1183 part->remote_amos_page_pa =
1184 remote_vars->amos_page_pa;
1185 xpc_mark_partition_disengaged(part);
1186 xpc_cancel_partition_disengage_request(part);
1187 }
951 xpc_IPI_send_activate(remote_vars); 1188 xpc_IPI_send_activate(remote_vars);
952 } 1189 }
953 } 1190 }
@@ -974,12 +1211,12 @@ xpc_initiate_partid_to_nasids(partid_t partid, void *nasid_mask)
974 return xpcPartitionDown; 1211 return xpcPartitionDown;
975 } 1212 }
976 1213
977 part_nasid_pa = part->remote_rp_pa + 1214 memset(nasid_mask, 0, XP_NASID_MASK_BYTES);
978 (u64) &((struct xpc_rsvd_page *) 0)->part_nasids; 1215
1216 part_nasid_pa = (u64) XPC_RP_PART_NASIDS(part->remote_rp_pa);
979 1217
980 bte_res = xp_bte_copy(part_nasid_pa, ia64_tpa((u64) nasid_mask), 1218 bte_res = xp_bte_copy(part_nasid_pa, ia64_tpa((u64) nasid_mask),
981 L1_CACHE_ALIGN(XP_NASID_MASK_BYTES), 1219 xp_nasid_mask_bytes, (BTE_NOTIFY | BTE_WACQUIRE), NULL);
982 (BTE_NOTIFY | BTE_WACQUIRE), NULL);
983 1220
984 return xpc_map_bte_errors(bte_res); 1221 return xpc_map_bte_errors(bte_res);
985} 1222}
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index 75e6e874bebf..9bf9f23b9a1f 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -326,6 +326,29 @@ int sn_pci_legacy_read(struct pci_bus *bus, u16 port, u32 *val, u8 size)
326{ 326{
327 unsigned long addr; 327 unsigned long addr;
328 int ret; 328 int ret;
329 struct ia64_sal_retval isrv;
330
331 /*
332 * First, try the SN_SAL_IOIF_PCI_SAFE SAL call which can work
333 * around hw issues at the pci bus level. SGI proms older than
334 * 4.10 don't implment this.
335 */
336
337 SAL_CALL(isrv, SN_SAL_IOIF_PCI_SAFE,
338 pci_domain_nr(bus), bus->number,
339 0, /* io */
340 0, /* read */
341 port, size, __pa(val));
342
343 if (isrv.status == 0)
344 return size;
345
346 /*
347 * If the above failed, retry using the SAL_PROBE call which should
348 * be present in all proms (but which cannot work round PCI chipset
349 * bugs). This code is retained for compatability with old
350 * pre-4.10 proms, and should be removed at some point in the future.
351 */
329 352
330 if (!SN_PCIBUS_BUSSOFT(bus)) 353 if (!SN_PCIBUS_BUSSOFT(bus))
331 return -ENODEV; 354 return -ENODEV;
@@ -349,6 +372,29 @@ int sn_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size)
349 int ret = size; 372 int ret = size;
350 unsigned long paddr; 373 unsigned long paddr;
351 unsigned long *addr; 374 unsigned long *addr;
375 struct ia64_sal_retval isrv;
376
377 /*
378 * First, try the SN_SAL_IOIF_PCI_SAFE SAL call which can work
379 * around hw issues at the pci bus level. SGI proms older than
380 * 4.10 don't implment this.
381 */
382
383 SAL_CALL(isrv, SN_SAL_IOIF_PCI_SAFE,
384 pci_domain_nr(bus), bus->number,
385 0, /* io */
386 1, /* write */
387 port, size, __pa(&val));
388
389 if (isrv.status == 0)
390 return size;
391
392 /*
393 * If the above failed, retry using the SAL_PROBE call which should
394 * be present in all proms (but which cannot work round PCI chipset
395 * bugs). This code is retained for compatability with old
396 * pre-4.10 proms, and should be removed at some point in the future.
397 */
352 398
353 if (!SN_PCIBUS_BUSSOFT(bus)) { 399 if (!SN_PCIBUS_BUSSOFT(bus)) {
354 ret = -ENODEV; 400 ret = -ENODEV;
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_reg.c b/arch/ia64/sn/pci/pcibr/pcibr_reg.c
index 21426d02fbe6..4f718c3e93d3 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_reg.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_reg.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/interrupt.h> 9#include <linux/interrupt.h>
10#include <linux/types.h> 10#include <linux/types.h>
11#include <asm/sn/io.h>
11#include <asm/sn/pcibr_provider.h> 12#include <asm/sn/pcibr_provider.h>
12#include <asm/sn/pcibus_provider_defs.h> 13#include <asm/sn/pcibus_provider_defs.h>
13#include <asm/sn/pcidev.h> 14#include <asm/sn/pcidev.h>
@@ -29,10 +30,10 @@ void pcireg_control_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits)
29 if (pcibus_info) { 30 if (pcibus_info) {
30 switch (pcibus_info->pbi_bridge_type) { 31 switch (pcibus_info->pbi_bridge_type) {
31 case PCIBR_BRIDGETYPE_TIOCP: 32 case PCIBR_BRIDGETYPE_TIOCP:
32 ptr->tio.cp_control &= ~bits; 33 __sn_clrq_relaxed(&ptr->tio.cp_control, bits);
33 break; 34 break;
34 case PCIBR_BRIDGETYPE_PIC: 35 case PCIBR_BRIDGETYPE_PIC:
35 ptr->pic.p_wid_control &= ~bits; 36 __sn_clrq_relaxed(&ptr->pic.p_wid_control, bits);
36 break; 37 break;
37 default: 38 default:
38 panic 39 panic
@@ -49,10 +50,10 @@ void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
49 if (pcibus_info) { 50 if (pcibus_info) {
50 switch (pcibus_info->pbi_bridge_type) { 51 switch (pcibus_info->pbi_bridge_type) {
51 case PCIBR_BRIDGETYPE_TIOCP: 52 case PCIBR_BRIDGETYPE_TIOCP:
52 ptr->tio.cp_control |= bits; 53 __sn_setq_relaxed(&ptr->tio.cp_control, bits);
53 break; 54 break;
54 case PCIBR_BRIDGETYPE_PIC: 55 case PCIBR_BRIDGETYPE_PIC:
55 ptr->pic.p_wid_control |= bits; 56 __sn_setq_relaxed(&ptr->pic.p_wid_control, bits);
56 break; 57 break;
57 default: 58 default:
58 panic 59 panic
@@ -73,10 +74,10 @@ uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info)
73 if (pcibus_info) { 74 if (pcibus_info) {
74 switch (pcibus_info->pbi_bridge_type) { 75 switch (pcibus_info->pbi_bridge_type) {
75 case PCIBR_BRIDGETYPE_TIOCP: 76 case PCIBR_BRIDGETYPE_TIOCP:
76 ret = ptr->tio.cp_tflush; 77 ret = __sn_readq_relaxed(&ptr->tio.cp_tflush);
77 break; 78 break;
78 case PCIBR_BRIDGETYPE_PIC: 79 case PCIBR_BRIDGETYPE_PIC:
79 ret = ptr->pic.p_wid_tflush; 80 ret = __sn_readq_relaxed(&ptr->pic.p_wid_tflush);
80 break; 81 break;
81 default: 82 default:
82 panic 83 panic
@@ -103,10 +104,10 @@ uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info)
103 if (pcibus_info) { 104 if (pcibus_info) {
104 switch (pcibus_info->pbi_bridge_type) { 105 switch (pcibus_info->pbi_bridge_type) {
105 case PCIBR_BRIDGETYPE_TIOCP: 106 case PCIBR_BRIDGETYPE_TIOCP:
106 ret = ptr->tio.cp_int_status; 107 ret = __sn_readq_relaxed(&ptr->tio.cp_int_status);
107 break; 108 break;
108 case PCIBR_BRIDGETYPE_PIC: 109 case PCIBR_BRIDGETYPE_PIC:
109 ret = ptr->pic.p_int_status; 110 ret = __sn_readq_relaxed(&ptr->pic.p_int_status);
110 break; 111 break;
111 default: 112 default:
112 panic 113 panic
@@ -127,10 +128,10 @@ void pcireg_intr_enable_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits)
127 if (pcibus_info) { 128 if (pcibus_info) {
128 switch (pcibus_info->pbi_bridge_type) { 129 switch (pcibus_info->pbi_bridge_type) {
129 case PCIBR_BRIDGETYPE_TIOCP: 130 case PCIBR_BRIDGETYPE_TIOCP:
130 ptr->tio.cp_int_enable &= ~bits; 131 __sn_clrq_relaxed(&ptr->tio.cp_int_enable, bits);
131 break; 132 break;
132 case PCIBR_BRIDGETYPE_PIC: 133 case PCIBR_BRIDGETYPE_PIC:
133 ptr->pic.p_int_enable &= ~bits; 134 __sn_clrq_relaxed(&ptr->pic.p_int_enable, ~bits);
134 break; 135 break;
135 default: 136 default:
136 panic 137 panic
@@ -147,10 +148,10 @@ void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
147 if (pcibus_info) { 148 if (pcibus_info) {
148 switch (pcibus_info->pbi_bridge_type) { 149 switch (pcibus_info->pbi_bridge_type) {
149 case PCIBR_BRIDGETYPE_TIOCP: 150 case PCIBR_BRIDGETYPE_TIOCP:
150 ptr->tio.cp_int_enable |= bits; 151 __sn_setq_relaxed(&ptr->tio.cp_int_enable, bits);
151 break; 152 break;
152 case PCIBR_BRIDGETYPE_PIC: 153 case PCIBR_BRIDGETYPE_PIC:
153 ptr->pic.p_int_enable |= bits; 154 __sn_setq_relaxed(&ptr->pic.p_int_enable, bits);
154 break; 155 break;
155 default: 156 default:
156 panic 157 panic
@@ -171,14 +172,16 @@ void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n,
171 if (pcibus_info) { 172 if (pcibus_info) {
172 switch (pcibus_info->pbi_bridge_type) { 173 switch (pcibus_info->pbi_bridge_type) {
173 case PCIBR_BRIDGETYPE_TIOCP: 174 case PCIBR_BRIDGETYPE_TIOCP:
174 ptr->tio.cp_int_addr[int_n] &= ~TIOCP_HOST_INTR_ADDR; 175 __sn_clrq_relaxed(&ptr->tio.cp_int_addr[int_n],
175 ptr->tio.cp_int_addr[int_n] |= 176 TIOCP_HOST_INTR_ADDR);
176 (addr & TIOCP_HOST_INTR_ADDR); 177 __sn_setq_relaxed(&ptr->tio.cp_int_addr[int_n],
178 (addr & TIOCP_HOST_INTR_ADDR));
177 break; 179 break;
178 case PCIBR_BRIDGETYPE_PIC: 180 case PCIBR_BRIDGETYPE_PIC:
179 ptr->pic.p_int_addr[int_n] &= ~PIC_HOST_INTR_ADDR; 181 __sn_clrq_relaxed(&ptr->pic.p_int_addr[int_n],
180 ptr->pic.p_int_addr[int_n] |= 182 PIC_HOST_INTR_ADDR);
181 (addr & PIC_HOST_INTR_ADDR); 183 __sn_setq_relaxed(&ptr->pic.p_int_addr[int_n],
184 (addr & PIC_HOST_INTR_ADDR));
182 break; 185 break;
183 default: 186 default:
184 panic 187 panic
@@ -198,10 +201,10 @@ void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n)
198 if (pcibus_info) { 201 if (pcibus_info) {
199 switch (pcibus_info->pbi_bridge_type) { 202 switch (pcibus_info->pbi_bridge_type) {
200 case PCIBR_BRIDGETYPE_TIOCP: 203 case PCIBR_BRIDGETYPE_TIOCP:
201 ptr->tio.cp_force_pin[int_n] = 1; 204 writeq(1, &ptr->tio.cp_force_pin[int_n]);
202 break; 205 break;
203 case PCIBR_BRIDGETYPE_PIC: 206 case PCIBR_BRIDGETYPE_PIC:
204 ptr->pic.p_force_pin[int_n] = 1; 207 writeq(1, &ptr->pic.p_force_pin[int_n]);
205 break; 208 break;
206 default: 209 default:
207 panic 210 panic
@@ -222,10 +225,12 @@ uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device)
222 if (pcibus_info) { 225 if (pcibus_info) {
223 switch (pcibus_info->pbi_bridge_type) { 226 switch (pcibus_info->pbi_bridge_type) {
224 case PCIBR_BRIDGETYPE_TIOCP: 227 case PCIBR_BRIDGETYPE_TIOCP:
225 ret = ptr->tio.cp_wr_req_buf[device]; 228 ret =
229 __sn_readq_relaxed(&ptr->tio.cp_wr_req_buf[device]);
226 break; 230 break;
227 case PCIBR_BRIDGETYPE_PIC: 231 case PCIBR_BRIDGETYPE_PIC:
228 ret = ptr->pic.p_wr_req_buf[device]; 232 ret =
233 __sn_readq_relaxed(&ptr->pic.p_wr_req_buf[device]);
229 break; 234 break;
230 default: 235 default:
231 panic("pcireg_wrb_flush_get: unknown bridgetype bridge 0x%p", (void *)ptr); 236 panic("pcireg_wrb_flush_get: unknown bridgetype bridge 0x%p", (void *)ptr);
@@ -244,10 +249,10 @@ void pcireg_int_ate_set(struct pcibus_info *pcibus_info, int ate_index,
244 if (pcibus_info) { 249 if (pcibus_info) {
245 switch (pcibus_info->pbi_bridge_type) { 250 switch (pcibus_info->pbi_bridge_type) {
246 case PCIBR_BRIDGETYPE_TIOCP: 251 case PCIBR_BRIDGETYPE_TIOCP:
247 ptr->tio.cp_int_ate_ram[ate_index] = (uint64_t) val; 252 writeq(val, &ptr->tio.cp_int_ate_ram[ate_index]);
248 break; 253 break;
249 case PCIBR_BRIDGETYPE_PIC: 254 case PCIBR_BRIDGETYPE_PIC:
250 ptr->pic.p_int_ate_ram[ate_index] = (uint64_t) val; 255 writeq(val, &ptr->pic.p_int_ate_ram[ate_index]);
251 break; 256 break;
252 default: 257 default:
253 panic 258 panic
@@ -265,12 +270,10 @@ uint64_t *pcireg_int_ate_addr(struct pcibus_info *pcibus_info, int ate_index)
265 if (pcibus_info) { 270 if (pcibus_info) {
266 switch (pcibus_info->pbi_bridge_type) { 271 switch (pcibus_info->pbi_bridge_type) {
267 case PCIBR_BRIDGETYPE_TIOCP: 272 case PCIBR_BRIDGETYPE_TIOCP:
268 ret = 273 ret = &ptr->tio.cp_int_ate_ram[ate_index];
269 (uint64_t *) & (ptr->tio.cp_int_ate_ram[ate_index]);
270 break; 274 break;
271 case PCIBR_BRIDGETYPE_PIC: 275 case PCIBR_BRIDGETYPE_PIC:
272 ret = 276 ret = &ptr->pic.p_int_ate_ram[ate_index];
273 (uint64_t *) & (ptr->pic.p_int_ate_ram[ate_index]);
274 break; 277 break;
275 default: 278 default:
276 panic 279 panic
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index 19bced34d5f1..46b646a6d345 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -11,6 +11,7 @@
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <asm/sn/sn_sal.h> 12#include <asm/sn/sn_sal.h>
13#include <asm/sn/addrs.h> 13#include <asm/sn/addrs.h>
14#include <asm/sn/io.h>
14#include <asm/sn/pcidev.h> 15#include <asm/sn/pcidev.h>
15#include <asm/sn/pcibus_provider_defs.h> 16#include <asm/sn/pcibus_provider_defs.h>
16#include <asm/sn/tioca_provider.h> 17#include <asm/sn/tioca_provider.h>
@@ -37,7 +38,7 @@ tioca_gart_init(struct tioca_kernel *tioca_kern)
37 uint64_t offset; 38 uint64_t offset;
38 struct page *tmp; 39 struct page *tmp;
39 struct tioca_common *tioca_common; 40 struct tioca_common *tioca_common;
40 volatile struct tioca *ca_base; 41 struct tioca *ca_base;
41 42
42 tioca_common = tioca_kern->ca_common; 43 tioca_common = tioca_kern->ca_common;
43 ca_base = (struct tioca *)tioca_common->ca_common.bs_base; 44 ca_base = (struct tioca *)tioca_common->ca_common.bs_base;
@@ -174,27 +175,29 @@ tioca_gart_init(struct tioca_kernel *tioca_kern)
174 * DISABLE GART PREFETCHING due to hw bug tracked in SGI PV930029 175 * DISABLE GART PREFETCHING due to hw bug tracked in SGI PV930029
175 */ 176 */
176 177
177 ca_base->ca_control1 |= CA_AGPDMA_OP_ENB_COMBDELAY; /* PV895469 ? */ 178 __sn_setq_relaxed(&ca_base->ca_control1,
178 ca_base->ca_control2 &= ~(CA_GART_MEM_PARAM); 179 CA_AGPDMA_OP_ENB_COMBDELAY); /* PV895469 ? */
179 ca_base->ca_control2 |= (0x2ull << CA_GART_MEM_PARAM_SHFT); 180 __sn_clrq_relaxed(&ca_base->ca_control2, CA_GART_MEM_PARAM);
181 __sn_setq_relaxed(&ca_base->ca_control2,
182 (0x2ull << CA_GART_MEM_PARAM_SHFT));
180 tioca_kern->ca_gart_iscoherent = 1; 183 tioca_kern->ca_gart_iscoherent = 1;
181 ca_base->ca_control2 &= 184 __sn_clrq_relaxed(&ca_base->ca_control2,
182 ~(CA_GART_WR_PREFETCH_ENB | CA_GART_RD_PREFETCH_ENB); 185 (CA_GART_WR_PREFETCH_ENB | CA_GART_RD_PREFETCH_ENB));
183 186
184 /* 187 /*
185 * Unmask GART fetch error interrupts. Clear residual errors first. 188 * Unmask GART fetch error interrupts. Clear residual errors first.
186 */ 189 */
187 190
188 ca_base->ca_int_status_alias = CA_GART_FETCH_ERR; 191 writeq(CA_GART_FETCH_ERR, &ca_base->ca_int_status_alias);
189 ca_base->ca_mult_error_alias = CA_GART_FETCH_ERR; 192 writeq(CA_GART_FETCH_ERR, &ca_base->ca_mult_error_alias);
190 ca_base->ca_int_mask &= ~CA_GART_FETCH_ERR; 193 __sn_clrq_relaxed(&ca_base->ca_int_mask, CA_GART_FETCH_ERR);
191 194
192 /* 195 /*
193 * Program the aperature and gart registers in TIOCA 196 * Program the aperature and gart registers in TIOCA
194 */ 197 */
195 198
196 ca_base->ca_gart_aperature = ap_reg; 199 writeq(ap_reg, &ca_base->ca_gart_aperature);
197 ca_base->ca_gart_ptr_table = tioca_kern->ca_gart_coretalk_addr | 1; 200 writeq(tioca_kern->ca_gart_coretalk_addr|1, &ca_base->ca_gart_ptr_table);
198 201
199 return 0; 202 return 0;
200} 203}
@@ -211,7 +214,6 @@ void
211tioca_fastwrite_enable(struct tioca_kernel *tioca_kern) 214tioca_fastwrite_enable(struct tioca_kernel *tioca_kern)
212{ 215{
213 int cap_ptr; 216 int cap_ptr;
214 uint64_t ca_control1;
215 uint32_t reg; 217 uint32_t reg;
216 struct tioca *tioca_base; 218 struct tioca *tioca_base;
217 struct pci_dev *pdev; 219 struct pci_dev *pdev;
@@ -256,9 +258,7 @@ tioca_fastwrite_enable(struct tioca_kernel *tioca_kern)
256 */ 258 */
257 259
258 tioca_base = (struct tioca *)common->ca_common.bs_base; 260 tioca_base = (struct tioca *)common->ca_common.bs_base;
259 ca_control1 = tioca_base->ca_control1; 261 __sn_setq_relaxed(&tioca_base->ca_control1, CA_AGP_FW_ENABLE);
260 ca_control1 |= CA_AGP_FW_ENABLE;
261 tioca_base->ca_control1 = ca_control1;
262} 262}
263 263
264EXPORT_SYMBOL(tioca_fastwrite_enable); /* used by agp-sgi */ 264EXPORT_SYMBOL(tioca_fastwrite_enable); /* used by agp-sgi */
@@ -345,7 +345,7 @@ tioca_dma_d48(struct pci_dev *pdev, uint64_t paddr)
345 return 0; 345 return 0;
346 } 346 }
347 347
348 agp_dma_extn = ca_base->ca_agp_dma_addr_extn; 348 agp_dma_extn = __sn_readq_relaxed(&ca_base->ca_agp_dma_addr_extn);
349 if (node_upper != (agp_dma_extn >> CA_AGP_DMA_NODE_ID_SHFT)) { 349 if (node_upper != (agp_dma_extn >> CA_AGP_DMA_NODE_ID_SHFT)) {
350 printk(KERN_ERR "%s: coretalk upper node (%u) " 350 printk(KERN_ERR "%s: coretalk upper node (%u) "
351 "mismatch with ca_agp_dma_addr_extn (%lu)\n", 351 "mismatch with ca_agp_dma_addr_extn (%lu)\n",
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c
index 8e75db2b825d..9f03d4e5121c 100644
--- a/arch/ia64/sn/pci/tioce_provider.c
+++ b/arch/ia64/sn/pci/tioce_provider.c
@@ -11,6 +11,7 @@
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <asm/sn/sn_sal.h> 12#include <asm/sn/sn_sal.h>
13#include <asm/sn/addrs.h> 13#include <asm/sn/addrs.h>
14#include <asm/sn/io.h>
14#include <asm/sn/pcidev.h> 15#include <asm/sn/pcidev.h>
15#include <asm/sn/pcibus_provider_defs.h> 16#include <asm/sn/pcibus_provider_defs.h>
16#include <asm/sn/tioce_provider.h> 17#include <asm/sn/tioce_provider.h>
@@ -227,7 +228,7 @@ tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
227 228
228 ate = ATE_MAKE(addr, pagesize); 229 ate = ATE_MAKE(addr, pagesize);
229 ate_shadow[i + j] = ate; 230 ate_shadow[i + j] = ate;
230 ate_reg[i + j] = ate; 231 writeq(ate, &ate_reg[i + j]);
231 addr += pagesize; 232 addr += pagesize;
232 } 233 }
233 234
@@ -268,10 +269,10 @@ tioce_dma_d32(struct pci_dev *pdev, uint64_t ct_addr)
268 pcidev_to_tioce(pdev, &ce_mmr, &ce_kern, &port); 269 pcidev_to_tioce(pdev, &ce_mmr, &ce_kern, &port);
269 270
270 if (ce_kern->ce_port[port].dirmap_refcnt == 0) { 271 if (ce_kern->ce_port[port].dirmap_refcnt == 0) {
271 volatile uint64_t tmp; 272 uint64_t tmp;
272 273
273 ce_kern->ce_port[port].dirmap_shadow = ct_upper; 274 ce_kern->ce_port[port].dirmap_shadow = ct_upper;
274 ce_mmr->ce_ure_dir_map[port] = ct_upper; 275 writeq(ct_upper, &ce_mmr->ce_ure_dir_map[port]);
275 tmp = ce_mmr->ce_ure_dir_map[port]; 276 tmp = ce_mmr->ce_ure_dir_map[port];
276 dma_ok = 1; 277 dma_ok = 1;
277 } else 278 } else
@@ -343,7 +344,7 @@ tioce_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir)
343 if (TIOCE_D32_ADDR(bus_addr)) { 344 if (TIOCE_D32_ADDR(bus_addr)) {
344 if (--ce_kern->ce_port[port].dirmap_refcnt == 0) { 345 if (--ce_kern->ce_port[port].dirmap_refcnt == 0) {
345 ce_kern->ce_port[port].dirmap_shadow = 0; 346 ce_kern->ce_port[port].dirmap_shadow = 0;
346 ce_mmr->ce_ure_dir_map[port] = 0; 347 writeq(0, &ce_mmr->ce_ure_dir_map[port]);
347 } 348 }
348 } else { 349 } else {
349 struct tioce_dmamap *map; 350 struct tioce_dmamap *map;
@@ -582,18 +583,18 @@ tioce_kern_init(struct tioce_common *tioce_common)
582 */ 583 */
583 584
584 tioce_mmr = (struct tioce *)tioce_common->ce_pcibus.bs_base; 585 tioce_mmr = (struct tioce *)tioce_common->ce_pcibus.bs_base;
585 tioce_mmr->ce_ure_page_map &= ~CE_URE_PAGESIZE_MASK; 586 __sn_clrq_relaxed(&tioce_mmr->ce_ure_page_map, CE_URE_PAGESIZE_MASK);
586 tioce_mmr->ce_ure_page_map |= CE_URE_256K_PAGESIZE; 587 __sn_setq_relaxed(&tioce_mmr->ce_ure_page_map, CE_URE_256K_PAGESIZE);
587 tioce_kern->ce_ate3240_pagesize = KB(256); 588 tioce_kern->ce_ate3240_pagesize = KB(256);
588 589
589 for (i = 0; i < TIOCE_NUM_M40_ATES; i++) { 590 for (i = 0; i < TIOCE_NUM_M40_ATES; i++) {
590 tioce_kern->ce_ate40_shadow[i] = 0; 591 tioce_kern->ce_ate40_shadow[i] = 0;
591 tioce_mmr->ce_ure_ate40[i] = 0; 592 writeq(0, &tioce_mmr->ce_ure_ate40[i]);
592 } 593 }
593 594
594 for (i = 0; i < TIOCE_NUM_M3240_ATES; i++) { 595 for (i = 0; i < TIOCE_NUM_M3240_ATES; i++) {
595 tioce_kern->ce_ate3240_shadow[i] = 0; 596 tioce_kern->ce_ate3240_shadow[i] = 0;
596 tioce_mmr->ce_ure_ate3240[i] = 0; 597 writeq(0, &tioce_mmr->ce_ure_ate3240[i]);
597 } 598 }
598 599
599 return tioce_kern; 600 return tioce_kern;
@@ -665,7 +666,7 @@ tioce_force_interrupt(struct sn_irq_info *sn_irq_info)
665 default: 666 default:
666 return; 667 return;
667 } 668 }
668 ce_mmr->ce_adm_force_int = force_int_val; 669 writeq(force_int_val, &ce_mmr->ce_adm_force_int);
669} 670}
670 671
671/** 672/**
@@ -686,6 +687,7 @@ tioce_target_interrupt(struct sn_irq_info *sn_irq_info)
686 struct tioce_common *ce_common; 687 struct tioce_common *ce_common;
687 struct tioce *ce_mmr; 688 struct tioce *ce_mmr;
688 int bit; 689 int bit;
690 uint64_t vector;
689 691
690 pcidev_info = (struct pcidev_info *)sn_irq_info->irq_pciioinfo; 692 pcidev_info = (struct pcidev_info *)sn_irq_info->irq_pciioinfo;
691 if (!pcidev_info) 693 if (!pcidev_info)
@@ -696,11 +698,11 @@ tioce_target_interrupt(struct sn_irq_info *sn_irq_info)
696 698
697 bit = sn_irq_info->irq_int_bit; 699 bit = sn_irq_info->irq_int_bit;
698 700
699 ce_mmr->ce_adm_int_mask |= (1UL << bit); 701 __sn_setq_relaxed(&ce_mmr->ce_adm_int_mask, (1UL << bit));
700 ce_mmr->ce_adm_int_dest[bit] = 702 vector = (uint64_t)sn_irq_info->irq_irq << INTR_VECTOR_SHFT;
701 ((uint64_t)sn_irq_info->irq_irq << INTR_VECTOR_SHFT) | 703 vector |= sn_irq_info->irq_xtalkaddr;
702 sn_irq_info->irq_xtalkaddr; 704 writeq(vector, &ce_mmr->ce_adm_int_dest[bit]);
703 ce_mmr->ce_adm_int_mask &= ~(1UL << bit); 705 __sn_clrq_relaxed(&ce_mmr->ce_adm_int_mask, (1UL << bit));
704 706
705 tioce_force_interrupt(sn_irq_info); 707 tioce_force_interrupt(sn_irq_info);
706} 708}
diff --git a/drivers/Makefile b/drivers/Makefile
index 1a109a6dd953..65670be6ff1a 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -5,7 +5,7 @@
5# Rewritten to use lists instead of if-statements. 5# Rewritten to use lists instead of if-statements.
6# 6#
7 7
8obj-$(CONFIG_PCI) += pci/ 8obj-$(CONFIG_PCI) += pci/ usb/
9obj-$(CONFIG_PARISC) += parisc/ 9obj-$(CONFIG_PARISC) += parisc/
10obj-y += video/ 10obj-y += video/
11obj-$(CONFIG_ACPI) += acpi/ 11obj-$(CONFIG_ACPI) += acpi/
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 15e6a8f951f1..0d2e101e4f15 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -30,23 +30,6 @@ LIST_HEAD(dpm_off_irq);
30DECLARE_MUTEX(dpm_sem); 30DECLARE_MUTEX(dpm_sem);
31DECLARE_MUTEX(dpm_list_sem); 31DECLARE_MUTEX(dpm_list_sem);
32 32
33/*
34 * PM Reference Counting.
35 */
36
37static inline void device_pm_hold(struct device * dev)
38{
39 if (dev)
40 atomic_inc(&dev->power.pm_users);
41}
42
43static inline void device_pm_release(struct device * dev)
44{
45 if (dev)
46 atomic_dec(&dev->power.pm_users);
47}
48
49
50/** 33/**
51 * device_pm_set_parent - Specify power dependency. 34 * device_pm_set_parent - Specify power dependency.
52 * @dev: Device who needs power. 35 * @dev: Device who needs power.
@@ -62,10 +45,8 @@ static inline void device_pm_release(struct device * dev)
62 45
63void device_pm_set_parent(struct device * dev, struct device * parent) 46void device_pm_set_parent(struct device * dev, struct device * parent)
64{ 47{
65 struct device * old_parent = dev->power.pm_parent; 48 put_device(dev->power.pm_parent);
66 device_pm_release(old_parent); 49 dev->power.pm_parent = get_device(parent);
67 dev->power.pm_parent = parent;
68 device_pm_hold(parent);
69} 50}
70EXPORT_SYMBOL_GPL(device_pm_set_parent); 51EXPORT_SYMBOL_GPL(device_pm_set_parent);
71 52
@@ -75,7 +56,6 @@ int device_pm_add(struct device * dev)
75 56
76 pr_debug("PM: Adding info for %s:%s\n", 57 pr_debug("PM: Adding info for %s:%s\n",
77 dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); 58 dev->bus ? dev->bus->name : "No Bus", dev->kobj.name);
78 atomic_set(&dev->power.pm_users, 0);
79 down(&dpm_list_sem); 59 down(&dpm_list_sem);
80 list_add_tail(&dev->power.entry, &dpm_active); 60 list_add_tail(&dev->power.entry, &dpm_active);
81 device_pm_set_parent(dev, dev->parent); 61 device_pm_set_parent(dev, dev->parent);
@@ -91,7 +71,7 @@ void device_pm_remove(struct device * dev)
91 dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); 71 dev->bus ? dev->bus->name : "No Bus", dev->kobj.name);
92 down(&dpm_list_sem); 72 down(&dpm_list_sem);
93 dpm_sysfs_remove(dev); 73 dpm_sysfs_remove(dev);
94 device_pm_release(dev->power.pm_parent); 74 put_device(dev->power.pm_parent);
95 list_del_init(&dev->power.entry); 75 list_del_init(&dev->power.entry);
96 up(&dpm_list_sem); 76 up(&dpm_list_sem);
97} 77}
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index 2e700d795cf1..fb3d35a9e101 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -67,9 +67,6 @@ extern int suspend_device(struct device *, pm_message_t);
67 * runtime.c 67 * runtime.c
68 */ 68 */
69 69
70extern int dpm_runtime_suspend(struct device *, pm_message_t);
71extern void dpm_runtime_resume(struct device *);
72
73#else /* CONFIG_PM */ 70#else /* CONFIG_PM */
74 71
75 72
@@ -82,14 +79,4 @@ static inline void device_pm_remove(struct device * dev)
82 79
83} 80}
84 81
85static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state)
86{
87 return 0;
88}
89
90static inline void dpm_runtime_resume(struct device * dev)
91{
92
93}
94
95#endif 82#endif
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index e8f0519f5dfa..adbc3148c039 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -36,6 +36,7 @@ void dpm_runtime_resume(struct device * dev)
36 runtime_resume(dev); 36 runtime_resume(dev);
37 up(&dpm_sem); 37 up(&dpm_sem);
38} 38}
39EXPORT_SYMBOL(dpm_runtime_resume);
39 40
40 41
41/** 42/**
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index ed4d5006fe62..bfb23d543ff7 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -1512,7 +1512,7 @@ static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
1512 scmd->nsg = 1; 1512 scmd->nsg = 1;
1513 sg = &scmd->sgv[0]; 1513 sg = &scmd->sgv[0];
1514 sg->page = virt_to_page(sc->top_sense); 1514 sg->page = virt_to_page(sc->top_sense);
1515 sg->offset = (unsigned int)sc->top_sense & (PAGE_SIZE-1); 1515 sg->offset = (unsigned long)sc->top_sense & (PAGE_SIZE-1);
1516 sg->length = UB_SENSE_SIZE; 1516 sg->length = UB_SENSE_SIZE;
1517 scmd->len = UB_SENSE_SIZE; 1517 scmd->len = UB_SENSE_SIZE;
1518 scmd->lun = cmd->lun; 1518 scmd->lun = cmd->lun;
@@ -1891,7 +1891,7 @@ static int ub_sync_read_cap(struct ub_dev *sc, struct ub_lun *lun,
1891 cmd->nsg = 1; 1891 cmd->nsg = 1;
1892 sg = &cmd->sgv[0]; 1892 sg = &cmd->sgv[0];
1893 sg->page = virt_to_page(p); 1893 sg->page = virt_to_page(p);
1894 sg->offset = (unsigned int)p & (PAGE_SIZE-1); 1894 sg->offset = (unsigned long)p & (PAGE_SIZE-1);
1895 sg->length = 8; 1895 sg->length = 8;
1896 cmd->len = 8; 1896 cmd->len = 8;
1897 cmd->lun = lun; 1897 cmd->lun = lun;
diff --git a/drivers/char/agp/sgi-agp.c b/drivers/char/agp/sgi-agp.c
index d3aa159c9dec..7957fc91f6ad 100644
--- a/drivers/char/agp/sgi-agp.c
+++ b/drivers/char/agp/sgi-agp.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/agp_backend.h> 18#include <linux/agp_backend.h>
19#include <asm/sn/addrs.h> 19#include <asm/sn/addrs.h>
20#include <asm/sn/io.h>
20#include <asm/sn/pcidev.h> 21#include <asm/sn/pcidev.h>
21#include <asm/sn/pcibus_provider_defs.h> 22#include <asm/sn/pcibus_provider_defs.h>
22#include <asm/sn/tioca_provider.h> 23#include <asm/sn/tioca_provider.h>
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index 12006182f575..78c89a3e7825 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -441,7 +441,7 @@ static irqreturn_t
441mmtimer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 441mmtimer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
442{ 442{
443 int i; 443 int i;
444 mmtimer_t *base = timers + cpuid_to_cnodeid(smp_processor_id()) * 444 mmtimer_t *base = timers + cpu_to_node(smp_processor_id()) *
445 NUM_COMPARATORS; 445 NUM_COMPARATORS;
446 unsigned long expires = 0; 446 unsigned long expires = 0;
447 int result = IRQ_NONE; 447 int result = IRQ_NONE;
@@ -608,7 +608,7 @@ static int sgi_timer_set(struct k_itimer *timr, int flags,
608 */ 608 */
609 preempt_disable(); 609 preempt_disable();
610 610
611 nodeid = cpuid_to_cnodeid(smp_processor_id()); 611 nodeid = cpu_to_node(smp_processor_id());
612 base = timers + nodeid * NUM_COMPARATORS; 612 base = timers + nodeid * NUM_COMPARATORS;
613retry: 613retry:
614 /* Don't use an allocated timer, or a deleted one that's pending */ 614 /* Don't use an allocated timer, or a deleted one that's pending */
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c
index 1758a83327e5..0e7d216e7eb0 100644
--- a/drivers/char/snsc.c
+++ b/drivers/char/snsc.c
@@ -377,7 +377,7 @@ scdrv_init(void)
377 dev_t first_dev, dev; 377 dev_t first_dev, dev;
378 nasid_t event_nasid = ia64_sn_get_console_nasid(); 378 nasid_t event_nasid = ia64_sn_get_console_nasid();
379 379
380 if (alloc_chrdev_region(&first_dev, 0, numionodes, 380 if (alloc_chrdev_region(&first_dev, 0, num_cnodes,
381 SYSCTL_BASENAME) < 0) { 381 SYSCTL_BASENAME) < 0) {
382 printk("%s: failed to register SN system controller device\n", 382 printk("%s: failed to register SN system controller device\n",
383 __FUNCTION__); 383 __FUNCTION__);
@@ -385,7 +385,7 @@ scdrv_init(void)
385 } 385 }
386 snsc_class = class_create(THIS_MODULE, SYSCTL_BASENAME); 386 snsc_class = class_create(THIS_MODULE, SYSCTL_BASENAME);
387 387
388 for (cnode = 0; cnode < numionodes; cnode++) { 388 for (cnode = 0; cnode < num_cnodes; cnode++) {
389 geoid = cnodeid_get_geoid(cnode); 389 geoid = cnodeid_get_geoid(cnode);
390 devnamep = devname; 390 devnamep = devname;
391 format_module_id(devnamep, geo_module(geoid), 391 format_module_id(devnamep, geo_module(geoid),
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index ee1605906a3e..bbd9c2323d8c 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -7,6 +7,9 @@
7 * 7 *
8 * Copyright (c) 1999 Martin Mares <mj@ucw.cz> 8 * Copyright (c) 1999 Martin Mares <mj@ucw.cz>
9 * 9 *
10 * Init/reset quirks for USB host controllers should be in the
11 * USB quirks file, where their drivers can access reuse it.
12 *
10 * The bridge optimization stuff has been removed. If you really 13 * The bridge optimization stuff has been removed. If you really
11 * have a silly BIOS which is unable to set your host bridge right, 14 * have a silly BIOS which is unable to set your host bridge right,
12 * use the PowerTweak utility (see http://powertweak.sourceforge.net). 15 * use the PowerTweak utility (see http://powertweak.sourceforge.net).
@@ -645,28 +648,6 @@ static void quirk_via_irq(struct pci_dev *dev)
645DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_via_irq); 648DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_via_irq);
646 649
647/* 650/*
648 * PIIX3 USB: We have to disable USB interrupts that are
649 * hardwired to PIRQD# and may be shared with an
650 * external device.
651 *
652 * Legacy Support Register (LEGSUP):
653 * bit13: USB PIRQ Enable (USBPIRQDEN),
654 * bit4: Trap/SMI On IRQ Enable (USBSMIEN).
655 *
656 * We mask out all r/wc bits, too.
657 */
658static void __devinit quirk_piix3_usb(struct pci_dev *dev)
659{
660 u16 legsup;
661
662 pci_read_config_word(dev, 0xc0, &legsup);
663 legsup &= 0x50ef;
664 pci_write_config_word(dev, 0xc0, legsup);
665}
666DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371SB_2, quirk_piix3_usb );
667DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_2, quirk_piix3_usb );
668
669/*
670 * VIA VT82C598 has its device ID settable and many BIOSes 651 * VIA VT82C598 has its device ID settable and many BIOSes
671 * set it to the ID of VT82C597 for backward compatibility. 652 * set it to the ID of VT82C597 for backward compatibility.
672 * We need to switch it off to be able to recognize the real 653 * We need to switch it off to be able to recognize the real
@@ -1039,234 +1020,6 @@ static void __init quirk_sis_96x_smbus(struct pci_dev *dev)
1039 pci_read_config_byte(dev, 0x77, &val); 1020 pci_read_config_byte(dev, 0x77, &val);
1040} 1021}
1041 1022
1042
1043#define UHCI_USBLEGSUP 0xc0 /* legacy support */
1044#define UHCI_USBCMD 0 /* command register */
1045#define UHCI_USBSTS 2 /* status register */
1046#define UHCI_USBINTR 4 /* interrupt register */
1047#define UHCI_USBLEGSUP_DEFAULT 0x2000 /* only PIRQ enable set */
1048#define UHCI_USBCMD_RUN (1 << 0) /* RUN/STOP bit */
1049#define UHCI_USBCMD_GRESET (1 << 2) /* Global reset */
1050#define UHCI_USBCMD_CONFIGURE (1 << 6) /* config semaphore */
1051#define UHCI_USBSTS_HALTED (1 << 5) /* HCHalted bit */
1052
1053#define OHCI_CONTROL 0x04
1054#define OHCI_CMDSTATUS 0x08
1055#define OHCI_INTRSTATUS 0x0c
1056#define OHCI_INTRENABLE 0x10
1057#define OHCI_INTRDISABLE 0x14
1058#define OHCI_OCR (1 << 3) /* ownership change request */
1059#define OHCI_CTRL_IR (1 << 8) /* interrupt routing */
1060#define OHCI_INTR_OC (1 << 30) /* ownership change */
1061
1062#define EHCI_HCC_PARAMS 0x08 /* extended capabilities */
1063#define EHCI_USBCMD 0 /* command register */
1064#define EHCI_USBCMD_RUN (1 << 0) /* RUN/STOP bit */
1065#define EHCI_USBSTS 4 /* status register */
1066#define EHCI_USBSTS_HALTED (1 << 12) /* HCHalted bit */
1067#define EHCI_USBINTR 8 /* interrupt register */
1068#define EHCI_USBLEGSUP 0 /* legacy support register */
1069#define EHCI_USBLEGSUP_BIOS (1 << 16) /* BIOS semaphore */
1070#define EHCI_USBLEGSUP_OS (1 << 24) /* OS semaphore */
1071#define EHCI_USBLEGCTLSTS 4 /* legacy control/status */
1072#define EHCI_USBLEGCTLSTS_SOOE (1 << 13) /* SMI on ownership change */
1073
1074int usb_early_handoff __devinitdata = 0;
1075static int __init usb_handoff_early(char *str)
1076{
1077 usb_early_handoff = 1;
1078 return 0;
1079}
1080__setup("usb-handoff", usb_handoff_early);
1081
1082static void __devinit quirk_usb_handoff_uhci(struct pci_dev *pdev)
1083{
1084 unsigned long base = 0;
1085 int wait_time, delta;
1086 u16 val, sts;
1087 int i;
1088
1089 for (i = 0; i < PCI_ROM_RESOURCE; i++)
1090 if ((pci_resource_flags(pdev, i) & IORESOURCE_IO)) {
1091 base = pci_resource_start(pdev, i);
1092 break;
1093 }
1094
1095 if (!base)
1096 return;
1097
1098 /*
1099 * stop controller
1100 */
1101 sts = inw(base + UHCI_USBSTS);
1102 val = inw(base + UHCI_USBCMD);
1103 val &= ~(u16)(UHCI_USBCMD_RUN | UHCI_USBCMD_CONFIGURE);
1104 outw(val, base + UHCI_USBCMD);
1105
1106 /*
1107 * wait while it stops if it was running
1108 */
1109 if ((sts & UHCI_USBSTS_HALTED) == 0)
1110 {
1111 wait_time = 1000;
1112 delta = 100;
1113
1114 do {
1115 outw(0x1f, base + UHCI_USBSTS);
1116 udelay(delta);
1117 wait_time -= delta;
1118 val = inw(base + UHCI_USBSTS);
1119 if (val & UHCI_USBSTS_HALTED)
1120 break;
1121 } while (wait_time > 0);
1122 }
1123
1124 /*
1125 * disable interrupts & legacy support
1126 */
1127 outw(0, base + UHCI_USBINTR);
1128 outw(0x1f, base + UHCI_USBSTS);
1129 pci_read_config_word(pdev, UHCI_USBLEGSUP, &val);
1130 if (val & 0xbf)
1131 pci_write_config_word(pdev, UHCI_USBLEGSUP, UHCI_USBLEGSUP_DEFAULT);
1132
1133}
1134
1135static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
1136{
1137 void __iomem *base;
1138 int wait_time;
1139
1140 base = ioremap_nocache(pci_resource_start(pdev, 0),
1141 pci_resource_len(pdev, 0));
1142 if (base == NULL) return;
1143
1144 if (readl(base + OHCI_CONTROL) & OHCI_CTRL_IR) {
1145 wait_time = 500; /* 0.5 seconds */
1146 writel(OHCI_INTR_OC, base + OHCI_INTRENABLE);
1147 writel(OHCI_OCR, base + OHCI_CMDSTATUS);
1148 while (wait_time > 0 &&
1149 readl(base + OHCI_CONTROL) & OHCI_CTRL_IR) {
1150 wait_time -= 10;
1151 msleep(10);
1152 }
1153 }
1154
1155 /*
1156 * disable interrupts
1157 */
1158 writel(~(u32)0, base + OHCI_INTRDISABLE);
1159 writel(~(u32)0, base + OHCI_INTRSTATUS);
1160
1161 iounmap(base);
1162}
1163
1164static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
1165{
1166 int wait_time, delta;
1167 void __iomem *base, *op_reg_base;
1168 u32 hcc_params, val, temp;
1169 u8 cap_length;
1170
1171 base = ioremap_nocache(pci_resource_start(pdev, 0),
1172 pci_resource_len(pdev, 0));
1173 if (base == NULL) return;
1174
1175 cap_length = readb(base);
1176 op_reg_base = base + cap_length;
1177 hcc_params = readl(base + EHCI_HCC_PARAMS);
1178 hcc_params = (hcc_params >> 8) & 0xff;
1179 if (hcc_params) {
1180 pci_read_config_dword(pdev,
1181 hcc_params + EHCI_USBLEGSUP,
1182 &val);
1183 if (((val & 0xff) == 1) && (val & EHCI_USBLEGSUP_BIOS)) {
1184 /*
1185 * Ok, BIOS is in smm mode, try to hand off...
1186 */
1187 pci_read_config_dword(pdev,
1188 hcc_params + EHCI_USBLEGCTLSTS,
1189 &temp);
1190 pci_write_config_dword(pdev,
1191 hcc_params + EHCI_USBLEGCTLSTS,
1192 temp | EHCI_USBLEGCTLSTS_SOOE);
1193 val |= EHCI_USBLEGSUP_OS;
1194 pci_write_config_dword(pdev,
1195 hcc_params + EHCI_USBLEGSUP,
1196 val);
1197
1198 wait_time = 500;
1199 do {
1200 msleep(10);
1201 wait_time -= 10;
1202 pci_read_config_dword(pdev,
1203 hcc_params + EHCI_USBLEGSUP,
1204 &val);
1205 } while (wait_time && (val & EHCI_USBLEGSUP_BIOS));
1206 if (!wait_time) {
1207 /*
1208 * well, possibly buggy BIOS...
1209 */
1210 printk(KERN_WARNING "EHCI early BIOS handoff "
1211 "failed (BIOS bug ?)\n");
1212 pci_write_config_dword(pdev,
1213 hcc_params + EHCI_USBLEGSUP,
1214 EHCI_USBLEGSUP_OS);
1215 pci_write_config_dword(pdev,
1216 hcc_params + EHCI_USBLEGCTLSTS,
1217 0);
1218 }
1219 }
1220 }
1221
1222 /*
1223 * halt EHCI & disable its interrupts in any case
1224 */
1225 val = readl(op_reg_base + EHCI_USBSTS);
1226 if ((val & EHCI_USBSTS_HALTED) == 0) {
1227 val = readl(op_reg_base + EHCI_USBCMD);
1228 val &= ~EHCI_USBCMD_RUN;
1229 writel(val, op_reg_base + EHCI_USBCMD);
1230
1231 wait_time = 2000;
1232 delta = 100;
1233 do {
1234 writel(0x3f, op_reg_base + EHCI_USBSTS);
1235 udelay(delta);
1236 wait_time -= delta;
1237 val = readl(op_reg_base + EHCI_USBSTS);
1238 if ((val == ~(u32)0) || (val & EHCI_USBSTS_HALTED)) {
1239 break;
1240 }
1241 } while (wait_time > 0);
1242 }
1243 writel(0, op_reg_base + EHCI_USBINTR);
1244 writel(0x3f, op_reg_base + EHCI_USBSTS);
1245
1246 iounmap(base);
1247
1248 return;
1249}
1250
1251
1252
1253static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev)
1254{
1255 if (!usb_early_handoff)
1256 return;
1257
1258 if (pdev->class == ((PCI_CLASS_SERIAL_USB << 8) | 0x00)) { /* UHCI */
1259 quirk_usb_handoff_uhci(pdev);
1260 } else if (pdev->class == ((PCI_CLASS_SERIAL_USB << 8) | 0x10)) { /* OHCI */
1261 quirk_usb_handoff_ohci(pdev);
1262 } else if (pdev->class == ((PCI_CLASS_SERIAL_USB << 8) | 0x20)) { /* EHCI */
1263 quirk_usb_disable_ehci(pdev);
1264 }
1265
1266 return;
1267}
1268DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff);
1269
1270/* 1023/*
1271 * ... This is further complicated by the fact that some SiS96x south 1024 * ... This is further complicated by the fact that some SiS96x south
1272 * bridges pretend to be 85C503/5513 instead. In that case see if we 1025 * bridges pretend to be 85C503/5513 instead. In that case see if we
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index df014c2a7c54..a50c2bc506f2 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_USB) += core/
8 8
9obj-$(CONFIG_USB_MON) += mon/ 9obj-$(CONFIG_USB_MON) += mon/
10 10
11obj-$(CONFIG_PCI) += host/
11obj-$(CONFIG_USB_EHCI_HCD) += host/ 12obj-$(CONFIG_USB_EHCI_HCD) += host/
12obj-$(CONFIG_USB_ISP116X_HCD) += host/ 13obj-$(CONFIG_USB_ISP116X_HCD) += host/
13obj-$(CONFIG_USB_OHCI_HCD) += host/ 14obj-$(CONFIG_USB_OHCI_HCD) += host/
@@ -17,7 +18,6 @@ obj-$(CONFIG_ETRAX_USB_HOST) += host/
17 18
18obj-$(CONFIG_USB_ACM) += class/ 19obj-$(CONFIG_USB_ACM) += class/
19obj-$(CONFIG_USB_AUDIO) += class/ 20obj-$(CONFIG_USB_AUDIO) += class/
20obj-$(CONFIG_USB_BLUETOOTH_TTY) += class/
21obj-$(CONFIG_USB_MIDI) += class/ 21obj-$(CONFIG_USB_MIDI) += class/
22obj-$(CONFIG_USB_PRINTER) += class/ 22obj-$(CONFIG_USB_PRINTER) += class/
23 23
diff --git a/drivers/usb/class/Kconfig b/drivers/usb/class/Kconfig
index 333e39bb105f..ef105a92a7bd 100644
--- a/drivers/usb/class/Kconfig
+++ b/drivers/usb/class/Kconfig
@@ -28,29 +28,6 @@ config USB_AUDIO
28 To compile this driver as a module, choose M here: the 28 To compile this driver as a module, choose M here: the
29 module will be called audio. 29 module will be called audio.
30 30
31comment "USB Bluetooth TTY can only be used with disabled Bluetooth subsystem"
32 depends on USB && BT
33
34config USB_BLUETOOTH_TTY
35 tristate "USB Bluetooth TTY support"
36 depends on USB && BT=n
37 ---help---
38 This driver implements a nonstandard tty interface to a Bluetooth
39 device that can be used only by specialized Bluetooth HCI software.
40
41 Say Y here if you want to use OpenBT Bluetooth stack (available
42 at <http://developer.axis.com/software>), or other TTY based
43 Bluetooth stacks, and want to connect a USB Bluetooth device
44 to your computer's USB port.
45
46 Do *not* enable this driver if you want to use generic Linux
47 Bluetooth support.
48
49 If in doubt, say N here.
50
51 To compile this driver as a module, choose M here: the
52 module will be called bluetty.
53
54config USB_MIDI 31config USB_MIDI
55 tristate "USB MIDI support" 32 tristate "USB MIDI support"
56 depends on USB && SOUND && OBSOLETE_OSS_USB_DRIVER 33 depends on USB && SOUND && OBSOLETE_OSS_USB_DRIVER
diff --git a/drivers/usb/class/Makefile b/drivers/usb/class/Makefile
index 971e5497a3fd..229471247751 100644
--- a/drivers/usb/class/Makefile
+++ b/drivers/usb/class/Makefile
@@ -5,6 +5,5 @@
5 5
6obj-$(CONFIG_USB_ACM) += cdc-acm.o 6obj-$(CONFIG_USB_ACM) += cdc-acm.o
7obj-$(CONFIG_USB_AUDIO) += audio.o 7obj-$(CONFIG_USB_AUDIO) += audio.o
8obj-$(CONFIG_USB_BLUETOOTH_TTY) += bluetty.o
9obj-$(CONFIG_USB_MIDI) += usb-midi.o 8obj-$(CONFIG_USB_MIDI) += usb-midi.o
10obj-$(CONFIG_USB_PRINTER) += usblp.o 9obj-$(CONFIG_USB_PRINTER) += usblp.o
diff --git a/drivers/usb/class/bluetty.c b/drivers/usb/class/bluetty.c
deleted file mode 100644
index 524023327c49..000000000000
--- a/drivers/usb/class/bluetty.c
+++ /dev/null
@@ -1,1279 +0,0 @@
1/*
2 * bluetty.c Version 0.13
3 *
4 * Copyright (C) 2000, 2001 Greg Kroah-Hartman <greg@kroah.com>
5 * Copyright (C) 2000 Mark Douglas Corner <mcorner@umich.edu>
6 *
7 * USB Bluetooth TTY driver, based on the Bluetooth Spec version 1.0B
8 *
9 * (2001/11/30) Version 0.13 gkh
10 * - added locking patch from Masoodur Rahman <rmasoodu@in.ibm.com>
11 * - removed active variable, as open_count will do.
12 *
13 * (2001/07/09) Version 0.12 gkh
14 * - removed in_interrupt() call, as it doesn't make sense to do
15 * that anymore.
16 *
17 * (2001/06/05) Version 0.11 gkh
18 * - Fixed problem with read urb status saying that we have shutdown,
19 * and that we shouldn't resubmit the urb. Patch from unknown.
20 *
21 * (2001/05/28) Version 0.10 gkh
22 * - Fixed problem with using data from userspace in the bluetooth_write
23 * function as found by the CHECKER project.
24 * - Added a buffer to the write_urb_pool which reduces the number of
25 * buffers being created and destroyed for ever write. Also cleans
26 * up the logic a bit.
27 * - Added a buffer to the control_urb_pool which fixes a memory leak
28 * when the device is removed from the system.
29 *
30 * (2001/05/28) Version 0.9 gkh
31 * Fixed problem with bluetooth==NULL for bluetooth_read_bulk_callback
32 * which was found by both the CHECKER project and Mikko Rahkonen.
33 *
34 * (08/04/2001) gb
35 * Identify version on module load.
36 *
37 * (2001/03/10) Version 0.8 gkh
38 * Fixed problem with not unlinking interrupt urb on device close
39 * and resubmitting the read urb on error with bluetooth struct.
40 * Thanks to Narayan Mohanram <narayan@RovingNetworks.com> for the
41 * fixes.
42 *
43 * (11/29/2000) Version 0.7 gkh
44 * Fixed problem with overrunning the tty flip buffer.
45 * Removed unneeded NULL pointer initialization.
46 *
47 * (10/05/2000) Version 0.6 gkh
48 * Fixed bug with urb->dev not being set properly, now that the usb
49 * core needs it.
50 * Got a real major id number and name.
51 *
52 * (08/06/2000) Version 0.5 gkh
53 * Fixed problem of not resubmitting the bulk read urb if there is
54 * an error in the callback. Ericsson devices seem to need this.
55 *
56 * (07/11/2000) Version 0.4 gkh
57 * Fixed bug in disconnect for when we call tty_hangup
58 * Fixed bug in bluetooth_ctrl_msg where the bluetooth struct was not
59 * getting attached to the control urb properly.
60 * Fixed bug in bluetooth_write where we pay attention to the result
61 * of bluetooth_ctrl_msg.
62 *
63 * (08/03/2000) Version 0.3 gkh mdc
64 * Merged in Mark's changes to make the driver play nice with the Axis
65 * stack.
66 * Made the write bulk use an urb pool to enable larger transfers with
67 * fewer calls to the driver.
68 * Fixed off by one bug in acl pkt receive
69 * Made packet counters specific to each bluetooth device
70 * Added checks for zero length callbacks
71 * Added buffers for int and bulk packets. Had to do this otherwise
72 * packet types could intermingle.
73 * Made a control urb pool for the control messages.
74 *
75 * (07/11/2000) Version 0.2 gkh
76 * Fixed a small bug found by Nils Faerber in the usb_bluetooth_probe
77 * function.
78 *
79 * (07/09/2000) Version 0.1 gkh
80 * Initial release. Has support for sending ACL data (which is really just
81 * a HCI frame.) Raw HCI commands and HCI events are not supported.
82 * A ioctl will probably be needed for the HCI commands and events in the
83 * future. All isoch endpoints are ignored at this time also.
84 * This driver should work for all currently shipping USB Bluetooth
85 * devices at this time :)
86 *
87 */
88
89/*
90 * This program is free software; you can redistribute it and/or modify
91 * it under the terms of the GNU General Public License as published by
92 * the Free Software Foundation; either version 2 of the License, or
93 * (at your option) any later version.
94 *
95 * This program is distributed in the hope that it will be useful,
96 * but WITHOUT ANY WARRANTY; without even the implied warranty of
97 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98 * GNU General Public License for more details.
99 *
100 * You should have received a copy of the GNU General Public License
101 * along with this program; if not, write to the Free Software
102 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
103 */
104
105
106#include <linux/kernel.h>
107#include <linux/errno.h>
108#include <linux/init.h>
109#include <linux/slab.h>
110#include <linux/tty.h>
111#include <linux/tty_driver.h>
112#include <linux/tty_flip.h>
113#include <linux/module.h>
114#include <asm/uaccess.h>
115
116#define DEBUG
117#include <linux/usb.h>
118
119/*
120 * Version Information
121 */
122#define DRIVER_VERSION "v0.13"
123#define DRIVER_AUTHOR "Greg Kroah-Hartman, Mark Douglas Corner"
124#define DRIVER_DESC "USB Bluetooth tty driver"
125
126/* define this if you have hardware that is not good */
127/*#define BTBUGGYHARDWARE */
128
129/* Class, SubClass, and Protocol codes that describe a Bluetooth device */
130#define WIRELESS_CLASS_CODE 0xe0
131#define RF_SUBCLASS_CODE 0x01
132#define BLUETOOTH_PROGRAMMING_PROTOCOL_CODE 0x01
133
134
135#define BLUETOOTH_TTY_MAJOR 216 /* real device node major id */
136#define BLUETOOTH_TTY_MINORS 256 /* whole lotta bluetooth devices */
137
138#define USB_BLUETOOTH_MAGIC 0x6d02 /* magic number for bluetooth struct */
139
140#define BLUETOOTH_CONTROL_REQUEST_TYPE 0x20
141
142/* Bluetooth packet types */
143#define CMD_PKT 0x01
144#define ACL_PKT 0x02
145#define SCO_PKT 0x03
146#define EVENT_PKT 0x04
147#define ERROR_PKT 0x05
148#define NEG_PKT 0x06
149
150/* Message sizes */
151#define MAX_EVENT_SIZE 0xFF
152#define EVENT_HDR_SIZE 3 /* 2 for the header + 1 for the type indicator */
153#define EVENT_BUFFER_SIZE (MAX_EVENT_SIZE + EVENT_HDR_SIZE)
154
155#define MAX_ACL_SIZE 0xFFFF
156#define ACL_HDR_SIZE 5 /* 4 for the header + 1 for the type indicator */
157#define ACL_BUFFER_SIZE (MAX_ACL_SIZE + ACL_HDR_SIZE)
158
159/* parity check flag */
160#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
161
162#define CHAR2INT16(c1,c0) (((u32)((c1) & 0xff) << 8) + (u32)((c0) & 0xff))
163
164#define NUM_BULK_URBS 24
165#define NUM_CONTROL_URBS 16
166
167struct usb_bluetooth {
168 int magic;
169 struct usb_device * dev;
170 struct tty_driver * tty_driver; /* the tty_driver for this device */
171 struct tty_struct * tty; /* the corresponding tty for this port */
172
173 unsigned char minor; /* the starting minor number for this device */
174 int throttle; /* throttled by tty layer */
175 int open_count;
176
177 __u8 control_out_bInterfaceNum;
178 struct urb * control_urb_pool[NUM_CONTROL_URBS];
179 struct usb_ctrlrequest dr[NUM_CONTROL_URBS];
180
181 unsigned char * interrupt_in_buffer;
182 struct urb * interrupt_in_urb;
183 __u8 interrupt_in_endpointAddress;
184 __u8 interrupt_in_interval;
185 int interrupt_in_buffer_size;
186
187 unsigned char * bulk_in_buffer;
188 struct urb * read_urb;
189 __u8 bulk_in_endpointAddress;
190 int bulk_in_buffer_size;
191
192 int bulk_out_buffer_size;
193 __u8 bulk_out_endpointAddress;
194
195 wait_queue_head_t write_wait;
196
197 struct work_struct work; /* work queue entry for line discipline waking up */
198
199 unsigned int int_packet_pos;
200 unsigned char int_buffer[EVENT_BUFFER_SIZE];
201 unsigned int bulk_packet_pos;
202 unsigned char bulk_buffer[ACL_BUFFER_SIZE]; /* 64k preallocated, fix? */
203 struct semaphore lock;
204};
205
206
207/* local function prototypes */
208static int bluetooth_open (struct tty_struct *tty, struct file *filp);
209static void bluetooth_close (struct tty_struct *tty, struct file *filp);
210static int bluetooth_write (struct tty_struct *tty, const unsigned char *buf, int count);
211static int bluetooth_write_room (struct tty_struct *tty);
212static int bluetooth_chars_in_buffer (struct tty_struct *tty);
213static void bluetooth_throttle (struct tty_struct *tty);
214static void bluetooth_unthrottle (struct tty_struct *tty);
215static int bluetooth_ioctl (struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg);
216static void bluetooth_set_termios (struct tty_struct *tty, struct termios *old);
217
218static void bluetooth_int_callback (struct urb *urb, struct pt_regs *regs);
219static void bluetooth_ctrl_callback (struct urb *urb, struct pt_regs *regs);
220static void bluetooth_read_bulk_callback (struct urb *urb, struct pt_regs *regs);
221static void bluetooth_write_bulk_callback (struct urb *urb, struct pt_regs *regs);
222
223static int usb_bluetooth_probe (struct usb_interface *intf,
224 const struct usb_device_id *id);
225static void usb_bluetooth_disconnect (struct usb_interface *intf);
226
227
228static struct usb_device_id usb_bluetooth_ids [] = {
229 { USB_DEVICE_INFO(WIRELESS_CLASS_CODE, RF_SUBCLASS_CODE, BLUETOOTH_PROGRAMMING_PROTOCOL_CODE) },
230 { } /* Terminating entry */
231};
232
233MODULE_DEVICE_TABLE (usb, usb_bluetooth_ids);
234
235static struct usb_driver usb_bluetooth_driver = {
236 .owner = THIS_MODULE,
237 .name = "bluetty",
238 .probe = usb_bluetooth_probe,
239 .disconnect = usb_bluetooth_disconnect,
240 .id_table = usb_bluetooth_ids,
241};
242
243static struct tty_driver *bluetooth_tty_driver;
244static struct usb_bluetooth *bluetooth_table[BLUETOOTH_TTY_MINORS];
245
246
247static inline int bluetooth_paranoia_check (struct usb_bluetooth *bluetooth, const char *function)
248{
249 if (!bluetooth) {
250 dbg("%s - bluetooth == NULL", function);
251 return -1;
252 }
253 if (bluetooth->magic != USB_BLUETOOTH_MAGIC) {
254 dbg("%s - bad magic number for bluetooth", function);
255 return -1;
256 }
257
258 return 0;
259}
260
261
262static inline struct usb_bluetooth* get_usb_bluetooth (struct usb_bluetooth *bluetooth, const char *function)
263{
264 if (!bluetooth ||
265 bluetooth_paranoia_check (bluetooth, function)) {
266 /* then say that we don't have a valid usb_bluetooth thing, which will
267 * end up generating -ENODEV return values */
268 return NULL;
269 }
270
271 return bluetooth;
272}
273
274
275static inline struct usb_bluetooth *get_bluetooth_by_index (int index)
276{
277 return bluetooth_table[index];
278}
279
280
281static int bluetooth_ctrl_msg (struct usb_bluetooth *bluetooth, int request, int value, const unsigned char *buf, int len)
282{
283 struct urb *urb = NULL;
284 struct usb_ctrlrequest *dr = NULL;
285 int i;
286 int status;
287
288 dbg ("%s", __FUNCTION__);
289
290 /* try to find a free urb in our list */
291 for (i = 0; i < NUM_CONTROL_URBS; ++i) {
292 if (bluetooth->control_urb_pool[i]->status != -EINPROGRESS) {
293 urb = bluetooth->control_urb_pool[i];
294 dr = &bluetooth->dr[i];
295 break;
296 }
297 }
298 if (urb == NULL) {
299 dbg ("%s - no free urbs", __FUNCTION__);
300 return -ENOMEM;
301 }
302
303 /* keep increasing the urb transfer buffer to fit the size of the message */
304 if (urb->transfer_buffer == NULL) {
305 urb->transfer_buffer = kmalloc (len, GFP_KERNEL);
306 if (urb->transfer_buffer == NULL) {
307 err ("%s - out of memory", __FUNCTION__);
308 return -ENOMEM;
309 }
310 }
311 if (urb->transfer_buffer_length < len) {
312 kfree(urb->transfer_buffer);
313 urb->transfer_buffer = kmalloc (len, GFP_KERNEL);
314 if (urb->transfer_buffer == NULL) {
315 err ("%s - out of memory", __FUNCTION__);
316 return -ENOMEM;
317 }
318 }
319 memcpy (urb->transfer_buffer, buf, len);
320
321 dr->bRequestType= BLUETOOTH_CONTROL_REQUEST_TYPE;
322 dr->bRequest = request;
323 dr->wValue = cpu_to_le16((u16) value);
324 dr->wIndex = cpu_to_le16((u16) bluetooth->control_out_bInterfaceNum);
325 dr->wLength = cpu_to_le16((u16) len);
326
327 usb_fill_control_urb (urb, bluetooth->dev, usb_sndctrlpipe(bluetooth->dev, 0),
328 (unsigned char*)dr, urb->transfer_buffer, len, bluetooth_ctrl_callback, bluetooth);
329
330 /* send it down the pipe */
331 status = usb_submit_urb(urb, GFP_KERNEL);
332 if (status)
333 dbg("%s - usb_submit_urb(control) failed with status = %d", __FUNCTION__, status);
334
335 return status;
336}
337
338
339
340
341
342/*****************************************************************************
343 * Driver tty interface functions
344 *****************************************************************************/
345static int bluetooth_open (struct tty_struct *tty, struct file * filp)
346{
347 struct usb_bluetooth *bluetooth;
348 int result;
349
350 dbg("%s", __FUNCTION__);
351
352 /* initialize the pointer incase something fails */
353 tty->driver_data = NULL;
354
355 /* get the bluetooth object associated with this tty pointer */
356 bluetooth = get_bluetooth_by_index (tty->index);
357
358 if (bluetooth_paranoia_check (bluetooth, __FUNCTION__)) {
359 return -ENODEV;
360 }
361
362 down (&bluetooth->lock);
363
364 ++bluetooth->open_count;
365 if (bluetooth->open_count == 1) {
366 /* set up our structure making the tty driver remember our object, and us it */
367 tty->driver_data = bluetooth;
368 bluetooth->tty = tty;
369
370 /* force low_latency on so that our tty_push actually forces the data through,
371 * otherwise it is scheduled, and with high data rates (like with OHCI) data
372 * can get lost. */
373 bluetooth->tty->low_latency = 1;
374
375 /* Reset the packet position counters */
376 bluetooth->int_packet_pos = 0;
377 bluetooth->bulk_packet_pos = 0;
378
379#ifndef BTBUGGYHARDWARE
380 /* Start reading from the device */
381 usb_fill_bulk_urb (bluetooth->read_urb, bluetooth->dev,
382 usb_rcvbulkpipe(bluetooth->dev, bluetooth->bulk_in_endpointAddress),
383 bluetooth->bulk_in_buffer,
384 bluetooth->bulk_in_buffer_size,
385 bluetooth_read_bulk_callback, bluetooth);
386 result = usb_submit_urb(bluetooth->read_urb, GFP_KERNEL);
387 if (result)
388 dbg("%s - usb_submit_urb(read bulk) failed with status %d", __FUNCTION__, result);
389#endif
390 usb_fill_int_urb (bluetooth->interrupt_in_urb, bluetooth->dev,
391 usb_rcvintpipe(bluetooth->dev, bluetooth->interrupt_in_endpointAddress),
392 bluetooth->interrupt_in_buffer,
393 bluetooth->interrupt_in_buffer_size,
394 bluetooth_int_callback, bluetooth,
395 bluetooth->interrupt_in_interval);
396 result = usb_submit_urb(bluetooth->interrupt_in_urb, GFP_KERNEL);
397 if (result)
398 dbg("%s - usb_submit_urb(interrupt in) failed with status %d", __FUNCTION__, result);
399 }
400
401 up(&bluetooth->lock);
402
403 return 0;
404}
405
406
407static void bluetooth_close (struct tty_struct *tty, struct file * filp)
408{
409 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);
410
411 if (!bluetooth) {
412 return;
413 }
414
415 dbg("%s", __FUNCTION__);
416
417 if (!bluetooth->open_count) {
418 dbg ("%s - device not opened", __FUNCTION__);
419 return;
420 }
421
422 down (&bluetooth->lock);
423
424 --bluetooth->open_count;
425 if (bluetooth->open_count <= 0) {
426 bluetooth->open_count = 0;
427
428 /* shutdown any in-flight urbs that we know about */
429 usb_kill_urb (bluetooth->read_urb);
430 usb_kill_urb (bluetooth->interrupt_in_urb);
431 }
432 up(&bluetooth->lock);
433}
434
435
436static int bluetooth_write (struct tty_struct * tty, const unsigned char *buf, int count)
437{
438 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);
439 struct urb *urb = NULL;
440 unsigned char *temp_buffer = NULL;
441 const unsigned char *current_buffer;
442 unsigned char *urb_buffer;
443 int i;
444 int retval = 0;
445
446 if (!bluetooth) {
447 return -ENODEV;
448 }
449
450 dbg("%s - %d byte(s)", __FUNCTION__, count);
451
452 if (!bluetooth->open_count) {
453 dbg ("%s - device not opened", __FUNCTION__);
454 return -EINVAL;
455 }
456
457 if (count == 0) {
458 dbg("%s - write request of 0 bytes", __FUNCTION__);
459 return 0;
460 }
461 if (count == 1) {
462 dbg("%s - write request only included type %d", __FUNCTION__, buf[0]);
463 return 1;
464 }
465
466#ifdef DEBUG
467 printk (KERN_DEBUG __FILE__ ": %s - length = %d, data = ", __FUNCTION__, count);
468 for (i = 0; i < count; ++i) {
469 printk ("%.2x ", buf[i]);
470 }
471 printk ("\n");
472#endif
473
474 current_buffer = buf;
475
476 switch (*current_buffer) {
477 /* First byte indicates the type of packet */
478 case CMD_PKT:
479 /* dbg("%s- Send cmd_pkt len:%d", __FUNCTION__, count);*/
480
481 retval = bluetooth_ctrl_msg (bluetooth, 0x00, 0x00, &current_buffer[1], count-1);
482 if (retval) {
483 goto exit;
484 }
485 retval = count;
486 break;
487
488 case ACL_PKT:
489 ++current_buffer;
490 --count;
491
492 urb_buffer = kmalloc (count, GFP_ATOMIC);
493 if (!urb_buffer) {
494 dev_err(&bluetooth->dev->dev, "out of memory\n");
495 retval = -ENOMEM;
496 goto exit;
497 }
498
499 urb = usb_alloc_urb(0, GFP_ATOMIC);
500 if (!urb) {
501 dev_err(&bluetooth->dev->dev, "no more free urbs\n");
502 kfree(urb_buffer);
503 retval = -ENOMEM;
504 goto exit;
505 }
506 memcpy (urb_buffer, current_buffer, count);
507
508 /* build up our urb */
509 usb_fill_bulk_urb(urb, bluetooth->dev,
510 usb_sndbulkpipe(bluetooth->dev,
511 bluetooth->bulk_out_endpointAddress),
512 urb_buffer,
513 count,
514 bluetooth_write_bulk_callback,
515 bluetooth);
516
517
518 /* send it down the pipe */
519 retval = usb_submit_urb(urb, GFP_KERNEL);
520 if (retval) {
521 dbg("%s - usb_submit_urb(write bulk) failed with error = %d", __FUNCTION__, retval);
522 goto exit;
523 }
524
525 /* we are done with this urb, so let the host driver
526 * really free it when it is finished with it */
527 usb_free_urb (urb);
528 retval = count + 1;
529 break;
530
531 default :
532 dbg("%s - unsupported (at this time) write type", __FUNCTION__);
533 retval = -EINVAL;
534 break;
535 }
536
537exit:
538 kfree(temp_buffer);
539
540 return retval;
541}
542
543
544static int bluetooth_write_room (struct tty_struct *tty)
545{
546 dbg("%s", __FUNCTION__);
547
548 /*
549 * We really can take anything the user throws at us
550 * but let's pick a nice big number to tell the tty
551 * layer that we have lots of free space
552 */
553 return 2048;
554}
555
556
557static int bluetooth_chars_in_buffer (struct tty_struct *tty)
558{
559 dbg("%s", __FUNCTION__);
560
561 /*
562 * We can't really account for how much data we
563 * have sent out, but hasn't made it through to the
564 * device, so just tell the tty layer that everything
565 * is flushed.
566 */
567 return 0;
568}
569
570
571static void bluetooth_throttle (struct tty_struct * tty)
572{
573 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);
574
575 if (!bluetooth) {
576 return;
577 }
578
579 dbg("%s", __FUNCTION__);
580
581 if (!bluetooth->open_count) {
582 dbg ("%s - device not open", __FUNCTION__);
583 return;
584 }
585
586 dbg("%s unsupported (at this time)", __FUNCTION__);
587
588 return;
589}
590
591
592static void bluetooth_unthrottle (struct tty_struct * tty)
593{
594 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);
595
596 if (!bluetooth) {
597 return;
598 }
599
600 dbg("%s", __FUNCTION__);
601
602 if (!bluetooth->open_count) {
603 dbg ("%s - device not open", __FUNCTION__);
604 return;
605 }
606
607 dbg("%s unsupported (at this time)", __FUNCTION__);
608}
609
610
611static int bluetooth_ioctl (struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg)
612{
613 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);
614
615 if (!bluetooth) {
616 return -ENODEV;
617 }
618
619 dbg("%s - cmd 0x%.4x", __FUNCTION__, cmd);
620
621 if (!bluetooth->open_count) {
622 dbg ("%s - device not open", __FUNCTION__);
623 return -ENODEV;
624 }
625
626 /* FIXME!!! */
627 return -ENOIOCTLCMD;
628}
629
630
631static void bluetooth_set_termios (struct tty_struct *tty, struct termios * old)
632{
633 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);
634
635 if (!bluetooth) {
636 return;
637 }
638
639 dbg("%s", __FUNCTION__);
640
641 if (!bluetooth->open_count) {
642 dbg ("%s - device not open", __FUNCTION__);
643 return;
644 }
645
646 /* FIXME!!! */
647
648 return;
649}
650
651
652#ifdef BTBUGGYHARDWARE
653void btusb_enable_bulk_read(struct tty_struct *tty){
654 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);
655 int result;
656
657 if (!bluetooth) {
658 return;
659 }
660
661 dbg("%s", __FUNCTION__);
662
663 if (!bluetooth->open_count) {
664 dbg ("%s - device not open", __FUNCTION__);
665 return;
666 }
667
668 if (bluetooth->read_urb) {
669 usb_fill_bulk_urb(bluetooth->read_urb, bluetooth->dev,
670 usb_rcvbulkpipe(bluetooth->dev, bluetooth->bulk_in_endpointAddress),
671 bluetooth->bulk_in_buffer, bluetooth->bulk_in_buffer_size,
672 bluetooth_read_bulk_callback, bluetooth);
673 result = usb_submit_urb(bluetooth->read_urb, GFP_KERNEL);
674 if (result)
675 err ("%s - failed submitting read urb, error %d", __FUNCTION__, result);
676 }
677}
678
679void btusb_disable_bulk_read(struct tty_struct *tty){
680 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)tty->driver_data, __FUNCTION__);
681
682 if (!bluetooth) {
683 return;
684 }
685
686 dbg("%s", __FUNCTION__);
687
688 if (!bluetooth->open_count) {
689 dbg ("%s - device not open", __FUNCTION__);
690 return;
691 }
692
693 if ((bluetooth->read_urb) && (bluetooth->read_urb->actual_length))
694 usb_kill_urb(bluetooth->read_urb);
695}
696#endif
697
698
699/*****************************************************************************
700 * urb callback functions
701 *****************************************************************************/
702
703
704static void bluetooth_int_callback (struct urb *urb, struct pt_regs *regs)
705{
706 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)urb->context, __FUNCTION__);
707 unsigned char *data = urb->transfer_buffer;
708 unsigned int i;
709 unsigned int count = urb->actual_length;
710 unsigned int packet_size;
711 int status;
712
713 dbg("%s", __FUNCTION__);
714
715 if (!bluetooth) {
716 dbg("%s - bad bluetooth pointer, exiting", __FUNCTION__);
717 return;
718 }
719
720 switch (urb->status) {
721 case 0:
722 /* success */
723 break;
724 case -ECONNRESET:
725 case -ENOENT:
726 case -ESHUTDOWN:
727 /* this urb is terminated, clean up */
728 dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
729 return;
730 default:
731 dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
732 goto exit;
733 }
734
735 if (!count) {
736 dbg("%s - zero length int", __FUNCTION__);
737 goto exit;
738 }
739
740
741#ifdef DEBUG
742 if (count) {
743 printk (KERN_DEBUG __FILE__ ": %s- length = %d, data = ", __FUNCTION__, count);
744 for (i = 0; i < count; ++i) {
745 printk ("%.2x ", data[i]);
746 }
747 printk ("\n");
748 }
749#endif
750
751#ifdef BTBUGGYHARDWARE
752 if ((count >= 2) && (data[0] == 0xFF) && (data[1] == 0x00)) {
753 data += 2;
754 count -= 2;
755 }
756 if (count == 0) {
757 urb->actual_length = 0;
758 goto exit;
759 }
760#endif
761 /* We add a packet type identifier to the beginning of each
762 HCI frame. This makes the data in the tty look like a
763 serial USB devices. Each HCI frame can be broken across
764 multiple URBs so we buffer them until we have a full hci
765 packet */
766
767 if (!bluetooth->int_packet_pos) {
768 bluetooth->int_buffer[0] = EVENT_PKT;
769 bluetooth->int_packet_pos++;
770 }
771
772 if (bluetooth->int_packet_pos + count > EVENT_BUFFER_SIZE) {
773 err("%s - exceeded EVENT_BUFFER_SIZE", __FUNCTION__);
774 bluetooth->int_packet_pos = 0;
775 goto exit;
776 }
777
778 memcpy (&bluetooth->int_buffer[bluetooth->int_packet_pos],
779 urb->transfer_buffer, count);
780 bluetooth->int_packet_pos += count;
781 urb->actual_length = 0;
782
783 if (bluetooth->int_packet_pos >= EVENT_HDR_SIZE)
784 packet_size = bluetooth->int_buffer[2];
785 else
786 goto exit;
787
788 if (packet_size + EVENT_HDR_SIZE < bluetooth->int_packet_pos) {
789 err("%s - packet was too long", __FUNCTION__);
790 bluetooth->int_packet_pos = 0;
791 goto exit;
792 }
793
794 if (packet_size + EVENT_HDR_SIZE == bluetooth->int_packet_pos) {
795 for (i = 0; i < bluetooth->int_packet_pos; ++i) {
796 /* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them */
797 if (bluetooth->tty->flip.count >= TTY_FLIPBUF_SIZE) {
798 tty_flip_buffer_push(bluetooth->tty);
799 }
800 tty_insert_flip_char(bluetooth->tty, bluetooth->int_buffer[i], 0);
801 }
802 tty_flip_buffer_push(bluetooth->tty);
803
804 bluetooth->int_packet_pos = 0;
805 }
806
807exit:
808 status = usb_submit_urb (urb, GFP_ATOMIC);
809 if (status)
810 err ("%s - usb_submit_urb failed with result %d",
811 __FUNCTION__, status);
812}
813
814
815static void bluetooth_ctrl_callback (struct urb *urb, struct pt_regs *regs)
816{
817 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)urb->context, __FUNCTION__);
818
819 dbg("%s", __FUNCTION__);
820
821 if (!bluetooth) {
822 dbg("%s - bad bluetooth pointer, exiting", __FUNCTION__);
823 return;
824 }
825
826 if (urb->status) {
827 dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
828 return;
829 }
830}
831
832
833static void bluetooth_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
834{
835 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)urb->context, __FUNCTION__);
836 unsigned char *data = urb->transfer_buffer;
837 unsigned int count = urb->actual_length;
838 unsigned int i;
839 unsigned int packet_size;
840 int result;
841
842
843 dbg("%s", __FUNCTION__);
844
845 if (!bluetooth) {
846 dbg("%s - bad bluetooth pointer, exiting", __FUNCTION__);
847 return;
848 }
849
850 if (urb->status) {
851 dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
852 if (urb->status == -ENOENT) {
853 dbg("%s - URB canceled, won't reschedule", __FUNCTION__);
854 return;
855 }
856 goto exit;
857 }
858
859 if (!count) {
860 dbg("%s - zero length read bulk", __FUNCTION__);
861 goto exit;
862 }
863
864#ifdef DEBUG
865 if (count) {
866 printk (KERN_DEBUG __FILE__ ": %s- length = %d, data = ", __FUNCTION__, count);
867 for (i = 0; i < count; ++i) {
868 printk ("%.2x ", data[i]);
869 }
870 printk ("\n");
871 }
872#endif
873#ifdef BTBUGGYHARDWARE
874 if ((count == 4) && (data[0] == 0x00) && (data[1] == 0x00)
875 && (data[2] == 0x00) && (data[3] == 0x00)) {
876 urb->actual_length = 0;
877 usb_fill_bulk_urb(bluetooth->read_urb, bluetooth->dev,
878 usb_rcvbulkpipe(bluetooth->dev, bluetooth->bulk_in_endpointAddress),
879 bluetooth->bulk_in_buffer, bluetooth->bulk_in_buffer_size,
880 bluetooth_read_bulk_callback, bluetooth);
881 result = usb_submit_urb(bluetooth->read_urb, GFP_KERNEL);
882 if (result)
883 err ("%s - failed resubmitting read urb, error %d", __FUNCTION__, result);
884
885 return;
886 }
887#endif
888 /* We add a packet type identifier to the beginning of each
889 HCI frame. This makes the data in the tty look like a
890 serial USB devices. Each HCI frame can be broken across
891 multiple URBs so we buffer them until we have a full hci
892 packet */
893
894 if (!bluetooth->bulk_packet_pos) {
895 bluetooth->bulk_buffer[0] = ACL_PKT;
896 bluetooth->bulk_packet_pos++;
897 }
898
899 if (bluetooth->bulk_packet_pos + count > ACL_BUFFER_SIZE) {
900 err("%s - exceeded ACL_BUFFER_SIZE", __FUNCTION__);
901 bluetooth->bulk_packet_pos = 0;
902 goto exit;
903 }
904
905 memcpy (&bluetooth->bulk_buffer[bluetooth->bulk_packet_pos],
906 urb->transfer_buffer, count);
907 bluetooth->bulk_packet_pos += count;
908 urb->actual_length = 0;
909
910 if (bluetooth->bulk_packet_pos >= ACL_HDR_SIZE) {
911 packet_size = CHAR2INT16(bluetooth->bulk_buffer[4],bluetooth->bulk_buffer[3]);
912 } else {
913 goto exit;
914 }
915
916 if (packet_size + ACL_HDR_SIZE < bluetooth->bulk_packet_pos) {
917 err("%s - packet was too long", __FUNCTION__);
918 bluetooth->bulk_packet_pos = 0;
919 goto exit;
920 }
921
922 if (packet_size + ACL_HDR_SIZE == bluetooth->bulk_packet_pos) {
923 for (i = 0; i < bluetooth->bulk_packet_pos; ++i) {
924 /* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */
925 if (bluetooth->tty->flip.count >= TTY_FLIPBUF_SIZE) {
926 tty_flip_buffer_push(bluetooth->tty);
927 }
928 tty_insert_flip_char(bluetooth->tty, bluetooth->bulk_buffer[i], 0);
929 }
930 tty_flip_buffer_push(bluetooth->tty);
931 bluetooth->bulk_packet_pos = 0;
932 }
933
934exit:
935 if (!bluetooth || !bluetooth->open_count)
936 return;
937
938 usb_fill_bulk_urb(bluetooth->read_urb, bluetooth->dev,
939 usb_rcvbulkpipe(bluetooth->dev, bluetooth->bulk_in_endpointAddress),
940 bluetooth->bulk_in_buffer, bluetooth->bulk_in_buffer_size,
941 bluetooth_read_bulk_callback, bluetooth);
942 result = usb_submit_urb(bluetooth->read_urb, GFP_KERNEL);
943 if (result)
944 err ("%s - failed resubmitting read urb, error %d", __FUNCTION__, result);
945
946 return;
947}
948
949
950static void bluetooth_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
951{
952 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)urb->context, __FUNCTION__);
953
954 dbg("%s", __FUNCTION__);
955
956 /* free up the transfer buffer, as usb_free_urb() does not do this */
957 kfree(urb->transfer_buffer);
958
959 if (!bluetooth) {
960 dbg("%s - bad bluetooth pointer, exiting", __FUNCTION__);
961 return;
962 }
963
964 if (urb->status) {
965 dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
966 return;
967 }
968
969 /* wake up our little function to let the tty layer know that something happened */
970 schedule_work(&bluetooth->work);
971}
972
973
974static void bluetooth_softint(void *private)
975{
976 struct usb_bluetooth *bluetooth = get_usb_bluetooth ((struct usb_bluetooth *)private, __FUNCTION__);
977
978 dbg("%s", __FUNCTION__);
979
980 if (!bluetooth)
981 return;
982
983 tty_wakeup(bluetooth->tty);
984}
985
986
987static int usb_bluetooth_probe (struct usb_interface *intf,
988 const struct usb_device_id *id)
989{
990 struct usb_device *dev = interface_to_usbdev (intf);
991 struct usb_bluetooth *bluetooth = NULL;
992 struct usb_host_interface *interface;
993 struct usb_endpoint_descriptor *endpoint;
994 struct usb_endpoint_descriptor *interrupt_in_endpoint[8];
995 struct usb_endpoint_descriptor *bulk_in_endpoint[8];
996 struct usb_endpoint_descriptor *bulk_out_endpoint[8];
997 int control_out_endpoint;
998
999 int minor;
1000 int buffer_size;
1001 int i;
1002 int num_interrupt_in = 0;
1003 int num_bulk_in = 0;
1004 int num_bulk_out = 0;
1005
1006 interface = intf->cur_altsetting;
1007 control_out_endpoint = interface->desc.bInterfaceNumber;
1008
1009 /* find the endpoints that we need */
1010 for (i = 0; i < interface->desc.bNumEndpoints; ++i) {
1011 endpoint = &interface->endpoint[i].desc;
1012
1013 if ((endpoint->bEndpointAddress & 0x80) &&
1014 ((endpoint->bmAttributes & 3) == 0x02)) {
1015 /* we found a bulk in endpoint */
1016 dbg("found bulk in");
1017 bulk_in_endpoint[num_bulk_in] = endpoint;
1018 ++num_bulk_in;
1019 }
1020
1021 if (((endpoint->bEndpointAddress & 0x80) == 0x00) &&
1022 ((endpoint->bmAttributes & 3) == 0x02)) {
1023 /* we found a bulk out endpoint */
1024 dbg("found bulk out");
1025 bulk_out_endpoint[num_bulk_out] = endpoint;
1026 ++num_bulk_out;
1027 }
1028
1029 if ((endpoint->bEndpointAddress & 0x80) &&
1030 ((endpoint->bmAttributes & 3) == 0x03)) {
1031 /* we found a interrupt in endpoint */
1032 dbg("found interrupt in");
1033 interrupt_in_endpoint[num_interrupt_in] = endpoint;
1034 ++num_interrupt_in;
1035 }
1036 }
1037
1038 /* according to the spec, we can only have 1 bulk_in, 1 bulk_out, and 1 interrupt_in endpoints */
1039 if ((num_bulk_in != 1) ||
1040 (num_bulk_out != 1) ||
1041 (num_interrupt_in != 1)) {
1042 dbg ("%s - improper number of endpoints. Bluetooth driver not bound.", __FUNCTION__);
1043 return -EIO;
1044 }
1045
1046 info("USB Bluetooth converter detected");
1047
1048 for (minor = 0; minor < BLUETOOTH_TTY_MINORS && bluetooth_table[minor]; ++minor)
1049 ;
1050 if (bluetooth_table[minor]) {
1051 err("No more free Bluetooth devices");
1052 return -ENODEV;
1053 }
1054
1055 if (!(bluetooth = kmalloc(sizeof(struct usb_bluetooth), GFP_KERNEL))) {
1056 err("Out of memory");
1057 return -ENOMEM;
1058 }
1059
1060 memset(bluetooth, 0, sizeof(struct usb_bluetooth));
1061
1062 bluetooth->magic = USB_BLUETOOTH_MAGIC;
1063 bluetooth->dev = dev;
1064 bluetooth->minor = minor;
1065 INIT_WORK(&bluetooth->work, bluetooth_softint, bluetooth);
1066 init_MUTEX(&bluetooth->lock);
1067
1068 /* record the interface number for the control out */
1069 bluetooth->control_out_bInterfaceNum = control_out_endpoint;
1070
1071 /* create our control out urb pool */
1072 for (i = 0; i < NUM_CONTROL_URBS; ++i) {
1073 struct urb *urb = usb_alloc_urb(0, GFP_KERNEL);
1074 if (urb == NULL) {
1075 err("No free urbs available");
1076 goto probe_error;
1077 }
1078 urb->transfer_buffer = NULL;
1079 bluetooth->control_urb_pool[i] = urb;
1080 }
1081
1082 /* set up the endpoint information */
1083 endpoint = bulk_in_endpoint[0];
1084 bluetooth->read_urb = usb_alloc_urb (0, GFP_KERNEL);
1085 if (!bluetooth->read_urb) {
1086 err("No free urbs available");
1087 goto probe_error;
1088 }
1089 bluetooth->bulk_in_buffer_size = buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
1090 bluetooth->bulk_in_endpointAddress = endpoint->bEndpointAddress;
1091 bluetooth->bulk_in_buffer = kmalloc (buffer_size, GFP_KERNEL);
1092 if (!bluetooth->bulk_in_buffer) {
1093 err("Couldn't allocate bulk_in_buffer");
1094 goto probe_error;
1095 }
1096 usb_fill_bulk_urb(bluetooth->read_urb, dev, usb_rcvbulkpipe(dev, endpoint->bEndpointAddress),
1097 bluetooth->bulk_in_buffer, buffer_size, bluetooth_read_bulk_callback, bluetooth);
1098
1099 endpoint = bulk_out_endpoint[0];
1100 bluetooth->bulk_out_endpointAddress = endpoint->bEndpointAddress;
1101 bluetooth->bulk_out_buffer_size = le16_to_cpu(endpoint->wMaxPacketSize) * 2;
1102
1103 endpoint = interrupt_in_endpoint[0];
1104 bluetooth->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
1105 if (!bluetooth->interrupt_in_urb) {
1106 err("No free urbs available");
1107 goto probe_error;
1108 }
1109 bluetooth->interrupt_in_buffer_size = buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
1110 bluetooth->interrupt_in_endpointAddress = endpoint->bEndpointAddress;
1111 bluetooth->interrupt_in_interval = endpoint->bInterval;
1112 bluetooth->interrupt_in_buffer = kmalloc (buffer_size, GFP_KERNEL);
1113 if (!bluetooth->interrupt_in_buffer) {
1114 err("Couldn't allocate interrupt_in_buffer");
1115 goto probe_error;
1116 }
1117 usb_fill_int_urb(bluetooth->interrupt_in_urb, dev, usb_rcvintpipe(dev, endpoint->bEndpointAddress),
1118 bluetooth->interrupt_in_buffer, buffer_size, bluetooth_int_callback,
1119 bluetooth, endpoint->bInterval);
1120
1121 /* initialize the devfs nodes for this device and let the user know what bluetooths we are bound to */
1122 tty_register_device (bluetooth_tty_driver, minor, &intf->dev);
1123 info("Bluetooth converter now attached to ttyUB%d (or usb/ttub/%d for devfs)", minor, minor);
1124
1125 bluetooth_table[minor] = bluetooth;
1126
1127 /* success */
1128 usb_set_intfdata (intf, bluetooth);
1129 return 0;
1130
1131probe_error:
1132 if (bluetooth->read_urb)
1133 usb_free_urb (bluetooth->read_urb);
1134 if (bluetooth->bulk_in_buffer)
1135 kfree (bluetooth->bulk_in_buffer);
1136 if (bluetooth->interrupt_in_urb)
1137 usb_free_urb (bluetooth->interrupt_in_urb);
1138 if (bluetooth->interrupt_in_buffer)
1139 kfree (bluetooth->interrupt_in_buffer);
1140 for (i = 0; i < NUM_CONTROL_URBS; ++i)
1141 if (bluetooth->control_urb_pool[i]) {
1142 if (bluetooth->control_urb_pool[i]->transfer_buffer)
1143 kfree (bluetooth->control_urb_pool[i]->transfer_buffer);
1144 usb_free_urb (bluetooth->control_urb_pool[i]);
1145 }
1146
1147 bluetooth_table[minor] = NULL;
1148
1149 /* free up any memory that we allocated */
1150 kfree (bluetooth);
1151 return -EIO;
1152}
1153
1154
1155static void usb_bluetooth_disconnect(struct usb_interface *intf)
1156{
1157 struct usb_bluetooth *bluetooth = usb_get_intfdata (intf);
1158 int i;
1159
1160 usb_set_intfdata (intf, NULL);
1161 if (bluetooth) {
1162 if ((bluetooth->open_count) && (bluetooth->tty))
1163 tty_hangup(bluetooth->tty);
1164
1165 bluetooth->open_count = 0;
1166
1167 if (bluetooth->read_urb) {
1168 usb_kill_urb (bluetooth->read_urb);
1169 usb_free_urb (bluetooth->read_urb);
1170 }
1171 if (bluetooth->bulk_in_buffer)
1172 kfree (bluetooth->bulk_in_buffer);
1173
1174 if (bluetooth->interrupt_in_urb) {
1175 usb_kill_urb (bluetooth->interrupt_in_urb);
1176 usb_free_urb (bluetooth->interrupt_in_urb);
1177 }
1178 if (bluetooth->interrupt_in_buffer)
1179 kfree (bluetooth->interrupt_in_buffer);
1180
1181 tty_unregister_device (bluetooth_tty_driver, bluetooth->minor);
1182
1183 for (i = 0; i < NUM_CONTROL_URBS; ++i) {
1184 if (bluetooth->control_urb_pool[i]) {
1185 usb_kill_urb (bluetooth->control_urb_pool[i]);
1186 if (bluetooth->control_urb_pool[i]->transfer_buffer)
1187 kfree (bluetooth->control_urb_pool[i]->transfer_buffer);
1188 usb_free_urb (bluetooth->control_urb_pool[i]);
1189 }
1190 }
1191
1192 info("Bluetooth converter now disconnected from ttyUB%d", bluetooth->minor);
1193
1194 bluetooth_table[bluetooth->minor] = NULL;
1195
1196 /* free up any memory that we allocated */
1197 kfree (bluetooth);
1198 } else {
1199 info("device disconnected");
1200 }
1201}
1202
1203static struct tty_operations bluetooth_ops = {
1204 .open = bluetooth_open,
1205 .close = bluetooth_close,
1206 .write = bluetooth_write,
1207 .write_room = bluetooth_write_room,
1208 .ioctl = bluetooth_ioctl,
1209 .set_termios = bluetooth_set_termios,
1210 .throttle = bluetooth_throttle,
1211 .unthrottle = bluetooth_unthrottle,
1212 .chars_in_buffer = bluetooth_chars_in_buffer,
1213};
1214
1215static int usb_bluetooth_init(void)
1216{
1217 int i;
1218 int result;
1219
1220 /* Initialize our global data */
1221 for (i = 0; i < BLUETOOTH_TTY_MINORS; ++i) {
1222 bluetooth_table[i] = NULL;
1223 }
1224
1225 info ("USB Bluetooth support registered");
1226
1227 bluetooth_tty_driver = alloc_tty_driver(BLUETOOTH_TTY_MINORS);
1228 if (!bluetooth_tty_driver)
1229 return -ENOMEM;
1230
1231 bluetooth_tty_driver->owner = THIS_MODULE;
1232 bluetooth_tty_driver->driver_name = "usb-bluetooth";
1233 bluetooth_tty_driver->name = "ttyUB";
1234 bluetooth_tty_driver->devfs_name = "usb/ttub/";
1235 bluetooth_tty_driver->major = BLUETOOTH_TTY_MAJOR;
1236 bluetooth_tty_driver->minor_start = 0;
1237 bluetooth_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
1238 bluetooth_tty_driver->subtype = SERIAL_TYPE_NORMAL;
1239 bluetooth_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
1240 bluetooth_tty_driver->init_termios = tty_std_termios;
1241 bluetooth_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
1242 tty_set_operations(bluetooth_tty_driver, &bluetooth_ops);
1243 if (tty_register_driver (bluetooth_tty_driver)) {
1244 err("%s - failed to register tty driver", __FUNCTION__);
1245 put_tty_driver(bluetooth_tty_driver);
1246 return -1;
1247 }
1248
1249 /* register the USB driver */
1250 result = usb_register(&usb_bluetooth_driver);
1251 if (result < 0) {
1252 tty_unregister_driver(bluetooth_tty_driver);
1253 put_tty_driver(bluetooth_tty_driver);
1254 err("usb_register failed for the USB bluetooth driver. Error number %d", result);
1255 return -1;
1256 }
1257
1258 info(DRIVER_DESC " " DRIVER_VERSION);
1259
1260 return 0;
1261}
1262
1263
1264static void usb_bluetooth_exit(void)
1265{
1266 usb_deregister(&usb_bluetooth_driver);
1267 tty_unregister_driver(bluetooth_tty_driver);
1268 put_tty_driver(bluetooth_tty_driver);
1269}
1270
1271
1272module_init(usb_bluetooth_init);
1273module_exit(usb_bluetooth_exit);
1274
1275/* Module information */
1276MODULE_AUTHOR( DRIVER_AUTHOR );
1277MODULE_DESCRIPTION( DRIVER_DESC );
1278MODULE_LICENSE("GPL");
1279
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 16ecad30e29c..1b4751412970 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -827,11 +827,10 @@ skip_normal_probe:
827 return -ENODEV; 827 return -ENODEV;
828 } 828 }
829 829
830 if (!(acm = kmalloc(sizeof(struct acm), GFP_KERNEL))) { 830 if (!(acm = kzalloc(sizeof(struct acm), GFP_KERNEL))) {
831 dev_dbg(&intf->dev, "out of memory (acm kmalloc)\n"); 831 dev_dbg(&intf->dev, "out of memory (acm kzalloc)\n");
832 goto alloc_fail; 832 goto alloc_fail;
833 } 833 }
834 memset(acm, 0, sizeof(struct acm));
835 834
836 ctrlsize = le16_to_cpu(epctrl->wMaxPacketSize); 835 ctrlsize = le16_to_cpu(epctrl->wMaxPacketSize);
837 readsize = le16_to_cpu(epread->wMaxPacketSize); 836 readsize = le16_to_cpu(epread->wMaxPacketSize);
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index e195709c9c7f..357e75335f17 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -844,9 +844,8 @@ static struct file_operations usblp_fops = {
844}; 844};
845 845
846static struct usb_class_driver usblp_class = { 846static struct usb_class_driver usblp_class = {
847 .name = "usb/lp%d", 847 .name = "lp%d",
848 .fops = &usblp_fops, 848 .fops = &usblp_fops,
849 .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
850 .minor_base = USBLP_MINOR_BASE, 849 .minor_base = USBLP_MINOR_BASE,
851}; 850};
852 851
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index 1a9ff6184943..ff03184da403 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -61,14 +61,17 @@ config USB_DYNAMIC_MINORS
61 If you are unsure about this, say N here. 61 If you are unsure about this, say N here.
62 62
63config USB_SUSPEND 63config USB_SUSPEND
64 bool "USB suspend/resume (EXPERIMENTAL)" 64 bool "USB selective suspend/resume and wakeup (EXPERIMENTAL)"
65 depends on USB && PM && EXPERIMENTAL 65 depends on USB && PM && EXPERIMENTAL
66 help 66 help
67 If you say Y here, you can use driver calls or the sysfs 67 If you say Y here, you can use driver calls or the sysfs
68 "power/state" file to suspend or resume individual USB 68 "power/state" file to suspend or resume individual USB
69 peripherals. There are many related features, such as 69 peripherals.
70 remote wakeup and driver-specific suspend processing, that 70
71 may not yet work as expected. 71 Also, USB "remote wakeup" signaling is supported, whereby some
72 USB devices (like keyboards and network adapters) can wake up
73 their parent hub. That wakeup cascades up the USB tree, and
74 could wake the system from states like suspend-to-RAM.
72 75
73 If you are unsure about this, say N here. 76 If you are unsure about this, say N here.
74 77
diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile
index d5503cf0bf74..dd1c4d2a0c31 100644
--- a/drivers/usb/core/Makefile
+++ b/drivers/usb/core/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5usbcore-objs := usb.o hub.o hcd.o urb.o message.o \ 5usbcore-objs := usb.o hub.o hcd.o urb.o message.o \
6 config.o file.o buffer.o sysfs.o devio.o 6 config.o file.o buffer.o sysfs.o devio.o notify.o
7 7
8ifeq ($(CONFIG_PCI),y) 8ifeq ($(CONFIG_PCI),y)
9 usbcore-objs += hcd-pci.o 9 usbcore-objs += hcd-pci.o
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 99595e07b653..993019500cc3 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -112,8 +112,12 @@ void usb_release_interface_cache(struct kref *ref)
112 struct usb_interface_cache *intfc = ref_to_usb_interface_cache(ref); 112 struct usb_interface_cache *intfc = ref_to_usb_interface_cache(ref);
113 int j; 113 int j;
114 114
115 for (j = 0; j < intfc->num_altsetting; j++) 115 for (j = 0; j < intfc->num_altsetting; j++) {
116 kfree(intfc->altsetting[j].endpoint); 116 struct usb_host_interface *alt = &intfc->altsetting[j];
117
118 kfree(alt->endpoint);
119 kfree(alt->string);
120 }
117 kfree(intfc); 121 kfree(intfc);
118} 122}
119 123
@@ -188,10 +192,9 @@ static int usb_parse_interface(struct device *ddev, int cfgno,
188 } 192 }
189 193
190 len = sizeof(struct usb_host_endpoint) * num_ep; 194 len = sizeof(struct usb_host_endpoint) * num_ep;
191 alt->endpoint = kmalloc(len, GFP_KERNEL); 195 alt->endpoint = kzalloc(len, GFP_KERNEL);
192 if (!alt->endpoint) 196 if (!alt->endpoint)
193 return -ENOMEM; 197 return -ENOMEM;
194 memset(alt->endpoint, 0, len);
195 198
196 /* Parse all the endpoint descriptors */ 199 /* Parse all the endpoint descriptors */
197 n = 0; 200 n = 0;
@@ -353,10 +356,9 @@ static int usb_parse_configuration(struct device *ddev, int cfgidx,
353 } 356 }
354 357
355 len = sizeof(*intfc) + sizeof(struct usb_host_interface) * j; 358 len = sizeof(*intfc) + sizeof(struct usb_host_interface) * j;
356 config->intf_cache[i] = intfc = kmalloc(len, GFP_KERNEL); 359 config->intf_cache[i] = intfc = kzalloc(len, GFP_KERNEL);
357 if (!intfc) 360 if (!intfc)
358 return -ENOMEM; 361 return -ENOMEM;
359 memset(intfc, 0, len);
360 kref_init(&intfc->ref); 362 kref_init(&intfc->ref);
361 } 363 }
362 364
@@ -422,8 +424,6 @@ void usb_destroy_configuration(struct usb_device *dev)
422 struct usb_host_config *cf = &dev->config[c]; 424 struct usb_host_config *cf = &dev->config[c];
423 425
424 kfree(cf->string); 426 kfree(cf->string);
425 cf->string = NULL;
426
427 for (i = 0; i < cf->desc.bNumInterfaces; i++) { 427 for (i = 0; i < cf->desc.bNumInterfaces; i++) {
428 if (cf->intf_cache[i]) 428 if (cf->intf_cache[i])
429 kref_put(&cf->intf_cache[i]->ref, 429 kref_put(&cf->intf_cache[i]->ref,
@@ -459,16 +459,14 @@ int usb_get_configuration(struct usb_device *dev)
459 } 459 }
460 460
461 length = ncfg * sizeof(struct usb_host_config); 461 length = ncfg * sizeof(struct usb_host_config);
462 dev->config = kmalloc(length, GFP_KERNEL); 462 dev->config = kzalloc(length, GFP_KERNEL);
463 if (!dev->config) 463 if (!dev->config)
464 goto err2; 464 goto err2;
465 memset(dev->config, 0, length);
466 465
467 length = ncfg * sizeof(char *); 466 length = ncfg * sizeof(char *);
468 dev->rawdescriptors = kmalloc(length, GFP_KERNEL); 467 dev->rawdescriptors = kzalloc(length, GFP_KERNEL);
469 if (!dev->rawdescriptors) 468 if (!dev->rawdescriptors)
470 goto err2; 469 goto err2;
471 memset(dev->rawdescriptors, 0, length);
472 470
473 buffer = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL); 471 buffer = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL);
474 if (!buffer) 472 if (!buffer)
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index befe0c7f63d1..942cd437dc48 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -46,6 +46,7 @@
46#include <linux/usb.h> 46#include <linux/usb.h>
47#include <linux/usbdevice_fs.h> 47#include <linux/usbdevice_fs.h>
48#include <linux/cdev.h> 48#include <linux/cdev.h>
49#include <linux/notifier.h>
49#include <asm/uaccess.h> 50#include <asm/uaccess.h>
50#include <asm/byteorder.h> 51#include <asm/byteorder.h>
51#include <linux/moduleparam.h> 52#include <linux/moduleparam.h>
@@ -209,10 +210,10 @@ err:
209static struct async *alloc_async(unsigned int numisoframes) 210static struct async *alloc_async(unsigned int numisoframes)
210{ 211{
211 unsigned int assize = sizeof(struct async) + numisoframes * sizeof(struct usb_iso_packet_descriptor); 212 unsigned int assize = sizeof(struct async) + numisoframes * sizeof(struct usb_iso_packet_descriptor);
212 struct async *as = kmalloc(assize, GFP_KERNEL); 213 struct async *as = kzalloc(assize, GFP_KERNEL);
214
213 if (!as) 215 if (!as)
214 return NULL; 216 return NULL;
215 memset(as, 0, assize);
216 as->urb = usb_alloc_urb(numisoframes, GFP_KERNEL); 217 as->urb = usb_alloc_urb(numisoframes, GFP_KERNEL);
217 if (!as->urb) { 218 if (!as->urb) {
218 kfree(as); 219 kfree(as);
@@ -279,6 +280,28 @@ static inline struct async *async_getpending(struct dev_state *ps, void __user *
279 return NULL; 280 return NULL;
280} 281}
281 282
283static void snoop_urb(struct urb *urb, void __user *userurb)
284{
285 int j;
286 unsigned char *data = urb->transfer_buffer;
287
288 if (!usbfs_snoop)
289 return;
290
291 if (urb->pipe & USB_DIR_IN)
292 dev_info(&urb->dev->dev, "direction=IN\n");
293 else
294 dev_info(&urb->dev->dev, "direction=OUT\n");
295 dev_info(&urb->dev->dev, "userurb=%p\n", userurb);
296 dev_info(&urb->dev->dev, "transfer_buffer_length=%d\n",
297 urb->transfer_buffer_length);
298 dev_info(&urb->dev->dev, "actual_length=%d\n", urb->actual_length);
299 dev_info(&urb->dev->dev, "data: ");
300 for (j = 0; j < urb->transfer_buffer_length; ++j)
301 printk ("%02x ", data[j]);
302 printk("\n");
303}
304
282static void async_completed(struct urb *urb, struct pt_regs *regs) 305static void async_completed(struct urb *urb, struct pt_regs *regs)
283{ 306{
284 struct async *as = (struct async *)urb->context; 307 struct async *as = (struct async *)urb->context;
@@ -296,7 +319,9 @@ static void async_completed(struct urb *urb, struct pt_regs *regs)
296 kill_proc_info_as_uid(as->signr, &sinfo, as->pid, as->uid, 319 kill_proc_info_as_uid(as->signr, &sinfo, as->pid, as->uid,
297 as->euid); 320 as->euid);
298 } 321 }
299 wake_up(&ps->wait); 322 snoop(&urb->dev->dev, "urb complete\n");
323 snoop_urb(urb, as->userurb);
324 wake_up(&ps->wait);
300} 325}
301 326
302static void destroy_async (struct dev_state *ps, struct list_head *list) 327static void destroy_async (struct dev_state *ps, struct list_head *list)
@@ -493,6 +518,23 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsig
493 return ret; 518 return ret;
494} 519}
495 520
521static struct usb_device *usbdev_lookup_minor(int minor)
522{
523 struct class_device *class_dev;
524 struct usb_device *dev = NULL;
525
526 down(&usb_device_class->sem);
527 list_for_each_entry(class_dev, &usb_device_class->children, node) {
528 if (class_dev->devt == MKDEV(USB_DEVICE_MAJOR, minor)) {
529 dev = class_dev->class_data;
530 break;
531 }
532 }
533 up(&usb_device_class->sem);
534
535 return dev;
536};
537
496/* 538/*
497 * file operations 539 * file operations
498 */ 540 */
@@ -601,7 +643,7 @@ static int proc_control(struct dev_state *ps, void __user *arg)
601 if (usbfs_snoop) { 643 if (usbfs_snoop) {
602 dev_info(&dev->dev, "control read: data "); 644 dev_info(&dev->dev, "control read: data ");
603 for (j = 0; j < i; ++j) 645 for (j = 0; j < i; ++j)
604 printk ("%02x ", (unsigned char)(tbuf)[j]); 646 printk("%02x ", (unsigned char)(tbuf)[j]);
605 printk("\n"); 647 printk("\n");
606 } 648 }
607 if (copy_to_user(ctrl.data, tbuf, i)) { 649 if (copy_to_user(ctrl.data, tbuf, i)) {
@@ -624,7 +666,7 @@ static int proc_control(struct dev_state *ps, void __user *arg)
624 if (usbfs_snoop) { 666 if (usbfs_snoop) {
625 dev_info(&dev->dev, "control write: data: "); 667 dev_info(&dev->dev, "control write: data: ");
626 for (j = 0; j < ctrl.wLength; ++j) 668 for (j = 0; j < ctrl.wLength; ++j)
627 printk ("%02x ", (unsigned char)(tbuf)[j]); 669 printk("%02x ", (unsigned char)(tbuf)[j]);
628 printk("\n"); 670 printk("\n");
629 } 671 }
630 usb_unlock_device(dev); 672 usb_unlock_device(dev);
@@ -649,7 +691,7 @@ static int proc_bulk(struct dev_state *ps, void __user *arg)
649 unsigned int tmo, len1, pipe; 691 unsigned int tmo, len1, pipe;
650 int len2; 692 int len2;
651 unsigned char *tbuf; 693 unsigned char *tbuf;
652 int i, ret; 694 int i, j, ret;
653 695
654 if (copy_from_user(&bulk, arg, sizeof(bulk))) 696 if (copy_from_user(&bulk, arg, sizeof(bulk)))
655 return -EFAULT; 697 return -EFAULT;
@@ -674,10 +716,18 @@ static int proc_bulk(struct dev_state *ps, void __user *arg)
674 kfree(tbuf); 716 kfree(tbuf);
675 return -EINVAL; 717 return -EINVAL;
676 } 718 }
719 snoop(&dev->dev, "bulk read: len=0x%02x timeout=%04d\n",
720 bulk.len, bulk.timeout);
677 usb_unlock_device(dev); 721 usb_unlock_device(dev);
678 i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo); 722 i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo);
679 usb_lock_device(dev); 723 usb_lock_device(dev);
680 if (!i && len2) { 724 if (!i && len2) {
725 if (usbfs_snoop) {
726 dev_info(&dev->dev, "bulk read: data ");
727 for (j = 0; j < len2; ++j)
728 printk("%02x ", (unsigned char)(tbuf)[j]);
729 printk("\n");
730 }
681 if (copy_to_user(bulk.data, tbuf, len2)) { 731 if (copy_to_user(bulk.data, tbuf, len2)) {
682 kfree(tbuf); 732 kfree(tbuf);
683 return -EFAULT; 733 return -EFAULT;
@@ -690,6 +740,14 @@ static int proc_bulk(struct dev_state *ps, void __user *arg)
690 return -EFAULT; 740 return -EFAULT;
691 } 741 }
692 } 742 }
743 snoop(&dev->dev, "bulk write: len=0x%02x timeout=%04d\n",
744 bulk.len, bulk.timeout);
745 if (usbfs_snoop) {
746 dev_info(&dev->dev, "bulk write: data: ");
747 for (j = 0; j < len1; ++j)
748 printk("%02x ", (unsigned char)(tbuf)[j]);
749 printk("\n");
750 }
693 usb_unlock_device(dev); 751 usb_unlock_device(dev);
694 i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo); 752 i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo);
695 usb_lock_device(dev); 753 usb_lock_device(dev);
@@ -835,7 +893,6 @@ static int proc_setconfig(struct dev_state *ps, void __user *arg)
835 return status; 893 return status;
836} 894}
837 895
838
839static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, 896static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
840 struct usbdevfs_iso_packet_desc __user *iso_frame_desc, 897 struct usbdevfs_iso_packet_desc __user *iso_frame_desc,
841 void __user *arg) 898 void __user *arg)
@@ -896,6 +953,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
896 kfree(dr); 953 kfree(dr);
897 return -EFAULT; 954 return -EFAULT;
898 } 955 }
956 snoop(&ps->dev->dev, "control urb\n");
899 break; 957 break;
900 958
901 case USBDEVFS_URB_TYPE_BULK: 959 case USBDEVFS_URB_TYPE_BULK:
@@ -910,6 +968,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
910 return -EINVAL; 968 return -EINVAL;
911 if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length)) 969 if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length))
912 return -EFAULT; 970 return -EFAULT;
971 snoop(&ps->dev->dev, "bulk urb\n");
913 break; 972 break;
914 973
915 case USBDEVFS_URB_TYPE_ISO: 974 case USBDEVFS_URB_TYPE_ISO:
@@ -939,6 +998,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
939 return -EINVAL; 998 return -EINVAL;
940 } 999 }
941 uurb->buffer_length = totlen; 1000 uurb->buffer_length = totlen;
1001 snoop(&ps->dev->dev, "iso urb\n");
942 break; 1002 break;
943 1003
944 case USBDEVFS_URB_TYPE_INTERRUPT: 1004 case USBDEVFS_URB_TYPE_INTERRUPT:
@@ -954,6 +1014,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
954 return -EINVAL; 1014 return -EINVAL;
955 if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length)) 1015 if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length))
956 return -EFAULT; 1016 return -EFAULT;
1017 snoop(&ps->dev->dev, "interrupt urb\n");
957 break; 1018 break;
958 1019
959 default: 1020 default:
@@ -1003,6 +1064,8 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1003 return -EFAULT; 1064 return -EFAULT;
1004 } 1065 }
1005 } 1066 }
1067 snoop(&as->urb->dev->dev, "submit urb\n");
1068 snoop_urb(as->urb, as->userurb);
1006 async_newpending(as); 1069 async_newpending(as);
1007 if ((ret = usb_submit_urb(as->urb, GFP_KERNEL))) { 1070 if ((ret = usb_submit_urb(as->urb, GFP_KERNEL))) {
1008 dev_printk(KERN_DEBUG, &ps->dev->dev, "usbfs: usb_submit_urb returned %d\n", ret); 1071 dev_printk(KERN_DEBUG, &ps->dev->dev, "usbfs: usb_submit_urb returned %d\n", ret);
@@ -1238,23 +1301,20 @@ static int proc_releaseinterface(struct dev_state *ps, void __user *arg)
1238 return 0; 1301 return 0;
1239} 1302}
1240 1303
1241static int proc_ioctl (struct dev_state *ps, void __user *arg) 1304static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
1242{ 1305{
1243 struct usbdevfs_ioctl ctrl;
1244 int size; 1306 int size;
1245 void *buf = NULL; 1307 void *buf = NULL;
1246 int retval = 0; 1308 int retval = 0;
1247 struct usb_interface *intf = NULL; 1309 struct usb_interface *intf = NULL;
1248 struct usb_driver *driver = NULL; 1310 struct usb_driver *driver = NULL;
1249 1311
1250 /* get input parameters and alloc buffer */ 1312 /* alloc buffer */
1251 if (copy_from_user(&ctrl, arg, sizeof (ctrl))) 1313 if ((size = _IOC_SIZE (ctl->ioctl_code)) > 0) {
1252 return -EFAULT;
1253 if ((size = _IOC_SIZE (ctrl.ioctl_code)) > 0) {
1254 if ((buf = kmalloc (size, GFP_KERNEL)) == NULL) 1314 if ((buf = kmalloc (size, GFP_KERNEL)) == NULL)
1255 return -ENOMEM; 1315 return -ENOMEM;
1256 if ((_IOC_DIR(ctrl.ioctl_code) & _IOC_WRITE)) { 1316 if ((_IOC_DIR(ctl->ioctl_code) & _IOC_WRITE)) {
1257 if (copy_from_user (buf, ctrl.data, size)) { 1317 if (copy_from_user (buf, ctl->data, size)) {
1258 kfree(buf); 1318 kfree(buf);
1259 return -EFAULT; 1319 return -EFAULT;
1260 } 1320 }
@@ -1270,9 +1330,9 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
1270 1330
1271 if (ps->dev->state != USB_STATE_CONFIGURED) 1331 if (ps->dev->state != USB_STATE_CONFIGURED)
1272 retval = -EHOSTUNREACH; 1332 retval = -EHOSTUNREACH;
1273 else if (!(intf = usb_ifnum_to_if (ps->dev, ctrl.ifno))) 1333 else if (!(intf = usb_ifnum_to_if (ps->dev, ctl->ifno)))
1274 retval = -EINVAL; 1334 retval = -EINVAL;
1275 else switch (ctrl.ioctl_code) { 1335 else switch (ctl->ioctl_code) {
1276 1336
1277 /* disconnect kernel driver from interface */ 1337 /* disconnect kernel driver from interface */
1278 case USBDEVFS_DISCONNECT: 1338 case USBDEVFS_DISCONNECT:
@@ -1304,7 +1364,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
1304 if (driver == NULL || driver->ioctl == NULL) { 1364 if (driver == NULL || driver->ioctl == NULL) {
1305 retval = -ENOTTY; 1365 retval = -ENOTTY;
1306 } else { 1366 } else {
1307 retval = driver->ioctl (intf, ctrl.ioctl_code, buf); 1367 retval = driver->ioctl (intf, ctl->ioctl_code, buf);
1308 if (retval == -ENOIOCTLCMD) 1368 if (retval == -ENOIOCTLCMD)
1309 retval = -ENOTTY; 1369 retval = -ENOTTY;
1310 } 1370 }
@@ -1313,15 +1373,42 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
1313 1373
1314 /* cleanup and return */ 1374 /* cleanup and return */
1315 if (retval >= 0 1375 if (retval >= 0
1316 && (_IOC_DIR (ctrl.ioctl_code) & _IOC_READ) != 0 1376 && (_IOC_DIR (ctl->ioctl_code) & _IOC_READ) != 0
1317 && size > 0 1377 && size > 0
1318 && copy_to_user (ctrl.data, buf, size) != 0) 1378 && copy_to_user (ctl->data, buf, size) != 0)
1319 retval = -EFAULT; 1379 retval = -EFAULT;
1320 1380
1321 kfree(buf); 1381 kfree(buf);
1322 return retval; 1382 return retval;
1323} 1383}
1324 1384
1385static int proc_ioctl_default(struct dev_state *ps, void __user *arg)
1386{
1387 struct usbdevfs_ioctl ctrl;
1388
1389 if (copy_from_user(&ctrl, arg, sizeof (ctrl)))
1390 return -EFAULT;
1391 return proc_ioctl(ps, &ctrl);
1392}
1393
1394#ifdef CONFIG_COMPAT
1395static int proc_ioctl_compat(struct dev_state *ps, void __user *arg)
1396{
1397 struct usbdevfs_ioctl32 __user *uioc;
1398 struct usbdevfs_ioctl ctrl;
1399 u32 udata;
1400
1401 uioc = compat_ptr(arg);
1402 if (get_user(ctrl.ifno, &uioc->ifno) ||
1403 get_user(ctrl.ioctl_code, &uioc->ioctl_code) ||
1404 __get_user(udata, &uioc->data))
1405 return -EFAULT;
1406 ctrl.data = compat_ptr(udata);
1407
1408 return proc_ioctl(ps, &ctrl);
1409}
1410#endif
1411
1325/* 1412/*
1326 * NOTE: All requests here that have interface numbers as parameters 1413 * NOTE: All requests here that have interface numbers as parameters
1327 * are assuming that somehow the configuration has been prevented from 1414 * are assuming that somehow the configuration has been prevented from
@@ -1422,6 +1509,10 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
1422 ret = proc_reapurbnonblock_compat(ps, p); 1509 ret = proc_reapurbnonblock_compat(ps, p);
1423 break; 1510 break;
1424 1511
1512 case USBDEVFS_IOCTL32:
1513 snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__);
1514 ret = proc_ioctl_compat(ps, p);
1515 break;
1425#endif 1516#endif
1426 1517
1427 case USBDEVFS_DISCARDURB: 1518 case USBDEVFS_DISCARDURB:
@@ -1456,7 +1547,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
1456 1547
1457 case USBDEVFS_IOCTL: 1548 case USBDEVFS_IOCTL:
1458 snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__); 1549 snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__);
1459 ret = proc_ioctl(ps, p); 1550 ret = proc_ioctl_default(ps, p);
1460 break; 1551 break;
1461 } 1552 }
1462 usb_unlock_device(dev); 1553 usb_unlock_device(dev);
@@ -1488,24 +1579,7 @@ struct file_operations usbfs_device_file_operations = {
1488 .release = usbdev_release, 1579 .release = usbdev_release,
1489}; 1580};
1490 1581
1491struct usb_device *usbdev_lookup_minor(int minor) 1582static void usbdev_add(struct usb_device *dev)
1492{
1493 struct class_device *class_dev;
1494 struct usb_device *dev = NULL;
1495
1496 down(&usb_device_class->sem);
1497 list_for_each_entry(class_dev, &usb_device_class->children, node) {
1498 if (class_dev->devt == MKDEV(USB_DEVICE_MAJOR, minor)) {
1499 dev = class_dev->class_data;
1500 break;
1501 }
1502 }
1503 up(&usb_device_class->sem);
1504
1505 return dev;
1506};
1507
1508void usbdev_add(struct usb_device *dev)
1509{ 1583{
1510 int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1); 1584 int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1);
1511 1585
@@ -1516,11 +1590,29 @@ void usbdev_add(struct usb_device *dev)
1516 dev->class_dev->class_data = dev; 1590 dev->class_dev->class_data = dev;
1517} 1591}
1518 1592
1519void usbdev_remove(struct usb_device *dev) 1593static void usbdev_remove(struct usb_device *dev)
1520{ 1594{
1521 class_device_unregister(dev->class_dev); 1595 class_device_unregister(dev->class_dev);
1522} 1596}
1523 1597
1598static int usbdev_notify(struct notifier_block *self, unsigned long action,
1599 void *dev)
1600{
1601 switch (action) {
1602 case USB_DEVICE_ADD:
1603 usbdev_add(dev);
1604 break;
1605 case USB_DEVICE_REMOVE:
1606 usbdev_remove(dev);
1607 break;
1608 }
1609 return NOTIFY_OK;
1610}
1611
1612static struct notifier_block usbdev_nb = {
1613 .notifier_call = usbdev_notify,
1614};
1615
1524static struct cdev usb_device_cdev = { 1616static struct cdev usb_device_cdev = {
1525 .kobj = {.name = "usb_device", }, 1617 .kobj = {.name = "usb_device", },
1526 .owner = THIS_MODULE, 1618 .owner = THIS_MODULE,
@@ -1540,24 +1632,32 @@ int __init usbdev_init(void)
1540 retval = cdev_add(&usb_device_cdev, USB_DEVICE_DEV, USB_DEVICE_MAX); 1632 retval = cdev_add(&usb_device_cdev, USB_DEVICE_DEV, USB_DEVICE_MAX);
1541 if (retval) { 1633 if (retval) {
1542 err("unable to get usb_device major %d", USB_DEVICE_MAJOR); 1634 err("unable to get usb_device major %d", USB_DEVICE_MAJOR);
1543 unregister_chrdev_region(USB_DEVICE_DEV, USB_DEVICE_MAX); 1635 goto error_cdev;
1544 goto out;
1545 } 1636 }
1546 usb_device_class = class_create(THIS_MODULE, "usb_device"); 1637 usb_device_class = class_create(THIS_MODULE, "usb_device");
1547 if (IS_ERR(usb_device_class)) { 1638 if (IS_ERR(usb_device_class)) {
1548 err("unable to register usb_device class"); 1639 err("unable to register usb_device class");
1549 retval = PTR_ERR(usb_device_class); 1640 retval = PTR_ERR(usb_device_class);
1550 usb_device_class = NULL; 1641 goto error_class;
1551 cdev_del(&usb_device_cdev);
1552 unregister_chrdev_region(USB_DEVICE_DEV, USB_DEVICE_MAX);
1553 } 1642 }
1554 1643
1644 usb_register_notify(&usbdev_nb);
1645
1555out: 1646out:
1556 return retval; 1647 return retval;
1648
1649error_class:
1650 usb_device_class = NULL;
1651 cdev_del(&usb_device_cdev);
1652
1653error_cdev:
1654 unregister_chrdev_region(USB_DEVICE_DEV, USB_DEVICE_MAX);
1655 goto out;
1557} 1656}
1558 1657
1559void usbdev_cleanup(void) 1658void usbdev_cleanup(void)
1560{ 1659{
1660 usb_unregister_notify(&usbdev_nb);
1561 class_destroy(usb_device_class); 1661 class_destroy(usb_device_class);
1562 cdev_del(&usb_device_cdev); 1662 cdev_del(&usb_device_cdev);
1563 unregister_chrdev_region(USB_DEVICE_DEV, USB_DEVICE_MAX); 1663 unregister_chrdev_region(USB_DEVICE_DEV, USB_DEVICE_MAX);
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index 78cb4be9529f..e695308095ae 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -17,7 +17,6 @@
17 17
18#include <linux/config.h> 18#include <linux/config.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/devfs_fs_kernel.h>
21#include <linux/spinlock.h> 20#include <linux/spinlock.h>
22#include <linux/errno.h> 21#include <linux/errno.h>
23 22
@@ -88,8 +87,6 @@ int usb_major_init(void)
88 goto out; 87 goto out;
89 } 88 }
90 89
91 devfs_mk_dir("usb");
92
93out: 90out:
94 return error; 91 return error;
95} 92}
@@ -97,7 +94,6 @@ out:
97void usb_major_cleanup(void) 94void usb_major_cleanup(void)
98{ 95{
99 class_destroy(usb_class); 96 class_destroy(usb_class);
100 devfs_remove("usb");
101 unregister_chrdev(USB_MAJOR, "usb"); 97 unregister_chrdev(USB_MAJOR, "usb");
102} 98}
103 99
@@ -112,8 +108,7 @@ void usb_major_cleanup(void)
112 * enabled, the minor number will be based on the next available free minor, 108 * enabled, the minor number will be based on the next available free minor,
113 * starting at the class_driver->minor_base. 109 * starting at the class_driver->minor_base.
114 * 110 *
115 * This function also creates the devfs file for the usb device, if devfs 111 * This function also creates a usb class device in the sysfs tree.
116 * is enabled, and creates a usb class device in the sysfs tree.
117 * 112 *
118 * usb_deregister_dev() must be called when the driver is done with 113 * usb_deregister_dev() must be called when the driver is done with
119 * the minor numbers given out by this function. 114 * the minor numbers given out by this function.
@@ -162,11 +157,8 @@ int usb_register_dev(struct usb_interface *intf,
162 157
163 intf->minor = minor; 158 intf->minor = minor;
164 159
165 /* handle the devfs registration */
166 snprintf(name, BUS_ID_SIZE, class_driver->name, minor - minor_base);
167 devfs_mk_cdev(MKDEV(USB_MAJOR, minor), class_driver->mode, name);
168
169 /* create a usb class device for this usb interface */ 160 /* create a usb class device for this usb interface */
161 snprintf(name, BUS_ID_SIZE, class_driver->name, minor - minor_base);
170 temp = strrchr(name, '/'); 162 temp = strrchr(name, '/');
171 if (temp && (temp[1] != 0x00)) 163 if (temp && (temp[1] != 0x00))
172 ++temp; 164 ++temp;
@@ -179,7 +171,6 @@ int usb_register_dev(struct usb_interface *intf,
179 spin_lock (&minor_lock); 171 spin_lock (&minor_lock);
180 usb_minors[intf->minor] = NULL; 172 usb_minors[intf->minor] = NULL;
181 spin_unlock (&minor_lock); 173 spin_unlock (&minor_lock);
182 devfs_remove (name);
183 retval = PTR_ERR(intf->class_dev); 174 retval = PTR_ERR(intf->class_dev);
184 } 175 }
185exit: 176exit:
@@ -197,9 +188,8 @@ EXPORT_SYMBOL(usb_register_dev);
197 * call to usb_register_dev() (usually when the device is disconnected 188 * call to usb_register_dev() (usually when the device is disconnected
198 * from the system.) 189 * from the system.)
199 * 190 *
200 * This function also cleans up the devfs file for the usb device, if devfs 191 * This function also removes the usb class device from the sysfs tree.
201 * is enabled, and removes the usb class device from the sysfs tree. 192 *
202 *
203 * This should be called by all drivers that use the USB major number. 193 * This should be called by all drivers that use the USB major number.
204 */ 194 */
205void usb_deregister_dev(struct usb_interface *intf, 195void usb_deregister_dev(struct usb_interface *intf,
@@ -222,7 +212,6 @@ void usb_deregister_dev(struct usb_interface *intf,
222 spin_unlock (&minor_lock); 212 spin_unlock (&minor_lock);
223 213
224 snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); 214 snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base);
225 devfs_remove (name);
226 class_device_destroy(usb_class, MKDEV(USB_MAJOR, intf->minor)); 215 class_device_destroy(usb_class, MKDEV(USB_MAJOR, intf->minor));
227 intf->class_dev = NULL; 216 intf->class_dev = NULL;
228 intf->minor = -1; 217 intf->minor = -1;
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 6385d1a99b60..84d9e69329bb 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -30,6 +30,8 @@
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <linux/usb.h> 32#include <linux/usb.h>
33
34#include "usb.h"
33#include "hcd.h" 35#include "hcd.h"
34 36
35 37
@@ -197,6 +199,26 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
197 199
198 hcd = pci_get_drvdata(dev); 200 hcd = pci_get_drvdata(dev);
199 201
202 /* Root hub suspend should have stopped all downstream traffic,
203 * and all bus master traffic. And done so for both the interface
204 * and the stub usb_device (which we check here). But maybe it
205 * didn't; writing sysfs power/state files ignores such rules...
206 *
207 * We must ignore the FREEZE vs SUSPEND distinction here, because
208 * otherwise the swsusp will save (and restore) garbage state.
209 */
210 if (hcd->self.root_hub->dev.power.power_state.event == PM_EVENT_ON)
211 return -EBUSY;
212
213 if (hcd->driver->suspend) {
214 retval = hcd->driver->suspend(hcd, message);
215 if (retval) {
216 dev_dbg (&dev->dev, "PCI pre-suspend fail, %d\n",
217 retval);
218 goto done;
219 }
220 }
221
200 /* FIXME until the generic PM interfaces change a lot more, this 222 /* FIXME until the generic PM interfaces change a lot more, this
201 * can't use PCI D1 and D2 states. For example, the confusion 223 * can't use PCI D1 and D2 states. For example, the confusion
202 * between messages and states will need to vanish, and messages 224 * between messages and states will need to vanish, and messages
@@ -215,31 +237,13 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
215 */ 237 */
216 has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM); 238 has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
217 239
218 switch (hcd->state) { 240 /* Downstream ports from this root hub should already be quiesced, so
219 241 * there will be no DMA activity. Now we can shut down the upstream
220 /* entry if root hub wasn't yet suspended ... from sysfs, 242 * link (except maybe for PME# resume signaling) and enter some PCI
221 * without autosuspend, or if USB_SUSPEND isn't configured. 243 * low power state, if the hardware allows.
222 */ 244 */
223 case HC_STATE_RUNNING: 245 if (hcd->state == HC_STATE_SUSPENDED) {
224 hcd->state = HC_STATE_QUIESCING;
225 retval = hcd->driver->suspend (hcd, message);
226 if (retval) {
227 dev_dbg (hcd->self.controller,
228 "suspend fail, retval %d\n",
229 retval);
230 break;
231 }
232 hcd->state = HC_STATE_SUSPENDED;
233 /* FALLTHROUGH */
234 246
235 /* entry with CONFIG_USB_SUSPEND, or hcds that autosuspend: the
236 * controller and/or root hub will already have been suspended,
237 * but it won't be ready for a PCI resume call.
238 *
239 * FIXME only CONFIG_USB_SUSPEND guarantees hub_suspend() will
240 * have been called, otherwise root hub timers still run ...
241 */
242 case HC_STATE_SUSPENDED:
243 /* no DMA or IRQs except when HC is active */ 247 /* no DMA or IRQs except when HC is active */
244 if (dev->current_state == PCI_D0) { 248 if (dev->current_state == PCI_D0) {
245 pci_save_state (dev); 249 pci_save_state (dev);
@@ -248,7 +252,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
248 252
249 if (!has_pci_pm) { 253 if (!has_pci_pm) {
250 dev_dbg (hcd->self.controller, "--> PCI D0/legacy\n"); 254 dev_dbg (hcd->self.controller, "--> PCI D0/legacy\n");
251 break; 255 goto done;
252 } 256 }
253 257
254 /* NOTE: dev->current_state becomes nonzero only here, and 258 /* NOTE: dev->current_state becomes nonzero only here, and
@@ -259,28 +263,29 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
259 retval = pci_set_power_state (dev, PCI_D3hot); 263 retval = pci_set_power_state (dev, PCI_D3hot);
260 if (retval == 0) { 264 if (retval == 0) {
261 dev_dbg (hcd->self.controller, "--> PCI D3\n"); 265 dev_dbg (hcd->self.controller, "--> PCI D3\n");
262 retval = pci_enable_wake (dev, PCI_D3hot, hcd->remote_wakeup); 266
263 if (retval) 267 /* Ignore these return values. We rely on pci code to
264 break; 268 * reject requests the hardware can't implement, rather
265 retval = pci_enable_wake (dev, PCI_D3cold, hcd->remote_wakeup); 269 * than coding the same thing.
266 } else if (retval < 0) { 270 */
271 (void) pci_enable_wake (dev, PCI_D3hot, hcd->remote_wakeup);
272 (void) pci_enable_wake (dev, PCI_D3cold, hcd->remote_wakeup);
273 } else {
267 dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n", 274 dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n",
268 retval); 275 retval);
269 (void) usb_hcd_pci_resume (dev); 276 (void) usb_hcd_pci_resume (dev);
270 break;
271 } 277 }
272 break; 278
273 default: 279 } else {
274 dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n", 280 dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n",
275 hcd->state); 281 hcd->state);
276 WARN_ON(1); 282 WARN_ON(1);
277 retval = -EINVAL; 283 retval = -EINVAL;
278 break;
279 } 284 }
280 285
281 /* update power_state **ONLY** to make sysfs happier */ 286done:
282 if (retval == 0) 287 if (retval == 0)
283 dev->dev.power.power_state = message; 288 dev->dev.power.power_state = PMSG_SUSPEND;
284 return retval; 289 return retval;
285} 290}
286EXPORT_SYMBOL (usb_hcd_pci_suspend); 291EXPORT_SYMBOL (usb_hcd_pci_suspend);
@@ -336,20 +341,9 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
336 dev->current_state); 341 dev->current_state);
337 } 342 }
338#endif 343#endif
339 retval = pci_enable_wake (dev, dev->current_state, 0); 344 /* yes, ignore these results too... */
340 if (retval) { 345 (void) pci_enable_wake (dev, dev->current_state, 0);
341 dev_err(hcd->self.controller, 346 (void) pci_enable_wake (dev, PCI_D3cold, 0);
342 "can't enable_wake to %d, %d!\n",
343 dev->current_state, retval);
344 return retval;
345 }
346 retval = pci_enable_wake (dev, PCI_D3cold, 0);
347 if (retval) {
348 dev_err(hcd->self.controller,
349 "can't enable_wake to %d, %d!\n",
350 PCI_D3cold, retval);
351 return retval;
352 }
353 } else { 347 } else {
354 /* Same basic cases: clean (powered/not), dirty */ 348 /* Same basic cases: clean (powered/not), dirty */
355 dev_dbg(hcd->self.controller, "PCI legacy resume\n"); 349 dev_dbg(hcd->self.controller, "PCI legacy resume\n");
@@ -371,17 +365,17 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
371 365
372 dev->dev.power.power_state = PMSG_ON; 366 dev->dev.power.power_state = PMSG_ON;
373 367
374 hcd->state = HC_STATE_RESUMING;
375 hcd->saw_irq = 0; 368 hcd->saw_irq = 0;
376 369
377 retval = hcd->driver->resume (hcd); 370 if (hcd->driver->resume) {
378 if (!HC_IS_RUNNING (hcd->state)) { 371 retval = hcd->driver->resume(hcd);
379 dev_dbg (hcd->self.controller, 372 if (retval) {
380 "resume fail, retval %d\n", retval); 373 dev_err (hcd->self.controller,
381 usb_hc_died (hcd); 374 "PCI post-resume error %d!\n", retval);
375 usb_hc_died (hcd);
376 }
382 } 377 }
383 378
384 retval = pci_enable_device(dev);
385 return retval; 379 return retval;
386} 380}
387EXPORT_SYMBOL (usb_hcd_pci_resume); 381EXPORT_SYMBOL (usb_hcd_pci_resume);
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 14c47a10da86..6c7ca5b08cd6 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -130,7 +130,7 @@ static const u8 usb2_rh_dev_descriptor [18] = {
130 0x09, /* __u8 bDeviceClass; HUB_CLASSCODE */ 130 0x09, /* __u8 bDeviceClass; HUB_CLASSCODE */
131 0x00, /* __u8 bDeviceSubClass; */ 131 0x00, /* __u8 bDeviceSubClass; */
132 0x01, /* __u8 bDeviceProtocol; [ usb 2.0 single TT ]*/ 132 0x01, /* __u8 bDeviceProtocol; [ usb 2.0 single TT ]*/
133 0x08, /* __u8 bMaxPacketSize0; 8 Bytes */ 133 0x40, /* __u8 bMaxPacketSize0; 64 Bytes */
134 134
135 0x00, 0x00, /* __le16 idVendor; */ 135 0x00, 0x00, /* __le16 idVendor; */
136 0x00, 0x00, /* __le16 idProduct; */ 136 0x00, 0x00, /* __le16 idProduct; */
@@ -153,7 +153,7 @@ static const u8 usb11_rh_dev_descriptor [18] = {
153 0x09, /* __u8 bDeviceClass; HUB_CLASSCODE */ 153 0x09, /* __u8 bDeviceClass; HUB_CLASSCODE */
154 0x00, /* __u8 bDeviceSubClass; */ 154 0x00, /* __u8 bDeviceSubClass; */
155 0x00, /* __u8 bDeviceProtocol; [ low/full speeds only ] */ 155 0x00, /* __u8 bDeviceProtocol; [ low/full speeds only ] */
156 0x08, /* __u8 bMaxPacketSize0; 8 Bytes */ 156 0x40, /* __u8 bMaxPacketSize0; 64 Bytes */
157 157
158 0x00, 0x00, /* __le16 idVendor; */ 158 0x00, 0x00, /* __le16 idVendor; */
159 0x00, 0x00, /* __le16 idProduct; */ 159 0x00, 0x00, /* __le16 idProduct; */
@@ -458,22 +458,18 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
458 458
459 default: 459 default:
460 /* non-generic request */ 460 /* non-generic request */
461 if (HC_IS_SUSPENDED (hcd->state)) 461 switch (typeReq) {
462 status = -EAGAIN; 462 case GetHubStatus:
463 else { 463 case GetPortStatus:
464 switch (typeReq) { 464 len = 4;
465 case GetHubStatus: 465 break;
466 case GetPortStatus: 466 case GetHubDescriptor:
467 len = 4; 467 len = sizeof (struct usb_hub_descriptor);
468 break; 468 break;
469 case GetHubDescriptor:
470 len = sizeof (struct usb_hub_descriptor);
471 break;
472 }
473 status = hcd->driver->hub_control (hcd,
474 typeReq, wValue, wIndex,
475 tbuf, wLength);
476 } 469 }
470 status = hcd->driver->hub_control (hcd,
471 typeReq, wValue, wIndex,
472 tbuf, wLength);
477 break; 473 break;
478error: 474error:
479 /* "protocol stall" on error */ 475 /* "protocol stall" on error */
@@ -487,7 +483,7 @@ error:
487 "CTRL: TypeReq=0x%x val=0x%x " 483 "CTRL: TypeReq=0x%x val=0x%x "
488 "idx=0x%x len=%d ==> %d\n", 484 "idx=0x%x len=%d ==> %d\n",
489 typeReq, wValue, wIndex, 485 typeReq, wValue, wIndex,
490 wLength, urb->status); 486 wLength, status);
491 } 487 }
492 } 488 }
493 if (len) { 489 if (len) {
@@ -748,10 +744,9 @@ struct usb_bus *usb_alloc_bus (struct usb_operations *op)
748{ 744{
749 struct usb_bus *bus; 745 struct usb_bus *bus;
750 746
751 bus = kmalloc (sizeof *bus, GFP_KERNEL); 747 bus = kzalloc (sizeof *bus, GFP_KERNEL);
752 if (!bus) 748 if (!bus)
753 return NULL; 749 return NULL;
754 memset(bus, 0, sizeof(struct usb_bus));
755 usb_bus_init (bus); 750 usb_bus_init (bus);
756 bus->op = op; 751 bus->op = op;
757 return bus; 752 return bus;
@@ -796,8 +791,7 @@ static int usb_register_bus(struct usb_bus *bus)
796 list_add (&bus->bus_list, &usb_bus_list); 791 list_add (&bus->bus_list, &usb_bus_list);
797 up (&usb_bus_list_lock); 792 up (&usb_bus_list_lock);
798 793
799 usbfs_add_bus (bus); 794 usb_notify_add_bus(bus);
800 usbmon_notify_bus_add (bus);
801 795
802 dev_info (bus->controller, "new USB bus registered, assigned bus number %d\n", bus->busnum); 796 dev_info (bus->controller, "new USB bus registered, assigned bus number %d\n", bus->busnum);
803 return 0; 797 return 0;
@@ -824,8 +818,7 @@ static void usb_deregister_bus (struct usb_bus *bus)
824 list_del (&bus->bus_list); 818 list_del (&bus->bus_list);
825 up (&usb_bus_list_lock); 819 up (&usb_bus_list_lock);
826 820
827 usbmon_notify_bus_remove (bus); 821 usb_notify_remove_bus(bus);
828 usbfs_remove_bus (bus);
829 822
830 clear_bit (bus->busnum, busmap.busmap); 823 clear_bit (bus->busnum, busmap.busmap);
831 824
@@ -1143,10 +1136,20 @@ static int hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
1143 else switch (hcd->state) { 1136 else switch (hcd->state) {
1144 case HC_STATE_RUNNING: 1137 case HC_STATE_RUNNING:
1145 case HC_STATE_RESUMING: 1138 case HC_STATE_RESUMING:
1139doit:
1146 usb_get_dev (urb->dev); 1140 usb_get_dev (urb->dev);
1147 list_add_tail (&urb->urb_list, &ep->urb_list); 1141 list_add_tail (&urb->urb_list, &ep->urb_list);
1148 status = 0; 1142 status = 0;
1149 break; 1143 break;
1144 case HC_STATE_SUSPENDED:
1145 /* HC upstream links (register access, wakeup signaling) can work
1146 * even when the downstream links (and DMA etc) are quiesced; let
1147 * usbcore talk to the root hub.
1148 */
1149 if (hcd->self.controller->power.power_state.event == PM_EVENT_ON
1150 && urb->dev->parent == NULL)
1151 goto doit;
1152 /* FALL THROUGH */
1150 default: 1153 default:
1151 status = -ESHUTDOWN; 1154 status = -ESHUTDOWN;
1152 break; 1155 break;
@@ -1294,12 +1297,6 @@ static int hcd_unlink_urb (struct urb *urb, int status)
1294 goto done; 1297 goto done;
1295 } 1298 }
1296 1299
1297 /* running ~= hc unlink handshake works (irq, timer, etc)
1298 * halted ~= no unlink handshake is needed
1299 * suspended, resuming == should never happen
1300 */
1301 WARN_ON (!HC_IS_RUNNING (hcd->state) && hcd->state != HC_STATE_HALT);
1302
1303 /* insist the urb is still queued */ 1300 /* insist the urb is still queued */
1304 list_for_each(tmp, &ep->urb_list) { 1301 list_for_each(tmp, &ep->urb_list) {
1305 if (tmp == &urb->urb_list) 1302 if (tmp == &urb->urb_list)
@@ -1431,28 +1428,92 @@ rescan:
1431 1428
1432/*-------------------------------------------------------------------------*/ 1429/*-------------------------------------------------------------------------*/
1433 1430
1434#ifdef CONFIG_USB_SUSPEND 1431#ifdef CONFIG_PM
1435 1432
1436static int hcd_hub_suspend (struct usb_bus *bus) 1433int hcd_bus_suspend (struct usb_bus *bus)
1437{ 1434{
1438 struct usb_hcd *hcd; 1435 struct usb_hcd *hcd;
1436 int status;
1439 1437
1440 hcd = container_of (bus, struct usb_hcd, self); 1438 hcd = container_of (bus, struct usb_hcd, self);
1441 if (hcd->driver->hub_suspend) 1439 if (!hcd->driver->bus_suspend)
1442 return hcd->driver->hub_suspend (hcd); 1440 return -ENOENT;
1443 return 0; 1441 hcd->state = HC_STATE_QUIESCING;
1442 status = hcd->driver->bus_suspend (hcd);
1443 if (status == 0)
1444 hcd->state = HC_STATE_SUSPENDED;
1445 else
1446 dev_dbg(&bus->root_hub->dev, "%s fail, err %d\n",
1447 "suspend", status);
1448 return status;
1444} 1449}
1445 1450
1446static int hcd_hub_resume (struct usb_bus *bus) 1451int hcd_bus_resume (struct usb_bus *bus)
1447{ 1452{
1448 struct usb_hcd *hcd; 1453 struct usb_hcd *hcd;
1454 int status;
1449 1455
1450 hcd = container_of (bus, struct usb_hcd, self); 1456 hcd = container_of (bus, struct usb_hcd, self);
1451 if (hcd->driver->hub_resume) 1457 if (!hcd->driver->bus_resume)
1452 return hcd->driver->hub_resume (hcd); 1458 return -ENOENT;
1453 return 0; 1459 if (hcd->state == HC_STATE_RUNNING)
1460 return 0;
1461 hcd->state = HC_STATE_RESUMING;
1462 status = hcd->driver->bus_resume (hcd);
1463 if (status == 0)
1464 hcd->state = HC_STATE_RUNNING;
1465 else {
1466 dev_dbg(&bus->root_hub->dev, "%s fail, err %d\n",
1467 "resume", status);
1468 usb_hc_died(hcd);
1469 }
1470 return status;
1454} 1471}
1455 1472
1473/*
1474 * usb_hcd_suspend_root_hub - HCD autosuspends downstream ports
1475 * @hcd: host controller for this root hub
1476 *
1477 * This call arranges that usb_hcd_resume_root_hub() is safe to call later;
1478 * that the HCD's root hub polling is deactivated; and that the root's hub
1479 * driver is suspended. HCDs may call this to autosuspend when their root
1480 * hub's downstream ports are all inactive: unpowered, disconnected,
1481 * disabled, or suspended.
1482 *
1483 * The HCD will autoresume on device connect change detection (using SRP
1484 * or a D+/D- pullup). The HCD also autoresumes on remote wakeup signaling
1485 * from any ports that are suspended (if that is enabled). In most cases,
1486 * overcurrent signaling (on powered ports) will also start autoresume.
1487 *
1488 * Always called with IRQs blocked.
1489 */
1490void usb_hcd_suspend_root_hub (struct usb_hcd *hcd)
1491{
1492 struct urb *urb;
1493
1494 spin_lock (&hcd_root_hub_lock);
1495 usb_suspend_root_hub (hcd->self.root_hub);
1496
1497 /* force status urb to complete/unlink while suspended */
1498 if (hcd->status_urb) {
1499 urb = hcd->status_urb;
1500 urb->status = -ECONNRESET;
1501 urb->hcpriv = NULL;
1502 urb->actual_length = 0;
1503
1504 del_timer (&hcd->rh_timer);
1505 hcd->poll_pending = 0;
1506 hcd->status_urb = NULL;
1507 } else
1508 urb = NULL;
1509 spin_unlock (&hcd_root_hub_lock);
1510 hcd->state = HC_STATE_SUSPENDED;
1511
1512 if (urb)
1513 usb_hcd_giveback_urb (hcd, urb, NULL);
1514}
1515EXPORT_SYMBOL_GPL(usb_hcd_suspend_root_hub);
1516
1456/** 1517/**
1457 * usb_hcd_resume_root_hub - called by HCD to resume its root hub 1518 * usb_hcd_resume_root_hub - called by HCD to resume its root hub
1458 * @hcd: host controller for this root hub 1519 * @hcd: host controller for this root hub
@@ -1460,7 +1521,7 @@ static int hcd_hub_resume (struct usb_bus *bus)
1460 * The USB host controller calls this function when its root hub is 1521 * The USB host controller calls this function when its root hub is
1461 * suspended (with the remote wakeup feature enabled) and a remote 1522 * suspended (with the remote wakeup feature enabled) and a remote
1462 * wakeup request is received. It queues a request for khubd to 1523 * wakeup request is received. It queues a request for khubd to
1463 * resume the root hub. 1524 * resume the root hub (that is, manage its downstream ports again).
1464 */ 1525 */
1465void usb_hcd_resume_root_hub (struct usb_hcd *hcd) 1526void usb_hcd_resume_root_hub (struct usb_hcd *hcd)
1466{ 1527{
@@ -1471,13 +1532,9 @@ void usb_hcd_resume_root_hub (struct usb_hcd *hcd)
1471 usb_resume_root_hub (hcd->self.root_hub); 1532 usb_resume_root_hub (hcd->self.root_hub);
1472 spin_unlock_irqrestore (&hcd_root_hub_lock, flags); 1533 spin_unlock_irqrestore (&hcd_root_hub_lock, flags);
1473} 1534}
1535EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub);
1474 1536
1475#else
1476void usb_hcd_resume_root_hub (struct usb_hcd *hcd)
1477{
1478}
1479#endif 1537#endif
1480EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub);
1481 1538
1482/*-------------------------------------------------------------------------*/ 1539/*-------------------------------------------------------------------------*/
1483 1540
@@ -1530,10 +1587,6 @@ static struct usb_operations usb_hcd_operations = {
1530 .buffer_alloc = hcd_buffer_alloc, 1587 .buffer_alloc = hcd_buffer_alloc,
1531 .buffer_free = hcd_buffer_free, 1588 .buffer_free = hcd_buffer_free,
1532 .disable = hcd_endpoint_disable, 1589 .disable = hcd_endpoint_disable,
1533#ifdef CONFIG_USB_SUSPEND
1534 .hub_suspend = hcd_hub_suspend,
1535 .hub_resume = hcd_hub_resume,
1536#endif
1537}; 1590};
1538 1591
1539/*-------------------------------------------------------------------------*/ 1592/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 1f1ed6211af8..24a62a2ff86d 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -154,10 +154,6 @@ struct usb_operations {
154 154
155 void (*disable)(struct usb_device *udev, 155 void (*disable)(struct usb_device *udev,
156 struct usb_host_endpoint *ep); 156 struct usb_host_endpoint *ep);
157
158 /* global suspend/resume of bus */
159 int (*hub_suspend)(struct usb_bus *);
160 int (*hub_resume)(struct usb_bus *);
161}; 157};
162 158
163/* each driver provides one of these, and hardware init support */ 159/* each driver provides one of these, and hardware init support */
@@ -182,12 +178,12 @@ struct hc_driver {
182 int (*start) (struct usb_hcd *hcd); 178 int (*start) (struct usb_hcd *hcd);
183 179
184 /* NOTE: these suspend/resume calls relate to the HC as 180 /* NOTE: these suspend/resume calls relate to the HC as
185 * a whole, not just the root hub; they're for bus glue. 181 * a whole, not just the root hub; they're for PCI bus glue.
186 */ 182 */
187 /* called after all devices were suspended */ 183 /* called after suspending the hub, before entering D3 etc */
188 int (*suspend) (struct usb_hcd *hcd, pm_message_t message); 184 int (*suspend) (struct usb_hcd *hcd, pm_message_t message);
189 185
190 /* called before any devices get resumed */ 186 /* called after entering D0 (etc), before resuming the hub */
191 int (*resume) (struct usb_hcd *hcd); 187 int (*resume) (struct usb_hcd *hcd);
192 188
193 /* cleanly make HCD stop writing memory and doing I/O */ 189 /* cleanly make HCD stop writing memory and doing I/O */
@@ -212,8 +208,8 @@ struct hc_driver {
212 int (*hub_control) (struct usb_hcd *hcd, 208 int (*hub_control) (struct usb_hcd *hcd,
213 u16 typeReq, u16 wValue, u16 wIndex, 209 u16 typeReq, u16 wValue, u16 wIndex,
214 char *buf, u16 wLength); 210 char *buf, u16 wLength);
215 int (*hub_suspend)(struct usb_hcd *); 211 int (*bus_suspend)(struct usb_hcd *);
216 int (*hub_resume)(struct usb_hcd *); 212 int (*bus_resume)(struct usb_hcd *);
217 int (*start_port_reset)(struct usb_hcd *, unsigned port_num); 213 int (*start_port_reset)(struct usb_hcd *, unsigned port_num);
218 void (*hub_irq_enable)(struct usb_hcd *); 214 void (*hub_irq_enable)(struct usb_hcd *);
219 /* Needed only if port-change IRQs are level-triggered */ 215 /* Needed only if port-change IRQs are level-triggered */
@@ -355,8 +351,6 @@ extern long usb_calc_bus_time (int speed, int is_input,
355 351
356extern struct usb_bus *usb_alloc_bus (struct usb_operations *); 352extern struct usb_bus *usb_alloc_bus (struct usb_operations *);
357 353
358extern void usb_hcd_resume_root_hub (struct usb_hcd *hcd);
359
360extern void usb_set_device_state(struct usb_device *udev, 354extern void usb_set_device_state(struct usb_device *udev,
361 enum usb_device_state new_state); 355 enum usb_device_state new_state);
362 356
@@ -378,6 +372,33 @@ extern int usb_find_interface_driver (struct usb_device *dev,
378 372
379#define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN)) 373#define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN))
380 374
375#ifdef CONFIG_PM
376extern void usb_hcd_suspend_root_hub (struct usb_hcd *hcd);
377extern void usb_hcd_resume_root_hub (struct usb_hcd *hcd);
378extern int hcd_bus_suspend (struct usb_bus *bus);
379extern int hcd_bus_resume (struct usb_bus *bus);
380#else
381static inline void usb_hcd_suspend_root_hub(struct usb_hcd *hcd)
382{
383 return;
384}
385
386static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)
387{
388 return;
389}
390
391static inline int hcd_bus_suspend(struct usb_bus *bus)
392{
393 return 0;
394}
395
396static inline int hcd_bus_resume (struct usb_bus *bus)
397{
398 return 0;
399}
400#endif /* CONFIG_PM */
401
381/* 402/*
382 * USB device fs stuff 403 * USB device fs stuff
383 */ 404 */
@@ -388,23 +409,13 @@ extern int usb_find_interface_driver (struct usb_device *dev,
388 * these are expected to be called from the USB core/hub thread 409 * these are expected to be called from the USB core/hub thread
389 * with the kernel lock held 410 * with the kernel lock held
390 */ 411 */
391extern void usbfs_add_bus(struct usb_bus *bus);
392extern void usbfs_remove_bus(struct usb_bus *bus);
393extern void usbfs_add_device(struct usb_device *dev);
394extern void usbfs_remove_device(struct usb_device *dev);
395extern void usbfs_update_special (void); 412extern void usbfs_update_special (void);
396
397extern int usbfs_init(void); 413extern int usbfs_init(void);
398extern void usbfs_cleanup(void); 414extern void usbfs_cleanup(void);
399 415
400#else /* CONFIG_USB_DEVICEFS */ 416#else /* CONFIG_USB_DEVICEFS */
401 417
402static inline void usbfs_add_bus(struct usb_bus *bus) {}
403static inline void usbfs_remove_bus(struct usb_bus *bus) {}
404static inline void usbfs_add_device(struct usb_device *dev) {}
405static inline void usbfs_remove_device(struct usb_device *dev) {}
406static inline void usbfs_update_special (void) {} 418static inline void usbfs_update_special (void) {}
407
408static inline int usbfs_init(void) { return 0; } 419static inline int usbfs_init(void) { return 0; }
409static inline void usbfs_cleanup(void) { } 420static inline void usbfs_cleanup(void) { }
410 421
@@ -419,8 +430,6 @@ struct usb_mon_operations {
419 void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err); 430 void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err);
420 void (*urb_complete)(struct usb_bus *bus, struct urb *urb); 431 void (*urb_complete)(struct usb_bus *bus, struct urb *urb);
421 /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */ 432 /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */
422 void (*bus_add)(struct usb_bus *bus);
423 void (*bus_remove)(struct usb_bus *bus);
424}; 433};
425 434
426extern struct usb_mon_operations *mon_ops; 435extern struct usb_mon_operations *mon_ops;
@@ -443,18 +452,6 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb)
443 if (bus->monitored) 452 if (bus->monitored)
444 (*mon_ops->urb_complete)(bus, urb); 453 (*mon_ops->urb_complete)(bus, urb);
445} 454}
446
447static inline void usbmon_notify_bus_add(struct usb_bus *bus)
448{
449 if (mon_ops)
450 (*mon_ops->bus_add)(bus);
451}
452
453static inline void usbmon_notify_bus_remove(struct usb_bus *bus)
454{
455 if (mon_ops)
456 (*mon_ops->bus_remove)(bus);
457}
458 455
459int usb_mon_register(struct usb_mon_operations *ops); 456int usb_mon_register(struct usb_mon_operations *ops);
460void usb_mon_deregister(void); 457void usb_mon_deregister(void);
@@ -465,8 +462,6 @@ static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) {}
465static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb, 462static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
466 int error) {} 463 int error) {}
467static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb) {} 464static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb) {}
468static inline void usbmon_notify_bus_add(struct usb_bus *bus) {}
469static inline void usbmon_notify_bus_remove(struct usb_bus *bus) {}
470 465
471#endif /* CONFIG_USB_MON */ 466#endif /* CONFIG_USB_MON */
472 467
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index c3e2024c4347..256d9f698715 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -436,9 +436,10 @@ static void hub_power_on(struct usb_hub *hub)
436{ 436{
437 int port1; 437 int port1;
438 unsigned pgood_delay = hub->descriptor->bPwrOn2PwrGood * 2; 438 unsigned pgood_delay = hub->descriptor->bPwrOn2PwrGood * 2;
439 u16 wHubCharacteristics = le16_to_cpu(hub->descriptor->wHubCharacteristics);
439 440
440 /* if hub supports power switching, enable power on each port */ 441 /* if hub supports power switching, enable power on each port */
441 if ((hub->descriptor->wHubCharacteristics & HUB_CHAR_LPSM) < 2) { 442 if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2) {
442 dev_dbg(hub->intfdev, "enabling power on all ports\n"); 443 dev_dbg(hub->intfdev, "enabling power on all ports\n");
443 for (port1 = 1; port1 <= hub->descriptor->bNbrPorts; port1++) 444 for (port1 = 1; port1 <= hub->descriptor->bNbrPorts; port1++)
444 set_port_feature(hub->hdev, port1, 445 set_port_feature(hub->hdev, port1,
@@ -449,10 +450,18 @@ static void hub_power_on(struct usb_hub *hub)
449 msleep(max(pgood_delay, (unsigned) 100)); 450 msleep(max(pgood_delay, (unsigned) 100));
450} 451}
451 452
452static void hub_quiesce(struct usb_hub *hub) 453static inline void __hub_quiesce(struct usb_hub *hub)
453{ 454{
454 /* stop khubd and related activity */ 455 /* (nonblocking) khubd and related activity won't re-trigger */
455 hub->quiescing = 1; 456 hub->quiescing = 1;
457 hub->activating = 0;
458 hub->resume_root_hub = 0;
459}
460
461static void hub_quiesce(struct usb_hub *hub)
462{
463 /* (blocking) stop khubd and related activity */
464 __hub_quiesce(hub);
456 usb_kill_urb(hub->urb); 465 usb_kill_urb(hub->urb);
457 if (hub->has_indicators) 466 if (hub->has_indicators)
458 cancel_delayed_work(&hub->leds); 467 cancel_delayed_work(&hub->leds);
@@ -466,6 +475,7 @@ static void hub_activate(struct usb_hub *hub)
466 475
467 hub->quiescing = 0; 476 hub->quiescing = 0;
468 hub->activating = 1; 477 hub->activating = 1;
478 hub->resume_root_hub = 0;
469 status = usb_submit_urb(hub->urb, GFP_NOIO); 479 status = usb_submit_urb(hub->urb, GFP_NOIO);
470 if (status < 0) 480 if (status < 0)
471 dev_err(hub->intfdev, "activate --> %d\n", status); 481 dev_err(hub->intfdev, "activate --> %d\n", status);
@@ -516,6 +526,7 @@ static int hub_configure(struct usb_hub *hub,
516 struct usb_device *hdev = hub->hdev; 526 struct usb_device *hdev = hub->hdev;
517 struct device *hub_dev = hub->intfdev; 527 struct device *hub_dev = hub->intfdev;
518 u16 hubstatus, hubchange; 528 u16 hubstatus, hubchange;
529 u16 wHubCharacteristics;
519 unsigned int pipe; 530 unsigned int pipe;
520 int maxp, ret; 531 int maxp, ret;
521 char *message; 532 char *message;
@@ -561,9 +572,9 @@ static int hub_configure(struct usb_hub *hub,
561 dev_info (hub_dev, "%d port%s detected\n", hdev->maxchild, 572 dev_info (hub_dev, "%d port%s detected\n", hdev->maxchild,
562 (hdev->maxchild == 1) ? "" : "s"); 573 (hdev->maxchild == 1) ? "" : "s");
563 574
564 le16_to_cpus(&hub->descriptor->wHubCharacteristics); 575 wHubCharacteristics = le16_to_cpu(hub->descriptor->wHubCharacteristics);
565 576
566 if (hub->descriptor->wHubCharacteristics & HUB_CHAR_COMPOUND) { 577 if (wHubCharacteristics & HUB_CHAR_COMPOUND) {
567 int i; 578 int i;
568 char portstr [USB_MAXCHILDREN + 1]; 579 char portstr [USB_MAXCHILDREN + 1];
569 580
@@ -576,7 +587,7 @@ static int hub_configure(struct usb_hub *hub,
576 } else 587 } else
577 dev_dbg(hub_dev, "standalone hub\n"); 588 dev_dbg(hub_dev, "standalone hub\n");
578 589
579 switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_LPSM) { 590 switch (wHubCharacteristics & HUB_CHAR_LPSM) {
580 case 0x00: 591 case 0x00:
581 dev_dbg(hub_dev, "ganged power switching\n"); 592 dev_dbg(hub_dev, "ganged power switching\n");
582 break; 593 break;
@@ -589,7 +600,7 @@ static int hub_configure(struct usb_hub *hub,
589 break; 600 break;
590 } 601 }
591 602
592 switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_OCPM) { 603 switch (wHubCharacteristics & HUB_CHAR_OCPM) {
593 case 0x00: 604 case 0x00:
594 dev_dbg(hub_dev, "global over-current protection\n"); 605 dev_dbg(hub_dev, "global over-current protection\n");
595 break; 606 break;
@@ -629,7 +640,7 @@ static int hub_configure(struct usb_hub *hub,
629 } 640 }
630 641
631 /* Note 8 FS bit times == (8 bits / 12000000 bps) ~= 666ns */ 642 /* Note 8 FS bit times == (8 bits / 12000000 bps) ~= 666ns */
632 switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_TTTT) { 643 switch (wHubCharacteristics & HUB_CHAR_TTTT) {
633 case HUB_TTTT_8_BITS: 644 case HUB_TTTT_8_BITS:
634 if (hdev->descriptor.bDeviceProtocol != 0) { 645 if (hdev->descriptor.bDeviceProtocol != 0) {
635 hub->tt.think_time = 666; 646 hub->tt.think_time = 666;
@@ -659,7 +670,7 @@ static int hub_configure(struct usb_hub *hub,
659 } 670 }
660 671
661 /* probe() zeroes hub->indicator[] */ 672 /* probe() zeroes hub->indicator[] */
662 if (hub->descriptor->wHubCharacteristics & HUB_CHAR_PORTIND) { 673 if (wHubCharacteristics & HUB_CHAR_PORTIND) {
663 hub->has_indicators = 1; 674 hub->has_indicators = 1;
664 dev_dbg(hub_dev, "Port indicators are supported\n"); 675 dev_dbg(hub_dev, "Port indicators are supported\n");
665 } 676 }
@@ -704,7 +715,7 @@ static int hub_configure(struct usb_hub *hub,
704 (hubstatus & HUB_STATUS_LOCAL_POWER) 715 (hubstatus & HUB_STATUS_LOCAL_POWER)
705 ? "lost (inactive)" : "good"); 716 ? "lost (inactive)" : "good");
706 717
707 if ((hub->descriptor->wHubCharacteristics & HUB_CHAR_OCPM) == 0) 718 if ((wHubCharacteristics & HUB_CHAR_OCPM) == 0)
708 dev_dbg(hub_dev, "%sover-current condition exists\n", 719 dev_dbg(hub_dev, "%sover-current condition exists\n",
709 (hubstatus & HUB_STATUS_OVERCURRENT) ? "" : "no "); 720 (hubstatus & HUB_STATUS_OVERCURRENT) ? "" : "no ");
710 721
@@ -854,14 +865,12 @@ descriptor_error:
854 /* We found a hub */ 865 /* We found a hub */
855 dev_info (&intf->dev, "USB hub found\n"); 866 dev_info (&intf->dev, "USB hub found\n");
856 867
857 hub = kmalloc(sizeof(*hub), GFP_KERNEL); 868 hub = kzalloc(sizeof(*hub), GFP_KERNEL);
858 if (!hub) { 869 if (!hub) {
859 dev_dbg (&intf->dev, "couldn't kmalloc hub struct\n"); 870 dev_dbg (&intf->dev, "couldn't kmalloc hub struct\n");
860 return -ENOMEM; 871 return -ENOMEM;
861 } 872 }
862 873
863 memset(hub, 0, sizeof(*hub));
864
865 INIT_LIST_HEAD(&hub->event_list); 874 INIT_LIST_HEAD(&hub->event_list);
866 hub->intfdev = &intf->dev; 875 hub->intfdev = &intf->dev;
867 hub->hdev = hdev; 876 hub->hdev = hdev;
@@ -1117,14 +1126,14 @@ void usb_disconnect(struct usb_device **pdev)
1117 */ 1126 */
1118 usb_disable_device(udev, 0); 1127 usb_disable_device(udev, 0);
1119 1128
1129 usb_notify_remove_device(udev);
1130
1120 /* Free the device number, remove the /proc/bus/usb entry and 1131 /* Free the device number, remove the /proc/bus/usb entry and
1121 * the sysfs attributes, and delete the parent's children[] 1132 * the sysfs attributes, and delete the parent's children[]
1122 * (or root_hub) pointer. 1133 * (or root_hub) pointer.
1123 */ 1134 */
1124 dev_dbg (&udev->dev, "unregistering device\n"); 1135 dev_dbg (&udev->dev, "unregistering device\n");
1125 release_address(udev); 1136 release_address(udev);
1126 usbfs_remove_device(udev);
1127 usbdev_remove(udev);
1128 usb_remove_sysfs_dev_files(udev); 1137 usb_remove_sysfs_dev_files(udev);
1129 1138
1130 /* Avoid races with recursively_mark_NOTATTACHED() */ 1139 /* Avoid races with recursively_mark_NOTATTACHED() */
@@ -1195,21 +1204,6 @@ static inline void show_string(struct usb_device *udev, char *id, char *string)
1195{} 1204{}
1196#endif 1205#endif
1197 1206
1198static void get_string(struct usb_device *udev, char **string, int index)
1199{
1200 char *buf;
1201
1202 if (!index)
1203 return;
1204 buf = kmalloc(256, GFP_KERNEL);
1205 if (!buf)
1206 return;
1207 if (usb_string(udev, index, buf, 256) > 0)
1208 *string = buf;
1209 else
1210 kfree(buf);
1211}
1212
1213 1207
1214#ifdef CONFIG_USB_OTG 1208#ifdef CONFIG_USB_OTG
1215#include "otg_whitelist.h" 1209#include "otg_whitelist.h"
@@ -1248,9 +1242,10 @@ int usb_new_device(struct usb_device *udev)
1248 } 1242 }
1249 1243
1250 /* read the standard strings and cache them if present */ 1244 /* read the standard strings and cache them if present */
1251 get_string(udev, &udev->product, udev->descriptor.iProduct); 1245 udev->product = usb_cache_string(udev, udev->descriptor.iProduct);
1252 get_string(udev, &udev->manufacturer, udev->descriptor.iManufacturer); 1246 udev->manufacturer = usb_cache_string(udev,
1253 get_string(udev, &udev->serial, udev->descriptor.iSerialNumber); 1247 udev->descriptor.iManufacturer);
1248 udev->serial = usb_cache_string(udev, udev->descriptor.iSerialNumber);
1254 1249
1255 /* Tell the world! */ 1250 /* Tell the world! */
1256 dev_dbg(&udev->dev, "new device strings: Mfr=%d, Product=%d, " 1251 dev_dbg(&udev->dev, "new device strings: Mfr=%d, Product=%d, "
@@ -1322,11 +1317,9 @@ int usb_new_device(struct usb_device *udev)
1322 * (Includes HNP test device.) 1317 * (Includes HNP test device.)
1323 */ 1318 */
1324 if (udev->bus->b_hnp_enable || udev->bus->is_b_host) { 1319 if (udev->bus->b_hnp_enable || udev->bus->is_b_host) {
1325 static int __usb_suspend_device (struct usb_device *, 1320 static int __usb_suspend_device(struct usb_device *,
1326 int port1, pm_message_t state); 1321 int port1);
1327 err = __usb_suspend_device(udev, 1322 err = __usb_suspend_device(udev, udev->bus->otg_port);
1328 udev->bus->otg_port,
1329 PMSG_SUSPEND);
1330 if (err < 0) 1323 if (err < 0)
1331 dev_dbg(&udev->dev, "HNP fail, %d\n", err); 1324 dev_dbg(&udev->dev, "HNP fail, %d\n", err);
1332 } 1325 }
@@ -1362,10 +1355,8 @@ int usb_new_device(struct usb_device *udev)
1362 } 1355 }
1363 1356
1364 /* USB device state == configured ... usable */ 1357 /* USB device state == configured ... usable */
1358 usb_notify_add_device(udev);
1365 1359
1366 /* add a /proc/bus/usb entry */
1367 usbdev_add(udev);
1368 usbfs_add_device(udev);
1369 return 0; 1360 return 0;
1370 1361
1371fail: 1362fail:
@@ -1516,7 +1507,7 @@ static void hub_port_logical_disconnect(struct usb_hub *hub, int port1)
1516 /* FIXME let caller ask to power down the port: 1507 /* FIXME let caller ask to power down the port:
1517 * - some devices won't enumerate without a VBUS power cycle 1508 * - some devices won't enumerate without a VBUS power cycle
1518 * - SRP saves power that way 1509 * - SRP saves power that way
1519 * - usb_suspend_device(dev, PMSG_SUSPEND) 1510 * - ... new call, TBD ...
1520 * That's easy if this hub can switch power per-port, and 1511 * That's easy if this hub can switch power per-port, and
1521 * khubd reactivates the port later (timer, SRP, etc). 1512 * khubd reactivates the port later (timer, SRP, etc).
1522 * Powerdown must be optional, because of reset/DFU. 1513 * Powerdown must be optional, because of reset/DFU.
@@ -1598,11 +1589,14 @@ static int hub_port_suspend(struct usb_hub *hub, int port1,
1598 * Other than re-initializing the hub (plug/unplug, except for root hubs), 1589 * Other than re-initializing the hub (plug/unplug, except for root hubs),
1599 * Linux (2.6) currently has NO mechanisms to initiate that: no khubd 1590 * Linux (2.6) currently has NO mechanisms to initiate that: no khubd
1600 * timer, no SRP, no requests through sysfs. 1591 * timer, no SRP, no requests through sysfs.
1592 *
1593 * If CONFIG_USB_SUSPEND isn't enabled, devices only really suspend when
1594 * the root hub for their bus goes into global suspend ... so we don't
1595 * (falsely) update the device power state to say it suspended.
1601 */ 1596 */
1602static int __usb_suspend_device (struct usb_device *udev, int port1, 1597static int __usb_suspend_device (struct usb_device *udev, int port1)
1603 pm_message_t state)
1604{ 1598{
1605 int status; 1599 int status = 0;
1606 1600
1607 /* caller owns the udev device lock */ 1601 /* caller owns the udev device lock */
1608 if (port1 < 0) 1602 if (port1 < 0)
@@ -1613,95 +1607,39 @@ static int __usb_suspend_device (struct usb_device *udev, int port1,
1613 return 0; 1607 return 0;
1614 } 1608 }
1615 1609
1616 /* suspend interface drivers; if this is a hub, it 1610 /* all interfaces must already be suspended */
1617 * suspends the child devices
1618 */
1619 if (udev->actconfig) { 1611 if (udev->actconfig) {
1620 int i; 1612 int i;
1621 1613
1622 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { 1614 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
1623 struct usb_interface *intf; 1615 struct usb_interface *intf;
1624 struct usb_driver *driver;
1625 1616
1626 intf = udev->actconfig->interface[i]; 1617 intf = udev->actconfig->interface[i];
1627 if (state.event <= intf->dev.power.power_state.event) 1618 if (is_active(intf)) {
1628 continue; 1619 dev_dbg(&intf->dev, "nyet suspended\n");
1629 if (!intf->dev.driver) 1620 return -EBUSY;
1630 continue;
1631 driver = to_usb_driver(intf->dev.driver);
1632
1633 if (driver->suspend) {
1634 status = driver->suspend(intf, state);
1635 if (intf->dev.power.power_state.event != state.event
1636 || status)
1637 dev_err(&intf->dev,
1638 "suspend %d fail, code %d\n",
1639 state.event, status);
1640 }
1641
1642 /* only drivers with suspend() can ever resume();
1643 * and after power loss, even they won't.
1644 * bus_rescan_devices() can rebind drivers later.
1645 *
1646 * FIXME the PM core self-deadlocks when unbinding
1647 * drivers during suspend/resume ... everything grabs
1648 * dpm_sem (not a spinlock, ugh). we want to unbind,
1649 * since we know every driver's probe/disconnect works
1650 * even for drivers that can't suspend.
1651 */
1652 if (!driver->suspend || state.event > PM_EVENT_FREEZE) {
1653#if 1
1654 dev_warn(&intf->dev, "resume is unsafe!\n");
1655#else
1656 down_write(&usb_bus_type.rwsem);
1657 device_release_driver(&intf->dev);
1658 up_write(&usb_bus_type.rwsem);
1659#endif
1660 } 1621 }
1661 } 1622 }
1662 } 1623 }
1663 1624
1664 /* 1625 /* we only change a device's upstream USB link.
1665 * FIXME this needs port power off call paths too, to help force 1626 * root hubs have no upstream USB link.
1666 * USB into the "generic" PM model. At least for devices on
1667 * ports that aren't using ganged switching (usually root hubs).
1668 *
1669 * NOTE: SRP-capable links should adopt more aggressive poweroff
1670 * policies (when HNP doesn't apply) once we have mechanisms to
1671 * turn power back on! (Likely not before 2.7...)
1672 */ 1627 */
1673 if (state.event > PM_EVENT_FREEZE) { 1628 if (udev->parent)
1674 dev_warn(&udev->dev, "no poweroff yet, suspending instead\n");
1675 }
1676
1677 /* "global suspend" of the HC-to-USB interface (root hub), or
1678 * "selective suspend" of just one hub-device link.
1679 */
1680 if (!udev->parent) {
1681 struct usb_bus *bus = udev->bus;
1682 if (bus && bus->op->hub_suspend) {
1683 status = bus->op->hub_suspend (bus);
1684 if (status == 0) {
1685 dev_dbg(&udev->dev, "usb suspend\n");
1686 usb_set_device_state(udev,
1687 USB_STATE_SUSPENDED);
1688 }
1689 } else
1690 status = -EOPNOTSUPP;
1691 } else
1692 status = hub_port_suspend(hdev_to_hub(udev->parent), port1, 1629 status = hub_port_suspend(hdev_to_hub(udev->parent), port1,
1693 udev); 1630 udev);
1694 1631
1695 if (status == 0) 1632 if (status == 0)
1696 udev->dev.power.power_state = state; 1633 udev->dev.power.power_state = PMSG_SUSPEND;
1697 return status; 1634 return status;
1698} 1635}
1699 1636
1700/** 1637#endif
1638
1639/*
1701 * usb_suspend_device - suspend a usb device 1640 * usb_suspend_device - suspend a usb device
1702 * @udev: device that's no longer in active use 1641 * @udev: device that's no longer in active use
1703 * @state: PMSG_SUSPEND to suspend 1642 * Context: must be able to sleep; device not locked; pm locks held
1704 * Context: must be able to sleep; device not locked
1705 * 1643 *
1706 * Suspends a USB device that isn't in active use, conserving power. 1644 * Suspends a USB device that isn't in active use, conserving power.
1707 * Devices may wake out of a suspend, if anything important happens, 1645 * Devices may wake out of a suspend, if anything important happens,
@@ -1709,37 +1647,50 @@ static int __usb_suspend_device (struct usb_device *udev, int port1,
1709 * suspend by the host, using usb_resume_device(). It's also routine 1647 * suspend by the host, using usb_resume_device(). It's also routine
1710 * to disconnect devices while they are suspended. 1648 * to disconnect devices while they are suspended.
1711 * 1649 *
1650 * This only affects the USB hardware for a device; its interfaces
1651 * (and, for hubs, child devices) must already have been suspended.
1652 *
1712 * Suspending OTG devices may trigger HNP, if that's been enabled 1653 * Suspending OTG devices may trigger HNP, if that's been enabled
1713 * between a pair of dual-role devices. That will change roles, such 1654 * between a pair of dual-role devices. That will change roles, such
1714 * as from A-Host to A-Peripheral or from B-Host back to B-Peripheral. 1655 * as from A-Host to A-Peripheral or from B-Host back to B-Peripheral.
1715 * 1656 *
1716 * Returns 0 on success, else negative errno. 1657 * Returns 0 on success, else negative errno.
1717 */ 1658 */
1718int usb_suspend_device(struct usb_device *udev, pm_message_t state) 1659int usb_suspend_device(struct usb_device *udev)
1719{ 1660{
1661#ifdef CONFIG_USB_SUSPEND
1720 int port1, status; 1662 int port1, status;
1721 1663
1722 port1 = locktree(udev); 1664 port1 = locktree(udev);
1723 if (port1 < 0) 1665 if (port1 < 0)
1724 return port1; 1666 return port1;
1725 1667
1726 status = __usb_suspend_device(udev, port1, state); 1668 status = __usb_suspend_device(udev, port1);
1727 usb_unlock_device(udev); 1669 usb_unlock_device(udev);
1728 return status; 1670 return status;
1671#else
1672 /* NOTE: udev->state unchanged, it's not lying ... */
1673 udev->dev.power.power_state = PMSG_SUSPEND;
1674 return 0;
1675#endif
1729} 1676}
1677EXPORT_SYMBOL_GPL(usb_suspend_device);
1730 1678
1731/* 1679/*
1680 * If the USB "suspend" state is in use (rather than "global suspend"),
1681 * many devices will be individually taken out of suspend state using
1682 * special" resume" signaling. These routines kick in shortly after
1732 * hardware resume signaling is finished, either because of selective 1683 * hardware resume signaling is finished, either because of selective
1733 * resume (by host) or remote wakeup (by device) ... now see what changed 1684 * resume (by host) or remote wakeup (by device) ... now see what changed
1734 * in the tree that's rooted at this device. 1685 * in the tree that's rooted at this device.
1735 */ 1686 */
1736static int finish_port_resume(struct usb_device *udev) 1687static int finish_device_resume(struct usb_device *udev)
1737{ 1688{
1738 int status; 1689 int status;
1739 u16 devstatus; 1690 u16 devstatus;
1740 1691
1741 /* caller owns the udev device lock */ 1692 /* caller owns the udev device lock */
1742 dev_dbg(&udev->dev, "usb resume\n"); 1693 dev_dbg(&udev->dev, "finish resume\n");
1743 1694
1744 /* usb ch9 identifies four variants of SUSPENDED, based on what 1695 /* usb ch9 identifies four variants of SUSPENDED, based on what
1745 * state the device resumes to. Linux currently won't see the 1696 * state the device resumes to. Linux currently won't see the
@@ -1749,7 +1700,6 @@ static int finish_port_resume(struct usb_device *udev)
1749 usb_set_device_state(udev, udev->actconfig 1700 usb_set_device_state(udev, udev->actconfig
1750 ? USB_STATE_CONFIGURED 1701 ? USB_STATE_CONFIGURED
1751 : USB_STATE_ADDRESS); 1702 : USB_STATE_ADDRESS);
1752 udev->dev.power.power_state = PMSG_ON;
1753 1703
1754 /* 10.5.4.5 says be sure devices in the tree are still there. 1704 /* 10.5.4.5 says be sure devices in the tree are still there.
1755 * For now let's assume the device didn't go crazy on resume, 1705 * For now let's assume the device didn't go crazy on resume,
@@ -1762,9 +1712,11 @@ static int finish_port_resume(struct usb_device *udev)
1762 status); 1712 status);
1763 else if (udev->actconfig) { 1713 else if (udev->actconfig) {
1764 unsigned i; 1714 unsigned i;
1715 int (*resume)(struct device *);
1765 1716
1766 le16_to_cpus(&devstatus); 1717 le16_to_cpus(&devstatus);
1767 if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) { 1718 if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)
1719 && udev->parent) {
1768 status = usb_control_msg(udev, 1720 status = usb_control_msg(udev,
1769 usb_sndctrlpipe(udev, 0), 1721 usb_sndctrlpipe(udev, 0),
1770 USB_REQ_CLEAR_FEATURE, 1722 USB_REQ_CLEAR_FEATURE,
@@ -1780,33 +1732,11 @@ static int finish_port_resume(struct usb_device *udev)
1780 } 1732 }
1781 1733
1782 /* resume interface drivers; if this is a hub, it 1734 /* resume interface drivers; if this is a hub, it
1783 * resumes the child devices 1735 * may have a child resume event to deal with soon
1784 */ 1736 */
1785 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { 1737 resume = udev->dev.bus->resume;
1786 struct usb_interface *intf; 1738 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++)
1787 struct usb_driver *driver; 1739 (void) resume(&udev->actconfig->interface[i]->dev);
1788
1789 intf = udev->actconfig->interface[i];
1790 if (intf->dev.power.power_state.event == PM_EVENT_ON)
1791 continue;
1792 if (!intf->dev.driver) {
1793 /* FIXME maybe force to alt 0 */
1794 continue;
1795 }
1796 driver = to_usb_driver(intf->dev.driver);
1797
1798 /* bus_rescan_devices() may rebind drivers */
1799 if (!driver->resume)
1800 continue;
1801
1802 /* can we do better than just logging errors? */
1803 status = driver->resume(intf);
1804 if (intf->dev.power.power_state.event != PM_EVENT_ON
1805 || status)
1806 dev_dbg(&intf->dev,
1807 "resume fail, state %d code %d\n",
1808 intf->dev.power.power_state.event, status);
1809 }
1810 status = 0; 1740 status = 0;
1811 1741
1812 } else if (udev->devnum <= 0) { 1742 } else if (udev->devnum <= 0) {
@@ -1816,6 +1746,8 @@ static int finish_port_resume(struct usb_device *udev)
1816 return status; 1746 return status;
1817} 1747}
1818 1748
1749#ifdef CONFIG_USB_SUSPEND
1750
1819static int 1751static int
1820hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev) 1752hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev)
1821{ 1753{
@@ -1861,7 +1793,7 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev)
1861 /* TRSMRCY = 10 msec */ 1793 /* TRSMRCY = 10 msec */
1862 msleep(10); 1794 msleep(10);
1863 if (udev) 1795 if (udev)
1864 status = finish_port_resume(udev); 1796 status = finish_device_resume(udev);
1865 } 1797 }
1866 } 1798 }
1867 if (status < 0) 1799 if (status < 0)
@@ -1870,12 +1802,12 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev)
1870 return status; 1802 return status;
1871} 1803}
1872 1804
1873static int hub_resume (struct usb_interface *intf); 1805#endif
1874 1806
1875/** 1807/*
1876 * usb_resume_device - re-activate a suspended usb device 1808 * usb_resume_device - re-activate a suspended usb device
1877 * @udev: device to re-activate 1809 * @udev: device to re-activate
1878 * Context: must be able to sleep; device not locked 1810 * Context: must be able to sleep; device not locked; pm locks held
1879 * 1811 *
1880 * This will re-activate the suspended device, increasing power usage 1812 * This will re-activate the suspended device, increasing power usage
1881 * while letting drivers communicate again with its endpoints. 1813 * while letting drivers communicate again with its endpoints.
@@ -1893,35 +1825,22 @@ int usb_resume_device(struct usb_device *udev)
1893 if (port1 < 0) 1825 if (port1 < 0)
1894 return port1; 1826 return port1;
1895 1827
1896 /* "global resume" of the HC-to-USB interface (root hub), or 1828#ifdef CONFIG_USB_SUSPEND
1897 * selective resume of one hub-to-device port 1829 /* selective resume of one downstream hub-to-device port */
1898 */ 1830 if (udev->parent) {
1899 if (!udev->parent) { 1831 if (udev->state == USB_STATE_SUSPENDED) {
1900 struct usb_bus *bus = udev->bus; 1832 // NOTE swsusp may bork us, device state being wrong...
1901 if (bus && bus->op->hub_resume) { 1833 // NOTE this fails if parent is also suspended...
1902 status = bus->op->hub_resume (bus); 1834 status = hub_port_resume(hdev_to_hub(udev->parent),
1835 port1, udev);
1903 } else 1836 } else
1904 status = -EOPNOTSUPP; 1837 status = 0;
1905 if (status == 0) { 1838 } else
1906 dev_dbg(&udev->dev, "usb resume\n"); 1839#endif
1907 /* TRSMRCY = 10 msec */ 1840 status = finish_device_resume(udev);
1908 msleep(10); 1841 if (status < 0)
1909 usb_set_device_state (udev, USB_STATE_CONFIGURED);
1910 udev->dev.power.power_state = PMSG_ON;
1911 status = hub_resume (udev
1912 ->actconfig->interface[0]);
1913 }
1914 } else if (udev->state == USB_STATE_SUSPENDED) {
1915 // NOTE this fails if parent is also suspended...
1916 status = hub_port_resume(hdev_to_hub(udev->parent),
1917 port1, udev);
1918 } else {
1919 status = 0;
1920 }
1921 if (status < 0) {
1922 dev_dbg(&udev->dev, "can't resume, status %d\n", 1842 dev_dbg(&udev->dev, "can't resume, status %d\n",
1923 status); 1843 status);
1924 }
1925 1844
1926 usb_unlock_device(udev); 1845 usb_unlock_device(udev);
1927 1846
@@ -1938,6 +1857,8 @@ static int remote_wakeup(struct usb_device *udev)
1938{ 1857{
1939 int status = 0; 1858 int status = 0;
1940 1859
1860#ifdef CONFIG_USB_SUSPEND
1861
1941 /* don't repeat RESUME sequence if this device 1862 /* don't repeat RESUME sequence if this device
1942 * was already woken up by some other task 1863 * was already woken up by some other task
1943 */ 1864 */
@@ -1946,38 +1867,52 @@ static int remote_wakeup(struct usb_device *udev)
1946 dev_dbg(&udev->dev, "RESUME (wakeup)\n"); 1867 dev_dbg(&udev->dev, "RESUME (wakeup)\n");
1947 /* TRSMRCY = 10 msec */ 1868 /* TRSMRCY = 10 msec */
1948 msleep(10); 1869 msleep(10);
1949 status = finish_port_resume(udev); 1870 status = finish_device_resume(udev);
1950 } 1871 }
1951 up(&udev->serialize); 1872 up(&udev->serialize);
1873#endif
1952 return status; 1874 return status;
1953} 1875}
1954 1876
1955static int hub_suspend(struct usb_interface *intf, pm_message_t state) 1877static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
1956{ 1878{
1957 struct usb_hub *hub = usb_get_intfdata (intf); 1879 struct usb_hub *hub = usb_get_intfdata (intf);
1958 struct usb_device *hdev = hub->hdev; 1880 struct usb_device *hdev = hub->hdev;
1959 unsigned port1; 1881 unsigned port1;
1960 int status;
1961
1962 /* stop khubd and related activity */
1963 hub_quiesce(hub);
1964 1882
1965 /* then suspend every port */ 1883 /* fail if children aren't already suspended */
1966 for (port1 = 1; port1 <= hdev->maxchild; port1++) { 1884 for (port1 = 1; port1 <= hdev->maxchild; port1++) {
1967 struct usb_device *udev; 1885 struct usb_device *udev;
1968 1886
1969 udev = hdev->children [port1-1]; 1887 udev = hdev->children [port1-1];
1970 if (!udev) 1888 if (udev && (udev->dev.power.power_state.event
1971 continue; 1889 == PM_EVENT_ON
1972 down(&udev->serialize); 1890#ifdef CONFIG_USB_SUSPEND
1973 status = __usb_suspend_device(udev, port1, state); 1891 || udev->state != USB_STATE_SUSPENDED
1974 up(&udev->serialize); 1892#endif
1975 if (status < 0) 1893 )) {
1976 dev_dbg(&intf->dev, "suspend port %d --> %d\n", 1894 dev_dbg(&intf->dev, "port %d nyet suspended\n", port1);
1977 port1, status); 1895 return -EBUSY;
1896 }
1978 } 1897 }
1979 1898
1980 intf->dev.power.power_state = state; 1899 /* "global suspend" of the downstream HC-to-USB interface */
1900 if (!hdev->parent) {
1901 struct usb_bus *bus = hdev->bus;
1902 if (bus) {
1903 int status = hcd_bus_suspend (bus);
1904
1905 if (status != 0) {
1906 dev_dbg(&hdev->dev, "'global' suspend %d\n",
1907 status);
1908 return status;
1909 }
1910 } else
1911 return -EOPNOTSUPP;
1912 }
1913
1914 /* stop khubd and related activity */
1915 hub_quiesce(hub);
1981 return 0; 1916 return 0;
1982} 1917}
1983 1918
@@ -1985,11 +1920,35 @@ static int hub_resume(struct usb_interface *intf)
1985{ 1920{
1986 struct usb_device *hdev = interface_to_usbdev(intf); 1921 struct usb_device *hdev = interface_to_usbdev(intf);
1987 struct usb_hub *hub = usb_get_intfdata (intf); 1922 struct usb_hub *hub = usb_get_intfdata (intf);
1988 unsigned port1;
1989 int status; 1923 int status;
1990 1924
1991 if (intf->dev.power.power_state.event == PM_EVENT_ON) 1925 /* "global resume" of the downstream HC-to-USB interface */
1992 return 0; 1926 if (!hdev->parent) {
1927 struct usb_bus *bus = hdev->bus;
1928 if (bus) {
1929 status = hcd_bus_resume (bus);
1930 if (status) {
1931 dev_dbg(&intf->dev, "'global' resume %d\n",
1932 status);
1933 return status;
1934 }
1935 } else
1936 return -EOPNOTSUPP;
1937 if (status == 0) {
1938 /* TRSMRCY = 10 msec */
1939 msleep(10);
1940 }
1941 }
1942
1943 hub_activate(hub);
1944
1945 /* REVISIT: this recursion probably shouldn't exist. Remove
1946 * this code sometime, after retesting with different root and
1947 * external hubs.
1948 */
1949#ifdef CONFIG_USB_SUSPEND
1950 {
1951 unsigned port1;
1993 1952
1994 for (port1 = 1; port1 <= hdev->maxchild; port1++) { 1953 for (port1 = 1; port1 <= hdev->maxchild; port1++) {
1995 struct usb_device *udev; 1954 struct usb_device *udev;
@@ -2015,7 +1974,7 @@ static int hub_resume(struct usb_interface *intf)
2015 if (portstat & USB_PORT_STAT_SUSPEND) 1974 if (portstat & USB_PORT_STAT_SUSPEND)
2016 status = hub_port_resume(hub, port1, udev); 1975 status = hub_port_resume(hub, port1, udev);
2017 else { 1976 else {
2018 status = finish_port_resume(udev); 1977 status = finish_device_resume(udev);
2019 if (status < 0) { 1978 if (status < 0) {
2020 dev_dbg(&intf->dev, "resume port %d --> %d\n", 1979 dev_dbg(&intf->dev, "resume port %d --> %d\n",
2021 port1, status); 1980 port1, status);
@@ -2024,43 +1983,31 @@ static int hub_resume(struct usb_interface *intf)
2024 } 1983 }
2025 up(&udev->serialize); 1984 up(&udev->serialize);
2026 } 1985 }
2027 intf->dev.power.power_state = PMSG_ON; 1986 }
2028 1987#endif
2029 hub->resume_root_hub = 0;
2030 hub_activate(hub);
2031 return 0; 1988 return 0;
2032} 1989}
2033 1990
2034void usb_resume_root_hub(struct usb_device *hdev) 1991void usb_suspend_root_hub(struct usb_device *hdev)
2035{ 1992{
2036 struct usb_hub *hub = hdev_to_hub(hdev); 1993 struct usb_hub *hub = hdev_to_hub(hdev);
2037 1994
2038 hub->resume_root_hub = 1; 1995 /* This also makes any led blinker stop retriggering. We're called
2039 kick_khubd(hub); 1996 * from irq, so the blinker might still be scheduled. Caller promises
1997 * that the root hub status URB will be canceled.
1998 */
1999 __hub_quiesce(hub);
2000 mark_quiesced(to_usb_interface(hub->intfdev));
2040} 2001}
2041 2002
2042#else /* !CONFIG_USB_SUSPEND */ 2003void usb_resume_root_hub(struct usb_device *hdev)
2043
2044int usb_suspend_device(struct usb_device *udev, pm_message_t state)
2045{ 2004{
2046 return 0; 2005 struct usb_hub *hub = hdev_to_hub(hdev);
2047}
2048 2006
2049int usb_resume_device(struct usb_device *udev) 2007 hub->resume_root_hub = 1;
2050{ 2008 kick_khubd(hub);
2051 return 0;
2052} 2009}
2053 2010
2054#define hub_suspend NULL
2055#define hub_resume NULL
2056#define remote_wakeup(x) 0
2057
2058#endif /* CONFIG_USB_SUSPEND */
2059
2060EXPORT_SYMBOL(usb_suspend_device);
2061EXPORT_SYMBOL(usb_resume_device);
2062
2063
2064 2011
2065/* USB 2.0 spec, 7.1.7.3 / fig 7-29: 2012/* USB 2.0 spec, 7.1.7.3 / fig 7-29:
2066 * 2013 *
@@ -2469,6 +2416,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2469{ 2416{
2470 struct usb_device *hdev = hub->hdev; 2417 struct usb_device *hdev = hub->hdev;
2471 struct device *hub_dev = hub->intfdev; 2418 struct device *hub_dev = hub->intfdev;
2419 u16 wHubCharacteristics = le16_to_cpu(hub->descriptor->wHubCharacteristics);
2472 int status, i; 2420 int status, i;
2473 2421
2474 dev_dbg (hub_dev, 2422 dev_dbg (hub_dev,
@@ -2506,8 +2454,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2506 if (!(portstatus & USB_PORT_STAT_CONNECTION)) { 2454 if (!(portstatus & USB_PORT_STAT_CONNECTION)) {
2507 2455
2508 /* maybe switch power back on (e.g. root hub was reset) */ 2456 /* maybe switch power back on (e.g. root hub was reset) */
2509 if ((hub->descriptor->wHubCharacteristics 2457 if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2
2510 & HUB_CHAR_LPSM) < 2
2511 && !(portstatus & (1 << USB_PORT_FEAT_POWER))) 2458 && !(portstatus & (1 << USB_PORT_FEAT_POWER)))
2512 set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); 2459 set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
2513 2460
@@ -2686,21 +2633,28 @@ static void hub_events(void)
2686 intf = to_usb_interface(hub->intfdev); 2633 intf = to_usb_interface(hub->intfdev);
2687 hub_dev = &intf->dev; 2634 hub_dev = &intf->dev;
2688 2635
2689 dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n", 2636 i = hub->resume_root_hub;
2637
2638 dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x%s\n",
2690 hdev->state, hub->descriptor 2639 hdev->state, hub->descriptor
2691 ? hub->descriptor->bNbrPorts 2640 ? hub->descriptor->bNbrPorts
2692 : 0, 2641 : 0,
2693 /* NOTE: expects max 15 ports... */ 2642 /* NOTE: expects max 15 ports... */
2694 (u16) hub->change_bits[0], 2643 (u16) hub->change_bits[0],
2695 (u16) hub->event_bits[0]); 2644 (u16) hub->event_bits[0],
2645 i ? ", resume root" : "");
2696 2646
2697 usb_get_intf(intf); 2647 usb_get_intf(intf);
2698 i = hub->resume_root_hub;
2699 spin_unlock_irq(&hub_event_lock); 2648 spin_unlock_irq(&hub_event_lock);
2700 2649
2701 /* Is this is a root hub wanting to be resumed? */ 2650 /* Is this is a root hub wanting to reactivate the downstream
2702 if (i) 2651 * ports? If so, be sure the interface resumes even if its
2703 usb_resume_device(hdev); 2652 * stub "device" node was never suspended.
2653 */
2654 if (i) {
2655 dpm_runtime_resume(&hdev->dev);
2656 dpm_runtime_resume(&intf->dev);
2657 }
2704 2658
2705 /* Lock the device, then check to see if we were 2659 /* Lock the device, then check to see if we were
2706 * disconnected while waiting for the lock to succeed. */ 2660 * disconnected while waiting for the lock to succeed. */
diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
index e7fa9b5a521e..bf23f8978024 100644
--- a/drivers/usb/core/hub.h
+++ b/drivers/usb/core/hub.h
@@ -131,7 +131,7 @@ struct usb_hub_descriptor {
131 __u8 bDescLength; 131 __u8 bDescLength;
132 __u8 bDescriptorType; 132 __u8 bDescriptorType;
133 __u8 bNbrPorts; 133 __u8 bNbrPorts;
134 __u16 wHubCharacteristics; 134 __le16 wHubCharacteristics;
135 __u8 bPwrOn2PwrGood; 135 __u8 bPwrOn2PwrGood;
136 __u8 bHubContrCurrent; 136 __u8 bHubContrCurrent;
137 /* add 1 bit for hub status change; round to bytes */ 137 /* add 1 bit for hub status change; round to bytes */
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index d07bba01995b..12f490fdee8f 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -39,6 +39,7 @@
39#include <linux/usbdevice_fs.h> 39#include <linux/usbdevice_fs.h>
40#include <linux/smp_lock.h> 40#include <linux/smp_lock.h>
41#include <linux/parser.h> 41#include <linux/parser.h>
42#include <linux/notifier.h>
42#include <asm/byteorder.h> 43#include <asm/byteorder.h>
43#include "usb.h" 44#include "usb.h"
44#include "hcd.h" 45#include "hcd.h"
@@ -619,7 +620,7 @@ void usbfs_update_special (void)
619 } 620 }
620} 621}
621 622
622void usbfs_add_bus(struct usb_bus *bus) 623static void usbfs_add_bus(struct usb_bus *bus)
623{ 624{
624 struct dentry *parent; 625 struct dentry *parent;
625 char name[8]; 626 char name[8];
@@ -642,12 +643,9 @@ void usbfs_add_bus(struct usb_bus *bus)
642 err ("error creating usbfs bus entry"); 643 err ("error creating usbfs bus entry");
643 return; 644 return;
644 } 645 }
645
646 usbfs_update_special();
647 usbfs_conn_disc_event();
648} 646}
649 647
650void usbfs_remove_bus(struct usb_bus *bus) 648static void usbfs_remove_bus(struct usb_bus *bus)
651{ 649{
652 if (bus->usbfs_dentry) { 650 if (bus->usbfs_dentry) {
653 fs_remove_file (bus->usbfs_dentry); 651 fs_remove_file (bus->usbfs_dentry);
@@ -659,12 +657,9 @@ void usbfs_remove_bus(struct usb_bus *bus)
659 remove_special_files(); 657 remove_special_files();
660 num_buses = 0; 658 num_buses = 0;
661 } 659 }
662
663 usbfs_update_special();
664 usbfs_conn_disc_event();
665} 660}
666 661
667void usbfs_add_device(struct usb_device *dev) 662static void usbfs_add_device(struct usb_device *dev)
668{ 663{
669 char name[8]; 664 char name[8];
670 int i; 665 int i;
@@ -690,12 +685,9 @@ void usbfs_add_device(struct usb_device *dev)
690 } 685 }
691 if (dev->usbfs_dentry->d_inode) 686 if (dev->usbfs_dentry->d_inode)
692 dev->usbfs_dentry->d_inode->i_size = i_size; 687 dev->usbfs_dentry->d_inode->i_size = i_size;
693
694 usbfs_update_special();
695 usbfs_conn_disc_event();
696} 688}
697 689
698void usbfs_remove_device(struct usb_device *dev) 690static void usbfs_remove_device(struct usb_device *dev)
699{ 691{
700 struct dev_state *ds; 692 struct dev_state *ds;
701 struct siginfo sinfo; 693 struct siginfo sinfo;
@@ -716,10 +708,33 @@ void usbfs_remove_device(struct usb_device *dev)
716 kill_proc_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid, ds->disc_uid, ds->disc_euid); 708 kill_proc_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid, ds->disc_uid, ds->disc_euid);
717 } 709 }
718 } 710 }
711}
712
713static int usbfs_notify(struct notifier_block *self, unsigned long action, void *dev)
714{
715 switch (action) {
716 case USB_DEVICE_ADD:
717 usbfs_add_device(dev);
718 break;
719 case USB_DEVICE_REMOVE:
720 usbfs_remove_device(dev);
721 break;
722 case USB_BUS_ADD:
723 usbfs_add_bus(dev);
724 break;
725 case USB_BUS_REMOVE:
726 usbfs_remove_bus(dev);
727 }
728
719 usbfs_update_special(); 729 usbfs_update_special();
720 usbfs_conn_disc_event(); 730 usbfs_conn_disc_event();
731 return NOTIFY_OK;
721} 732}
722 733
734static struct notifier_block usbfs_nb = {
735 .notifier_call = usbfs_notify,
736};
737
723/* --------------------------------------------------------------------- */ 738/* --------------------------------------------------------------------- */
724 739
725static struct proc_dir_entry *usbdir = NULL; 740static struct proc_dir_entry *usbdir = NULL;
@@ -732,6 +747,8 @@ int __init usbfs_init(void)
732 if (retval) 747 if (retval)
733 return retval; 748 return retval;
734 749
750 usb_register_notify(&usbfs_nb);
751
735 /* create mount point for usbfs */ 752 /* create mount point for usbfs */
736 usbdir = proc_mkdir("usb", proc_bus); 753 usbdir = proc_mkdir("usb", proc_bus);
737 754
@@ -740,6 +757,7 @@ int __init usbfs_init(void)
740 757
741void usbfs_cleanup(void) 758void usbfs_cleanup(void)
742{ 759{
760 usb_unregister_notify(&usbfs_nb);
743 unregister_filesystem(&usb_fs_type); 761 unregister_filesystem(&usb_fs_type);
744 if (usbdir) 762 if (usbdir)
745 remove_proc_entry("usb", proc_bus); 763 remove_proc_entry("usb", proc_bus);
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index f9a81e84dbdf..644a3d4f12aa 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -187,21 +187,37 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u
187 * If a thread in your driver uses this call, make sure your disconnect() 187 * If a thread in your driver uses this call, make sure your disconnect()
188 * method can wait for it to complete. Since you don't have a handle on 188 * method can wait for it to complete. Since you don't have a handle on
189 * the URB used, you can't cancel the request. 189 * the URB used, you can't cancel the request.
190 *
191 * Because there is no usb_interrupt_msg() and no USBDEVFS_INTERRUPT
192 * ioctl, users are forced to abuse this routine by using it to submit
193 * URBs for interrupt endpoints. We will take the liberty of creating
194 * an interrupt URB (with the default interval) if the target is an
195 * interrupt endpoint.
190 */ 196 */
191int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, 197int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
192 void *data, int len, int *actual_length, int timeout) 198 void *data, int len, int *actual_length, int timeout)
193{ 199{
194 struct urb *urb; 200 struct urb *urb;
201 struct usb_host_endpoint *ep;
195 202
196 if (len < 0) 203 ep = (usb_pipein(pipe) ? usb_dev->ep_in : usb_dev->ep_out)
204 [usb_pipeendpoint(pipe)];
205 if (!ep || len < 0)
197 return -EINVAL; 206 return -EINVAL;
198 207
199 urb=usb_alloc_urb(0, GFP_KERNEL); 208 urb = usb_alloc_urb(0, GFP_KERNEL);
200 if (!urb) 209 if (!urb)
201 return -ENOMEM; 210 return -ENOMEM;
202 211
203 usb_fill_bulk_urb(urb, usb_dev, pipe, data, len, 212 if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
204 usb_api_blocking_completion, NULL); 213 USB_ENDPOINT_XFER_INT) {
214 pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30);
215 usb_fill_int_urb(urb, usb_dev, pipe, data, len,
216 usb_api_blocking_completion, NULL,
217 ep->desc.bInterval);
218 } else
219 usb_fill_bulk_urb(urb, usb_dev, pipe, data, len,
220 usb_api_blocking_completion, NULL);
205 221
206 return usb_start_wait_urb(urb, timeout, actual_length); 222 return usb_start_wait_urb(urb, timeout, actual_length);
207} 223}
@@ -771,6 +787,31 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
771 return err; 787 return err;
772} 788}
773 789
790/**
791 * usb_cache_string - read a string descriptor and cache it for later use
792 * @udev: the device whose string descriptor is being read
793 * @index: the descriptor index
794 *
795 * Returns a pointer to a kmalloc'ed buffer containing the descriptor string,
796 * or NULL if the index is 0 or the string could not be read.
797 */
798char *usb_cache_string(struct usb_device *udev, int index)
799{
800 char *buf;
801 char *smallbuf = NULL;
802 int len;
803
804 if (index > 0 && (buf = kmalloc(256, GFP_KERNEL)) != NULL) {
805 if ((len = usb_string(udev, index, buf, 256)) > 0) {
806 if ((smallbuf = kmalloc(++len, GFP_KERNEL)) == NULL)
807 return buf;
808 memcpy(smallbuf, buf, len);
809 }
810 kfree(buf);
811 }
812 return smallbuf;
813}
814
774/* 815/*
775 * usb_get_device_descriptor - (re)reads the device descriptor (usbcore) 816 * usb_get_device_descriptor - (re)reads the device descriptor (usbcore)
776 * @dev: the device whose device descriptor is being updated 817 * @dev: the device whose device descriptor is being updated
@@ -992,8 +1033,6 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
992 dev_dbg (&dev->dev, "unregistering interface %s\n", 1033 dev_dbg (&dev->dev, "unregistering interface %s\n",
993 interface->dev.bus_id); 1034 interface->dev.bus_id);
994 usb_remove_sysfs_intf_files(interface); 1035 usb_remove_sysfs_intf_files(interface);
995 kfree(interface->cur_altsetting->string);
996 interface->cur_altsetting->string = NULL;
997 device_del (&interface->dev); 1036 device_del (&interface->dev);
998 } 1037 }
999 1038
@@ -1133,6 +1172,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1133 */ 1172 */
1134 1173
1135 /* prevent submissions using previous endpoint settings */ 1174 /* prevent submissions using previous endpoint settings */
1175 if (device_is_registered(&iface->dev))
1176 usb_remove_sysfs_intf_files(iface);
1136 usb_disable_interface(dev, iface); 1177 usb_disable_interface(dev, iface);
1137 1178
1138 iface->cur_altsetting = alt; 1179 iface->cur_altsetting = alt;
@@ -1168,6 +1209,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1168 * (Likewise, EP0 never "halts" on well designed devices.) 1209 * (Likewise, EP0 never "halts" on well designed devices.)
1169 */ 1210 */
1170 usb_enable_interface(dev, iface); 1211 usb_enable_interface(dev, iface);
1212 if (device_is_registered(&iface->dev))
1213 usb_create_sysfs_intf_files(iface);
1171 1214
1172 return 0; 1215 return 0;
1173} 1216}
@@ -1217,10 +1260,8 @@ int usb_reset_configuration(struct usb_device *dev)
1217 USB_REQ_SET_CONFIGURATION, 0, 1260 USB_REQ_SET_CONFIGURATION, 0,
1218 config->desc.bConfigurationValue, 0, 1261 config->desc.bConfigurationValue, 0,
1219 NULL, 0, USB_CTRL_SET_TIMEOUT); 1262 NULL, 0, USB_CTRL_SET_TIMEOUT);
1220 if (retval < 0) { 1263 if (retval < 0)
1221 usb_set_device_state(dev, USB_STATE_ADDRESS);
1222 return retval; 1264 return retval;
1223 }
1224 1265
1225 dev->toggle[0] = dev->toggle[1] = 0; 1266 dev->toggle[0] = dev->toggle[1] = 0;
1226 1267
@@ -1229,6 +1270,8 @@ int usb_reset_configuration(struct usb_device *dev)
1229 struct usb_interface *intf = config->interface[i]; 1270 struct usb_interface *intf = config->interface[i];
1230 struct usb_host_interface *alt; 1271 struct usb_host_interface *alt;
1231 1272
1273 if (device_is_registered(&intf->dev))
1274 usb_remove_sysfs_intf_files(intf);
1232 alt = usb_altnum_to_altsetting(intf, 0); 1275 alt = usb_altnum_to_altsetting(intf, 0);
1233 1276
1234 /* No altsetting 0? We'll assume the first altsetting. 1277 /* No altsetting 0? We'll assume the first altsetting.
@@ -1241,6 +1284,8 @@ int usb_reset_configuration(struct usb_device *dev)
1241 1284
1242 intf->cur_altsetting = alt; 1285 intf->cur_altsetting = alt;
1243 usb_enable_interface(dev, intf); 1286 usb_enable_interface(dev, intf);
1287 if (device_is_registered(&intf->dev))
1288 usb_create_sysfs_intf_files(intf);
1244 } 1289 }
1245 return 0; 1290 return 0;
1246} 1291}
@@ -1328,7 +1373,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
1328 } 1373 }
1329 1374
1330 for (; n < nintf; ++n) { 1375 for (; n < nintf; ++n) {
1331 new_interfaces[n] = kmalloc( 1376 new_interfaces[n] = kzalloc(
1332 sizeof(struct usb_interface), 1377 sizeof(struct usb_interface),
1333 GFP_KERNEL); 1378 GFP_KERNEL);
1334 if (!new_interfaces[n]) { 1379 if (!new_interfaces[n]) {
@@ -1369,7 +1414,6 @@ free_interfaces:
1369 struct usb_host_interface *alt; 1414 struct usb_host_interface *alt;
1370 1415
1371 cp->interface[i] = intf = new_interfaces[i]; 1416 cp->interface[i] = intf = new_interfaces[i];
1372 memset(intf, 0, sizeof(*intf));
1373 intfc = cp->intf_cache[i]; 1417 intfc = cp->intf_cache[i];
1374 intf->altsetting = intfc->altsetting; 1418 intf->altsetting = intfc->altsetting;
1375 intf->num_altsetting = intfc->num_altsetting; 1419 intf->num_altsetting = intfc->num_altsetting;
@@ -1393,6 +1437,7 @@ free_interfaces:
1393 intf->dev.dma_mask = dev->dev.dma_mask; 1437 intf->dev.dma_mask = dev->dev.dma_mask;
1394 intf->dev.release = release_interface; 1438 intf->dev.release = release_interface;
1395 device_initialize (&intf->dev); 1439 device_initialize (&intf->dev);
1440 mark_quiesced(intf);
1396 sprintf (&intf->dev.bus_id[0], "%d-%s:%d.%d", 1441 sprintf (&intf->dev.bus_id[0], "%d-%s:%d.%d",
1397 dev->bus->busnum, dev->devpath, 1442 dev->bus->busnum, dev->devpath,
1398 configuration, 1443 configuration,
@@ -1400,12 +1445,9 @@ free_interfaces:
1400 } 1445 }
1401 kfree(new_interfaces); 1446 kfree(new_interfaces);
1402 1447
1403 if ((cp->desc.iConfiguration) && 1448 if (cp->string == NULL)
1404 (cp->string == NULL)) { 1449 cp->string = usb_cache_string(dev,
1405 cp->string = kmalloc(256, GFP_KERNEL); 1450 cp->desc.iConfiguration);
1406 if (cp->string)
1407 usb_string(dev, cp->desc.iConfiguration, cp->string, 256);
1408 }
1409 1451
1410 /* Now that all the interfaces are set up, register them 1452 /* Now that all the interfaces are set up, register them
1411 * to trigger binding of drivers to interfaces. probe() 1453 * to trigger binding of drivers to interfaces. probe()
@@ -1415,13 +1457,12 @@ free_interfaces:
1415 */ 1457 */
1416 for (i = 0; i < nintf; ++i) { 1458 for (i = 0; i < nintf; ++i) {
1417 struct usb_interface *intf = cp->interface[i]; 1459 struct usb_interface *intf = cp->interface[i];
1418 struct usb_interface_descriptor *desc; 1460 struct usb_host_interface *alt = intf->cur_altsetting;
1419 1461
1420 desc = &intf->altsetting [0].desc;
1421 dev_dbg (&dev->dev, 1462 dev_dbg (&dev->dev,
1422 "adding %s (config #%d, interface %d)\n", 1463 "adding %s (config #%d, interface %d)\n",
1423 intf->dev.bus_id, configuration, 1464 intf->dev.bus_id, configuration,
1424 desc->bInterfaceNumber); 1465 alt->desc.bInterfaceNumber);
1425 ret = device_add (&intf->dev); 1466 ret = device_add (&intf->dev);
1426 if (ret != 0) { 1467 if (ret != 0) {
1427 dev_err(&dev->dev, 1468 dev_err(&dev->dev,
@@ -1430,13 +1471,6 @@ free_interfaces:
1430 ret); 1471 ret);
1431 continue; 1472 continue;
1432 } 1473 }
1433 if ((intf->cur_altsetting->desc.iInterface) &&
1434 (intf->cur_altsetting->string == NULL)) {
1435 intf->cur_altsetting->string = kmalloc(256, GFP_KERNEL);
1436 if (intf->cur_altsetting->string)
1437 usb_string(dev, intf->cur_altsetting->desc.iInterface,
1438 intf->cur_altsetting->string, 256);
1439 }
1440 usb_create_sysfs_intf_files (intf); 1474 usb_create_sysfs_intf_files (intf);
1441 } 1475 }
1442 } 1476 }
diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c
new file mode 100644
index 000000000000..37da059eced7
--- /dev/null
+++ b/drivers/usb/core/notify.c
@@ -0,0 +1,120 @@
1/*
2 * All the USB notify logic
3 *
4 * (C) Copyright 2005 Greg Kroah-Hartman <gregkh@suse.de>
5 *
6 * notifier functions originally based on those in kernel/sys.c
7 * but fixed up to not be so broken.
8 *
9 */
10
11
12#include <linux/config.h>
13#include <linux/kernel.h>
14#include <linux/notifier.h>
15#ifdef CONFIG_USB_DEBUG
16 #define DEBUG
17#else
18 #undef DEBUG
19#endif
20#include <linux/usb.h>
21
22#include "usb.h"
23
24
25static struct notifier_block *usb_notifier_list;
26static DECLARE_MUTEX(usb_notifier_lock);
27
28static void usb_notifier_chain_register(struct notifier_block **list,
29 struct notifier_block *n)
30{
31 down(&usb_notifier_lock);
32 while (*list) {
33 if (n->priority > (*list)->priority)
34 break;
35 list = &((*list)->next);
36 }
37 n->next = *list;
38 *list = n;
39 up(&usb_notifier_lock);
40}
41
42static void usb_notifier_chain_unregister(struct notifier_block **nl,
43 struct notifier_block *n)
44{
45 down(&usb_notifier_lock);
46 while ((*nl)!=NULL) {
47 if ((*nl)==n) {
48 *nl = n->next;
49 goto exit;
50 }
51 nl=&((*nl)->next);
52 }
53exit:
54 up(&usb_notifier_lock);
55}
56
57static int usb_notifier_call_chain(struct notifier_block **n,
58 unsigned long val, void *v)
59{
60 int ret=NOTIFY_DONE;
61 struct notifier_block *nb = *n;
62
63 down(&usb_notifier_lock);
64 while (nb) {
65 ret = nb->notifier_call(nb,val,v);
66 if (ret&NOTIFY_STOP_MASK) {
67 goto exit;
68 }
69 nb = nb->next;
70 }
71exit:
72 up(&usb_notifier_lock);
73 return ret;
74}
75
76/**
77 * usb_register_notify - register a notifier callback whenever a usb change happens
78 * @nb: pointer to the notifier block for the callback events.
79 *
80 * These changes are either USB devices or busses being added or removed.
81 */
82void usb_register_notify(struct notifier_block *nb)
83{
84 usb_notifier_chain_register(&usb_notifier_list, nb);
85}
86EXPORT_SYMBOL_GPL(usb_register_notify);
87
88/**
89 * usb_unregister_notify - unregister a notifier callback
90 * @nb: pointer to the notifier block for the callback events.
91 *
92 * usb_register_notifier() must have been previously called for this function
93 * to work properly.
94 */
95void usb_unregister_notify(struct notifier_block *nb)
96{
97 usb_notifier_chain_unregister(&usb_notifier_list, nb);
98}
99EXPORT_SYMBOL_GPL(usb_unregister_notify);
100
101
102void usb_notify_add_device(struct usb_device *udev)
103{
104 usb_notifier_call_chain(&usb_notifier_list, USB_DEVICE_ADD, udev);
105}
106
107void usb_notify_remove_device(struct usb_device *udev)
108{
109 usb_notifier_call_chain(&usb_notifier_list, USB_DEVICE_REMOVE, udev);
110}
111
112void usb_notify_add_bus(struct usb_bus *ubus)
113{
114 usb_notifier_call_chain(&usb_notifier_list, USB_BUS_ADD, ubus);
115}
116
117void usb_notify_remove_bus(struct usb_bus *ubus)
118{
119 usb_notifier_call_chain(&usb_notifier_list, USB_BUS_REMOVE, ubus);
120}
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 00297f113849..edd83e014452 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -22,9 +22,207 @@
22 22
23#include "usb.h" 23#include "usb.h"
24 24
25/* endpoint stuff */
26struct ep_object {
27 struct usb_endpoint_descriptor *desc;
28 struct usb_device *udev;
29 struct kobject kobj;
30};
31#define to_ep_object(_kobj) \
32 container_of(_kobj, struct ep_object, kobj)
33
34struct ep_attribute {
35 struct attribute attr;
36 ssize_t (*show)(struct usb_device *,
37 struct usb_endpoint_descriptor *, char *);
38};
39#define to_ep_attribute(_attr) \
40 container_of(_attr, struct ep_attribute, attr)
41
42#define EP_ATTR(_name) \
43struct ep_attribute ep_##_name = { \
44 .attr = {.name = #_name, .owner = THIS_MODULE, \
45 .mode = S_IRUGO}, \
46 .show = show_ep_##_name}
47
48#define usb_ep_attr(field, format_string) \
49static ssize_t show_ep_##field(struct usb_device *udev, \
50 struct usb_endpoint_descriptor *desc, \
51 char *buf) \
52{ \
53 return sprintf(buf, format_string, desc->field); \
54} \
55static EP_ATTR(field);
56
57usb_ep_attr(bLength, "%02x\n")
58usb_ep_attr(bEndpointAddress, "%02x\n")
59usb_ep_attr(bmAttributes, "%02x\n")
60usb_ep_attr(bInterval, "%02x\n")
61
62static ssize_t show_ep_wMaxPacketSize(struct usb_device *udev,
63 struct usb_endpoint_descriptor *desc, char *buf)
64{
65 return sprintf(buf, "%04x\n",
66 le16_to_cpu(desc->wMaxPacketSize) & 0x07ff);
67}
68static EP_ATTR(wMaxPacketSize);
69
70static ssize_t show_ep_type(struct usb_device *udev,
71 struct usb_endpoint_descriptor *desc, char *buf)
72{
73 char *type = "unknown";
74
75 switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
76 case USB_ENDPOINT_XFER_CONTROL:
77 type = "Control";
78 break;
79 case USB_ENDPOINT_XFER_ISOC:
80 type = "Isoc";
81 break;
82 case USB_ENDPOINT_XFER_BULK:
83 type = "Bulk";
84 break;
85 case USB_ENDPOINT_XFER_INT:
86 type = "Interrupt";
87 break;
88 }
89 return sprintf(buf, "%s\n", type);
90}
91static EP_ATTR(type);
92
93static ssize_t show_ep_interval(struct usb_device *udev,
94 struct usb_endpoint_descriptor *desc, char *buf)
95{
96 char unit;
97 unsigned interval = 0;
98 unsigned in;
99
100 in = (desc->bEndpointAddress & USB_DIR_IN);
101
102 switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
103 case USB_ENDPOINT_XFER_CONTROL:
104 if (udev->speed == USB_SPEED_HIGH) /* uframes per NAK */
105 interval = desc->bInterval;
106 break;
107 case USB_ENDPOINT_XFER_ISOC:
108 interval = 1 << (desc->bInterval - 1);
109 break;
110 case USB_ENDPOINT_XFER_BULK:
111 if (udev->speed == USB_SPEED_HIGH && !in) /* uframes per NAK */
112 interval = desc->bInterval;
113 break;
114 case USB_ENDPOINT_XFER_INT:
115 if (udev->speed == USB_SPEED_HIGH)
116 interval = 1 << (desc->bInterval - 1);
117 else
118 interval = desc->bInterval;
119 break;
120 }
121 interval *= (udev->speed == USB_SPEED_HIGH) ? 125 : 1000;
122 if (interval % 1000)
123 unit = 'u';
124 else {
125 unit = 'm';
126 interval /= 1000;
127 }
128
129 return sprintf(buf, "%d%cs\n", interval, unit);
130}
131static EP_ATTR(interval);
132
133static ssize_t show_ep_direction(struct usb_device *udev,
134 struct usb_endpoint_descriptor *desc, char *buf)
135{
136 char *direction;
137
138 if ((desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
139 USB_ENDPOINT_XFER_CONTROL)
140 direction = "both";
141 else if (desc->bEndpointAddress & USB_DIR_IN)
142 direction = "in";
143 else
144 direction = "out";
145 return sprintf(buf, "%s\n", direction);
146}
147static EP_ATTR(direction);
148
149static struct attribute *ep_attrs[] = {
150 &ep_bLength.attr,
151 &ep_bEndpointAddress.attr,
152 &ep_bmAttributes.attr,
153 &ep_bInterval.attr,
154 &ep_wMaxPacketSize.attr,
155 &ep_type.attr,
156 &ep_interval.attr,
157 &ep_direction.attr,
158 NULL,
159};
160
161static void ep_object_release(struct kobject *kobj)
162{
163 kfree(to_ep_object(kobj));
164}
165
166static ssize_t ep_object_show(struct kobject *kobj, struct attribute *attr,
167 char *buf)
168{
169 struct ep_object *ep_obj = to_ep_object(kobj);
170 struct ep_attribute *ep_attr = to_ep_attribute(attr);
171
172 return (ep_attr->show)(ep_obj->udev, ep_obj->desc, buf);
173}
174
175static struct sysfs_ops ep_object_sysfs_ops = {
176 .show = ep_object_show,
177};
178
179static struct kobj_type ep_object_ktype = {
180 .release = ep_object_release,
181 .sysfs_ops = &ep_object_sysfs_ops,
182 .default_attrs = ep_attrs,
183};
184
185static void usb_create_ep_files(struct kobject *parent,
186 struct usb_host_endpoint *endpoint,
187 struct usb_device *udev)
188{
189 struct ep_object *ep_obj;
190 struct kobject *kobj;
191
192 ep_obj = kzalloc(sizeof(struct ep_object), GFP_KERNEL);
193 if (!ep_obj)
194 return;
195
196 ep_obj->desc = &endpoint->desc;
197 ep_obj->udev = udev;
198
199 kobj = &ep_obj->kobj;
200 kobject_set_name(kobj, "ep_%02x", endpoint->desc.bEndpointAddress);
201 kobj->parent = parent;
202 kobj->ktype = &ep_object_ktype;
203
204 /* Don't use kobject_register, because it generates a hotplug event */
205 kobject_init(kobj);
206 if (kobject_add(kobj) == 0)
207 endpoint->kobj = kobj;
208 else
209 kobject_put(kobj);
210}
211
212static void usb_remove_ep_files(struct usb_host_endpoint *endpoint)
213{
214
215 if (endpoint->kobj) {
216 kobject_del(endpoint->kobj);
217 kobject_put(endpoint->kobj);
218 endpoint->kobj = NULL;
219 }
220}
221
25/* Active configuration fields */ 222/* Active configuration fields */
26#define usb_actconfig_show(field, multiplier, format_string) \ 223#define usb_actconfig_show(field, multiplier, format_string) \
27static ssize_t show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ 224static ssize_t show_##field (struct device *dev, \
225 struct device_attribute *attr, char *buf) \
28{ \ 226{ \
29 struct usb_device *udev; \ 227 struct usb_device *udev; \
30 struct usb_host_config *actconfig; \ 228 struct usb_host_config *actconfig; \
@@ -46,22 +244,17 @@ usb_actconfig_attr (bNumInterfaces, 1, "%2d\n")
46usb_actconfig_attr (bmAttributes, 1, "%2x\n") 244usb_actconfig_attr (bmAttributes, 1, "%2x\n")
47usb_actconfig_attr (bMaxPower, 2, "%3dmA\n") 245usb_actconfig_attr (bMaxPower, 2, "%3dmA\n")
48 246
49static ssize_t show_configuration_string(struct device *dev, struct device_attribute *attr, char *buf) 247static ssize_t show_configuration_string(struct device *dev,
248 struct device_attribute *attr, char *buf)
50{ 249{
51 struct usb_device *udev; 250 struct usb_device *udev;
52 struct usb_host_config *actconfig; 251 struct usb_host_config *actconfig;
53 int len;
54 252
55 udev = to_usb_device (dev); 253 udev = to_usb_device (dev);
56 actconfig = udev->actconfig; 254 actconfig = udev->actconfig;
57 if ((!actconfig) || (!actconfig->string)) 255 if ((!actconfig) || (!actconfig->string))
58 return 0; 256 return 0;
59 len = sprintf(buf, actconfig->string, PAGE_SIZE); 257 return sprintf(buf, "%s\n", actconfig->string);
60 if (len < 0)
61 return 0;
62 buf[len] = '\n';
63 buf[len+1] = 0;
64 return len+1;
65} 258}
66static DEVICE_ATTR(configuration, S_IRUGO, show_configuration_string, NULL); 259static DEVICE_ATTR(configuration, S_IRUGO, show_configuration_string, NULL);
67 260
@@ -69,7 +262,8 @@ static DEVICE_ATTR(configuration, S_IRUGO, show_configuration_string, NULL);
69usb_actconfig_show(bConfigurationValue, 1, "%u\n"); 262usb_actconfig_show(bConfigurationValue, 1, "%u\n");
70 263
71static ssize_t 264static ssize_t
72set_bConfigurationValue (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 265set_bConfigurationValue (struct device *dev, struct device_attribute *attr,
266 const char *buf, size_t count)
73{ 267{
74 struct usb_device *udev = udev = to_usb_device (dev); 268 struct usb_device *udev = udev = to_usb_device (dev);
75 int config, value; 269 int config, value;
@@ -87,18 +281,13 @@ static DEVICE_ATTR(bConfigurationValue, S_IRUGO | S_IWUSR,
87 281
88/* String fields */ 282/* String fields */
89#define usb_string_attr(name) \ 283#define usb_string_attr(name) \
90static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ 284static ssize_t show_##name(struct device *dev, \
285 struct device_attribute *attr, char *buf) \
91{ \ 286{ \
92 struct usb_device *udev; \ 287 struct usb_device *udev; \
93 int len; \
94 \ 288 \
95 udev = to_usb_device (dev); \ 289 udev = to_usb_device (dev); \
96 len = snprintf(buf, 256, "%s", udev->name); \ 290 return sprintf(buf, "%s\n", udev->name); \
97 if (len < 0) \
98 return 0; \
99 buf[len] = '\n'; \
100 buf[len+1] = 0; \
101 return len+1; \
102} \ 291} \
103static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL); 292static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
104 293
@@ -167,7 +356,8 @@ static DEVICE_ATTR(maxchild, S_IRUGO, show_maxchild, NULL);
167/* Descriptor fields */ 356/* Descriptor fields */
168#define usb_descriptor_attr_le16(field, format_string) \ 357#define usb_descriptor_attr_le16(field, format_string) \
169static ssize_t \ 358static ssize_t \
170show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ 359show_##field (struct device *dev, struct device_attribute *attr, \
360 char *buf) \
171{ \ 361{ \
172 struct usb_device *udev; \ 362 struct usb_device *udev; \
173 \ 363 \
@@ -183,7 +373,8 @@ usb_descriptor_attr_le16(bcdDevice, "%04x\n")
183 373
184#define usb_descriptor_attr(field, format_string) \ 374#define usb_descriptor_attr(field, format_string) \
185static ssize_t \ 375static ssize_t \
186show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ 376show_##field (struct device *dev, struct device_attribute *attr, \
377 char *buf) \
187{ \ 378{ \
188 struct usb_device *udev; \ 379 struct usb_device *udev; \
189 \ 380 \
@@ -236,19 +427,21 @@ void usb_create_sysfs_dev_files (struct usb_device *udev)
236 if (udev->serial) 427 if (udev->serial)
237 device_create_file (dev, &dev_attr_serial); 428 device_create_file (dev, &dev_attr_serial);
238 device_create_file (dev, &dev_attr_configuration); 429 device_create_file (dev, &dev_attr_configuration);
430 usb_create_ep_files(&dev->kobj, &udev->ep0, udev);
239} 431}
240 432
241void usb_remove_sysfs_dev_files (struct usb_device *udev) 433void usb_remove_sysfs_dev_files (struct usb_device *udev)
242{ 434{
243 struct device *dev = &udev->dev; 435 struct device *dev = &udev->dev;
244 436
437 usb_remove_ep_files(&udev->ep0);
245 sysfs_remove_group(&dev->kobj, &dev_attr_grp); 438 sysfs_remove_group(&dev->kobj, &dev_attr_grp);
246 439
247 if (udev->descriptor.iManufacturer) 440 if (udev->manufacturer)
248 device_remove_file(dev, &dev_attr_manufacturer); 441 device_remove_file(dev, &dev_attr_manufacturer);
249 if (udev->descriptor.iProduct) 442 if (udev->product)
250 device_remove_file(dev, &dev_attr_product); 443 device_remove_file(dev, &dev_attr_product);
251 if (udev->descriptor.iSerialNumber) 444 if (udev->serial)
252 device_remove_file(dev, &dev_attr_serial); 445 device_remove_file(dev, &dev_attr_serial);
253 device_remove_file (dev, &dev_attr_configuration); 446 device_remove_file (dev, &dev_attr_configuration);
254} 447}
@@ -256,11 +449,13 @@ void usb_remove_sysfs_dev_files (struct usb_device *udev)
256/* Interface fields */ 449/* Interface fields */
257#define usb_intf_attr(field, format_string) \ 450#define usb_intf_attr(field, format_string) \
258static ssize_t \ 451static ssize_t \
259show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ 452show_##field (struct device *dev, struct device_attribute *attr, \
453 char *buf) \
260{ \ 454{ \
261 struct usb_interface *intf = to_usb_interface (dev); \ 455 struct usb_interface *intf = to_usb_interface (dev); \
262 \ 456 \
263 return sprintf (buf, format_string, intf->cur_altsetting->desc.field); \ 457 return sprintf (buf, format_string, \
458 intf->cur_altsetting->desc.field); \
264} \ 459} \
265static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL); 460static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
266 461
@@ -271,7 +466,8 @@ usb_intf_attr (bInterfaceClass, "%02x\n")
271usb_intf_attr (bInterfaceSubClass, "%02x\n") 466usb_intf_attr (bInterfaceSubClass, "%02x\n")
272usb_intf_attr (bInterfaceProtocol, "%02x\n") 467usb_intf_attr (bInterfaceProtocol, "%02x\n")
273 468
274static ssize_t show_interface_string(struct device *dev, struct device_attribute *attr, char *buf) 469static ssize_t show_interface_string(struct device *dev,
470 struct device_attribute *attr, char *buf)
275{ 471{
276 struct usb_interface *intf; 472 struct usb_interface *intf;
277 struct usb_device *udev; 473 struct usb_device *udev;
@@ -288,34 +484,28 @@ static ssize_t show_interface_string(struct device *dev, struct device_attribute
288} 484}
289static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL); 485static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL);
290 486
291static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf) 487static ssize_t show_modalias(struct device *dev,
488 struct device_attribute *attr, char *buf)
292{ 489{
293 struct usb_interface *intf; 490 struct usb_interface *intf;
294 struct usb_device *udev; 491 struct usb_device *udev;
295 int len; 492 struct usb_host_interface *alt;
296 493
297 intf = to_usb_interface(dev); 494 intf = to_usb_interface(dev);
298 udev = interface_to_usbdev(intf); 495 udev = interface_to_usbdev(intf);
299 496 alt = intf->cur_altsetting;
300 len = sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic", 497
301 le16_to_cpu(udev->descriptor.idVendor), 498 return sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02X"
302 le16_to_cpu(udev->descriptor.idProduct), 499 "ic%02Xisc%02Xip%02X\n",
303 le16_to_cpu(udev->descriptor.bcdDevice), 500 le16_to_cpu(udev->descriptor.idVendor),
304 udev->descriptor.bDeviceClass, 501 le16_to_cpu(udev->descriptor.idProduct),
305 udev->descriptor.bDeviceSubClass, 502 le16_to_cpu(udev->descriptor.bcdDevice),
306 udev->descriptor.bDeviceProtocol); 503 udev->descriptor.bDeviceClass,
307 buf += len; 504 udev->descriptor.bDeviceSubClass,
308 505 udev->descriptor.bDeviceProtocol,
309 if (udev->descriptor.bDeviceClass == 0) { 506 alt->desc.bInterfaceClass,
310 struct usb_host_interface *alt = intf->cur_altsetting; 507 alt->desc.bInterfaceSubClass,
311 508 alt->desc.bInterfaceProtocol);
312 return len + sprintf(buf, "%02Xisc%02Xip%02X\n",
313 alt->desc.bInterfaceClass,
314 alt->desc.bInterfaceSubClass,
315 alt->desc.bInterfaceProtocol);
316 } else {
317 return len + sprintf(buf, "*isc*ip*\n");
318 }
319} 509}
320static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL); 510static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);
321 511
@@ -333,20 +523,47 @@ static struct attribute_group intf_attr_grp = {
333 .attrs = intf_attrs, 523 .attrs = intf_attrs,
334}; 524};
335 525
526static inline void usb_create_intf_ep_files(struct usb_interface *intf,
527 struct usb_device *udev)
528{
529 struct usb_host_interface *iface_desc;
530 int i;
531
532 iface_desc = intf->cur_altsetting;
533 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i)
534 usb_create_ep_files(&intf->dev.kobj, &iface_desc->endpoint[i],
535 udev);
536}
537
538static inline void usb_remove_intf_ep_files(struct usb_interface *intf)
539{
540 struct usb_host_interface *iface_desc;
541 int i;
542
543 iface_desc = intf->cur_altsetting;
544 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i)
545 usb_remove_ep_files(&iface_desc->endpoint[i]);
546}
547
336void usb_create_sysfs_intf_files (struct usb_interface *intf) 548void usb_create_sysfs_intf_files (struct usb_interface *intf)
337{ 549{
550 struct usb_device *udev = interface_to_usbdev(intf);
551 struct usb_host_interface *alt = intf->cur_altsetting;
552
338 sysfs_create_group(&intf->dev.kobj, &intf_attr_grp); 553 sysfs_create_group(&intf->dev.kobj, &intf_attr_grp);
339 554
340 if (intf->cur_altsetting->string) 555 if (alt->string == NULL)
556 alt->string = usb_cache_string(udev, alt->desc.iInterface);
557 if (alt->string)
341 device_create_file(&intf->dev, &dev_attr_interface); 558 device_create_file(&intf->dev, &dev_attr_interface);
342 559 usb_create_intf_ep_files(intf, udev);
343} 560}
344 561
345void usb_remove_sysfs_intf_files (struct usb_interface *intf) 562void usb_remove_sysfs_intf_files (struct usb_interface *intf)
346{ 563{
564 usb_remove_intf_ep_files(intf);
347 sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp); 565 sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp);
348 566
349 if (intf->cur_altsetting->string) 567 if (intf->cur_altsetting->string)
350 device_remove_file(&intf->dev, &dev_attr_interface); 568 device_remove_file(&intf->dev, &dev_attr_interface);
351
352} 569}
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index b32898e0a27d..f2a1fed2a802 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -237,7 +237,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
237 (dev->state < USB_STATE_DEFAULT) || 237 (dev->state < USB_STATE_DEFAULT) ||
238 (!dev->bus) || (dev->devnum <= 0)) 238 (!dev->bus) || (dev->devnum <= 0))
239 return -ENODEV; 239 return -ENODEV;
240 if (dev->state == USB_STATE_SUSPENDED) 240 if (dev->bus->controller->power.power_state.event != PM_EVENT_ON
241 || dev->state == USB_STATE_SUSPENDED)
241 return -EHOSTUNREACH; 242 return -EHOSTUNREACH;
242 if (!(op = dev->bus->op) || !op->submit_urb) 243 if (!(op = dev->bus->op) || !op->submit_urb)
243 return -ENODEV; 244 return -ENODEV;
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 4c57f3f649ed..0eefff7bcb3c 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -107,10 +107,19 @@ static int usb_probe_interface(struct device *dev)
107 id = usb_match_id (intf, driver->id_table); 107 id = usb_match_id (intf, driver->id_table);
108 if (id) { 108 if (id) {
109 dev_dbg (dev, "%s - got id\n", __FUNCTION__); 109 dev_dbg (dev, "%s - got id\n", __FUNCTION__);
110
111 /* Interface "power state" doesn't correspond to any hardware
112 * state whatsoever. We use it to record when it's bound to
113 * a driver that may start I/0: it's not frozen/quiesced.
114 */
115 mark_active(intf);
110 intf->condition = USB_INTERFACE_BINDING; 116 intf->condition = USB_INTERFACE_BINDING;
111 error = driver->probe (intf, id); 117 error = driver->probe (intf, id);
112 intf->condition = error ? USB_INTERFACE_UNBOUND : 118 if (error) {
113 USB_INTERFACE_BOUND; 119 mark_quiesced(intf);
120 intf->condition = USB_INTERFACE_UNBOUND;
121 } else
122 intf->condition = USB_INTERFACE_BOUND;
114 } 123 }
115 124
116 return error; 125 return error;
@@ -136,6 +145,7 @@ static int usb_unbind_interface(struct device *dev)
136 0); 145 0);
137 usb_set_intfdata(intf, NULL); 146 usb_set_intfdata(intf, NULL);
138 intf->condition = USB_INTERFACE_UNBOUND; 147 intf->condition = USB_INTERFACE_UNBOUND;
148 mark_quiesced(intf);
139 149
140 return 0; 150 return 0;
141} 151}
@@ -299,6 +309,7 @@ int usb_driver_claim_interface(struct usb_driver *driver,
299 dev->driver = &driver->driver; 309 dev->driver = &driver->driver;
300 usb_set_intfdata(iface, priv); 310 usb_set_intfdata(iface, priv);
301 iface->condition = USB_INTERFACE_BOUND; 311 iface->condition = USB_INTERFACE_BOUND;
312 mark_active(iface);
302 313
303 /* if interface was already added, bind now; else let 314 /* if interface was already added, bind now; else let
304 * the future device_add() bind it, bypassing probe() 315 * the future device_add() bind it, bypassing probe()
@@ -345,6 +356,7 @@ void usb_driver_release_interface(struct usb_driver *driver,
345 dev->driver = NULL; 356 dev->driver = NULL;
346 usb_set_intfdata(iface, NULL); 357 usb_set_intfdata(iface, NULL);
347 iface->condition = USB_INTERFACE_UNBOUND; 358 iface->condition = USB_INTERFACE_UNBOUND;
359 mark_quiesced(iface);
348} 360}
349 361
350/** 362/**
@@ -557,6 +569,7 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp,
557{ 569{
558 struct usb_interface *intf; 570 struct usb_interface *intf;
559 struct usb_device *usb_dev; 571 struct usb_device *usb_dev;
572 struct usb_host_interface *alt;
560 int i = 0; 573 int i = 0;
561 int length = 0; 574 int length = 0;
562 575
@@ -573,7 +586,8 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp,
573 586
574 intf = to_usb_interface(dev); 587 intf = to_usb_interface(dev);
575 usb_dev = interface_to_usbdev (intf); 588 usb_dev = interface_to_usbdev (intf);
576 589 alt = intf->cur_altsetting;
590
577 if (usb_dev->devnum < 0) { 591 if (usb_dev->devnum < 0) {
578 pr_debug ("usb %s: already deleted?\n", dev->bus_id); 592 pr_debug ("usb %s: already deleted?\n", dev->bus_id);
579 return -ENODEV; 593 return -ENODEV;
@@ -615,46 +629,27 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp,
615 usb_dev->descriptor.bDeviceProtocol)) 629 usb_dev->descriptor.bDeviceProtocol))
616 return -ENOMEM; 630 return -ENOMEM;
617 631
618 if (usb_dev->descriptor.bDeviceClass == 0) { 632 if (add_hotplug_env_var(envp, num_envp, &i,
619 struct usb_host_interface *alt = intf->cur_altsetting; 633 buffer, buffer_size, &length,
634 "INTERFACE=%d/%d/%d",
635 alt->desc.bInterfaceClass,
636 alt->desc.bInterfaceSubClass,
637 alt->desc.bInterfaceProtocol))
638 return -ENOMEM;
620 639
621 /* 2.4 only exposed interface zero. in 2.5, hotplug 640 if (add_hotplug_env_var(envp, num_envp, &i,
622 * agents are called for all interfaces, and can use 641 buffer, buffer_size, &length,
623 * $DEVPATH/bInterfaceNumber if necessary. 642 "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X",
624 */ 643 le16_to_cpu(usb_dev->descriptor.idVendor),
625 if (add_hotplug_env_var(envp, num_envp, &i, 644 le16_to_cpu(usb_dev->descriptor.idProduct),
626 buffer, buffer_size, &length, 645 le16_to_cpu(usb_dev->descriptor.bcdDevice),
627 "INTERFACE=%d/%d/%d", 646 usb_dev->descriptor.bDeviceClass,
628 alt->desc.bInterfaceClass, 647 usb_dev->descriptor.bDeviceSubClass,
629 alt->desc.bInterfaceSubClass, 648 usb_dev->descriptor.bDeviceProtocol,
630 alt->desc.bInterfaceProtocol)) 649 alt->desc.bInterfaceClass,
631 return -ENOMEM; 650 alt->desc.bInterfaceSubClass,
632 651 alt->desc.bInterfaceProtocol))
633 if (add_hotplug_env_var(envp, num_envp, &i, 652 return -ENOMEM;
634 buffer, buffer_size, &length,
635 "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X",
636 le16_to_cpu(usb_dev->descriptor.idVendor),
637 le16_to_cpu(usb_dev->descriptor.idProduct),
638 le16_to_cpu(usb_dev->descriptor.bcdDevice),
639 usb_dev->descriptor.bDeviceClass,
640 usb_dev->descriptor.bDeviceSubClass,
641 usb_dev->descriptor.bDeviceProtocol,
642 alt->desc.bInterfaceClass,
643 alt->desc.bInterfaceSubClass,
644 alt->desc.bInterfaceProtocol))
645 return -ENOMEM;
646 } else {
647 if (add_hotplug_env_var(envp, num_envp, &i,
648 buffer, buffer_size, &length,
649 "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic*isc*ip*",
650 le16_to_cpu(usb_dev->descriptor.idVendor),
651 le16_to_cpu(usb_dev->descriptor.idProduct),
652 le16_to_cpu(usb_dev->descriptor.bcdDevice),
653 usb_dev->descriptor.bDeviceClass,
654 usb_dev->descriptor.bDeviceSubClass,
655 usb_dev->descriptor.bDeviceProtocol))
656 return -ENOMEM;
657 }
658 653
659 envp[i] = NULL; 654 envp[i] = NULL;
660 655
@@ -709,12 +704,10 @@ usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus, unsigned port1)
709{ 704{
710 struct usb_device *dev; 705 struct usb_device *dev;
711 706
712 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 707 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
713 if (!dev) 708 if (!dev)
714 return NULL; 709 return NULL;
715 710
716 memset(dev, 0, sizeof(*dev));
717
718 bus = usb_bus_get(bus); 711 bus = usb_bus_get(bus);
719 if (!bus) { 712 if (!bus) {
720 kfree(dev); 713 kfree(dev);
@@ -1402,13 +1395,30 @@ void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe,
1402 usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); 1395 usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
1403} 1396}
1404 1397
1398static int verify_suspended(struct device *dev, void *unused)
1399{
1400 return (dev->power.power_state.event == PM_EVENT_ON) ? -EBUSY : 0;
1401}
1402
1405static int usb_generic_suspend(struct device *dev, pm_message_t message) 1403static int usb_generic_suspend(struct device *dev, pm_message_t message)
1406{ 1404{
1407 struct usb_interface *intf; 1405 struct usb_interface *intf;
1408 struct usb_driver *driver; 1406 struct usb_driver *driver;
1407 int status;
1409 1408
1410 if (dev->driver == &usb_generic_driver) 1409 /* USB devices enter SUSPEND state through their hubs, but can be
1411 return usb_suspend_device (to_usb_device(dev), message); 1410 * marked for FREEZE as soon as their children are already idled.
1411 * But those semantics are useless, so we equate the two (sigh).
1412 */
1413 if (dev->driver == &usb_generic_driver) {
1414 if (dev->power.power_state.event == message.event)
1415 return 0;
1416 /* we need to rule out bogus requests through sysfs */
1417 status = device_for_each_child(dev, NULL, verify_suspended);
1418 if (status)
1419 return status;
1420 return usb_suspend_device (to_usb_device(dev));
1421 }
1412 1422
1413 if ((dev->driver == NULL) || 1423 if ((dev->driver == NULL) ||
1414 (dev->driver_data == &usb_generic_driver_data)) 1424 (dev->driver_data == &usb_generic_driver_data))
@@ -1417,23 +1427,44 @@ static int usb_generic_suspend(struct device *dev, pm_message_t message)
1417 intf = to_usb_interface(dev); 1427 intf = to_usb_interface(dev);
1418 driver = to_usb_driver(dev->driver); 1428 driver = to_usb_driver(dev->driver);
1419 1429
1420 /* there's only one USB suspend state */ 1430 /* with no hardware, USB interfaces only use FREEZE and ON states */
1421 if (intf->dev.power.power_state.event) 1431 if (!is_active(intf))
1422 return 0; 1432 return 0;
1423 1433
1424 if (driver->suspend) 1434 if (driver->suspend && driver->resume) {
1425 return driver->suspend(intf, message); 1435 status = driver->suspend(intf, message);
1426 return 0; 1436 if (status)
1437 dev_err(dev, "%s error %d\n", "suspend", status);
1438 else
1439 mark_quiesced(intf);
1440 } else {
1441 // FIXME else if there's no suspend method, disconnect...
1442 dev_warn(dev, "no %s?\n", "suspend");
1443 status = 0;
1444 }
1445 return status;
1427} 1446}
1428 1447
1429static int usb_generic_resume(struct device *dev) 1448static int usb_generic_resume(struct device *dev)
1430{ 1449{
1431 struct usb_interface *intf; 1450 struct usb_interface *intf;
1432 struct usb_driver *driver; 1451 struct usb_driver *driver;
1452 struct usb_device *udev;
1453 int status;
1433 1454
1434 /* devices resume through their hub */ 1455 if (dev->power.power_state.event == PM_EVENT_ON)
1435 if (dev->driver == &usb_generic_driver) 1456 return 0;
1457
1458 /* mark things as "on" immediately, no matter what errors crop up */
1459 dev->power.power_state.event = PM_EVENT_ON;
1460
1461 /* devices resume through their hubs */
1462 if (dev->driver == &usb_generic_driver) {
1463 udev = to_usb_device(dev);
1464 if (udev->state == USB_STATE_NOTATTACHED)
1465 return 0;
1436 return usb_resume_device (to_usb_device(dev)); 1466 return usb_resume_device (to_usb_device(dev));
1467 }
1437 1468
1438 if ((dev->driver == NULL) || 1469 if ((dev->driver == NULL) ||
1439 (dev->driver_data == &usb_generic_driver_data)) 1470 (dev->driver_data == &usb_generic_driver_data))
@@ -1442,8 +1473,22 @@ static int usb_generic_resume(struct device *dev)
1442 intf = to_usb_interface(dev); 1473 intf = to_usb_interface(dev);
1443 driver = to_usb_driver(dev->driver); 1474 driver = to_usb_driver(dev->driver);
1444 1475
1445 if (driver->resume) 1476 udev = interface_to_usbdev(intf);
1446 return driver->resume(intf); 1477 if (udev->state == USB_STATE_NOTATTACHED)
1478 return 0;
1479
1480 /* if driver was suspended, it has a resume method;
1481 * however, sysfs can wrongly mark things as suspended
1482 * (on the "no suspend method" FIXME path above)
1483 */
1484 if (driver->resume) {
1485 status = driver->resume(intf);
1486 if (status) {
1487 dev_err(dev, "%s error %d\n", "resume", status);
1488 mark_quiesced(intf);
1489 }
1490 } else
1491 dev_warn(dev, "no %s?\n", "resume");
1447 return 0; 1492 return 0;
1448} 1493}
1449 1494
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index e6504f3370ad..1c4a68499dce 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -13,12 +13,14 @@ extern void usb_disable_device (struct usb_device *dev, int skip_ep0);
13 13
14extern int usb_get_device_descriptor(struct usb_device *dev, 14extern int usb_get_device_descriptor(struct usb_device *dev,
15 unsigned int size); 15 unsigned int size);
16extern char *usb_cache_string(struct usb_device *udev, int index);
16extern int usb_set_configuration(struct usb_device *dev, int configuration); 17extern int usb_set_configuration(struct usb_device *dev, int configuration);
17 18
18extern void usb_lock_all_devices(void); 19extern void usb_lock_all_devices(void);
19extern void usb_unlock_all_devices(void); 20extern void usb_unlock_all_devices(void);
20 21
21extern void usb_kick_khubd(struct usb_device *dev); 22extern void usb_kick_khubd(struct usb_device *dev);
23extern void usb_suspend_root_hub(struct usb_device *hdev);
22extern void usb_resume_root_hub(struct usb_device *dev); 24extern void usb_resume_root_hub(struct usb_device *dev);
23 25
24extern int usb_hub_init(void); 26extern int usb_hub_init(void);
@@ -28,6 +30,28 @@ extern void usb_major_cleanup(void);
28extern int usb_host_init(void); 30extern int usb_host_init(void);
29extern void usb_host_cleanup(void); 31extern void usb_host_cleanup(void);
30 32
33extern int usb_suspend_device(struct usb_device *dev);
34extern int usb_resume_device(struct usb_device *dev);
35
36
37/* Interfaces and their "power state" are owned by usbcore */
38
39static inline void mark_active(struct usb_interface *f)
40{
41 f->dev.power.power_state.event = PM_EVENT_ON;
42}
43
44static inline void mark_quiesced(struct usb_interface *f)
45{
46 f->dev.power.power_state.event = PM_EVENT_FREEZE;
47}
48
49static inline int is_active(struct usb_interface *f)
50{
51 return f->dev.power.power_state.event == PM_EVENT_ON;
52}
53
54
31/* for labeling diagnostics */ 55/* for labeling diagnostics */
32extern const char *usbcore_name; 56extern const char *usbcore_name;
33 57
@@ -39,9 +63,6 @@ extern void usbfs_conn_disc_event(void);
39 63
40extern int usbdev_init(void); 64extern int usbdev_init(void);
41extern void usbdev_cleanup(void); 65extern void usbdev_cleanup(void);
42extern void usbdev_add(struct usb_device *dev);
43extern void usbdev_remove(struct usb_device *dev);
44extern struct usb_device *usbdev_lookup_minor(int minor);
45 66
46struct dev_state { 67struct dev_state {
47 struct list_head list; /* state list */ 68 struct list_head list; /* state list */
@@ -58,3 +79,9 @@ struct dev_state {
58 unsigned long ifclaimed; 79 unsigned long ifclaimed;
59}; 80};
60 81
82/* internal notify stuff */
83extern void usb_notify_add_device(struct usb_device *udev);
84extern void usb_notify_remove_device(struct usb_device *udev);
85extern void usb_notify_add_bus(struct usb_bus *ubus);
86extern void usb_notify_remove_bus(struct usb_bus *ubus);
87
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 503201764f6b..02106bebd5c1 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -967,6 +967,7 @@ static int dummy_udc_resume (struct device *dev)
967 967
968static struct device_driver dummy_udc_driver = { 968static struct device_driver dummy_udc_driver = {
969 .name = (char *) gadget_name, 969 .name = (char *) gadget_name,
970 .owner = THIS_MODULE,
970 .bus = &platform_bus_type, 971 .bus = &platform_bus_type,
971 .probe = dummy_udc_probe, 972 .probe = dummy_udc_probe,
972 .remove = dummy_udc_remove, 973 .remove = dummy_udc_remove,
@@ -1751,7 +1752,7 @@ static int dummy_hub_control (
1751 return retval; 1752 return retval;
1752} 1753}
1753 1754
1754static int dummy_hub_suspend (struct usb_hcd *hcd) 1755static int dummy_bus_suspend (struct usb_hcd *hcd)
1755{ 1756{
1756 struct dummy *dum = hcd_to_dummy (hcd); 1757 struct dummy *dum = hcd_to_dummy (hcd);
1757 1758
@@ -1762,7 +1763,7 @@ static int dummy_hub_suspend (struct usb_hcd *hcd)
1762 return 0; 1763 return 0;
1763} 1764}
1764 1765
1765static int dummy_hub_resume (struct usb_hcd *hcd) 1766static int dummy_bus_resume (struct usb_hcd *hcd)
1766{ 1767{
1767 struct dummy *dum = hcd_to_dummy (hcd); 1768 struct dummy *dum = hcd_to_dummy (hcd);
1768 1769
@@ -1894,8 +1895,8 @@ static const struct hc_driver dummy_hcd = {
1894 1895
1895 .hub_status_data = dummy_hub_status, 1896 .hub_status_data = dummy_hub_status,
1896 .hub_control = dummy_hub_control, 1897 .hub_control = dummy_hub_control,
1897 .hub_suspend = dummy_hub_suspend, 1898 .bus_suspend = dummy_bus_suspend,
1898 .hub_resume = dummy_hub_resume, 1899 .bus_resume = dummy_bus_resume,
1899}; 1900};
1900 1901
1901static int dummy_hcd_probe (struct device *dev) 1902static int dummy_hcd_probe (struct device *dev)
@@ -1936,13 +1937,6 @@ static int dummy_hcd_suspend (struct device *dev, pm_message_t state)
1936 dev_dbg (dev, "%s\n", __FUNCTION__); 1937 dev_dbg (dev, "%s\n", __FUNCTION__);
1937 hcd = dev_get_drvdata (dev); 1938 hcd = dev_get_drvdata (dev);
1938 1939
1939#ifndef CONFIG_USB_SUSPEND
1940 /* Otherwise this would never happen */
1941 usb_lock_device (hcd->self.root_hub);
1942 dummy_hub_suspend (hcd);
1943 usb_unlock_device (hcd->self.root_hub);
1944#endif
1945
1946 hcd->state = HC_STATE_SUSPENDED; 1940 hcd->state = HC_STATE_SUSPENDED;
1947 return 0; 1941 return 0;
1948} 1942}
@@ -1955,19 +1949,13 @@ static int dummy_hcd_resume (struct device *dev)
1955 hcd = dev_get_drvdata (dev); 1949 hcd = dev_get_drvdata (dev);
1956 hcd->state = HC_STATE_RUNNING; 1950 hcd->state = HC_STATE_RUNNING;
1957 1951
1958#ifndef CONFIG_USB_SUSPEND
1959 /* Otherwise this would never happen */
1960 usb_lock_device (hcd->self.root_hub);
1961 dummy_hub_resume (hcd);
1962 usb_unlock_device (hcd->self.root_hub);
1963#endif
1964
1965 usb_hcd_poll_rh_status (hcd); 1952 usb_hcd_poll_rh_status (hcd);
1966 return 0; 1953 return 0;
1967} 1954}
1968 1955
1969static struct device_driver dummy_hcd_driver = { 1956static struct device_driver dummy_hcd_driver = {
1970 .name = (char *) driver_name, 1957 .name = (char *) driver_name,
1958 .owner = THIS_MODULE,
1971 .bus = &platform_bus_type, 1959 .bus = &platform_bus_type,
1972 .probe = dummy_hcd_probe, 1960 .probe = dummy_hcd_probe,
1973 .remove = dummy_hcd_remove, 1961 .remove = dummy_hcd_remove,
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index f1024e804d5c..8f402f85e1ca 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -2533,6 +2533,7 @@ static struct usb_gadget_driver eth_driver = {
2533 2533
2534 .driver = { 2534 .driver = {
2535 .name = (char *) shortname, 2535 .name = (char *) shortname,
2536 .owner = THIS_MODULE,
2536 // .shutdown = ... 2537 // .shutdown = ...
2537 // .suspend = ... 2538 // .suspend = ...
2538 // .resume = ... 2539 // .resume = ...
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index a41d9d4baee3..ea09aaa3cab6 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -224,6 +224,7 @@
224#include <linux/fs.h> 224#include <linux/fs.h>
225#include <linux/init.h> 225#include <linux/init.h>
226#include <linux/kernel.h> 226#include <linux/kernel.h>
227#include <linux/kthread.h>
227#include <linux/limits.h> 228#include <linux/limits.h>
228#include <linux/list.h> 229#include <linux/list.h>
229#include <linux/module.h> 230#include <linux/module.h>
@@ -669,7 +670,6 @@ struct fsg_dev {
669 wait_queue_head_t thread_wqh; 670 wait_queue_head_t thread_wqh;
670 int thread_wakeup_needed; 671 int thread_wakeup_needed;
671 struct completion thread_notifier; 672 struct completion thread_notifier;
672 int thread_pid;
673 struct task_struct *thread_task; 673 struct task_struct *thread_task;
674 sigset_t thread_signal_mask; 674 sigset_t thread_signal_mask;
675 675
@@ -1084,7 +1084,6 @@ static void wakeup_thread(struct fsg_dev *fsg)
1084static void raise_exception(struct fsg_dev *fsg, enum fsg_state new_state) 1084static void raise_exception(struct fsg_dev *fsg, enum fsg_state new_state)
1085{ 1085{
1086 unsigned long flags; 1086 unsigned long flags;
1087 struct task_struct *thread_task;
1088 1087
1089 /* Do nothing if a higher-priority exception is already in progress. 1088 /* Do nothing if a higher-priority exception is already in progress.
1090 * If a lower-or-equal priority exception is in progress, preempt it 1089 * If a lower-or-equal priority exception is in progress, preempt it
@@ -1093,9 +1092,9 @@ static void raise_exception(struct fsg_dev *fsg, enum fsg_state new_state)
1093 if (fsg->state <= new_state) { 1092 if (fsg->state <= new_state) {
1094 fsg->exception_req_tag = fsg->ep0_req_tag; 1093 fsg->exception_req_tag = fsg->ep0_req_tag;
1095 fsg->state = new_state; 1094 fsg->state = new_state;
1096 thread_task = fsg->thread_task; 1095 if (fsg->thread_task)
1097 if (thread_task) 1096 send_sig_info(SIGUSR1, SEND_SIG_FORCED,
1098 send_sig_info(SIGUSR1, SEND_SIG_FORCED, thread_task); 1097 fsg->thread_task);
1099 } 1098 }
1100 spin_unlock_irqrestore(&fsg->lock, flags); 1099 spin_unlock_irqrestore(&fsg->lock, flags);
1101} 1100}
@@ -3383,11 +3382,6 @@ static int fsg_main_thread(void *fsg_)
3383{ 3382{
3384 struct fsg_dev *fsg = (struct fsg_dev *) fsg_; 3383 struct fsg_dev *fsg = (struct fsg_dev *) fsg_;
3385 3384
3386 fsg->thread_task = current;
3387
3388 /* Release all our userspace resources */
3389 daemonize("file-storage-gadget");
3390
3391 /* Allow the thread to be killed by a signal, but set the signal mask 3385 /* Allow the thread to be killed by a signal, but set the signal mask
3392 * to block everything but INT, TERM, KILL, and USR1. */ 3386 * to block everything but INT, TERM, KILL, and USR1. */
3393 siginitsetinv(&fsg->thread_signal_mask, sigmask(SIGINT) | 3387 siginitsetinv(&fsg->thread_signal_mask, sigmask(SIGINT) |
@@ -3400,9 +3394,6 @@ static int fsg_main_thread(void *fsg_)
3400 * that expects a __user pointer and it will work okay. */ 3394 * that expects a __user pointer and it will work okay. */
3401 set_fs(get_ds()); 3395 set_fs(get_ds());
3402 3396
3403 /* Wait for the gadget registration to finish up */
3404 wait_for_completion(&fsg->thread_notifier);
3405
3406 /* The main loop */ 3397 /* The main loop */
3407 while (fsg->state != FSG_STATE_TERMINATED) { 3398 while (fsg->state != FSG_STATE_TERMINATED) {
3408 if (exception_in_progress(fsg) || signal_pending(current)) { 3399 if (exception_in_progress(fsg) || signal_pending(current)) {
@@ -3440,8 +3431,9 @@ static int fsg_main_thread(void *fsg_)
3440 spin_unlock_irq(&fsg->lock); 3431 spin_unlock_irq(&fsg->lock);
3441 } 3432 }
3442 3433
3434 spin_lock_irq(&fsg->lock);
3443 fsg->thread_task = NULL; 3435 fsg->thread_task = NULL;
3444 flush_signals(current); 3436 spin_unlock_irq(&fsg->lock);
3445 3437
3446 /* In case we are exiting because of a signal, unregister the 3438 /* In case we are exiting because of a signal, unregister the
3447 * gadget driver and close the backing file. */ 3439 * gadget driver and close the backing file. */
@@ -3831,12 +3823,11 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3831 3823
3832 /* Create the LUNs, open their backing files, and register the 3824 /* Create the LUNs, open their backing files, and register the
3833 * LUN devices in sysfs. */ 3825 * LUN devices in sysfs. */
3834 fsg->luns = kmalloc(i * sizeof(struct lun), GFP_KERNEL); 3826 fsg->luns = kzalloc(i * sizeof(struct lun), GFP_KERNEL);
3835 if (!fsg->luns) { 3827 if (!fsg->luns) {
3836 rc = -ENOMEM; 3828 rc = -ENOMEM;
3837 goto out; 3829 goto out;
3838 } 3830 }
3839 memset(fsg->luns, 0, i * sizeof(struct lun));
3840 fsg->nluns = i; 3831 fsg->nluns = i;
3841 3832
3842 for (i = 0; i < fsg->nluns; ++i) { 3833 for (i = 0; i < fsg->nluns; ++i) {
@@ -3959,10 +3950,12 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3959 sprintf(&serial[i], "%02X", c); 3950 sprintf(&serial[i], "%02X", c);
3960 } 3951 }
3961 3952
3962 if ((rc = kernel_thread(fsg_main_thread, fsg, (CLONE_VM | CLONE_FS | 3953 fsg->thread_task = kthread_create(fsg_main_thread, fsg,
3963 CLONE_FILES))) < 0) 3954 "file-storage-gadget");
3955 if (IS_ERR(fsg->thread_task)) {
3956 rc = PTR_ERR(fsg->thread_task);
3964 goto out; 3957 goto out;
3965 fsg->thread_pid = rc; 3958 }
3966 3959
3967 INFO(fsg, DRIVER_DESC ", version: " DRIVER_VERSION "\n"); 3960 INFO(fsg, DRIVER_DESC ", version: " DRIVER_VERSION "\n");
3968 INFO(fsg, "Number of LUNs=%d\n", fsg->nluns); 3961 INFO(fsg, "Number of LUNs=%d\n", fsg->nluns);
@@ -3994,7 +3987,12 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3994 DBG(fsg, "removable=%d, stall=%d, buflen=%u\n", 3987 DBG(fsg, "removable=%d, stall=%d, buflen=%u\n",
3995 mod_data.removable, mod_data.can_stall, 3988 mod_data.removable, mod_data.can_stall,
3996 mod_data.buflen); 3989 mod_data.buflen);
3997 DBG(fsg, "I/O thread pid: %d\n", fsg->thread_pid); 3990 DBG(fsg, "I/O thread pid: %d\n", fsg->thread_task->pid);
3991
3992 set_bit(REGISTERED, &fsg->atomic_bitflags);
3993
3994 /* Tell the thread to start working */
3995 wake_up_process(fsg->thread_task);
3998 return 0; 3996 return 0;
3999 3997
4000autoconf_fail: 3998autoconf_fail:
@@ -4046,6 +4044,7 @@ static struct usb_gadget_driver fsg_driver = {
4046 4044
4047 .driver = { 4045 .driver = {
4048 .name = (char *) shortname, 4046 .name = (char *) shortname,
4047 .owner = THIS_MODULE,
4049 // .release = ... 4048 // .release = ...
4050 // .suspend = ... 4049 // .suspend = ...
4051 // .resume = ... 4050 // .resume = ...
@@ -4057,10 +4056,9 @@ static int __init fsg_alloc(void)
4057{ 4056{
4058 struct fsg_dev *fsg; 4057 struct fsg_dev *fsg;
4059 4058
4060 fsg = kmalloc(sizeof *fsg, GFP_KERNEL); 4059 fsg = kzalloc(sizeof *fsg, GFP_KERNEL);
4061 if (!fsg) 4060 if (!fsg)
4062 return -ENOMEM; 4061 return -ENOMEM;
4063 memset(fsg, 0, sizeof *fsg);
4064 spin_lock_init(&fsg->lock); 4062 spin_lock_init(&fsg->lock);
4065 init_rwsem(&fsg->filesem); 4063 init_rwsem(&fsg->filesem);
4066 init_waitqueue_head(&fsg->thread_wqh); 4064 init_waitqueue_head(&fsg->thread_wqh);
@@ -4086,15 +4084,9 @@ static int __init fsg_init(void)
4086 if ((rc = fsg_alloc()) != 0) 4084 if ((rc = fsg_alloc()) != 0)
4087 return rc; 4085 return rc;
4088 fsg = the_fsg; 4086 fsg = the_fsg;
4089 if ((rc = usb_gadget_register_driver(&fsg_driver)) != 0) { 4087 if ((rc = usb_gadget_register_driver(&fsg_driver)) != 0)
4090 fsg_free(fsg); 4088 fsg_free(fsg);
4091 return rc; 4089 return rc;
4092 }
4093 set_bit(REGISTERED, &fsg->atomic_bitflags);
4094
4095 /* Tell the thread to start working */
4096 complete(&fsg->thread_notifier);
4097 return 0;
4098} 4090}
4099module_init(fsg_init); 4091module_init(fsg_init);
4100 4092
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index b0f3cd63e3b9..654469778ab5 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -1970,6 +1970,7 @@ MODULE_DEVICE_TABLE (pci, pci_ids);
1970static struct pci_driver goku_pci_driver = { 1970static struct pci_driver goku_pci_driver = {
1971 .name = (char *) driver_name, 1971 .name = (char *) driver_name,
1972 .id_table = pci_ids, 1972 .id_table = pci_ids,
1973 .owner = THIS_MODULE,
1973 1974
1974 .probe = goku_probe, 1975 .probe = goku_probe,
1975 .remove = goku_remove, 1976 .remove = goku_remove,
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index 012d1e5f1524..9b3673904daf 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -2140,6 +2140,7 @@ static int lh7a40x_udc_remove(struct device *_dev)
2140 2140
2141static struct device_driver udc_driver = { 2141static struct device_driver udc_driver = {
2142 .name = (char *)driver_name, 2142 .name = (char *)driver_name,
2143 .owner = THIS_MODULE,
2143 .bus = &platform_bus_type, 2144 .bus = &platform_bus_type,
2144 .probe = lh7a40x_udc_probe, 2145 .probe = lh7a40x_udc_probe,
2145 .remove = lh7a40x_udc_remove 2146 .remove = lh7a40x_udc_remove
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index c32e1f7476da..0dc6bb00bf72 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -2948,6 +2948,7 @@ MODULE_DEVICE_TABLE (pci, pci_ids);
2948static struct pci_driver net2280_pci_driver = { 2948static struct pci_driver net2280_pci_driver = {
2949 .name = (char *) driver_name, 2949 .name = (char *) driver_name,
2950 .id_table = pci_ids, 2950 .id_table = pci_ids,
2951 .owner = THIS_MODULE,
2951 2952
2952 .probe = net2280_probe, 2953 .probe = net2280_probe,
2953 .remove = net2280_remove, 2954 .remove = net2280_remove,
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index b7885dc0f42f..41c96b0afbb3 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -691,7 +691,7 @@ static void next_out_dma(struct omap_ep *ep, struct omap_req *req)
691} 691}
692 692
693static void 693static void
694finish_out_dma(struct omap_ep *ep, struct omap_req *req, int status) 694finish_out_dma(struct omap_ep *ep, struct omap_req *req, int status, int one)
695{ 695{
696 u16 count; 696 u16 count;
697 697
@@ -699,6 +699,8 @@ finish_out_dma(struct omap_ep *ep, struct omap_req *req, int status)
699 ep->dma_counter = (u16) (req->req.dma + req->req.actual); 699 ep->dma_counter = (u16) (req->req.dma + req->req.actual);
700 count = dma_dest_len(ep, req->req.dma + req->req.actual); 700 count = dma_dest_len(ep, req->req.dma + req->req.actual);
701 count += req->req.actual; 701 count += req->req.actual;
702 if (one)
703 count--;
702 if (count <= req->req.length) 704 if (count <= req->req.length)
703 req->req.actual = count; 705 req->req.actual = count;
704 706
@@ -747,7 +749,7 @@ static void dma_irq(struct omap_udc *udc, u16 irq_src)
747 if (!list_empty(&ep->queue)) { 749 if (!list_empty(&ep->queue)) {
748 req = container_of(ep->queue.next, 750 req = container_of(ep->queue.next,
749 struct omap_req, queue); 751 struct omap_req, queue);
750 finish_out_dma(ep, req, 0); 752 finish_out_dma(ep, req, 0, dman_stat & UDC_DMA_RX_SB);
751 } 753 }
752 UDC_IRQ_SRC_REG = UDC_RXN_EOT; 754 UDC_IRQ_SRC_REG = UDC_RXN_EOT;
753 755
@@ -925,7 +927,7 @@ static void dma_channel_release(struct omap_ep *ep)
925 while (UDC_RXDMA_CFG_REG & mask) 927 while (UDC_RXDMA_CFG_REG & mask)
926 udelay(10); 928 udelay(10);
927 if (req) 929 if (req)
928 finish_out_dma(ep, req, -ECONNRESET); 930 finish_out_dma(ep, req, -ECONNRESET, 0);
929 } 931 }
930 omap_free_dma(ep->lch); 932 omap_free_dma(ep->lch);
931 ep->dma_channel = 0; 933 ep->dma_channel = 0;
@@ -1786,8 +1788,12 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src)
1786 udc->driver->suspend(&udc->gadget); 1788 udc->driver->suspend(&udc->gadget);
1787 spin_lock(&udc->lock); 1789 spin_lock(&udc->lock);
1788 } 1790 }
1791 if (udc->transceiver)
1792 otg_set_suspend(udc->transceiver, 1);
1789 } else { 1793 } else {
1790 VDBG("resume\n"); 1794 VDBG("resume\n");
1795 if (udc->transceiver)
1796 otg_set_suspend(udc->transceiver, 0);
1791 if (udc->gadget.speed == USB_SPEED_FULL 1797 if (udc->gadget.speed == USB_SPEED_FULL
1792 && udc->driver->resume) { 1798 && udc->driver->resume) {
1793 spin_unlock(&udc->lock); 1799 spin_unlock(&udc->lock);
@@ -2943,6 +2949,7 @@ static int omap_udc_resume(struct device *dev)
2943 2949
2944static struct device_driver udc_driver = { 2950static struct device_driver udc_driver = {
2945 .name = (char *) driver_name, 2951 .name = (char *) driver_name,
2952 .owner = THIS_MODULE,
2946 .bus = &platform_bus_type, 2953 .bus = &platform_bus_type,
2947 .probe = omap_udc_probe, 2954 .probe = omap_udc_probe,
2948 .remove = __exit_p(omap_udc_remove), 2955 .remove = __exit_p(omap_udc_remove),
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index 647028590b23..f83a9262f953 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -2631,6 +2631,7 @@ static int pxa2xx_udc_resume(struct device *dev)
2631 2631
2632static struct device_driver udc_driver = { 2632static struct device_driver udc_driver = {
2633 .name = "pxa2xx-udc", 2633 .name = "pxa2xx-udc",
2634 .owner = THIS_MODULE,
2634 .bus = &platform_bus_type, 2635 .bus = &platform_bus_type,
2635 .probe = pxa2xx_udc_probe, 2636 .probe = pxa2xx_udc_probe,
2636 .shutdown = pxa2xx_udc_shutdown, 2637 .shutdown = pxa2xx_udc_shutdown,
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index ec9c424f1d97..6c58636e914b 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -1302,6 +1302,7 @@ static struct usb_gadget_driver zero_driver = {
1302 1302
1303 .driver = { 1303 .driver = {
1304 .name = (char *) shortname, 1304 .name = (char *) shortname,
1305 .owner = THIS_MODULE,
1305 // .shutdown = ... 1306 // .shutdown = ...
1306 // .suspend = ... 1307 // .suspend = ...
1307 // .resume = ... 1308 // .resume = ...
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 350d14fc1cc9..58321d3f314c 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -1,8 +1,9 @@
1# 1#
2# Makefile for USB Host Controller Driver 2# Makefile for USB Host Controller Drivers
3# framework and drivers
4# 3#
5 4
5obj-$(CONFIG_PCI) += pci-quirks.o
6
6obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o 7obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
7obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o 8obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
8obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o 9obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index f5eb9e7b5b18..af3c05eb86fc 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -182,6 +182,9 @@ static int ehci_halt (struct ehci_hcd *ehci)
182{ 182{
183 u32 temp = readl (&ehci->regs->status); 183 u32 temp = readl (&ehci->regs->status);
184 184
185 /* disable any irqs left enabled by previous code */
186 writel (0, &ehci->regs->intr_enable);
187
185 if ((temp & STS_HALT) != 0) 188 if ((temp & STS_HALT) != 0)
186 return 0; 189 return 0;
187 190
@@ -297,50 +300,17 @@ static void ehci_watchdog (unsigned long param)
297 spin_unlock_irqrestore (&ehci->lock, flags); 300 spin_unlock_irqrestore (&ehci->lock, flags);
298} 301}
299 302
300#ifdef CONFIG_PCI 303/* Reboot notifiers kick in for silicon on any bus (not just pci, etc).
301 304 * This forcibly disables dma and IRQs, helping kexec and other cases
302/* EHCI 0.96 (and later) section 5.1 says how to kick BIOS/SMM/... 305 * where the next system software may expect clean state.
303 * off the controller (maybe it can boot from highspeed USB disks).
304 */ 306 */
305static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap)
306{
307 struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller);
308
309 /* always say Linux will own the hardware */
310 pci_write_config_byte(pdev, where + 3, 1);
311
312 /* maybe wait a while for BIOS to respond */
313 if (cap & (1 << 16)) {
314 int msec = 5000;
315
316 do {
317 msleep(10);
318 msec -= 10;
319 pci_read_config_dword(pdev, where, &cap);
320 } while ((cap & (1 << 16)) && msec);
321 if (cap & (1 << 16)) {
322 ehci_err(ehci, "BIOS handoff failed (%d, %08x)\n",
323 where, cap);
324 // some BIOS versions seem buggy...
325 // return 1;
326 ehci_warn (ehci, "continuing after BIOS bug...\n");
327 /* disable all SMIs, and clear "BIOS owns" flag */
328 pci_write_config_dword(pdev, where + 4, 0);
329 pci_write_config_byte(pdev, where + 2, 0);
330 } else
331 ehci_dbg(ehci, "BIOS handoff succeeded\n");
332 }
333 return 0;
334}
335
336#endif
337
338static int 307static int
339ehci_reboot (struct notifier_block *self, unsigned long code, void *null) 308ehci_reboot (struct notifier_block *self, unsigned long code, void *null)
340{ 309{
341 struct ehci_hcd *ehci; 310 struct ehci_hcd *ehci;
342 311
343 ehci = container_of (self, struct ehci_hcd, reboot_notifier); 312 ehci = container_of (self, struct ehci_hcd, reboot_notifier);
313 (void) ehci_halt (ehci);
344 314
345 /* make BIOS/etc use companion controller during reboot */ 315 /* make BIOS/etc use companion controller during reboot */
346 writel (0, &ehci->regs->configured_flag); 316 writel (0, &ehci->regs->configured_flag);
@@ -363,156 +333,90 @@ static void ehci_port_power (struct ehci_hcd *ehci, int is_on)
363 msleep(20); 333 msleep(20);
364} 334}
365 335
336/*-------------------------------------------------------------------------*/
337
338/*
339 * ehci_work is called from some interrupts, timers, and so on.
340 * it calls driver completion functions, after dropping ehci->lock.
341 */
342static void ehci_work (struct ehci_hcd *ehci, struct pt_regs *regs)
343{
344 timer_action_done (ehci, TIMER_IO_WATCHDOG);
345 if (ehci->reclaim_ready)
346 end_unlink_async (ehci, regs);
347
348 /* another CPU may drop ehci->lock during a schedule scan while
349 * it reports urb completions. this flag guards against bogus
350 * attempts at re-entrant schedule scanning.
351 */
352 if (ehci->scanning)
353 return;
354 ehci->scanning = 1;
355 scan_async (ehci, regs);
356 if (ehci->next_uframe != -1)
357 scan_periodic (ehci, regs);
358 ehci->scanning = 0;
366 359
367/* called by khubd or root hub init threads */ 360 /* the IO watchdog guards against hardware or driver bugs that
361 * misplace IRQs, and should let us run completely without IRQs.
362 * such lossage has been observed on both VT6202 and VT8235.
363 */
364 if (HC_IS_RUNNING (ehci_to_hcd(ehci)->state) &&
365 (ehci->async->qh_next.ptr != NULL ||
366 ehci->periodic_sched != 0))
367 timer_action (ehci, TIMER_IO_WATCHDOG);
368}
368 369
369static int ehci_hc_reset (struct usb_hcd *hcd) 370static void ehci_stop (struct usb_hcd *hcd)
370{ 371{
371 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 372 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
372 u32 temp;
373 unsigned count = 256/4;
374 373
375 spin_lock_init (&ehci->lock); 374 ehci_dbg (ehci, "stop\n");
376 375
377 ehci->caps = hcd->regs; 376 /* Turn off port power on all root hub ports. */
378 ehci->regs = hcd->regs + HC_LENGTH (readl (&ehci->caps->hc_capbase)); 377 ehci_port_power (ehci, 0);
379 dbg_hcs_params (ehci, "reset");
380 dbg_hcc_params (ehci, "reset");
381 378
382 /* cache this readonly data; minimize chip reads */ 379 /* no more interrupts ... */
383 ehci->hcs_params = readl (&ehci->caps->hcs_params); 380 del_timer_sync (&ehci->watchdog);
384 381
385#ifdef CONFIG_PCI 382 spin_lock_irq(&ehci->lock);
386 if (hcd->self.controller->bus == &pci_bus_type) { 383 if (HC_IS_RUNNING (hcd->state))
387 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); 384 ehci_quiesce (ehci);
388 385
389 switch (pdev->vendor) { 386 ehci_reset (ehci);
390 case PCI_VENDOR_ID_TDI: 387 writel (0, &ehci->regs->intr_enable);
391 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { 388 spin_unlock_irq(&ehci->lock);
392 ehci->is_tdi_rh_tt = 1;
393 tdi_reset (ehci);
394 }
395 break;
396 case PCI_VENDOR_ID_AMD:
397 /* AMD8111 EHCI doesn't work, according to AMD errata */
398 if (pdev->device == 0x7463) {
399 ehci_info (ehci, "ignoring AMD8111 (errata)\n");
400 return -EIO;
401 }
402 break;
403 case PCI_VENDOR_ID_NVIDIA:
404 /* NVidia reports that certain chips don't handle
405 * QH, ITD, or SITD addresses above 2GB. (But TD,
406 * data buffer, and periodic schedule are normal.)
407 */
408 switch (pdev->device) {
409 case 0x003c: /* MCP04 */
410 case 0x005b: /* CK804 */
411 case 0x00d8: /* CK8 */
412 case 0x00e8: /* CK8S */
413 if (pci_set_consistent_dma_mask(pdev,
414 DMA_31BIT_MASK) < 0)
415 ehci_warn (ehci, "can't enable NVidia "
416 "workaround for >2GB RAM\n");
417 break;
418 }
419 break;
420 }
421 389
422 /* optional debug port, normally in the first BAR */ 390 /* let companion controllers work when we aren't */
423 temp = pci_find_capability (pdev, 0x0a); 391 writel (0, &ehci->regs->configured_flag);
424 if (temp) { 392 unregister_reboot_notifier (&ehci->reboot_notifier);
425 pci_read_config_dword(pdev, temp, &temp);
426 temp >>= 16;
427 if ((temp & (3 << 13)) == (1 << 13)) {
428 temp &= 0x1fff;
429 ehci->debug = hcd->regs + temp;
430 temp = readl (&ehci->debug->control);
431 ehci_info (ehci, "debug port %d%s\n",
432 HCS_DEBUG_PORT(ehci->hcs_params),
433 (temp & DBGP_ENABLED)
434 ? " IN USE"
435 : "");
436 if (!(temp & DBGP_ENABLED))
437 ehci->debug = NULL;
438 }
439 }
440 393
441 temp = HCC_EXT_CAPS (readl (&ehci->caps->hcc_params)); 394 remove_debug_files (ehci);
442 } else
443 temp = 0;
444
445 /* EHCI 0.96 and later may have "extended capabilities" */
446 while (temp && count--) {
447 u32 cap;
448
449 pci_read_config_dword (to_pci_dev(hcd->self.controller),
450 temp, &cap);
451 ehci_dbg (ehci, "capability %04x at %02x\n", cap, temp);
452 switch (cap & 0xff) {
453 case 1: /* BIOS/SMM/... handoff */
454 if (bios_handoff (ehci, temp, cap) != 0)
455 return -EOPNOTSUPP;
456 break;
457 case 0: /* illegal reserved capability */
458 ehci_warn (ehci, "illegal capability!\n");
459 cap = 0;
460 /* FALLTHROUGH */
461 default: /* unknown */
462 break;
463 }
464 temp = (cap >> 8) & 0xff;
465 }
466 if (!count) {
467 ehci_err (ehci, "bogus capabilities ... PCI problems!\n");
468 return -EIO;
469 }
470 if (ehci_is_TDI(ehci))
471 ehci_reset (ehci);
472#endif
473 395
474 ehci_port_power (ehci, 0); 396 /* root hub is shut down separately (first, when possible) */
397 spin_lock_irq (&ehci->lock);
398 if (ehci->async)
399 ehci_work (ehci, NULL);
400 spin_unlock_irq (&ehci->lock);
401 ehci_mem_cleanup (ehci);
475 402
476 /* at least the Genesys GL880S needs fixup here */ 403#ifdef EHCI_STATS
477 temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params); 404 ehci_dbg (ehci, "irq normal %ld err %ld reclaim %ld (lost %ld)\n",
478 temp &= 0x0f; 405 ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim,
479 if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) { 406 ehci->stats.lost_iaa);
480 ehci_dbg (ehci, "bogus port configuration: " 407 ehci_dbg (ehci, "complete %ld unlink %ld\n",
481 "cc=%d x pcc=%d < ports=%d\n", 408 ehci->stats.complete, ehci->stats.unlink);
482 HCS_N_CC(ehci->hcs_params),
483 HCS_N_PCC(ehci->hcs_params),
484 HCS_N_PORTS(ehci->hcs_params));
485
486#ifdef CONFIG_PCI
487 if (hcd->self.controller->bus == &pci_bus_type) {
488 struct pci_dev *pdev;
489
490 pdev = to_pci_dev(hcd->self.controller);
491 switch (pdev->vendor) {
492 case 0x17a0: /* GENESYS */
493 /* GL880S: should be PORTS=2 */
494 temp |= (ehci->hcs_params & ~0xf);
495 ehci->hcs_params = temp;
496 break;
497 case PCI_VENDOR_ID_NVIDIA:
498 /* NF4: should be PCC=10 */
499 break;
500 }
501 }
502#endif 409#endif
503 }
504 410
505 /* force HC to halt state */ 411 dbg_status (ehci, "ehci_stop completed", readl (&ehci->regs->status));
506 return ehci_halt (ehci);
507} 412}
508 413
509static int ehci_start (struct usb_hcd *hcd) 414static int ehci_run (struct usb_hcd *hcd)
510{ 415{
511 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 416 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
512 u32 temp; 417 u32 temp;
513 int retval; 418 int retval;
514 u32 hcc_params; 419 u32 hcc_params;
515 u8 sbrn = 0;
516 int first; 420 int first;
517 421
518 /* skip some things on restart paths */ 422 /* skip some things on restart paths */
@@ -551,27 +455,6 @@ static int ehci_start (struct usb_hcd *hcd)
551 } 455 }
552 writel (ehci->periodic_dma, &ehci->regs->frame_list); 456 writel (ehci->periodic_dma, &ehci->regs->frame_list);
553 457
554#ifdef CONFIG_PCI
555 if (hcd->self.controller->bus == &pci_bus_type) {
556 struct pci_dev *pdev;
557 u16 port_wake;
558
559 pdev = to_pci_dev(hcd->self.controller);
560
561 /* Serial Bus Release Number is at PCI 0x60 offset */
562 pci_read_config_byte(pdev, 0x60, &sbrn);
563
564 /* port wake capability, reported by boot firmware */
565 pci_read_config_word(pdev, 0x62, &port_wake);
566 hcd->can_wakeup = (port_wake & 1) != 0;
567
568 /* help hc dma work well with cachelines */
569 retval = pci_set_mwi(pdev);
570 if (retval)
571 ehci_dbg(ehci, "unable to enable MWI - not fatal.\n");
572 }
573#endif
574
575 /* 458 /*
576 * dedicate a qh for the async ring head, since we couldn't unlink 459 * dedicate a qh for the async ring head, since we couldn't unlink
577 * a 'real' qh without stopping the async schedule [4.8]. use it 460 * a 'real' qh without stopping the async schedule [4.8]. use it
@@ -667,7 +550,7 @@ static int ehci_start (struct usb_hcd *hcd)
667 temp = HC_VERSION(readl (&ehci->caps->hc_capbase)); 550 temp = HC_VERSION(readl (&ehci->caps->hc_capbase));
668 ehci_info (ehci, 551 ehci_info (ehci,
669 "USB %x.%x %s, EHCI %x.%02x, driver %s\n", 552 "USB %x.%x %s, EHCI %x.%02x, driver %s\n",
670 ((sbrn & 0xf0)>>4), (sbrn & 0x0f), 553 ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f),
671 first ? "initialized" : "restarted", 554 first ? "initialized" : "restarted",
672 temp >> 8, temp & 0xff, DRIVER_VERSION); 555 temp >> 8, temp & 0xff, DRIVER_VERSION);
673 556
@@ -679,188 +562,6 @@ static int ehci_start (struct usb_hcd *hcd)
679 return 0; 562 return 0;
680} 563}
681 564
682/* always called by thread; normally rmmod */
683
684static void ehci_stop (struct usb_hcd *hcd)
685{
686 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
687
688 ehci_dbg (ehci, "stop\n");
689
690 /* Turn off port power on all root hub ports. */
691 ehci_port_power (ehci, 0);
692
693 /* no more interrupts ... */
694 del_timer_sync (&ehci->watchdog);
695
696 spin_lock_irq(&ehci->lock);
697 if (HC_IS_RUNNING (hcd->state))
698 ehci_quiesce (ehci);
699
700 ehci_reset (ehci);
701 writel (0, &ehci->regs->intr_enable);
702 spin_unlock_irq(&ehci->lock);
703
704 /* let companion controllers work when we aren't */
705 writel (0, &ehci->regs->configured_flag);
706 unregister_reboot_notifier (&ehci->reboot_notifier);
707
708 remove_debug_files (ehci);
709
710 /* root hub is shut down separately (first, when possible) */
711 spin_lock_irq (&ehci->lock);
712 if (ehci->async)
713 ehci_work (ehci, NULL);
714 spin_unlock_irq (&ehci->lock);
715 ehci_mem_cleanup (ehci);
716
717#ifdef EHCI_STATS
718 ehci_dbg (ehci, "irq normal %ld err %ld reclaim %ld (lost %ld)\n",
719 ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim,
720 ehci->stats.lost_iaa);
721 ehci_dbg (ehci, "complete %ld unlink %ld\n",
722 ehci->stats.complete, ehci->stats.unlink);
723#endif
724
725 dbg_status (ehci, "ehci_stop completed", readl (&ehci->regs->status));
726}
727
728static int ehci_get_frame (struct usb_hcd *hcd)
729{
730 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
731 return (readl (&ehci->regs->frame_index) >> 3) % ehci->periodic_size;
732}
733
734/*-------------------------------------------------------------------------*/
735
736#ifdef CONFIG_PM
737
738/* suspend/resume, section 4.3 */
739
740/* These routines rely on the bus (pci, platform, etc)
741 * to handle powerdown and wakeup, and currently also on
742 * transceivers that don't need any software attention to set up
743 * the right sort of wakeup.
744 */
745
746static int ehci_suspend (struct usb_hcd *hcd, pm_message_t message)
747{
748 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
749
750 if (time_before (jiffies, ehci->next_statechange))
751 msleep (100);
752
753#ifdef CONFIG_USB_SUSPEND
754 (void) usb_suspend_device (hcd->self.root_hub, message);
755#else
756 usb_lock_device (hcd->self.root_hub);
757 (void) ehci_hub_suspend (hcd);
758 usb_unlock_device (hcd->self.root_hub);
759#endif
760
761 // save (PCI) FLADJ in case of Vaux power loss
762 // ... we'd only use it to handle clock skew
763
764 return 0;
765}
766
767static int ehci_resume (struct usb_hcd *hcd)
768{
769 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
770 unsigned port;
771 struct usb_device *root = hcd->self.root_hub;
772 int retval = -EINVAL;
773
774 // maybe restore (PCI) FLADJ
775
776 if (time_before (jiffies, ehci->next_statechange))
777 msleep (100);
778
779 /* If any port is suspended (or owned by the companion),
780 * we know we can/must resume the HC (and mustn't reset it).
781 */
782 for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) {
783 u32 status;
784 port--;
785 status = readl (&ehci->regs->port_status [port]);
786 if (!(status & PORT_POWER))
787 continue;
788 if (status & (PORT_SUSPEND | PORT_OWNER)) {
789 down (&hcd->self.root_hub->serialize);
790 retval = ehci_hub_resume (hcd);
791 up (&hcd->self.root_hub->serialize);
792 break;
793 }
794 if (!root->children [port])
795 continue;
796 dbg_port (ehci, __FUNCTION__, port + 1, status);
797 usb_set_device_state (root->children[port],
798 USB_STATE_NOTATTACHED);
799 }
800
801 /* Else reset, to cope with power loss or flush-to-storage
802 * style "resume" having activated BIOS during reboot.
803 */
804 if (port == 0) {
805 (void) ehci_halt (ehci);
806 (void) ehci_reset (ehci);
807 (void) ehci_hc_reset (hcd);
808
809 /* emptying the schedule aborts any urbs */
810 spin_lock_irq (&ehci->lock);
811 if (ehci->reclaim)
812 ehci->reclaim_ready = 1;
813 ehci_work (ehci, NULL);
814 spin_unlock_irq (&ehci->lock);
815
816 /* restart; khubd will disconnect devices */
817 retval = ehci_start (hcd);
818
819 /* here we "know" root ports should always stay powered;
820 * but some controllers may lose all power.
821 */
822 ehci_port_power (ehci, 1);
823 }
824
825 return retval;
826}
827
828#endif
829
830/*-------------------------------------------------------------------------*/
831
832/*
833 * ehci_work is called from some interrupts, timers, and so on.
834 * it calls driver completion functions, after dropping ehci->lock.
835 */
836static void ehci_work (struct ehci_hcd *ehci, struct pt_regs *regs)
837{
838 timer_action_done (ehci, TIMER_IO_WATCHDOG);
839 if (ehci->reclaim_ready)
840 end_unlink_async (ehci, regs);
841
842 /* another CPU may drop ehci->lock during a schedule scan while
843 * it reports urb completions. this flag guards against bogus
844 * attempts at re-entrant schedule scanning.
845 */
846 if (ehci->scanning)
847 return;
848 ehci->scanning = 1;
849 scan_async (ehci, regs);
850 if (ehci->next_uframe != -1)
851 scan_periodic (ehci, regs);
852 ehci->scanning = 0;
853
854 /* the IO watchdog guards against hardware or driver bugs that
855 * misplace IRQs, and should let us run completely without IRQs.
856 * such lossage has been observed on both VT6202 and VT8235.
857 */
858 if (HC_IS_RUNNING (ehci_to_hcd(ehci)->state) &&
859 (ehci->async->qh_next.ptr != NULL ||
860 ehci->periodic_sched != 0))
861 timer_action (ehci, TIMER_IO_WATCHDOG);
862}
863
864/*-------------------------------------------------------------------------*/ 565/*-------------------------------------------------------------------------*/
865 566
866static irqreturn_t ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs) 567static irqreturn_t ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
@@ -1171,106 +872,24 @@ done:
1171 return; 872 return;
1172} 873}
1173 874
1174/*-------------------------------------------------------------------------*/ 875static int ehci_get_frame (struct usb_hcd *hcd)
1175 876{
1176static const struct hc_driver ehci_driver = { 877 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
1177 .description = hcd_name, 878 return (readl (&ehci->regs->frame_index) >> 3) % ehci->periodic_size;
1178 .product_desc = "EHCI Host Controller", 879}
1179 .hcd_priv_size = sizeof(struct ehci_hcd),
1180
1181 /*
1182 * generic hardware linkage
1183 */
1184 .irq = ehci_irq,
1185 .flags = HCD_MEMORY | HCD_USB2,
1186
1187 /*
1188 * basic lifecycle operations
1189 */
1190 .reset = ehci_hc_reset,
1191 .start = ehci_start,
1192#ifdef CONFIG_PM
1193 .suspend = ehci_suspend,
1194 .resume = ehci_resume,
1195#endif
1196 .stop = ehci_stop,
1197
1198 /*
1199 * managing i/o requests and associated device resources
1200 */
1201 .urb_enqueue = ehci_urb_enqueue,
1202 .urb_dequeue = ehci_urb_dequeue,
1203 .endpoint_disable = ehci_endpoint_disable,
1204
1205 /*
1206 * scheduling support
1207 */
1208 .get_frame_number = ehci_get_frame,
1209
1210 /*
1211 * root hub support
1212 */
1213 .hub_status_data = ehci_hub_status_data,
1214 .hub_control = ehci_hub_control,
1215 .hub_suspend = ehci_hub_suspend,
1216 .hub_resume = ehci_hub_resume,
1217};
1218 880
1219/*-------------------------------------------------------------------------*/ 881/*-------------------------------------------------------------------------*/
1220 882
1221/* EHCI 1.0 doesn't require PCI */
1222
1223#ifdef CONFIG_PCI
1224
1225/* PCI driver selection metadata; PCI hotplugging uses this */
1226static const struct pci_device_id pci_ids [] = { {
1227 /* handle any USB 2.0 EHCI controller */
1228 PCI_DEVICE_CLASS(((PCI_CLASS_SERIAL_USB << 8) | 0x20), ~0),
1229 .driver_data = (unsigned long) &ehci_driver,
1230 },
1231 { /* end: all zeroes */ }
1232};
1233MODULE_DEVICE_TABLE (pci, pci_ids);
1234
1235/* pci driver glue; this is a "new style" PCI driver module */
1236static struct pci_driver ehci_pci_driver = {
1237 .name = (char *) hcd_name,
1238 .id_table = pci_ids,
1239
1240 .probe = usb_hcd_pci_probe,
1241 .remove = usb_hcd_pci_remove,
1242
1243#ifdef CONFIG_PM
1244 .suspend = usb_hcd_pci_suspend,
1245 .resume = usb_hcd_pci_resume,
1246#endif
1247};
1248
1249#endif /* PCI */
1250
1251
1252#define DRIVER_INFO DRIVER_VERSION " " DRIVER_DESC 883#define DRIVER_INFO DRIVER_VERSION " " DRIVER_DESC
1253 884
1254MODULE_DESCRIPTION (DRIVER_INFO); 885MODULE_DESCRIPTION (DRIVER_INFO);
1255MODULE_AUTHOR (DRIVER_AUTHOR); 886MODULE_AUTHOR (DRIVER_AUTHOR);
1256MODULE_LICENSE ("GPL"); 887MODULE_LICENSE ("GPL");
1257 888
1258static int __init init (void) 889#ifdef CONFIG_PCI
1259{ 890#include "ehci-pci.c"
1260 if (usb_disabled()) 891#endif
1261 return -ENODEV;
1262
1263 pr_debug ("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n",
1264 hcd_name,
1265 sizeof (struct ehci_qh), sizeof (struct ehci_qtd),
1266 sizeof (struct ehci_itd), sizeof (struct ehci_sitd));
1267
1268 return pci_register_driver (&ehci_pci_driver);
1269}
1270module_init (init);
1271 892
1272static void __exit cleanup (void) 893#if !defined(CONFIG_PCI)
1273{ 894#error "missing bus glue for ehci-hcd"
1274 pci_unregister_driver (&ehci_pci_driver); 895#endif
1275}
1276module_exit (cleanup);
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 18d3f2270316..88cb4ada686e 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -30,7 +30,7 @@
30 30
31#ifdef CONFIG_PM 31#ifdef CONFIG_PM
32 32
33static int ehci_hub_suspend (struct usb_hcd *hcd) 33static int ehci_bus_suspend (struct usb_hcd *hcd)
34{ 34{
35 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 35 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
36 int port; 36 int port;
@@ -83,7 +83,7 @@ static int ehci_hub_suspend (struct usb_hcd *hcd)
83 83
84 84
85/* caller has locked the root hub, and should reset/reinit on error */ 85/* caller has locked the root hub, and should reset/reinit on error */
86static int ehci_hub_resume (struct usb_hcd *hcd) 86static int ehci_bus_resume (struct usb_hcd *hcd)
87{ 87{
88 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 88 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
89 u32 temp; 89 u32 temp;
@@ -159,8 +159,8 @@ static int ehci_hub_resume (struct usb_hcd *hcd)
159 159
160#else 160#else
161 161
162#define ehci_hub_suspend NULL 162#define ehci_bus_suspend NULL
163#define ehci_hub_resume NULL 163#define ehci_bus_resume NULL
164 164
165#endif /* CONFIG_PM */ 165#endif /* CONFIG_PM */
166 166
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
new file mode 100644
index 000000000000..145008853966
--- /dev/null
+++ b/drivers/usb/host/ehci-pci.c
@@ -0,0 +1,415 @@
1/*
2 * EHCI HCD (Host Controller Driver) PCI Bus Glue.
3 *
4 * Copyright (c) 2000-2004 by David Brownell
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef CONFIG_PCI
22#error "This file is PCI bus glue. CONFIG_PCI must be defined."
23#endif
24
25/*-------------------------------------------------------------------------*/
26
27/* EHCI 0.96 (and later) section 5.1 says how to kick BIOS/SMM/...
28 * off the controller (maybe it can boot from highspeed USB disks).
29 */
30static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap)
31{
32 struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller);
33
34 /* always say Linux will own the hardware */
35 pci_write_config_byte(pdev, where + 3, 1);
36
37 /* maybe wait a while for BIOS to respond */
38 if (cap & (1 << 16)) {
39 int msec = 5000;
40
41 do {
42 msleep(10);
43 msec -= 10;
44 pci_read_config_dword(pdev, where, &cap);
45 } while ((cap & (1 << 16)) && msec);
46 if (cap & (1 << 16)) {
47 ehci_err(ehci, "BIOS handoff failed (%d, %08x)\n",
48 where, cap);
49 // some BIOS versions seem buggy...
50 // return 1;
51 ehci_warn (ehci, "continuing after BIOS bug...\n");
52 /* disable all SMIs, and clear "BIOS owns" flag */
53 pci_write_config_dword(pdev, where + 4, 0);
54 pci_write_config_byte(pdev, where + 2, 0);
55 } else
56 ehci_dbg(ehci, "BIOS handoff succeeded\n");
57 }
58 return 0;
59}
60
61/* called by khubd or root hub init threads */
62static int ehci_pci_reset (struct usb_hcd *hcd)
63{
64 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
65 u32 temp;
66 unsigned count = 256/4;
67
68 spin_lock_init (&ehci->lock);
69
70 ehci->caps = hcd->regs;
71 ehci->regs = hcd->regs + HC_LENGTH (readl (&ehci->caps->hc_capbase));
72 dbg_hcs_params (ehci, "reset");
73 dbg_hcc_params (ehci, "reset");
74
75 /* cache this readonly data; minimize chip reads */
76 ehci->hcs_params = readl (&ehci->caps->hcs_params);
77
78 if (hcd->self.controller->bus == &pci_bus_type) {
79 struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
80
81 switch (pdev->vendor) {
82 case PCI_VENDOR_ID_TDI:
83 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
84 ehci->is_tdi_rh_tt = 1;
85 tdi_reset (ehci);
86 }
87 break;
88 case PCI_VENDOR_ID_AMD:
89 /* AMD8111 EHCI doesn't work, according to AMD errata */
90 if (pdev->device == 0x7463) {
91 ehci_info (ehci, "ignoring AMD8111 (errata)\n");
92 return -EIO;
93 }
94 break;
95 case PCI_VENDOR_ID_NVIDIA:
96 /* NVidia reports that certain chips don't handle
97 * QH, ITD, or SITD addresses above 2GB. (But TD,
98 * data buffer, and periodic schedule are normal.)
99 */
100 switch (pdev->device) {
101 case 0x003c: /* MCP04 */
102 case 0x005b: /* CK804 */
103 case 0x00d8: /* CK8 */
104 case 0x00e8: /* CK8S */
105 if (pci_set_consistent_dma_mask(pdev,
106 DMA_31BIT_MASK) < 0)
107 ehci_warn (ehci, "can't enable NVidia "
108 "workaround for >2GB RAM\n");
109 break;
110 }
111 break;
112 }
113
114 /* optional debug port, normally in the first BAR */
115 temp = pci_find_capability (pdev, 0x0a);
116 if (temp) {
117 pci_read_config_dword(pdev, temp, &temp);
118 temp >>= 16;
119 if ((temp & (3 << 13)) == (1 << 13)) {
120 temp &= 0x1fff;
121 ehci->debug = hcd->regs + temp;
122 temp = readl (&ehci->debug->control);
123 ehci_info (ehci, "debug port %d%s\n",
124 HCS_DEBUG_PORT(ehci->hcs_params),
125 (temp & DBGP_ENABLED)
126 ? " IN USE"
127 : "");
128 if (!(temp & DBGP_ENABLED))
129 ehci->debug = NULL;
130 }
131 }
132
133 temp = HCC_EXT_CAPS (readl (&ehci->caps->hcc_params));
134 } else
135 temp = 0;
136
137 /* EHCI 0.96 and later may have "extended capabilities" */
138 while (temp && count--) {
139 u32 cap;
140
141 pci_read_config_dword (to_pci_dev(hcd->self.controller),
142 temp, &cap);
143 ehci_dbg (ehci, "capability %04x at %02x\n", cap, temp);
144 switch (cap & 0xff) {
145 case 1: /* BIOS/SMM/... handoff */
146 if (bios_handoff (ehci, temp, cap) != 0)
147 return -EOPNOTSUPP;
148 break;
149 case 0: /* illegal reserved capability */
150 ehci_warn (ehci, "illegal capability!\n");
151 cap = 0;
152 /* FALLTHROUGH */
153 default: /* unknown */
154 break;
155 }
156 temp = (cap >> 8) & 0xff;
157 }
158 if (!count) {
159 ehci_err (ehci, "bogus capabilities ... PCI problems!\n");
160 return -EIO;
161 }
162 if (ehci_is_TDI(ehci))
163 ehci_reset (ehci);
164
165 ehci_port_power (ehci, 0);
166
167 /* at least the Genesys GL880S needs fixup here */
168 temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params);
169 temp &= 0x0f;
170 if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) {
171 ehci_dbg (ehci, "bogus port configuration: "
172 "cc=%d x pcc=%d < ports=%d\n",
173 HCS_N_CC(ehci->hcs_params),
174 HCS_N_PCC(ehci->hcs_params),
175 HCS_N_PORTS(ehci->hcs_params));
176
177 if (hcd->self.controller->bus == &pci_bus_type) {
178 struct pci_dev *pdev;
179
180 pdev = to_pci_dev(hcd->self.controller);
181 switch (pdev->vendor) {
182 case 0x17a0: /* GENESYS */
183 /* GL880S: should be PORTS=2 */
184 temp |= (ehci->hcs_params & ~0xf);
185 ehci->hcs_params = temp;
186 break;
187 case PCI_VENDOR_ID_NVIDIA:
188 /* NF4: should be PCC=10 */
189 break;
190 }
191 }
192 }
193
194 /* force HC to halt state */
195 return ehci_halt (ehci);
196}
197
198static int ehci_pci_start (struct usb_hcd *hcd)
199{
200 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
201 int result = 0;
202
203 if (hcd->self.controller->bus == &pci_bus_type) {
204 struct pci_dev *pdev;
205 u16 port_wake;
206
207 pdev = to_pci_dev(hcd->self.controller);
208
209 /* Serial Bus Release Number is at PCI 0x60 offset */
210 pci_read_config_byte(pdev, 0x60, &ehci->sbrn);
211
212 /* port wake capability, reported by boot firmware */
213 pci_read_config_word(pdev, 0x62, &port_wake);
214 hcd->can_wakeup = (port_wake & 1) != 0;
215
216 /* help hc dma work well with cachelines */
217 result = pci_set_mwi(pdev);
218 if (result)
219 ehci_dbg(ehci, "unable to enable MWI - not fatal.\n");
220 }
221
222 return ehci_run (hcd);
223}
224
225/* always called by thread; normally rmmod */
226
227static void ehci_pci_stop (struct usb_hcd *hcd)
228{
229 ehci_stop (hcd);
230}
231
232/*-------------------------------------------------------------------------*/
233
234#ifdef CONFIG_PM
235
236/* suspend/resume, section 4.3 */
237
238/* These routines rely on the bus (pci, platform, etc)
239 * to handle powerdown and wakeup, and currently also on
240 * transceivers that don't need any software attention to set up
241 * the right sort of wakeup.
242 */
243
244static int ehci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
245{
246 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
247
248 if (time_before (jiffies, ehci->next_statechange))
249 msleep (100);
250
251#ifdef CONFIG_USB_SUSPEND
252 (void) usb_suspend_device (hcd->self.root_hub);
253#else
254 usb_lock_device (hcd->self.root_hub);
255 (void) ehci_bus_suspend (hcd);
256 usb_unlock_device (hcd->self.root_hub);
257#endif
258
259 // save (PCI) FLADJ in case of Vaux power loss
260 // ... we'd only use it to handle clock skew
261
262 return 0;
263}
264
265static int ehci_pci_resume (struct usb_hcd *hcd)
266{
267 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
268 unsigned port;
269 struct usb_device *root = hcd->self.root_hub;
270 int retval = -EINVAL;
271
272 // maybe restore (PCI) FLADJ
273
274 if (time_before (jiffies, ehci->next_statechange))
275 msleep (100);
276
277 /* If any port is suspended (or owned by the companion),
278 * we know we can/must resume the HC (and mustn't reset it).
279 */
280 for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) {
281 u32 status;
282 port--;
283 status = readl (&ehci->regs->port_status [port]);
284 if (!(status & PORT_POWER))
285 continue;
286 if (status & (PORT_SUSPEND | PORT_OWNER)) {
287 down (&hcd->self.root_hub->serialize);
288 retval = ehci_bus_resume (hcd);
289 up (&hcd->self.root_hub->serialize);
290 break;
291 }
292 if (!root->children [port])
293 continue;
294 dbg_port (ehci, __FUNCTION__, port + 1, status);
295 usb_set_device_state (root->children[port],
296 USB_STATE_NOTATTACHED);
297 }
298
299 /* Else reset, to cope with power loss or flush-to-storage
300 * style "resume" having activated BIOS during reboot.
301 */
302 if (port == 0) {
303 (void) ehci_halt (ehci);
304 (void) ehci_reset (ehci);
305 (void) ehci_pci_reset (hcd);
306
307 /* emptying the schedule aborts any urbs */
308 spin_lock_irq (&ehci->lock);
309 if (ehci->reclaim)
310 ehci->reclaim_ready = 1;
311 ehci_work (ehci, NULL);
312 spin_unlock_irq (&ehci->lock);
313
314 /* restart; khubd will disconnect devices */
315 retval = ehci_run (hcd);
316
317 /* here we "know" root ports should always stay powered;
318 * but some controllers may lose all power.
319 */
320 ehci_port_power (ehci, 1);
321 }
322
323 return retval;
324}
325#endif
326
327static const struct hc_driver ehci_pci_hc_driver = {
328 .description = hcd_name,
329 .product_desc = "EHCI Host Controller",
330 .hcd_priv_size = sizeof(struct ehci_hcd),
331
332 /*
333 * generic hardware linkage
334 */
335 .irq = ehci_irq,
336 .flags = HCD_MEMORY | HCD_USB2,
337
338 /*
339 * basic lifecycle operations
340 */
341 .reset = ehci_pci_reset,
342 .start = ehci_pci_start,
343#ifdef CONFIG_PM
344 .suspend = ehci_pci_suspend,
345 .resume = ehci_pci_resume,
346#endif
347 .stop = ehci_pci_stop,
348
349 /*
350 * managing i/o requests and associated device resources
351 */
352 .urb_enqueue = ehci_urb_enqueue,
353 .urb_dequeue = ehci_urb_dequeue,
354 .endpoint_disable = ehci_endpoint_disable,
355
356 /*
357 * scheduling support
358 */
359 .get_frame_number = ehci_get_frame,
360
361 /*
362 * root hub support
363 */
364 .hub_status_data = ehci_hub_status_data,
365 .hub_control = ehci_hub_control,
366 .bus_suspend = ehci_bus_suspend,
367 .bus_resume = ehci_bus_resume,
368};
369
370/*-------------------------------------------------------------------------*/
371
372/* PCI driver selection metadata; PCI hotplugging uses this */
373static const struct pci_device_id pci_ids [] = { {
374 /* handle any USB 2.0 EHCI controller */
375 PCI_DEVICE_CLASS(((PCI_CLASS_SERIAL_USB << 8) | 0x20), ~0),
376 .driver_data = (unsigned long) &ehci_pci_hc_driver,
377 },
378 { /* end: all zeroes */ }
379};
380MODULE_DEVICE_TABLE (pci, pci_ids);
381
382/* pci driver glue; this is a "new style" PCI driver module */
383static struct pci_driver ehci_pci_driver = {
384 .name = (char *) hcd_name,
385 .id_table = pci_ids,
386 .owner = THIS_MODULE,
387
388 .probe = usb_hcd_pci_probe,
389 .remove = usb_hcd_pci_remove,
390
391#ifdef CONFIG_PM
392 .suspend = usb_hcd_pci_suspend,
393 .resume = usb_hcd_pci_resume,
394#endif
395};
396
397static int __init ehci_hcd_pci_init (void)
398{
399 if (usb_disabled())
400 return -ENODEV;
401
402 pr_debug ("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n",
403 hcd_name,
404 sizeof (struct ehci_qh), sizeof (struct ehci_qtd),
405 sizeof (struct ehci_itd), sizeof (struct ehci_sitd));
406
407 return pci_register_driver (&ehci_pci_driver);
408}
409module_init (ehci_hcd_pci_init);
410
411static void __exit ehci_hcd_pci_cleanup (void)
412{
413 pci_unregister_driver (&ehci_pci_driver);
414}
415module_exit (ehci_hcd_pci_cleanup);
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index f34a0516d35f..18e257c2bdb5 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -97,6 +97,7 @@ struct ehci_hcd { /* one per controller */
97#else 97#else
98# define COUNT(x) do {} while (0) 98# define COUNT(x) do {} while (0)
99#endif 99#endif
100 u8 sbrn; /* packed release number */
100}; 101};
101 102
102/* convert between an HCD pointer and the corresponding EHCI_HCD */ 103/* convert between an HCD pointer and the corresponding EHCI_HCD */
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 642f35068ce2..ddb8fc591466 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -638,7 +638,7 @@ static irqreturn_t isp116x_irq(struct usb_hcd *hcd, struct pt_regs *regs)
638 + msecs_to_jiffies(20) + 1); 638 + msecs_to_jiffies(20) + 1);
639 if (intstat & HCINT_RD) { 639 if (intstat & HCINT_RD) {
640 DBG("---- remote wakeup\n"); 640 DBG("---- remote wakeup\n");
641 schedule_work(&isp116x->rh_resume); 641 usb_hcd_resume_root_hub(hcd);
642 ret = IRQ_HANDLED; 642 ret = IRQ_HANDLED;
643 } 643 }
644 irqstat &= ~HCuPINT_OPR; 644 irqstat &= ~HCuPINT_OPR;
@@ -1160,7 +1160,7 @@ static int isp116x_hub_control(struct usb_hcd *hcd,
1160 1160
1161#ifdef CONFIG_PM 1161#ifdef CONFIG_PM
1162 1162
1163static int isp116x_hub_suspend(struct usb_hcd *hcd) 1163static int isp116x_bus_suspend(struct usb_hcd *hcd)
1164{ 1164{
1165 struct isp116x *isp116x = hcd_to_isp116x(hcd); 1165 struct isp116x *isp116x = hcd_to_isp116x(hcd);
1166 unsigned long flags; 1166 unsigned long flags;
@@ -1200,7 +1200,7 @@ static int isp116x_hub_suspend(struct usb_hcd *hcd)
1200 return ret; 1200 return ret;
1201} 1201}
1202 1202
1203static int isp116x_hub_resume(struct usb_hcd *hcd) 1203static int isp116x_bus_resume(struct usb_hcd *hcd)
1204{ 1204{
1205 struct isp116x *isp116x = hcd_to_isp116x(hcd); 1205 struct isp116x *isp116x = hcd_to_isp116x(hcd);
1206 u32 val; 1206 u32 val;
@@ -1263,21 +1263,11 @@ static int isp116x_hub_resume(struct usb_hcd *hcd)
1263 return 0; 1263 return 0;
1264} 1264}
1265 1265
1266static void isp116x_rh_resume(void *_hcd)
1267{
1268 struct usb_hcd *hcd = _hcd;
1269
1270 usb_resume_device(hcd->self.root_hub);
1271}
1272 1266
1273#else 1267#else
1274 1268
1275#define isp116x_hub_suspend NULL 1269#define isp116x_bus_suspend NULL
1276#define isp116x_hub_resume NULL 1270#define isp116x_bus_resume NULL
1277
1278static void isp116x_rh_resume(void *_hcd)
1279{
1280}
1281 1271
1282#endif 1272#endif
1283 1273
@@ -1636,8 +1626,8 @@ static struct hc_driver isp116x_hc_driver = {
1636 1626
1637 .hub_status_data = isp116x_hub_status_data, 1627 .hub_status_data = isp116x_hub_status_data,
1638 .hub_control = isp116x_hub_control, 1628 .hub_control = isp116x_hub_control,
1639 .hub_suspend = isp116x_hub_suspend, 1629 .bus_suspend = isp116x_bus_suspend,
1640 .hub_resume = isp116x_hub_resume, 1630 .bus_resume = isp116x_bus_resume,
1641}; 1631};
1642 1632
1643/*----------------------------------------------------------------*/ 1633/*----------------------------------------------------------------*/
@@ -1732,7 +1722,6 @@ static int __init isp116x_probe(struct device *dev)
1732 isp116x->addr_reg = addr_reg; 1722 isp116x->addr_reg = addr_reg;
1733 spin_lock_init(&isp116x->lock); 1723 spin_lock_init(&isp116x->lock);
1734 INIT_LIST_HEAD(&isp116x->async); 1724 INIT_LIST_HEAD(&isp116x->async);
1735 INIT_WORK(&isp116x->rh_resume, isp116x_rh_resume, hcd);
1736 isp116x->board = dev->platform_data; 1725 isp116x->board = dev->platform_data;
1737 1726
1738 if (!isp116x->board) { 1727 if (!isp116x->board) {
@@ -1777,16 +1766,10 @@ static int __init isp116x_probe(struct device *dev)
1777static int isp116x_suspend(struct device *dev, pm_message_t state) 1766static int isp116x_suspend(struct device *dev, pm_message_t state)
1778{ 1767{
1779 int ret = 0; 1768 int ret = 0;
1780 struct usb_hcd *hcd = dev_get_drvdata(dev);
1781 1769
1782 VDBG("%s: state %x\n", __func__, state); 1770 VDBG("%s: state %x\n", __func__, state);
1783 1771
1784 ret = usb_suspend_device(hcd->self.root_hub, state); 1772 dev->power.power_state = state;
1785 if (!ret) {
1786 dev->power.power_state = state;
1787 INFO("%s suspended\n", hcd_name);
1788 } else
1789 ERR("%s suspend failed\n", hcd_name);
1790 1773
1791 return ret; 1774 return ret;
1792} 1775}
@@ -1797,15 +1780,11 @@ static int isp116x_suspend(struct device *dev, pm_message_t state)
1797static int isp116x_resume(struct device *dev) 1780static int isp116x_resume(struct device *dev)
1798{ 1781{
1799 int ret = 0; 1782 int ret = 0;
1800 struct usb_hcd *hcd = dev_get_drvdata(dev);
1801 1783
1802 VDBG("%s: state %x\n", __func__, dev->power.power_state); 1784 VDBG("%s: state %x\n", __func__, dev->power.power_state);
1803 1785
1804 ret = usb_resume_device(hcd->self.root_hub); 1786 dev->power.power_state = PMSG_ON;
1805 if (!ret) { 1787
1806 dev->power.power_state = PMSG_ON;
1807 VDBG("%s resumed\n", (char *)hcd_name);
1808 }
1809 return ret; 1788 return ret;
1810} 1789}
1811 1790
diff --git a/drivers/usb/host/isp116x.h b/drivers/usb/host/isp116x.h
index 58873470dcf5..c6fec96785fe 100644
--- a/drivers/usb/host/isp116x.h
+++ b/drivers/usb/host/isp116x.h
@@ -253,7 +253,6 @@ static const int cc_to_error[16] = {
253 253
254struct isp116x { 254struct isp116x {
255 spinlock_t lock; 255 spinlock_t lock;
256 struct work_struct rh_resume;
257 256
258 void __iomem *addr_reg; 257 void __iomem *addr_reg;
259 void __iomem *data_reg; 258 void __iomem *data_reg;
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index 3981bf15c8c7..a277e258eb6c 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -214,6 +214,11 @@ static const struct hc_driver ohci_au1xxx_hc_driver = {
214 */ 214 */
215 .hub_status_data = ohci_hub_status_data, 215 .hub_status_data = ohci_hub_status_data,
216 .hub_control = ohci_hub_control, 216 .hub_control = ohci_hub_control,
217#ifdef CONFIG_PM
218 .bus_suspend = ohci_bus_suspend,
219 .bus_resume = ohci_bus_resume,
220#endif
221 .start_port_reset = ohci_start_port_reset,
217}; 222};
218 223
219/*-------------------------------------------------------------------------*/ 224/*-------------------------------------------------------------------------*/
@@ -259,6 +264,7 @@ static int ohci_hcd_au1xxx_drv_resume(struct device *dev)
259 264
260static struct device_driver ohci_hcd_au1xxx_driver = { 265static struct device_driver ohci_hcd_au1xxx_driver = {
261 .name = "au1xxx-ohci", 266 .name = "au1xxx-ohci",
267 .owner = THIS_MODULE,
262 .bus = &platform_bus_type, 268 .bus = &platform_bus_type,
263 .probe = ohci_hcd_au1xxx_drv_probe, 269 .probe = ohci_hcd_au1xxx_drv_probe,
264 .remove = ohci_hcd_au1xxx_drv_remove, 270 .remove = ohci_hcd_au1xxx_drv_remove,
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index 7924c74f958e..7bfffcbbd226 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -193,10 +193,6 @@ ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size)
193 193
194 maybe_print_eds (controller, "donehead", 194 maybe_print_eds (controller, "donehead",
195 ohci_readl (controller, &regs->donehead), next, size); 195 ohci_readl (controller, &regs->donehead), next, size);
196
197 /* broken fminterval means traffic won't flow! */
198 ohci_dbg (controller, "fminterval %08x\n",
199 ohci_readl (controller, &regs->fminterval));
200} 196}
201 197
202#define dbg_port_sw(hc,num,value,next,size) \ 198#define dbg_port_sw(hc,num,value,next,size) \
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index f8da8c7af7c6..5c0c6c8a7a82 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -723,7 +723,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
723 ohci_vdbg (ohci, "resume detect\n"); 723 ohci_vdbg (ohci, "resume detect\n");
724 ohci_writel (ohci, OHCI_INTR_RD, &regs->intrstatus); 724 ohci_writel (ohci, OHCI_INTR_RD, &regs->intrstatus);
725 if (hcd->state != HC_STATE_QUIESCING) 725 if (hcd->state != HC_STATE_QUIESCING)
726 schedule_work(&ohci->rh_resume); 726 usb_hcd_resume_root_hub(hcd);
727 } 727 }
728 728
729 if (ints & OHCI_INTR_WDH) { 729 if (ints & OHCI_INTR_WDH) {
@@ -791,7 +791,7 @@ static void ohci_stop (struct usb_hcd *hcd)
791 791
792/* must not be called from interrupt context */ 792/* must not be called from interrupt context */
793 793
794#if defined(CONFIG_USB_SUSPEND) || defined(CONFIG_PM) 794#ifdef CONFIG_PM
795 795
796static int ohci_restart (struct ohci_hcd *ohci) 796static int ohci_restart (struct ohci_hcd *ohci)
797{ 797{
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index ce7b28da7a15..e01e77bc324b 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -36,7 +36,7 @@
36 36
37/*-------------------------------------------------------------------------*/ 37/*-------------------------------------------------------------------------*/
38 38
39#if defined(CONFIG_USB_SUSPEND) || defined(CONFIG_PM) 39#ifdef CONFIG_PM
40 40
41#define OHCI_SCHED_ENABLES \ 41#define OHCI_SCHED_ENABLES \
42 (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) 42 (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE)
@@ -45,7 +45,7 @@ static void dl_done_list (struct ohci_hcd *, struct pt_regs *);
45static void finish_unlinks (struct ohci_hcd *, u16 , struct pt_regs *); 45static void finish_unlinks (struct ohci_hcd *, u16 , struct pt_regs *);
46static int ohci_restart (struct ohci_hcd *ohci); 46static int ohci_restart (struct ohci_hcd *ohci);
47 47
48static int ohci_hub_suspend (struct usb_hcd *hcd) 48static int ohci_bus_suspend (struct usb_hcd *hcd)
49{ 49{
50 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 50 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
51 int status = 0; 51 int status = 0;
@@ -73,7 +73,6 @@ static int ohci_hub_suspend (struct usb_hcd *hcd)
73 ohci_dbg (ohci, "suspend root hub\n"); 73 ohci_dbg (ohci, "suspend root hub\n");
74 74
75 /* First stop any processing */ 75 /* First stop any processing */
76 hcd->state = HC_STATE_QUIESCING;
77 if (ohci->hc_control & OHCI_SCHED_ENABLES) { 76 if (ohci->hc_control & OHCI_SCHED_ENABLES) {
78 int limit; 77 int limit;
79 78
@@ -108,7 +107,9 @@ static int ohci_hub_suspend (struct usb_hcd *hcd)
108 else 107 else
109 ohci->hc_control &= ~OHCI_CTRL_RWE; 108 ohci->hc_control &= ~OHCI_CTRL_RWE;
110 109
111 /* Suspend hub */ 110 /* Suspend hub ... this is the "global (to this bus) suspend" mode,
111 * which doesn't imply ports will first be individually suspended.
112 */
112 ohci->hc_control &= ~OHCI_CTRL_HCFS; 113 ohci->hc_control &= ~OHCI_CTRL_HCFS;
113 ohci->hc_control |= OHCI_USB_SUSPEND; 114 ohci->hc_control |= OHCI_USB_SUSPEND;
114 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control); 115 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
@@ -118,8 +119,9 @@ static int ohci_hub_suspend (struct usb_hcd *hcd)
118 ohci->next_statechange = jiffies + msecs_to_jiffies (5); 119 ohci->next_statechange = jiffies + msecs_to_jiffies (5);
119 120
120done: 121done:
122 /* external suspend vs self autosuspend ... same effect */
121 if (status == 0) 123 if (status == 0)
122 hcd->state = HC_STATE_SUSPENDED; 124 usb_hcd_suspend_root_hub(hcd);
123 spin_unlock_irqrestore (&ohci->lock, flags); 125 spin_unlock_irqrestore (&ohci->lock, flags);
124 return status; 126 return status;
125} 127}
@@ -133,7 +135,7 @@ static inline struct ed *find_head (struct ed *ed)
133} 135}
134 136
135/* caller has locked the root hub */ 137/* caller has locked the root hub */
136static int ohci_hub_resume (struct usb_hcd *hcd) 138static int ohci_bus_resume (struct usb_hcd *hcd)
137{ 139{
138 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 140 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
139 u32 temp, enables; 141 u32 temp, enables;
@@ -146,7 +148,7 @@ static int ohci_hub_resume (struct usb_hcd *hcd)
146 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control); 148 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control);
147 149
148 if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) { 150 if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
149 /* this can happen after suspend-to-disk */ 151 /* this can happen after resuming a swsusp snapshot */
150 if (hcd->state == HC_STATE_RESUMING) { 152 if (hcd->state == HC_STATE_RESUMING) {
151 ohci_dbg (ohci, "BIOS/SMM active, control %03x\n", 153 ohci_dbg (ohci, "BIOS/SMM active, control %03x\n",
152 ohci->hc_control); 154 ohci->hc_control);
@@ -169,11 +171,12 @@ static int ohci_hub_resume (struct usb_hcd *hcd)
169 ohci_info (ohci, "wakeup\n"); 171 ohci_info (ohci, "wakeup\n");
170 break; 172 break;
171 case OHCI_USB_OPER: 173 case OHCI_USB_OPER:
172 ohci_dbg (ohci, "already resumed\n"); 174 /* this can happen after resuming a swsusp snapshot */
173 status = 0; 175 ohci_dbg (ohci, "snapshot resume? reinit\n");
176 status = -EBUSY;
174 break; 177 break;
175 default: /* RESET, we lost power */ 178 default: /* RESET, we lost power */
176 ohci_dbg (ohci, "root hub hardware reset\n"); 179 ohci_dbg (ohci, "lost power\n");
177 status = -EBUSY; 180 status = -EBUSY;
178 } 181 }
179 spin_unlock_irq (&ohci->lock); 182 spin_unlock_irq (&ohci->lock);
@@ -198,8 +201,7 @@ static int ohci_hub_resume (struct usb_hcd *hcd)
198 } 201 }
199 202
200 /* Some controllers (lucent erratum) need extra-long delays */ 203 /* Some controllers (lucent erratum) need extra-long delays */
201 hcd->state = HC_STATE_RESUMING; 204 msleep (20 /* usb 11.5.1.10 */ + 12 /* 32 msec counter */ + 1);
202 mdelay (20 /* usb 11.5.1.10 */ + 15);
203 205
204 temp = ohci_readl (ohci, &ohci->regs->control); 206 temp = ohci_readl (ohci, &ohci->regs->control);
205 temp &= OHCI_CTRL_HCFS; 207 temp &= OHCI_CTRL_HCFS;
@@ -273,28 +275,10 @@ static int ohci_hub_resume (struct usb_hcd *hcd)
273 (void) ohci_readl (ohci, &ohci->regs->control); 275 (void) ohci_readl (ohci, &ohci->regs->control);
274 } 276 }
275 277
276 hcd->state = HC_STATE_RUNNING;
277 return 0; 278 return 0;
278} 279}
279 280
280static void ohci_rh_resume (void *_hcd) 281#endif /* CONFIG_PM */
281{
282 struct usb_hcd *hcd = _hcd;
283
284 usb_lock_device (hcd->self.root_hub);
285 (void) ohci_hub_resume (hcd);
286 usb_unlock_device (hcd->self.root_hub);
287}
288
289#else
290
291static void ohci_rh_resume (void *_hcd)
292{
293 struct ohci_hcd *ohci = hcd_to_ohci (_hcd);
294 ohci_dbg(ohci, "rh_resume ??\n");
295}
296
297#endif /* CONFIG_USB_SUSPEND || CONFIG_PM */
298 282
299/*-------------------------------------------------------------------------*/ 283/*-------------------------------------------------------------------------*/
300 284
@@ -367,7 +351,6 @@ done:
367#ifdef CONFIG_PM 351#ifdef CONFIG_PM
368 /* save power by suspending idle root hubs; 352 /* save power by suspending idle root hubs;
369 * INTR_RD wakes us when there's work 353 * INTR_RD wakes us when there's work
370 * NOTE: if we can do this, we don't need a root hub timer!
371 */ 354 */
372 if (can_suspend 355 if (can_suspend
373 && !changed 356 && !changed
@@ -379,8 +362,7 @@ done:
379 && usb_trylock_device (hcd->self.root_hub) 362 && usb_trylock_device (hcd->self.root_hub)
380 ) { 363 ) {
381 ohci_vdbg (ohci, "autosuspend\n"); 364 ohci_vdbg (ohci, "autosuspend\n");
382 (void) ohci_hub_suspend (hcd); 365 (void) ohci_bus_suspend (hcd);
383 hcd->state = HC_STATE_RUNNING;
384 usb_unlock_device (hcd->self.root_hub); 366 usb_unlock_device (hcd->self.root_hub);
385 } 367 }
386#endif 368#endif
@@ -554,7 +536,7 @@ static int ohci_hub_control (
554 temp = RH_PS_POCI; 536 temp = RH_PS_POCI;
555 if ((ohci->hc_control & OHCI_CTRL_HCFS) 537 if ((ohci->hc_control & OHCI_CTRL_HCFS)
556 != OHCI_USB_OPER) 538 != OHCI_USB_OPER)
557 schedule_work (&ohci->rh_resume); 539 usb_hcd_resume_root_hub(hcd);
558 break; 540 break;
559 case USB_PORT_FEAT_C_SUSPEND: 541 case USB_PORT_FEAT_C_SUSPEND:
560 temp = RH_PS_PSSC; 542 temp = RH_PS_PSSC;
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c
index 859aca7be753..238fa4ade615 100644
--- a/drivers/usb/host/ohci-lh7a404.c
+++ b/drivers/usb/host/ohci-lh7a404.c
@@ -193,6 +193,11 @@ static const struct hc_driver ohci_lh7a404_hc_driver = {
193 */ 193 */
194 .hub_status_data = ohci_hub_status_data, 194 .hub_status_data = ohci_hub_status_data,
195 .hub_control = ohci_hub_control, 195 .hub_control = ohci_hub_control,
196#ifdef CONFIG_PM
197 .bus_suspend = ohci_bus_suspend,
198 .bus_resume = ohci_bus_resume,
199#endif
200 .start_port_reset = ohci_start_port_reset,
196}; 201};
197 202
198/*-------------------------------------------------------------------------*/ 203/*-------------------------------------------------------------------------*/
@@ -239,6 +244,7 @@ static int ohci_hcd_lh7a404_drv_resume(struct device *dev)
239 244
240static struct device_driver ohci_hcd_lh7a404_driver = { 245static struct device_driver ohci_hcd_lh7a404_driver = {
241 .name = "lh7a404-ohci", 246 .name = "lh7a404-ohci",
247 .owner = THIS_MODULE,
242 .bus = &platform_bus_type, 248 .bus = &platform_bus_type,
243 .probe = ohci_hcd_lh7a404_drv_probe, 249 .probe = ohci_hcd_lh7a404_drv_probe,
244 .remove = ohci_hcd_lh7a404_drv_remove, 250 .remove = ohci_hcd_lh7a404_drv_remove,
diff --git a/drivers/usb/host/ohci-mem.c b/drivers/usb/host/ohci-mem.c
index 9fb83dfb1eb4..bfbe328a4788 100644
--- a/drivers/usb/host/ohci-mem.c
+++ b/drivers/usb/host/ohci-mem.c
@@ -28,7 +28,6 @@ static void ohci_hcd_init (struct ohci_hcd *ohci)
28 ohci->next_statechange = jiffies; 28 ohci->next_statechange = jiffies;
29 spin_lock_init (&ohci->lock); 29 spin_lock_init (&ohci->lock);
30 INIT_LIST_HEAD (&ohci->pending); 30 INIT_LIST_HEAD (&ohci->pending);
31 INIT_WORK (&ohci->rh_resume, ohci_rh_resume, ohci_to_hcd(ohci));
32 ohci->reboot_notifier.notifier_call = ohci_reboot; 31 ohci->reboot_notifier.notifier_call = ohci_reboot;
33} 32}
34 33
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index a574216625a0..45efeed1fcc3 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -420,9 +420,9 @@ static const struct hc_driver ohci_omap_hc_driver = {
420 */ 420 */
421 .hub_status_data = ohci_hub_status_data, 421 .hub_status_data = ohci_hub_status_data,
422 .hub_control = ohci_hub_control, 422 .hub_control = ohci_hub_control,
423#ifdef CONFIG_USB_SUSPEND 423#ifdef CONFIG_PM
424 .hub_suspend = ohci_hub_suspend, 424 .bus_suspend = ohci_bus_suspend,
425 .hub_resume = ohci_hub_resume, 425 .bus_resume = ohci_bus_resume,
426#endif 426#endif
427 .start_port_reset = ohci_start_port_reset, 427 .start_port_reset = ohci_start_port_reset,
428}; 428};
@@ -458,41 +458,29 @@ static int ohci_hcd_omap_drv_remove(struct device *dev)
458static int ohci_omap_suspend(struct device *dev, pm_message_t message) 458static int ohci_omap_suspend(struct device *dev, pm_message_t message)
459{ 459{
460 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); 460 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
461 int status = -EINVAL; 461
462 462 if (time_before(jiffies, ohci->next_statechange))
463 down(&ohci_to_hcd(ohci)->self.root_hub->serialize); 463 msleep(5);
464 status = ohci_hub_suspend(ohci_to_hcd(ohci)); 464 ohci->next_statechange = jiffies;
465 if (status == 0) { 465
466 omap_ohci_clock_power(0); 466 omap_ohci_clock_power(0);
467 ohci_to_hcd(ohci)->self.root_hub->state = 467 ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED;
468 USB_STATE_SUSPENDED; 468 dev->power.power_state = PMSG_SUSPEND;
469 ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; 469 return 0;
470 dev->power.power_state = PMSG_SUSPEND;
471 }
472 up(&ohci_to_hcd(ohci)->self.root_hub->serialize);
473 return status;
474} 470}
475 471
476static int ohci_omap_resume(struct device *dev) 472static int ohci_omap_resume(struct device *dev)
477{ 473{
478 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); 474 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
479 int status = 0;
480 475
481 if (time_before(jiffies, ohci->next_statechange)) 476 if (time_before(jiffies, ohci->next_statechange))
482 msleep(5); 477 msleep(5);
483 ohci->next_statechange = jiffies; 478 ohci->next_statechange = jiffies;
479
484 omap_ohci_clock_power(1); 480 omap_ohci_clock_power(1);
485#ifdef CONFIG_USB_SUSPEND 481 dev->power.power_state = PMSG_ON;
486 /* get extra cleanup even if remote wakeup isn't in use */ 482 usb_hcd_resume_root_hub(dev_get_drvdata(dev));
487 status = usb_resume_device(ohci_to_hcd(ohci)->self.root_hub); 483 return 0;
488#else
489 down(&ohci_to_hcd(ohci)->self.root_hub->serialize);
490 status = ohci_hub_resume(ohci_to_hcd(ohci));
491 up(&ohci_to_hcd(ohci)->self.root_hub->serialize);
492#endif
493 if (status == 0)
494 dev->power.power_state = PMSG_ON;
495 return status;
496} 484}
497 485
498#endif 486#endif
@@ -504,6 +492,7 @@ static int ohci_omap_resume(struct device *dev)
504 */ 492 */
505static struct device_driver ohci_hcd_omap_driver = { 493static struct device_driver ohci_hcd_omap_driver = {
506 .name = "ohci", 494 .name = "ohci",
495 .owner = THIS_MODULE,
507 .bus = &platform_bus_type, 496 .bus = &platform_bus_type,
508 .probe = ohci_hcd_omap_drv_probe, 497 .probe = ohci_hcd_omap_drv_probe,
509 .remove = ohci_hcd_omap_drv_remove, 498 .remove = ohci_hcd_omap_drv_remove,
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index eede6be098d2..bf1d5ab4aa3a 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -112,23 +112,13 @@ ohci_pci_start (struct usb_hcd *hcd)
112 112
113static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) 113static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
114{ 114{
115 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 115 /* root hub was already suspended */
116
117 /* suspend root hub, hoping it keeps power during suspend */
118 if (time_before (jiffies, ohci->next_statechange))
119 msleep (100);
120
121#ifdef CONFIG_USB_SUSPEND
122 (void) usb_suspend_device (hcd->self.root_hub, message);
123#else
124 usb_lock_device (hcd->self.root_hub);
125 (void) ohci_hub_suspend (hcd);
126 usb_unlock_device (hcd->self.root_hub);
127#endif
128 116
129 /* let things settle down a bit */ 117 /* FIXME these PMAC things get called in the wrong places. ASIC
130 msleep (100); 118 * clocks should be turned off AFTER entering D3, and on BEFORE
131 119 * trying to enter D0. Evidently the PCI layer doesn't currently
120 * provide the right sort of platform hooks for this ...
121 */
132#ifdef CONFIG_PPC_PMAC 122#ifdef CONFIG_PPC_PMAC
133 if (_machine == _MACH_Pmac) { 123 if (_machine == _MACH_Pmac) {
134 struct device_node *of_node; 124 struct device_node *of_node;
@@ -145,9 +135,6 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
145 135
146static int ohci_pci_resume (struct usb_hcd *hcd) 136static int ohci_pci_resume (struct usb_hcd *hcd)
147{ 137{
148 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
149 int retval = 0;
150
151#ifdef CONFIG_PPC_PMAC 138#ifdef CONFIG_PPC_PMAC
152 if (_machine == _MACH_Pmac) { 139 if (_machine == _MACH_Pmac) {
153 struct device_node *of_node; 140 struct device_node *of_node;
@@ -159,19 +146,8 @@ static int ohci_pci_resume (struct usb_hcd *hcd)
159 } 146 }
160#endif /* CONFIG_PPC_PMAC */ 147#endif /* CONFIG_PPC_PMAC */
161 148
162 /* resume root hub */ 149 usb_hcd_resume_root_hub(hcd);
163 if (time_before (jiffies, ohci->next_statechange)) 150 return 0;
164 msleep (100);
165#ifdef CONFIG_USB_SUSPEND
166 /* get extra cleanup even if remote wakeup isn't in use */
167 retval = usb_resume_device (hcd->self.root_hub);
168#else
169 usb_lock_device (hcd->self.root_hub);
170 retval = ohci_hub_resume (hcd);
171 usb_unlock_device (hcd->self.root_hub);
172#endif
173
174 return retval;
175} 151}
176 152
177#endif /* CONFIG_PM */ 153#endif /* CONFIG_PM */
@@ -218,9 +194,9 @@ static const struct hc_driver ohci_pci_hc_driver = {
218 */ 194 */
219 .hub_status_data = ohci_hub_status_data, 195 .hub_status_data = ohci_hub_status_data,
220 .hub_control = ohci_hub_control, 196 .hub_control = ohci_hub_control,
221#ifdef CONFIG_USB_SUSPEND 197#ifdef CONFIG_PM
222 .hub_suspend = ohci_hub_suspend, 198 .bus_suspend = ohci_bus_suspend,
223 .hub_resume = ohci_hub_resume, 199 .bus_resume = ohci_bus_resume,
224#endif 200#endif
225 .start_port_reset = ohci_start_port_reset, 201 .start_port_reset = ohci_start_port_reset,
226}; 202};
@@ -240,6 +216,7 @@ MODULE_DEVICE_TABLE (pci, pci_ids);
240static struct pci_driver ohci_pci_driver = { 216static struct pci_driver ohci_pci_driver = {
241 .name = (char *) hcd_name, 217 .name = (char *) hcd_name,
242 .id_table = pci_ids, 218 .id_table = pci_ids,
219 .owner = THIS_MODULE,
243 220
244 .probe = usb_hcd_pci_probe, 221 .probe = usb_hcd_pci_probe,
245 .remove = usb_hcd_pci_remove, 222 .remove = usb_hcd_pci_remove,
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c
index 251533363028..4832e57ae579 100644
--- a/drivers/usb/host/ohci-ppc-soc.c
+++ b/drivers/usb/host/ohci-ppc-soc.c
@@ -163,9 +163,9 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = {
163 */ 163 */
164 .hub_status_data = ohci_hub_status_data, 164 .hub_status_data = ohci_hub_status_data,
165 .hub_control = ohci_hub_control, 165 .hub_control = ohci_hub_control,
166#ifdef CONFIG_USB_SUSPEND 166#ifdef CONFIG_PM
167 .hub_suspend = ohci_hub_suspend, 167 .bus_suspend = ohci_bus_suspend,
168 .hub_resume = ohci_hub_resume, 168 .bus_resume = ohci_bus_resume,
169#endif 169#endif
170 .start_port_reset = ohci_start_port_reset, 170 .start_port_reset = ohci_start_port_reset,
171}; 171};
@@ -193,10 +193,11 @@ static int ohci_hcd_ppc_soc_drv_remove(struct device *dev)
193 193
194static struct device_driver ohci_hcd_ppc_soc_driver = { 194static struct device_driver ohci_hcd_ppc_soc_driver = {
195 .name = "ppc-soc-ohci", 195 .name = "ppc-soc-ohci",
196 .owner = THIS_MODULE,
196 .bus = &platform_bus_type, 197 .bus = &platform_bus_type,
197 .probe = ohci_hcd_ppc_soc_drv_probe, 198 .probe = ohci_hcd_ppc_soc_drv_probe,
198 .remove = ohci_hcd_ppc_soc_drv_remove, 199 .remove = ohci_hcd_ppc_soc_drv_remove,
199#if defined(CONFIG_USB_SUSPEND) || defined(CONFIG_PM) 200#ifdef CONFIG_PM
200 /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/ 201 /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/
201 /*.resume = ohci_hcd_ppc_soc_drv_resume,*/ 202 /*.resume = ohci_hcd_ppc_soc_drv_resume,*/
202#endif 203#endif
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index f042261ecb8e..d287dcccd415 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -278,10 +278,11 @@ static const struct hc_driver ohci_pxa27x_hc_driver = {
278 */ 278 */
279 .hub_status_data = ohci_hub_status_data, 279 .hub_status_data = ohci_hub_status_data,
280 .hub_control = ohci_hub_control, 280 .hub_control = ohci_hub_control,
281#ifdef CONFIG_USB_SUSPEND 281#ifdef CONFIG_PM
282 .hub_suspend = ohci_hub_suspend, 282 .bus_suspend = ohci_bus_suspend,
283 .hub_resume = ohci_hub_resume, 283 .bus_resume = ohci_bus_resume,
284#endif 284#endif
285 .start_port_reset = ohci_start_port_reset,
285}; 286};
286 287
287/*-------------------------------------------------------------------------*/ 288/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index da7d5478f74d..fab420a2ce71 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -448,11 +448,11 @@ static const struct hc_driver ohci_s3c2410_hc_driver = {
448 */ 448 */
449 .hub_status_data = ohci_s3c2410_hub_status_data, 449 .hub_status_data = ohci_s3c2410_hub_status_data,
450 .hub_control = ohci_s3c2410_hub_control, 450 .hub_control = ohci_s3c2410_hub_control,
451 451#ifdef CONFIG_PM
452#if defined(CONFIG_USB_SUSPEND) && 0 452 .bus_suspend = ohci_bus_suspend,
453 .hub_suspend = ohci_hub_suspend, 453 .bus_resume = ohci_bus_resume,
454 .hub_resume = ohci_hub_resume,
455#endif 454#endif
455 .start_port_reset = ohci_start_port_reset,
456}; 456};
457 457
458/* device driver */ 458/* device driver */
@@ -474,6 +474,7 @@ static int ohci_hcd_s3c2410_drv_remove(struct device *dev)
474 474
475static struct device_driver ohci_hcd_s3c2410_driver = { 475static struct device_driver ohci_hcd_s3c2410_driver = {
476 .name = "s3c2410-ohci", 476 .name = "s3c2410-ohci",
477 .owner = THIS_MODULE,
477 .bus = &platform_bus_type, 478 .bus = &platform_bus_type,
478 .probe = ohci_hcd_s3c2410_drv_probe, 479 .probe = ohci_hcd_s3c2410_drv_probe,
479 .remove = ohci_hcd_s3c2410_drv_remove, 480 .remove = ohci_hcd_s3c2410_drv_remove,
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
index 814d2be4ee7b..fb3221ebbb29 100644
--- a/drivers/usb/host/ohci-sa1111.c
+++ b/drivers/usb/host/ohci-sa1111.c
@@ -235,10 +235,11 @@ static const struct hc_driver ohci_sa1111_hc_driver = {
235 */ 235 */
236 .hub_status_data = ohci_hub_status_data, 236 .hub_status_data = ohci_hub_status_data,
237 .hub_control = ohci_hub_control, 237 .hub_control = ohci_hub_control,
238#ifdef CONFIG_USB_SUSPEND 238#ifdef CONFIG_PM
239 .hub_suspend = ohci_hub_suspend, 239 .bus_suspend = ohci_bus_suspend,
240 .hub_resume = ohci_hub_resume, 240 .bus_resume = ohci_bus_resume,
241#endif 241#endif
242 .start_port_reset = ohci_start_port_reset,
242}; 243};
243 244
244/*-------------------------------------------------------------------------*/ 245/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 8a9b9d9209e9..caacf14371f5 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -389,7 +389,6 @@ struct ohci_hcd {
389 unsigned long next_statechange; /* suspend/resume */ 389 unsigned long next_statechange; /* suspend/resume */
390 u32 fminterval; /* saved register */ 390 u32 fminterval; /* saved register */
391 391
392 struct work_struct rh_resume;
393 struct notifier_block reboot_notifier; 392 struct notifier_block reboot_notifier;
394 393
395 unsigned long flags; /* for HC bugs */ 394 unsigned long flags; /* for HC bugs */
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
new file mode 100644
index 000000000000..b7fd3f644e1e
--- /dev/null
+++ b/drivers/usb/host/pci-quirks.c
@@ -0,0 +1,296 @@
1/*
2 * This file contains code to reset and initialize USB host controllers.
3 * Some of it includes work-arounds for PCI hardware and BIOS quirks.
4 * It may need to run early during booting -- before USB would normally
5 * initialize -- to ensure that Linux doesn't use any legacy modes.
6 *
7 * Copyright (c) 1999 Martin Mares <mj@ucw.cz>
8 * (and others)
9 */
10
11#include <linux/config.h>
12#ifdef CONFIG_USB_DEBUG
13#define DEBUG
14#else
15#undef DEBUG
16#endif
17
18#include <linux/types.h>
19#include <linux/kernel.h>
20#include <linux/pci.h>
21#include <linux/init.h>
22#include <linux/delay.h>
23#include <linux/acpi.h>
24
25
26#define UHCI_USBLEGSUP 0xc0 /* legacy support */
27#define UHCI_USBCMD 0 /* command register */
28#define UHCI_USBINTR 4 /* interrupt register */
29#define UHCI_USBLEGSUP_RWC 0x8f00 /* the R/WC bits */
30#define UHCI_USBLEGSUP_RO 0x5040 /* R/O and reserved bits */
31#define UHCI_USBCMD_RUN 0x0001 /* RUN/STOP bit */
32#define UHCI_USBCMD_HCRESET 0x0002 /* Host Controller reset */
33#define UHCI_USBCMD_EGSM 0x0008 /* Global Suspend Mode */
34#define UHCI_USBCMD_CONFIGURE 0x0040 /* Config Flag */
35#define UHCI_USBINTR_RESUME 0x0002 /* Resume interrupt enable */
36
37#define OHCI_CONTROL 0x04
38#define OHCI_CMDSTATUS 0x08
39#define OHCI_INTRSTATUS 0x0c
40#define OHCI_INTRENABLE 0x10
41#define OHCI_INTRDISABLE 0x14
42#define OHCI_OCR (1 << 3) /* ownership change request */
43#define OHCI_CTRL_RWC (1 << 9) /* remote wakeup connected */
44#define OHCI_CTRL_IR (1 << 8) /* interrupt routing */
45#define OHCI_INTR_OC (1 << 30) /* ownership change */
46
47#define EHCI_HCC_PARAMS 0x08 /* extended capabilities */
48#define EHCI_USBCMD 0 /* command register */
49#define EHCI_USBCMD_RUN (1 << 0) /* RUN/STOP bit */
50#define EHCI_USBSTS 4 /* status register */
51#define EHCI_USBSTS_HALTED (1 << 12) /* HCHalted bit */
52#define EHCI_USBINTR 8 /* interrupt register */
53#define EHCI_USBLEGSUP 0 /* legacy support register */
54#define EHCI_USBLEGSUP_BIOS (1 << 16) /* BIOS semaphore */
55#define EHCI_USBLEGSUP_OS (1 << 24) /* OS semaphore */
56#define EHCI_USBLEGCTLSTS 4 /* legacy control/status */
57#define EHCI_USBLEGCTLSTS_SOOE (1 << 13) /* SMI on ownership change */
58
59
60/*
61 * Make sure the controller is completely inactive, unable to
62 * generate interrupts or do DMA.
63 */
64void uhci_reset_hc(struct pci_dev *pdev, unsigned long base)
65{
66 /* Turn off PIRQ enable and SMI enable. (This also turns off the
67 * BIOS's USB Legacy Support.) Turn off all the R/WC bits too.
68 */
69 pci_write_config_word(pdev, UHCI_USBLEGSUP, UHCI_USBLEGSUP_RWC);
70
71 /* Reset the HC - this will force us to get a
72 * new notification of any already connected
73 * ports due to the virtual disconnect that it
74 * implies.
75 */
76 outw(UHCI_USBCMD_HCRESET, base + UHCI_USBCMD);
77 mb();
78 udelay(5);
79 if (inw(base + UHCI_USBCMD) & UHCI_USBCMD_HCRESET)
80 dev_warn(&pdev->dev, "HCRESET not completed yet!\n");
81
82 /* Just to be safe, disable interrupt requests and
83 * make sure the controller is stopped.
84 */
85 outw(0, base + UHCI_USBINTR);
86 outw(0, base + UHCI_USBCMD);
87}
88EXPORT_SYMBOL_GPL(uhci_reset_hc);
89
90/*
91 * Initialize a controller that was newly discovered or has just been
92 * resumed. In either case we can't be sure of its previous state.
93 *
94 * Returns: 1 if the controller was reset, 0 otherwise.
95 */
96int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base)
97{
98 u16 legsup;
99 unsigned int cmd, intr;
100
101 /*
102 * When restarting a suspended controller, we expect all the
103 * settings to be the same as we left them:
104 *
105 * PIRQ and SMI disabled, no R/W bits set in USBLEGSUP;
106 * Controller is stopped and configured with EGSM set;
107 * No interrupts enabled except possibly Resume Detect.
108 *
109 * If any of these conditions are violated we do a complete reset.
110 */
111 pci_read_config_word(pdev, UHCI_USBLEGSUP, &legsup);
112 if (legsup & ~(UHCI_USBLEGSUP_RO | UHCI_USBLEGSUP_RWC)) {
113 dev_dbg(&pdev->dev, "%s: legsup = 0x%04x\n",
114 __FUNCTION__, legsup);
115 goto reset_needed;
116 }
117
118 cmd = inw(base + UHCI_USBCMD);
119 if ((cmd & UHCI_USBCMD_RUN) || !(cmd & UHCI_USBCMD_CONFIGURE) ||
120 !(cmd & UHCI_USBCMD_EGSM)) {
121 dev_dbg(&pdev->dev, "%s: cmd = 0x%04x\n",
122 __FUNCTION__, cmd);
123 goto reset_needed;
124 }
125
126 intr = inw(base + UHCI_USBINTR);
127 if (intr & (~UHCI_USBINTR_RESUME)) {
128 dev_dbg(&pdev->dev, "%s: intr = 0x%04x\n",
129 __FUNCTION__, intr);
130 goto reset_needed;
131 }
132 return 0;
133
134reset_needed:
135 dev_dbg(&pdev->dev, "Performing full reset\n");
136 uhci_reset_hc(pdev, base);
137 return 1;
138}
139EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc);
140
141static void __devinit quirk_usb_handoff_uhci(struct pci_dev *pdev)
142{
143 unsigned long base = 0;
144 int i;
145
146 for (i = 0; i < PCI_ROM_RESOURCE; i++)
147 if ((pci_resource_flags(pdev, i) & IORESOURCE_IO)) {
148 base = pci_resource_start(pdev, i);
149 break;
150 }
151
152 if (base)
153 uhci_check_and_reset_hc(pdev, base);
154}
155
156static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev)
157{
158 void __iomem *base;
159 int wait_time;
160 u32 control;
161
162 base = ioremap_nocache(pci_resource_start(pdev, 0),
163 pci_resource_len(pdev, 0));
164 if (base == NULL) return;
165
166/* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */
167#ifndef __hppa__
168 control = readl(base + OHCI_CONTROL);
169 if (control & OHCI_CTRL_IR) {
170 wait_time = 500; /* arbitrary; 5 seconds */
171 writel(OHCI_INTR_OC, base + OHCI_INTRENABLE);
172 writel(OHCI_OCR, base + OHCI_CMDSTATUS);
173 while (wait_time > 0 &&
174 readl(base + OHCI_CONTROL) & OHCI_CTRL_IR) {
175 wait_time -= 10;
176 msleep(10);
177 }
178 if (wait_time <= 0)
179 printk(KERN_WARNING "%s %s: early BIOS handoff "
180 "failed (BIOS bug ?)\n",
181 pdev->dev.bus_id, "OHCI");
182
183 /* reset controller, preserving RWC */
184 writel(control & OHCI_CTRL_RWC, base + OHCI_CONTROL);
185 }
186#endif
187
188 /*
189 * disable interrupts
190 */
191 writel(~(u32)0, base + OHCI_INTRDISABLE);
192 writel(~(u32)0, base + OHCI_INTRSTATUS);
193
194 iounmap(base);
195}
196
197static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
198{
199 int wait_time, delta;
200 void __iomem *base, *op_reg_base;
201 u32 hcc_params, val, temp;
202 u8 cap_length;
203
204 base = ioremap_nocache(pci_resource_start(pdev, 0),
205 pci_resource_len(pdev, 0));
206 if (base == NULL) return;
207
208 cap_length = readb(base);
209 op_reg_base = base + cap_length;
210 hcc_params = readl(base + EHCI_HCC_PARAMS);
211 hcc_params = (hcc_params >> 8) & 0xff;
212 if (hcc_params) {
213 pci_read_config_dword(pdev,
214 hcc_params + EHCI_USBLEGSUP,
215 &val);
216 if (((val & 0xff) == 1) && (val & EHCI_USBLEGSUP_BIOS)) {
217 /*
218 * Ok, BIOS is in smm mode, try to hand off...
219 */
220 pci_read_config_dword(pdev,
221 hcc_params + EHCI_USBLEGCTLSTS,
222 &temp);
223 pci_write_config_dword(pdev,
224 hcc_params + EHCI_USBLEGCTLSTS,
225 temp | EHCI_USBLEGCTLSTS_SOOE);
226 val |= EHCI_USBLEGSUP_OS;
227 pci_write_config_dword(pdev,
228 hcc_params + EHCI_USBLEGSUP,
229 val);
230
231 wait_time = 500;
232 do {
233 msleep(10);
234 wait_time -= 10;
235 pci_read_config_dword(pdev,
236 hcc_params + EHCI_USBLEGSUP,
237 &val);
238 } while (wait_time && (val & EHCI_USBLEGSUP_BIOS));
239 if (!wait_time) {
240 /*
241 * well, possibly buggy BIOS...
242 */
243 printk(KERN_WARNING "%s %s: early BIOS handoff "
244 "failed (BIOS bug ?)\n",
245 pdev->dev.bus_id, "EHCI");
246 pci_write_config_dword(pdev,
247 hcc_params + EHCI_USBLEGSUP,
248 EHCI_USBLEGSUP_OS);
249 pci_write_config_dword(pdev,
250 hcc_params + EHCI_USBLEGCTLSTS,
251 0);
252 }
253 }
254 }
255
256 /*
257 * halt EHCI & disable its interrupts in any case
258 */
259 val = readl(op_reg_base + EHCI_USBSTS);
260 if ((val & EHCI_USBSTS_HALTED) == 0) {
261 val = readl(op_reg_base + EHCI_USBCMD);
262 val &= ~EHCI_USBCMD_RUN;
263 writel(val, op_reg_base + EHCI_USBCMD);
264
265 wait_time = 2000;
266 delta = 100;
267 do {
268 writel(0x3f, op_reg_base + EHCI_USBSTS);
269 udelay(delta);
270 wait_time -= delta;
271 val = readl(op_reg_base + EHCI_USBSTS);
272 if ((val == ~(u32)0) || (val & EHCI_USBSTS_HALTED)) {
273 break;
274 }
275 } while (wait_time > 0);
276 }
277 writel(0, op_reg_base + EHCI_USBINTR);
278 writel(0x3f, op_reg_base + EHCI_USBSTS);
279
280 iounmap(base);
281
282 return;
283}
284
285
286
287static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev)
288{
289 if (pdev->class == PCI_CLASS_SERIAL_USB_UHCI)
290 quirk_usb_handoff_uhci(pdev);
291 else if (pdev->class == PCI_CLASS_SERIAL_USB_OHCI)
292 quirk_usb_handoff_ohci(pdev);
293 else if (pdev->class == PCI_CLASS_SERIAL_USB_EHCI)
294 quirk_usb_disable_ehci(pdev);
295}
296DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff);
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index b5e7a478bc01..40169d9cf2b1 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1363,7 +1363,7 @@ error:
1363#ifdef CONFIG_PM 1363#ifdef CONFIG_PM
1364 1364
1365static int 1365static int
1366sl811h_hub_suspend(struct usb_hcd *hcd) 1366sl811h_bus_suspend(struct usb_hcd *hcd)
1367{ 1367{
1368 // SOFs off 1368 // SOFs off
1369 DBG("%s\n", __FUNCTION__); 1369 DBG("%s\n", __FUNCTION__);
@@ -1371,7 +1371,7 @@ sl811h_hub_suspend(struct usb_hcd *hcd)
1371} 1371}
1372 1372
1373static int 1373static int
1374sl811h_hub_resume(struct usb_hcd *hcd) 1374sl811h_bus_resume(struct usb_hcd *hcd)
1375{ 1375{
1376 // SOFs on 1376 // SOFs on
1377 DBG("%s\n", __FUNCTION__); 1377 DBG("%s\n", __FUNCTION__);
@@ -1380,8 +1380,8 @@ sl811h_hub_resume(struct usb_hcd *hcd)
1380 1380
1381#else 1381#else
1382 1382
1383#define sl811h_hub_suspend NULL 1383#define sl811h_bus_suspend NULL
1384#define sl811h_hub_resume NULL 1384#define sl811h_bus_resume NULL
1385 1385
1386#endif 1386#endif
1387 1387
@@ -1623,8 +1623,8 @@ static struct hc_driver sl811h_hc_driver = {
1623 */ 1623 */
1624 .hub_status_data = sl811h_hub_status_data, 1624 .hub_status_data = sl811h_hub_status_data,
1625 .hub_control = sl811h_hub_control, 1625 .hub_control = sl811h_hub_control,
1626 .hub_suspend = sl811h_hub_suspend, 1626 .bus_suspend = sl811h_bus_suspend,
1627 .hub_resume = sl811h_hub_resume, 1627 .bus_resume = sl811h_bus_resume,
1628}; 1628};
1629 1629
1630/*-------------------------------------------------------------------------*/ 1630/*-------------------------------------------------------------------------*/
@@ -1791,7 +1791,7 @@ sl811h_suspend(struct device *dev, pm_message_t state)
1791 int retval = 0; 1791 int retval = 0;
1792 1792
1793 if (state.event == PM_EVENT_FREEZE) 1793 if (state.event == PM_EVENT_FREEZE)
1794 retval = sl811h_hub_suspend(hcd); 1794 retval = sl811h_bus_suspend(hcd);
1795 else if (state.event == PM_EVENT_SUSPEND) 1795 else if (state.event == PM_EVENT_SUSPEND)
1796 port_power(sl811, 0); 1796 port_power(sl811, 0);
1797 if (retval == 0) 1797 if (retval == 0)
@@ -1816,7 +1816,7 @@ sl811h_resume(struct device *dev)
1816 } 1816 }
1817 1817
1818 dev->power.power_state = PMSG_ON; 1818 dev->power.power_state = PMSG_ON;
1819 return sl811h_hub_resume(hcd); 1819 return sl811h_bus_resume(hcd);
1820} 1820}
1821 1821
1822#else 1822#else
@@ -1831,6 +1831,7 @@ sl811h_resume(struct device *dev)
1831struct device_driver sl811h_driver = { 1831struct device_driver sl811h_driver = {
1832 .name = (char *) hcd_name, 1832 .name = (char *) hcd_name,
1833 .bus = &platform_bus_type, 1833 .bus = &platform_bus_type,
1834 .owner = THIS_MODULE,
1834 1835
1835 .probe = sl811h_probe, 1836 .probe = sl811h_probe,
1836 .remove = __devexit_p(sl811h_remove), 1837 .remove = __devexit_p(sl811h_remove),
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
index 4538a98b6f9d..151154df37fa 100644
--- a/drivers/usb/host/uhci-debug.c
+++ b/drivers/usb/host/uhci-debug.c
@@ -348,7 +348,6 @@ static int uhci_show_urbp(struct uhci_hcd *uhci, struct urb_priv *urbp, char *bu
348 348
349 if (urbp->urb->status != -EINPROGRESS) 349 if (urbp->urb->status != -EINPROGRESS)
350 out += sprintf(out, "Status=%d ", urbp->urb->status); 350 out += sprintf(out, "Status=%d ", urbp->urb->status);
351 //out += sprintf(out, "Inserttime=%lx ",urbp->inserttime);
352 //out += sprintf(out, "FSBRtime=%lx ",urbp->fsbrtime); 351 //out += sprintf(out, "FSBRtime=%lx ",urbp->fsbrtime);
353 352
354 count = 0; 353 count = 0;
@@ -446,11 +445,11 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len)
446 out += sprintf(out, "Frame List\n"); 445 out += sprintf(out, "Frame List\n");
447 for (i = 0; i < UHCI_NUMFRAMES; ++i) { 446 for (i = 0; i < UHCI_NUMFRAMES; ++i) {
448 int shown = 0; 447 int shown = 0;
449 td = uhci->fl->frame_cpu[i]; 448 td = uhci->frame_cpu[i];
450 if (!td) 449 if (!td)
451 continue; 450 continue;
452 451
453 if (td->dma_handle != (dma_addr_t)uhci->fl->frame[i]) { 452 if (td->dma_handle != (dma_addr_t)uhci->frame[i]) {
454 show_frame_num(); 453 show_frame_num();
455 out += sprintf(out, " frame list does not match td->dma_handle!\n"); 454 out += sprintf(out, " frame list does not match td->dma_handle!\n");
456 } 455 }
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 0c024898cbea..15e0a511069b 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -101,37 +101,16 @@ static void uhci_get_current_frame_number(struct uhci_hcd *uhci);
101#include "uhci-q.c" 101#include "uhci-q.c"
102#include "uhci-hub.c" 102#include "uhci-hub.c"
103 103
104extern void uhci_reset_hc(struct pci_dev *pdev, unsigned long base);
105extern int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base);
106
104/* 107/*
105 * Make sure the controller is completely inactive, unable to 108 * Finish up a host controller reset and update the recorded state.
106 * generate interrupts or do DMA.
107 */ 109 */
108static void reset_hc(struct uhci_hcd *uhci) 110static void finish_reset(struct uhci_hcd *uhci)
109{ 111{
110 int port; 112 int port;
111 113
112 /* Turn off PIRQ enable and SMI enable. (This also turns off the
113 * BIOS's USB Legacy Support.) Turn off all the R/WC bits too.
114 */
115 pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP,
116 USBLEGSUP_RWC);
117
118 /* Reset the HC - this will force us to get a
119 * new notification of any already connected
120 * ports due to the virtual disconnect that it
121 * implies.
122 */
123 outw(USBCMD_HCRESET, uhci->io_addr + USBCMD);
124 mb();
125 udelay(5);
126 if (inw(uhci->io_addr + USBCMD) & USBCMD_HCRESET)
127 dev_warn(uhci_dev(uhci), "HCRESET not completed yet!\n");
128
129 /* Just to be safe, disable interrupt requests and
130 * make sure the controller is stopped.
131 */
132 outw(0, uhci->io_addr + USBINTR);
133 outw(0, uhci->io_addr + USBCMD);
134
135 /* HCRESET doesn't affect the Suspend, Reset, and Resume Detect 114 /* HCRESET doesn't affect the Suspend, Reset, and Resume Detect
136 * bits in the port status and control registers. 115 * bits in the port status and control registers.
137 * We have to clear them by hand. 116 * We have to clear them by hand.
@@ -153,7 +132,8 @@ static void reset_hc(struct uhci_hcd *uhci)
153 */ 132 */
154static void hc_died(struct uhci_hcd *uhci) 133static void hc_died(struct uhci_hcd *uhci)
155{ 134{
156 reset_hc(uhci); 135 uhci_reset_hc(to_pci_dev(uhci_dev(uhci)), uhci->io_addr);
136 finish_reset(uhci);
157 uhci->hc_inaccessible = 1; 137 uhci->hc_inaccessible = 1;
158} 138}
159 139
@@ -163,44 +143,8 @@ static void hc_died(struct uhci_hcd *uhci)
163 */ 143 */
164static void check_and_reset_hc(struct uhci_hcd *uhci) 144static void check_and_reset_hc(struct uhci_hcd *uhci)
165{ 145{
166 u16 legsup; 146 if (uhci_check_and_reset_hc(to_pci_dev(uhci_dev(uhci)), uhci->io_addr))
167 unsigned int cmd, intr; 147 finish_reset(uhci);
168
169 /*
170 * When restarting a suspended controller, we expect all the
171 * settings to be the same as we left them:
172 *
173 * PIRQ and SMI disabled, no R/W bits set in USBLEGSUP;
174 * Controller is stopped and configured with EGSM set;
175 * No interrupts enabled except possibly Resume Detect.
176 *
177 * If any of these conditions are violated we do a complete reset.
178 */
179 pci_read_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, &legsup);
180 if (legsup & ~(USBLEGSUP_RO | USBLEGSUP_RWC)) {
181 dev_dbg(uhci_dev(uhci), "%s: legsup = 0x%04x\n",
182 __FUNCTION__, legsup);
183 goto reset_needed;
184 }
185
186 cmd = inw(uhci->io_addr + USBCMD);
187 if ((cmd & USBCMD_RS) || !(cmd & USBCMD_CF) || !(cmd & USBCMD_EGSM)) {
188 dev_dbg(uhci_dev(uhci), "%s: cmd = 0x%04x\n",
189 __FUNCTION__, cmd);
190 goto reset_needed;
191 }
192
193 intr = inw(uhci->io_addr + USBINTR);
194 if (intr & (~USBINTR_RESUME)) {
195 dev_dbg(uhci_dev(uhci), "%s: intr = 0x%04x\n",
196 __FUNCTION__, intr);
197 goto reset_needed;
198 }
199 return;
200
201reset_needed:
202 dev_dbg(uhci_dev(uhci), "Performing full reset\n");
203 reset_hc(uhci);
204} 148}
205 149
206/* 150/*
@@ -212,13 +156,13 @@ static void configure_hc(struct uhci_hcd *uhci)
212 outb(USBSOF_DEFAULT, uhci->io_addr + USBSOF); 156 outb(USBSOF_DEFAULT, uhci->io_addr + USBSOF);
213 157
214 /* Store the frame list base address */ 158 /* Store the frame list base address */
215 outl(uhci->fl->dma_handle, uhci->io_addr + USBFLBASEADD); 159 outl(uhci->frame_dma_handle, uhci->io_addr + USBFLBASEADD);
216 160
217 /* Set the current frame number */ 161 /* Set the current frame number */
218 outw(uhci->frame_number, uhci->io_addr + USBFRNUM); 162 outw(uhci->frame_number, uhci->io_addr + USBFRNUM);
219 163
220 /* Mark controller as running before we enable interrupts */ 164 /* Mark controller as not halted before we enable interrupts */
221 uhci_to_hcd(uhci)->state = HC_STATE_RUNNING; 165 uhci_to_hcd(uhci)->state = HC_STATE_SUSPENDED;
222 mb(); 166 mb();
223 167
224 /* Enable PIRQ */ 168 /* Enable PIRQ */
@@ -319,6 +263,7 @@ __acquires(uhci->lock)
319 263
320static void start_rh(struct uhci_hcd *uhci) 264static void start_rh(struct uhci_hcd *uhci)
321{ 265{
266 uhci_to_hcd(uhci)->state = HC_STATE_RUNNING;
322 uhci->is_stopped = 0; 267 uhci->is_stopped = 0;
323 smp_wmb(); 268 smp_wmb();
324 269
@@ -437,36 +382,21 @@ static void release_uhci(struct uhci_hcd *uhci)
437 int i; 382 int i;
438 383
439 for (i = 0; i < UHCI_NUM_SKELQH; i++) 384 for (i = 0; i < UHCI_NUM_SKELQH; i++)
440 if (uhci->skelqh[i]) { 385 uhci_free_qh(uhci, uhci->skelqh[i]);
441 uhci_free_qh(uhci, uhci->skelqh[i]);
442 uhci->skelqh[i] = NULL;
443 }
444 386
445 if (uhci->term_td) { 387 uhci_free_td(uhci, uhci->term_td);
446 uhci_free_td(uhci, uhci->term_td);
447 uhci->term_td = NULL;
448 }
449 388
450 if (uhci->qh_pool) { 389 dma_pool_destroy(uhci->qh_pool);
451 dma_pool_destroy(uhci->qh_pool);
452 uhci->qh_pool = NULL;
453 }
454 390
455 if (uhci->td_pool) { 391 dma_pool_destroy(uhci->td_pool);
456 dma_pool_destroy(uhci->td_pool);
457 uhci->td_pool = NULL;
458 }
459 392
460 if (uhci->fl) { 393 kfree(uhci->frame_cpu);
461 dma_free_coherent(uhci_dev(uhci), sizeof(*uhci->fl),
462 uhci->fl, uhci->fl->dma_handle);
463 uhci->fl = NULL;
464 }
465 394
466 if (uhci->dentry) { 395 dma_free_coherent(uhci_dev(uhci),
467 debugfs_remove(uhci->dentry); 396 UHCI_NUMFRAMES * sizeof(*uhci->frame),
468 uhci->dentry = NULL; 397 uhci->frame, uhci->frame_dma_handle);
469 } 398
399 debugfs_remove(uhci->dentry);
470} 400}
471 401
472static int uhci_reset(struct usb_hcd *hcd) 402static int uhci_reset(struct usb_hcd *hcd)
@@ -545,7 +475,6 @@ static int uhci_start(struct usb_hcd *hcd)
545 struct uhci_hcd *uhci = hcd_to_uhci(hcd); 475 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
546 int retval = -EBUSY; 476 int retval = -EBUSY;
547 int i; 477 int i;
548 dma_addr_t dma_handle;
549 struct dentry *dentry; 478 struct dentry *dentry;
550 479
551 hcd->uses_new_polling = 1; 480 hcd->uses_new_polling = 1;
@@ -579,17 +508,23 @@ static int uhci_start(struct usb_hcd *hcd)
579 508
580 init_waitqueue_head(&uhci->waitqh); 509 init_waitqueue_head(&uhci->waitqh);
581 510
582 uhci->fl = dma_alloc_coherent(uhci_dev(uhci), sizeof(*uhci->fl), 511 uhci->frame = dma_alloc_coherent(uhci_dev(uhci),
583 &dma_handle, 0); 512 UHCI_NUMFRAMES * sizeof(*uhci->frame),
584 if (!uhci->fl) { 513 &uhci->frame_dma_handle, 0);
514 if (!uhci->frame) {
585 dev_err(uhci_dev(uhci), "unable to allocate " 515 dev_err(uhci_dev(uhci), "unable to allocate "
586 "consistent memory for frame list\n"); 516 "consistent memory for frame list\n");
587 goto err_alloc_fl; 517 goto err_alloc_frame;
588 } 518 }
519 memset(uhci->frame, 0, UHCI_NUMFRAMES * sizeof(*uhci->frame));
589 520
590 memset((void *)uhci->fl, 0, sizeof(*uhci->fl)); 521 uhci->frame_cpu = kcalloc(UHCI_NUMFRAMES, sizeof(*uhci->frame_cpu),
591 522 GFP_KERNEL);
592 uhci->fl->dma_handle = dma_handle; 523 if (!uhci->frame_cpu) {
524 dev_err(uhci_dev(uhci), "unable to allocate "
525 "memory for frame pointers\n");
526 goto err_alloc_frame_cpu;
527 }
593 528
594 uhci->td_pool = dma_pool_create("uhci_td", uhci_dev(uhci), 529 uhci->td_pool = dma_pool_create("uhci_td", uhci_dev(uhci),
595 sizeof(struct uhci_td), 16, 0); 530 sizeof(struct uhci_td), 16, 0);
@@ -672,7 +607,7 @@ static int uhci_start(struct usb_hcd *hcd)
672 irq = 7; 607 irq = 7;
673 608
674 /* Only place we don't use the frame list routines */ 609 /* Only place we don't use the frame list routines */
675 uhci->fl->frame[i] = UHCI_PTR_QH | 610 uhci->frame[i] = UHCI_PTR_QH |
676 cpu_to_le32(uhci->skelqh[irq]->dma_handle); 611 cpu_to_le32(uhci->skelqh[irq]->dma_handle);
677 } 612 }
678 613
@@ -690,31 +625,29 @@ static int uhci_start(struct usb_hcd *hcd)
690 * error exits: 625 * error exits:
691 */ 626 */
692err_alloc_skelqh: 627err_alloc_skelqh:
693 for (i = 0; i < UHCI_NUM_SKELQH; i++) 628 for (i = 0; i < UHCI_NUM_SKELQH; i++) {
694 if (uhci->skelqh[i]) { 629 if (uhci->skelqh[i])
695 uhci_free_qh(uhci, uhci->skelqh[i]); 630 uhci_free_qh(uhci, uhci->skelqh[i]);
696 uhci->skelqh[i] = NULL; 631 }
697 }
698 632
699 uhci_free_td(uhci, uhci->term_td); 633 uhci_free_td(uhci, uhci->term_td);
700 uhci->term_td = NULL;
701 634
702err_alloc_term_td: 635err_alloc_term_td:
703 dma_pool_destroy(uhci->qh_pool); 636 dma_pool_destroy(uhci->qh_pool);
704 uhci->qh_pool = NULL;
705 637
706err_create_qh_pool: 638err_create_qh_pool:
707 dma_pool_destroy(uhci->td_pool); 639 dma_pool_destroy(uhci->td_pool);
708 uhci->td_pool = NULL;
709 640
710err_create_td_pool: 641err_create_td_pool:
711 dma_free_coherent(uhci_dev(uhci), sizeof(*uhci->fl), 642 kfree(uhci->frame_cpu);
712 uhci->fl, uhci->fl->dma_handle); 643
713 uhci->fl = NULL; 644err_alloc_frame_cpu:
645 dma_free_coherent(uhci_dev(uhci),
646 UHCI_NUMFRAMES * sizeof(*uhci->frame),
647 uhci->frame, uhci->frame_dma_handle);
714 648
715err_alloc_fl: 649err_alloc_frame:
716 debugfs_remove(uhci->dentry); 650 debugfs_remove(uhci->dentry);
717 uhci->dentry = NULL;
718 651
719err_create_debug_entry: 652err_create_debug_entry:
720 return retval; 653 return retval;
@@ -726,7 +659,7 @@ static void uhci_stop(struct usb_hcd *hcd)
726 659
727 spin_lock_irq(&uhci->lock); 660 spin_lock_irq(&uhci->lock);
728 if (!uhci->hc_inaccessible) 661 if (!uhci->hc_inaccessible)
729 reset_hc(uhci); 662 hc_died(uhci);
730 uhci_scan_schedule(uhci, NULL); 663 uhci_scan_schedule(uhci, NULL);
731 spin_unlock_irq(&uhci->lock); 664 spin_unlock_irq(&uhci->lock);
732 665
@@ -774,14 +707,8 @@ static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message)
774 if (uhci->hc_inaccessible) /* Dead or already suspended */ 707 if (uhci->hc_inaccessible) /* Dead or already suspended */
775 goto done; 708 goto done;
776 709
777#ifndef CONFIG_USB_SUSPEND
778 /* Otherwise this would never happen */
779 suspend_rh(uhci, UHCI_RH_SUSPENDED);
780#endif
781
782 if (uhci->rh_state > UHCI_RH_SUSPENDED) { 710 if (uhci->rh_state > UHCI_RH_SUSPENDED) {
783 dev_warn(uhci_dev(uhci), "Root hub isn't suspended!\n"); 711 dev_warn(uhci_dev(uhci), "Root hub isn't suspended!\n");
784 hcd->state = HC_STATE_RUNNING;
785 rc = -EBUSY; 712 rc = -EBUSY;
786 goto done; 713 goto done;
787 }; 714 };
@@ -820,10 +747,6 @@ static int uhci_resume(struct usb_hcd *hcd)
820 check_and_reset_hc(uhci); 747 check_and_reset_hc(uhci);
821 configure_hc(uhci); 748 configure_hc(uhci);
822 749
823#ifndef CONFIG_USB_SUSPEND
824 /* Otherwise this would never happen */
825 wakeup_rh(uhci);
826#endif
827 if (uhci->rh_state == UHCI_RH_RESET) 750 if (uhci->rh_state == UHCI_RH_RESET)
828 suspend_rh(uhci, UHCI_RH_SUSPENDED); 751 suspend_rh(uhci, UHCI_RH_SUSPENDED);
829 752
@@ -881,8 +804,8 @@ static const struct hc_driver uhci_driver = {
881#ifdef CONFIG_PM 804#ifdef CONFIG_PM
882 .suspend = uhci_suspend, 805 .suspend = uhci_suspend,
883 .resume = uhci_resume, 806 .resume = uhci_resume,
884 .hub_suspend = uhci_rh_suspend, 807 .bus_suspend = uhci_rh_suspend,
885 .hub_resume = uhci_rh_resume, 808 .bus_resume = uhci_rh_resume,
886#endif 809#endif
887 .stop = uhci_stop, 810 .stop = uhci_stop,
888 811
@@ -908,6 +831,7 @@ MODULE_DEVICE_TABLE(pci, uhci_pci_ids);
908static struct pci_driver uhci_pci_driver = { 831static struct pci_driver uhci_pci_driver = {
909 .name = (char *)hcd_name, 832 .name = (char *)hcd_name,
910 .id_table = uhci_pci_ids, 833 .id_table = uhci_pci_ids,
834 .owner = THIS_MODULE,
911 835
912 .probe = usb_hcd_pci_probe, 836 .probe = usb_hcd_pci_probe,
913 .remove = usb_hcd_pci_remove, 837 .remove = usb_hcd_pci_remove,
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
index 282f40b75881..e576db57a926 100644
--- a/drivers/usb/host/uhci-hcd.h
+++ b/drivers/usb/host/uhci-hcd.h
@@ -7,6 +7,7 @@
7#define usb_packetid(pipe) (usb_pipein(pipe) ? USB_PID_IN : USB_PID_OUT) 7#define usb_packetid(pipe) (usb_pipein(pipe) ? USB_PID_IN : USB_PID_OUT)
8#define PIPE_DEVEP_MASK 0x0007ff00 8#define PIPE_DEVEP_MASK 0x0007ff00
9 9
10
10/* 11/*
11 * Universal Host Controller Interface data structures and defines 12 * Universal Host Controller Interface data structures and defines
12 */ 13 */
@@ -82,15 +83,10 @@
82#define UHCI_MAX_SOF_NUMBER 2047 /* in an SOF packet */ 83#define UHCI_MAX_SOF_NUMBER 2047 /* in an SOF packet */
83#define CAN_SCHEDULE_FRAMES 1000 /* how far future frames can be scheduled */ 84#define CAN_SCHEDULE_FRAMES 1000 /* how far future frames can be scheduled */
84 85
85struct uhci_frame_list {
86 __le32 frame[UHCI_NUMFRAMES];
87
88 void *frame_cpu[UHCI_NUMFRAMES];
89
90 dma_addr_t dma_handle;
91};
92 86
93struct urb_priv; 87/*
88 * Queue Headers
89 */
94 90
95/* 91/*
96 * One role of a QH is to hold a queue of TDs for some endpoint. Each QH is 92 * One role of a QH is to hold a queue of TDs for some endpoint. Each QH is
@@ -116,13 +112,13 @@ struct uhci_qh {
116 112
117 struct urb_priv *urbp; 113 struct urb_priv *urbp;
118 114
119 struct list_head list; /* P: uhci->frame_list_lock */ 115 struct list_head list;
120 struct list_head remove_list; /* P: uhci->remove_list_lock */ 116 struct list_head remove_list;
121} __attribute__((aligned(16))); 117} __attribute__((aligned(16)));
122 118
123/* 119/*
124 * We need a special accessor for the element pointer because it is 120 * We need a special accessor for the element pointer because it is
125 * subject to asynchronous updates by the controller 121 * subject to asynchronous updates by the controller.
126 */ 122 */
127static __le32 inline qh_element(struct uhci_qh *qh) { 123static __le32 inline qh_element(struct uhci_qh *qh) {
128 __le32 element = qh->element; 124 __le32 element = qh->element;
@@ -131,6 +127,11 @@ static __le32 inline qh_element(struct uhci_qh *qh) {
131 return element; 127 return element;
132} 128}
133 129
130
131/*
132 * Transfer Descriptors
133 */
134
134/* 135/*
135 * for TD <status>: 136 * for TD <status>:
136 */ 137 */
@@ -183,17 +184,10 @@ static __le32 inline qh_element(struct uhci_qh *qh) {
183 * 184 *
184 * That's silly, the hardware doesn't care. The hardware only cares that 185 * That's silly, the hardware doesn't care. The hardware only cares that
185 * the hardware words are 16-byte aligned, and we can have any amount of 186 * the hardware words are 16-byte aligned, and we can have any amount of
186 * sw space after the TD entry as far as I can tell. 187 * sw space after the TD entry.
187 *
188 * But let's just go with the documentation, at least for 32-bit machines.
189 * On 64-bit machines we probably want to take advantage of the fact that
190 * hw doesn't really care about the size of the sw-only area.
191 *
192 * Alas, not anymore, we have more than 4 words for software, woops.
193 * Everything still works tho, surprise! -jerdfelt
194 * 188 *
195 * td->link points to either another TD (not necessarily for the same urb or 189 * td->link points to either another TD (not necessarily for the same urb or
196 * even the same endpoint), or nothing (PTR_TERM), or a QH (for queued urbs) 190 * even the same endpoint), or nothing (PTR_TERM), or a QH (for queued urbs).
197 */ 191 */
198struct uhci_td { 192struct uhci_td {
199 /* Hardware fields */ 193 /* Hardware fields */
@@ -205,18 +199,16 @@ struct uhci_td {
205 /* Software fields */ 199 /* Software fields */
206 dma_addr_t dma_handle; 200 dma_addr_t dma_handle;
207 201
208 struct urb *urb; 202 struct list_head list;
209 203 struct list_head remove_list;
210 struct list_head list; /* P: urb->lock */
211 struct list_head remove_list; /* P: uhci->td_remove_list_lock */
212 204
213 int frame; /* for iso: what frame? */ 205 int frame; /* for iso: what frame? */
214 struct list_head fl_list; /* P: uhci->frame_list_lock */ 206 struct list_head fl_list;
215} __attribute__((aligned(16))); 207} __attribute__((aligned(16)));
216 208
217/* 209/*
218 * We need a special accessor for the control/status word because it is 210 * We need a special accessor for the control/status word because it is
219 * subject to asynchronous updates by the controller 211 * subject to asynchronous updates by the controller.
220 */ 212 */
221static u32 inline td_status(struct uhci_td *td) { 213static u32 inline td_status(struct uhci_td *td) {
222 __le32 status = td->status; 214 __le32 status = td->status;
@@ -227,6 +219,10 @@ static u32 inline td_status(struct uhci_td *td) {
227 219
228 220
229/* 221/*
222 * Skeleton Queue Headers
223 */
224
225/*
230 * The UHCI driver places Interrupt, Control and Bulk into QH's both 226 * The UHCI driver places Interrupt, Control and Bulk into QH's both
231 * to group together TD's for one transfer, and also to faciliate queuing 227 * to group together TD's for one transfer, and also to faciliate queuing
232 * of URB's. To make it easy to insert entries into the schedule, we have 228 * of URB's. To make it easy to insert entries into the schedule, we have
@@ -256,15 +252,15 @@ static u32 inline td_status(struct uhci_td *td) {
256 * 252 *
257 * The terminating QH is used for 2 reasons: 253 * The terminating QH is used for 2 reasons:
258 * - To place a terminating TD which is used to workaround a PIIX bug 254 * - To place a terminating TD which is used to workaround a PIIX bug
259 * (see Intel errata for explanation) 255 * (see Intel errata for explanation), and
260 * - To loop back to the full-speed control queue for full-speed bandwidth 256 * - To loop back to the full-speed control queue for full-speed bandwidth
261 * reclamation 257 * reclamation.
262 * 258 *
263 * Isochronous transfers are stored before the start of the skeleton 259 * Isochronous transfers are stored before the start of the skeleton
264 * schedule and don't use QH's. While the UHCI spec doesn't forbid the 260 * schedule and don't use QH's. While the UHCI spec doesn't forbid the
265 * use of QH's for Isochronous, it doesn't use them either. Since we don't 261 * use of QH's for Isochronous, it doesn't use them either. And the spec
266 * need to use them either, we follow the spec diagrams in hope that it'll 262 * says that queues never advance on an error completion status, which
267 * be more compatible with future UHCI implementations. 263 * makes them totally unsuitable for Isochronous transfers.
268 */ 264 */
269 265
270#define UHCI_NUM_SKELQH 12 266#define UHCI_NUM_SKELQH 12
@@ -314,8 +310,13 @@ static inline int __interval_to_skel(int interval)
314 return 0; /* int128 for 128-255 ms (Max.) */ 310 return 0; /* int128 for 128-255 ms (Max.) */
315} 311}
316 312
313
314/*
315 * The UHCI controller and root hub
316 */
317
317/* 318/*
318 * States for the root hub. 319 * States for the root hub:
319 * 320 *
320 * To prevent "bouncing" in the presence of electrical noise, 321 * To prevent "bouncing" in the presence of electrical noise,
321 * when there are no devices attached we delay for 1 second in the 322 * when there are no devices attached we delay for 1 second in the
@@ -326,7 +327,7 @@ static inline int __interval_to_skel(int interval)
326 */ 327 */
327enum uhci_rh_state { 328enum uhci_rh_state {
328 /* In the following states the HC must be halted. 329 /* In the following states the HC must be halted.
329 * These two must come first */ 330 * These two must come first. */
330 UHCI_RH_RESET, 331 UHCI_RH_RESET,
331 UHCI_RH_SUSPENDED, 332 UHCI_RH_SUSPENDED,
332 333
@@ -338,13 +339,13 @@ enum uhci_rh_state {
338 UHCI_RH_SUSPENDING, 339 UHCI_RH_SUSPENDING,
339 340
340 /* In the following states it's an error if the HC is halted. 341 /* In the following states it's an error if the HC is halted.
341 * These two must come last */ 342 * These two must come last. */
342 UHCI_RH_RUNNING, /* The normal state */ 343 UHCI_RH_RUNNING, /* The normal state */
343 UHCI_RH_RUNNING_NODEVS, /* Running with no devices attached */ 344 UHCI_RH_RUNNING_NODEVS, /* Running with no devices attached */
344}; 345};
345 346
346/* 347/*
347 * This describes the full uhci information. 348 * The full UHCI controller information:
348 */ 349 */
349struct uhci_hcd { 350struct uhci_hcd {
350 351
@@ -361,7 +362,11 @@ struct uhci_hcd {
361 struct uhci_qh *skelqh[UHCI_NUM_SKELQH]; /* Skeleton QH's */ 362 struct uhci_qh *skelqh[UHCI_NUM_SKELQH]; /* Skeleton QH's */
362 363
363 spinlock_t lock; 364 spinlock_t lock;
364 struct uhci_frame_list *fl; /* P: uhci->lock */ 365
366 dma_addr_t frame_dma_handle; /* Hardware frame list */
367 __le32 *frame;
368 void **frame_cpu; /* CPU's frame list */
369
365 int fsbr; /* Full-speed bandwidth reclamation */ 370 int fsbr; /* Full-speed bandwidth reclamation */
366 unsigned long fsbrtimeout; /* FSBR delay */ 371 unsigned long fsbrtimeout; /* FSBR delay */
367 372
@@ -385,22 +390,22 @@ struct uhci_hcd {
385 unsigned long ports_timeout; /* Time to stop signalling */ 390 unsigned long ports_timeout; /* Time to stop signalling */
386 391
387 /* Main list of URB's currently controlled by this HC */ 392 /* Main list of URB's currently controlled by this HC */
388 struct list_head urb_list; /* P: uhci->lock */ 393 struct list_head urb_list;
389 394
390 /* List of QH's that are done, but waiting to be unlinked (race) */ 395 /* List of QH's that are done, but waiting to be unlinked (race) */
391 struct list_head qh_remove_list; /* P: uhci->lock */ 396 struct list_head qh_remove_list;
392 unsigned int qh_remove_age; /* Age in frames */ 397 unsigned int qh_remove_age; /* Age in frames */
393 398
394 /* List of TD's that are done, but waiting to be freed (race) */ 399 /* List of TD's that are done, but waiting to be freed (race) */
395 struct list_head td_remove_list; /* P: uhci->lock */ 400 struct list_head td_remove_list;
396 unsigned int td_remove_age; /* Age in frames */ 401 unsigned int td_remove_age; /* Age in frames */
397 402
398 /* List of asynchronously unlinked URB's */ 403 /* List of asynchronously unlinked URB's */
399 struct list_head urb_remove_list; /* P: uhci->lock */ 404 struct list_head urb_remove_list;
400 unsigned int urb_remove_age; /* Age in frames */ 405 unsigned int urb_remove_age; /* Age in frames */
401 406
402 /* List of URB's awaiting completion callback */ 407 /* List of URB's awaiting completion callback */
403 struct list_head complete_list; /* P: uhci->lock */ 408 struct list_head complete_list;
404 409
405 int rh_numports; /* Number of root-hub ports */ 410 int rh_numports; /* Number of root-hub ports */
406 411
@@ -419,13 +424,17 @@ static inline struct usb_hcd *uhci_to_hcd(struct uhci_hcd *uhci)
419 424
420#define uhci_dev(u) (uhci_to_hcd(u)->self.controller) 425#define uhci_dev(u) (uhci_to_hcd(u)->self.controller)
421 426
427
428/*
429 * Private per-URB data
430 */
422struct urb_priv { 431struct urb_priv {
423 struct list_head urb_list; 432 struct list_head urb_list;
424 433
425 struct urb *urb; 434 struct urb *urb;
426 435
427 struct uhci_qh *qh; /* QH for this URB */ 436 struct uhci_qh *qh; /* QH for this URB */
428 struct list_head td_list; /* P: urb->lock */ 437 struct list_head td_list;
429 438
430 unsigned fsbr : 1; /* URB turned on FSBR */ 439 unsigned fsbr : 1; /* URB turned on FSBR */
431 unsigned fsbr_timeout : 1; /* URB timed out on FSBR */ 440 unsigned fsbr_timeout : 1; /* URB timed out on FSBR */
@@ -434,12 +443,12 @@ struct urb_priv {
434 /* a control transfer, retrigger */ 443 /* a control transfer, retrigger */
435 /* the status phase */ 444 /* the status phase */
436 445
437 unsigned long inserttime; /* In jiffies */
438 unsigned long fsbrtime; /* In jiffies */ 446 unsigned long fsbrtime; /* In jiffies */
439 447
440 struct list_head queue_list; /* P: uhci->frame_list_lock */ 448 struct list_head queue_list;
441}; 449};
442 450
451
443/* 452/*
444 * Locking in uhci.c 453 * Locking in uhci.c
445 * 454 *
@@ -459,6 +468,5 @@ struct urb_priv {
459 468
460#define PCI_VENDOR_ID_GENESYS 0x17a0 469#define PCI_VENDOR_ID_GENESYS 0x17a0
461#define PCI_DEVICE_ID_GL880S_UHCI 0x8083 470#define PCI_DEVICE_ID_GL880S_UHCI 0x8083
462#define PCI_DEVICE_ID_GL880S_EHCI 0x8084
463 471
464#endif 472#endif
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 4e0fbe2c1a9a..7e46887d9e12 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -89,10 +89,10 @@ static void uhci_insert_td_frame_list(struct uhci_hcd *uhci, struct uhci_td *td,
89 td->frame = framenum; 89 td->frame = framenum;
90 90
91 /* Is there a TD already mapped there? */ 91 /* Is there a TD already mapped there? */
92 if (uhci->fl->frame_cpu[framenum]) { 92 if (uhci->frame_cpu[framenum]) {
93 struct uhci_td *ftd, *ltd; 93 struct uhci_td *ftd, *ltd;
94 94
95 ftd = uhci->fl->frame_cpu[framenum]; 95 ftd = uhci->frame_cpu[framenum];
96 ltd = list_entry(ftd->fl_list.prev, struct uhci_td, fl_list); 96 ltd = list_entry(ftd->fl_list.prev, struct uhci_td, fl_list);
97 97
98 list_add_tail(&td->fl_list, &ftd->fl_list); 98 list_add_tail(&td->fl_list, &ftd->fl_list);
@@ -101,29 +101,32 @@ static void uhci_insert_td_frame_list(struct uhci_hcd *uhci, struct uhci_td *td,
101 wmb(); 101 wmb();
102 ltd->link = cpu_to_le32(td->dma_handle); 102 ltd->link = cpu_to_le32(td->dma_handle);
103 } else { 103 } else {
104 td->link = uhci->fl->frame[framenum]; 104 td->link = uhci->frame[framenum];
105 wmb(); 105 wmb();
106 uhci->fl->frame[framenum] = cpu_to_le32(td->dma_handle); 106 uhci->frame[framenum] = cpu_to_le32(td->dma_handle);
107 uhci->fl->frame_cpu[framenum] = td; 107 uhci->frame_cpu[framenum] = td;
108 } 108 }
109} 109}
110 110
111static void uhci_remove_td(struct uhci_hcd *uhci, struct uhci_td *td) 111static inline void uhci_remove_td_frame_list(struct uhci_hcd *uhci,
112 struct uhci_td *td)
112{ 113{
113 /* If it's not inserted, don't remove it */ 114 /* If it's not inserted, don't remove it */
114 if (td->frame == -1 && list_empty(&td->fl_list)) 115 if (td->frame == -1) {
116 WARN_ON(!list_empty(&td->fl_list));
115 return; 117 return;
118 }
116 119
117 if (td->frame != -1 && uhci->fl->frame_cpu[td->frame] == td) { 120 if (uhci->frame_cpu[td->frame] == td) {
118 if (list_empty(&td->fl_list)) { 121 if (list_empty(&td->fl_list)) {
119 uhci->fl->frame[td->frame] = td->link; 122 uhci->frame[td->frame] = td->link;
120 uhci->fl->frame_cpu[td->frame] = NULL; 123 uhci->frame_cpu[td->frame] = NULL;
121 } else { 124 } else {
122 struct uhci_td *ntd; 125 struct uhci_td *ntd;
123 126
124 ntd = list_entry(td->fl_list.next, struct uhci_td, fl_list); 127 ntd = list_entry(td->fl_list.next, struct uhci_td, fl_list);
125 uhci->fl->frame[td->frame] = cpu_to_le32(ntd->dma_handle); 128 uhci->frame[td->frame] = cpu_to_le32(ntd->dma_handle);
126 uhci->fl->frame_cpu[td->frame] = ntd; 129 uhci->frame_cpu[td->frame] = ntd;
127 } 130 }
128 } else { 131 } else {
129 struct uhci_td *ptd; 132 struct uhci_td *ptd;
@@ -132,13 +135,20 @@ static void uhci_remove_td(struct uhci_hcd *uhci, struct uhci_td *td)
132 ptd->link = td->link; 135 ptd->link = td->link;
133 } 136 }
134 137
135 wmb();
136 td->link = UHCI_PTR_TERM;
137
138 list_del_init(&td->fl_list); 138 list_del_init(&td->fl_list);
139 td->frame = -1; 139 td->frame = -1;
140} 140}
141 141
142static void unlink_isochronous_tds(struct uhci_hcd *uhci, struct urb *urb)
143{
144 struct urb_priv *urbp = (struct urb_priv *) urb->hcpriv;
145 struct uhci_td *td;
146
147 list_for_each_entry(td, &urbp->td_list, list)
148 uhci_remove_td_frame_list(uhci, td);
149 wmb();
150}
151
142/* 152/*
143 * Inserts a td list into qh. 153 * Inserts a td list into qh.
144 */ 154 */
@@ -443,7 +453,6 @@ static struct urb_priv *uhci_alloc_urb_priv(struct uhci_hcd *uhci, struct urb *u
443 453
444 memset((void *)urbp, 0, sizeof(*urbp)); 454 memset((void *)urbp, 0, sizeof(*urbp));
445 455
446 urbp->inserttime = jiffies;
447 urbp->fsbrtime = jiffies; 456 urbp->fsbrtime = jiffies;
448 urbp->urb = urb; 457 urbp->urb = urb;
449 458
@@ -462,8 +471,6 @@ static void uhci_add_td_to_urb(struct urb *urb, struct uhci_td *td)
462{ 471{
463 struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv; 472 struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
464 473
465 td->urb = urb;
466
467 list_add_tail(&td->list, &urbp->td_list); 474 list_add_tail(&td->list, &urbp->td_list);
468} 475}
469 476
@@ -473,8 +480,6 @@ static void uhci_remove_td_from_urb(struct uhci_td *td)
473 return; 480 return;
474 481
475 list_del_init(&td->list); 482 list_del_init(&td->list);
476
477 td->urb = NULL;
478} 483}
479 484
480static void uhci_destroy_urb_priv(struct uhci_hcd *uhci, struct urb *urb) 485static void uhci_destroy_urb_priv(struct uhci_hcd *uhci, struct urb *urb)
@@ -503,7 +508,6 @@ static void uhci_destroy_urb_priv(struct uhci_hcd *uhci, struct urb *urb)
503 508
504 list_for_each_entry_safe(td, tmp, &urbp->td_list, list) { 509 list_for_each_entry_safe(td, tmp, &urbp->td_list, list) {
505 uhci_remove_td_from_urb(td); 510 uhci_remove_td_from_urb(td);
506 uhci_remove_td(uhci, td);
507 list_add(&td->remove_list, &uhci->td_remove_list); 511 list_add(&td->remove_list, &uhci->td_remove_list);
508 } 512 }
509 513
@@ -1073,6 +1077,7 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb)
1073 struct uhci_td *td; 1077 struct uhci_td *td;
1074 int i, ret, frame; 1078 int i, ret, frame;
1075 int status, destination; 1079 int status, destination;
1080 struct urb_priv *urbp = (struct urb_priv *) urb->hcpriv;
1076 1081
1077 status = TD_CTRL_ACTIVE | TD_CTRL_IOS; 1082 status = TD_CTRL_ACTIVE | TD_CTRL_IOS;
1078 destination = (urb->pipe & PIPE_DEVEP_MASK) | usb_packetid(urb->pipe); 1083 destination = (urb->pipe & PIPE_DEVEP_MASK) | usb_packetid(urb->pipe);
@@ -1081,11 +1086,7 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb)
1081 if (ret) 1086 if (ret)
1082 return ret; 1087 return ret;
1083 1088
1084 frame = urb->start_frame; 1089 for (i = 0; i < urb->number_of_packets; i++) {
1085 for (i = 0; i < urb->number_of_packets; i++, frame += urb->interval) {
1086 if (!urb->iso_frame_desc[i].length)
1087 continue;
1088
1089 td = uhci_alloc_td(uhci); 1090 td = uhci_alloc_td(uhci);
1090 if (!td) 1091 if (!td)
1091 return -ENOMEM; 1092 return -ENOMEM;
@@ -1096,8 +1097,12 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb)
1096 1097
1097 if (i + 1 >= urb->number_of_packets) 1098 if (i + 1 >= urb->number_of_packets)
1098 td->status |= cpu_to_le32(TD_CTRL_IOC); 1099 td->status |= cpu_to_le32(TD_CTRL_IOC);
1100 }
1099 1101
1102 frame = urb->start_frame;
1103 list_for_each_entry(td, &urbp->td_list, list) {
1100 uhci_insert_td_frame_list(uhci, td, frame); 1104 uhci_insert_td_frame_list(uhci, td, frame);
1105 frame += urb->interval;
1101 } 1106 }
1102 1107
1103 return -EINPROGRESS; 1108 return -EINPROGRESS;
@@ -1110,7 +1115,7 @@ static int uhci_result_isochronous(struct uhci_hcd *uhci, struct urb *urb)
1110 int status; 1115 int status;
1111 int i, ret = 0; 1116 int i, ret = 0;
1112 1117
1113 urb->actual_length = 0; 1118 urb->actual_length = urb->error_count = 0;
1114 1119
1115 i = 0; 1120 i = 0;
1116 list_for_each_entry(td, &urbp->td_list, list) { 1121 list_for_each_entry(td, &urbp->td_list, list) {
@@ -1134,6 +1139,7 @@ static int uhci_result_isochronous(struct uhci_hcd *uhci, struct urb *urb)
1134 1139
1135 i++; 1140 i++;
1136 } 1141 }
1142 unlink_isochronous_tds(uhci, urb);
1137 1143
1138 return ret; 1144 return ret;
1139} 1145}
@@ -1366,6 +1372,8 @@ static int uhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb)
1366 goto done; 1372 goto done;
1367 list_del_init(&urbp->urb_list); 1373 list_del_init(&urbp->urb_list);
1368 1374
1375 if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS)
1376 unlink_isochronous_tds(uhci, urb);
1369 uhci_unlink_generic(uhci, urb); 1377 uhci_unlink_generic(uhci, urb);
1370 1378
1371 uhci_get_current_frame_number(uhci); 1379 uhci_get_current_frame_number(uhci);
diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
index a330a4b50e16..1d973bcf56aa 100644
--- a/drivers/usb/image/mdc800.c
+++ b/drivers/usb/image/mdc800.c
@@ -425,9 +425,8 @@ static void mdc800_usb_download_notify (struct urb *urb, struct pt_regs *res)
425static struct usb_driver mdc800_usb_driver; 425static struct usb_driver mdc800_usb_driver;
426static struct file_operations mdc800_device_ops; 426static struct file_operations mdc800_device_ops;
427static struct usb_class_driver mdc800_class = { 427static struct usb_class_driver mdc800_class = {
428 .name = "usb/mdc800%d", 428 .name = "mdc800%d",
429 .fops = &mdc800_device_ops, 429 .fops = &mdc800_device_ops,
430 .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
431 .minor_base = MDC800_DEVICE_MINOR_BASE, 430 .minor_base = MDC800_DEVICE_MINOR_BASE,
432}; 431};
433 432
@@ -976,13 +975,13 @@ static struct usb_driver mdc800_usb_driver =
976 Init and Cleanup this driver (Main Functions) 975 Init and Cleanup this driver (Main Functions)
977*************************************************************************/ 976*************************************************************************/
978 977
979#define try(A) if (!(A)) goto cleanup_on_fail;
980
981static int __init usb_mdc800_init (void) 978static int __init usb_mdc800_init (void)
982{ 979{
983 int retval = -ENODEV; 980 int retval = -ENODEV;
984 /* Allocate Memory */ 981 /* Allocate Memory */
985 try (mdc800=kmalloc (sizeof (struct mdc800_data), GFP_KERNEL)); 982 mdc800=kmalloc (sizeof (struct mdc800_data), GFP_KERNEL);
983 if (!mdc800)
984 goto cleanup_on_fail;
986 985
987 memset(mdc800, 0, sizeof(struct mdc800_data)); 986 memset(mdc800, 0, sizeof(struct mdc800_data));
988 mdc800->dev = NULL; 987 mdc800->dev = NULL;
@@ -998,13 +997,25 @@ static int __init usb_mdc800_init (void)
998 mdc800->downloaded = 0; 997 mdc800->downloaded = 0;
999 mdc800->written = 0; 998 mdc800->written = 0;
1000 999
1001 try (mdc800->irq_urb_buffer=kmalloc (8, GFP_KERNEL)); 1000 mdc800->irq_urb_buffer=kmalloc (8, GFP_KERNEL);
1002 try (mdc800->write_urb_buffer=kmalloc (8, GFP_KERNEL)); 1001 if (!mdc800->irq_urb_buffer)
1003 try (mdc800->download_urb_buffer=kmalloc (64, GFP_KERNEL)); 1002 goto cleanup_on_fail;
1003 mdc800->write_urb_buffer=kmalloc (8, GFP_KERNEL);
1004 if (!mdc800->write_urb_buffer)
1005 goto cleanup_on_fail;
1006 mdc800->download_urb_buffer=kmalloc (64, GFP_KERNEL);
1007 if (!mdc800->download_urb_buffer)
1008 goto cleanup_on_fail;
1004 1009
1005 try (mdc800->irq_urb=usb_alloc_urb (0, GFP_KERNEL)); 1010 mdc800->irq_urb=usb_alloc_urb (0, GFP_KERNEL);
1006 try (mdc800->download_urb=usb_alloc_urb (0, GFP_KERNEL)); 1011 if (!mdc800->irq_urb)
1007 try (mdc800->write_urb=usb_alloc_urb (0, GFP_KERNEL)); 1012 goto cleanup_on_fail;
1013 mdc800->download_urb=usb_alloc_urb (0, GFP_KERNEL);
1014 if (!mdc800->download_urb)
1015 goto cleanup_on_fail;
1016 mdc800->write_urb=usb_alloc_urb (0, GFP_KERNEL);
1017 if (!mdc800->write_urb)
1018 goto cleanup_on_fail;
1008 1019
1009 /* Register the driver */ 1020 /* Register the driver */
1010 retval = usb_register(&mdc800_usb_driver); 1021 retval = usb_register(&mdc800_usb_driver);
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index c84e1486054f..c89d0769b3da 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -773,11 +773,10 @@ static int mts_usb_probe(struct usb_interface *intf,
773 } 773 }
774 774
775 775
776 new_desc = kmalloc(sizeof(struct mts_desc), GFP_KERNEL); 776 new_desc = kzalloc(sizeof(struct mts_desc), GFP_KERNEL);
777 if (!new_desc) 777 if (!new_desc)
778 goto out; 778 goto out;
779 779
780 memset(new_desc, 0, sizeof(*new_desc));
781 new_desc->urb = usb_alloc_urb(0, GFP_KERNEL); 780 new_desc->urb = usb_alloc_urb(0, GFP_KERNEL);
782 if (!new_desc->urb) 781 if (!new_desc->urb)
783 goto out_kfree; 782 goto out_kfree;
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
index 1c5205321d83..1c3b472a3bca 100644
--- a/drivers/usb/input/aiptek.c
+++ b/drivers/usb/input/aiptek.c
@@ -2154,7 +2154,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2154 * input_handles associated with this input device. 2154 * input_handles associated with this input device.
2155 * What identifies an evdev input_handler is that it begins 2155 * What identifies an evdev input_handler is that it begins
2156 * with 'event', continues with a digit, and that in turn 2156 * with 'event', continues with a digit, and that in turn
2157 * is mapped to /{devfs}/input/eventN. 2157 * is mapped to input/eventN.
2158 */ 2158 */
2159 list_for_each_safe(node, next, &inputdev->h_list) { 2159 list_for_each_safe(node, next, &inputdev->h_list) {
2160 inputhandle = to_handle(node); 2160 inputhandle = to_handle(node);
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index 411a0645a7a3..79ddce4555ab 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -1784,6 +1784,9 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
1784 hid->urbctrl->transfer_dma = hid->ctrlbuf_dma; 1784 hid->urbctrl->transfer_dma = hid->ctrlbuf_dma;
1785 hid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); 1785 hid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP);
1786 1786
1787 /* May be needed for some devices */
1788 usb_clear_halt(hid->dev, hid->urbin->pipe);
1789
1787 return hid; 1790 return hid;
1788 1791
1789fail: 1792fail:
@@ -1887,7 +1890,6 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message)
1887 struct hid_device *hid = usb_get_intfdata (intf); 1890 struct hid_device *hid = usb_get_intfdata (intf);
1888 1891
1889 usb_kill_urb(hid->urbin); 1892 usb_kill_urb(hid->urbin);
1890 intf->dev.power.power_state = PMSG_SUSPEND;
1891 dev_dbg(&intf->dev, "suspend\n"); 1893 dev_dbg(&intf->dev, "suspend\n");
1892 return 0; 1894 return 0;
1893} 1895}
@@ -1897,7 +1899,6 @@ static int hid_resume(struct usb_interface *intf)
1897 struct hid_device *hid = usb_get_intfdata (intf); 1899 struct hid_device *hid = usb_get_intfdata (intf);
1898 int status; 1900 int status;
1899 1901
1900 intf->dev.power.power_state = PMSG_ON;
1901 if (hid->open) 1902 if (hid->open)
1902 status = usb_submit_urb(hid->urbin, GFP_NOIO); 1903 status = usb_submit_urb(hid->urbin, GFP_NOIO);
1903 else 1904 else
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c
index d32427818af7..440377c7a0da 100644
--- a/drivers/usb/input/hiddev.c
+++ b/drivers/usb/input/hiddev.c
@@ -732,9 +732,8 @@ static struct file_operations hiddev_fops = {
732}; 732};
733 733
734static struct usb_class_driver hiddev_class = { 734static struct usb_class_driver hiddev_class = {
735 .name = "usb/hid/hiddev%d", 735 .name = "hiddev%d",
736 .fops = &hiddev_fops, 736 .fops = &hiddev_fops,
737 .mode = S_IFCHR | S_IRUGO | S_IWUSR,
738 .minor_base = HIDDEV_MINOR_BASE, 737 .minor_base = HIDDEV_MINOR_BASE,
739}; 738};
740 739
diff --git a/drivers/usb/input/map_to_7segment.h b/drivers/usb/input/map_to_7segment.h
index 52ff27f15127..a424094d9fe2 100644
--- a/drivers/usb/input/map_to_7segment.h
+++ b/drivers/usb/input/map_to_7segment.h
@@ -79,7 +79,7 @@ struct seg7_conversion_map {
79 79
80static inline int map_to_seg7(struct seg7_conversion_map *map, int c) 80static inline int map_to_seg7(struct seg7_conversion_map *map, int c)
81{ 81{
82 return c & 0x7f ? map->table[c] : -EINVAL; 82 return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL;
83} 83}
84 84
85#define SEG7_CONVERSION_MAP(_name, _map) \ 85#define SEG7_CONVERSION_MAP(_name, _map) \
diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c
index 3766ccc271be..0043e6ebcd1f 100644
--- a/drivers/usb/input/touchkitusb.c
+++ b/drivers/usb/input/touchkitusb.c
@@ -75,7 +75,9 @@ struct touchkit_usb {
75 75
76static struct usb_device_id touchkit_devices[] = { 76static struct usb_device_id touchkit_devices[] = {
77 {USB_DEVICE(0x3823, 0x0001)}, 77 {USB_DEVICE(0x3823, 0x0001)},
78 {USB_DEVICE(0x0123, 0x0001)},
78 {USB_DEVICE(0x0eef, 0x0001)}, 79 {USB_DEVICE(0x0eef, 0x0001)},
80 {USB_DEVICE(0x0eef, 0x0002)},
79 {} 81 {}
80}; 82};
81 83
diff --git a/drivers/usb/media/dabusb.c b/drivers/usb/media/dabusb.c
index 6ca2fae99d2d..27b23c55bbc7 100644
--- a/drivers/usb/media/dabusb.c
+++ b/drivers/usb/media/dabusb.c
@@ -707,9 +707,8 @@ static struct file_operations dabusb_fops =
707}; 707};
708 708
709static struct usb_class_driver dabusb_class = { 709static struct usb_class_driver dabusb_class = {
710 .name = "usb/dabusb%d", 710 .name = "dabusb%d",
711 .fops = &dabusb_fops, 711 .fops = &dabusb_fops,
712 .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
713 .minor_base = DABUSB_MINOR, 712 .minor_base = DABUSB_MINOR,
714}; 713};
715 714
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
index ae4681f9f0ea..5f33f7c64885 100644
--- a/drivers/usb/misc/auerswald.c
+++ b/drivers/usb/misc/auerswald.c
@@ -1873,9 +1873,8 @@ static struct file_operations auerswald_fops =
1873}; 1873};
1874 1874
1875static struct usb_class_driver auerswald_class = { 1875static struct usb_class_driver auerswald_class = {
1876 .name = "usb/auer%d", 1876 .name = "auer%d",
1877 .fops = &auerswald_fops, 1877 .fops = &auerswald_fops,
1878 .mode = S_IFCHR | S_IRUGO | S_IWUGO,
1879 .minor_base = AUER_MINOR_BASE, 1878 .minor_base = AUER_MINOR_BASE,
1880}; 1879};
1881 1880
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index 733acc213726..3944a55ed74c 100644
--- a/drivers/usb/misc/idmouse.c
+++ b/drivers/usb/misc/idmouse.c
@@ -105,11 +105,10 @@ static struct file_operations idmouse_fops = {
105 .release = idmouse_release, 105 .release = idmouse_release,
106}; 106};
107 107
108/* class driver information for devfs */ 108/* class driver information */
109static struct usb_class_driver idmouse_class = { 109static struct usb_class_driver idmouse_class = {
110 .name = "usb/idmouse%d", 110 .name = "idmouse%d",
111 .fops = &idmouse_fops, 111 .fops = &idmouse_fops,
112 .mode = S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH, /* filemode (char, 444) */
113 .minor_base = USB_IDMOUSE_MINOR_BASE, 112 .minor_base = USB_IDMOUSE_MINOR_BASE,
114}; 113};
115 114
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 7d06105763d4..2703e205bc8f 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -271,12 +271,11 @@ static struct file_operations tower_fops = {
271 271
272/* 272/*
273 * usb class driver info in order to get a minor number from the usb core, 273 * usb class driver info in order to get a minor number from the usb core,
274 * and to have the device registered with devfs and the driver core 274 * and to have the device registered with the driver core
275 */ 275 */
276static struct usb_class_driver tower_class = { 276static struct usb_class_driver tower_class = {
277 .name = "usb/legousbtower%d", 277 .name = "legousbtower%d",
278 .fops = &tower_fops, 278 .fops = &tower_fops,
279 .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
280 .minor_base = LEGO_USB_TOWER_MINOR_BASE, 279 .minor_base = LEGO_USB_TOWER_MINOR_BASE,
281}; 280};
282 281
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c
index 26f77e29c7a6..7d02d8ec6b1a 100644
--- a/drivers/usb/misc/rio500.c
+++ b/drivers/usb/misc/rio500.c
@@ -443,9 +443,8 @@ file_operations usb_rio_fops = {
443}; 443};
444 444
445static struct usb_class_driver usb_rio_class = { 445static struct usb_class_driver usb_rio_class = {
446 .name = "usb/rio500%d", 446 .name = "rio500%d",
447 .fops = &usb_rio_fops, 447 .fops = &usb_rio_fops,
448 .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
449 .minor_base = RIO_MINOR, 448 .minor_base = RIO_MINOR,
450}; 449};
451 450
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index 39db3155723a..c946c9a538a0 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -2440,7 +2440,7 @@ int
2440sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init) 2440sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init)
2441{ 2441{
2442 int ret = 0, slot = sisusb->font_slot, i; 2442 int ret = 0, slot = sisusb->font_slot, i;
2443 struct font_desc *myfont; 2443 const struct font_desc *myfont;
2444 u8 *tempbuf; 2444 u8 *tempbuf;
2445 u16 *tempbufb; 2445 u16 *tempbufb;
2446 size_t written; 2446 size_t written;
@@ -3239,12 +3239,7 @@ static struct file_operations usb_sisusb_fops = {
3239}; 3239};
3240 3240
3241static struct usb_class_driver usb_sisusb_class = { 3241static struct usb_class_driver usb_sisusb_class = {
3242#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)
3243 .name = "usb/sisusbvga%d",
3244 .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
3245#else
3246 .name = "sisusbvga%d", 3242 .name = "sisusbvga%d",
3247#endif
3248 .fops = &usb_sisusb_fops, 3243 .fops = &usb_sisusb_fops,
3249 .minor_base = SISUSB_MINOR 3244 .minor_base = SISUSB_MINOR
3250}; 3245};
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index 096ab3029676..85f3725334b0 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -251,13 +251,12 @@ static struct file_operations lcd_fops = {
251}; 251};
252 252
253/* 253/*
254 * * usb class driver info in order to get a minor number from the usb core, 254 * usb class driver info in order to get a minor number from the usb core,
255 * * and to have the device registered with devfs and the driver core 255 * and to have the device registered with the driver core
256 * */ 256 */
257static struct usb_class_driver lcd_class = { 257static struct usb_class_driver lcd_class = {
258 .name = "usb/lcd%d", 258 .name = "lcd%d",
259 .fops = &lcd_fops, 259 .fops = &lcd_fops,
260 .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
261 .minor_base = USBLCD_MINOR, 260 .minor_base = USBLCD_MINOR,
262}; 261};
263 262
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 54799eb0bc60..90a96257d6ce 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -983,6 +983,7 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param)
983 reqp->number = i % NUM_SUBCASES; 983 reqp->number = i % NUM_SUBCASES;
984 reqp->expected = expected; 984 reqp->expected = expected;
985 u->setup_packet = (char *) &reqp->setup; 985 u->setup_packet = (char *) &reqp->setup;
986 u->transfer_flags |= URB_NO_SETUP_DMA_MAP;
986 987
987 u->context = &context; 988 u->context = &context;
988 u->complete = ctrl_complete; 989 u->complete = ctrl_complete;
@@ -1948,21 +1949,11 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id)
1948 1949
1949static int usbtest_suspend (struct usb_interface *intf, pm_message_t message) 1950static int usbtest_suspend (struct usb_interface *intf, pm_message_t message)
1950{ 1951{
1951 struct usbtest_dev *dev = usb_get_intfdata (intf);
1952
1953 down (&dev->sem);
1954 intf->dev.power.power_state = PMSG_SUSPEND;
1955 up (&dev->sem);
1956 return 0; 1952 return 0;
1957} 1953}
1958 1954
1959static int usbtest_resume (struct usb_interface *intf) 1955static int usbtest_resume (struct usb_interface *intf)
1960{ 1956{
1961 struct usbtest_dev *dev = usb_get_intfdata (intf);
1962
1963 down (&dev->sem);
1964 intf->dev.power.power_state = PMSG_ON;
1965 up (&dev->sem);
1966 return 0; 1957 return 0;
1967} 1958}
1968 1959
diff --git a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c
index 508a21028db4..c34944c75047 100644
--- a/drivers/usb/mon/mon_main.c
+++ b/drivers/usb/mon/mon_main.c
@@ -11,6 +11,7 @@
11#include <linux/usb.h> 11#include <linux/usb.h>
12#include <linux/debugfs.h> 12#include <linux/debugfs.h>
13#include <linux/smp_lock.h> 13#include <linux/smp_lock.h>
14#include <linux/notifier.h>
14 15
15#include "usb_mon.h" 16#include "usb_mon.h"
16#include "../core/hcd.h" 17#include "../core/hcd.h"
@@ -205,6 +206,23 @@ static void mon_bus_remove(struct usb_bus *ubus)
205 up(&mon_lock); 206 up(&mon_lock);
206} 207}
207 208
209static int mon_notify(struct notifier_block *self, unsigned long action,
210 void *dev)
211{
212 switch (action) {
213 case USB_BUS_ADD:
214 mon_bus_add(dev);
215 break;
216 case USB_BUS_REMOVE:
217 mon_bus_remove(dev);
218 }
219 return NOTIFY_OK;
220}
221
222static struct notifier_block mon_nb = {
223 .notifier_call = mon_notify,
224};
225
208/* 226/*
209 * Ops 227 * Ops
210 */ 228 */
@@ -212,8 +230,6 @@ static struct usb_mon_operations mon_ops_0 = {
212 .urb_submit = mon_submit, 230 .urb_submit = mon_submit,
213 .urb_submit_error = mon_submit_error, 231 .urb_submit_error = mon_submit_error,
214 .urb_complete = mon_complete, 232 .urb_complete = mon_complete,
215 .bus_add = mon_bus_add,
216 .bus_remove = mon_bus_remove,
217}; 233};
218 234
219/* 235/*
@@ -329,6 +345,8 @@ static int __init mon_init(void)
329 } 345 }
330 // MOD_INC_USE_COUNT(which_module?); 346 // MOD_INC_USE_COUNT(which_module?);
331 347
348 usb_register_notify(&mon_nb);
349
332 down(&usb_bus_list_lock); 350 down(&usb_bus_list_lock);
333 list_for_each_entry (ubus, &usb_bus_list, bus_list) { 351 list_for_each_entry (ubus, &usb_bus_list, bus_list) {
334 mon_bus_init(mondir, ubus); 352 mon_bus_init(mondir, ubus);
@@ -342,6 +360,7 @@ static void __exit mon_exit(void)
342 struct mon_bus *mbus; 360 struct mon_bus *mbus;
343 struct list_head *p; 361 struct list_head *p;
344 362
363 usb_unregister_notify(&mon_nb);
345 usb_mon_deregister(); 364 usb_mon_deregister();
346 365
347 down(&mon_lock); 366 down(&mon_lock);
diff --git a/drivers/usb/net/Kconfig b/drivers/usb/net/Kconfig
index 8c010bb44eb8..efd6ca7e4ac5 100644
--- a/drivers/usb/net/Kconfig
+++ b/drivers/usb/net/Kconfig
@@ -294,7 +294,7 @@ config USB_NET_ZAURUS
294 This also supports some related device firmware, as used in some 294 This also supports some related device firmware, as used in some
295 PDAs from Olympus and some cell phones from Motorola. 295 PDAs from Olympus and some cell phones from Motorola.
296 296
297 If you install an alternate ROM image, such as the Linux 2.6 based 297 If you install an alternate image, such as the Linux 2.6 based
298 versions of OpenZaurus, you should no longer need to support this 298 versions of OpenZaurus, you should no longer need to support this
299 protocol. Only the "eth-fd" or "net_fd" drivers in these devices 299 protocol. Only the "eth-fd" or "net_fd" drivers in these devices
300 really need this non-conformant variant of CDC Ethernet (or in 300 really need this non-conformant variant of CDC Ethernet (or in
diff --git a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c
index c82655d3d448..6bef1be6b36c 100644
--- a/drivers/usb/net/kaweth.c
+++ b/drivers/usb/net/kaweth.c
@@ -469,7 +469,7 @@ static int kaweth_reset(struct kaweth_device *kaweth)
469 0, 469 0,
470 KAWETH_CONTROL_TIMEOUT); 470 KAWETH_CONTROL_TIMEOUT);
471 471
472 udelay(10000); 472 mdelay(10);
473 473
474 kaweth_dbg("kaweth_reset() returns %d.",result); 474 kaweth_dbg("kaweth_reset() returns %d.",result);
475 475
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
index 6a4ffe6c3977..537eb181d985 100644
--- a/drivers/usb/net/pegasus.c
+++ b/drivers/usb/net/pegasus.c
@@ -1384,7 +1384,6 @@ static int pegasus_suspend (struct usb_interface *intf, pm_message_t message)
1384 usb_kill_urb(pegasus->rx_urb); 1384 usb_kill_urb(pegasus->rx_urb);
1385 usb_kill_urb(pegasus->intr_urb); 1385 usb_kill_urb(pegasus->intr_urb);
1386 } 1386 }
1387 intf->dev.power.power_state = PMSG_SUSPEND;
1388 return 0; 1387 return 0;
1389} 1388}
1390 1389
@@ -1392,7 +1391,6 @@ static int pegasus_resume (struct usb_interface *intf)
1392{ 1391{
1393 struct pegasus *pegasus = usb_get_intfdata(intf); 1392 struct pegasus *pegasus = usb_get_intfdata(intf);
1394 1393
1395 intf->dev.power.power_state = PMSG_ON;
1396 netif_device_attach (pegasus->net); 1394 netif_device_attach (pegasus->net);
1397 if (netif_running(pegasus->net)) { 1395 if (netif_running(pegasus->net)) {
1398 pegasus->rx_urb->status = 0; 1396 pegasus->rx_urb->status = 0;
diff --git a/drivers/usb/net/pegasus.h b/drivers/usb/net/pegasus.h
index b98f2a833442..9fbd59b55cb6 100644
--- a/drivers/usb/net/pegasus.h
+++ b/drivers/usb/net/pegasus.h
@@ -181,6 +181,8 @@ PEGASUS_DEV( "Accton USB 10/100 Ethernet Adapter", VENDOR_ACCTON, 0x1046,
181 DEFAULT_GPIO_RESET ) 181 DEFAULT_GPIO_RESET )
182PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046, 182PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046,
183 DEFAULT_GPIO_RESET | PEGASUS_II ) 183 DEFAULT_GPIO_RESET | PEGASUS_II )
184PEGASUS_DEV( "Philips USB 10/100 Ethernet", VENDOR_ACCTON, 0xb004,
185 DEFAULT_GPIO_RESET | PEGASUS_II )
184PEGASUS_DEV( "ADMtek ADM8511 \"Pegasus II\" USB Ethernet", 186PEGASUS_DEV( "ADMtek ADM8511 \"Pegasus II\" USB Ethernet",
185 VENDOR_ADMTEK, 0x8511, 187 VENDOR_ADMTEK, 0x8511,
186 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA ) 188 DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA )
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c
index c3d4e3589e30..787dd3591d6a 100644
--- a/drivers/usb/net/rtl8150.c
+++ b/drivers/usb/net/rtl8150.c
@@ -909,6 +909,7 @@ static void rtl8150_disconnect(struct usb_interface *intf)
909 usb_set_intfdata(intf, NULL); 909 usb_set_intfdata(intf, NULL);
910 if (dev) { 910 if (dev) {
911 set_bit(RTL8150_UNPLUG, &dev->flags); 911 set_bit(RTL8150_UNPLUG, &dev->flags);
912 tasklet_disable(&dev->tl);
912 unregister_netdev(dev->netdev); 913 unregister_netdev(dev->netdev);
913 unlink_all_urbs(dev); 914 unlink_all_urbs(dev);
914 free_all_urbs(dev); 915 free_all_urbs(dev);
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
index fce81d738933..74f05c9c84d5 100644
--- a/drivers/usb/net/usbnet.c
+++ b/drivers/usb/net/usbnet.c
@@ -1185,7 +1185,6 @@ int usbnet_suspend (struct usb_interface *intf, pm_message_t message)
1185 netif_device_detach (dev->net); 1185 netif_device_detach (dev->net);
1186 (void) unlink_urbs (dev, &dev->rxq); 1186 (void) unlink_urbs (dev, &dev->rxq);
1187 (void) unlink_urbs (dev, &dev->txq); 1187 (void) unlink_urbs (dev, &dev->txq);
1188 intf->dev.power.power_state = PMSG_SUSPEND;
1189 return 0; 1188 return 0;
1190} 1189}
1191EXPORT_SYMBOL_GPL(usbnet_suspend); 1190EXPORT_SYMBOL_GPL(usbnet_suspend);
@@ -1194,7 +1193,6 @@ int usbnet_resume (struct usb_interface *intf)
1194{ 1193{
1195 struct usbnet *dev = usb_get_intfdata(intf); 1194 struct usbnet *dev = usb_get_intfdata(intf);
1196 1195
1197 intf->dev.power.power_state = PMSG_ON;
1198 netif_device_attach (dev->net); 1196 netif_device_attach (dev->net);
1199 tasklet_schedule (&dev->bh); 1197 tasklet_schedule (&dev->bh);
1200 return 0; 1198 return 0;
diff --git a/drivers/usb/serial/ChangeLog.old b/drivers/usb/serial/ChangeLog.old
new file mode 100644
index 000000000000..c1b279939bbf
--- /dev/null
+++ b/drivers/usb/serial/ChangeLog.old
@@ -0,0 +1,730 @@
1This is the contents of some of the drivers/usb/serial/ files that had old
2changelog comments. They were quite old, and out of date, and we don't keep
3them anymore, so I've put them here, away from the source files, in case
4people still care to see them.
5
6- Greg Kroah-Hartman <greg@kroah.com> October 20, 2005
7
8-----------------------------------------------------------------------
9usb-serial.h Change Log comments:
10
11 (03/26/2002) gkh
12 removed the port->tty check from port_paranoia_check() due to serial
13 consoles not having a tty device assigned to them.
14
15 (12/03/2001) gkh
16 removed active from the port structure.
17 added documentation to the usb_serial_device_type structure
18
19 (10/10/2001) gkh
20 added vendor and product to serial structure. Needed to determine device
21 owner when the device is disconnected.
22
23 (05/30/2001) gkh
24 added sem to port structure and removed port_lock
25
26 (10/05/2000) gkh
27 Added interrupt_in_endpointAddress and bulk_in_endpointAddress to help
28 fix bug with urb->dev not being set properly, now that the usb core
29 needs it.
30
31 (09/11/2000) gkh
32 Added usb_serial_debug_data function to help get rid of #DEBUG in the
33 drivers.
34
35 (08/28/2000) gkh
36 Added port_lock to port structure.
37
38 (08/08/2000) gkh
39 Added open_count to port structure.
40
41 (07/23/2000) gkh
42 Added bulk_out_endpointAddress to port structure.
43
44 (07/19/2000) gkh, pberger, and borchers
45 Modifications to allow usb-serial drivers to be modules.
46
47-----------------------------------------------------------------------
48usb-serial.c Change Log comments:
49
50 (12/10/2002) gkh
51 Split the ports off into their own struct device, and added a
52 usb-serial bus driver.
53
54 (11/19/2002) gkh
55 removed a few #ifdefs for the generic code and cleaned up the failure
56 logic in initialization.
57
58 (10/02/2002) gkh
59 moved the console code to console.c and out of this file.
60
61 (06/05/2002) gkh
62 moved location of startup() call in serial_probe() until after all
63 of the port information and endpoints are initialized. This makes
64 things easier for some drivers.
65
66 (04/10/2002) gkh
67 added serial_read_proc function which creates a
68 /proc/tty/driver/usb-serial file.
69
70 (03/27/2002) gkh
71 Got USB serial console code working properly and merged into the main
72 version of the tree. Thanks to Randy Dunlap for the initial version
73 of this code, and for pushing me to finish it up.
74 The USB serial console works with any usb serial driver device.
75
76 (03/21/2002) gkh
77 Moved all manipulation of port->open_count into the core. Now the
78 individual driver's open and close functions are called only when the
79 first open() and last close() is called. Making the drivers a bit
80 smaller and simpler.
81 Fixed a bug if a driver didn't have the owner field set.
82
83 (02/26/2002) gkh
84 Moved all locking into the main serial_* functions, instead of having
85 the individual drivers have to grab the port semaphore. This should
86 reduce races.
87 Reworked the MOD_INC logic a bit to always increment and decrement, even
88 if the generic driver is being used.
89
90 (10/10/2001) gkh
91 usb_serial_disconnect() now sets the serial->dev pointer is to NULL to
92 help prevent child drivers from accessing the device since it is now
93 gone.
94
95 (09/13/2001) gkh
96 Moved generic driver initialize after we have registered with the USB
97 core. Thanks to Randy Dunlap for pointing this problem out.
98
99 (07/03/2001) gkh
100 Fixed module paramater size. Thanks to John Brockmeyer for the pointer.
101 Fixed vendor and product getting defined through the MODULE_PARM macro
102 if the Generic driver wasn't compiled in.
103 Fixed problem with generic_shutdown() not being called for drivers that
104 don't have a shutdown() function.
105
106 (06/06/2001) gkh
107 added evil hack that is needed for the prolific pl2303 device due to the
108 crazy way its endpoints are set up.
109
110 (05/30/2001) gkh
111 switched from using spinlock to a semaphore, which fixes lots of problems.
112
113 (04/08/2001) gb
114 Identify version on module load.
115
116 2001_02_05 gkh
117 Fixed buffer overflows bug with the generic serial driver. Thanks to
118 Todd Squires <squirest@ct0.com> for fixing this.
119
120 (01/10/2001) gkh
121 Fixed bug where the generic serial adaptor grabbed _any_ device that was
122 offered to it.
123
124 (12/12/2000) gkh
125 Removed MOD_INC and MOD_DEC from poll and disconnect functions, and
126 moved them to the serial_open and serial_close functions.
127 Also fixed bug with there not being a MOD_DEC for the generic driver
128 (thanks to Gary Brubaker for finding this.)
129
130 (11/29/2000) gkh
131 Small NULL pointer initialization cleanup which saves a bit of disk image
132
133 (11/01/2000) Adam J. Richter
134 instead of using idVendor/idProduct pairs, usb serial drivers
135 now identify their hardware interest with usb_device_id tables,
136 which they usually have anyhow for use with MODULE_DEVICE_TABLE.
137
138 (10/05/2000) gkh
139 Fixed bug with urb->dev not being set properly, now that the usb
140 core needs it.
141
142 (09/11/2000) gkh
143 Removed DEBUG #ifdefs with call to usb_serial_debug_data
144
145 (08/28/2000) gkh
146 Added port_lock to port structure.
147 Added locks for SMP safeness to generic driver
148 Fixed the ability to open a generic device's port more than once.
149
150 (07/23/2000) gkh
151 Added bulk_out_endpointAddress to port structure.
152
153 (07/19/2000) gkh, pberger, and borchers
154 Modifications to allow usb-serial drivers to be modules.
155
156 (07/03/2000) gkh
157 Added more debugging to serial_ioctl call
158
159 (06/25/2000) gkh
160 Changed generic_write_bulk_callback to not call wake_up_interruptible
161 directly, but to have port_softint do it at a safer time.
162
163 (06/23/2000) gkh
164 Cleaned up debugging statements in a quest to find UHCI timeout bug.
165
166 (05/22/2000) gkh
167 Changed the makefile, enabling the big CONFIG_USB_SERIAL_SOMTHING to be
168 removed from the individual device source files.
169
170 (05/03/2000) gkh
171 Added the Digi Acceleport driver from Al Borchers and Peter Berger.
172
173 (05/02/2000) gkh
174 Changed devfs and tty register code to work properly now. This was based on
175 the ACM driver changes by Vojtech Pavlik.
176
177 (04/27/2000) Ryan VanderBijl
178 Put calls to *_paranoia_checks into one function.
179
180 (04/23/2000) gkh
181 Fixed bug that Randy Dunlap found for Generic devices with no bulk out ports.
182 Moved when the startup code printed out the devices that are supported.
183
184 (04/19/2000) gkh
185 Added driver for ZyXEL omni.net lcd plus ISDN TA
186 Made startup info message specify which drivers were compiled in.
187
188 (04/03/2000) gkh
189 Changed the probe process to remove the module unload races.
190 Changed where the tty layer gets initialized to have devfs work nicer.
191 Added initial devfs support.
192
193 (03/26/2000) gkh
194 Split driver up into device specific pieces.
195
196 (03/19/2000) gkh
197 Fixed oops that could happen when device was removed while a program
198 was talking to the device.
199 Removed the static urbs and now all urbs are created and destroyed
200 dynamically.
201 Reworked the internal interface. Now everything is based on the
202 usb_serial_port structure instead of the larger usb_serial structure.
203 This fixes the bug that a multiport device could not have more than
204 one port open at one time.
205
206 (03/17/2000) gkh
207 Added config option for debugging messages.
208 Added patch for keyspan pda from Brian Warner.
209
210 (03/06/2000) gkh
211 Added the keyspan pda code from Brian Warner <warner@lothar.com>
212 Moved a bunch of the port specific stuff into its own structure. This
213 is in anticipation of the true multiport devices (there's a bug if you
214 try to access more than one port of any multiport device right now)
215
216 (02/21/2000) gkh
217 Made it so that any serial devices only have to specify which functions
218 they want to overload from the generic function calls (great,
219 inheritance in C, in a driver, just what I wanted...)
220 Added support for set_termios and ioctl function calls. No drivers take
221 advantage of this yet.
222 Removed the #ifdef MODULE, now there is no module specific code.
223 Cleaned up a few comments in usb-serial.h that were wrong (thanks again
224 to Miles Lott).
225 Small fix to get_free_serial.
226
227 (02/14/2000) gkh
228 Removed the Belkin and Peracom functionality from the driver due to
229 the lack of support from the vendor, and me not wanting people to
230 accidenatly buy the device, expecting it to work with Linux.
231 Added read_bulk_callback and write_bulk_callback to the type structure
232 for the needs of the FTDI and WhiteHEAT driver.
233 Changed all reverences to FTDI to FTDI_SIO at the request of Bill
234 Ryder.
235 Changed the output urb size back to the max endpoint size to make
236 the ftdi_sio driver have it easier, and due to the fact that it didn't
237 really increase the speed any.
238
239 (02/11/2000) gkh
240 Added VISOR_FUNCTION_CONSOLE to the visor startup function. This was a
241 patch from Miles Lott (milos@insync.net).
242 Fixed bug with not restoring the minor range that a device grabs, if
243 the startup function fails (thanks Miles for finding this).
244
245 (02/05/2000) gkh
246 Added initial framework for the Keyspan PDA serial converter so that
247 Brian Warner has a place to put his code.
248 Made the ezusb specific functions generic enough that different
249 devices can use them (whiteheat and keyspan_pda both need them).
250 Split out a whole bunch of structure and other stuff to a separate
251 usb-serial.h file.
252 Made the Visor connection messages a little more understandable, now
253 that Miles Lott (milos@insync.net) has gotten the Generic channel to
254 work. Also made them always show up in the log file.
255
256 (01/25/2000) gkh
257 Added initial framework for FTDI serial converter so that Bill Ryder
258 has a place to put his code.
259 Added the vendor specific info from Handspring. Now we can print out
260 informational debug messages as well as understand what is happening.
261
262 (01/23/2000) gkh
263 Fixed problem of crash when trying to open a port that didn't have a
264 device assigned to it. Made the minor node finding a little smarter,
265 now it looks to find a continuous space for the new device.
266
267 (01/21/2000) gkh
268 Fixed bug in visor_startup with patch from Miles Lott (milos@insync.net)
269 Fixed get_serial_by_minor which was all messed up for multi port
270 devices. Fixed multi port problem for generic devices. Now the number
271 of ports is determined by the number of bulk out endpoints for the
272 generic device.
273
274 (01/19/2000) gkh
275 Removed lots of cruft that was around from the old (pre urb) driver
276 interface.
277 Made the serial_table dynamic. This should save lots of memory when
278 the number of minor nodes goes up to 256.
279 Added initial support for devices that have more than one port.
280 Added more debugging comments for the Visor, and added a needed
281 set_configuration call.
282
283 (01/17/2000) gkh
284 Fixed the WhiteHEAT firmware (my processing tool had a bug)
285 and added new debug loader firmware for it.
286 Removed the put_char function as it isn't really needed.
287 Added visor startup commands as found by the Win98 dump.
288
289 (01/13/2000) gkh
290 Fixed the vendor id for the generic driver to the one I meant it to be.
291
292 (01/12/2000) gkh
293 Forget the version numbering...that's pretty useless...
294 Made the driver able to be compiled so that the user can select which
295 converter they want to use. This allows people who only want the Visor
296 support to not pay the memory size price of the WhiteHEAT.
297 Fixed bug where the generic driver (idVendor=0000 and idProduct=0000)
298 grabbed the root hub. Not good.
299
300 version 0.4.0 (01/10/2000) gkh
301 Added whiteheat.h containing the firmware for the ConnectTech WhiteHEAT
302 device. Added startup function to allow firmware to be downloaded to
303 a device if it needs to be.
304 Added firmware download logic to the WhiteHEAT device.
305 Started to add #defines to split up the different drivers for potential
306 configuration option.
307
308 version 0.3.1 (12/30/99) gkh
309 Fixed problems with urb for bulk out.
310 Added initial support for multiple sets of endpoints. This enables
311 the Handspring Visor to be attached successfully. Only the first
312 bulk in / bulk out endpoint pair is being used right now.
313
314 version 0.3.0 (12/27/99) gkh
315 Added initial support for the Handspring Visor based on a patch from
316 Miles Lott (milos@sneety.insync.net)
317 Cleaned up the code a bunch and converted over to using urbs only.
318
319 version 0.2.3 (12/21/99) gkh
320 Added initial support for the Connect Tech WhiteHEAT converter.
321 Incremented the number of ports in expectation of getting the
322 WhiteHEAT to work properly (4 ports per connection).
323 Added notification on insertion and removal of what port the
324 device is/was connected to (and what kind of device it was).
325
326 version 0.2.2 (12/16/99) gkh
327 Changed major number to the new allocated number. We're legal now!
328
329 version 0.2.1 (12/14/99) gkh
330 Fixed bug that happens when device node is opened when there isn't a
331 device attached to it. Thanks to marek@webdesign.no for noticing this.
332
333 version 0.2.0 (11/10/99) gkh
334 Split up internals to make it easier to add different types of serial
335 converters to the code.
336 Added a "generic" driver that gets it's vendor and product id
337 from when the module is loaded. Thanks to David E. Nelson (dnelson@jump.net)
338 for the idea and sample code (from the usb scanner driver.)
339 Cleared up any licensing questions by releasing it under the GNU GPL.
340
341 version 0.1.2 (10/25/99) gkh
342 Fixed bug in detecting device.
343
344 version 0.1.1 (10/05/99) gkh
345 Changed the major number to not conflict with anything else.
346
347 version 0.1 (09/28/99) gkh
348 Can recognize the two different devices and start up a read from
349 device when asked to. Writes also work. No control signals yet, this
350 all is vendor specific data (i.e. no spec), also no control for
351 different baud rates or other bit settings.
352 Currently we are using the same devid as the acm driver. This needs
353 to change.
354
355-----------------------------------------------------------------------
356visor.c Change Log comments:
357
358 (06/03/2003) Judd Montgomery <judd at jpilot.org>
359 Added support for module parameter options for untested/unknown
360 devices.
361
362 (03/09/2003) gkh
363 Added support for the Sony Clie NZ90V device. Thanks to Martin Brachtl
364 <brachtl@redgrep.cz> for the information.
365
366 (03/05/2003) gkh
367 Think Treo support is now working.
368
369 (04/03/2002) gkh
370 Added support for the Sony OS 4.1 devices. Thanks to Hiroyuki ARAKI
371 <hiro@zob.ne.jp> for the information.
372
373 (03/27/2002) gkh
374 Removed assumptions that port->tty was always valid (is not true
375 for usb serial console devices.)
376
377 (03/23/2002) gkh
378 Added support for the Palm i705 device, thanks to Thomas Riemer
379 <tom@netmech.com> for the information.
380
381 (03/21/2002) gkh
382 Added support for the Palm m130 device, thanks to Udo Eisenbarth
383 <udo.eisenbarth@web.de> for the information.
384
385 (02/27/2002) gkh
386 Reworked the urb handling logic. We have no more pool, but dynamically
387 allocate the urb and the transfer buffer on the fly. In testing this
388 does not incure any measurable overhead. This also relies on the fact
389 that we have proper reference counting logic for urbs.
390
391 (02/21/2002) SilaS
392 Added initial support for the Palm m515 devices.
393
394 (02/14/2002) gkh
395 Added support for the Clie S-360 device.
396
397 (12/18/2001) gkh
398 Added better Clie support for 3.5 devices. Thanks to Geoffrey Levand
399 for the patch.
400
401 (11/11/2001) gkh
402 Added support for the m125 devices, and added check to prevent oopses
403 for Clié devices that lie about the number of ports they have.
404
405 (08/30/2001) gkh
406 Added support for the Clie devices, both the 3.5 and 4.0 os versions.
407 Many thanks to Daniel Burke, and Bryan Payne for helping with this.
408
409 (08/23/2001) gkh
410 fixed a few potential bugs pointed out by Oliver Neukum.
411
412 (05/30/2001) gkh
413 switched from using spinlock to a semaphore, which fixes lots of problems.
414
415 (05/28/2000) gkh
416 Added initial support for the Palm m500 and Palm m505 devices.
417
418 (04/08/2001) gb
419 Identify version on module load.
420
421 (01/21/2000) gkh
422 Added write_room and chars_in_buffer, as they were previously using the
423 generic driver versions which is all wrong now that we are using an urb
424 pool. Thanks to Wolfgang Grandegger for pointing this out to me.
425 Removed count assignment in the write function, which was not needed anymore
426 either. Thanks to Al Borchers for pointing this out.
427
428 (12/12/2000) gkh
429 Moved MOD_DEC to end of visor_close to be nicer, as the final write
430 message can sleep.
431
432 (11/12/2000) gkh
433 Fixed bug with data being dropped on the floor by forcing tty->low_latency
434 to be on. Hopefully this fixes the OHCI issue!
435
436 (11/01/2000) Adam J. Richter
437 usb_device_id table support
438
439 (10/05/2000) gkh
440 Fixed bug with urb->dev not being set properly, now that the usb
441 core needs it.
442
443 (09/11/2000) gkh
444 Got rid of always calling kmalloc for every urb we wrote out to the
445 device.
446 Added visor_read_callback so we can keep track of bytes in and out for
447 those people who like to know the speed of their device.
448 Removed DEBUG #ifdefs with call to usb_serial_debug_data
449
450 (09/06/2000) gkh
451 Fixed oops in visor_exit. Need to uncomment usb_unlink_urb call _after_
452 the host controller drivers set urb->dev = NULL when the urb is finished.
453
454 (08/28/2000) gkh
455 Added locks for SMP safeness.
456
457 (08/08/2000) gkh
458 Fixed endian problem in visor_startup.
459 Fixed MOD_INC and MOD_DEC logic and the ability to open a port more
460 than once.
461
462 (07/23/2000) gkh
463 Added pool of write urbs to speed up transfers to the visor.
464
465 (07/19/2000) gkh
466 Added module_init and module_exit functions to handle the fact that this
467 driver is a loadable module now.
468
469 (07/03/2000) gkh
470 Added visor_set_ioctl and visor_set_termios functions (they don't do much
471 of anything, but are good for debugging.)
472
473 (06/25/2000) gkh
474 Fixed bug in visor_unthrottle that should help with the disconnect in PPP
475 bug that people have been reporting.
476
477 (06/23/2000) gkh
478 Cleaned up debugging statements in a quest to find UHCI timeout bug.
479
480 (04/27/2000) Ryan VanderBijl
481 Fixed memory leak in visor_close
482
483 (03/26/2000) gkh
484 Split driver up into device specific pieces.
485
486-----------------------------------------------------------------------
487pl2303.c Change Log comments:
488
489 2002_Mar_26 gkh
490 allowed driver to work properly if there is no tty assigned to a port
491 (this happens for serial console devices.)
492
493 2001_Oct_06 gkh
494 Added RTS and DTR line control. Thanks to joe@bndlg.de for parts of it.
495
496 2001_Sep_19 gkh
497 Added break support.
498
499 2001_Aug_30 gkh
500 fixed oops in write_bulk_callback.
501
502 2001_Aug_28 gkh
503 reworked buffer logic to be like other usb-serial drivers. Hopefully
504 removing some reported problems.
505
506 2001_Jun_06 gkh
507 finished porting to 2.4 format.
508
509
510-----------------------------------------------------------------------
511io_edgeport.c Change Log comments:
512
513 2003_04_03 al borchers
514 - fixed a bug (that shows up with dosemu) where the tty struct is
515 used in a callback after it has been freed
516
517 2.3 2002_03_08 greg kroah-hartman
518 - fixed bug when multiple devices were attached at the same time.
519
520 2.2 2001_11_14 greg kroah-hartman
521 - fixed bug in edge_close that kept the port from being used more
522 than once.
523 - fixed memory leak on device removal.
524 - fixed potential double free of memory when command urb submitting
525 failed.
526 - other small cleanups when the device is removed
527
528 2.1 2001_07_09 greg kroah-hartman
529 - added support for TIOCMBIS and TIOCMBIC.
530
531 (04/08/2001) gb
532 - Identify version on module load.
533
534 2.0 2001_03_05 greg kroah-hartman
535 - reworked entire driver to fit properly in with the other usb-serial
536 drivers. Occasional oopses still happen, but it's a good start.
537
538 1.2.3 (02/23/2001) greg kroah-hartman
539 - changed device table to work properly for 2.4.x final format.
540 - fixed problem with dropping data at high data rates.
541
542 1.2.2 (11/27/2000) greg kroah-hartman
543 - cleaned up more NTisms.
544 - Added device table for 2.4.0-test11
545
546 1.2.1 (11/08/2000) greg kroah-hartman
547 - Started to clean up NTisms.
548 - Fixed problem with dev field of urb for kernels >= 2.4.0-test9
549
550 1.2 (10/17/2000) David Iacovelli
551 Remove all EPIC code and GPL source
552 Fix RELEVANT_IFLAG macro to include flow control
553 changes port configuration changes.
554 Fix redefinition of SERIAL_MAGIC
555 Change all timeout values to 5 seconds
556 Tried to fix the UHCI multiple urb submission, but failed miserably.
557 it seems to work fine with OHCI.
558 ( Greg take a look at the #if 0 at end of WriteCmdUsb() we must
559 find a way to work arount this UHCI bug )
560
561 1.1 (10/11/2000) David Iacovelli
562 Fix XON/XOFF flow control to support both IXON and IXOFF
563
564 0.9.27 (06/30/2000) David Iacovelli
565 Added transmit queue and now allocate urb for command writes.
566
567 0.9.26 (06/29/2000) David Iacovelli
568 Add support for 80251 based edgeport
569
570 0.9.25 (06/27/2000) David Iacovelli
571 Do not close the port if it has multiple opens.
572
573 0.9.24 (05/26/2000) David Iacovelli
574 Add IOCTLs to support RXTX and JAVA POS
575 and first cut at running BlackBox Demo
576
577 0.9.23 (05/24/2000) David Iacovelli
578 Add IOCTLs to support RXTX and JAVA POS
579
580 0.9.22 (05/23/2000) David Iacovelli
581 fixed bug in enumeration. If epconfig turns on mapping by
582 path after a device is already plugged in, we now update
583 the mapping correctly
584
585 0.9.21 (05/16/2000) David Iacovelli
586 Added BlockUntilChaseResp() to also wait for txcredits
587 Updated the way we allocate and handle write URBs
588 Add debug code to dump buffers
589
590 0.9.20 (05/01/2000) David Iacovelli
591 change driver to use usb/tts/
592
593 0.9.19 (05/01/2000) David Iacovelli
594 Update code to compile if DEBUG is off
595
596 0.9.18 (04/28/2000) David Iacovelli
597 cleanup and test tty_register with devfs
598
599 0.9.17 (04/27/2000) greg kroah-hartman
600 changed tty_register around to be like the way it
601 was before, but now it works properly with devfs.
602
603 0.9.16 (04/26/2000) david iacovelli
604 Fixed bug in GetProductInfo()
605
606 0.9.15 (04/25/2000) david iacovelli
607 Updated enumeration
608
609 0.9.14 (04/24/2000) david iacovelli
610 Removed all config/status IOCTLS and
611 converted to using /proc/edgeport
612 still playing with devfs
613
614 0.9.13 (04/24/2000) david iacovelli
615 Removed configuration based on ttyUSB0
616 Added support for configuration using /prod/edgeport
617 first attempt at using devfs (not working yet!)
618 Added IOCTL to GetProductInfo()
619 Added support for custom baud rates
620 Add support for random port numbers
621
622 0.9.12 (04/18/2000) david iacovelli
623 added additional configuration IOCTLs
624 use ttyUSB0 for configuration
625
626 0.9.11 (04/17/2000) greg kroah-hartman
627 fixed module initialization race conditions.
628 made all urbs dynamically allocated.
629 made driver devfs compatible. now it only registers the tty device
630 when the device is actually plugged in.
631
632 0.9.10 (04/13/2000) greg kroah-hartman
633 added proc interface framework.
634
635 0.9.9 (04/13/2000) david iacovelli
636 added enumeration code and ioctls to configure the device
637
638 0.9.8 (04/12/2000) david iacovelli
639 Change interrupt read start when device is plugged in
640 and stop when device is removed
641 process interrupt reads when all ports are closed
642 (keep value of rxBytesAvail consistent with the edgeport)
643 set the USB_BULK_QUEUE flag so that we can shove a bunch
644 of urbs at once down the pipe
645
646 0.9.7 (04/10/2000) david iacovelli
647 start to add enumeration code.
648 generate serial number for epic devices
649 add support for kdb
650
651 0.9.6 (03/30/2000) david iacovelli
652 add IOCTL to get string, manufacture, and boot descriptors
653
654 0.9.5 (03/14/2000) greg kroah-hartman
655 more error checking added to SerialOpen to try to fix UHCI open problem
656
657 0.9.4 (03/09/2000) greg kroah-hartman
658 added more error checking to handle oops when data is hanging
659 around and tty is abruptly closed.
660
661 0.9.3 (03/09/2000) david iacovelli
662 Add epic support for xon/xoff chars
663 play with performance
664
665 0.9.2 (03/08/2000) greg kroah-hartman
666 changed most "info" calls to "dbg"
667 implemented flow control properly in the termios call
668
669 0.9.1 (03/08/2000) david iacovelli
670 added EPIC support
671 enabled bootloader update
672
673 0.9 (03/08/2000) greg kroah-hartman
674 Release to IO networks.
675 Integrated changes that David made
676 made getting urbs for writing SMP safe
677
678 0.8 (03/07/2000) greg kroah-hartman
679 Release to IO networks.
680 Fixed problems that were seen in code by David.
681 Now both Edgeport/4 and Edgeport/2 works properly.
682 Changed most of the functions to use port instead of serial.
683
684 0.7 (02/27/2000) greg kroah-hartman
685 Milestone 3 release.
686 Release to IO Networks
687 ioctl for waiting on line change implemented.
688 ioctl for getting statistics implemented.
689 multiport support working.
690 lsr and msr registers are now handled properly.
691 change break now hooked up and working.
692 support for all known Edgeport devices.
693
694 0.6 (02/22/2000) greg kroah-hartman
695 Release to IO networks.
696 CHASE is implemented correctly when port is closed.
697 SerialOpen now blocks correctly until port is fully opened.
698
699 0.5 (02/20/2000) greg kroah-hartman
700 Release to IO networks.
701 Known problems:
702 modem status register changes are not sent on to the user
703 CHASE is not implemented when the port is closed.
704
705 0.4 (02/16/2000) greg kroah-hartman
706 Second cut at the CeBit demo.
707 Doesn't leak memory on every write to the port
708 Still small leaks on startup.
709 Added support for Edgeport/2 and Edgeport/8
710
711 0.3 (02/15/2000) greg kroah-hartman
712 CeBit demo release.
713 Force the line settings to 4800, 8, 1, e for the demo.
714 Warning! This version leaks memory like crazy!
715
716 0.2 (01/30/2000) greg kroah-hartman
717 Milestone 1 release.
718 Device is found by USB subsystem, enumerated, fimware is downloaded
719 and the descriptors are printed to the debug log, config is set, and
720 green light starts to blink. Open port works, and data can be sent
721 and received at the default settings of the UART. Loopback connector
722 and debug log confirms this.
723
724 0.1 (01/23/2000) greg kroah-hartman
725 Initial release to help IO Networks try to set up their test system.
726 Edgeport4 is recognized, firmware is downloaded, config is set so
727 device blinks green light every 3 sec. Port is bound, but opening,
728 closing, and sending data do not work properly.
729
730
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 9438909e87a5..7b5e8e4ee2bb 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -394,6 +394,15 @@ config USB_SERIAL_MCT_U232
394 To compile this driver as a module, choose M here: the 394 To compile this driver as a module, choose M here: the
395 module will be called mct_u232. 395 module will be called mct_u232.
396 396
397config USB_SERIAL_NOKIA_DKU2
398 tristate "USB Nokia DKU2 Driver"
399 depends on USB_SERIAL
400 help
401 Say Y here if you want to use a Nokia DKU2 device.
402
403 To compile this driver as a module, choose M here: the
404 module will be called nokia_dku2.
405
397config USB_SERIAL_PL2303 406config USB_SERIAL_PL2303
398 tristate "USB Prolific 2303 Single Port Serial Driver" 407 tristate "USB Prolific 2303 Single Port Serial Driver"
399 depends on USB_SERIAL 408 depends on USB_SERIAL
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 6c7cdcc99a9e..55fd461793b7 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_USB_SERIAL_KEYSPAN_PDA) += keyspan_pda.o
31obj-$(CONFIG_USB_SERIAL_KLSI) += kl5kusb105.o 31obj-$(CONFIG_USB_SERIAL_KLSI) += kl5kusb105.o
32obj-$(CONFIG_USB_SERIAL_KOBIL_SCT) += kobil_sct.o 32obj-$(CONFIG_USB_SERIAL_KOBIL_SCT) += kobil_sct.o
33obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o 33obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o
34obj-$(CONFIG_USB_SERIAL_NOKIA_DKU2) += nokia_dku2.o
34obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o 35obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o
35obj-$(CONFIG_USB_SERIAL_OPTION) += option.o 36obj-$(CONFIG_USB_SERIAL_OPTION) += option.o
36obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o 37obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c
index 926d4c2c1600..1f29d8837327 100644
--- a/drivers/usb/serial/airprime.c
+++ b/drivers/usb/serial/airprime.c
@@ -30,9 +30,11 @@ static struct usb_driver airprime_driver = {
30 .id_table = id_table, 30 .id_table = id_table,
31}; 31};
32 32
33static struct usb_serial_device_type airprime_device = { 33static struct usb_serial_driver airprime_device = {
34 .owner = THIS_MODULE, 34 .driver = {
35 .name = "airprime", 35 .owner = THIS_MODULE,
36 .name = "airprime",
37 },
36 .id_table = id_table, 38 .id_table = id_table,
37 .num_interrupt_in = NUM_DONT_CARE, 39 .num_interrupt_in = NUM_DONT_CARE,
38 .num_bulk_in = NUM_DONT_CARE, 40 .num_bulk_in = NUM_DONT_CARE,
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index abb1b2c543bb..84bc0ee4f061 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -121,10 +121,12 @@ static struct usb_driver belkin_driver = {
121}; 121};
122 122
123/* All of the device info needed for the serial converters */ 123/* All of the device info needed for the serial converters */
124static struct usb_serial_device_type belkin_device = { 124static struct usb_serial_driver belkin_device = {
125 .owner = THIS_MODULE, 125 .driver = {
126 .name = "Belkin / Peracom / GoHubs USB Serial Adapter", 126 .owner = THIS_MODULE,
127 .short_name = "belkin", 127 .name = "belkin",
128 },
129 .description = "Belkin / Peracom / GoHubs USB Serial Adapter",
128 .id_table = id_table_combined, 130 .id_table = id_table_combined,
129 .num_interrupt_in = 1, 131 .num_interrupt_in = 1,
130 .num_bulk_in = 1, 132 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index 2f612c2d894b..664139afcfa9 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -18,7 +18,7 @@
18 18
19static int usb_serial_device_match (struct device *dev, struct device_driver *drv) 19static int usb_serial_device_match (struct device *dev, struct device_driver *drv)
20{ 20{
21 struct usb_serial_device_type *driver; 21 struct usb_serial_driver *driver;
22 const struct usb_serial_port *port; 22 const struct usb_serial_port *port;
23 23
24 /* 24 /*
@@ -44,7 +44,7 @@ struct bus_type usb_serial_bus_type = {
44 44
45static int usb_serial_device_probe (struct device *dev) 45static int usb_serial_device_probe (struct device *dev)
46{ 46{
47 struct usb_serial_device_type *driver; 47 struct usb_serial_driver *driver;
48 struct usb_serial_port *port; 48 struct usb_serial_port *port;
49 int retval = 0; 49 int retval = 0;
50 int minor; 50 int minor;
@@ -57,13 +57,13 @@ static int usb_serial_device_probe (struct device *dev)
57 57
58 driver = port->serial->type; 58 driver = port->serial->type;
59 if (driver->port_probe) { 59 if (driver->port_probe) {
60 if (!try_module_get(driver->owner)) { 60 if (!try_module_get(driver->driver.owner)) {
61 dev_err(dev, "module get failed, exiting\n"); 61 dev_err(dev, "module get failed, exiting\n");
62 retval = -EIO; 62 retval = -EIO;
63 goto exit; 63 goto exit;
64 } 64 }
65 retval = driver->port_probe (port); 65 retval = driver->port_probe (port);
66 module_put(driver->owner); 66 module_put(driver->driver.owner);
67 if (retval) 67 if (retval)
68 goto exit; 68 goto exit;
69 } 69 }
@@ -72,7 +72,7 @@ static int usb_serial_device_probe (struct device *dev)
72 tty_register_device (usb_serial_tty_driver, minor, dev); 72 tty_register_device (usb_serial_tty_driver, minor, dev);
73 dev_info(&port->serial->dev->dev, 73 dev_info(&port->serial->dev->dev,
74 "%s converter now attached to ttyUSB%d\n", 74 "%s converter now attached to ttyUSB%d\n",
75 driver->name, minor); 75 driver->description, minor);
76 76
77exit: 77exit:
78 return retval; 78 return retval;
@@ -80,7 +80,7 @@ exit:
80 80
81static int usb_serial_device_remove (struct device *dev) 81static int usb_serial_device_remove (struct device *dev)
82{ 82{
83 struct usb_serial_device_type *driver; 83 struct usb_serial_driver *driver;
84 struct usb_serial_port *port; 84 struct usb_serial_port *port;
85 int retval = 0; 85 int retval = 0;
86 int minor; 86 int minor;
@@ -92,43 +92,38 @@ static int usb_serial_device_remove (struct device *dev)
92 92
93 driver = port->serial->type; 93 driver = port->serial->type;
94 if (driver->port_remove) { 94 if (driver->port_remove) {
95 if (!try_module_get(driver->owner)) { 95 if (!try_module_get(driver->driver.owner)) {
96 dev_err(dev, "module get failed, exiting\n"); 96 dev_err(dev, "module get failed, exiting\n");
97 retval = -EIO; 97 retval = -EIO;
98 goto exit; 98 goto exit;
99 } 99 }
100 retval = driver->port_remove (port); 100 retval = driver->port_remove (port);
101 module_put(driver->owner); 101 module_put(driver->driver.owner);
102 } 102 }
103exit: 103exit:
104 minor = port->number; 104 minor = port->number;
105 tty_unregister_device (usb_serial_tty_driver, minor); 105 tty_unregister_device (usb_serial_tty_driver, minor);
106 dev_info(dev, "%s converter now disconnected from ttyUSB%d\n", 106 dev_info(dev, "%s converter now disconnected from ttyUSB%d\n",
107 driver->name, minor); 107 driver->description, minor);
108 108
109 return retval; 109 return retval;
110} 110}
111 111
112int usb_serial_bus_register(struct usb_serial_device_type *device) 112int usb_serial_bus_register(struct usb_serial_driver *driver)
113{ 113{
114 int retval; 114 int retval;
115 115
116 if (device->short_name) 116 driver->driver.bus = &usb_serial_bus_type;
117 device->driver.name = (char *)device->short_name; 117 driver->driver.probe = usb_serial_device_probe;
118 else 118 driver->driver.remove = usb_serial_device_remove;
119 device->driver.name = (char *)device->name;
120 device->driver.bus = &usb_serial_bus_type;
121 device->driver.probe = usb_serial_device_probe;
122 device->driver.remove = usb_serial_device_remove;
123 device->driver.owner = device->owner;
124 119
125 retval = driver_register(&device->driver); 120 retval = driver_register(&driver->driver);
126 121
127 return retval; 122 return retval;
128} 123}
129 124
130void usb_serial_bus_deregister(struct usb_serial_device_type *device) 125void usb_serial_bus_deregister(struct usb_serial_driver *driver)
131{ 126{
132 driver_unregister (&device->driver); 127 driver_unregister(&driver->driver);
133} 128}
134 129
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index 97c78c21e8d1..c5334dd89b12 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -67,15 +67,17 @@ MODULE_DEVICE_TABLE (usb, id_table);
67 67
68static struct usb_driver cp2101_driver = { 68static struct usb_driver cp2101_driver = {
69 .owner = THIS_MODULE, 69 .owner = THIS_MODULE,
70 .name = "CP2101", 70 .name = "cp2101",
71 .probe = usb_serial_probe, 71 .probe = usb_serial_probe,
72 .disconnect = usb_serial_disconnect, 72 .disconnect = usb_serial_disconnect,
73 .id_table = id_table, 73 .id_table = id_table,
74}; 74};
75 75
76static struct usb_serial_device_type cp2101_device = { 76static struct usb_serial_driver cp2101_device = {
77 .owner = THIS_MODULE, 77 .driver = {
78 .name = "CP2101", 78 .owner = THIS_MODULE,
79 .name = "cp2101",
80 },
79 .id_table = id_table, 81 .id_table = id_table,
80 .num_interrupt_in = 0, 82 .num_interrupt_in = 0,
81 .num_bulk_in = 0, 83 .num_bulk_in = 0,
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index b5b431067b08..e581e4ae8483 100644
--- a/drivers/usb/serial/cyberjack.c
+++ b/drivers/usb/serial/cyberjack.c
@@ -83,10 +83,12 @@ static struct usb_driver cyberjack_driver = {
83 .id_table = id_table, 83 .id_table = id_table,
84}; 84};
85 85
86static struct usb_serial_device_type cyberjack_device = { 86static struct usb_serial_driver cyberjack_device = {
87 .owner = THIS_MODULE, 87 .driver = {
88 .name = "Reiner SCT Cyberjack USB card reader", 88 .owner = THIS_MODULE,
89 .short_name = "cyberjack", 89 .name = "cyberjack",
90 },
91 .description = "Reiner SCT Cyberjack USB card reader",
90 .id_table = id_table, 92 .id_table = id_table,
91 .num_interrupt_in = 1, 93 .num_interrupt_in = 1,
92 .num_bulk_in = 1, 94 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 9ee1aaff2fcd..af9290ed257b 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -176,10 +176,12 @@ static unsigned int cypress_buf_put(struct cypress_buf *cb, const char *buf, u
176static unsigned int cypress_buf_get(struct cypress_buf *cb, char *buf, unsigned int count); 176static unsigned int cypress_buf_get(struct cypress_buf *cb, char *buf, unsigned int count);
177 177
178 178
179static struct usb_serial_device_type cypress_earthmate_device = { 179static struct usb_serial_driver cypress_earthmate_device = {
180 .owner = THIS_MODULE, 180 .driver = {
181 .name = "DeLorme Earthmate USB", 181 .owner = THIS_MODULE,
182 .short_name = "earthmate", 182 .name = "earthmate",
183 },
184 .description = "DeLorme Earthmate USB",
183 .id_table = id_table_earthmate, 185 .id_table = id_table_earthmate,
184 .num_interrupt_in = 1, 186 .num_interrupt_in = 1,
185 .num_interrupt_out = 1, 187 .num_interrupt_out = 1,
@@ -203,10 +205,12 @@ static struct usb_serial_device_type cypress_earthmate_device = {
203 .write_int_callback = cypress_write_int_callback, 205 .write_int_callback = cypress_write_int_callback,
204}; 206};
205 207
206static struct usb_serial_device_type cypress_hidcom_device = { 208static struct usb_serial_driver cypress_hidcom_device = {
207 .owner = THIS_MODULE, 209 .driver = {
208 .name = "HID->COM RS232 Adapter", 210 .owner = THIS_MODULE,
209 .short_name = "cyphidcom", 211 .name = "cyphidcom",
212 },
213 .description = "HID->COM RS232 Adapter",
210 .id_table = id_table_cyphidcomrs232, 214 .id_table = id_table_cyphidcomrs232,
211 .num_interrupt_in = 1, 215 .num_interrupt_in = 1,
212 .num_interrupt_out = 1, 216 .num_interrupt_out = 1,
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index a19a47f6cf12..dc74644a603d 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -503,10 +503,12 @@ static struct usb_driver digi_driver = {
503 503
504/* device info needed for the Digi serial converter */ 504/* device info needed for the Digi serial converter */
505 505
506static struct usb_serial_device_type digi_acceleport_2_device = { 506static struct usb_serial_driver digi_acceleport_2_device = {
507 .owner = THIS_MODULE, 507 .driver = {
508 .name = "Digi 2 port USB adapter", 508 .owner = THIS_MODULE,
509 .short_name = "digi_2", 509 .name = "digi_2",
510 },
511 .description = "Digi 2 port USB adapter",
510 .id_table = id_table_2, 512 .id_table = id_table_2,
511 .num_interrupt_in = 0, 513 .num_interrupt_in = 0,
512 .num_bulk_in = 4, 514 .num_bulk_in = 4,
@@ -530,10 +532,12 @@ static struct usb_serial_device_type digi_acceleport_2_device = {
530 .shutdown = digi_shutdown, 532 .shutdown = digi_shutdown,
531}; 533};
532 534
533static struct usb_serial_device_type digi_acceleport_4_device = { 535static struct usb_serial_driver digi_acceleport_4_device = {
534 .owner = THIS_MODULE, 536 .driver = {
535 .name = "Digi 4 port USB adapter", 537 .owner = THIS_MODULE,
536 .short_name = "digi_4", 538 .name = "digi_4",
539 },
540 .description = "Digi 4 port USB adapter",
537 .id_table = id_table_4, 541 .id_table = id_table_4,
538 .num_interrupt_in = 0, 542 .num_interrupt_in = 0,
539 .num_bulk_in = 5, 543 .num_bulk_in = 5,
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
index 8d562ab454a8..0b0546dcc7b9 100644
--- a/drivers/usb/serial/empeg.c
+++ b/drivers/usb/serial/empeg.c
@@ -112,9 +112,11 @@ static struct usb_driver empeg_driver = {
112 .id_table = id_table, 112 .id_table = id_table,
113}; 113};
114 114
115static struct usb_serial_device_type empeg_device = { 115static struct usb_serial_driver empeg_device = {
116 .owner = THIS_MODULE, 116 .driver = {
117 .name = "Empeg", 117 .owner = THIS_MODULE,
118 .name = "empeg",
119 },
118 .id_table = id_table, 120 .id_table = id_table,
119 .num_interrupt_in = 0, 121 .num_interrupt_in = 0,
120 .num_bulk_in = 1, 122 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 5a8631c8a4a7..61204bf7cd78 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -411,6 +411,8 @@ static struct usb_device_id id_table_combined [] = {
411 { USB_DEVICE(FTDI_VID, FTDI_ELV_UM100_PID) }, 411 { USB_DEVICE(FTDI_VID, FTDI_ELV_UM100_PID) },
412 { USB_DEVICE(FTDI_VID, FTDI_ELV_UR100_PID) }, 412 { USB_DEVICE(FTDI_VID, FTDI_ELV_UR100_PID) },
413 { USB_DEVICE(FTDI_VID, FTDI_ELV_ALC8500_PID) }, 413 { USB_DEVICE(FTDI_VID, FTDI_ELV_ALC8500_PID) },
414 { USB_DEVICE(FTDI_VID, FTDI_PYRAMID_PID) },
415 { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1000PC_PID) },
414 /* 416 /*
415 * These will probably use user-space drivers. Uncomment them if 417 * These will probably use user-space drivers. Uncomment them if
416 * you need them or use the user-specified vendor/product module 418 * you need them or use the user-specified vendor/product module
@@ -428,7 +430,6 @@ static struct usb_device_id id_table_combined [] = {
428 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_T1100_PID) }, */ 430 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_T1100_PID) }, */
429 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_PCD200_PID) }, */ 431 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_PCD200_PID) }, */
430 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_ULA200_PID) }, */ 432 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_ULA200_PID) }, */
431 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1000PC_PID) }, */
432 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_CSI8_PID) }, */ 433 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_CSI8_PID) }, */
433 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_EM1000DL_PID) }, */ 434 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_EM1000DL_PID) }, */
434 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_PCK100_PID) }, */ 435 /* { USB_DEVICE(FTDI_VID, FTDI_ELV_PCK100_PID) }, */
@@ -471,6 +472,9 @@ static struct usb_device_id id_table_combined [] = {
471 { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) }, 472 { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) },
472 { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) }, 473 { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) },
473 { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, 474 { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) },
475 { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) },
476 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) },
477 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) },
474 { }, /* Optional parameter entry */ 478 { }, /* Optional parameter entry */
475 { } /* Terminating entry */ 479 { } /* Terminating entry */
476}; 480};
@@ -558,10 +562,12 @@ static unsigned short int ftdi_232am_baud_to_divisor (int baud);
558static __u32 ftdi_232bm_baud_base_to_divisor (int baud, int base); 562static __u32 ftdi_232bm_baud_base_to_divisor (int baud, int base);
559static __u32 ftdi_232bm_baud_to_divisor (int baud); 563static __u32 ftdi_232bm_baud_to_divisor (int baud);
560 564
561static struct usb_serial_device_type ftdi_sio_device = { 565static struct usb_serial_driver ftdi_sio_device = {
562 .owner = THIS_MODULE, 566 .driver = {
563 .name = "FTDI USB Serial Device", 567 .owner = THIS_MODULE,
564 .short_name = "ftdi_sio", 568 .name = "ftdi_sio",
569 },
570 .description = "FTDI USB Serial Device",
565 .id_table = id_table_combined, 571 .id_table = id_table_combined,
566 .num_interrupt_in = 0, 572 .num_interrupt_in = 0,
567 .num_bulk_in = 1, 573 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 2c35d74cc6d6..ddb63df31ce6 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -199,6 +199,19 @@
199#define FTDI_PIEGROUP_PID 0xF208 /* Product Id */ 199#define FTDI_PIEGROUP_PID 0xF208 /* Product Id */
200 200
201/* 201/*
202 * Definitions for Artemis astronomical USB based cameras
203 * Check it at http://www.artemisccd.co.uk/
204 */
205#define FTDI_ARTEMIS_PID 0xDF28 /* All Artemis Cameras */
206
207/*
208 * Definitions for ATIK Instruments astronomical USB based cameras
209 * Check it at http://www.atik-instruments.com/
210 */
211#define FTDI_ATIK_ATK16_PID 0xDF30 /* ATIK ATK-16 Camera */
212#define FTDI_ATIK_ATK16HR_PID 0xDF31 /* ATIK ATK-16HR Camera */
213
214/*
202 * Protego product ids 215 * Protego product ids
203 */ 216 */
204#define PROTEGO_SPECIAL_1 0xFC70 /* special/unknown device */ 217#define PROTEGO_SPECIAL_1 0xFC70 /* special/unknown device */
@@ -329,6 +342,9 @@
329#define EVOLUTION_VID 0xDEEE /* Vendor ID */ 342#define EVOLUTION_VID 0xDEEE /* Vendor ID */
330#define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */ 343#define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */
331 344
345/* Pyramid Computer GmbH */
346#define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */
347
332/* Commands */ 348/* Commands */
333#define FTDI_SIO_RESET 0 /* Reset the port */ 349#define FTDI_SIO_RESET 0 /* Reset the port */
334#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ 350#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 2ef614d5c8f2..35820bda7ae1 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1468,16 +1468,13 @@ static void garmin_shutdown (struct usb_serial *serial)
1468} 1468}
1469 1469
1470 1470
1471
1472
1473
1474
1475
1476/* All of the device info needed */ 1471/* All of the device info needed */
1477static struct usb_serial_device_type garmin_device = { 1472static struct usb_serial_driver garmin_device = {
1478 .owner = THIS_MODULE, 1473 .driver = {
1479 .name = "Garmin GPS usb/tty", 1474 .owner = THIS_MODULE,
1480 .short_name = "garmin_gps", 1475 .name = "garmin_gps",
1476 },
1477 .description = "Garmin GPS usb/tty",
1481 .id_table = id_table, 1478 .id_table = id_table,
1482 .num_interrupt_in = 1, 1479 .num_interrupt_in = 1,
1483 .num_bulk_in = 1, 1480 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 5f7d3193d355..8909208f506a 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -36,10 +36,11 @@ MODULE_PARM_DESC(product, "User specified USB idProduct");
36static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */ 36static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */
37 37
38/* All of the device info needed for the Generic Serial Converter */ 38/* All of the device info needed for the Generic Serial Converter */
39struct usb_serial_device_type usb_serial_generic_device = { 39struct usb_serial_driver usb_serial_generic_device = {
40 .owner = THIS_MODULE, 40 .driver = {
41 .name = "Generic", 41 .owner = THIS_MODULE,
42 .short_name = "generic", 42 .name = "generic",
43 },
43 .id_table = generic_device_ids, 44 .id_table = generic_device_ids,
44 .num_interrupt_in = NUM_DONT_CARE, 45 .num_interrupt_in = NUM_DONT_CARE,
45 .num_bulk_in = NUM_DONT_CARE, 46 .num_bulk_in = NUM_DONT_CARE,
diff --git a/drivers/usb/serial/hp4x.c b/drivers/usb/serial/hp4x.c
index 64d55fbd206e..8eadfb705601 100644
--- a/drivers/usb/serial/hp4x.c
+++ b/drivers/usb/serial/hp4x.c
@@ -38,15 +38,17 @@ MODULE_DEVICE_TABLE(usb, id_table);
38 38
39static struct usb_driver hp49gp_driver = { 39static struct usb_driver hp49gp_driver = {
40 .owner = THIS_MODULE, 40 .owner = THIS_MODULE,
41 .name = "HP4X", 41 .name = "hp4X",
42 .probe = usb_serial_probe, 42 .probe = usb_serial_probe,
43 .disconnect = usb_serial_disconnect, 43 .disconnect = usb_serial_disconnect,
44 .id_table = id_table, 44 .id_table = id_table,
45}; 45};
46 46
47static struct usb_serial_device_type hp49gp_device = { 47static struct usb_serial_driver hp49gp_device = {
48 .owner = THIS_MODULE, 48 .driver = {
49 .name = "HP4X", 49 .owner = THIS_MODULE,
50 .name = "hp4X",
51 },
50 .id_table = id_table, 52 .id_table = id_table,
51 .num_interrupt_in = NUM_DONT_CARE, 53 .num_interrupt_in = NUM_DONT_CARE,
52 .num_bulk_in = NUM_DONT_CARE, 54 .num_bulk_in = NUM_DONT_CARE,
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 04bfe279d763..dc4c498bd1ed 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -27,225 +27,6 @@
27 * Networks technical support, or Peter Berger <pberger@brimson.com>, 27 * Networks technical support, or Peter Berger <pberger@brimson.com>,
28 * or Al Borchers <alborchers@steinerpoint.com>. 28 * or Al Borchers <alborchers@steinerpoint.com>.
29 * 29 *
30 * Version history:
31 *
32 * 2003_04_03 al borchers
33 * - fixed a bug (that shows up with dosemu) where the tty struct is
34 * used in a callback after it has been freed
35 *
36 * 2.3 2002_03_08 greg kroah-hartman
37 * - fixed bug when multiple devices were attached at the same time.
38 *
39 * 2.2 2001_11_14 greg kroah-hartman
40 * - fixed bug in edge_close that kept the port from being used more
41 * than once.
42 * - fixed memory leak on device removal.
43 * - fixed potential double free of memory when command urb submitting
44 * failed.
45 * - other small cleanups when the device is removed
46 *
47 * 2.1 2001_07_09 greg kroah-hartman
48 * - added support for TIOCMBIS and TIOCMBIC.
49 *
50 * (04/08/2001) gb
51 * - Identify version on module load.
52 *
53 * 2.0 2001_03_05 greg kroah-hartman
54 * - reworked entire driver to fit properly in with the other usb-serial
55 * drivers. Occasional oopses still happen, but it's a good start.
56 *
57 * 1.2.3 (02/23/2001) greg kroah-hartman
58 * - changed device table to work properly for 2.4.x final format.
59 * - fixed problem with dropping data at high data rates.
60 *
61 * 1.2.2 (11/27/2000) greg kroah-hartman
62 * - cleaned up more NTisms.
63 * - Added device table for 2.4.0-test11
64 *
65 * 1.2.1 (11/08/2000) greg kroah-hartman
66 * - Started to clean up NTisms.
67 * - Fixed problem with dev field of urb for kernels >= 2.4.0-test9
68 *
69 * 1.2 (10/17/2000) David Iacovelli
70 * Remove all EPIC code and GPL source
71 * Fix RELEVANT_IFLAG macro to include flow control
72 * changes port configuration changes.
73 * Fix redefinition of SERIAL_MAGIC
74 * Change all timeout values to 5 seconds
75 * Tried to fix the UHCI multiple urb submission, but failed miserably.
76 * it seems to work fine with OHCI.
77 * ( Greg take a look at the #if 0 at end of WriteCmdUsb() we must
78 * find a way to work arount this UHCI bug )
79 *
80 * 1.1 (10/11/2000) David Iacovelli
81 * Fix XON/XOFF flow control to support both IXON and IXOFF
82 *
83 * 0.9.27 (06/30/2000) David Iacovelli
84 * Added transmit queue and now allocate urb for command writes.
85 *
86 * 0.9.26 (06/29/2000) David Iacovelli
87 * Add support for 80251 based edgeport
88 *
89 * 0.9.25 (06/27/2000) David Iacovelli
90 * Do not close the port if it has multiple opens.
91 *
92 * 0.9.24 (05/26/2000) David Iacovelli
93 * Add IOCTLs to support RXTX and JAVA POS
94 * and first cut at running BlackBox Demo
95 *
96 * 0.9.23 (05/24/2000) David Iacovelli
97 * Add IOCTLs to support RXTX and JAVA POS
98 *
99 * 0.9.22 (05/23/2000) David Iacovelli
100 * fixed bug in enumeration. If epconfig turns on mapping by
101 * path after a device is already plugged in, we now update
102 * the mapping correctly
103 *
104 * 0.9.21 (05/16/2000) David Iacovelli
105 * Added BlockUntilChaseResp() to also wait for txcredits
106 * Updated the way we allocate and handle write URBs
107 * Add debug code to dump buffers
108 *
109 * 0.9.20 (05/01/2000) David Iacovelli
110 * change driver to use usb/tts/
111 *
112 * 0.9.19 (05/01/2000) David Iacovelli
113 * Update code to compile if DEBUG is off
114 *
115 * 0.9.18 (04/28/2000) David Iacovelli
116 * cleanup and test tty_register with devfs
117 *
118 * 0.9.17 (04/27/2000) greg kroah-hartman
119 * changed tty_register around to be like the way it
120 * was before, but now it works properly with devfs.
121 *
122 * 0.9.16 (04/26/2000) david iacovelli
123 * Fixed bug in GetProductInfo()
124 *
125 * 0.9.15 (04/25/2000) david iacovelli
126 * Updated enumeration
127 *
128 * 0.9.14 (04/24/2000) david iacovelli
129 * Removed all config/status IOCTLS and
130 * converted to using /proc/edgeport
131 * still playing with devfs
132 *
133 * 0.9.13 (04/24/2000) david iacovelli
134 * Removed configuration based on ttyUSB0
135 * Added support for configuration using /prod/edgeport
136 * first attempt at using devfs (not working yet!)
137 * Added IOCTL to GetProductInfo()
138 * Added support for custom baud rates
139 * Add support for random port numbers
140 *
141 * 0.9.12 (04/18/2000) david iacovelli
142 * added additional configuration IOCTLs
143 * use ttyUSB0 for configuration
144 *
145 * 0.9.11 (04/17/2000) greg kroah-hartman
146 * fixed module initialization race conditions.
147 * made all urbs dynamically allocated.
148 * made driver devfs compatible. now it only registers the tty device
149 * when the device is actually plugged in.
150 *
151 * 0.9.10 (04/13/2000) greg kroah-hartman
152 * added proc interface framework.
153 *
154 * 0.9.9 (04/13/2000) david iacovelli
155 * added enumeration code and ioctls to configure the device
156 *
157 * 0.9.8 (04/12/2000) david iacovelli
158 * Change interrupt read start when device is plugged in
159 * and stop when device is removed
160 * process interrupt reads when all ports are closed
161 * (keep value of rxBytesAvail consistent with the edgeport)
162 * set the USB_BULK_QUEUE flag so that we can shove a bunch
163 * of urbs at once down the pipe
164 *
165 * 0.9.7 (04/10/2000) david iacovelli
166 * start to add enumeration code.
167 * generate serial number for epic devices
168 * add support for kdb
169 *
170 * 0.9.6 (03/30/2000) david iacovelli
171 * add IOCTL to get string, manufacture, and boot descriptors
172 *
173 * 0.9.5 (03/14/2000) greg kroah-hartman
174 * more error checking added to SerialOpen to try to fix UHCI open problem
175 *
176 * 0.9.4 (03/09/2000) greg kroah-hartman
177 * added more error checking to handle oops when data is hanging
178 * around and tty is abruptly closed.
179 *
180 * 0.9.3 (03/09/2000) david iacovelli
181 * Add epic support for xon/xoff chars
182 * play with performance
183 *
184 * 0.9.2 (03/08/2000) greg kroah-hartman
185 * changed most "info" calls to "dbg"
186 * implemented flow control properly in the termios call
187 *
188 * 0.9.1 (03/08/2000) david iacovelli
189 * added EPIC support
190 * enabled bootloader update
191 *
192 * 0.9 (03/08/2000) greg kroah-hartman
193 * Release to IO networks.
194 * Integrated changes that David made
195 * made getting urbs for writing SMP safe
196 *
197 * 0.8 (03/07/2000) greg kroah-hartman
198 * Release to IO networks.
199 * Fixed problems that were seen in code by David.
200 * Now both Edgeport/4 and Edgeport/2 works properly.
201 * Changed most of the functions to use port instead of serial.
202 *
203 * 0.7 (02/27/2000) greg kroah-hartman
204 * Milestone 3 release.
205 * Release to IO Networks
206 * ioctl for waiting on line change implemented.
207 * ioctl for getting statistics implemented.
208 * multiport support working.
209 * lsr and msr registers are now handled properly.
210 * change break now hooked up and working.
211 * support for all known Edgeport devices.
212 *
213 * 0.6 (02/22/2000) greg kroah-hartman
214 * Release to IO networks.
215 * CHASE is implemented correctly when port is closed.
216 * SerialOpen now blocks correctly until port is fully opened.
217 *
218 * 0.5 (02/20/2000) greg kroah-hartman
219 * Release to IO networks.
220 * Known problems:
221 * modem status register changes are not sent on to the user
222 * CHASE is not implemented when the port is closed.
223 *
224 * 0.4 (02/16/2000) greg kroah-hartman
225 * Second cut at the CeBit demo.
226 * Doesn't leak memory on every write to the port
227 * Still small leaks on startup.
228 * Added support for Edgeport/2 and Edgeport/8
229 *
230 * 0.3 (02/15/2000) greg kroah-hartman
231 * CeBit demo release.
232 * Force the line settings to 4800, 8, 1, e for the demo.
233 * Warning! This version leaks memory like crazy!
234 *
235 * 0.2 (01/30/2000) greg kroah-hartman
236 * Milestone 1 release.
237 * Device is found by USB subsystem, enumerated, fimware is downloaded
238 * and the descriptors are printed to the debug log, config is set, and
239 * green light starts to blink. Open port works, and data can be sent
240 * and received at the default settings of the UART. Loopback connector
241 * and debug log confirms this.
242 *
243 * 0.1 (01/23/2000) greg kroah-hartman
244 * Initial release to help IO Networks try to set up their test system.
245 * Edgeport4 is recognized, firmware is downloaded, config is set so
246 * device blinks green light every 3 sec. Port is bound, but opening,
247 * closing, and sending data do not work properly.
248 *
249 */ 30 */
250 31
251#include <linux/config.h> 32#include <linux/config.h>
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h
index e7ffe02408bd..fad561c04c76 100644
--- a/drivers/usb/serial/io_tables.h
+++ b/drivers/usb/serial/io_tables.h
@@ -75,10 +75,12 @@ static struct usb_device_id id_table_combined [] = {
75 75
76MODULE_DEVICE_TABLE (usb, id_table_combined); 76MODULE_DEVICE_TABLE (usb, id_table_combined);
77 77
78static struct usb_serial_device_type edgeport_2port_device = { 78static struct usb_serial_driver edgeport_2port_device = {
79 .owner = THIS_MODULE, 79 .driver = {
80 .name = "Edgeport 2 port adapter", 80 .owner = THIS_MODULE,
81 .short_name = "edgeport_2", 81 .name = "edgeport_2",
82 },
83 .description = "Edgeport 2 port adapter",
82 .id_table = edgeport_2port_id_table, 84 .id_table = edgeport_2port_id_table,
83 .num_interrupt_in = 1, 85 .num_interrupt_in = 1,
84 .num_bulk_in = 1, 86 .num_bulk_in = 1,
@@ -103,10 +105,12 @@ static struct usb_serial_device_type edgeport_2port_device = {
103 .write_bulk_callback = edge_bulk_out_data_callback, 105 .write_bulk_callback = edge_bulk_out_data_callback,
104}; 106};
105 107
106static struct usb_serial_device_type edgeport_4port_device = { 108static struct usb_serial_driver edgeport_4port_device = {
107 .owner = THIS_MODULE, 109 .driver = {
108 .name = "Edgeport 4 port adapter", 110 .owner = THIS_MODULE,
109 .short_name = "edgeport_4", 111 .name = "edgeport_4",
112 },
113 .description = "Edgeport 4 port adapter",
110 .id_table = edgeport_4port_id_table, 114 .id_table = edgeport_4port_id_table,
111 .num_interrupt_in = 1, 115 .num_interrupt_in = 1,
112 .num_bulk_in = 1, 116 .num_bulk_in = 1,
@@ -131,10 +135,12 @@ static struct usb_serial_device_type edgeport_4port_device = {
131 .write_bulk_callback = edge_bulk_out_data_callback, 135 .write_bulk_callback = edge_bulk_out_data_callback,
132}; 136};
133 137
134static struct usb_serial_device_type edgeport_8port_device = { 138static struct usb_serial_driver edgeport_8port_device = {
135 .owner = THIS_MODULE, 139 .driver = {
136 .name = "Edgeport 8 port adapter", 140 .owner = THIS_MODULE,
137 .short_name = "edgeport_8", 141 .name = "edgeport_8",
142 },
143 .description = "Edgeport 8 port adapter",
138 .id_table = edgeport_8port_id_table, 144 .id_table = edgeport_8port_id_table,
139 .num_interrupt_in = 1, 145 .num_interrupt_in = 1,
140 .num_bulk_in = 1, 146 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index ebf9967f7c86..832b6d6734c0 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2982,10 +2982,12 @@ static unsigned int edge_buf_get(struct edge_buf *eb, char *buf,
2982} 2982}
2983 2983
2984 2984
2985static struct usb_serial_device_type edgeport_1port_device = { 2985static struct usb_serial_driver edgeport_1port_device = {
2986 .owner = THIS_MODULE, 2986 .driver = {
2987 .name = "Edgeport TI 1 port adapter", 2987 .owner = THIS_MODULE,
2988 .short_name = "edgeport_ti_1", 2988 .name = "edgeport_ti_1",
2989 },
2990 .description = "Edgeport TI 1 port adapter",
2989 .id_table = edgeport_1port_id_table, 2991 .id_table = edgeport_1port_id_table,
2990 .num_interrupt_in = 1, 2992 .num_interrupt_in = 1,
2991 .num_bulk_in = 1, 2993 .num_bulk_in = 1,
@@ -3010,10 +3012,12 @@ static struct usb_serial_device_type edgeport_1port_device = {
3010 .write_bulk_callback = edge_bulk_out_callback, 3012 .write_bulk_callback = edge_bulk_out_callback,
3011}; 3013};
3012 3014
3013static struct usb_serial_device_type edgeport_2port_device = { 3015static struct usb_serial_driver edgeport_2port_device = {
3014 .owner = THIS_MODULE, 3016 .driver = {
3015 .name = "Edgeport TI 2 port adapter", 3017 .owner = THIS_MODULE,
3016 .short_name = "edgeport_ti_2", 3018 .name = "edgeport_ti_2",
3019 },
3020 .description = "Edgeport TI 2 port adapter",
3017 .id_table = edgeport_2port_id_table, 3021 .id_table = edgeport_2port_id_table,
3018 .num_interrupt_in = 1, 3022 .num_interrupt_in = 1,
3019 .num_bulk_in = 2, 3023 .num_bulk_in = 2,
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index c05c2a2a0f31..d5d066488100 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -92,24 +92,7 @@ static void ipaq_destroy_lists(struct usb_serial_port *port);
92static struct usb_device_id ipaq_id_table [] = { 92static struct usb_device_id ipaq_id_table [] = {
93 /* The first entry is a placeholder for the insmod-specified device */ 93 /* The first entry is a placeholder for the insmod-specified device */
94 { USB_DEVICE(0x049F, 0x0003) }, 94 { USB_DEVICE(0x049F, 0x0003) },
95 { USB_DEVICE(0x1690, 0x0601) }, /* Askey USB Sync */ 95 { USB_DEVICE(0x0104, 0x00BE) }, /* Socket USB Sync */
96 { USB_DEVICE(0x0960, 0x0065) }, /* BCOM USB Sync 0065 */
97 { USB_DEVICE(0x0960, 0x0066) }, /* BCOM USB Sync 0066 */
98 { USB_DEVICE(0x0960, 0x0067) }, /* BCOM USB Sync 0067 */
99 { USB_DEVICE(0x07CF, 0x2001) }, /* CASIO USB Sync 2001 */
100 { USB_DEVICE(0x07CF, 0x2002) }, /* CASIO USB Sync 2002 */
101 { USB_DEVICE(0x07CF, 0x2003) }, /* CASIO USB Sync 2003 */
102 { USB_DEVICE(0x049F, 0x0003) }, /* Compaq iPAQ USB Sync */
103 { USB_DEVICE(0x049F, 0x0032) }, /* Compaq iPAQ USB Sync */
104 { USB_DEVICE(0x413C, 0x4001) }, /* Dell Axim USB Sync */
105 { USB_DEVICE(0x413C, 0x4002) }, /* Dell Axim USB Sync */
106 { USB_DEVICE(0x413C, 0x4003) }, /* Dell Axim USB Sync */
107 { USB_DEVICE(0x413C, 0x4004) }, /* Dell Axim USB Sync */
108 { USB_DEVICE(0x413C, 0x4005) }, /* Dell Axim USB Sync */
109 { USB_DEVICE(0x413C, 0x4006) }, /* Dell Axim USB Sync */
110 { USB_DEVICE(0x413C, 0x4007) }, /* Dell Axim USB Sync */
111 { USB_DEVICE(0x413C, 0x4008) }, /* Dell Axim USB Sync */
112 { USB_DEVICE(0x413C, 0x4009) }, /* Dell Axim USB Sync */
113 { USB_DEVICE(0x03F0, 0x1016) }, /* HP USB Sync */ 96 { USB_DEVICE(0x03F0, 0x1016) }, /* HP USB Sync */
114 { USB_DEVICE(0x03F0, 0x1116) }, /* HP USB Sync 1611 */ 97 { USB_DEVICE(0x03F0, 0x1116) }, /* HP USB Sync 1611 */
115 { USB_DEVICE(0x03F0, 0x1216) }, /* HP USB Sync 1612 */ 98 { USB_DEVICE(0x03F0, 0x1216) }, /* HP USB Sync 1612 */
@@ -125,7 +108,13 @@ static struct usb_device_id ipaq_id_table [] = {
125 { USB_DEVICE(0x03F0, 0x5016) }, /* HP USB Sync 1650 */ 108 { USB_DEVICE(0x03F0, 0x5016) }, /* HP USB Sync 1650 */
126 { USB_DEVICE(0x03F0, 0x5116) }, /* HP USB Sync 1651 */ 109 { USB_DEVICE(0x03F0, 0x5116) }, /* HP USB Sync 1651 */
127 { USB_DEVICE(0x03F0, 0x5216) }, /* HP USB Sync 1652 */ 110 { USB_DEVICE(0x03F0, 0x5216) }, /* HP USB Sync 1652 */
128 { USB_DEVICE(0x094B, 0x0001) }, /* Linkup Systems USB Sync */ 111 { USB_DEVICE(0x0409, 0x00D5) }, /* NEC USB Sync */
112 { USB_DEVICE(0x0409, 0x00D6) }, /* NEC USB Sync */
113 { USB_DEVICE(0x0409, 0x00D7) }, /* NEC USB Sync */
114 { USB_DEVICE(0x0409, 0x8024) }, /* NEC USB Sync */
115 { USB_DEVICE(0x0409, 0x8025) }, /* NEC USB Sync */
116 { USB_DEVICE(0x043E, 0x9C01) }, /* LGE USB Sync */
117 { USB_DEVICE(0x045E, 0x00CE) }, /* Microsoft USB Sync */
129 { USB_DEVICE(0x045E, 0x0400) }, /* Windows Powered Pocket PC 2002 */ 118 { USB_DEVICE(0x045E, 0x0400) }, /* Windows Powered Pocket PC 2002 */
130 { USB_DEVICE(0x045E, 0x0401) }, /* Windows Powered Pocket PC 2002 */ 119 { USB_DEVICE(0x045E, 0x0401) }, /* Windows Powered Pocket PC 2002 */
131 { USB_DEVICE(0x045E, 0x0402) }, /* Windows Powered Pocket PC 2002 */ 120 { USB_DEVICE(0x045E, 0x0402) }, /* Windows Powered Pocket PC 2002 */
@@ -251,17 +240,81 @@ static struct usb_device_id ipaq_id_table [] = {
251 { USB_DEVICE(0x045E, 0x04E8) }, /* Windows Powered Smartphone 2003 */ 240 { USB_DEVICE(0x045E, 0x04E8) }, /* Windows Powered Smartphone 2003 */
252 { USB_DEVICE(0x045E, 0x04E9) }, /* Windows Powered Smartphone 2003 */ 241 { USB_DEVICE(0x045E, 0x04E9) }, /* Windows Powered Smartphone 2003 */
253 { USB_DEVICE(0x045E, 0x04EA) }, /* Windows Powered Smartphone 2003 */ 242 { USB_DEVICE(0x045E, 0x04EA) }, /* Windows Powered Smartphone 2003 */
254 { USB_DEVICE(0x0961, 0x0010) }, /* Portatec USB Sync */ 243 { USB_DEVICE(0x049F, 0x0003) }, /* Compaq iPAQ USB Sync */
255 { USB_DEVICE(0x5E04, 0xCE00) }, /* SAGEM Wireless Assistant */ 244 { USB_DEVICE(0x049F, 0x0032) }, /* Compaq iPAQ USB Sync */
256 { USB_DEVICE(0x0104, 0x00BE) }, /* Socket USB Sync */ 245 { USB_DEVICE(0x04A4, 0x0014) }, /* Hitachi USB Sync */
246 { USB_DEVICE(0x04AD, 0x0301) }, /* USB Sync 0301 */
247 { USB_DEVICE(0x04AD, 0x0302) }, /* USB Sync 0302 */
248 { USB_DEVICE(0x04AD, 0x0303) }, /* USB Sync 0303 */
249 { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */
250 { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */
251 { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */
252 { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */
253 { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */
254 { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */
255 { USB_DEVICE(0x04E8, 0x5F03) }, /* Samsung NEXiO USB Sync */
256 { USB_DEVICE(0x04E8, 0x5F04) }, /* Samsung NEXiO USB Sync */
257 { USB_DEVICE(0x04E8, 0x6611) }, /* Samsung MITs USB Sync */
258 { USB_DEVICE(0x04E8, 0x6613) }, /* Samsung MITs USB Sync */
259 { USB_DEVICE(0x04E8, 0x6615) }, /* Samsung MITs USB Sync */
260 { USB_DEVICE(0x04E8, 0x6617) }, /* Samsung MITs USB Sync */
261 { USB_DEVICE(0x04E8, 0x6619) }, /* Samsung MITs USB Sync */
262 { USB_DEVICE(0x04E8, 0x661B) }, /* Samsung MITs USB Sync */
263 { USB_DEVICE(0x04E8, 0x662E) }, /* Samsung MITs USB Sync */
264 { USB_DEVICE(0x04E8, 0x6630) }, /* Samsung MITs USB Sync */
265 { USB_DEVICE(0x04E8, 0x6632) }, /* Samsung MITs USB Sync */
266 { USB_DEVICE(0x04f1, 0x3011) }, /* JVC USB Sync */
267 { USB_DEVICE(0x04F1, 0x3012) }, /* JVC USB Sync */
268 { USB_DEVICE(0x0502, 0x1631) }, /* c10 Series */
269 { USB_DEVICE(0x0502, 0x1632) }, /* c20 Series */
270 { USB_DEVICE(0x0502, 0x16E1) }, /* Acer n10 Handheld USB Sync */
271 { USB_DEVICE(0x0502, 0x16E2) }, /* Acer n20 Handheld USB Sync */
272 { USB_DEVICE(0x0502, 0x16E3) }, /* Acer n30 Handheld USB Sync */
273 { USB_DEVICE(0x0536, 0x01A0) }, /* HHP PDT */
274 { USB_DEVICE(0x0543, 0x0ED9) }, /* ViewSonic Color Pocket PC V35 */
275 { USB_DEVICE(0x0543, 0x1527) }, /* ViewSonic Color Pocket PC V36 */
276 { USB_DEVICE(0x0543, 0x1529) }, /* ViewSonic Color Pocket PC V37 */
277 { USB_DEVICE(0x0543, 0x152B) }, /* ViewSonic Color Pocket PC V38 */
278 { USB_DEVICE(0x0543, 0x152E) }, /* ViewSonic Pocket PC */
279 { USB_DEVICE(0x0543, 0x1921) }, /* ViewSonic Communicator Pocket PC */
280 { USB_DEVICE(0x0543, 0x1922) }, /* ViewSonic Smartphone */
281 { USB_DEVICE(0x0543, 0x1923) }, /* ViewSonic Pocket PC V30 */
282 { USB_DEVICE(0x05E0, 0x2000) }, /* Symbol USB Sync */
283 { USB_DEVICE(0x05E0, 0x2001) }, /* Symbol USB Sync 0x2001 */
284 { USB_DEVICE(0x05E0, 0x2002) }, /* Symbol USB Sync 0x2002 */
285 { USB_DEVICE(0x05E0, 0x2003) }, /* Symbol USB Sync 0x2003 */
286 { USB_DEVICE(0x05E0, 0x2004) }, /* Symbol USB Sync 0x2004 */
287 { USB_DEVICE(0x05E0, 0x2005) }, /* Symbol USB Sync 0x2005 */
288 { USB_DEVICE(0x05E0, 0x2006) }, /* Symbol USB Sync 0x2006 */
289 { USB_DEVICE(0x05E0, 0x2007) }, /* Symbol USB Sync 0x2007 */
290 { USB_DEVICE(0x05E0, 0x2008) }, /* Symbol USB Sync 0x2008 */
291 { USB_DEVICE(0x05E0, 0x2009) }, /* Symbol USB Sync 0x2009 */
292 { USB_DEVICE(0x05E0, 0x200A) }, /* Symbol USB Sync 0x200A */
293 { USB_DEVICE(0x067E, 0x1001) }, /* Intermec Mobile Computer */
294 { USB_DEVICE(0x07CF, 0x2001) }, /* CASIO USB Sync 2001 */
295 { USB_DEVICE(0x07CF, 0x2002) }, /* CASIO USB Sync 2002 */
296 { USB_DEVICE(0x07CF, 0x2003) }, /* CASIO USB Sync 2003 */
257 { USB_DEVICE(0x0930, 0x0700) }, /* TOSHIBA USB Sync 0700 */ 297 { USB_DEVICE(0x0930, 0x0700) }, /* TOSHIBA USB Sync 0700 */
258 { USB_DEVICE(0x0930, 0x0705) }, /* TOSHIBA Pocket PC e310 */ 298 { USB_DEVICE(0x0930, 0x0705) }, /* TOSHIBA Pocket PC e310 */
299 { USB_DEVICE(0x0930, 0x0706) }, /* TOSHIBA Pocket PC e740 */
259 { USB_DEVICE(0x0930, 0x0707) }, /* TOSHIBA Pocket PC e330 Series */ 300 { USB_DEVICE(0x0930, 0x0707) }, /* TOSHIBA Pocket PC e330 Series */
260 { USB_DEVICE(0x0930, 0x0708) }, /* TOSHIBA Pocket PC e350 Series */ 301 { USB_DEVICE(0x0930, 0x0708) }, /* TOSHIBA Pocket PC e350 Series */
261 { USB_DEVICE(0x0930, 0x0706) }, /* TOSHIBA Pocket PC e740 */
262 { USB_DEVICE(0x0930, 0x0709) }, /* TOSHIBA Pocket PC e750 Series */ 302 { USB_DEVICE(0x0930, 0x0709) }, /* TOSHIBA Pocket PC e750 Series */
263 { USB_DEVICE(0x0930, 0x070A) }, /* TOSHIBA Pocket PC e400 Series */ 303 { USB_DEVICE(0x0930, 0x070A) }, /* TOSHIBA Pocket PC e400 Series */
264 { USB_DEVICE(0x0930, 0x070B) }, /* TOSHIBA Pocket PC e800 Series */ 304 { USB_DEVICE(0x0930, 0x070B) }, /* TOSHIBA Pocket PC e800 Series */
305 { USB_DEVICE(0x094B, 0x0001) }, /* Linkup Systems USB Sync */
306 { USB_DEVICE(0x0960, 0x0065) }, /* BCOM USB Sync 0065 */
307 { USB_DEVICE(0x0960, 0x0066) }, /* BCOM USB Sync 0066 */
308 { USB_DEVICE(0x0960, 0x0067) }, /* BCOM USB Sync 0067 */
309 { USB_DEVICE(0x0961, 0x0010) }, /* Portatec USB Sync */
310 { USB_DEVICE(0x099E, 0x0052) }, /* Trimble GeoExplorer */
311 { USB_DEVICE(0x099E, 0x4000) }, /* TDS Data Collector */
312 { USB_DEVICE(0x0B05, 0x4200) }, /* ASUS USB Sync */
313 { USB_DEVICE(0x0B05, 0x4201) }, /* ASUS USB Sync */
314 { USB_DEVICE(0x0B05, 0x4202) }, /* ASUS USB Sync */
315 { USB_DEVICE(0x0B05, 0x420F) }, /* ASUS USB Sync */
316 { USB_DEVICE(0x0B05, 0x9200) }, /* ASUS USB Sync */
317 { USB_DEVICE(0x0B05, 0x9202) }, /* ASUS USB Sync */
265 { USB_DEVICE(0x0BB4, 0x00CE) }, /* HTC USB Sync */ 318 { USB_DEVICE(0x0BB4, 0x00CE) }, /* HTC USB Sync */
266 { USB_DEVICE(0x0BB4, 0x0A01) }, /* PocketPC USB Sync */ 319 { USB_DEVICE(0x0BB4, 0x0A01) }, /* PocketPC USB Sync */
267 { USB_DEVICE(0x0BB4, 0x0A02) }, /* PocketPC USB Sync */ 320 { USB_DEVICE(0x0BB4, 0x0A02) }, /* PocketPC USB Sync */
@@ -422,116 +475,67 @@ static struct usb_device_id ipaq_id_table [] = {
422 { USB_DEVICE(0x0BB4, 0x0A9D) }, /* SmartPhone USB Sync */ 475 { USB_DEVICE(0x0BB4, 0x0A9D) }, /* SmartPhone USB Sync */
423 { USB_DEVICE(0x0BB4, 0x0A9E) }, /* SmartPhone USB Sync */ 476 { USB_DEVICE(0x0BB4, 0x0A9E) }, /* SmartPhone USB Sync */
424 { USB_DEVICE(0x0BB4, 0x0A9F) }, /* SmartPhone USB Sync */ 477 { USB_DEVICE(0x0BB4, 0x0A9F) }, /* SmartPhone USB Sync */
425 { USB_DEVICE(0x0409, 0x00D5) }, /* NEC USB Sync */
426 { USB_DEVICE(0x0409, 0x00D6) }, /* NEC USB Sync */
427 { USB_DEVICE(0x0409, 0x00D7) }, /* NEC USB Sync */
428 { USB_DEVICE(0x0409, 0x8024) }, /* NEC USB Sync */
429 { USB_DEVICE(0x0409, 0x8025) }, /* NEC USB Sync */
430 { USB_DEVICE(0x04A4, 0x0014) }, /* Hitachi USB Sync */
431 { USB_DEVICE(0x0BF8, 0x1001) }, /* Fujitsu Siemens Computers USB Sync */ 478 { USB_DEVICE(0x0BF8, 0x1001) }, /* Fujitsu Siemens Computers USB Sync */
432 { USB_DEVICE(0x0F98, 0x0201) }, /* Cyberbank USB Sync */ 479 { USB_DEVICE(0x0C44, 0x03A2) }, /* Motorola iDEN Smartphone */
433 { USB_DEVICE(0x0502, 0x16E1) }, /* Acer n10 Handheld USB Sync */
434 { USB_DEVICE(0x0502, 0x16E3) }, /* Acer n30 Handheld USB Sync */
435 { USB_DEVICE(0x0502, 0x16E2) }, /* Acer n20 Handheld USB Sync */
436 { USB_DEVICE(0x0502, 0x1631) }, /* c10 Series */
437 { USB_DEVICE(0x0502, 0x1632) }, /* c20 Series */
438 { USB_DEVICE(0x0B05, 0x9202) }, /* ASUS USB Sync */
439 { USB_DEVICE(0x0B05, 0x420F) }, /* ASUS USB Sync */
440 { USB_DEVICE(0x0B05, 0x4200) }, /* ASUS USB Sync */
441 { USB_DEVICE(0x0B05, 0x4201) }, /* ASUS USB Sync */
442 { USB_DEVICE(0x0B05, 0x4202) }, /* ASUS USB Sync */
443 { USB_DEVICE(0x0B05, 0x9200) }, /* ASUS USB Sync */
444 { USB_DEVICE(0x0C8E, 0x6000) }, /* Cesscom Luxian Series */ 480 { USB_DEVICE(0x0C8E, 0x6000) }, /* Cesscom Luxian Series */
445 { USB_DEVICE(0x04AD, 0x0301) }, /* USB Sync 0301 */ 481 { USB_DEVICE(0x0CAD, 0x9001) }, /* Motorola PowerPad Pocket PC Device */
446 { USB_DEVICE(0x04AD, 0x0302) }, /* USB Sync 0302 */ 482 { USB_DEVICE(0x0F4E, 0x0200) }, /* Freedom Scientific USB Sync */
447 { USB_DEVICE(0x04AD, 0x0303) }, /* USB Sync 0303 */ 483 { USB_DEVICE(0x0F98, 0x0201) }, /* Cyberbank USB Sync */
484 { USB_DEVICE(0x0FB8, 0x3001) }, /* Wistron USB Sync */
485 { USB_DEVICE(0x0FB8, 0x3002) }, /* Wistron USB Sync */
486 { USB_DEVICE(0x0FB8, 0x3003) }, /* Wistron USB Sync */
487 { USB_DEVICE(0x0FB8, 0x4001) }, /* Wistron USB Sync */
488 { USB_DEVICE(0x1066, 0x00CE) }, /* E-TEN USB Sync */
448 { USB_DEVICE(0x1066, 0x0300) }, /* E-TEN P3XX Pocket PC */ 489 { USB_DEVICE(0x1066, 0x0300) }, /* E-TEN P3XX Pocket PC */
449 { USB_DEVICE(0x1066, 0x0500) }, /* E-TEN P5XX Pocket PC */ 490 { USB_DEVICE(0x1066, 0x0500) }, /* E-TEN P5XX Pocket PC */
450 { USB_DEVICE(0x1066, 0x0600) }, /* E-TEN P6XX Pocket PC */ 491 { USB_DEVICE(0x1066, 0x0600) }, /* E-TEN P6XX Pocket PC */
451 { USB_DEVICE(0x1066, 0x0700) }, /* E-TEN P7XX Pocket PC */ 492 { USB_DEVICE(0x1066, 0x0700) }, /* E-TEN P7XX Pocket PC */
452 { USB_DEVICE(0x1066, 0x00CE) }, /* E-TEN USB Sync */ 493 { USB_DEVICE(0x1114, 0x0001) }, /* Psion Teklogix Sync 753x */
453 { USB_DEVICE(0x0F4E, 0x0200) }, /* Freedom Scientific USB Sync */ 494 { USB_DEVICE(0x1114, 0x0004) }, /* Psion Teklogix Sync netBookPro */
454 { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ 495 { USB_DEVICE(0x1114, 0x0006) }, /* Psion Teklogix Sync 7525 */
455 { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ 496 { USB_DEVICE(0x1182, 0x1388) }, /* VES USB Sync */
456 { USB_DEVICE(0x067E, 0x1001) }, /* Intermec Mobile Computer */ 497 { USB_DEVICE(0x11D9, 0x1002) }, /* Rugged Pocket PC 2003 */
457 { USB_DEVICE(0x04f1, 0x3011) }, /* JVC USB Sync */ 498 { USB_DEVICE(0x11D9, 0x1003) }, /* Rugged Pocket PC 2003 */
458 { USB_DEVICE(0x04F1, 0x3012) }, /* JVC USB Sync */ 499 { USB_DEVICE(0x1231, 0xCE01) }, /* USB Sync 03 */
459 { USB_DEVICE(0x3708, 0x20CE) }, /* Legend USB Sync */ 500 { USB_DEVICE(0x1231, 0xCE02) }, /* USB Sync 03 */
460 { USB_DEVICE(0x3708, 0x21CE) }, /* Lenovo USB Sync */ 501 { USB_DEVICE(0x1690, 0x0601) }, /* Askey USB Sync */
461 { USB_DEVICE(0x043E, 0x9C01) }, /* LGE USB Sync */ 502 { USB_DEVICE(0x22B8, 0x4204) }, /* Motorola MPx200 Smartphone */
462 { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ 503 { USB_DEVICE(0x22B8, 0x4214) }, /* Motorola MPc GSM */
463 { USB_DEVICE(0x3340, 0x0B1C) }, /* Generic PPC StrongARM */ 504 { USB_DEVICE(0x22B8, 0x4224) }, /* Motorola MPx220 Smartphone */
464 { USB_DEVICE(0x3340, 0x0E3A) }, /* Generic PPC USB Sync */ 505 { USB_DEVICE(0x22B8, 0x4234) }, /* Motorola MPc CDMA */
465 { USB_DEVICE(0x3340, 0x0F3A) }, /* Generic SmartPhone USB Sync */ 506 { USB_DEVICE(0x22B8, 0x4244) }, /* Motorola MPx100 Smartphone */
466 { USB_DEVICE(0x3340, 0x0F1C) }, /* Itautec USB Sync */ 507 { USB_DEVICE(0x3340, 0x011C) }, /* Mio DigiWalker PPC StrongARM */
467 { USB_DEVICE(0x3340, 0x1326) }, /* Itautec USB Sync */
468 { USB_DEVICE(0x3340, 0x3326) }, /* MEDION Winodws Moble USB Sync */
469 { USB_DEVICE(0x3340, 0x0326) }, /* Mio DigiWalker 338 */ 508 { USB_DEVICE(0x3340, 0x0326) }, /* Mio DigiWalker 338 */
470 { USB_DEVICE(0x3340, 0x0426) }, /* Mio DigiWalker 338 */ 509 { USB_DEVICE(0x3340, 0x0426) }, /* Mio DigiWalker 338 */
471 { USB_DEVICE(0x3340, 0x011C) }, /* Mio DigiWalker PPC StrongARM */
472 { USB_DEVICE(0x3340, 0x053A) }, /* Mio DigiWalker SmartPhone USB Sync */
473 { USB_DEVICE(0x3340, 0x043A) }, /* Mio DigiWalker USB Sync */ 510 { USB_DEVICE(0x3340, 0x043A) }, /* Mio DigiWalker USB Sync */
474 { USB_DEVICE(0x3340, 0x071C) }, /* MiTAC USB Sync */
475 { USB_DEVICE(0x3340, 0x051C) }, /* MiTAC USB Sync 528 */ 511 { USB_DEVICE(0x3340, 0x051C) }, /* MiTAC USB Sync 528 */
476 { USB_DEVICE(0x3340, 0x2326) }, /* Vobis USB Sync */ 512 { USB_DEVICE(0x3340, 0x053A) }, /* Mio DigiWalker SmartPhone USB Sync */
513 { USB_DEVICE(0x3340, 0x071C) }, /* MiTAC USB Sync */
514 { USB_DEVICE(0x3340, 0x0B1C) }, /* Generic PPC StrongARM */
515 { USB_DEVICE(0x3340, 0x0E3A) }, /* Generic PPC USB Sync */
516 { USB_DEVICE(0x3340, 0x0F1C) }, /* Itautec USB Sync */
517 { USB_DEVICE(0x3340, 0x0F3A) }, /* Generic SmartPhone USB Sync */
518 { USB_DEVICE(0x3340, 0x1326) }, /* Itautec USB Sync */
477 { USB_DEVICE(0x3340, 0x191C) }, /* YAKUMO USB Sync */ 519 { USB_DEVICE(0x3340, 0x191C) }, /* YAKUMO USB Sync */
520 { USB_DEVICE(0x3340, 0x2326) }, /* Vobis USB Sync */
521 { USB_DEVICE(0x3340, 0x3326) }, /* MEDION Winodws Moble USB Sync */
522 { USB_DEVICE(0x3708, 0x20CE) }, /* Legend USB Sync */
523 { USB_DEVICE(0x3708, 0x21CE) }, /* Lenovo USB Sync */
478 { USB_DEVICE(0x4113, 0x0210) }, /* Mobile Media Technology USB Sync */ 524 { USB_DEVICE(0x4113, 0x0210) }, /* Mobile Media Technology USB Sync */
479 { USB_DEVICE(0x4113, 0x0211) }, /* Mobile Media Technology USB Sync */ 525 { USB_DEVICE(0x4113, 0x0211) }, /* Mobile Media Technology USB Sync */
480 { USB_DEVICE(0x4113, 0x0400) }, /* Mobile Media Technology USB Sync */ 526 { USB_DEVICE(0x4113, 0x0400) }, /* Mobile Media Technology USB Sync */
481 { USB_DEVICE(0x4113, 0x0410) }, /* Mobile Media Technology USB Sync */ 527 { USB_DEVICE(0x4113, 0x0410) }, /* Mobile Media Technology USB Sync */
482 { USB_DEVICE(0x0CAD, 0x9001) }, /* Motorola PowerPad Pocket PC Device */ 528 { USB_DEVICE(0x413C, 0x4001) }, /* Dell Axim USB Sync */
483 { USB_DEVICE(0x0C44, 0x03A2) }, /* Motorola iDEN Smartphone */ 529 { USB_DEVICE(0x413C, 0x4002) }, /* Dell Axim USB Sync */
484 { USB_DEVICE(0x04E8, 0x6611) }, /* Samsung MITs USB Sync */ 530 { USB_DEVICE(0x413C, 0x4003) }, /* Dell Axim USB Sync */
485 { USB_DEVICE(0x04E8, 0x6613) }, /* Samsung MITs USB Sync */ 531 { USB_DEVICE(0x413C, 0x4004) }, /* Dell Axim USB Sync */
486 { USB_DEVICE(0x04E8, 0x6615) }, /* Samsung MITs USB Sync */ 532 { USB_DEVICE(0x413C, 0x4005) }, /* Dell Axim USB Sync */
487 { USB_DEVICE(0x04E8, 0x6617) }, /* Samsung MITs USB Sync */ 533 { USB_DEVICE(0x413C, 0x4006) }, /* Dell Axim USB Sync */
488 { USB_DEVICE(0x04E8, 0x6619) }, /* Samsung MITs USB Sync */ 534 { USB_DEVICE(0x413C, 0x4007) }, /* Dell Axim USB Sync */
489 { USB_DEVICE(0x04E8, 0x661B) }, /* Samsung MITs USB Sync */ 535 { USB_DEVICE(0x413C, 0x4008) }, /* Dell Axim USB Sync */
490 { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ 536 { USB_DEVICE(0x413C, 0x4009) }, /* Dell Axim USB Sync */
491 { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */
492 { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */
493 { USB_DEVICE(0x04E8, 0x5F03) }, /* Samsung NEXiO USB Sync */
494 { USB_DEVICE(0x04E8, 0x5F04) }, /* Samsung NEXiO USB Sync */
495 { USB_DEVICE(0x04E8, 0x662E) }, /* Samsung MITs USB Sync */
496 { USB_DEVICE(0x04E8, 0x6630) }, /* Samsung MITs USB Sync */
497 { USB_DEVICE(0x04E8, 0x6632) }, /* Samsung MITs USB Sync */
498 { USB_DEVICE(0x4505, 0x0010) }, /* Smartphone */ 537 { USB_DEVICE(0x4505, 0x0010) }, /* Smartphone */
499 { USB_DEVICE(0x05E0, 0x2000) }, /* Symbol USB Sync */ 538 { USB_DEVICE(0x5E04, 0xCE00) }, /* SAGEM Wireless Assistant */
500 { USB_DEVICE(0x05E0, 0x2001) }, /* Symbol USB Sync 0x2001 */
501 { USB_DEVICE(0x05E0, 0x2002) }, /* Symbol USB Sync 0x2002 */
502 { USB_DEVICE(0x05E0, 0x2003) }, /* Symbol USB Sync 0x2003 */
503 { USB_DEVICE(0x05E0, 0x2004) }, /* Symbol USB Sync 0x2004 */
504 { USB_DEVICE(0x05E0, 0x2005) }, /* Symbol USB Sync 0x2005 */
505 { USB_DEVICE(0x05E0, 0x2006) }, /* Symbol USB Sync 0x2006 */
506 { USB_DEVICE(0x05E0, 0x2007) }, /* Symbol USB Sync 0x2007 */
507 { USB_DEVICE(0x05E0, 0x2008) }, /* Symbol USB Sync 0x2008 */
508 { USB_DEVICE(0x05E0, 0x2009) }, /* Symbol USB Sync 0x2009 */
509 { USB_DEVICE(0x05E0, 0x200A) }, /* Symbol USB Sync 0x200A */
510 { USB_DEVICE(0x1182, 0x1388) }, /* VES USB Sync */
511 { USB_DEVICE(0x0543, 0x0ED9) }, /* ViewSonic Color Pocket PC V35 */
512 { USB_DEVICE(0x0543, 0x1527) }, /* ViewSonic Color Pocket PC V36 */
513 { USB_DEVICE(0x0543, 0x1529) }, /* ViewSonic Color Pocket PC V37 */
514 { USB_DEVICE(0x0543, 0x152B) }, /* ViewSonic Color Pocket PC V38 */
515 { USB_DEVICE(0x0543, 0x152E) }, /* ViewSonic Pocket PC */
516 { USB_DEVICE(0x0543, 0x1921) }, /* ViewSonic Communicator Pocket PC */
517 { USB_DEVICE(0x0543, 0x1922) }, /* ViewSonic Smartphone */
518 { USB_DEVICE(0x0543, 0x1923) }, /* ViewSonic Pocket PC V30 */
519 { USB_DEVICE(0x0536, 0x01A0) }, /* HHP PDT */
520 { USB_DEVICE(0x099E, 0x0052) }, /* Trimble GeoExplorer */
521 { USB_DEVICE(0x099E, 0x4000) }, /* TDS Data Collector */
522 { USB_DEVICE(0x0FB8, 0x3001) }, /* Wistron USB Sync */
523 { USB_DEVICE(0x0FB8, 0x3002) }, /* Wistron USB Sync */
524 { USB_DEVICE(0x0FB8, 0x3003) }, /* Wistron USB Sync */
525 { USB_DEVICE(0x0FB8, 0x4001) }, /* Wistron USB Sync */
526 { USB_DEVICE(0x11D9, 0x1003) }, /* Rugged Pocket PC 2003 */
527 { USB_DEVICE(0x11D9, 0x1002) }, /* Rugged Pocket PC 2003 */
528 { USB_DEVICE(0x22B8, 0x4204) }, /* Motorola MPx200 Smartphone */
529 { USB_DEVICE(0x22B8, 0x4214) }, /* Motorola MPc GSM */
530 { USB_DEVICE(0x22B8, 0x4224) }, /* Motorola MPx220 Smartphone */
531 { USB_DEVICE(0x22B8, 0x4234) }, /* Motorola MPc CDMA */
532 { USB_DEVICE(0x22B8, 0x4244) }, /* Motorola MPx100 Smartphone */
533 { USB_DEVICE(0x1231, 0xCE01) }, /* USB Sync 03 */
534 { USB_DEVICE(0x1231, 0xCE02) }, /* USB Sync 03 */
535 { } /* Terminating entry */ 539 { } /* Terminating entry */
536}; 540};
537 541
@@ -547,9 +551,12 @@ static struct usb_driver ipaq_driver = {
547 551
548 552
549/* All of the device info needed for the Compaq iPAQ */ 553/* All of the device info needed for the Compaq iPAQ */
550static struct usb_serial_device_type ipaq_device = { 554static struct usb_serial_driver ipaq_device = {
551 .owner = THIS_MODULE, 555 .driver = {
552 .name = "PocketPC PDA", 556 .owner = THIS_MODULE,
557 .name = "ipaq",
558 },
559 .description = "PocketPC PDA",
553 .id_table = ipaq_id_table, 560 .id_table = ipaq_id_table,
554 .num_interrupt_in = NUM_DONT_CARE, 561 .num_interrupt_in = NUM_DONT_CARE,
555 .num_bulk_in = 1, 562 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
index 85e242459c27..a02fada85362 100644
--- a/drivers/usb/serial/ipw.c
+++ b/drivers/usb/serial/ipw.c
@@ -443,10 +443,12 @@ static int ipw_disconnect(struct usb_serial_port *port)
443 return 0; 443 return 0;
444} 444}
445 445
446static struct usb_serial_device_type ipw_device = { 446static struct usb_serial_driver ipw_device = {
447 .owner = THIS_MODULE, 447 .driver = {
448 .name = "IPWireless converter", 448 .owner = THIS_MODULE,
449 .short_name = "ipw", 449 .name = "ipw",
450 },
451 .description = "IPWireless converter",
450 .id_table = usb_ipw_ids, 452 .id_table = usb_ipw_ids,
451 .num_interrupt_in = NUM_DONT_CARE, 453 .num_interrupt_in = NUM_DONT_CARE,
452 .num_bulk_in = 1, 454 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index 937b2fdd7171..19f329e9bdcf 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -133,9 +133,12 @@ static struct usb_driver ir_driver = {
133}; 133};
134 134
135 135
136static struct usb_serial_device_type ir_device = { 136static struct usb_serial_driver ir_device = {
137 .owner = THIS_MODULE, 137 .driver = {
138 .name = "IR Dongle", 138 .owner = THIS_MODULE,
139 .name = "ir-usb",
140 },
141 .description = "IR Dongle",
139 .id_table = id_table, 142 .id_table = id_table,
140 .num_interrupt_in = 1, 143 .num_interrupt_in = 1,
141 .num_bulk_in = 1, 144 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
index e9b45b768aca..5cfc13b5e56f 100644
--- a/drivers/usb/serial/keyspan.h
+++ b/drivers/usb/serial/keyspan.h
@@ -570,10 +570,12 @@ static struct usb_device_id keyspan_4port_ids[] = {
570}; 570};
571 571
572/* Structs for the devices, pre and post renumeration. */ 572/* Structs for the devices, pre and post renumeration. */
573static struct usb_serial_device_type keyspan_pre_device = { 573static struct usb_serial_driver keyspan_pre_device = {
574 .owner = THIS_MODULE, 574 .driver = {
575 .name = "Keyspan - (without firmware)", 575 .owner = THIS_MODULE,
576 .short_name = "keyspan_no_firm", 576 .name = "keyspan_no_firm",
577 },
578 .description = "Keyspan - (without firmware)",
577 .id_table = keyspan_pre_ids, 579 .id_table = keyspan_pre_ids,
578 .num_interrupt_in = NUM_DONT_CARE, 580 .num_interrupt_in = NUM_DONT_CARE,
579 .num_bulk_in = NUM_DONT_CARE, 581 .num_bulk_in = NUM_DONT_CARE,
@@ -582,10 +584,12 @@ static struct usb_serial_device_type keyspan_pre_device = {
582 .attach = keyspan_fake_startup, 584 .attach = keyspan_fake_startup,
583}; 585};
584 586
585static struct usb_serial_device_type keyspan_1port_device = { 587static struct usb_serial_driver keyspan_1port_device = {
586 .owner = THIS_MODULE, 588 .driver = {
587 .name = "Keyspan 1 port adapter", 589 .owner = THIS_MODULE,
588 .short_name = "keyspan_1", 590 .name = "keyspan_1",
591 },
592 .description = "Keyspan 1 port adapter",
589 .id_table = keyspan_1port_ids, 593 .id_table = keyspan_1port_ids,
590 .num_interrupt_in = NUM_DONT_CARE, 594 .num_interrupt_in = NUM_DONT_CARE,
591 .num_bulk_in = NUM_DONT_CARE, 595 .num_bulk_in = NUM_DONT_CARE,
@@ -607,10 +611,12 @@ static struct usb_serial_device_type keyspan_1port_device = {
607 .shutdown = keyspan_shutdown, 611 .shutdown = keyspan_shutdown,
608}; 612};
609 613
610static struct usb_serial_device_type keyspan_2port_device = { 614static struct usb_serial_driver keyspan_2port_device = {
611 .owner = THIS_MODULE, 615 .driver = {
612 .name = "Keyspan 2 port adapter", 616 .owner = THIS_MODULE,
613 .short_name = "keyspan_2", 617 .name = "keyspan_2",
618 },
619 .description = "Keyspan 2 port adapter",
614 .id_table = keyspan_2port_ids, 620 .id_table = keyspan_2port_ids,
615 .num_interrupt_in = NUM_DONT_CARE, 621 .num_interrupt_in = NUM_DONT_CARE,
616 .num_bulk_in = NUM_DONT_CARE, 622 .num_bulk_in = NUM_DONT_CARE,
@@ -632,10 +638,12 @@ static struct usb_serial_device_type keyspan_2port_device = {
632 .shutdown = keyspan_shutdown, 638 .shutdown = keyspan_shutdown,
633}; 639};
634 640
635static struct usb_serial_device_type keyspan_4port_device = { 641static struct usb_serial_driver keyspan_4port_device = {
636 .owner = THIS_MODULE, 642 .driver = {
637 .name = "Keyspan 4 port adapter", 643 .owner = THIS_MODULE,
638 .short_name = "keyspan_4", 644 .name = "keyspan_4",
645 },
646 .description = "Keyspan 4 port adapter",
639 .id_table = keyspan_4port_ids, 647 .id_table = keyspan_4port_ids,
640 .num_interrupt_in = NUM_DONT_CARE, 648 .num_interrupt_in = NUM_DONT_CARE,
641 .num_bulk_in = 5, 649 .num_bulk_in = 5,
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 635c384cb15a..cd4f48bd83b6 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -783,10 +783,12 @@ static void keyspan_pda_shutdown (struct usb_serial *serial)
783} 783}
784 784
785#ifdef KEYSPAN 785#ifdef KEYSPAN
786static struct usb_serial_device_type keyspan_pda_fake_device = { 786static struct usb_serial_driver keyspan_pda_fake_device = {
787 .owner = THIS_MODULE, 787 .driver = {
788 .name = "Keyspan PDA - (prerenumeration)", 788 .owner = THIS_MODULE,
789 .short_name = "keyspan_pda_pre", 789 .name = "keyspan_pda_pre",
790 },
791 .description = "Keyspan PDA - (prerenumeration)",
790 .id_table = id_table_fake, 792 .id_table = id_table_fake,
791 .num_interrupt_in = NUM_DONT_CARE, 793 .num_interrupt_in = NUM_DONT_CARE,
792 .num_bulk_in = NUM_DONT_CARE, 794 .num_bulk_in = NUM_DONT_CARE,
@@ -797,10 +799,12 @@ static struct usb_serial_device_type keyspan_pda_fake_device = {
797#endif 799#endif
798 800
799#ifdef XIRCOM 801#ifdef XIRCOM
800static struct usb_serial_device_type xircom_pgs_fake_device = { 802static struct usb_serial_driver xircom_pgs_fake_device = {
801 .owner = THIS_MODULE, 803 .driver = {
802 .name = "Xircom / Entregra PGS - (prerenumeration)", 804 .owner = THIS_MODULE,
803 .short_name = "xircom_no_firm", 805 .name = "xircom_no_firm",
806 },
807 .description = "Xircom / Entregra PGS - (prerenumeration)",
804 .id_table = id_table_fake_xircom, 808 .id_table = id_table_fake_xircom,
805 .num_interrupt_in = NUM_DONT_CARE, 809 .num_interrupt_in = NUM_DONT_CARE,
806 .num_bulk_in = NUM_DONT_CARE, 810 .num_bulk_in = NUM_DONT_CARE,
@@ -810,10 +814,12 @@ static struct usb_serial_device_type xircom_pgs_fake_device = {
810}; 814};
811#endif 815#endif
812 816
813static struct usb_serial_device_type keyspan_pda_device = { 817static struct usb_serial_driver keyspan_pda_device = {
814 .owner = THIS_MODULE, 818 .driver = {
815 .name = "Keyspan PDA", 819 .owner = THIS_MODULE,
816 .short_name = "keyspan_pda", 820 .name = "keyspan_pda",
821 },
822 .description = "Keyspan PDA",
817 .id_table = id_table_std, 823 .id_table = id_table_std,
818 .num_interrupt_in = 1, 824 .num_interrupt_in = 1,
819 .num_bulk_in = 0, 825 .num_bulk_in = 0,
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index a11e829e38c8..a8951c0fd020 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -123,10 +123,12 @@ static struct usb_driver kl5kusb105d_driver = {
123 .id_table = id_table, 123 .id_table = id_table,
124}; 124};
125 125
126static struct usb_serial_device_type kl5kusb105d_device = { 126static struct usb_serial_driver kl5kusb105d_device = {
127 .owner = THIS_MODULE, 127 .driver = {
128 .name = "KL5KUSB105D / PalmConnect", 128 .owner = THIS_MODULE,
129 .short_name = "kl5kusb105d", 129 .name = "kl5kusb105d",
130 },
131 .description = "KL5KUSB105D / PalmConnect",
130 .id_table = id_table, 132 .id_table = id_table,
131 .num_interrupt_in = 1, 133 .num_interrupt_in = 1,
132 .num_bulk_in = 1, 134 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index fe4c98a75171..9456dd9dd136 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -105,9 +105,12 @@ static struct usb_driver kobil_driver = {
105}; 105};
106 106
107 107
108static struct usb_serial_device_type kobil_device = { 108static struct usb_serial_driver kobil_device = {
109 .owner = THIS_MODULE, 109 .driver = {
110 .name = "KOBIL USB smart card terminal", 110 .owner = THIS_MODULE,
111 .name = "kobil",
112 },
113 .description = "KOBIL USB smart card terminal",
111 .id_table = id_table, 114 .id_table = id_table,
112 .num_interrupt_in = NUM_DONT_CARE, 115 .num_interrupt_in = NUM_DONT_CARE,
113 .num_bulk_in = 0, 116 .num_bulk_in = 0,
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 50b6369647d2..ca5dbadb9b7e 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -132,10 +132,12 @@ static struct usb_driver mct_u232_driver = {
132 .id_table = id_table_combined, 132 .id_table = id_table_combined,
133}; 133};
134 134
135static struct usb_serial_device_type mct_u232_device = { 135static struct usb_serial_driver mct_u232_device = {
136 .owner = THIS_MODULE, 136 .driver = {
137 .name = "MCT U232", 137 .owner = THIS_MODULE,
138 .short_name = "mct_u232", 138 .name = "mct_u232",
139 },
140 .description = "MCT U232",
139 .id_table = id_table_combined, 141 .id_table = id_table_combined,
140 .num_interrupt_in = 2, 142 .num_interrupt_in = 2,
141 .num_bulk_in = 0, 143 .num_bulk_in = 0,
diff --git a/drivers/usb/serial/nokia_dku2.c b/drivers/usb/serial/nokia_dku2.c
new file mode 100644
index 000000000000..fad01bef3a64
--- /dev/null
+++ b/drivers/usb/serial/nokia_dku2.c
@@ -0,0 +1,142 @@
1/*
2 * Nokia DKU2 USB driver
3 *
4 * Copyright (C) 2004
5 * Author: C Kemp
6 *
7 * This program is largely derived from work by the linux-usb group
8 * and associated source files. Please see the usb/serial files for
9 * individual credits and copyrights.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * 20.09.2005 - Matthias Blaesing <matthias.blaesing@rwth-aachen.de>
17 * Added short name to device structure to make driver load into kernel 2.6.13
18 *
19 * 20.09.2005 - Matthias Blaesing <matthias.blaesing@rwth-aachen.de>
20 * Added usb_deregister to exit code - to allow remove and reinsert of module
21 */
22
23
24#include <linux/config.h>
25#include <linux/kernel.h>
26#include <linux/errno.h>
27#include <linux/init.h>
28#include <linux/slab.h>
29#include <linux/tty.h>
30#include <linux/tty_driver.h>
31#include <linux/tty_flip.h>
32#include <linux/module.h>
33#include <linux/usb.h>
34#include "usb-serial.h"
35
36
37#define NOKIA_VENDOR_ID 0x0421
38#define NOKIA7600_PRODUCT_ID 0x0400
39#define NOKIA6230_PRODUCT_ID 0x040f
40#define NOKIA6170_PRODUCT_ID 0x0416
41#define NOKIA6670_PRODUCT_ID 0x041d
42#define NOKIA6680_PRODUCT_ID 0x041e
43#define NOKIA6230i_PRODUCT_ID 0x0428
44
45#define NOKIA_AT_PORT 0x82
46#define NOKIA_FBUS_PORT 0x86
47
48/*
49 * Version Information
50 */
51#define DRIVER_VERSION "v0.2"
52#define DRIVER_AUTHOR "C Kemp"
53#define DRIVER_DESC "Nokia DKU2 Driver"
54
55static struct usb_device_id id_table [] = {
56 { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA7600_PRODUCT_ID) },
57 { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6230_PRODUCT_ID) },
58 { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6170_PRODUCT_ID) },
59 { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6670_PRODUCT_ID) },
60 { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6680_PRODUCT_ID) },
61 { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6230i_PRODUCT_ID) },
62 { } /* Terminating entry */
63};
64MODULE_DEVICE_TABLE(usb, id_table);
65
66/* The only thing which makes this device different from a generic
67 * device is that we have to set an alternative configuration to make
68 * the relevant endpoints available. In 2.6 this is really easy... */
69static int nokia_probe(struct usb_serial *serial,
70 const struct usb_device_id *id)
71{
72 int retval = -ENODEV;
73
74 if (serial->interface->altsetting[0].endpoint[0].desc.bEndpointAddress == NOKIA_AT_PORT) {
75 /* the AT port */
76 dev_info(&serial->dev->dev, "Nokia AT Port:\n");
77 retval = 0;
78 } else if (serial->interface->num_altsetting == 2 &&
79 serial->interface->altsetting[1].endpoint[0].desc.bEndpointAddress == NOKIA_FBUS_PORT) {
80 /* the FBUS port */
81 dev_info(&serial->dev->dev, "Nokia FBUS Port:\n");
82 usb_set_interface(serial->dev, 10, 1);
83 retval = 0;
84 }
85
86 return retval;
87}
88
89static struct usb_driver nokia_driver = {
90 .owner = THIS_MODULE,
91 .name = "nokia_dku2",
92 .probe = usb_serial_probe,
93 .disconnect = usb_serial_disconnect,
94 .id_table = id_table,
95};
96
97static struct usb_serial_driver nokia_serial_driver = {
98 .driver = {
99 .owner = THIS_MODULE,
100 .name = "nokia_dku2",
101 },
102 .description = "Nokia 7600/6230(i)/6170/66x0 DKU2 driver",
103 .id_table = id_table,
104 .num_interrupt_in = 1,
105 .num_bulk_in = 1,
106 .num_bulk_out = 1,
107 .num_ports = 1,
108 .probe = nokia_probe,
109};
110
111static int __init nokia_init(void)
112{
113 int retval;
114
115 retval = usb_serial_register(&nokia_serial_driver);
116 if (retval)
117 return retval;
118
119 retval = usb_register(&nokia_driver);
120 if (retval) {
121 usb_serial_deregister(&nokia_serial_driver);
122 return retval;
123 }
124
125 info(DRIVER_VERSION " " DRIVER_AUTHOR);
126 info(DRIVER_DESC);
127
128 return retval;
129}
130
131static void __exit nokia_exit(void)
132{
133 usb_deregister(&nokia_driver);
134 usb_serial_deregister(&nokia_serial_driver);
135}
136
137module_init(nokia_init);
138module_exit(nokia_exit);
139
140MODULE_AUTHOR(DRIVER_AUTHOR);
141MODULE_DESCRIPTION(DRIVER_DESC);
142MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 6a99ae192df1..3caf97072ac0 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -88,10 +88,12 @@ static struct usb_driver omninet_driver = {
88}; 88};
89 89
90 90
91static struct usb_serial_device_type zyxel_omninet_device = { 91static struct usb_serial_driver zyxel_omninet_device = {
92 .owner = THIS_MODULE, 92 .driver = {
93 .name = "ZyXEL - omni.net lcd plus usb", 93 .owner = THIS_MODULE,
94 .short_name = "omninet", 94 .name = "omninet",
95 },
96 .description = "ZyXEL - omni.net lcd plus usb",
95 .id_table = id_table, 97 .id_table = id_table,
96 .num_interrupt_in = 1, 98 .num_interrupt_in = 1,
97 .num_bulk_in = 1, 99 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 4989e5740d18..7716000045b7 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -105,10 +105,12 @@ static struct usb_driver option_driver = {
105/* The card has three separate interfaces, wich the serial driver 105/* The card has three separate interfaces, wich the serial driver
106 * recognizes separately, thus num_port=1. 106 * recognizes separately, thus num_port=1.
107 */ 107 */
108static struct usb_serial_device_type option_3port_device = { 108static struct usb_serial_driver option_3port_device = {
109 .owner = THIS_MODULE, 109 .driver = {
110 .name = "Option 3G data card", 110 .owner = THIS_MODULE,
111 .short_name = "option", 111 .name = "option",
112 },
113 .description = "Option 3G data card",
112 .id_table = option_ids, 114 .id_table = option_ids,
113 .num_interrupt_in = NUM_DONT_CARE, 115 .num_interrupt_in = NUM_DONT_CARE,
114 .num_bulk_in = NUM_DONT_CARE, 116 .num_bulk_in = NUM_DONT_CARE,
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 3cf245bdda54..165c119bf10e 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -8,31 +8,10 @@
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License.
12 * (at your option) any later version.
13 * 12 *
14 * See Documentation/usb/usb-serial.txt for more information on using this driver 13 * See Documentation/usb/usb-serial.txt for more information on using this driver
15 * 14 *
16 * 2002_Mar_26 gkh
17 * allowed driver to work properly if there is no tty assigned to a port
18 * (this happens for serial console devices.)
19 *
20 * 2001_Oct_06 gkh
21 * Added RTS and DTR line control. Thanks to joe@bndlg.de for parts of it.
22 *
23 * 2001_Sep_19 gkh
24 * Added break support.
25 *
26 * 2001_Aug_30 gkh
27 * fixed oops in write_bulk_callback.
28 *
29 * 2001_Aug_28 gkh
30 * reworked buffer logic to be like other usb-serial drivers. Hopefully
31 * removing some reported problems.
32 *
33 * 2001_Jun_06 gkh
34 * finished porting to 2.4 format.
35 *
36 */ 15 */
37 16
38#include <linux/config.h> 17#include <linux/config.h>
@@ -55,7 +34,6 @@
55/* 34/*
56 * Version Information 35 * Version Information
57 */ 36 */
58#define DRIVER_VERSION "v0.12"
59#define DRIVER_DESC "Prolific PL2303 USB to serial adaptor driver" 37#define DRIVER_DESC "Prolific PL2303 USB to serial adaptor driver"
60 38
61static int debug; 39static int debug;
@@ -175,9 +153,11 @@ static unsigned int pl2303_buf_get(struct pl2303_buf *pb, char *buf,
175 153
176 154
177/* All of the device info needed for the PL2303 SIO serial converter */ 155/* All of the device info needed for the PL2303 SIO serial converter */
178static struct usb_serial_device_type pl2303_device = { 156static struct usb_serial_driver pl2303_device = {
179 .owner = THIS_MODULE, 157 .driver = {
180 .name = "PL-2303", 158 .owner = THIS_MODULE,
159 .name = "pl2303",
160 },
181 .id_table = id_table, 161 .id_table = id_table,
182 .num_interrupt_in = NUM_DONT_CARE, 162 .num_interrupt_in = NUM_DONT_CARE,
183 .num_bulk_in = 1, 163 .num_bulk_in = 1,
@@ -1195,7 +1175,7 @@ static int __init pl2303_init (void)
1195 retval = usb_register(&pl2303_driver); 1175 retval = usb_register(&pl2303_driver);
1196 if (retval) 1176 if (retval)
1197 goto failed_usb_register; 1177 goto failed_usb_register;
1198 info(DRIVER_DESC " " DRIVER_VERSION); 1178 info(DRIVER_DESC);
1199 return 0; 1179 return 0;
1200failed_usb_register: 1180failed_usb_register:
1201 usb_serial_deregister(&pl2303_device); 1181 usb_serial_deregister(&pl2303_device);
@@ -1215,7 +1195,6 @@ module_init(pl2303_init);
1215module_exit(pl2303_exit); 1195module_exit(pl2303_exit);
1216 1196
1217MODULE_DESCRIPTION(DRIVER_DESC); 1197MODULE_DESCRIPTION(DRIVER_DESC);
1218MODULE_VERSION(DRIVER_VERSION);
1219MODULE_LICENSE("GPL"); 1198MODULE_LICENSE("GPL");
1220 1199
1221module_param(debug, bool, S_IRUGO | S_IWUSR); 1200module_param(debug, bool, S_IRUGO | S_IWUSR);
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
index 96a17568cbf1..c22bdc0c4dfd 100644
--- a/drivers/usb/serial/safe_serial.c
+++ b/drivers/usb/serial/safe_serial.c
@@ -92,7 +92,7 @@ MODULE_DESCRIPTION (DRIVER_DESC);
92MODULE_LICENSE("GPL"); 92MODULE_LICENSE("GPL");
93 93
94#if defined(CONFIG_USBD_SAFE_SERIAL_VENDOR) && !defined(CONFIG_USBD_SAFE_SERIAL_PRODUCT) 94#if defined(CONFIG_USBD_SAFE_SERIAL_VENDOR) && !defined(CONFIG_USBD_SAFE_SERIAL_PRODUCT)
95#abort "SAFE_SERIAL_VENDOR defined without SAFE_SERIAL_PRODUCT" 95#error "SAFE_SERIAL_VENDOR defined without SAFE_SERIAL_PRODUCT"
96#endif 96#endif
97 97
98#if ! defined(CONFIG_USBD_SAFE_SERIAL_VENDOR) 98#if ! defined(CONFIG_USBD_SAFE_SERIAL_VENDOR)
@@ -397,9 +397,11 @@ static int safe_startup (struct usb_serial *serial)
397 return 0; 397 return 0;
398} 398}
399 399
400static struct usb_serial_device_type safe_device = { 400static struct usb_serial_driver safe_device = {
401 .owner = THIS_MODULE, 401 .driver = {
402 .name = "Safe", 402 .owner = THIS_MODULE,
403 .name = "safe_serial",
404 },
403 .id_table = id_table, 405 .id_table = id_table,
404 .num_interrupt_in = NUM_DONT_CARE, 406 .num_interrupt_in = NUM_DONT_CARE,
405 .num_bulk_in = NUM_DONT_CARE, 407 .num_bulk_in = NUM_DONT_CARE,
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 59c88de3e7ae..205dbf7201da 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -255,9 +255,12 @@ static struct usb_driver ti_usb_driver = {
255 .id_table = ti_id_table_combined, 255 .id_table = ti_id_table_combined,
256}; 256};
257 257
258static struct usb_serial_device_type ti_1port_device = { 258static struct usb_serial_driver ti_1port_device = {
259 .owner = THIS_MODULE, 259 .driver = {
260 .name = "TI USB 3410 1 port adapter", 260 .owner = THIS_MODULE,
261 .name = "ti_usb_3410_5052_1",
262 },
263 .description = "TI USB 3410 1 port adapter",
261 .id_table = ti_id_table_3410, 264 .id_table = ti_id_table_3410,
262 .num_interrupt_in = 1, 265 .num_interrupt_in = 1,
263 .num_bulk_in = 1, 266 .num_bulk_in = 1,
@@ -282,9 +285,12 @@ static struct usb_serial_device_type ti_1port_device = {
282 .write_bulk_callback = ti_bulk_out_callback, 285 .write_bulk_callback = ti_bulk_out_callback,
283}; 286};
284 287
285static struct usb_serial_device_type ti_2port_device = { 288static struct usb_serial_driver ti_2port_device = {
286 .owner = THIS_MODULE, 289 .driver = {
287 .name = "TI USB 5052 2 port adapter", 290 .owner = THIS_MODULE,
291 .name = "ti_usb_3410_5052_2",
292 },
293 .description = "TI USB 5052 2 port adapter",
288 .id_table = ti_id_table_5052, 294 .id_table = ti_id_table_5052,
289 .num_interrupt_in = 1, 295 .num_interrupt_in = 1,
290 .num_bulk_in = 2, 296 .num_bulk_in = 2,
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index e77fbdfc782d..0c4881d18cd5 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * USB Serial Converter driver 2 * USB Serial Converter driver
3 * 3 *
4 * Copyright (C) 1999 - 2004 Greg Kroah-Hartman (greg@kroah.com) 4 * Copyright (C) 1999 - 2005 Greg Kroah-Hartman (greg@kroah.com)
5 * Copyright (C) 2000 Peter Berger (pberger@brimson.com) 5 * Copyright (C) 2000 Peter Berger (pberger@brimson.com)
6 * Copyright (C) 2000 Al Borchers (borchers@steinerpoint.com) 6 * Copyright (C) 2000 Al Borchers (borchers@steinerpoint.com)
7 * 7 *
@@ -9,316 +9,11 @@
9 * modify it under the terms of the GNU General Public License version 9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation. 10 * 2 as published by the Free Software Foundation.
11 * 11 *
12 * This driver was originally based on the ACM driver by Armin Fuerst (which was 12 * This driver was originally based on the ACM driver by Armin Fuerst (which was
13 * based on a driver by Brad Keryan) 13 * based on a driver by Brad Keryan)
14 * 14 *
15 * See Documentation/usb/usb-serial.txt for more information on using this driver 15 * See Documentation/usb/usb-serial.txt for more information on using this driver
16 * 16 *
17 * (12/10/2002) gkh
18 * Split the ports off into their own struct device, and added a
19 * usb-serial bus driver.
20 *
21 * (11/19/2002) gkh
22 * removed a few #ifdefs for the generic code and cleaned up the failure
23 * logic in initialization.
24 *
25 * (10/02/2002) gkh
26 * moved the console code to console.c and out of this file.
27 *
28 * (06/05/2002) gkh
29 * moved location of startup() call in serial_probe() until after all
30 * of the port information and endpoints are initialized. This makes
31 * things easier for some drivers.
32 *
33 * (04/10/2002) gkh
34 * added serial_read_proc function which creates a
35 * /proc/tty/driver/usb-serial file.
36 *
37 * (03/27/2002) gkh
38 * Got USB serial console code working properly and merged into the main
39 * version of the tree. Thanks to Randy Dunlap for the initial version
40 * of this code, and for pushing me to finish it up.
41 * The USB serial console works with any usb serial driver device.
42 *
43 * (03/21/2002) gkh
44 * Moved all manipulation of port->open_count into the core. Now the
45 * individual driver's open and close functions are called only when the
46 * first open() and last close() is called. Making the drivers a bit
47 * smaller and simpler.
48 * Fixed a bug if a driver didn't have the owner field set.
49 *
50 * (02/26/2002) gkh
51 * Moved all locking into the main serial_* functions, instead of having
52 * the individual drivers have to grab the port semaphore. This should
53 * reduce races.
54 * Reworked the MOD_INC logic a bit to always increment and decrement, even
55 * if the generic driver is being used.
56 *
57 * (10/10/2001) gkh
58 * usb_serial_disconnect() now sets the serial->dev pointer is to NULL to
59 * help prevent child drivers from accessing the device since it is now
60 * gone.
61 *
62 * (09/13/2001) gkh
63 * Moved generic driver initialize after we have registered with the USB
64 * core. Thanks to Randy Dunlap for pointing this problem out.
65 *
66 * (07/03/2001) gkh
67 * Fixed module paramater size. Thanks to John Brockmeyer for the pointer.
68 * Fixed vendor and product getting defined through the MODULE_PARM macro
69 * if the Generic driver wasn't compiled in.
70 * Fixed problem with generic_shutdown() not being called for drivers that
71 * don't have a shutdown() function.
72 *
73 * (06/06/2001) gkh
74 * added evil hack that is needed for the prolific pl2303 device due to the
75 * crazy way its endpoints are set up.
76 *
77 * (05/30/2001) gkh
78 * switched from using spinlock to a semaphore, which fixes lots of problems.
79 *
80 * (04/08/2001) gb
81 * Identify version on module load.
82 *
83 * 2001_02_05 gkh
84 * Fixed buffer overflows bug with the generic serial driver. Thanks to
85 * Todd Squires <squirest@ct0.com> for fixing this.
86 *
87 * (01/10/2001) gkh
88 * Fixed bug where the generic serial adaptor grabbed _any_ device that was
89 * offered to it.
90 *
91 * (12/12/2000) gkh
92 * Removed MOD_INC and MOD_DEC from poll and disconnect functions, and
93 * moved them to the serial_open and serial_close functions.
94 * Also fixed bug with there not being a MOD_DEC for the generic driver
95 * (thanks to Gary Brubaker for finding this.)
96 *
97 * (11/29/2000) gkh
98 * Small NULL pointer initialization cleanup which saves a bit of disk image
99 *
100 * (11/01/2000) Adam J. Richter
101 * instead of using idVendor/idProduct pairs, usb serial drivers
102 * now identify their hardware interest with usb_device_id tables,
103 * which they usually have anyhow for use with MODULE_DEVICE_TABLE.
104 *
105 * (10/05/2000) gkh
106 * Fixed bug with urb->dev not being set properly, now that the usb
107 * core needs it.
108 *
109 * (09/11/2000) gkh
110 * Removed DEBUG #ifdefs with call to usb_serial_debug_data
111 *
112 * (08/28/2000) gkh
113 * Added port_lock to port structure.
114 * Added locks for SMP safeness to generic driver
115 * Fixed the ability to open a generic device's port more than once.
116 *
117 * (07/23/2000) gkh
118 * Added bulk_out_endpointAddress to port structure.
119 *
120 * (07/19/2000) gkh, pberger, and borchers
121 * Modifications to allow usb-serial drivers to be modules.
122 *
123 * (07/03/2000) gkh
124 * Added more debugging to serial_ioctl call
125 *
126 * (06/25/2000) gkh
127 * Changed generic_write_bulk_callback to not call wake_up_interruptible
128 * directly, but to have port_softint do it at a safer time.
129 *
130 * (06/23/2000) gkh
131 * Cleaned up debugging statements in a quest to find UHCI timeout bug.
132 *
133 * (05/22/2000) gkh
134 * Changed the makefile, enabling the big CONFIG_USB_SERIAL_SOMTHING to be
135 * removed from the individual device source files.
136 *
137 * (05/03/2000) gkh
138 * Added the Digi Acceleport driver from Al Borchers and Peter Berger.
139 *
140 * (05/02/2000) gkh
141 * Changed devfs and tty register code to work properly now. This was based on
142 * the ACM driver changes by Vojtech Pavlik.
143 *
144 * (04/27/2000) Ryan VanderBijl
145 * Put calls to *_paranoia_checks into one function.
146 *
147 * (04/23/2000) gkh
148 * Fixed bug that Randy Dunlap found for Generic devices with no bulk out ports.
149 * Moved when the startup code printed out the devices that are supported.
150 *
151 * (04/19/2000) gkh
152 * Added driver for ZyXEL omni.net lcd plus ISDN TA
153 * Made startup info message specify which drivers were compiled in.
154 *
155 * (04/03/2000) gkh
156 * Changed the probe process to remove the module unload races.
157 * Changed where the tty layer gets initialized to have devfs work nicer.
158 * Added initial devfs support.
159 *
160 * (03/26/2000) gkh
161 * Split driver up into device specific pieces.
162 *
163 * (03/19/2000) gkh
164 * Fixed oops that could happen when device was removed while a program
165 * was talking to the device.
166 * Removed the static urbs and now all urbs are created and destroyed
167 * dynamically.
168 * Reworked the internal interface. Now everything is based on the
169 * usb_serial_port structure instead of the larger usb_serial structure.
170 * This fixes the bug that a multiport device could not have more than
171 * one port open at one time.
172 *
173 * (03/17/2000) gkh
174 * Added config option for debugging messages.
175 * Added patch for keyspan pda from Brian Warner.
176 *
177 * (03/06/2000) gkh
178 * Added the keyspan pda code from Brian Warner <warner@lothar.com>
179 * Moved a bunch of the port specific stuff into its own structure. This
180 * is in anticipation of the true multiport devices (there's a bug if you
181 * try to access more than one port of any multiport device right now)
182 *
183 * (02/21/2000) gkh
184 * Made it so that any serial devices only have to specify which functions
185 * they want to overload from the generic function calls (great,
186 * inheritance in C, in a driver, just what I wanted...)
187 * Added support for set_termios and ioctl function calls. No drivers take
188 * advantage of this yet.
189 * Removed the #ifdef MODULE, now there is no module specific code.
190 * Cleaned up a few comments in usb-serial.h that were wrong (thanks again
191 * to Miles Lott).
192 * Small fix to get_free_serial.
193 *
194 * (02/14/2000) gkh
195 * Removed the Belkin and Peracom functionality from the driver due to
196 * the lack of support from the vendor, and me not wanting people to
197 * accidenatly buy the device, expecting it to work with Linux.
198 * Added read_bulk_callback and write_bulk_callback to the type structure
199 * for the needs of the FTDI and WhiteHEAT driver.
200 * Changed all reverences to FTDI to FTDI_SIO at the request of Bill
201 * Ryder.
202 * Changed the output urb size back to the max endpoint size to make
203 * the ftdi_sio driver have it easier, and due to the fact that it didn't
204 * really increase the speed any.
205 *
206 * (02/11/2000) gkh
207 * Added VISOR_FUNCTION_CONSOLE to the visor startup function. This was a
208 * patch from Miles Lott (milos@insync.net).
209 * Fixed bug with not restoring the minor range that a device grabs, if
210 * the startup function fails (thanks Miles for finding this).
211 *
212 * (02/05/2000) gkh
213 * Added initial framework for the Keyspan PDA serial converter so that
214 * Brian Warner has a place to put his code.
215 * Made the ezusb specific functions generic enough that different
216 * devices can use them (whiteheat and keyspan_pda both need them).
217 * Split out a whole bunch of structure and other stuff to a separate
218 * usb-serial.h file.
219 * Made the Visor connection messages a little more understandable, now
220 * that Miles Lott (milos@insync.net) has gotten the Generic channel to
221 * work. Also made them always show up in the log file.
222 *
223 * (01/25/2000) gkh
224 * Added initial framework for FTDI serial converter so that Bill Ryder
225 * has a place to put his code.
226 * Added the vendor specific info from Handspring. Now we can print out
227 * informational debug messages as well as understand what is happening.
228 *
229 * (01/23/2000) gkh
230 * Fixed problem of crash when trying to open a port that didn't have a
231 * device assigned to it. Made the minor node finding a little smarter,
232 * now it looks to find a continuous space for the new device.
233 *
234 * (01/21/2000) gkh
235 * Fixed bug in visor_startup with patch from Miles Lott (milos@insync.net)
236 * Fixed get_serial_by_minor which was all messed up for multi port
237 * devices. Fixed multi port problem for generic devices. Now the number
238 * of ports is determined by the number of bulk out endpoints for the
239 * generic device.
240 *
241 * (01/19/2000) gkh
242 * Removed lots of cruft that was around from the old (pre urb) driver
243 * interface.
244 * Made the serial_table dynamic. This should save lots of memory when
245 * the number of minor nodes goes up to 256.
246 * Added initial support for devices that have more than one port.
247 * Added more debugging comments for the Visor, and added a needed
248 * set_configuration call.
249 *
250 * (01/17/2000) gkh
251 * Fixed the WhiteHEAT firmware (my processing tool had a bug)
252 * and added new debug loader firmware for it.
253 * Removed the put_char function as it isn't really needed.
254 * Added visor startup commands as found by the Win98 dump.
255 *
256 * (01/13/2000) gkh
257 * Fixed the vendor id for the generic driver to the one I meant it to be.
258 *
259 * (01/12/2000) gkh
260 * Forget the version numbering...that's pretty useless...
261 * Made the driver able to be compiled so that the user can select which
262 * converter they want to use. This allows people who only want the Visor
263 * support to not pay the memory size price of the WhiteHEAT.
264 * Fixed bug where the generic driver (idVendor=0000 and idProduct=0000)
265 * grabbed the root hub. Not good.
266 *
267 * version 0.4.0 (01/10/2000) gkh
268 * Added whiteheat.h containing the firmware for the ConnectTech WhiteHEAT
269 * device. Added startup function to allow firmware to be downloaded to
270 * a device if it needs to be.
271 * Added firmware download logic to the WhiteHEAT device.
272 * Started to add #defines to split up the different drivers for potential
273 * configuration option.
274 *
275 * version 0.3.1 (12/30/99) gkh
276 * Fixed problems with urb for bulk out.
277 * Added initial support for multiple sets of endpoints. This enables
278 * the Handspring Visor to be attached successfully. Only the first
279 * bulk in / bulk out endpoint pair is being used right now.
280 *
281 * version 0.3.0 (12/27/99) gkh
282 * Added initial support for the Handspring Visor based on a patch from
283 * Miles Lott (milos@sneety.insync.net)
284 * Cleaned up the code a bunch and converted over to using urbs only.
285 *
286 * version 0.2.3 (12/21/99) gkh
287 * Added initial support for the Connect Tech WhiteHEAT converter.
288 * Incremented the number of ports in expectation of getting the
289 * WhiteHEAT to work properly (4 ports per connection).
290 * Added notification on insertion and removal of what port the
291 * device is/was connected to (and what kind of device it was).
292 *
293 * version 0.2.2 (12/16/99) gkh
294 * Changed major number to the new allocated number. We're legal now!
295 *
296 * version 0.2.1 (12/14/99) gkh
297 * Fixed bug that happens when device node is opened when there isn't a
298 * device attached to it. Thanks to marek@webdesign.no for noticing this.
299 *
300 * version 0.2.0 (11/10/99) gkh
301 * Split up internals to make it easier to add different types of serial
302 * converters to the code.
303 * Added a "generic" driver that gets it's vendor and product id
304 * from when the module is loaded. Thanks to David E. Nelson (dnelson@jump.net)
305 * for the idea and sample code (from the usb scanner driver.)
306 * Cleared up any licensing questions by releasing it under the GNU GPL.
307 *
308 * version 0.1.2 (10/25/99) gkh
309 * Fixed bug in detecting device.
310 *
311 * version 0.1.1 (10/05/99) gkh
312 * Changed the major number to not conflict with anything else.
313 *
314 * version 0.1 (09/28/99) gkh
315 * Can recognize the two different devices and start up a read from
316 * device when asked to. Writes also work. No control signals yet, this
317 * all is vendor specific data (i.e. no spec), also no control for
318 * different baud rates or other bit settings.
319 * Currently we are using the same devid as the acm driver. This needs
320 * to change.
321 *
322 */ 17 */
323 18
324#include <linux/config.h> 19#include <linux/config.h>
@@ -342,7 +37,6 @@
342/* 37/*
343 * Version Information 38 * Version Information
344 */ 39 */
345#define DRIVER_VERSION "v2.0"
346#define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux/" 40#define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux/"
347#define DRIVER_DESC "USB Serial Driver core" 41#define DRIVER_DESC "USB Serial Driver core"
348 42
@@ -427,7 +121,7 @@ static void destroy_serial(struct kref *kref)
427 121
428 serial = to_usb_serial(kref); 122 serial = to_usb_serial(kref);
429 123
430 dbg ("%s - %s", __FUNCTION__, serial->type->name); 124 dbg("%s - %s", __FUNCTION__, serial->type->description);
431 125
432 serial->type->shutdown(serial); 126 serial->type->shutdown(serial);
433 127
@@ -507,7 +201,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
507 /* lock this module before we call it 201 /* lock this module before we call it
508 * this may fail, which means we must bail out, 202 * this may fail, which means we must bail out,
509 * safe because we are called with BKL held */ 203 * safe because we are called with BKL held */
510 if (!try_module_get(serial->type->owner)) { 204 if (!try_module_get(serial->type->driver.owner)) {
511 retval = -ENODEV; 205 retval = -ENODEV;
512 goto bailout_kref_put; 206 goto bailout_kref_put;
513 } 207 }
@@ -522,7 +216,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
522 return 0; 216 return 0;
523 217
524bailout_module_put: 218bailout_module_put:
525 module_put(serial->type->owner); 219 module_put(serial->type->driver.owner);
526bailout_kref_put: 220bailout_kref_put:
527 kref_put(&serial->kref, destroy_serial); 221 kref_put(&serial->kref, destroy_serial);
528 port->open_count = 0; 222 port->open_count = 0;
@@ -553,7 +247,7 @@ static void serial_close(struct tty_struct *tty, struct file * filp)
553 port->tty = NULL; 247 port->tty = NULL;
554 } 248 }
555 249
556 module_put(port->serial->type->owner); 250 module_put(port->serial->type->driver.owner);
557 } 251 }
558 252
559 kref_put(&port->serial->kref, destroy_serial); 253 kref_put(&port->serial->kref, destroy_serial);
@@ -711,16 +405,16 @@ static int serial_read_proc (char *page, char **start, off_t off, int count, int
711 char tmp[40]; 405 char tmp[40];
712 406
713 dbg("%s", __FUNCTION__); 407 dbg("%s", __FUNCTION__);
714 length += sprintf (page, "usbserinfo:1.0 driver:%s\n", DRIVER_VERSION); 408 length += sprintf (page, "usbserinfo:1.0 driver:2.0\n");
715 for (i = 0; i < SERIAL_TTY_MINORS && length < PAGE_SIZE; ++i) { 409 for (i = 0; i < SERIAL_TTY_MINORS && length < PAGE_SIZE; ++i) {
716 serial = usb_serial_get_by_index(i); 410 serial = usb_serial_get_by_index(i);
717 if (serial == NULL) 411 if (serial == NULL)
718 continue; 412 continue;
719 413
720 length += sprintf (page+length, "%d:", i); 414 length += sprintf (page+length, "%d:", i);
721 if (serial->type->owner) 415 if (serial->type->driver.owner)
722 length += sprintf (page+length, " module:%s", module_name(serial->type->owner)); 416 length += sprintf (page+length, " module:%s", module_name(serial->type->driver.owner));
723 length += sprintf (page+length, " name:\"%s\"", serial->type->name); 417 length += sprintf (page+length, " name:\"%s\"", serial->type->description);
724 length += sprintf (page+length, " vendor:%04x product:%04x", 418 length += sprintf (page+length, " vendor:%04x product:%04x",
725 le16_to_cpu(serial->dev->descriptor.idVendor), 419 le16_to_cpu(serial->dev->descriptor.idVendor),
726 le16_to_cpu(serial->dev->descriptor.idProduct)); 420 le16_to_cpu(serial->dev->descriptor.idProduct));
@@ -823,7 +517,7 @@ static void port_release(struct device *dev)
823 517
824static struct usb_serial * create_serial (struct usb_device *dev, 518static struct usb_serial * create_serial (struct usb_device *dev,
825 struct usb_interface *interface, 519 struct usb_interface *interface,
826 struct usb_serial_device_type *type) 520 struct usb_serial_driver *driver)
827{ 521{
828 struct usb_serial *serial; 522 struct usb_serial *serial;
829 523
@@ -834,22 +528,22 @@ static struct usb_serial * create_serial (struct usb_device *dev,
834 } 528 }
835 memset (serial, 0, sizeof(*serial)); 529 memset (serial, 0, sizeof(*serial));
836 serial->dev = usb_get_dev(dev); 530 serial->dev = usb_get_dev(dev);
837 serial->type = type; 531 serial->type = driver;
838 serial->interface = interface; 532 serial->interface = interface;
839 kref_init(&serial->kref); 533 kref_init(&serial->kref);
840 534
841 return serial; 535 return serial;
842} 536}
843 537
844static struct usb_serial_device_type *search_serial_device(struct usb_interface *iface) 538static struct usb_serial_driver *search_serial_device(struct usb_interface *iface)
845{ 539{
846 struct list_head *p; 540 struct list_head *p;
847 const struct usb_device_id *id; 541 const struct usb_device_id *id;
848 struct usb_serial_device_type *t; 542 struct usb_serial_driver *t;
849 543
850 /* List trough know devices and see if the usb id matches */ 544 /* List trough know devices and see if the usb id matches */
851 list_for_each(p, &usb_serial_driver_list) { 545 list_for_each(p, &usb_serial_driver_list) {
852 t = list_entry(p, struct usb_serial_device_type, driver_list); 546 t = list_entry(p, struct usb_serial_driver, driver_list);
853 id = usb_match_id(iface, t->id_table); 547 id = usb_match_id(iface, t->id_table);
854 if (id != NULL) { 548 if (id != NULL) {
855 dbg("descriptor matches"); 549 dbg("descriptor matches");
@@ -872,7 +566,7 @@ int usb_serial_probe(struct usb_interface *interface,
872 struct usb_endpoint_descriptor *interrupt_out_endpoint[MAX_NUM_PORTS]; 566 struct usb_endpoint_descriptor *interrupt_out_endpoint[MAX_NUM_PORTS];
873 struct usb_endpoint_descriptor *bulk_in_endpoint[MAX_NUM_PORTS]; 567 struct usb_endpoint_descriptor *bulk_in_endpoint[MAX_NUM_PORTS];
874 struct usb_endpoint_descriptor *bulk_out_endpoint[MAX_NUM_PORTS]; 568 struct usb_endpoint_descriptor *bulk_out_endpoint[MAX_NUM_PORTS];
875 struct usb_serial_device_type *type = NULL; 569 struct usb_serial_driver *type = NULL;
876 int retval; 570 int retval;
877 int minor; 571 int minor;
878 int buffer_size; 572 int buffer_size;
@@ -900,7 +594,7 @@ int usb_serial_probe(struct usb_interface *interface,
900 if (type->probe) { 594 if (type->probe) {
901 const struct usb_device_id *id; 595 const struct usb_device_id *id;
902 596
903 if (!try_module_get(type->owner)) { 597 if (!try_module_get(type->driver.owner)) {
904 dev_err(&interface->dev, "module get failed, exiting\n"); 598 dev_err(&interface->dev, "module get failed, exiting\n");
905 kfree (serial); 599 kfree (serial);
906 return -EIO; 600 return -EIO;
@@ -908,7 +602,7 @@ int usb_serial_probe(struct usb_interface *interface,
908 602
909 id = usb_match_id(interface, type->id_table); 603 id = usb_match_id(interface, type->id_table);
910 retval = type->probe(serial, id); 604 retval = type->probe(serial, id);
911 module_put(type->owner); 605 module_put(type->driver.owner);
912 606
913 if (retval) { 607 if (retval) {
914 dbg ("sub driver rejected device"); 608 dbg ("sub driver rejected device");
@@ -992,7 +686,7 @@ int usb_serial_probe(struct usb_interface *interface,
992#endif 686#endif
993 687
994 /* found all that we need */ 688 /* found all that we need */
995 dev_info(&interface->dev, "%s converter detected\n", type->name); 689 dev_info(&interface->dev, "%s converter detected\n", type->description);
996 690
997#ifdef CONFIG_USB_SERIAL_GENERIC 691#ifdef CONFIG_USB_SERIAL_GENERIC
998 if (type == &usb_serial_generic_device) { 692 if (type == &usb_serial_generic_device) {
@@ -1007,13 +701,13 @@ int usb_serial_probe(struct usb_interface *interface,
1007 if (!num_ports) { 701 if (!num_ports) {
1008 /* if this device type has a calc_num_ports function, call it */ 702 /* if this device type has a calc_num_ports function, call it */
1009 if (type->calc_num_ports) { 703 if (type->calc_num_ports) {
1010 if (!try_module_get(type->owner)) { 704 if (!try_module_get(type->driver.owner)) {
1011 dev_err(&interface->dev, "module get failed, exiting\n"); 705 dev_err(&interface->dev, "module get failed, exiting\n");
1012 kfree (serial); 706 kfree (serial);
1013 return -EIO; 707 return -EIO;
1014 } 708 }
1015 num_ports = type->calc_num_ports (serial); 709 num_ports = type->calc_num_ports (serial);
1016 module_put(type->owner); 710 module_put(type->driver.owner);
1017 } 711 }
1018 if (!num_ports) 712 if (!num_ports)
1019 num_ports = type->num_ports; 713 num_ports = type->num_ports;
@@ -1158,12 +852,12 @@ int usb_serial_probe(struct usb_interface *interface,
1158 852
1159 /* if this device type has an attach function, call it */ 853 /* if this device type has an attach function, call it */
1160 if (type->attach) { 854 if (type->attach) {
1161 if (!try_module_get(type->owner)) { 855 if (!try_module_get(type->driver.owner)) {
1162 dev_err(&interface->dev, "module get failed, exiting\n"); 856 dev_err(&interface->dev, "module get failed, exiting\n");
1163 goto probe_error; 857 goto probe_error;
1164 } 858 }
1165 retval = type->attach (serial); 859 retval = type->attach (serial);
1166 module_put(type->owner); 860 module_put(type->driver.owner);
1167 if (retval < 0) 861 if (retval < 0)
1168 goto probe_error; 862 goto probe_error;
1169 if (retval > 0) { 863 if (retval > 0) {
@@ -1330,7 +1024,7 @@ static int __init usb_serial_init(void)
1330 goto exit_generic; 1024 goto exit_generic;
1331 } 1025 }
1332 1026
1333 info(DRIVER_DESC " " DRIVER_VERSION); 1027 info(DRIVER_DESC);
1334 1028
1335 return result; 1029 return result;
1336 1030
@@ -1375,7 +1069,7 @@ module_exit(usb_serial_exit);
1375 } \ 1069 } \
1376 } while (0) 1070 } while (0)
1377 1071
1378static void fixup_generic(struct usb_serial_device_type *device) 1072static void fixup_generic(struct usb_serial_driver *device)
1379{ 1073{
1380 set_to_generic_if_null(device, open); 1074 set_to_generic_if_null(device, open);
1381 set_to_generic_if_null(device, write); 1075 set_to_generic_if_null(device, write);
@@ -1387,30 +1081,33 @@ static void fixup_generic(struct usb_serial_device_type *device)
1387 set_to_generic_if_null(device, shutdown); 1081 set_to_generic_if_null(device, shutdown);
1388} 1082}
1389 1083
1390int usb_serial_register(struct usb_serial_device_type *new_device) 1084int usb_serial_register(struct usb_serial_driver *driver)
1391{ 1085{
1392 int retval; 1086 int retval;
1393 1087
1394 fixup_generic(new_device); 1088 fixup_generic(driver);
1089
1090 if (!driver->description)
1091 driver->description = driver->driver.name;
1395 1092
1396 /* Add this device to our list of devices */ 1093 /* Add this device to our list of devices */
1397 list_add(&new_device->driver_list, &usb_serial_driver_list); 1094 list_add(&driver->driver_list, &usb_serial_driver_list);
1398 1095
1399 retval = usb_serial_bus_register(new_device); 1096 retval = usb_serial_bus_register(driver);
1400 if (retval) { 1097 if (retval) {
1401 err("problem %d when registering driver %s", retval, new_device->name); 1098 err("problem %d when registering driver %s", retval, driver->description);
1402 list_del(&new_device->driver_list); 1099 list_del(&driver->driver_list);
1403 } 1100 }
1404 else 1101 else
1405 info("USB Serial support registered for %s", new_device->name); 1102 info("USB Serial support registered for %s", driver->description);
1406 1103
1407 return retval; 1104 return retval;
1408} 1105}
1409 1106
1410 1107
1411void usb_serial_deregister(struct usb_serial_device_type *device) 1108void usb_serial_deregister(struct usb_serial_driver *device)
1412{ 1109{
1413 info("USB Serial deregistering driver %s", device->name); 1110 info("USB Serial deregistering driver %s", device->description);
1414 list_del(&device->driver_list); 1111 list_del(&device->driver_list);
1415 usb_serial_bus_deregister(device); 1112 usb_serial_bus_deregister(device);
1416} 1113}
@@ -1429,7 +1126,6 @@ EXPORT_SYMBOL_GPL(usb_serial_port_softint);
1429/* Module information */ 1126/* Module information */
1430MODULE_AUTHOR( DRIVER_AUTHOR ); 1127MODULE_AUTHOR( DRIVER_AUTHOR );
1431MODULE_DESCRIPTION( DRIVER_DESC ); 1128MODULE_DESCRIPTION( DRIVER_DESC );
1432MODULE_VERSION( DRIVER_VERSION );
1433MODULE_LICENSE("GPL"); 1129MODULE_LICENSE("GPL");
1434 1130
1435module_param(debug, bool, S_IRUGO | S_IWUSR); 1131module_param(debug, bool, S_IRUGO | S_IWUSR);
diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h
index 57f92f054c75..238a5a871ed6 100644
--- a/drivers/usb/serial/usb-serial.h
+++ b/drivers/usb/serial/usb-serial.h
@@ -1,53 +1,13 @@
1/* 1/*
2 * USB Serial Converter driver 2 * USB Serial Converter driver
3 * 3 *
4 * Copyright (C) 1999 - 2004 4 * Copyright (C) 1999 - 2005
5 * Greg Kroah-Hartman (greg@kroah.com) 5 * Greg Kroah-Hartman (greg@kroah.com)
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or 9 * the Free Software Foundation; either version 2 of the License.
10 * (at your option) any later version.
11 * 10 *
12 * See Documentation/usb/usb-serial.txt for more information on using this driver
13 *
14 * (03/26/2002) gkh
15 * removed the port->tty check from port_paranoia_check() due to serial
16 * consoles not having a tty device assigned to them.
17 *
18 * (12/03/2001) gkh
19 * removed active from the port structure.
20 * added documentation to the usb_serial_device_type structure
21 *
22 * (10/10/2001) gkh
23 * added vendor and product to serial structure. Needed to determine device
24 * owner when the device is disconnected.
25 *
26 * (05/30/2001) gkh
27 * added sem to port structure and removed port_lock
28 *
29 * (10/05/2000) gkh
30 * Added interrupt_in_endpointAddress and bulk_in_endpointAddress to help
31 * fix bug with urb->dev not being set properly, now that the usb core
32 * needs it.
33 *
34 * (09/11/2000) gkh
35 * Added usb_serial_debug_data function to help get rid of #DEBUG in the
36 * drivers.
37 *
38 * (08/28/2000) gkh
39 * Added port_lock to port structure.
40 *
41 * (08/08/2000) gkh
42 * Added open_count to port structure.
43 *
44 * (07/23/2000) gkh
45 * Added bulk_out_endpointAddress to port structure.
46 *
47 * (07/19/2000) gkh, pberger, and borchers
48 * Modifications to allow usb-serial drivers to be modules.
49 *
50 *
51 */ 11 */
52 12
53 13
@@ -143,7 +103,7 @@ static inline void usb_set_serial_port_data (struct usb_serial_port *port, void
143/** 103/**
144 * usb_serial - structure used by the usb-serial core for a device 104 * usb_serial - structure used by the usb-serial core for a device
145 * @dev: pointer to the struct usb_device for this device 105 * @dev: pointer to the struct usb_device for this device
146 * @type: pointer to the struct usb_serial_device_type for this device 106 * @type: pointer to the struct usb_serial_driver for this device
147 * @interface: pointer to the struct usb_interface for this device 107 * @interface: pointer to the struct usb_interface for this device
148 * @minor: the starting minor number for this device 108 * @minor: the starting minor number for this device
149 * @num_ports: the number of ports this device has 109 * @num_ports: the number of ports this device has
@@ -159,7 +119,7 @@ static inline void usb_set_serial_port_data (struct usb_serial_port *port, void
159 */ 119 */
160struct usb_serial { 120struct usb_serial {
161 struct usb_device * dev; 121 struct usb_device * dev;
162 struct usb_serial_device_type * type; 122 struct usb_serial_driver * type;
163 struct usb_interface * interface; 123 struct usb_interface * interface;
164 unsigned char minor; 124 unsigned char minor;
165 unsigned char num_ports; 125 unsigned char num_ports;
@@ -188,13 +148,9 @@ static inline void usb_set_serial_data (struct usb_serial *serial, void *data)
188} 148}
189 149
190/** 150/**
191 * usb_serial_device_type - a structure that defines a usb serial device 151 * usb_serial_driver - describes a usb serial driver
192 * @owner: pointer to the module that owns this device. 152 * @description: pointer to a string that describes this driver. This string used
193 * @name: pointer to a string that describes this device. This string used
194 * in the syslog messages when a device is inserted or removed. 153 * in the syslog messages when a device is inserted or removed.
195 * @short_name: a pointer to a string that describes this device in
196 * KOBJ_NAME_LEN characters or less. This is used for the sysfs interface
197 * to describe the driver.
198 * @id_table: pointer to a list of usb_device_id structures that define all 154 * @id_table: pointer to a list of usb_device_id structures that define all
199 * of the devices this structure can support. 155 * of the devices this structure can support.
200 * @num_interrupt_in: the number of interrupt in endpoints this device will 156 * @num_interrupt_in: the number of interrupt in endpoints this device will
@@ -221,16 +177,19 @@ static inline void usb_set_serial_data (struct usb_serial *serial, void *data)
221 * @shutdown: pointer to the driver's shutdown function. This will be 177 * @shutdown: pointer to the driver's shutdown function. This will be
222 * called when the device is removed from the system. 178 * called when the device is removed from the system.
223 * 179 *
224 * This structure is defines a USB Serial device. It provides all of 180 * This structure is defines a USB Serial driver. It provides all of
225 * the information that the USB serial core code needs. If the function 181 * the information that the USB serial core code needs. If the function
226 * pointers are defined, then the USB serial core code will call them when 182 * pointers are defined, then the USB serial core code will call them when
227 * the corresponding tty port functions are called. If they are not 183 * the corresponding tty port functions are called. If they are not
228 * called, the generic serial function will be used instead. 184 * called, the generic serial function will be used instead.
185 *
186 * The driver.owner field should be set to the module owner of this driver.
187 * The driver.name field should be set to the name of this driver (remember
188 * it will show up in sysfs, so it needs to be short and to the point.
189 * Useing the module name is a good idea.)
229 */ 190 */
230struct usb_serial_device_type { 191struct usb_serial_driver {
231 struct module *owner; 192 const char *description;
232 char *name;
233 char *short_name;
234 const struct usb_device_id *id_table; 193 const struct usb_device_id *id_table;
235 char num_interrupt_in; 194 char num_interrupt_in;
236 char num_interrupt_out; 195 char num_interrupt_out;
@@ -269,10 +228,10 @@ struct usb_serial_device_type {
269 void (*read_bulk_callback)(struct urb *urb, struct pt_regs *regs); 228 void (*read_bulk_callback)(struct urb *urb, struct pt_regs *regs);
270 void (*write_bulk_callback)(struct urb *urb, struct pt_regs *regs); 229 void (*write_bulk_callback)(struct urb *urb, struct pt_regs *regs);
271}; 230};
272#define to_usb_serial_driver(d) container_of(d, struct usb_serial_device_type, driver) 231#define to_usb_serial_driver(d) container_of(d, struct usb_serial_driver, driver)
273 232
274extern int usb_serial_register(struct usb_serial_device_type *new_device); 233extern int usb_serial_register(struct usb_serial_driver *driver);
275extern void usb_serial_deregister(struct usb_serial_device_type *device); 234extern void usb_serial_deregister(struct usb_serial_driver *driver);
276extern void usb_serial_port_softint(void *private); 235extern void usb_serial_port_softint(void *private);
277 236
278extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id); 237extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id);
@@ -303,10 +262,10 @@ extern void usb_serial_generic_shutdown (struct usb_serial *serial);
303extern int usb_serial_generic_register (int debug); 262extern int usb_serial_generic_register (int debug);
304extern void usb_serial_generic_deregister (void); 263extern void usb_serial_generic_deregister (void);
305 264
306extern int usb_serial_bus_register (struct usb_serial_device_type *device); 265extern int usb_serial_bus_register (struct usb_serial_driver *device);
307extern void usb_serial_bus_deregister (struct usb_serial_device_type *device); 266extern void usb_serial_bus_deregister (struct usb_serial_driver *device);
308 267
309extern struct usb_serial_device_type usb_serial_generic_device; 268extern struct usb_serial_driver usb_serial_generic_device;
310extern struct bus_type usb_serial_bus_type; 269extern struct bus_type usb_serial_bus_type;
311extern struct tty_driver *usb_serial_tty_driver; 270extern struct tty_driver *usb_serial_tty_driver;
312 271
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 31c57adcb623..a473c1c34559 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -7,139 +7,10 @@
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License.
11 * (at your option) any later version.
12 * 11 *
13 * See Documentation/usb/usb-serial.txt for more information on using this driver 12 * See Documentation/usb/usb-serial.txt for more information on using this driver
14 * 13 *
15 * (06/03/2003) Judd Montgomery <judd at jpilot.org>
16 * Added support for module parameter options for untested/unknown
17 * devices.
18 *
19 * (03/09/2003) gkh
20 * Added support for the Sony Clie NZ90V device. Thanks to Martin Brachtl
21 * <brachtl@redgrep.cz> for the information.
22 *
23 * (03/05/2003) gkh
24 * Think Treo support is now working.
25 *
26 * (04/03/2002) gkh
27 * Added support for the Sony OS 4.1 devices. Thanks to Hiroyuki ARAKI
28 * <hiro@zob.ne.jp> for the information.
29 *
30 * (03/27/2002) gkh
31 * Removed assumptions that port->tty was always valid (is not true
32 * for usb serial console devices.)
33 *
34 * (03/23/2002) gkh
35 * Added support for the Palm i705 device, thanks to Thomas Riemer
36 * <tom@netmech.com> for the information.
37 *
38 * (03/21/2002) gkh
39 * Added support for the Palm m130 device, thanks to Udo Eisenbarth
40 * <udo.eisenbarth@web.de> for the information.
41 *
42 * (02/27/2002) gkh
43 * Reworked the urb handling logic. We have no more pool, but dynamically
44 * allocate the urb and the transfer buffer on the fly. In testing this
45 * does not incure any measurable overhead. This also relies on the fact
46 * that we have proper reference counting logic for urbs.
47 *
48 * (02/21/2002) SilaS
49 * Added initial support for the Palm m515 devices.
50 *
51 * (02/14/2002) gkh
52 * Added support for the Clie S-360 device.
53 *
54 * (12/18/2001) gkh
55 * Added better Clie support for 3.5 devices. Thanks to Geoffrey Levand
56 * for the patch.
57 *
58 * (11/11/2001) gkh
59 * Added support for the m125 devices, and added check to prevent oopses
60 * for Clié devices that lie about the number of ports they have.
61 *
62 * (08/30/2001) gkh
63 * Added support for the Clie devices, both the 3.5 and 4.0 os versions.
64 * Many thanks to Daniel Burke, and Bryan Payne for helping with this.
65 *
66 * (08/23/2001) gkh
67 * fixed a few potential bugs pointed out by Oliver Neukum.
68 *
69 * (05/30/2001) gkh
70 * switched from using spinlock to a semaphore, which fixes lots of problems.
71 *
72 * (05/28/2000) gkh
73 * Added initial support for the Palm m500 and Palm m505 devices.
74 *
75 * (04/08/2001) gb
76 * Identify version on module load.
77 *
78 * (01/21/2000) gkh
79 * Added write_room and chars_in_buffer, as they were previously using the
80 * generic driver versions which is all wrong now that we are using an urb
81 * pool. Thanks to Wolfgang Grandegger for pointing this out to me.
82 * Removed count assignment in the write function, which was not needed anymore
83 * either. Thanks to Al Borchers for pointing this out.
84 *
85 * (12/12/2000) gkh
86 * Moved MOD_DEC to end of visor_close to be nicer, as the final write
87 * message can sleep.
88 *
89 * (11/12/2000) gkh
90 * Fixed bug with data being dropped on the floor by forcing tty->low_latency
91 * to be on. Hopefully this fixes the OHCI issue!
92 *
93 * (11/01/2000) Adam J. Richter
94 * usb_device_id table support
95 *
96 * (10/05/2000) gkh
97 * Fixed bug with urb->dev not being set properly, now that the usb
98 * core needs it.
99 *
100 * (09/11/2000) gkh
101 * Got rid of always calling kmalloc for every urb we wrote out to the
102 * device.
103 * Added visor_read_callback so we can keep track of bytes in and out for
104 * those people who like to know the speed of their device.
105 * Removed DEBUG #ifdefs with call to usb_serial_debug_data
106 *
107 * (09/06/2000) gkh
108 * Fixed oops in visor_exit. Need to uncomment usb_unlink_urb call _after_
109 * the host controller drivers set urb->dev = NULL when the urb is finished.
110 *
111 * (08/28/2000) gkh
112 * Added locks for SMP safeness.
113 *
114 * (08/08/2000) gkh
115 * Fixed endian problem in visor_startup.
116 * Fixed MOD_INC and MOD_DEC logic and the ability to open a port more
117 * than once.
118 *
119 * (07/23/2000) gkh
120 * Added pool of write urbs to speed up transfers to the visor.
121 *
122 * (07/19/2000) gkh
123 * Added module_init and module_exit functions to handle the fact that this
124 * driver is a loadable module now.
125 *
126 * (07/03/2000) gkh
127 * Added visor_set_ioctl and visor_set_termios functions (they don't do much
128 * of anything, but are good for debugging.)
129 *
130 * (06/25/2000) gkh
131 * Fixed bug in visor_unthrottle that should help with the disconnect in PPP
132 * bug that people have been reporting.
133 *
134 * (06/23/2000) gkh
135 * Cleaned up debugging statements in a quest to find UHCI timeout bug.
136 *
137 * (04/27/2000) Ryan VanderBijl
138 * Fixed memory leak in visor_close
139 *
140 * (03/26/2000) gkh
141 * Split driver up into device specific pieces.
142 *
143 */ 14 */
144 15
145#include <linux/config.h> 16#include <linux/config.h>
@@ -161,7 +32,6 @@
161/* 32/*
162 * Version Information 33 * Version Information
163 */ 34 */
164#define DRIVER_VERSION "v2.1"
165#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>" 35#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
166#define DRIVER_DESC "USB HandSpring Visor / Palm OS driver" 36#define DRIVER_DESC "USB HandSpring Visor / Palm OS driver"
167 37
@@ -311,10 +181,12 @@ static struct usb_driver visor_driver = {
311}; 181};
312 182
313/* All of the device info needed for the Handspring Visor, and Palm 4.0 devices */ 183/* All of the device info needed for the Handspring Visor, and Palm 4.0 devices */
314static struct usb_serial_device_type handspring_device = { 184static struct usb_serial_driver handspring_device = {
315 .owner = THIS_MODULE, 185 .driver = {
316 .name = "Handspring Visor / Palm OS", 186 .owner = THIS_MODULE,
317 .short_name = "visor", 187 .name = "visor",
188 },
189 .description = "Handspring Visor / Palm OS",
318 .id_table = id_table, 190 .id_table = id_table,
319 .num_interrupt_in = NUM_DONT_CARE, 191 .num_interrupt_in = NUM_DONT_CARE,
320 .num_bulk_in = 2, 192 .num_bulk_in = 2,
@@ -339,10 +211,12 @@ static struct usb_serial_device_type handspring_device = {
339}; 211};
340 212
341/* All of the device info needed for the Clie UX50, TH55 Palm 5.0 devices */ 213/* All of the device info needed for the Clie UX50, TH55 Palm 5.0 devices */
342static struct usb_serial_device_type clie_5_device = { 214static struct usb_serial_driver clie_5_device = {
343 .owner = THIS_MODULE, 215 .driver = {
344 .name = "Sony Clie 5.0", 216 .owner = THIS_MODULE,
345 .short_name = "clie_5", 217 .name = "clie_5",
218 },
219 .description = "Sony Clie 5.0",
346 .id_table = clie_id_5_table, 220 .id_table = clie_id_5_table,
347 .num_interrupt_in = NUM_DONT_CARE, 221 .num_interrupt_in = NUM_DONT_CARE,
348 .num_bulk_in = 2, 222 .num_bulk_in = 2,
@@ -367,10 +241,12 @@ static struct usb_serial_device_type clie_5_device = {
367}; 241};
368 242
369/* device info for the Sony Clie OS version 3.5 */ 243/* device info for the Sony Clie OS version 3.5 */
370static struct usb_serial_device_type clie_3_5_device = { 244static struct usb_serial_driver clie_3_5_device = {
371 .owner = THIS_MODULE, 245 .driver = {
372 .name = "Sony Clie 3.5", 246 .owner = THIS_MODULE,
373 .short_name = "clie_3.5", 247 .name = "clie_3.5",
248 },
249 .description = "Sony Clie 3.5",
374 .id_table = clie_id_3_5_table, 250 .id_table = clie_id_3_5_table,
375 .num_interrupt_in = 0, 251 .num_interrupt_in = 0,
376 .num_bulk_in = 1, 252 .num_bulk_in = 1,
@@ -782,7 +658,7 @@ static int palm_os_3_probe (struct usb_serial *serial, const struct usb_device_i
782 break; 658 break;
783 } 659 }
784 dev_info(dev, "%s: port %d, is for %s use\n", 660 dev_info(dev, "%s: port %d, is for %s use\n",
785 serial->type->name, 661 serial->type->description,
786 connection_info->connections[i].port, string); 662 connection_info->connections[i].port, string);
787 } 663 }
788 } 664 }
@@ -791,11 +667,11 @@ static int palm_os_3_probe (struct usb_serial *serial, const struct usb_device_i
791 */ 667 */
792 if (num_ports == 0 || num_ports > 2) { 668 if (num_ports == 0 || num_ports > 2) {
793 dev_warn (dev, "%s: No valid connect info available\n", 669 dev_warn (dev, "%s: No valid connect info available\n",
794 serial->type->name); 670 serial->type->description);
795 num_ports = 2; 671 num_ports = 2;
796 } 672 }
797 673
798 dev_info(dev, "%s: Number of ports: %d\n", serial->type->name, 674 dev_info(dev, "%s: Number of ports: %d\n", serial->type->description,
799 num_ports); 675 num_ports);
800 676
801 /* 677 /*
@@ -1125,7 +1001,7 @@ static int __init visor_init (void)
1125 retval = usb_register(&visor_driver); 1001 retval = usb_register(&visor_driver);
1126 if (retval) 1002 if (retval)
1127 goto failed_usb_register; 1003 goto failed_usb_register;
1128 info(DRIVER_DESC " " DRIVER_VERSION); 1004 info(DRIVER_DESC);
1129 1005
1130 return 0; 1006 return 0;
1131failed_usb_register: 1007failed_usb_register:
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index cf3bc30675a1..18c3183be769 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -156,10 +156,12 @@ static void whiteheat_unthrottle (struct usb_serial_port *port);
156static void whiteheat_read_callback (struct urb *urb, struct pt_regs *regs); 156static void whiteheat_read_callback (struct urb *urb, struct pt_regs *regs);
157static void whiteheat_write_callback (struct urb *urb, struct pt_regs *regs); 157static void whiteheat_write_callback (struct urb *urb, struct pt_regs *regs);
158 158
159static struct usb_serial_device_type whiteheat_fake_device = { 159static struct usb_serial_driver whiteheat_fake_device = {
160 .owner = THIS_MODULE, 160 .driver = {
161 .name = "Connect Tech - WhiteHEAT - (prerenumeration)", 161 .owner = THIS_MODULE,
162 .short_name = "whiteheatnofirm", 162 .name = "whiteheatnofirm",
163 },
164 .description = "Connect Tech - WhiteHEAT - (prerenumeration)",
163 .id_table = id_table_prerenumeration, 165 .id_table = id_table_prerenumeration,
164 .num_interrupt_in = NUM_DONT_CARE, 166 .num_interrupt_in = NUM_DONT_CARE,
165 .num_bulk_in = NUM_DONT_CARE, 167 .num_bulk_in = NUM_DONT_CARE,
@@ -169,10 +171,12 @@ static struct usb_serial_device_type whiteheat_fake_device = {
169 .attach = whiteheat_firmware_attach, 171 .attach = whiteheat_firmware_attach,
170}; 172};
171 173
172static struct usb_serial_device_type whiteheat_device = { 174static struct usb_serial_driver whiteheat_device = {
173 .owner = THIS_MODULE, 175 .driver = {
174 .name = "Connect Tech - WhiteHEAT", 176 .owner = THIS_MODULE,
175 .short_name = "whiteheat", 177 .name = "whiteheat",
178 },
179 .description = "Connect Tech - WhiteHEAT",
176 .id_table = id_table_std, 180 .id_table = id_table_std,
177 .num_interrupt_in = NUM_DONT_CARE, 181 .num_interrupt_in = NUM_DONT_CARE,
178 .num_bulk_in = NUM_DONT_CARE, 182 .num_bulk_in = NUM_DONT_CARE,
@@ -382,10 +386,10 @@ static int whiteheat_attach (struct usb_serial *serial)
382 usb_clear_halt(serial->dev, pipe); 386 usb_clear_halt(serial->dev, pipe);
383 ret = usb_bulk_msg (serial->dev, pipe, command, 2, &alen, COMMAND_TIMEOUT_MS); 387 ret = usb_bulk_msg (serial->dev, pipe, command, 2, &alen, COMMAND_TIMEOUT_MS);
384 if (ret) { 388 if (ret) {
385 err("%s: Couldn't send command [%d]", serial->type->name, ret); 389 err("%s: Couldn't send command [%d]", serial->type->description, ret);
386 goto no_firmware; 390 goto no_firmware;
387 } else if (alen != sizeof(command)) { 391 } else if (alen != sizeof(command)) {
388 err("%s: Send command incomplete [%d]", serial->type->name, alen); 392 err("%s: Send command incomplete [%d]", serial->type->description, alen);
389 goto no_firmware; 393 goto no_firmware;
390 } 394 }
391 395
@@ -394,19 +398,19 @@ static int whiteheat_attach (struct usb_serial *serial)
394 usb_clear_halt(serial->dev, pipe); 398 usb_clear_halt(serial->dev, pipe);
395 ret = usb_bulk_msg (serial->dev, pipe, result, sizeof(*hw_info) + 1, &alen, COMMAND_TIMEOUT_MS); 399 ret = usb_bulk_msg (serial->dev, pipe, result, sizeof(*hw_info) + 1, &alen, COMMAND_TIMEOUT_MS);
396 if (ret) { 400 if (ret) {
397 err("%s: Couldn't get results [%d]", serial->type->name, ret); 401 err("%s: Couldn't get results [%d]", serial->type->description, ret);
398 goto no_firmware; 402 goto no_firmware;
399 } else if (alen != sizeof(result)) { 403 } else if (alen != sizeof(result)) {
400 err("%s: Get results incomplete [%d]", serial->type->name, alen); 404 err("%s: Get results incomplete [%d]", serial->type->description, alen);
401 goto no_firmware; 405 goto no_firmware;
402 } else if (result[0] != command[0]) { 406 } else if (result[0] != command[0]) {
403 err("%s: Command failed [%d]", serial->type->name, result[0]); 407 err("%s: Command failed [%d]", serial->type->description, result[0]);
404 goto no_firmware; 408 goto no_firmware;
405 } 409 }
406 410
407 hw_info = (struct whiteheat_hw_info *)&result[1]; 411 hw_info = (struct whiteheat_hw_info *)&result[1];
408 412
409 info("%s: Driver %s: Firmware v%d.%02d", serial->type->name, 413 info("%s: Driver %s: Firmware v%d.%02d", serial->type->description,
410 DRIVER_VERSION, hw_info->sw_major_rev, hw_info->sw_minor_rev); 414 DRIVER_VERSION, hw_info->sw_major_rev, hw_info->sw_minor_rev);
411 415
412 for (i = 0; i < serial->num_ports; i++) { 416 for (i = 0; i < serial->num_ports; i++) {
@@ -414,7 +418,7 @@ static int whiteheat_attach (struct usb_serial *serial)
414 418
415 info = (struct whiteheat_private *)kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL); 419 info = (struct whiteheat_private *)kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL);
416 if (info == NULL) { 420 if (info == NULL) {
417 err("%s: Out of memory for port structures\n", serial->type->name); 421 err("%s: Out of memory for port structures\n", serial->type->description);
418 goto no_private; 422 goto no_private;
419 } 423 }
420 424
@@ -484,7 +488,7 @@ static int whiteheat_attach (struct usb_serial *serial)
484 488
485 command_info = (struct whiteheat_command_private *)kmalloc(sizeof(struct whiteheat_command_private), GFP_KERNEL); 489 command_info = (struct whiteheat_command_private *)kmalloc(sizeof(struct whiteheat_command_private), GFP_KERNEL);
486 if (command_info == NULL) { 490 if (command_info == NULL) {
487 err("%s: Out of memory for port structures\n", serial->type->name); 491 err("%s: Out of memory for port structures\n", serial->type->description);
488 goto no_command_private; 492 goto no_command_private;
489 } 493 }
490 494
@@ -501,9 +505,9 @@ static int whiteheat_attach (struct usb_serial *serial)
501 505
502no_firmware: 506no_firmware:
503 /* Firmware likely not running */ 507 /* Firmware likely not running */
504 err("%s: Unable to retrieve firmware version, try replugging\n", serial->type->name); 508 err("%s: Unable to retrieve firmware version, try replugging\n", serial->type->description);
505 err("%s: If the firmware is not running (status led not blinking)\n", serial->type->name); 509 err("%s: If the firmware is not running (status led not blinking)\n", serial->type->description);
506 err("%s: please contact support@connecttech.com\n", serial->type->name); 510 err("%s: please contact support@connecttech.com\n", serial->type->description);
507 return -ENODEV; 511 return -ENODEV;
508 512
509no_command_private: 513no_command_private:
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index bb9819cc8826..1a9679f76f5a 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -2,7 +2,8 @@
2# USB Storage driver configuration 2# USB Storage driver configuration
3# 3#
4 4
5comment "NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information" 5comment "NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'"
6comment "may also be needed; see USB_STORAGE Help for more information"
6 depends on USB 7 depends on USB
7 8
8config USB_STORAGE 9config USB_STORAGE
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
index 356342c6e7a2..33c55a6261bb 100644
--- a/drivers/usb/storage/shuttle_usbat.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -1,4 +1,4 @@
1/* Driver for SCM Microsystems USB-ATAPI cable 1/* Driver for SCM Microsystems (a.k.a. Shuttle) USB-ATAPI cable
2 * 2 *
3 * $Id: shuttle_usbat.c,v 1.17 2002/04/22 03:39:43 mdharm Exp $ 3 * $Id: shuttle_usbat.c,v 1.17 2002/04/22 03:39:43 mdharm Exp $
4 * 4 *
@@ -67,10 +67,10 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us);
67static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us); 67static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us);
68 68
69/* 69/*
70 * Convenience function to produce an ATAPI read/write sectors command 70 * Convenience function to produce an ATA read/write sectors command
71 * Use cmd=0x20 for read, cmd=0x30 for write 71 * Use cmd=0x20 for read, cmd=0x30 for write
72 */ 72 */
73static void usbat_pack_atapi_sector_cmd(unsigned char *buf, 73static void usbat_pack_ata_sector_cmd(unsigned char *buf,
74 unsigned char thistime, 74 unsigned char thistime,
75 u32 sector, unsigned char cmd) 75 u32 sector, unsigned char cmd)
76{ 76{
@@ -196,10 +196,12 @@ static int usbat_check_status(struct us_data *us)
196 if (rc != USB_STOR_XFER_GOOD) 196 if (rc != USB_STOR_XFER_GOOD)
197 return USB_STOR_TRANSPORT_FAILED; 197 return USB_STOR_TRANSPORT_FAILED;
198 198
199 if (*reply & 0x01 && *reply != 0x51) // error/check condition (0x51 is ok) 199 /* error/check condition (0x51 is ok) */
200 if (*reply & 0x01 && *reply != 0x51)
200 return USB_STOR_TRANSPORT_FAILED; 201 return USB_STOR_TRANSPORT_FAILED;
201 202
202 if (*reply & 0x20) // device fault 203 /* device fault */
204 if (*reply & 0x20)
203 return USB_STOR_TRANSPORT_FAILED; 205 return USB_STOR_TRANSPORT_FAILED;
204 206
205 return USB_STOR_TRANSPORT_GOOD; 207 return USB_STOR_TRANSPORT_GOOD;
@@ -222,29 +224,39 @@ static int usbat_set_shuttle_features(struct us_data *us,
222 command[0] = 0x40; 224 command[0] = 0x40;
223 command[1] = USBAT_CMD_SET_FEAT; 225 command[1] = USBAT_CMD_SET_FEAT;
224 226
225 // The only bit relevant to ATA access is bit 6 227 /*
226 // which defines 8 bit data access (set) or 16 bit (unset) 228 * The only bit relevant to ATA access is bit 6
229 * which defines 8 bit data access (set) or 16 bit (unset)
230 */
227 command[2] = epp_control; 231 command[2] = epp_control;
228 232
229 // If FCQ is set in the qualifier (defined in R/W cmd), then bits U0, U1, 233 /*
230 // ET1 and ET2 define an external event to be checked for on event of a 234 * If FCQ is set in the qualifier (defined in R/W cmd), then bits U0, U1,
231 // _read_blocks or _write_blocks operation. The read/write will not take 235 * ET1 and ET2 define an external event to be checked for on event of a
232 // place unless the defined trigger signal is active. 236 * _read_blocks or _write_blocks operation. The read/write will not take
237 * place unless the defined trigger signal is active.
238 */
233 command[3] = external_trigger; 239 command[3] = external_trigger;
234 240
235 // The resultant byte of the mask operation (see mask_byte) is compared for 241 /*
236 // equivalence with this test pattern. If equal, the read/write will take 242 * The resultant byte of the mask operation (see mask_byte) is compared for
237 // place. 243 * equivalence with this test pattern. If equal, the read/write will take
244 * place.
245 */
238 command[4] = test_pattern; 246 command[4] = test_pattern;
239 247
240 // This value is logically ANDed with the status register field specified 248 /*
241 // in the read/write command. 249 * This value is logically ANDed with the status register field specified
250 * in the read/write command.
251 */
242 command[5] = mask_byte; 252 command[5] = mask_byte;
243 253
244 // If ALQ is set in the qualifier, this field contains the address of the 254 /*
245 // registers where the byte count should be read for transferring the data. 255 * If ALQ is set in the qualifier, this field contains the address of the
246 // If ALQ is not set, then this field contains the number of bytes to be 256 * registers where the byte count should be read for transferring the data.
247 // transferred. 257 * If ALQ is not set, then this field contains the number of bytes to be
258 * transferred.
259 */
248 command[6] = subcountL; 260 command[6] = subcountL;
249 command[7] = subcountH; 261 command[7] = subcountH;
250 262
@@ -273,26 +285,26 @@ static int usbat_wait_not_busy(struct us_data *us, int minutes)
273 285
274 if (result!=USB_STOR_XFER_GOOD) 286 if (result!=USB_STOR_XFER_GOOD)
275 return USB_STOR_TRANSPORT_ERROR; 287 return USB_STOR_TRANSPORT_ERROR;
276 if (*status & 0x01) { // check condition 288 if (*status & 0x01) { /* check condition */
277 result = usbat_read(us, USBAT_ATA, 0x10, status); 289 result = usbat_read(us, USBAT_ATA, 0x10, status);
278 return USB_STOR_TRANSPORT_FAILED; 290 return USB_STOR_TRANSPORT_FAILED;
279 } 291 }
280 if (*status & 0x20) // device fault 292 if (*status & 0x20) /* device fault */
281 return USB_STOR_TRANSPORT_FAILED; 293 return USB_STOR_TRANSPORT_FAILED;
282 294
283 if ((*status & 0x80)==0x00) { // not busy 295 if ((*status & 0x80)==0x00) { /* not busy */
284 US_DEBUGP("Waited not busy for %d steps\n", i); 296 US_DEBUGP("Waited not busy for %d steps\n", i);
285 return USB_STOR_TRANSPORT_GOOD; 297 return USB_STOR_TRANSPORT_GOOD;
286 } 298 }
287 299
288 if (i<500) 300 if (i<500)
289 msleep(10); // 5 seconds 301 msleep(10); /* 5 seconds */
290 else if (i<700) 302 else if (i<700)
291 msleep(50); // 10 seconds 303 msleep(50); /* 10 seconds */
292 else if (i<1200) 304 else if (i<1200)
293 msleep(100); // 50 seconds 305 msleep(100); /* 50 seconds */
294 else 306 else
295 msleep(1000); // X minutes 307 msleep(1000); /* X minutes */
296 } 308 }
297 309
298 US_DEBUGP("Waited not busy for %d minutes, timing out.\n", 310 US_DEBUGP("Waited not busy for %d minutes, timing out.\n",
@@ -412,9 +424,12 @@ static int usbat_hp8200e_rw_block_test(struct us_data *us,
412 424
413 if (i==0) { 425 if (i==0) {
414 cmdlen = 16; 426 cmdlen = 16;
415 // Write to multiple registers 427 /*
416 // Not really sure the 0x07, 0x17, 0xfc, 0xe7 is necessary here, 428 * Write to multiple registers
417 // but that's what came out of the trace every single time. 429 * Not really sure the 0x07, 0x17, 0xfc, 0xe7 is
430 * necessary here, but that's what came out of the
431 * trace every single time.
432 */
418 command[0] = 0x40; 433 command[0] = 0x40;
419 command[1] = access | USBAT_CMD_WRITE_REGS; 434 command[1] = access | USBAT_CMD_WRITE_REGS;
420 command[2] = 0x07; 435 command[2] = 0x07;
@@ -426,7 +441,7 @@ static int usbat_hp8200e_rw_block_test(struct us_data *us,
426 } else 441 } else
427 cmdlen = 8; 442 cmdlen = 8;
428 443
429 // Conditionally read or write blocks 444 /* Conditionally read or write blocks */
430 command[cmdlen-8] = (direction==DMA_TO_DEVICE ? 0x40 : 0xC0); 445 command[cmdlen-8] = (direction==DMA_TO_DEVICE ? 0x40 : 0xC0);
431 command[cmdlen-7] = access | 446 command[cmdlen-7] = access |
432 (direction==DMA_TO_DEVICE ? 447 (direction==DMA_TO_DEVICE ?
@@ -456,11 +471,6 @@ static int usbat_hp8200e_rw_block_test(struct us_data *us,
456 471
457 } 472 }
458 473
459
460 //US_DEBUGP("Transfer %s %d bytes, sg buffers %d\n",
461 // direction == DMA_TO_DEVICE ? "out" : "in",
462 // len, use_sg);
463
464 result = usb_stor_bulk_transfer_sg(us, 474 result = usb_stor_bulk_transfer_sg(us,
465 pipe, content, len, use_sg, NULL); 475 pipe, content, len, use_sg, NULL);
466 476
@@ -508,9 +518,9 @@ static int usbat_hp8200e_rw_block_test(struct us_data *us,
508 518
509 if (result!=USB_STOR_XFER_GOOD) 519 if (result!=USB_STOR_XFER_GOOD)
510 return USB_STOR_TRANSPORT_ERROR; 520 return USB_STOR_TRANSPORT_ERROR;
511 if (*status & 0x01) // check condition 521 if (*status & 0x01) /* check condition */
512 return USB_STOR_TRANSPORT_FAILED; 522 return USB_STOR_TRANSPORT_FAILED;
513 if (*status & 0x20) // device fault 523 if (*status & 0x20) /* device fault */
514 return USB_STOR_TRANSPORT_FAILED; 524 return USB_STOR_TRANSPORT_FAILED;
515 525
516 US_DEBUGP("Redoing %s\n", 526 US_DEBUGP("Redoing %s\n",
@@ -547,32 +557,32 @@ static int usbat_multiple_write(struct us_data *us,
547 557
548 BUG_ON(num_registers > US_IOBUF_SIZE/2); 558 BUG_ON(num_registers > US_IOBUF_SIZE/2);
549 559
550 // Write to multiple registers, ATA access 560 /* Write to multiple registers, ATA access */
551 command[0] = 0x40; 561 command[0] = 0x40;
552 command[1] = USBAT_ATA | USBAT_CMD_WRITE_REGS; 562 command[1] = USBAT_ATA | USBAT_CMD_WRITE_REGS;
553 563
554 // No relevance 564 /* No relevance */
555 command[2] = 0; 565 command[2] = 0;
556 command[3] = 0; 566 command[3] = 0;
557 command[4] = 0; 567 command[4] = 0;
558 command[5] = 0; 568 command[5] = 0;
559 569
560 // Number of bytes to be transferred (incl. addresses and data) 570 /* Number of bytes to be transferred (incl. addresses and data) */
561 command[6] = LSB_of(num_registers*2); 571 command[6] = LSB_of(num_registers*2);
562 command[7] = MSB_of(num_registers*2); 572 command[7] = MSB_of(num_registers*2);
563 573
564 // The setup command 574 /* The setup command */
565 result = usbat_execute_command(us, command, 8); 575 result = usbat_execute_command(us, command, 8);
566 if (result != USB_STOR_XFER_GOOD) 576 if (result != USB_STOR_XFER_GOOD)
567 return USB_STOR_TRANSPORT_ERROR; 577 return USB_STOR_TRANSPORT_ERROR;
568 578
569 // Create the reg/data, reg/data sequence 579 /* Create the reg/data, reg/data sequence */
570 for (i=0; i<num_registers; i++) { 580 for (i=0; i<num_registers; i++) {
571 data[i<<1] = registers[i]; 581 data[i<<1] = registers[i];
572 data[1+(i<<1)] = data_out[i]; 582 data[1+(i<<1)] = data_out[i];
573 } 583 }
574 584
575 // Send the data 585 /* Send the data */
576 result = usbat_bulk_write(us, data, num_registers*2); 586 result = usbat_bulk_write(us, data, num_registers*2);
577 if (result != USB_STOR_XFER_GOOD) 587 if (result != USB_STOR_XFER_GOOD)
578 return USB_STOR_TRANSPORT_ERROR; 588 return USB_STOR_TRANSPORT_ERROR;
@@ -606,17 +616,17 @@ static int usbat_read_blocks(struct us_data *us,
606 command[1] = USBAT_ATA | USBAT_CMD_COND_READ_BLOCK; 616 command[1] = USBAT_ATA | USBAT_CMD_COND_READ_BLOCK;
607 command[2] = USBAT_ATA_DATA; 617 command[2] = USBAT_ATA_DATA;
608 command[3] = USBAT_ATA_STATUS; 618 command[3] = USBAT_ATA_STATUS;
609 command[4] = 0xFD; // Timeout (ms); 619 command[4] = 0xFD; /* Timeout (ms); */
610 command[5] = USBAT_QUAL_FCQ; 620 command[5] = USBAT_QUAL_FCQ;
611 command[6] = LSB_of(len); 621 command[6] = LSB_of(len);
612 command[7] = MSB_of(len); 622 command[7] = MSB_of(len);
613 623
614 // Multiple block read setup command 624 /* Multiple block read setup command */
615 result = usbat_execute_command(us, command, 8); 625 result = usbat_execute_command(us, command, 8);
616 if (result != USB_STOR_XFER_GOOD) 626 if (result != USB_STOR_XFER_GOOD)
617 return USB_STOR_TRANSPORT_FAILED; 627 return USB_STOR_TRANSPORT_FAILED;
618 628
619 // Read the blocks we just asked for 629 /* Read the blocks we just asked for */
620 result = usbat_bulk_read(us, buffer, len); 630 result = usbat_bulk_read(us, buffer, len);
621 if (result != USB_STOR_XFER_GOOD) 631 if (result != USB_STOR_XFER_GOOD)
622 return USB_STOR_TRANSPORT_FAILED; 632 return USB_STOR_TRANSPORT_FAILED;
@@ -647,17 +657,17 @@ static int usbat_write_blocks(struct us_data *us,
647 command[1] = USBAT_ATA | USBAT_CMD_COND_WRITE_BLOCK; 657 command[1] = USBAT_ATA | USBAT_CMD_COND_WRITE_BLOCK;
648 command[2] = USBAT_ATA_DATA; 658 command[2] = USBAT_ATA_DATA;
649 command[3] = USBAT_ATA_STATUS; 659 command[3] = USBAT_ATA_STATUS;
650 command[4] = 0xFD; // Timeout (ms) 660 command[4] = 0xFD; /* Timeout (ms) */
651 command[5] = USBAT_QUAL_FCQ; 661 command[5] = USBAT_QUAL_FCQ;
652 command[6] = LSB_of(len); 662 command[6] = LSB_of(len);
653 command[7] = MSB_of(len); 663 command[7] = MSB_of(len);
654 664
655 // Multiple block write setup command 665 /* Multiple block write setup command */
656 result = usbat_execute_command(us, command, 8); 666 result = usbat_execute_command(us, command, 8);
657 if (result != USB_STOR_XFER_GOOD) 667 if (result != USB_STOR_XFER_GOOD)
658 return USB_STOR_TRANSPORT_FAILED; 668 return USB_STOR_TRANSPORT_FAILED;
659 669
660 // Write the data 670 /* Write the data */
661 result = usbat_bulk_write(us, buffer, len); 671 result = usbat_bulk_write(us, buffer, len);
662 if (result != USB_STOR_XFER_GOOD) 672 if (result != USB_STOR_XFER_GOOD)
663 return USB_STOR_TRANSPORT_FAILED; 673 return USB_STOR_TRANSPORT_FAILED;
@@ -711,16 +721,20 @@ static int usbat_device_reset(struct us_data *us)
711{ 721{
712 int rc; 722 int rc;
713 723
714 // Reset peripheral, enable peripheral control signals 724 /*
715 // (bring reset signal up) 725 * Reset peripheral, enable peripheral control signals
726 * (bring reset signal up)
727 */
716 rc = usbat_write_user_io(us, 728 rc = usbat_write_user_io(us,
717 USBAT_UIO_DRVRST | USBAT_UIO_OE1 | USBAT_UIO_OE0, 729 USBAT_UIO_DRVRST | USBAT_UIO_OE1 | USBAT_UIO_OE0,
718 USBAT_UIO_EPAD | USBAT_UIO_1); 730 USBAT_UIO_EPAD | USBAT_UIO_1);
719 if (rc != USB_STOR_XFER_GOOD) 731 if (rc != USB_STOR_XFER_GOOD)
720 return USB_STOR_TRANSPORT_ERROR; 732 return USB_STOR_TRANSPORT_ERROR;
721 733
722 // Enable peripheral control signals 734 /*
723 // (bring reset signal down) 735 * Enable peripheral control signals
736 * (bring reset signal down)
737 */
724 rc = usbat_write_user_io(us, 738 rc = usbat_write_user_io(us,
725 USBAT_UIO_OE1 | USBAT_UIO_OE0, 739 USBAT_UIO_OE1 | USBAT_UIO_OE0,
726 USBAT_UIO_EPAD | USBAT_UIO_1); 740 USBAT_UIO_EPAD | USBAT_UIO_1);
@@ -737,7 +751,7 @@ static int usbat_device_enable_cdt(struct us_data *us)
737{ 751{
738 int rc; 752 int rc;
739 753
740 // Enable peripheral control signals and card detect 754 /* Enable peripheral control signals and card detect */
741 rc = usbat_write_user_io(us, 755 rc = usbat_write_user_io(us,
742 USBAT_UIO_ACKD | USBAT_UIO_OE1 | USBAT_UIO_OE0, 756 USBAT_UIO_ACKD | USBAT_UIO_OE1 | USBAT_UIO_OE0,
743 USBAT_UIO_EPAD | USBAT_UIO_1); 757 USBAT_UIO_EPAD | USBAT_UIO_1);
@@ -786,7 +800,7 @@ static int usbat_flash_check_media(struct us_data *us,
786 if (rc != USB_STOR_XFER_GOOD) 800 if (rc != USB_STOR_XFER_GOOD)
787 return USB_STOR_TRANSPORT_ERROR; 801 return USB_STOR_TRANSPORT_ERROR;
788 802
789 // Check for media existence 803 /* Check for media existence */
790 rc = usbat_flash_check_media_present(uio); 804 rc = usbat_flash_check_media_present(uio);
791 if (rc == USBAT_FLASH_MEDIA_NONE) { 805 if (rc == USBAT_FLASH_MEDIA_NONE) {
792 info->sense_key = 0x02; 806 info->sense_key = 0x02;
@@ -795,11 +809,11 @@ static int usbat_flash_check_media(struct us_data *us,
795 return USB_STOR_TRANSPORT_FAILED; 809 return USB_STOR_TRANSPORT_FAILED;
796 } 810 }
797 811
798 // Check for media change 812 /* Check for media change */
799 rc = usbat_flash_check_media_changed(uio); 813 rc = usbat_flash_check_media_changed(uio);
800 if (rc == USBAT_FLASH_MEDIA_CHANGED) { 814 if (rc == USBAT_FLASH_MEDIA_CHANGED) {
801 815
802 // Reset and re-enable card detect 816 /* Reset and re-enable card detect */
803 rc = usbat_device_reset(us); 817 rc = usbat_device_reset(us);
804 if (rc != USB_STOR_TRANSPORT_GOOD) 818 if (rc != USB_STOR_TRANSPORT_GOOD)
805 return rc; 819 return rc;
@@ -855,15 +869,15 @@ static int usbat_identify_device(struct us_data *us,
855 if (rc != USB_STOR_XFER_GOOD) 869 if (rc != USB_STOR_XFER_GOOD)
856 return USB_STOR_TRANSPORT_ERROR; 870 return USB_STOR_TRANSPORT_ERROR;
857 871
858 // Check for error bit 872 /* Check for error bit, or if the command 'fell through' */
859 if (status & 0x01) { 873 if (status == 0xA1 || !(status & 0x01)) {
860 // Device is a CompactFlash reader/writer 874 /* Device is HP 8200 */
861 US_DEBUGP("usbat_identify_device: Detected Flash reader/writer\n");
862 info->devicetype = USBAT_DEV_FLASH;
863 } else {
864 // Device is HP 8200
865 US_DEBUGP("usbat_identify_device: Detected HP8200 CDRW\n"); 875 US_DEBUGP("usbat_identify_device: Detected HP8200 CDRW\n");
866 info->devicetype = USBAT_DEV_HP8200; 876 info->devicetype = USBAT_DEV_HP8200;
877 } else {
878 /* Device is a CompactFlash reader/writer */
879 US_DEBUGP("usbat_identify_device: Detected Flash reader/writer\n");
880 info->devicetype = USBAT_DEV_FLASH;
867 } 881 }
868 882
869 return USB_STOR_TRANSPORT_GOOD; 883 return USB_STOR_TRANSPORT_GOOD;
@@ -916,7 +930,7 @@ static int usbat_flash_get_sector_count(struct us_data *us,
916 if (!reply) 930 if (!reply)
917 return USB_STOR_TRANSPORT_ERROR; 931 return USB_STOR_TRANSPORT_ERROR;
918 932
919 // ATAPI command : IDENTIFY DEVICE 933 /* ATA command : IDENTIFY DEVICE */
920 rc = usbat_multiple_write(us, registers, command, 3); 934 rc = usbat_multiple_write(us, registers, command, 3);
921 if (rc != USB_STOR_XFER_GOOD) { 935 if (rc != USB_STOR_XFER_GOOD) {
922 US_DEBUGP("usbat_flash_get_sector_count: Gah! identify_device failed\n"); 936 US_DEBUGP("usbat_flash_get_sector_count: Gah! identify_device failed\n");
@@ -924,7 +938,7 @@ static int usbat_flash_get_sector_count(struct us_data *us,
924 goto leave; 938 goto leave;
925 } 939 }
926 940
927 // Read device status 941 /* Read device status */
928 if (usbat_get_status(us, &status) != USB_STOR_XFER_GOOD) { 942 if (usbat_get_status(us, &status) != USB_STOR_XFER_GOOD) {
929 rc = USB_STOR_TRANSPORT_ERROR; 943 rc = USB_STOR_TRANSPORT_ERROR;
930 goto leave; 944 goto leave;
@@ -932,7 +946,7 @@ static int usbat_flash_get_sector_count(struct us_data *us,
932 946
933 msleep(100); 947 msleep(100);
934 948
935 // Read the device identification data 949 /* Read the device identification data */
936 rc = usbat_read_block(us, reply, 512); 950 rc = usbat_read_block(us, reply, 512);
937 if (rc != USB_STOR_TRANSPORT_GOOD) 951 if (rc != USB_STOR_TRANSPORT_GOOD)
938 goto leave; 952 goto leave;
@@ -977,19 +991,23 @@ static int usbat_flash_read_data(struct us_data *us,
977 if (result != USB_STOR_TRANSPORT_GOOD) 991 if (result != USB_STOR_TRANSPORT_GOOD)
978 return result; 992 return result;
979 993
980 // we're working in LBA mode. according to the ATA spec, 994 /*
981 // we can support up to 28-bit addressing. I don't know if Jumpshot 995 * we're working in LBA mode. according to the ATA spec,
982 // supports beyond 24-bit addressing. It's kind of hard to test 996 * we can support up to 28-bit addressing. I don't know if Jumpshot
983 // since it requires > 8GB CF card. 997 * supports beyond 24-bit addressing. It's kind of hard to test
998 * since it requires > 8GB CF card.
999 */
984 1000
985 if (sector > 0x0FFFFFFF) 1001 if (sector > 0x0FFFFFFF)
986 return USB_STOR_TRANSPORT_ERROR; 1002 return USB_STOR_TRANSPORT_ERROR;
987 1003
988 totallen = sectors * info->ssize; 1004 totallen = sectors * info->ssize;
989 1005
990 // Since we don't read more than 64 KB at a time, we have to create 1006 /*
991 // a bounce buffer and move the data a piece at a time between the 1007 * Since we don't read more than 64 KB at a time, we have to create
992 // bounce buffer and the actual transfer buffer. 1008 * a bounce buffer and move the data a piece at a time between the
1009 * bounce buffer and the actual transfer buffer.
1010 */
993 1011
994 alloclen = min(totallen, 65536u); 1012 alloclen = min(totallen, 65536u);
995 buffer = kmalloc(alloclen, GFP_NOIO); 1013 buffer = kmalloc(alloclen, GFP_NOIO);
@@ -997,27 +1015,29 @@ static int usbat_flash_read_data(struct us_data *us,
997 return USB_STOR_TRANSPORT_ERROR; 1015 return USB_STOR_TRANSPORT_ERROR;
998 1016
999 do { 1017 do {
1000 // loop, never allocate or transfer more than 64k at once 1018 /*
1001 // (min(128k, 255*info->ssize) is the real limit) 1019 * loop, never allocate or transfer more than 64k at once
1020 * (min(128k, 255*info->ssize) is the real limit)
1021 */
1002 len = min(totallen, alloclen); 1022 len = min(totallen, alloclen);
1003 thistime = (len / info->ssize) & 0xff; 1023 thistime = (len / info->ssize) & 0xff;
1004 1024
1005 // ATAPI command 0x20 (READ SECTORS) 1025 /* ATA command 0x20 (READ SECTORS) */
1006 usbat_pack_atapi_sector_cmd(command, thistime, sector, 0x20); 1026 usbat_pack_ata_sector_cmd(command, thistime, sector, 0x20);
1007 1027
1008 // Write/execute ATAPI read command 1028 /* Write/execute ATA read command */
1009 result = usbat_multiple_write(us, registers, command, 7); 1029 result = usbat_multiple_write(us, registers, command, 7);
1010 if (result != USB_STOR_TRANSPORT_GOOD) 1030 if (result != USB_STOR_TRANSPORT_GOOD)
1011 goto leave; 1031 goto leave;
1012 1032
1013 // Read the data we just requested 1033 /* Read the data we just requested */
1014 result = usbat_read_blocks(us, buffer, len); 1034 result = usbat_read_blocks(us, buffer, len);
1015 if (result != USB_STOR_TRANSPORT_GOOD) 1035 if (result != USB_STOR_TRANSPORT_GOOD)
1016 goto leave; 1036 goto leave;
1017 1037
1018 US_DEBUGP("usbat_flash_read_data: %d bytes\n", len); 1038 US_DEBUGP("usbat_flash_read_data: %d bytes\n", len);
1019 1039
1020 // Store the data in the transfer buffer 1040 /* Store the data in the transfer buffer */
1021 usb_stor_access_xfer_buf(buffer, len, us->srb, 1041 usb_stor_access_xfer_buf(buffer, len, us->srb,
1022 &sg_idx, &sg_offset, TO_XFER_BUF); 1042 &sg_idx, &sg_offset, TO_XFER_BUF);
1023 1043
@@ -1061,19 +1081,23 @@ static int usbat_flash_write_data(struct us_data *us,
1061 if (result != USB_STOR_TRANSPORT_GOOD) 1081 if (result != USB_STOR_TRANSPORT_GOOD)
1062 return result; 1082 return result;
1063 1083
1064 // we're working in LBA mode. according to the ATA spec, 1084 /*
1065 // we can support up to 28-bit addressing. I don't know if Jumpshot 1085 * we're working in LBA mode. according to the ATA spec,
1066 // supports beyond 24-bit addressing. It's kind of hard to test 1086 * we can support up to 28-bit addressing. I don't know if the device
1067 // since it requires > 8GB CF card. 1087 * supports beyond 24-bit addressing. It's kind of hard to test
1088 * since it requires > 8GB media.
1089 */
1068 1090
1069 if (sector > 0x0FFFFFFF) 1091 if (sector > 0x0FFFFFFF)
1070 return USB_STOR_TRANSPORT_ERROR; 1092 return USB_STOR_TRANSPORT_ERROR;
1071 1093
1072 totallen = sectors * info->ssize; 1094 totallen = sectors * info->ssize;
1073 1095
1074 // Since we don't write more than 64 KB at a time, we have to create 1096 /*
1075 // a bounce buffer and move the data a piece at a time between the 1097 * Since we don't write more than 64 KB at a time, we have to create
1076 // bounce buffer and the actual transfer buffer. 1098 * a bounce buffer and move the data a piece at a time between the
1099 * bounce buffer and the actual transfer buffer.
1100 */
1077 1101
1078 alloclen = min(totallen, 65536u); 1102 alloclen = min(totallen, 65536u);
1079 buffer = kmalloc(alloclen, GFP_NOIO); 1103 buffer = kmalloc(alloclen, GFP_NOIO);
@@ -1081,24 +1105,26 @@ static int usbat_flash_write_data(struct us_data *us,
1081 return USB_STOR_TRANSPORT_ERROR; 1105 return USB_STOR_TRANSPORT_ERROR;
1082 1106
1083 do { 1107 do {
1084 // loop, never allocate or transfer more than 64k at once 1108 /*
1085 // (min(128k, 255*info->ssize) is the real limit) 1109 * loop, never allocate or transfer more than 64k at once
1110 * (min(128k, 255*info->ssize) is the real limit)
1111 */
1086 len = min(totallen, alloclen); 1112 len = min(totallen, alloclen);
1087 thistime = (len / info->ssize) & 0xff; 1113 thistime = (len / info->ssize) & 0xff;
1088 1114
1089 // Get the data from the transfer buffer 1115 /* Get the data from the transfer buffer */
1090 usb_stor_access_xfer_buf(buffer, len, us->srb, 1116 usb_stor_access_xfer_buf(buffer, len, us->srb,
1091 &sg_idx, &sg_offset, FROM_XFER_BUF); 1117 &sg_idx, &sg_offset, FROM_XFER_BUF);
1092 1118
1093 // ATAPI command 0x30 (WRITE SECTORS) 1119 /* ATA command 0x30 (WRITE SECTORS) */
1094 usbat_pack_atapi_sector_cmd(command, thistime, sector, 0x30); 1120 usbat_pack_ata_sector_cmd(command, thistime, sector, 0x30);
1095 1121
1096 // Write/execute ATAPI write command 1122 /* Write/execute ATA write command */
1097 result = usbat_multiple_write(us, registers, command, 7); 1123 result = usbat_multiple_write(us, registers, command, 7);
1098 if (result != USB_STOR_TRANSPORT_GOOD) 1124 if (result != USB_STOR_TRANSPORT_GOOD)
1099 goto leave; 1125 goto leave;
1100 1126
1101 // Write the data 1127 /* Write the data */
1102 result = usbat_write_blocks(us, buffer, len); 1128 result = usbat_write_blocks(us, buffer, len);
1103 if (result != USB_STOR_TRANSPORT_GOOD) 1129 if (result != USB_STOR_TRANSPORT_GOOD)
1104 goto leave; 1130 goto leave;
@@ -1169,42 +1195,44 @@ static int usbat_hp8200e_handle_read10(struct us_data *us,
1169 srb->transfersize); 1195 srb->transfersize);
1170 } 1196 }
1171 1197
1172 // Since we only read in one block at a time, we have to create 1198 /*
1173 // a bounce buffer and move the data a piece at a time between the 1199 * Since we only read in one block at a time, we have to create
1174 // bounce buffer and the actual transfer buffer. 1200 * a bounce buffer and move the data a piece at a time between the
1201 * bounce buffer and the actual transfer buffer.
1202 */
1175 1203
1176 len = (65535/srb->transfersize) * srb->transfersize; 1204 len = (65535/srb->transfersize) * srb->transfersize;
1177 US_DEBUGP("Max read is %d bytes\n", len); 1205 US_DEBUGP("Max read is %d bytes\n", len);
1178 len = min(len, srb->request_bufflen); 1206 len = min(len, srb->request_bufflen);
1179 buffer = kmalloc(len, GFP_NOIO); 1207 buffer = kmalloc(len, GFP_NOIO);
1180 if (buffer == NULL) // bloody hell! 1208 if (buffer == NULL) /* bloody hell! */
1181 return USB_STOR_TRANSPORT_FAILED; 1209 return USB_STOR_TRANSPORT_FAILED;
1182 sector = short_pack(data[7+3], data[7+2]); 1210 sector = short_pack(data[7+3], data[7+2]);
1183 sector <<= 16; 1211 sector <<= 16;
1184 sector |= short_pack(data[7+5], data[7+4]); 1212 sector |= short_pack(data[7+5], data[7+4]);
1185 transferred = 0; 1213 transferred = 0;
1186 1214
1187 sg_segment = 0; // for keeping track of where we are in 1215 sg_segment = 0; /* for keeping track of where we are in */
1188 sg_offset = 0; // the scatter/gather list 1216 sg_offset = 0; /* the scatter/gather list */
1189 1217
1190 while (transferred != srb->request_bufflen) { 1218 while (transferred != srb->request_bufflen) {
1191 1219
1192 if (len > srb->request_bufflen - transferred) 1220 if (len > srb->request_bufflen - transferred)
1193 len = srb->request_bufflen - transferred; 1221 len = srb->request_bufflen - transferred;
1194 1222
1195 data[3] = len&0xFF; // (cylL) = expected length (L) 1223 data[3] = len&0xFF; /* (cylL) = expected length (L) */
1196 data[4] = (len>>8)&0xFF; // (cylH) = expected length (H) 1224 data[4] = (len>>8)&0xFF; /* (cylH) = expected length (H) */
1197 1225
1198 // Fix up the SCSI command sector and num sectors 1226 /* Fix up the SCSI command sector and num sectors */
1199 1227
1200 data[7+2] = MSB_of(sector>>16); // SCSI command sector 1228 data[7+2] = MSB_of(sector>>16); /* SCSI command sector */
1201 data[7+3] = LSB_of(sector>>16); 1229 data[7+3] = LSB_of(sector>>16);
1202 data[7+4] = MSB_of(sector&0xFFFF); 1230 data[7+4] = MSB_of(sector&0xFFFF);
1203 data[7+5] = LSB_of(sector&0xFFFF); 1231 data[7+5] = LSB_of(sector&0xFFFF);
1204 if (data[7+0] == GPCMD_READ_CD) 1232 if (data[7+0] == GPCMD_READ_CD)
1205 data[7+6] = 0; 1233 data[7+6] = 0;
1206 data[7+7] = MSB_of(len / srb->transfersize); // SCSI command 1234 data[7+7] = MSB_of(len / srb->transfersize); /* SCSI command */
1207 data[7+8] = LSB_of(len / srb->transfersize); // num sectors 1235 data[7+8] = LSB_of(len / srb->transfersize); /* num sectors */
1208 1236
1209 result = usbat_hp8200e_rw_block_test(us, USBAT_ATA, 1237 result = usbat_hp8200e_rw_block_test(us, USBAT_ATA,
1210 registers, data, 19, 1238 registers, data, 19,
@@ -1217,16 +1245,16 @@ static int usbat_hp8200e_handle_read10(struct us_data *us,
1217 if (result != USB_STOR_TRANSPORT_GOOD) 1245 if (result != USB_STOR_TRANSPORT_GOOD)
1218 break; 1246 break;
1219 1247
1220 // Store the data in the transfer buffer 1248 /* Store the data in the transfer buffer */
1221 usb_stor_access_xfer_buf(buffer, len, srb, 1249 usb_stor_access_xfer_buf(buffer, len, srb,
1222 &sg_segment, &sg_offset, TO_XFER_BUF); 1250 &sg_segment, &sg_offset, TO_XFER_BUF);
1223 1251
1224 // Update the amount transferred and the sector number 1252 /* Update the amount transferred and the sector number */
1225 1253
1226 transferred += len; 1254 transferred += len;
1227 sector += len / srb->transfersize; 1255 sector += len / srb->transfersize;
1228 1256
1229 } // while transferred != srb->request_bufflen 1257 } /* while transferred != srb->request_bufflen */
1230 1258
1231 kfree(buffer); 1259 kfree(buffer);
1232 return result; 1260 return result;
@@ -1237,7 +1265,7 @@ static int usbat_select_and_test_registers(struct us_data *us)
1237 int selector; 1265 int selector;
1238 unsigned char *status = us->iobuf; 1266 unsigned char *status = us->iobuf;
1239 1267
1240 // try device = master, then device = slave. 1268 /* try device = master, then device = slave. */
1241 for (selector = 0xA0; selector <= 0xB0; selector += 0x10) { 1269 for (selector = 0xA0; selector <= 0xB0; selector += 0x10) {
1242 if (usbat_write(us, USBAT_ATA, USBAT_ATA_DEVICE, selector) != 1270 if (usbat_write(us, USBAT_ATA, USBAT_ATA_DEVICE, selector) !=
1243 USB_STOR_XFER_GOOD) 1271 USB_STOR_XFER_GOOD)
@@ -1298,7 +1326,7 @@ int init_usbat(struct us_data *us)
1298 memset(us->extra, 0, sizeof(struct usbat_info)); 1326 memset(us->extra, 0, sizeof(struct usbat_info));
1299 info = (struct usbat_info *) (us->extra); 1327 info = (struct usbat_info *) (us->extra);
1300 1328
1301 // Enable peripheral control signals 1329 /* Enable peripheral control signals */
1302 rc = usbat_write_user_io(us, 1330 rc = usbat_write_user_io(us,
1303 USBAT_UIO_OE1 | USBAT_UIO_OE0, 1331 USBAT_UIO_OE1 | USBAT_UIO_OE0,
1304 USBAT_UIO_EPAD | USBAT_UIO_1); 1332 USBAT_UIO_EPAD | USBAT_UIO_1);
@@ -1337,7 +1365,7 @@ int init_usbat(struct us_data *us)
1337 1365
1338 US_DEBUGP("INIT 5\n"); 1366 US_DEBUGP("INIT 5\n");
1339 1367
1340 // Enable peripheral control signals and card detect 1368 /* Enable peripheral control signals and card detect */
1341 rc = usbat_device_enable_cdt(us); 1369 rc = usbat_device_enable_cdt(us);
1342 if (rc != USB_STOR_TRANSPORT_GOOD) 1370 if (rc != USB_STOR_TRANSPORT_GOOD)
1343 return rc; 1371 return rc;
@@ -1364,7 +1392,7 @@ int init_usbat(struct us_data *us)
1364 1392
1365 US_DEBUGP("INIT 9\n"); 1393 US_DEBUGP("INIT 9\n");
1366 1394
1367 // At this point, we need to detect which device we are using 1395 /* At this point, we need to detect which device we are using */
1368 if (usbat_set_transport(us, info)) 1396 if (usbat_set_transport(us, info))
1369 return USB_STOR_TRANSPORT_ERROR; 1397 return USB_STOR_TRANSPORT_ERROR;
1370 1398
@@ -1414,10 +1442,10 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)
1414 data[0] = 0x00; 1442 data[0] = 0x00;
1415 data[1] = 0x00; 1443 data[1] = 0x00;
1416 data[2] = 0x00; 1444 data[2] = 0x00;
1417 data[3] = len&0xFF; // (cylL) = expected length (L) 1445 data[3] = len&0xFF; /* (cylL) = expected length (L) */
1418 data[4] = (len>>8)&0xFF; // (cylH) = expected length (H) 1446 data[4] = (len>>8)&0xFF; /* (cylH) = expected length (H) */
1419 data[5] = 0xB0; // (device sel) = slave 1447 data[5] = 0xB0; /* (device sel) = slave */
1420 data[6] = 0xA0; // (command) = ATA PACKET COMMAND 1448 data[6] = 0xA0; /* (command) = ATA PACKET COMMAND */
1421 1449
1422 for (i=7; i<19; i++) { 1450 for (i=7; i<19; i++) {
1423 registers[i] = 0x10; 1451 registers[i] = 0x10;
@@ -1466,13 +1494,15 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)
1466 return result; 1494 return result;
1467 } 1495 }
1468 1496
1469 // Write the 12-byte command header. 1497 /*
1470 1498 * Write the 12-byte command header.
1471 // If the command is BLANK then set the timer for 75 minutes. 1499 *
1472 // Otherwise set it for 10 minutes. 1500 * If the command is BLANK then set the timer for 75 minutes.
1473 1501 * Otherwise set it for 10 minutes.
1474 // NOTE: THE 8200 DOCUMENTATION STATES THAT BLANKING A CDRW 1502 *
1475 // AT SPEED 4 IS UNRELIABLE!!! 1503 * NOTE: THE 8200 DOCUMENTATION STATES THAT BLANKING A CDRW
1504 * AT SPEED 4 IS UNRELIABLE!!!
1505 */
1476 1506
1477 if ( (result = usbat_write_block(us, 1507 if ( (result = usbat_write_block(us,
1478 USBAT_ATA, srb->cmnd, 12, 1508 USBAT_ATA, srb->cmnd, 12,
@@ -1481,19 +1511,18 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)
1481 return result; 1511 return result;
1482 } 1512 }
1483 1513
1484 // If there is response data to be read in 1514 /* If there is response data to be read in then do it here. */
1485 // then do it here.
1486 1515
1487 if (len != 0 && (srb->sc_data_direction == DMA_FROM_DEVICE)) { 1516 if (len != 0 && (srb->sc_data_direction == DMA_FROM_DEVICE)) {
1488 1517
1489 // How many bytes to read in? Check cylL register 1518 /* How many bytes to read in? Check cylL register */
1490 1519
1491 if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) != 1520 if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) !=
1492 USB_STOR_XFER_GOOD) { 1521 USB_STOR_XFER_GOOD) {
1493 return USB_STOR_TRANSPORT_ERROR; 1522 return USB_STOR_TRANSPORT_ERROR;
1494 } 1523 }
1495 1524
1496 if (len > 0xFF) { // need to read cylH also 1525 if (len > 0xFF) { /* need to read cylH also */
1497 len = *status; 1526 len = *status;
1498 if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_HI, status) != 1527 if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_HI, status) !=
1499 USB_STOR_XFER_GOOD) { 1528 USB_STOR_XFER_GOOD) {
@@ -1556,13 +1585,16 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us)
1556 if (rc != USB_STOR_TRANSPORT_GOOD) 1585 if (rc != USB_STOR_TRANSPORT_GOOD)
1557 return rc; 1586 return rc;
1558 1587
1559 info->ssize = 0x200; // hard coded 512 byte sectors as per ATA spec 1588 /* hard coded 512 byte sectors as per ATA spec */
1589 info->ssize = 0x200;
1560 US_DEBUGP("usbat_flash_transport: READ_CAPACITY: %ld sectors, %ld bytes per sector\n", 1590 US_DEBUGP("usbat_flash_transport: READ_CAPACITY: %ld sectors, %ld bytes per sector\n",
1561 info->sectors, info->ssize); 1591 info->sectors, info->ssize);
1562 1592
1563 // build the reply 1593 /*
1564 // note: must return the sector number of the last sector, 1594 * build the reply
1565 // *not* the total number of sectors 1595 * note: must return the sector number of the last sector,
1596 * *not* the total number of sectors
1597 */
1566 ((__be32 *) ptr)[0] = cpu_to_be32(info->sectors - 1); 1598 ((__be32 *) ptr)[0] = cpu_to_be32(info->sectors - 1);
1567 ((__be32 *) ptr)[1] = cpu_to_be32(info->ssize); 1599 ((__be32 *) ptr)[1] = cpu_to_be32(info->ssize);
1568 usb_stor_set_xfer_buf(ptr, 8, srb); 1600 usb_stor_set_xfer_buf(ptr, 8, srb);
@@ -1586,7 +1618,9 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us)
1586 } 1618 }
1587 1619
1588 if (srb->cmnd[0] == READ_12) { 1620 if (srb->cmnd[0] == READ_12) {
1589 // I don't think we'll ever see a READ_12 but support it anyway... 1621 /*
1622 * I don't think we'll ever see a READ_12 but support it anyway
1623 */
1590 block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) | 1624 block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
1591 ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5])); 1625 ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5]));
1592 1626
@@ -1608,7 +1642,9 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us)
1608 } 1642 }
1609 1643
1610 if (srb->cmnd[0] == WRITE_12) { 1644 if (srb->cmnd[0] == WRITE_12) {
1611 // I don't think we'll ever see a WRITE_12 but support it anyway... 1645 /*
1646 * I don't think we'll ever see a WRITE_12 but support it anyway
1647 */
1612 block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) | 1648 block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
1613 ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5])); 1649 ((u32)(srb->cmnd[4]) << 8) | ((u32)(srb->cmnd[5]));
1614 1650
@@ -1645,8 +1681,10 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us)
1645 } 1681 }
1646 1682
1647 if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) { 1683 if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {
1648 // sure. whatever. not like we can stop the user from popping 1684 /*
1649 // the media out of the device (no locking doors, etc) 1685 * sure. whatever. not like we can stop the user from popping
1686 * the media out of the device (no locking doors, etc)
1687 */
1650 return USB_STOR_TRANSPORT_GOOD; 1688 return USB_STOR_TRANSPORT_GOOD;
1651 } 1689 }
1652 1690
diff --git a/drivers/usb/storage/shuttle_usbat.h b/drivers/usb/storage/shuttle_usbat.h
index 5b8e867e2ae5..25e7d8b340b8 100644
--- a/drivers/usb/storage/shuttle_usbat.h
+++ b/drivers/usb/storage/shuttle_usbat.h
@@ -55,8 +55,8 @@
55#define USBAT_UIO_WRITE 0 55#define USBAT_UIO_WRITE 0
56 56
57/* Qualifier bits */ 57/* Qualifier bits */
58#define USBAT_QUAL_FCQ 0x20 // full compare 58#define USBAT_QUAL_FCQ 0x20 /* full compare */
59#define USBAT_QUAL_ALQ 0x10 // auto load subcount 59#define USBAT_QUAL_ALQ 0x10 /* auto load subcount */
60 60
61/* USBAT Flash Media status types */ 61/* USBAT Flash Media status types */
62#define USBAT_FLASH_MEDIA_NONE 0 62#define USBAT_FLASH_MEDIA_NONE 0
@@ -67,39 +67,39 @@
67#define USBAT_FLASH_MEDIA_CHANGED 1 67#define USBAT_FLASH_MEDIA_CHANGED 1
68 68
69/* USBAT ATA registers */ 69/* USBAT ATA registers */
70#define USBAT_ATA_DATA 0x10 // read/write data (R/W) 70#define USBAT_ATA_DATA 0x10 /* read/write data (R/W) */
71#define USBAT_ATA_FEATURES 0x11 // set features (W) 71#define USBAT_ATA_FEATURES 0x11 /* set features (W) */
72#define USBAT_ATA_ERROR 0x11 // error (R) 72#define USBAT_ATA_ERROR 0x11 /* error (R) */
73#define USBAT_ATA_SECCNT 0x12 // sector count (R/W) 73#define USBAT_ATA_SECCNT 0x12 /* sector count (R/W) */
74#define USBAT_ATA_SECNUM 0x13 // sector number (R/W) 74#define USBAT_ATA_SECNUM 0x13 /* sector number (R/W) */
75#define USBAT_ATA_LBA_ME 0x14 // cylinder low (R/W) 75#define USBAT_ATA_LBA_ME 0x14 /* cylinder low (R/W) */
76#define USBAT_ATA_LBA_HI 0x15 // cylinder high (R/W) 76#define USBAT_ATA_LBA_HI 0x15 /* cylinder high (R/W) */
77#define USBAT_ATA_DEVICE 0x16 // head/device selection (R/W) 77#define USBAT_ATA_DEVICE 0x16 /* head/device selection (R/W) */
78#define USBAT_ATA_STATUS 0x17 // device status (R) 78#define USBAT_ATA_STATUS 0x17 /* device status (R) */
79#define USBAT_ATA_CMD 0x17 // device command (W) 79#define USBAT_ATA_CMD 0x17 /* device command (W) */
80#define USBAT_ATA_ALTSTATUS 0x0E // status (no clear IRQ) (R) 80#define USBAT_ATA_ALTSTATUS 0x0E /* status (no clear IRQ) (R) */
81 81
82/* USBAT User I/O Data registers */ 82/* USBAT User I/O Data registers */
83#define USBAT_UIO_EPAD 0x80 // Enable Peripheral Control Signals 83#define USBAT_UIO_EPAD 0x80 /* Enable Peripheral Control Signals */
84#define USBAT_UIO_CDT 0x40 // Card Detect (Read Only) 84#define USBAT_UIO_CDT 0x40 /* Card Detect (Read Only) */
85 // CDT = ACKD & !UI1 & !UI0 85 /* CDT = ACKD & !UI1 & !UI0 */
86#define USBAT_UIO_1 0x20 // I/O 1 86#define USBAT_UIO_1 0x20 /* I/O 1 */
87#define USBAT_UIO_0 0x10 // I/O 0 87#define USBAT_UIO_0 0x10 /* I/O 0 */
88#define USBAT_UIO_EPP_ATA 0x08 // 1=EPP mode, 0=ATA mode 88#define USBAT_UIO_EPP_ATA 0x08 /* 1=EPP mode, 0=ATA mode */
89#define USBAT_UIO_UI1 0x04 // Input 1 89#define USBAT_UIO_UI1 0x04 /* Input 1 */
90#define USBAT_UIO_UI0 0x02 // Input 0 90#define USBAT_UIO_UI0 0x02 /* Input 0 */
91#define USBAT_UIO_INTR_ACK 0x01 // Interrupt (ATA & ISA)/Acknowledge (EPP) 91#define USBAT_UIO_INTR_ACK 0x01 /* Interrupt (ATA/ISA)/Acknowledge (EPP) */
92 92
93/* USBAT User I/O Enable registers */ 93/* USBAT User I/O Enable registers */
94#define USBAT_UIO_DRVRST 0x80 // Reset Peripheral 94#define USBAT_UIO_DRVRST 0x80 /* Reset Peripheral */
95#define USBAT_UIO_ACKD 0x40 // Enable Card Detect 95#define USBAT_UIO_ACKD 0x40 /* Enable Card Detect */
96#define USBAT_UIO_OE1 0x20 // I/O 1 set=output/clr=input 96#define USBAT_UIO_OE1 0x20 /* I/O 1 set=output/clr=input */
97 // If ACKD=1, set OE1 to 1 also. 97 /* If ACKD=1, set OE1 to 1 also. */
98#define USBAT_UIO_OE0 0x10 // I/O 0 set=output/clr=input 98#define USBAT_UIO_OE0 0x10 /* I/O 0 set=output/clr=input */
99#define USBAT_UIO_ADPRST 0x01 // Reset SCM chip 99#define USBAT_UIO_ADPRST 0x01 /* Reset SCM chip */
100 100
101/* USBAT Features */ 101/* USBAT Features */
102#define USBAT_FEAT_ETEN 0x80 // External trigger enable 102#define USBAT_FEAT_ETEN 0x80 /* External trigger enable */
103#define USBAT_FEAT_U1 0x08 103#define USBAT_FEAT_U1 0x08
104#define USBAT_FEAT_U0 0x04 104#define USBAT_FEAT_U0 0x04
105#define USBAT_FEAT_ET1 0x02 105#define USBAT_FEAT_ET1 0x02
@@ -112,12 +112,12 @@ struct usbat_info {
112 int devicetype; 112 int devicetype;
113 113
114 /* Used for Flash readers only */ 114 /* Used for Flash readers only */
115 unsigned long sectors; // total sector count 115 unsigned long sectors; /* total sector count */
116 unsigned long ssize; // sector size in bytes 116 unsigned long ssize; /* sector size in bytes */
117 117
118 unsigned char sense_key; 118 unsigned char sense_key;
119 unsigned long sense_asc; // additional sense code 119 unsigned long sense_asc; /* additional sense code */
120 unsigned long sense_ascq; // additional sense code qualifier 120 unsigned long sense_ascq; /* additional sense code qualifier */
121}; 121};
122 122
123#endif 123#endif
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index c1ba5301ebfc..7ca896a342e3 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -636,11 +636,11 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
636 636
637 /* use the new buffer we have */ 637 /* use the new buffer we have */
638 old_request_buffer = srb->request_buffer; 638 old_request_buffer = srb->request_buffer;
639 srb->request_buffer = srb->sense_buffer; 639 srb->request_buffer = us->sensebuf;
640 640
641 /* set the buffer length for transfer */ 641 /* set the buffer length for transfer */
642 old_request_bufflen = srb->request_bufflen; 642 old_request_bufflen = srb->request_bufflen;
643 srb->request_bufflen = 18; 643 srb->request_bufflen = US_SENSE_SIZE;
644 644
645 /* set up for no scatter-gather use */ 645 /* set up for no scatter-gather use */
646 old_sg = srb->use_sg; 646 old_sg = srb->use_sg;
@@ -652,6 +652,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
652 temp_result = us->transport(us->srb, us); 652 temp_result = us->transport(us->srb, us);
653 653
654 /* let's clean up right away */ 654 /* let's clean up right away */
655 memcpy(srb->sense_buffer, us->sensebuf, US_SENSE_SIZE);
655 srb->resid = old_resid; 656 srb->resid = old_resid;
656 srb->request_buffer = old_request_buffer; 657 srb->request_buffer = old_request_buffer;
657 srb->request_bufflen = old_request_bufflen; 658 srb->request_bufflen = old_request_bufflen;
@@ -923,6 +924,7 @@ int usb_stor_Bulk_max_lun(struct us_data *us)
923 int result; 924 int result;
924 925
925 /* issue the command */ 926 /* issue the command */
927 us->iobuf[0] = 0;
926 result = usb_stor_control_msg(us, us->recv_ctrl_pipe, 928 result = usb_stor_control_msg(us, us->recv_ctrl_pipe,
927 US_BULK_GET_MAX_LUN, 929 US_BULK_GET_MAX_LUN,
928 USB_DIR_IN | USB_TYPE_CLASS | 930 USB_DIR_IN | USB_TYPE_CLASS |
diff --git a/drivers/usb/storage/transport.h b/drivers/usb/storage/transport.h
index 8d9e0663f8fe..0a362cc781ad 100644
--- a/drivers/usb/storage/transport.h
+++ b/drivers/usb/storage/transport.h
@@ -50,7 +50,7 @@
50#define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */ 50#define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */
51#define US_PR_BULK 0x50 /* bulk only */ 51#define US_PR_BULK 0x50 /* bulk only */
52#ifdef CONFIG_USB_STORAGE_USBAT 52#ifdef CONFIG_USB_STORAGE_USBAT
53#define US_PR_SCM_ATAPI 0x80 /* SCM-ATAPI bridge */ 53#define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */
54#endif 54#endif
55#ifdef CONFIG_USB_STORAGE_SDDR09 55#ifdef CONFIG_USB_STORAGE_SDDR09
56#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */ 56#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index b79dad1b598c..9e926a8f2116 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -71,12 +71,12 @@ UNUSUAL_DEV( 0x03f0, 0x0107, 0x0200, 0x0200,
71UNUSUAL_DEV( 0x03f0, 0x0207, 0x0001, 0x0001, 71UNUSUAL_DEV( 0x03f0, 0x0207, 0x0001, 0x0001,
72 "HP", 72 "HP",
73 "CD-Writer+ 8200e", 73 "CD-Writer+ 8200e",
74 US_SC_8070, US_PR_SCM_ATAPI, init_usbat, 0), 74 US_SC_8070, US_PR_USBAT, init_usbat, 0),
75 75
76UNUSUAL_DEV( 0x03f0, 0x0307, 0x0001, 0x0001, 76UNUSUAL_DEV( 0x03f0, 0x0307, 0x0001, 0x0001,
77 "HP", 77 "HP",
78 "CD-Writer+ CD-4e", 78 "CD-Writer+ CD-4e",
79 US_SC_8070, US_PR_SCM_ATAPI, init_usbat, 0), 79 US_SC_8070, US_PR_USBAT, init_usbat, 0),
80#endif 80#endif
81 81
82/* Patch submitted by Mihnea-Costin Grigore <mihnea@zulu.ro> */ 82/* Patch submitted by Mihnea-Costin Grigore <mihnea@zulu.ro> */
@@ -106,6 +106,13 @@ UNUSUAL_DEV( 0x0411, 0x001c, 0x0113, 0x0113,
106 US_SC_DEVICE, US_PR_DEVICE, NULL, 106 US_SC_DEVICE, US_PR_DEVICE, NULL,
107 US_FL_FIX_INQUIRY ), 107 US_FL_FIX_INQUIRY ),
108 108
109/* Reported by Stefan Werner <dustbln@gmx.de> */
110UNUSUAL_DEV( 0x0419, 0xaaf6, 0x0100, 0x0100,
111 "TrekStor",
112 "i.Beat Joy 2.0",
113 US_SC_DEVICE, US_PR_DEVICE, NULL,
114 US_FL_IGNORE_RESIDUE ),
115
109/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ 116/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */
110UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, 117UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210,
111 "SMSC", 118 "SMSC",
@@ -244,6 +251,13 @@ UNUSUAL_DEV( 0x04da, 0x2372, 0x0000, 0x9999,
244 US_SC_DEVICE, US_PR_DEVICE, NULL, 251 US_SC_DEVICE, US_PR_DEVICE, NULL,
245 US_FL_FIX_CAPACITY | US_FL_NOT_LOCKABLE ), 252 US_FL_FIX_CAPACITY | US_FL_NOT_LOCKABLE ),
246 253
254/* Reported by Simeon Simeonov <simeonov_2000@yahoo.com> */
255UNUSUAL_DEV( 0x04da, 0x2373, 0x0000, 0x9999,
256 "LEICA",
257 "D-LUX Camera",
258 US_SC_DEVICE, US_PR_DEVICE, NULL,
259 US_FL_FIX_CAPACITY | US_FL_NOT_LOCKABLE ),
260
247/* Most of the following entries were developed with the help of 261/* Most of the following entries were developed with the help of
248 * Shuttle/SCM directly. 262 * Shuttle/SCM directly.
249 */ 263 */
@@ -333,9 +347,9 @@ UNUSUAL_DEV( 0x04fc, 0x80c2, 0x0100, 0x0100,
333 347
334#ifdef CONFIG_USB_STORAGE_USBAT 348#ifdef CONFIG_USB_STORAGE_USBAT
335UNUSUAL_DEV( 0x04e6, 0x1010, 0x0000, 0x9999, 349UNUSUAL_DEV( 0x04e6, 0x1010, 0x0000, 0x9999,
336 "SCM", 350 "Shuttle/SCM",
337 "SCM USBAT-02", 351 "USBAT-02",
338 US_SC_SCSI, US_PR_SCM_ATAPI, init_usbat, 352 US_SC_SCSI, US_PR_USBAT, init_usbat,
339 US_FL_SINGLE_LUN), 353 US_FL_SINGLE_LUN),
340#endif 354#endif
341 355
@@ -598,6 +612,16 @@ UNUSUAL_DEV( 0x05ac, 0x1205, 0x0000, 0x9999,
598 US_SC_DEVICE, US_PR_DEVICE, NULL, 612 US_SC_DEVICE, US_PR_DEVICE, NULL,
599 US_FL_FIX_CAPACITY ), 613 US_FL_FIX_CAPACITY ),
600 614
615/*
616 * Reported by Tyson Vinson <lornoss@gmail.com>
617 * This particular productId is the iPod Nano
618 */
619UNUSUAL_DEV( 0x05ac, 0x120a, 0x0000, 0x9999,
620 "Apple",
621 "iPod",
622 US_SC_DEVICE, US_PR_DEVICE, NULL,
623 US_FL_FIX_CAPACITY ),
624
601#ifdef CONFIG_USB_STORAGE_JUMPSHOT 625#ifdef CONFIG_USB_STORAGE_JUMPSHOT
602UNUSUAL_DEV( 0x05dc, 0x0001, 0x0000, 0x0001, 626UNUSUAL_DEV( 0x05dc, 0x0001, 0x0000, 0x0001,
603 "Lexar", 627 "Lexar",
@@ -702,6 +726,14 @@ UNUSUAL_DEV( 0x0781, 0x0001, 0x0200, 0x0200,
702 US_SC_SCSI, US_PR_CB, NULL, 726 US_SC_SCSI, US_PR_CB, NULL,
703 US_FL_SINGLE_LUN ), 727 US_FL_SINGLE_LUN ),
704 728
729#ifdef CONFIG_USB_STORAGE_USBAT
730UNUSUAL_DEV( 0x0781, 0x0005, 0x0005, 0x0005,
731 "Sandisk",
732 "ImageMate SDDR-05b",
733 US_SC_SCSI, US_PR_USBAT, init_usbat,
734 US_FL_SINGLE_LUN ),
735#endif
736
705UNUSUAL_DEV( 0x0781, 0x0100, 0x0100, 0x0100, 737UNUSUAL_DEV( 0x0781, 0x0100, 0x0100, 0x0100,
706 "Sandisk", 738 "Sandisk",
707 "ImageMate SDDR-12", 739 "ImageMate SDDR-12",
@@ -724,7 +756,7 @@ UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999,
724#endif 756#endif
725 757
726/* Reported by Eero Volotinen <eero@ping-viini.org> */ 758/* Reported by Eero Volotinen <eero@ping-viini.org> */
727UNUSUAL_DEV( 0x07ab, 0xfccd, 0x0406, 0x0406, 759UNUSUAL_DEV( 0x07ab, 0xfccd, 0x0000, 0x9999,
728 "Freecom Technologies", 760 "Freecom Technologies",
729 "FHD-Classic", 761 "FHD-Classic",
730 US_SC_DEVICE, US_PR_DEVICE, NULL, 762 US_SC_DEVICE, US_PR_DEVICE, NULL,
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index f9a9bfa1aef5..3847ebed2aa4 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -54,6 +54,7 @@
54#include <linux/module.h> 54#include <linux/module.h>
55#include <linux/init.h> 55#include <linux/init.h>
56#include <linux/slab.h> 56#include <linux/slab.h>
57#include <linux/kthread.h>
57 58
58#include <scsi/scsi.h> 59#include <scsi/scsi.h>
59#include <scsi/scsi_cmnd.h> 60#include <scsi/scsi_cmnd.h>
@@ -111,11 +112,6 @@ static atomic_t total_threads = ATOMIC_INIT(0);
111static DECLARE_COMPLETION(threads_gone); 112static DECLARE_COMPLETION(threads_gone);
112 113
113 114
114static int storage_probe(struct usb_interface *iface,
115 const struct usb_device_id *id);
116
117static void storage_disconnect(struct usb_interface *iface);
118
119/* The entries in this table, except for final ones here 115/* The entries in this table, except for final ones here
120 * (USB_MASS_STORAGE_CLASS and the empty entry), correspond, 116 * (USB_MASS_STORAGE_CLASS and the empty entry), correspond,
121 * line for line with the entries of us_unsuaul_dev_list[]. 117 * line for line with the entries of us_unsuaul_dev_list[].
@@ -233,13 +229,40 @@ static struct us_unusual_dev us_unusual_dev_list[] = {
233 { NULL } 229 { NULL }
234}; 230};
235 231
236static struct usb_driver usb_storage_driver = { 232
237 .owner = THIS_MODULE, 233#ifdef CONFIG_PM /* Minimal support for suspend and resume */
238 .name = "usb-storage", 234
239 .probe = storage_probe, 235static int storage_suspend(struct usb_interface *iface, pm_message_t message)
240 .disconnect = storage_disconnect, 236{
241 .id_table = storage_usb_ids, 237 struct us_data *us = usb_get_intfdata(iface);
242}; 238
239 /* Wait until no command is running */
240 down(&us->dev_semaphore);
241
242 US_DEBUGP("%s\n", __FUNCTION__);
243 iface->dev.power.power_state.event = message.event;
244
245 /* When runtime PM is working, we'll set a flag to indicate
246 * whether we should autoresume when a SCSI request arrives. */
247
248 up(&us->dev_semaphore);
249 return 0;
250}
251
252static int storage_resume(struct usb_interface *iface)
253{
254 struct us_data *us = usb_get_intfdata(iface);
255
256 down(&us->dev_semaphore);
257
258 US_DEBUGP("%s\n", __FUNCTION__);
259 iface->dev.power.power_state.event = PM_EVENT_ON;
260
261 up(&us->dev_semaphore);
262 return 0;
263}
264
265#endif /* CONFIG_PM */
243 266
244/* 267/*
245 * fill_inquiry_response takes an unsigned char array (which must 268 * fill_inquiry_response takes an unsigned char array (which must
@@ -288,22 +311,7 @@ static int usb_stor_control_thread(void * __us)
288 struct us_data *us = (struct us_data *)__us; 311 struct us_data *us = (struct us_data *)__us;
289 struct Scsi_Host *host = us_to_host(us); 312 struct Scsi_Host *host = us_to_host(us);
290 313
291 lock_kernel();
292
293 /*
294 * This thread doesn't need any user-level access,
295 * so get rid of all our resources.
296 */
297 daemonize("usb-storage");
298 current->flags |= PF_NOFREEZE; 314 current->flags |= PF_NOFREEZE;
299 unlock_kernel();
300
301 /* acquire a reference to the host, so it won't be deallocated
302 * until we're ready to exit */
303 scsi_host_get(host);
304
305 /* signal that we've started the thread */
306 complete(&(us->notify));
307 315
308 for(;;) { 316 for(;;) {
309 US_DEBUGP("*** thread sleeping.\n"); 317 US_DEBUGP("*** thread sleeping.\n");
@@ -467,6 +475,12 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf)
467 US_DEBUGP("I/O buffer allocation failed\n"); 475 US_DEBUGP("I/O buffer allocation failed\n");
468 return -ENOMEM; 476 return -ENOMEM;
469 } 477 }
478
479 us->sensebuf = kmalloc(US_SENSE_SIZE, GFP_KERNEL);
480 if (!us->sensebuf) {
481 US_DEBUGP("Sense buffer allocation failed\n");
482 return -ENOMEM;
483 }
470 return 0; 484 return 0;
471} 485}
472 486
@@ -555,8 +569,8 @@ static int get_transport(struct us_data *us)
555 break; 569 break;
556 570
557#ifdef CONFIG_USB_STORAGE_USBAT 571#ifdef CONFIG_USB_STORAGE_USBAT
558 case US_PR_SCM_ATAPI: 572 case US_PR_USBAT:
559 us->transport_name = "SCM/ATAPI"; 573 us->transport_name = "Shuttle USBAT";
560 us->transport = usbat_transport; 574 us->transport = usbat_transport;
561 us->transport_reset = usb_stor_CB_reset; 575 us->transport_reset = usb_stor_CB_reset;
562 us->max_lun = 1; 576 us->max_lun = 1;
@@ -740,6 +754,7 @@ static int get_pipes(struct us_data *us)
740static int usb_stor_acquire_resources(struct us_data *us) 754static int usb_stor_acquire_resources(struct us_data *us)
741{ 755{
742 int p; 756 int p;
757 struct task_struct *th;
743 758
744 us->current_urb = usb_alloc_urb(0, GFP_KERNEL); 759 us->current_urb = usb_alloc_urb(0, GFP_KERNEL);
745 if (!us->current_urb) { 760 if (!us->current_urb) {
@@ -747,38 +762,28 @@ static int usb_stor_acquire_resources(struct us_data *us)
747 return -ENOMEM; 762 return -ENOMEM;
748 } 763 }
749 764
750 /* Lock the device while we carry out the next two operations */
751 down(&us->dev_semaphore);
752
753 /* For bulk-only devices, determine the max LUN value */
754 if (us->protocol == US_PR_BULK) {
755 p = usb_stor_Bulk_max_lun(us);
756 if (p < 0) {
757 up(&us->dev_semaphore);
758 return p;
759 }
760 us->max_lun = p;
761 }
762
763 /* Just before we start our control thread, initialize 765 /* Just before we start our control thread, initialize
764 * the device if it needs initialization */ 766 * the device if it needs initialization */
765 if (us->unusual_dev->initFunction) 767 if (us->unusual_dev->initFunction) {
766 us->unusual_dev->initFunction(us); 768 p = us->unusual_dev->initFunction(us);
767 769 if (p)
768 up(&us->dev_semaphore); 770 return p;
771 }
769 772
770 /* Start up our control thread */ 773 /* Start up our control thread */
771 p = kernel_thread(usb_stor_control_thread, us, CLONE_VM); 774 th = kthread_create(usb_stor_control_thread, us, "usb-storage");
772 if (p < 0) { 775 if (IS_ERR(th)) {
773 printk(KERN_WARNING USB_STORAGE 776 printk(KERN_WARNING USB_STORAGE
774 "Unable to start control thread\n"); 777 "Unable to start control thread\n");
775 return p; 778 return PTR_ERR(th);
776 } 779 }
777 us->pid = p;
778 atomic_inc(&total_threads);
779 780
780 /* Wait for the thread to start */ 781 /* Take a reference to the host for the control thread and
781 wait_for_completion(&(us->notify)); 782 * count it among all the threads we have launched. Then
783 * start it up. */
784 scsi_host_get(us_to_host(us));
785 atomic_inc(&total_threads);
786 wake_up_process(th);
782 787
783 return 0; 788 return 0;
784} 789}
@@ -812,6 +817,8 @@ static void dissociate_dev(struct us_data *us)
812{ 817{
813 US_DEBUGP("-- %s\n", __FUNCTION__); 818 US_DEBUGP("-- %s\n", __FUNCTION__);
814 819
820 kfree(us->sensebuf);
821
815 /* Free the device-related DMA-mapped buffers */ 822 /* Free the device-related DMA-mapped buffers */
816 if (us->cr) 823 if (us->cr)
817 usb_buffer_free(us->pusb_dev, sizeof(*us->cr), us->cr, 824 usb_buffer_free(us->pusb_dev, sizeof(*us->cr), us->cr,
@@ -872,21 +879,6 @@ static int usb_stor_scan_thread(void * __us)
872{ 879{
873 struct us_data *us = (struct us_data *)__us; 880 struct us_data *us = (struct us_data *)__us;
874 881
875 /*
876 * This thread doesn't need any user-level access,
877 * so get rid of all our resources.
878 */
879 lock_kernel();
880 daemonize("usb-stor-scan");
881 unlock_kernel();
882
883 /* Acquire a reference to the host, so it won't be deallocated
884 * until we're ready to exit */
885 scsi_host_get(us_to_host(us));
886
887 /* Signal that we've started the thread */
888 complete(&(us->notify));
889
890 printk(KERN_DEBUG 882 printk(KERN_DEBUG
891 "usb-storage: device found at %d\n", us->pusb_dev->devnum); 883 "usb-storage: device found at %d\n", us->pusb_dev->devnum);
892 884
@@ -904,6 +896,14 @@ retry:
904 896
905 /* If the device is still connected, perform the scanning */ 897 /* If the device is still connected, perform the scanning */
906 if (!test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { 898 if (!test_bit(US_FLIDX_DISCONNECTING, &us->flags)) {
899
900 /* For bulk-only devices, determine the max LUN value */
901 if (us->protocol == US_PR_BULK &&
902 !(us->flags & US_FL_SINGLE_LUN)) {
903 down(&us->dev_semaphore);
904 us->max_lun = usb_stor_Bulk_max_lun(us);
905 up(&us->dev_semaphore);
906 }
907 scsi_scan_host(us_to_host(us)); 907 scsi_scan_host(us_to_host(us));
908 printk(KERN_DEBUG "usb-storage: device scan complete\n"); 908 printk(KERN_DEBUG "usb-storage: device scan complete\n");
909 909
@@ -923,6 +923,7 @@ static int storage_probe(struct usb_interface *intf,
923 struct us_data *us; 923 struct us_data *us;
924 const int id_index = id - storage_usb_ids; 924 const int id_index = id - storage_usb_ids;
925 int result; 925 int result;
926 struct task_struct *th;
926 927
927 US_DEBUGP("USB Mass Storage device detected\n"); 928 US_DEBUGP("USB Mass Storage device detected\n");
928 929
@@ -1003,17 +1004,21 @@ static int storage_probe(struct usb_interface *intf,
1003 } 1004 }
1004 1005
1005 /* Start up the thread for delayed SCSI-device scanning */ 1006 /* Start up the thread for delayed SCSI-device scanning */
1006 result = kernel_thread(usb_stor_scan_thread, us, CLONE_VM); 1007 th = kthread_create(usb_stor_scan_thread, us, "usb-stor-scan");
1007 if (result < 0) { 1008 if (IS_ERR(th)) {
1008 printk(KERN_WARNING USB_STORAGE 1009 printk(KERN_WARNING USB_STORAGE
1009 "Unable to start the device-scanning thread\n"); 1010 "Unable to start the device-scanning thread\n");
1010 quiesce_and_remove_host(us); 1011 quiesce_and_remove_host(us);
1012 result = PTR_ERR(th);
1011 goto BadDevice; 1013 goto BadDevice;
1012 } 1014 }
1013 atomic_inc(&total_threads);
1014 1015
1015 /* Wait for the thread to start */ 1016 /* Take a reference to the host for the scanning thread and
1016 wait_for_completion(&(us->notify)); 1017 * count it among all the threads we have launched. Then
1018 * start it up. */
1019 scsi_host_get(us_to_host(us));
1020 atomic_inc(&total_threads);
1021 wake_up_process(th);
1017 1022
1018 return 0; 1023 return 0;
1019 1024
@@ -1038,6 +1043,18 @@ static void storage_disconnect(struct usb_interface *intf)
1038 * Initialization and registration 1043 * Initialization and registration
1039 ***********************************************************************/ 1044 ***********************************************************************/
1040 1045
1046static struct usb_driver usb_storage_driver = {
1047 .owner = THIS_MODULE,
1048 .name = "usb-storage",
1049 .probe = storage_probe,
1050 .disconnect = storage_disconnect,
1051#ifdef CONFIG_PM
1052 .suspend = storage_suspend,
1053 .resume = storage_resume,
1054#endif
1055 .id_table = storage_usb_ids,
1056};
1057
1041static int __init usb_stor_init(void) 1058static int __init usb_stor_init(void)
1042{ 1059{
1043 int retval; 1060 int retval;
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
index a195adae57b6..98b09711a739 100644
--- a/drivers/usb/storage/usb.h
+++ b/drivers/usb/storage/usb.h
@@ -117,6 +117,7 @@ enum { US_DO_ALL_FLAGS };
117 */ 117 */
118 118
119#define US_IOBUF_SIZE 64 /* Size of the DMA-mapped I/O buffer */ 119#define US_IOBUF_SIZE 64 /* Size of the DMA-mapped I/O buffer */
120#define US_SENSE_SIZE 18 /* Size of the autosense data buffer */
120 121
121typedef int (*trans_cmnd)(struct scsi_cmnd *, struct us_data*); 122typedef int (*trans_cmnd)(struct scsi_cmnd *, struct us_data*);
122typedef int (*trans_reset)(struct us_data*); 123typedef int (*trans_reset)(struct us_data*);
@@ -160,14 +161,12 @@ struct us_data {
160 struct scsi_cmnd *srb; /* current srb */ 161 struct scsi_cmnd *srb; /* current srb */
161 unsigned int tag; /* current dCBWTag */ 162 unsigned int tag; /* current dCBWTag */
162 163
163 /* thread information */
164 int pid; /* control thread */
165
166 /* control and bulk communications data */ 164 /* control and bulk communications data */
167 struct urb *current_urb; /* USB requests */ 165 struct urb *current_urb; /* USB requests */
168 struct usb_ctrlrequest *cr; /* control requests */ 166 struct usb_ctrlrequest *cr; /* control requests */
169 struct usb_sg_request current_sg; /* scatter-gather req. */ 167 struct usb_sg_request current_sg; /* scatter-gather req. */
170 unsigned char *iobuf; /* I/O buffer */ 168 unsigned char *iobuf; /* I/O buffer */
169 unsigned char *sensebuf; /* sense data buffer */
171 dma_addr_t cr_dma; /* buffer DMA addresses */ 170 dma_addr_t cr_dma; /* buffer DMA addresses */
172 dma_addr_t iobuf_dma; 171 dma_addr_t iobuf_dma;
173 172
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
index 353f24d45bc1..6c3a53f8f26c 100644
--- a/drivers/usb/usb-skeleton.c
+++ b/drivers/usb/usb-skeleton.c
@@ -223,9 +223,8 @@ static struct file_operations skel_fops = {
223 * and to have the device registered with devfs and the driver core 223 * and to have the device registered with devfs and the driver core
224 */ 224 */
225static struct usb_class_driver skel_class = { 225static struct usb_class_driver skel_class = {
226 .name = "usb/skel%d", 226 .name = "skel%d",
227 .fops = &skel_fops, 227 .fops = &skel_fops,
228 .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
229 .minor_base = USB_SKEL_MINOR_BASE, 228 .minor_base = USB_SKEL_MINOR_BASE,
230}; 229};
231 230
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index e28a74203f3b..a327e03753ac 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -3050,6 +3050,7 @@ HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl)
3050HANDLE_IOCTL(USBDEVFS_CONTROL32, do_usbdevfs_control) 3050HANDLE_IOCTL(USBDEVFS_CONTROL32, do_usbdevfs_control)
3051HANDLE_IOCTL(USBDEVFS_BULK32, do_usbdevfs_bulk) 3051HANDLE_IOCTL(USBDEVFS_BULK32, do_usbdevfs_bulk)
3052HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal) 3052HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal)
3053COMPATIBLE_IOCTL(USBDEVFS_IOCTL32)
3053/* i2c */ 3054/* i2c */
3054HANDLE_IOCTL(I2C_FUNCS, w_long) 3055HANDLE_IOCTL(I2C_FUNCS, w_long)
3055HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl) 3056HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl)
diff --git a/include/asm-i386/mach-summit/mach_mpparse.h b/include/asm-i386/mach-summit/mach_mpparse.h
index 2b9e6d55bef1..1cce2b924a80 100644
--- a/include/asm-i386/mach-summit/mach_mpparse.h
+++ b/include/asm-i386/mach-summit/mach_mpparse.h
@@ -22,7 +22,6 @@ static inline void mpc_oem_pci_bus(struct mpc_config_bus *m,
22{ 22{
23} 23}
24 24
25extern int usb_early_handoff;
26static inline int mps_oem_check(struct mp_config_table *mpc, char *oem, 25static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
27 char *productid) 26 char *productid)
28{ 27{
@@ -32,7 +31,6 @@ static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
32 || !strncmp(productid, "RUTHLESS SMP", 12))){ 31 || !strncmp(productid, "RUTHLESS SMP", 12))){
33 use_cyclone = 1; /*enable cyclone-timer*/ 32 use_cyclone = 1; /*enable cyclone-timer*/
34 setup_summit(); 33 setup_summit();
35 usb_early_handoff = 1;
36 return 1; 34 return 1;
37 } 35 }
38 return 0; 36 return 0;
@@ -46,7 +44,6 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
46 || !strncmp(oem_table_id, "EXA", 3))){ 44 || !strncmp(oem_table_id, "EXA", 3))){
47 use_cyclone = 1; /*enable cyclone-timer*/ 45 use_cyclone = 1; /*enable cyclone-timer*/
48 setup_summit(); 46 setup_summit();
49 usb_early_handoff = 1;
50 return 1; 47 return 1;
51 } 48 }
52 return 0; 49 return 0;
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index a2f6ac5aef7d..ca5ea994d688 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -26,7 +26,7 @@ typedef void ia64_mv_cpu_init_t (void);
26typedef void ia64_mv_irq_init_t (void); 26typedef void ia64_mv_irq_init_t (void);
27typedef void ia64_mv_send_ipi_t (int, int, int, int); 27typedef void ia64_mv_send_ipi_t (int, int, int, int);
28typedef void ia64_mv_timer_interrupt_t (int, void *, struct pt_regs *); 28typedef void ia64_mv_timer_interrupt_t (int, void *, struct pt_regs *);
29typedef void ia64_mv_global_tlb_purge_t (unsigned long, unsigned long, unsigned long); 29typedef void ia64_mv_global_tlb_purge_t (struct mm_struct *, unsigned long, unsigned long, unsigned long);
30typedef void ia64_mv_tlb_migrate_finish_t (struct mm_struct *); 30typedef void ia64_mv_tlb_migrate_finish_t (struct mm_struct *);
31typedef unsigned int ia64_mv_local_vector_to_irq (u8); 31typedef unsigned int ia64_mv_local_vector_to_irq (u8);
32typedef char *ia64_mv_pci_get_legacy_mem_t (struct pci_bus *); 32typedef char *ia64_mv_pci_get_legacy_mem_t (struct pci_bus *);
diff --git a/include/asm-ia64/machvec_hpzx1.h b/include/asm-ia64/machvec_hpzx1.h
index daafe504c5f4..e90daf9ce340 100644
--- a/include/asm-ia64/machvec_hpzx1.h
+++ b/include/asm-ia64/machvec_hpzx1.h
@@ -1,8 +1,7 @@
1#ifndef _ASM_IA64_MACHVEC_HPZX1_h 1#ifndef _ASM_IA64_MACHVEC_HPZX1_h
2#define _ASM_IA64_MACHVEC_HPZX1_h 2#define _ASM_IA64_MACHVEC_HPZX1_h
3 3
4extern ia64_mv_setup_t dig_setup; 4extern ia64_mv_setup_t dig_setup;
5extern ia64_mv_setup_t sba_setup;
6extern ia64_mv_dma_alloc_coherent sba_alloc_coherent; 5extern ia64_mv_dma_alloc_coherent sba_alloc_coherent;
7extern ia64_mv_dma_free_coherent sba_free_coherent; 6extern ia64_mv_dma_free_coherent sba_free_coherent;
8extern ia64_mv_dma_map_single sba_map_single; 7extern ia64_mv_dma_map_single sba_map_single;
@@ -19,15 +18,15 @@ extern ia64_mv_dma_mapping_error sba_dma_mapping_error;
19 * platform's machvec structure. When compiling a non-generic kernel, 18 * platform's machvec structure. When compiling a non-generic kernel,
20 * the macros are used directly. 19 * the macros are used directly.
21 */ 20 */
22#define platform_name "hpzx1" 21#define platform_name "hpzx1"
23#define platform_setup sba_setup 22#define platform_setup dig_setup
24#define platform_dma_init machvec_noop 23#define platform_dma_init machvec_noop
25#define platform_dma_alloc_coherent sba_alloc_coherent 24#define platform_dma_alloc_coherent sba_alloc_coherent
26#define platform_dma_free_coherent sba_free_coherent 25#define platform_dma_free_coherent sba_free_coherent
27#define platform_dma_map_single sba_map_single 26#define platform_dma_map_single sba_map_single
28#define platform_dma_unmap_single sba_unmap_single 27#define platform_dma_unmap_single sba_unmap_single
29#define platform_dma_map_sg sba_map_sg 28#define platform_dma_map_sg sba_map_sg
30#define platform_dma_unmap_sg sba_unmap_sg 29#define platform_dma_unmap_sg sba_unmap_sg
31#define platform_dma_sync_single_for_cpu machvec_dma_sync_single 30#define platform_dma_sync_single_for_cpu machvec_dma_sync_single
32#define platform_dma_sync_sg_for_cpu machvec_dma_sync_sg 31#define platform_dma_sync_sg_for_cpu machvec_dma_sync_sg
33#define platform_dma_sync_single_for_device machvec_dma_sync_single 32#define platform_dma_sync_single_for_device machvec_dma_sync_single
diff --git a/include/asm-ia64/machvec_hpzx1_swiotlb.h b/include/asm-ia64/machvec_hpzx1_swiotlb.h
index 9924b1b00a6c..f00a34a148ff 100644
--- a/include/asm-ia64/machvec_hpzx1_swiotlb.h
+++ b/include/asm-ia64/machvec_hpzx1_swiotlb.h
@@ -2,7 +2,6 @@
2#define _ASM_IA64_MACHVEC_HPZX1_SWIOTLB_h 2#define _ASM_IA64_MACHVEC_HPZX1_SWIOTLB_h
3 3
4extern ia64_mv_setup_t dig_setup; 4extern ia64_mv_setup_t dig_setup;
5extern ia64_mv_dma_init hwsw_init;
6extern ia64_mv_dma_alloc_coherent hwsw_alloc_coherent; 5extern ia64_mv_dma_alloc_coherent hwsw_alloc_coherent;
7extern ia64_mv_dma_free_coherent hwsw_free_coherent; 6extern ia64_mv_dma_free_coherent hwsw_free_coherent;
8extern ia64_mv_dma_map_single hwsw_map_single; 7extern ia64_mv_dma_map_single hwsw_map_single;
@@ -26,7 +25,7 @@ extern ia64_mv_dma_sync_sg_for_device hwsw_sync_sg_for_device;
26#define platform_name "hpzx1_swiotlb" 25#define platform_name "hpzx1_swiotlb"
27 26
28#define platform_setup dig_setup 27#define platform_setup dig_setup
29#define platform_dma_init hwsw_init 28#define platform_dma_init machvec_noop
30#define platform_dma_alloc_coherent hwsw_alloc_coherent 29#define platform_dma_alloc_coherent hwsw_alloc_coherent
31#define platform_dma_free_coherent hwsw_free_coherent 30#define platform_dma_free_coherent hwsw_free_coherent
32#define platform_dma_map_single hwsw_map_single 31#define platform_dma_map_single hwsw_map_single
diff --git a/include/asm-ia64/meminit.h b/include/asm-ia64/meminit.h
index 1590dc65b30b..46501b01a5c5 100644
--- a/include/asm-ia64/meminit.h
+++ b/include/asm-ia64/meminit.h
@@ -16,10 +16,11 @@
16 * - initrd (optional) 16 * - initrd (optional)
17 * - command line string 17 * - command line string
18 * - kernel code & data 18 * - kernel code & data
19 * - Kernel memory map built from EFI memory map
19 * 20 *
20 * More could be added if necessary 21 * More could be added if necessary
21 */ 22 */
22#define IA64_MAX_RSVD_REGIONS 5 23#define IA64_MAX_RSVD_REGIONS 6
23 24
24struct rsvd_region { 25struct rsvd_region {
25 unsigned long start; /* virtual address of beginning of element */ 26 unsigned long start; /* virtual address of beginning of element */
@@ -33,6 +34,7 @@ extern void find_memory (void);
33extern void reserve_memory (void); 34extern void reserve_memory (void);
34extern void find_initrd (void); 35extern void find_initrd (void);
35extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg); 36extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg);
37extern void efi_memmap_init(unsigned long *, unsigned long *);
36 38
37/* 39/*
38 * For rounding an address to the next IA64_GRANULE_SIZE or order 40 * For rounding an address to the next IA64_GRANULE_SIZE or order
@@ -41,7 +43,7 @@ extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg
41#define GRANULEROUNDUP(n) (((n)+IA64_GRANULE_SIZE-1) & ~(IA64_GRANULE_SIZE-1)) 43#define GRANULEROUNDUP(n) (((n)+IA64_GRANULE_SIZE-1) & ~(IA64_GRANULE_SIZE-1))
42#define ORDERROUNDDOWN(n) ((n) & ~((PAGE_SIZE<<MAX_ORDER)-1)) 44#define ORDERROUNDDOWN(n) ((n) & ~((PAGE_SIZE<<MAX_ORDER)-1))
43 45
44#ifdef CONFIG_DISCONTIGMEM 46#ifdef CONFIG_NUMA
45 extern void call_pernode_memory (unsigned long start, unsigned long len, void *func); 47 extern void call_pernode_memory (unsigned long start, unsigned long len, void *func);
46#else 48#else
47# define call_pernode_memory(start, len, func) (*func)(start, len, 0) 49# define call_pernode_memory(start, len, func) (*func)(start, len, 0)
diff --git a/include/asm-ia64/mmzone.h b/include/asm-ia64/mmzone.h
index d32f51e3d6c2..34efe88eb849 100644
--- a/include/asm-ia64/mmzone.h
+++ b/include/asm-ia64/mmzone.h
@@ -15,7 +15,7 @@
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm/meminit.h> 16#include <asm/meminit.h>
17 17
18#ifdef CONFIG_DISCONTIGMEM 18#ifdef CONFIG_NUMA
19 19
20static inline int pfn_to_nid(unsigned long pfn) 20static inline int pfn_to_nid(unsigned long pfn)
21{ 21{
@@ -31,6 +31,10 @@ static inline int pfn_to_nid(unsigned long pfn)
31#endif 31#endif
32} 32}
33 33
34#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
35extern int early_pfn_to_nid(unsigned long pfn);
36#endif
37
34#ifdef CONFIG_IA64_DIG /* DIG systems are small */ 38#ifdef CONFIG_IA64_DIG /* DIG systems are small */
35# define MAX_PHYSNODE_ID 8 39# define MAX_PHYSNODE_ID 8
36# define NR_NODE_MEMBLKS (MAX_NUMNODES * 8) 40# define NR_NODE_MEMBLKS (MAX_NUMNODES * 8)
@@ -39,8 +43,8 @@ static inline int pfn_to_nid(unsigned long pfn)
39# define NR_NODE_MEMBLKS (MAX_NUMNODES * 4) 43# define NR_NODE_MEMBLKS (MAX_NUMNODES * 4)
40#endif 44#endif
41 45
42#else /* CONFIG_DISCONTIGMEM */ 46#else /* CONFIG_NUMA */
43# define NR_NODE_MEMBLKS (MAX_NUMNODES * 4) 47# define NR_NODE_MEMBLKS (MAX_NUMNODES * 4)
44#endif /* CONFIG_DISCONTIGMEM */ 48#endif /* CONFIG_NUMA */
45 49
46#endif /* _ASM_IA64_MMZONE_H */ 50#endif /* _ASM_IA64_MMZONE_H */
diff --git a/include/asm-ia64/nodedata.h b/include/asm-ia64/nodedata.h
index 6b0f3ed89b7e..9978c7ce7549 100644
--- a/include/asm-ia64/nodedata.h
+++ b/include/asm-ia64/nodedata.h
@@ -17,7 +17,7 @@
17#include <asm/percpu.h> 17#include <asm/percpu.h>
18#include <asm/mmzone.h> 18#include <asm/mmzone.h>
19 19
20#ifdef CONFIG_DISCONTIGMEM 20#ifdef CONFIG_NUMA
21 21
22/* 22/*
23 * Node Data. One of these structures is located on each node of a NUMA system. 23 * Node Data. One of these structures is located on each node of a NUMA system.
@@ -47,6 +47,6 @@ struct ia64_node_data {
47 */ 47 */
48#define NODE_DATA(nid) (local_node_data->pg_data_ptrs[nid]) 48#define NODE_DATA(nid) (local_node_data->pg_data_ptrs[nid])
49 49
50#endif /* CONFIG_DISCONTIGMEM */ 50#endif /* CONFIG_NUMA */
51 51
52#endif /* _ASM_IA64_NODEDATA_H */ 52#endif /* _ASM_IA64_NODEDATA_H */
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index 9edffad8c28b..ef436b9d06ad 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -102,15 +102,15 @@ do { \
102 102
103#ifdef CONFIG_VIRTUAL_MEM_MAP 103#ifdef CONFIG_VIRTUAL_MEM_MAP
104extern int ia64_pfn_valid (unsigned long pfn); 104extern int ia64_pfn_valid (unsigned long pfn);
105#else 105#elif defined(CONFIG_FLATMEM)
106# define ia64_pfn_valid(pfn) 1 106# define ia64_pfn_valid(pfn) 1
107#endif 107#endif
108 108
109#ifndef CONFIG_DISCONTIGMEM 109#ifdef CONFIG_FLATMEM
110# define pfn_valid(pfn) (((pfn) < max_mapnr) && ia64_pfn_valid(pfn)) 110# define pfn_valid(pfn) (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
111# define page_to_pfn(page) ((unsigned long) (page - mem_map)) 111# define page_to_pfn(page) ((unsigned long) (page - mem_map))
112# define pfn_to_page(pfn) (mem_map + (pfn)) 112# define pfn_to_page(pfn) (mem_map + (pfn))
113#else 113#elif defined(CONFIG_DISCONTIGMEM)
114extern struct page *vmem_map; 114extern struct page *vmem_map;
115extern unsigned long max_low_pfn; 115extern unsigned long max_low_pfn;
116# define pfn_valid(pfn) (((pfn) < max_low_pfn) && ia64_pfn_valid(pfn)) 116# define pfn_valid(pfn) (((pfn) < max_low_pfn) && ia64_pfn_valid(pfn))
diff --git a/include/asm-ia64/sn/arch.h b/include/asm-ia64/sn/arch.h
index ab827d298569..1a3831c04af6 100644
--- a/include/asm-ia64/sn/arch.h
+++ b/include/asm-ia64/sn/arch.h
@@ -18,6 +18,32 @@
18#include <asm/sn/sn_cpuid.h> 18#include <asm/sn/sn_cpuid.h>
19 19
20/* 20/*
21 * This is the maximum number of NUMALINK nodes that can be part of a single
22 * SSI kernel. This number includes C-brick, M-bricks, and TIOs. Nodes in
23 * remote partitions are NOT included in this number.
24 * The number of compact nodes cannot exceed size of a coherency domain.
25 * The purpose of this define is to specify a node count that includes
26 * all C/M/TIO nodes in an SSI system.
27 *
28 * SGI system can currently support up to 256 C/M nodes plus additional TIO nodes.
29 *
30 * Note: ACPI20 has an architectural limit of 256 nodes. When we upgrade
31 * to ACPI3.0, this limit will be removed. The notion of "compact nodes"
32 * should be deleted and TIOs should be included in MAX_NUMNODES.
33 */
34#define MAX_COMPACT_NODES 512
35
36/*
37 * Maximum number of nodes in all partitions and in all coherency domains.
38 * This is the total number of nodes accessible in the numalink fabric. It
39 * includes all C & M bricks, plus all TIOs.
40 *
41 * This value is also the value of the maximum number of NASIDs in the numalink
42 * fabric.
43 */
44#define MAX_NUMALINK_NODES 16384
45
46/*
21 * The following defines attributes of the HUB chip. These attributes are 47 * The following defines attributes of the HUB chip. These attributes are
22 * frequently referenced. They are kept in the per-cpu data areas of each cpu. 48 * frequently referenced. They are kept in the per-cpu data areas of each cpu.
23 * They are kept together in a struct to minimize cache misses. 49 * They are kept together in a struct to minimize cache misses.
@@ -41,15 +67,6 @@ DECLARE_PER_CPU(struct sn_hub_info_s, __sn_hub_info);
41 67
42 68
43/* 69/*
44 * This is the maximum number of nodes that can be part of a kernel.
45 * Effectively, it's the maximum number of compact node ids (cnodeid_t).
46 * This is not necessarily the same as MAX_NASIDS.
47 */
48#define MAX_COMPACT_NODES 2048
49#define CPUS_PER_NODE 4
50
51
52/*
53 * Compact node ID to nasid mappings kept in the per-cpu data areas of each 70 * Compact node ID to nasid mappings kept in the per-cpu data areas of each
54 * cpu. 71 * cpu.
55 */ 72 */
@@ -57,7 +74,6 @@ DECLARE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_NUMNODES]);
57#define sn_cnodeid_to_nasid (&__get_cpu_var(__sn_cnodeid_to_nasid[0])) 74#define sn_cnodeid_to_nasid (&__get_cpu_var(__sn_cnodeid_to_nasid[0]))
58 75
59 76
60
61extern u8 sn_partition_id; 77extern u8 sn_partition_id;
62extern u8 sn_system_size; 78extern u8 sn_system_size;
63extern u8 sn_sharing_domain_size; 79extern u8 sn_sharing_domain_size;
diff --git a/include/asm-ia64/sn/io.h b/include/asm-ia64/sn/io.h
index 42209733f6b1..41c73a735628 100644
--- a/include/asm-ia64/sn/io.h
+++ b/include/asm-ia64/sn/io.h
@@ -14,7 +14,7 @@
14extern void * sn_io_addr(unsigned long port) __attribute_const__; /* Forward definition */ 14extern void * sn_io_addr(unsigned long port) __attribute_const__; /* Forward definition */
15extern void __sn_mmiowb(void); /* Forward definition */ 15extern void __sn_mmiowb(void); /* Forward definition */
16 16
17extern int numionodes; 17extern int num_cnodes;
18 18
19#define __sn_mf_a() ia64_mfa() 19#define __sn_mf_a() ia64_mfa()
20 20
@@ -36,6 +36,15 @@ extern void sn_dma_flush(unsigned long);
36#define __sn_readq_relaxed ___sn_readq_relaxed 36#define __sn_readq_relaxed ___sn_readq_relaxed
37 37
38/* 38/*
39 * Convenience macros for setting/clearing bits using the above accessors
40 */
41
42#define __sn_setq_relaxed(addr, val) \
43 writeq((__sn_readq_relaxed(addr) | (val)), (addr))
44#define __sn_clrq_relaxed(addr, val) \
45 writeq((__sn_readq_relaxed(addr) & ~(val)), (addr))
46
47/*
39 * The following routines are SN Platform specific, called when 48 * The following routines are SN Platform specific, called when
40 * a reference is made to inX/outX set macros. SN Platform 49 * a reference is made to inX/outX set macros. SN Platform
41 * inX set of macros ensures that Posted DMA writes on the 50 * inX set of macros ensures that Posted DMA writes on the
diff --git a/include/asm-ia64/sn/klconfig.h b/include/asm-ia64/sn/klconfig.h
index 9f920c70a62a..bcbf209d63be 100644
--- a/include/asm-ia64/sn/klconfig.h
+++ b/include/asm-ia64/sn/klconfig.h
@@ -208,19 +208,6 @@ typedef struct lboard_s {
208 klconf_off_t brd_next_same; /* Next BOARD with same nasid */ 208 klconf_off_t brd_next_same; /* Next BOARD with same nasid */
209} lboard_t; 209} lboard_t;
210 210
211#define KLCF_NUM_COMPS(_brd) ((_brd)->brd_numcompts)
212#define NODE_OFFSET_TO_KLINFO(n,off) ((klinfo_t*) TO_NODE_CAC(n,off))
213#define KLCF_NEXT(_brd) \
214 ((_brd)->brd_next_same ? \
215 (NODE_OFFSET_TO_LBOARD((_brd)->brd_next_same_host, (_brd)->brd_next_same)): NULL)
216#define KLCF_NEXT_ANY(_brd) \
217 ((_brd)->brd_next_any ? \
218 (NODE_OFFSET_TO_LBOARD(NASID_GET(_brd), (_brd)->brd_next_any)): NULL)
219#define KLCF_COMP(_brd, _ndx) \
220 ((((_brd)->brd_compts[(_ndx)]) == 0) ? 0 : \
221 (NODE_OFFSET_TO_KLINFO(NASID_GET(_brd), (_brd)->brd_compts[(_ndx)])))
222
223
224/* 211/*
225 * Generic info structure. This stores common info about a 212 * Generic info structure. This stores common info about a
226 * component. 213 * component.
@@ -249,24 +236,11 @@ typedef struct klinfo_s { /* Generic info */
249} klinfo_t ; 236} klinfo_t ;
250 237
251 238
252static inline lboard_t *find_lboard_any(lboard_t * start, unsigned char brd_type) 239static inline lboard_t *find_lboard_next(lboard_t * brd)
253{ 240{
254 /* Search all boards stored on this node. */ 241 if (brd && brd->brd_next_any)
255 242 return NODE_OFFSET_TO_LBOARD(NASID_GET(brd), brd->brd_next_any);
256 while (start) { 243 return NULL;
257 if (start->brd_type == brd_type)
258 return start;
259 start = KLCF_NEXT_ANY(start);
260 }
261 /* Didn't find it. */
262 return (lboard_t *) NULL;
263} 244}
264 245
265
266/* external declarations of Linux kernel functions. */
267
268extern lboard_t *root_lboard[];
269extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type);
270extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type);
271
272#endif /* _ASM_IA64_SN_KLCONFIG_H */ 246#endif /* _ASM_IA64_SN_KLCONFIG_H */
diff --git a/include/asm-ia64/sn/l1.h b/include/asm-ia64/sn/l1.h
index 2e5f0aa38889..e3b819110d47 100644
--- a/include/asm-ia64/sn/l1.h
+++ b/include/asm-ia64/sn/l1.h
@@ -35,4 +35,16 @@
35#define L1_BRICKTYPE_ATHENA 0x2b /* + */ 35#define L1_BRICKTYPE_ATHENA 0x2b /* + */
36#define L1_BRICKTYPE_DAYTONA 0x7a /* z */ 36#define L1_BRICKTYPE_DAYTONA 0x7a /* z */
37 37
38/* board type response codes */
39#define L1_BOARDTYPE_IP69 0x0100 /* CA */
40#define L1_BOARDTYPE_IP63 0x0200 /* CB */
41#define L1_BOARDTYPE_BASEIO 0x0300 /* IB */
42#define L1_BOARDTYPE_PCIE2SLOT 0x0400 /* IC */
43#define L1_BOARDTYPE_PCIX3SLOT 0x0500 /* ID */
44#define L1_BOARDTYPE_PCIXPCIE4SLOT 0x0600 /* IE */
45#define L1_BOARDTYPE_ABACUS 0x0700 /* AB */
46#define L1_BOARDTYPE_DAYTONA 0x0800 /* AD */
47#define L1_BOARDTYPE_INVAL (-1) /* invalid brick type */
48
49
38#endif /* _ASM_IA64_SN_L1_H */ 50#endif /* _ASM_IA64_SN_L1_H */
diff --git a/include/asm-ia64/sn/nodepda.h b/include/asm-ia64/sn/nodepda.h
index 47bb8100fd00..6f6d69e39ff5 100644
--- a/include/asm-ia64/sn/nodepda.h
+++ b/include/asm-ia64/sn/nodepda.h
@@ -55,7 +55,6 @@ struct nodepda_s {
55 */ 55 */
56 struct phys_cpuid phys_cpuid[NR_CPUS]; 56 struct phys_cpuid phys_cpuid[NR_CPUS];
57 spinlock_t ptc_lock ____cacheline_aligned_in_smp; 57 spinlock_t ptc_lock ____cacheline_aligned_in_smp;
58 spinlock_t bist_lock;
59}; 58};
60 59
61typedef struct nodepda_s nodepda_t; 60typedef struct nodepda_s nodepda_t;
diff --git a/include/asm-ia64/sn/sn_cpuid.h b/include/asm-ia64/sn/sn_cpuid.h
index d2c1d34dcce4..749deb2ca6c1 100644
--- a/include/asm-ia64/sn/sn_cpuid.h
+++ b/include/asm-ia64/sn/sn_cpuid.h
@@ -105,7 +105,6 @@ extern short physical_node_map[]; /* indexed by nasid to get cnode */
105#define cpuid_to_nasid(cpuid) (sn_nodepda->phys_cpuid[cpuid].nasid) 105#define cpuid_to_nasid(cpuid) (sn_nodepda->phys_cpuid[cpuid].nasid)
106#define cpuid_to_subnode(cpuid) (sn_nodepda->phys_cpuid[cpuid].subnode) 106#define cpuid_to_subnode(cpuid) (sn_nodepda->phys_cpuid[cpuid].subnode)
107#define cpuid_to_slice(cpuid) (sn_nodepda->phys_cpuid[cpuid].slice) 107#define cpuid_to_slice(cpuid) (sn_nodepda->phys_cpuid[cpuid].slice)
108#define cpuid_to_cnodeid(cpuid) (physical_node_map[cpuid_to_nasid(cpuid)])
109 108
110 109
111/* 110/*
@@ -113,8 +112,6 @@ extern short physical_node_map[]; /* indexed by nasid to get cnode */
113 * of potentially large tables. 112 * of potentially large tables.
114 */ 113 */
115extern int nasid_slice_to_cpuid(int, int); 114extern int nasid_slice_to_cpuid(int, int);
116#define nasid_slice_to_cpu_physical_id(nasid, slice) \
117 cpu_physical_id(nasid_slice_to_cpuid(nasid, slice))
118 115
119/* 116/*
120 * cnodeid_to_nasid - convert a cnodeid to a NASID 117 * cnodeid_to_nasid - convert a cnodeid to a NASID
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index fea35b33d4e4..3f7564dc0aa9 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -47,6 +47,7 @@
47#define SN_SAL_CONSOLE_PUTB 0x02000028 47#define SN_SAL_CONSOLE_PUTB 0x02000028
48#define SN_SAL_CONSOLE_XMIT_CHARS 0x0200002a 48#define SN_SAL_CONSOLE_XMIT_CHARS 0x0200002a
49#define SN_SAL_CONSOLE_READC 0x0200002b 49#define SN_SAL_CONSOLE_READC 0x0200002b
50#define SN_SAL_SYSCTL_OP 0x02000030
50#define SN_SAL_SYSCTL_MODID_GET 0x02000031 51#define SN_SAL_SYSCTL_MODID_GET 0x02000031
51#define SN_SAL_SYSCTL_GET 0x02000032 52#define SN_SAL_SYSCTL_GET 0x02000032
52#define SN_SAL_SYSCTL_IOBRICK_MODULE_GET 0x02000033 53#define SN_SAL_SYSCTL_IOBRICK_MODULE_GET 0x02000033
@@ -67,7 +68,7 @@
67#define SN_SAL_IOIF_INTERRUPT 0x0200004a 68#define SN_SAL_IOIF_INTERRUPT 0x0200004a
68#define SN_SAL_HWPERF_OP 0x02000050 // lock 69#define SN_SAL_HWPERF_OP 0x02000050 // lock
69#define SN_SAL_IOIF_ERROR_INTERRUPT 0x02000051 70#define SN_SAL_IOIF_ERROR_INTERRUPT 0x02000051
70 71#define SN_SAL_IOIF_PCI_SAFE 0x02000052
71#define SN_SAL_IOIF_SLOT_ENABLE 0x02000053 72#define SN_SAL_IOIF_SLOT_ENABLE 0x02000053
72#define SN_SAL_IOIF_SLOT_DISABLE 0x02000054 73#define SN_SAL_IOIF_SLOT_DISABLE 0x02000054
73#define SN_SAL_IOIF_GET_HUBDEV_INFO 0x02000055 74#define SN_SAL_IOIF_GET_HUBDEV_INFO 0x02000055
@@ -101,6 +102,13 @@
101#define SAL_INTR_FREE 2 102#define SAL_INTR_FREE 2
102 103
103/* 104/*
105 * operations available on the generic SN_SAL_SYSCTL_OP
106 * runtime service
107 */
108#define SAL_SYSCTL_OP_IOBOARD 0x0001 /* retrieve board type */
109#define SAL_SYSCTL_OP_TIO_JLCK_RST 0x0002 /* issue TIO clock reset */
110
111/*
104 * IRouter (i.e. generalized system controller) operations 112 * IRouter (i.e. generalized system controller) operations
105 */ 113 */
106#define SAL_IROUTER_OPEN 0 /* open a subchannel */ 114#define SAL_IROUTER_OPEN 0 /* open a subchannel */
@@ -198,26 +206,16 @@ ia64_sn_get_master_baseio_nasid(void)
198 return ret_stuff.v0; 206 return ret_stuff.v0;
199} 207}
200 208
201static inline char * 209static inline void *
202ia64_sn_get_klconfig_addr(nasid_t nasid) 210ia64_sn_get_klconfig_addr(nasid_t nasid)
203{ 211{
204 struct ia64_sal_retval ret_stuff; 212 struct ia64_sal_retval ret_stuff;
205 int cnodeid;
206 213
207 cnodeid = nasid_to_cnodeid(nasid);
208 ret_stuff.status = 0; 214 ret_stuff.status = 0;
209 ret_stuff.v0 = 0; 215 ret_stuff.v0 = 0;
210 ret_stuff.v1 = 0; 216 ret_stuff.v1 = 0;
211 ret_stuff.v2 = 0; 217 ret_stuff.v2 = 0;
212 SAL_CALL(ret_stuff, SN_SAL_GET_KLCONFIG_ADDR, (u64)nasid, 0, 0, 0, 0, 0, 0); 218 SAL_CALL(ret_stuff, SN_SAL_GET_KLCONFIG_ADDR, (u64)nasid, 0, 0, 0, 0, 0, 0);
213
214 /*
215 * We should panic if a valid cnode nasid does not produce
216 * a klconfig address.
217 */
218 if (ret_stuff.status != 0) {
219 panic("ia64_sn_get_klconfig_addr: Returned error %lx\n", ret_stuff.status);
220 }
221 return ret_stuff.v0 ? __va(ret_stuff.v0) : NULL; 219 return ret_stuff.v0 ? __va(ret_stuff.v0) : NULL;
222} 220}
223 221
@@ -694,12 +692,10 @@ sn_change_memprotect(u64 paddr, u64 len, u64 perms, u64 *nasid_array)
694 unsigned long irq_flags; 692 unsigned long irq_flags;
695 693
696 cnodeid = nasid_to_cnodeid(get_node_number(paddr)); 694 cnodeid = nasid_to_cnodeid(get_node_number(paddr));
697 // spin_lock(&NODEPDA(cnodeid)->bist_lock);
698 local_irq_save(irq_flags); 695 local_irq_save(irq_flags);
699 ia64_sal_oemcall_nolock(&ret_stuff, SN_SAL_MEMPROTECT, paddr, len, 696 ia64_sal_oemcall_nolock(&ret_stuff, SN_SAL_MEMPROTECT, paddr, len,
700 (u64)nasid_array, perms, 0, 0, 0); 697 (u64)nasid_array, perms, 0, 0, 0);
701 local_irq_restore(irq_flags); 698 local_irq_restore(irq_flags);
702 // spin_unlock(&NODEPDA(cnodeid)->bist_lock);
703 return ret_stuff.status; 699 return ret_stuff.status;
704} 700}
705#define SN_MEMPROT_ACCESS_CLASS_0 0x14a080 701#define SN_MEMPROT_ACCESS_CLASS_0 0x14a080
@@ -873,6 +869,41 @@ ia64_sn_sysctl_event_init(nasid_t nasid)
873 return (int) rv.v0; 869 return (int) rv.v0;
874} 870}
875 871
872/*
873 * Ask the system controller on the specified nasid to reset
874 * the CX corelet clock. Only valid on TIO nodes.
875 */
876static inline int
877ia64_sn_sysctl_tio_clock_reset(nasid_t nasid)
878{
879 struct ia64_sal_retval rv;
880 SAL_CALL_REENTRANT(rv, SN_SAL_SYSCTL_OP, SAL_SYSCTL_OP_TIO_JLCK_RST,
881 nasid, 0, 0, 0, 0, 0);
882 if (rv.status != 0)
883 return (int)rv.status;
884 if (rv.v0 != 0)
885 return (int)rv.v0;
886
887 return 0;
888}
889
890/*
891 * Get the associated ioboard type for a given nasid.
892 */
893static inline int
894ia64_sn_sysctl_ioboard_get(nasid_t nasid)
895{
896 struct ia64_sal_retval rv;
897 SAL_CALL_REENTRANT(rv, SN_SAL_SYSCTL_OP, SAL_SYSCTL_OP_IOBOARD,
898 nasid, 0, 0, 0, 0, 0);
899 if (rv.v0 != 0)
900 return (int)rv.v0;
901 if (rv.v1 != 0)
902 return (int)rv.v1;
903
904 return 0;
905}
906
876/** 907/**
877 * ia64_sn_get_fit_compt - read a FIT entry from the PROM header 908 * ia64_sn_get_fit_compt - read a FIT entry from the PROM header
878 * @nasid: NASID of node to read 909 * @nasid: NASID of node to read
diff --git a/include/asm-ia64/sn/tioca_provider.h b/include/asm-ia64/sn/tioca_provider.h
index 5ccec608d325..b532ef6148ed 100644
--- a/include/asm-ia64/sn/tioca_provider.h
+++ b/include/asm-ia64/sn/tioca_provider.h
@@ -182,11 +182,11 @@ tioca_tlbflush(struct tioca_kernel *tioca_kernel)
182 * touch every CL aligned GART entry. 182 * touch every CL aligned GART entry.
183 */ 183 */
184 184
185 ca_base->ca_control2 &= ~(CA_GART_MEM_PARAM); 185 __sn_clrq_relaxed(&ca_base->ca_control2, CA_GART_MEM_PARAM);
186 ca_base->ca_control2 |= CA_GART_FLUSH_TLB; 186 __sn_setq_relaxed(&ca_base->ca_control2, CA_GART_FLUSH_TLB);
187 ca_base->ca_control2 |= 187 __sn_setq_relaxed(&ca_base->ca_control2,
188 (0x2ull << CA_GART_MEM_PARAM_SHFT); 188 (0x2ull << CA_GART_MEM_PARAM_SHFT));
189 tmp = ca_base->ca_control2; 189 tmp = __sn_readq_relaxed(&ca_base->ca_control2);
190 } 190 }
191 191
192 return; 192 return;
@@ -196,8 +196,8 @@ tioca_tlbflush(struct tioca_kernel *tioca_kernel)
196 * Gart in uncached mode ... need an explicit flush. 196 * Gart in uncached mode ... need an explicit flush.
197 */ 197 */
198 198
199 ca_base->ca_control2 |= CA_GART_FLUSH_TLB; 199 __sn_setq_relaxed(&ca_base->ca_control2, CA_GART_FLUSH_TLB);
200 tmp = ca_base->ca_control2; 200 tmp = __sn_readq_relaxed(&ca_base->ca_control2);
201} 201}
202 202
203extern uint32_t tioca_gart_found; 203extern uint32_t tioca_gart_found;
diff --git a/include/asm-ia64/sn/tiocx.h b/include/asm-ia64/sn/tiocx.h
index c5447a504509..5699e75e5024 100644
--- a/include/asm-ia64/sn/tiocx.h
+++ b/include/asm-ia64/sn/tiocx.h
@@ -19,6 +19,7 @@ struct cx_id_s {
19 19
20struct cx_dev { 20struct cx_dev {
21 struct cx_id_s cx_id; 21 struct cx_id_s cx_id;
22 int bt; /* board/blade type */
22 void *soft; /* driver specific */ 23 void *soft; /* driver specific */
23 struct hubdev_info *hubdev; 24 struct hubdev_info *hubdev;
24 struct device dev; 25 struct device dev;
@@ -59,7 +60,7 @@ struct cx_drv {
59extern struct sn_irq_info *tiocx_irq_alloc(nasid_t, int, int, nasid_t, int); 60extern struct sn_irq_info *tiocx_irq_alloc(nasid_t, int, int, nasid_t, int);
60extern void tiocx_irq_free(struct sn_irq_info *); 61extern void tiocx_irq_free(struct sn_irq_info *);
61extern int cx_device_unregister(struct cx_dev *); 62extern int cx_device_unregister(struct cx_dev *);
62extern int cx_device_register(nasid_t, int, int, struct hubdev_info *); 63extern int cx_device_register(nasid_t, int, int, struct hubdev_info *, int);
63extern int cx_driver_unregister(struct cx_drv *); 64extern int cx_driver_unregister(struct cx_drv *);
64extern int cx_driver_register(struct cx_drv *); 65extern int cx_driver_register(struct cx_drv *);
65extern uint64_t tiocx_dma_addr(uint64_t addr); 66extern uint64_t tiocx_dma_addr(uint64_t addr);
diff --git a/include/asm-ia64/sn/xp.h b/include/asm-ia64/sn/xp.h
index 1df1c9f61a65..49faf8f26430 100644
--- a/include/asm-ia64/sn/xp.h
+++ b/include/asm-ia64/sn/xp.h
@@ -49,7 +49,7 @@
49 * C-brick nasids, thus the need for bitmaps which don't account for 49 * C-brick nasids, thus the need for bitmaps which don't account for
50 * odd-numbered (non C-brick) nasids. 50 * odd-numbered (non C-brick) nasids.
51 */ 51 */
52#define XP_MAX_PHYSNODE_ID (MAX_PHYSNODE_ID / 2) 52#define XP_MAX_PHYSNODE_ID (MAX_NUMALINK_NODES / 2)
53#define XP_NASID_MASK_BYTES ((XP_MAX_PHYSNODE_ID + 7) / 8) 53#define XP_NASID_MASK_BYTES ((XP_MAX_PHYSNODE_ID + 7) / 8)
54#define XP_NASID_MASK_WORDS ((XP_MAX_PHYSNODE_ID + 63) / 64) 54#define XP_NASID_MASK_WORDS ((XP_MAX_PHYSNODE_ID + 63) / 64)
55 55
@@ -217,7 +217,17 @@ enum xpc_retval {
217 xpcInvalidPartid, /* 42: invalid partition ID */ 217 xpcInvalidPartid, /* 42: invalid partition ID */
218 xpcLocalPartid, /* 43: local partition ID */ 218 xpcLocalPartid, /* 43: local partition ID */
219 219
220 xpcUnknownReason /* 44: unknown reason -- must be last in list */ 220 xpcOtherGoingDown, /* 44: other side going down, reason unknown */
221 xpcSystemGoingDown, /* 45: system is going down, reason unknown */
222 xpcSystemHalt, /* 46: system is being halted */
223 xpcSystemReboot, /* 47: system is being rebooted */
224 xpcSystemPoweroff, /* 48: system is being powered off */
225
226 xpcDisconnecting, /* 49: channel disconnecting (closing) */
227
228 xpcOpenCloseError, /* 50: channel open/close protocol error */
229
230 xpcUnknownReason /* 51: unknown reason -- must be last in list */
221}; 231};
222 232
223 233
@@ -342,7 +352,7 @@ typedef void (*xpc_notify_func)(enum xpc_retval reason, partid_t partid,
342 * 352 *
343 * The 'func' field points to the function to call when aynchronous 353 * The 'func' field points to the function to call when aynchronous
344 * notification is required for such events as: a connection established/lost, 354 * notification is required for such events as: a connection established/lost,
345 * or an incomming message received, or an error condition encountered. A 355 * or an incoming message received, or an error condition encountered. A
346 * non-NULL 'func' field indicates that there is an active registration for 356 * non-NULL 'func' field indicates that there is an active registration for
347 * the channel. 357 * the channel.
348 */ 358 */
diff --git a/include/asm-ia64/sparsemem.h b/include/asm-ia64/sparsemem.h
new file mode 100644
index 000000000000..67a7c40ec27f
--- /dev/null
+++ b/include/asm-ia64/sparsemem.h
@@ -0,0 +1,20 @@
1#ifndef _ASM_IA64_SPARSEMEM_H
2#define _ASM_IA64_SPARSEMEM_H
3
4#ifdef CONFIG_SPARSEMEM
5/*
6 * SECTION_SIZE_BITS 2^N: how big each section will be
7 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space
8 */
9
10#define SECTION_SIZE_BITS (30)
11#define MAX_PHYSMEM_BITS (50)
12#ifdef CONFIG_FORCE_MAX_ZONEORDER
13#if ((CONFIG_FORCE_MAX_ZONEORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS)
14#undef SECTION_SIZE_BITS
15#define SECTION_SIZE_BITS (CONFIG_FORCE_MAX_ZONEORDER - 1 + PAGE_SHIFT)
16#endif
17#endif
18
19#endif /* CONFIG_SPARSEMEM */
20#endif /* _ASM_IA64_SPARSEMEM_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 7d300f7469e3..467a096c3b81 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -96,6 +96,9 @@
96#define PCI_CLASS_SERIAL_ACCESS 0x0c01 96#define PCI_CLASS_SERIAL_ACCESS 0x0c01
97#define PCI_CLASS_SERIAL_SSA 0x0c02 97#define PCI_CLASS_SERIAL_SSA 0x0c02
98#define PCI_CLASS_SERIAL_USB 0x0c03 98#define PCI_CLASS_SERIAL_USB 0x0c03
99#define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300
100#define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310
101#define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320
99#define PCI_CLASS_SERIAL_FIBER 0x0c04 102#define PCI_CLASS_SERIAL_FIBER 0x0c04
100#define PCI_CLASS_SERIAL_SMBUS 0x0c05 103#define PCI_CLASS_SERIAL_SMBUS 0x0c05
101 104
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 7897cf500c51..c61d5de837ef 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -224,7 +224,6 @@ struct dev_pm_info {
224 unsigned should_wakeup:1; 224 unsigned should_wakeup:1;
225 pm_message_t prev_state; 225 pm_message_t prev_state;
226 void * saved_state; 226 void * saved_state;
227 atomic_t pm_users;
228 struct device * pm_parent; 227 struct device * pm_parent;
229 struct list_head entry; 228 struct list_head entry;
230#endif 229#endif
@@ -244,6 +243,9 @@ extern int device_suspend(pm_message_t state);
244#define device_may_wakeup(dev) \ 243#define device_may_wakeup(dev) \
245 (device_can_wakeup(dev) && (dev)->power.should_wakeup) 244 (device_can_wakeup(dev) && (dev)->power.should_wakeup)
246 245
246extern int dpm_runtime_suspend(struct device *, pm_message_t);
247extern void dpm_runtime_resume(struct device *);
248
247#else /* !CONFIG_PM */ 249#else /* !CONFIG_PM */
248 250
249static inline int device_suspend(pm_message_t state) 251static inline int device_suspend(pm_message_t state)
@@ -254,6 +256,16 @@ static inline int device_suspend(pm_message_t state)
254#define device_set_wakeup_enable(dev,val) do{}while(0) 256#define device_set_wakeup_enable(dev,val) do{}while(0)
255#define device_may_wakeup(dev) (0) 257#define device_may_wakeup(dev) (0)
256 258
259static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state)
260{
261 return 0;
262}
263
264static inline void dpm_runtime_resume(struct device * dev)
265{
266
267}
268
257#endif 269#endif
258 270
259/* changes to device_may_wakeup take effect on the next pm state change. 271/* changes to device_may_wakeup take effect on the next pm state change.
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 8f731e8f2821..748d04385256 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -57,6 +57,7 @@ struct usb_host_endpoint {
57 struct usb_endpoint_descriptor desc; 57 struct usb_endpoint_descriptor desc;
58 struct list_head urb_list; 58 struct list_head urb_list;
59 void *hcpriv; 59 void *hcpriv;
60 struct kobject *kobj; /* For sysfs info */
60 61
61 unsigned char *extra; /* Extra descriptors */ 62 unsigned char *extra; /* Extra descriptors */
62 int extralen; 63 int extralen;
@@ -136,7 +137,8 @@ struct usb_interface {
136 * active alternate setting */ 137 * active alternate setting */
137 unsigned num_altsetting; /* number of alternate settings */ 138 unsigned num_altsetting; /* number of alternate settings */
138 139
139 int minor; /* minor number this interface is bound to */ 140 int minor; /* minor number this interface is
141 * bound to */
140 enum usb_interface_condition condition; /* state of binding */ 142 enum usb_interface_condition condition; /* state of binding */
141 struct device dev; /* interface specific device info */ 143 struct device dev; /* interface specific device info */
142 struct class_device *class_dev; 144 struct class_device *class_dev;
@@ -229,7 +231,7 @@ struct usb_interface_cache {
229struct usb_host_config { 231struct usb_host_config {
230 struct usb_config_descriptor desc; 232 struct usb_config_descriptor desc;
231 233
232 char *string; 234 char *string; /* iConfiguration string, if present */
233 /* the interfaces associated with this configuration, 235 /* the interfaces associated with this configuration,
234 * stored in no particular order */ 236 * stored in no particular order */
235 struct usb_interface *interface[USB_MAXINTERFACES]; 237 struct usb_interface *interface[USB_MAXINTERFACES];
@@ -248,7 +250,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
248 __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\ 250 __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\
249 type,(void**)ptr) 251 type,(void**)ptr)
250 252
251/* -------------------------------------------------------------------------- */ 253/* ----------------------------------------------------------------------- */
252 254
253struct usb_operations; 255struct usb_operations;
254 256
@@ -268,7 +270,8 @@ struct usb_bus {
268 unsigned is_b_host:1; /* true during some HNP roleswitches */ 270 unsigned is_b_host:1; /* true during some HNP roleswitches */
269 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ 271 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
270 272
271 int devnum_next; /* Next open device number in round-robin allocation */ 273 int devnum_next; /* Next open device number in
274 * round-robin allocation */
272 275
273 struct usb_devmap devmap; /* device address allocation map */ 276 struct usb_devmap devmap; /* device address allocation map */
274 struct usb_operations *op; /* Operations (specific to the HC) */ 277 struct usb_operations *op; /* Operations (specific to the HC) */
@@ -289,15 +292,16 @@ struct usb_bus {
289 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 292 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
290 293
291 struct class_device *class_dev; /* class device for this bus */ 294 struct class_device *class_dev; /* class device for this bus */
292 struct kref kref; /* handles reference counting this bus */ 295 struct kref kref; /* reference counting for this bus */
293 void (*release)(struct usb_bus *bus); /* function to destroy this bus's memory */ 296 void (*release)(struct usb_bus *bus);
297
294#if defined(CONFIG_USB_MON) 298#if defined(CONFIG_USB_MON)
295 struct mon_bus *mon_bus; /* non-null when associated */ 299 struct mon_bus *mon_bus; /* non-null when associated */
296 int monitored; /* non-zero when monitored */ 300 int monitored; /* non-zero when monitored */
297#endif 301#endif
298}; 302};
299 303
300/* -------------------------------------------------------------------------- */ 304/* ----------------------------------------------------------------------- */
301 305
302/* This is arbitrary. 306/* This is arbitrary.
303 * From USB 2.0 spec Table 11-13, offset 7, a hub can 307 * From USB 2.0 spec Table 11-13, offset 7, a hub can
@@ -326,7 +330,8 @@ struct usb_device {
326 330
327 struct semaphore serialize; 331 struct semaphore serialize;
328 332
329 unsigned int toggle[2]; /* one bit for each endpoint ([0] = IN, [1] = OUT) */ 333 unsigned int toggle[2]; /* one bit for each endpoint
334 * ([0] = IN, [1] = OUT) */
330 335
331 struct usb_device *parent; /* our hub, unless we're the root */ 336 struct usb_device *parent; /* our hub, unless we're the root */
332 struct usb_bus *bus; /* Bus we're part of */ 337 struct usb_bus *bus; /* Bus we're part of */
@@ -343,12 +348,14 @@ struct usb_device {
343 348
344 char **rawdescriptors; /* Raw descriptors for each config */ 349 char **rawdescriptors; /* Raw descriptors for each config */
345 350
346 int have_langid; /* whether string_langid is valid yet */ 351 int have_langid; /* whether string_langid is valid */
347 int string_langid; /* language ID for strings */ 352 int string_langid; /* language ID for strings */
348 353
349 char *product; 354 /* static strings from the device */
350 char *manufacturer; 355 char *product; /* iProduct string, if present */
351 char *serial; /* static strings from the device */ 356 char *manufacturer; /* iManufacturer string, if present */
357 char *serial; /* iSerialNumber string, if present */
358
352 struct list_head filelist; 359 struct list_head filelist;
353 struct class_device *class_dev; 360 struct class_device *class_dev;
354 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ 361 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */
@@ -440,22 +447,31 @@ extern struct usb_host_interface *usb_altnum_to_altsetting(
440 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are 447 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are
441 * high speed, and a different one if they are full or low speed. 448 * high speed, and a different one if they are full or low speed.
442 */ 449 */
443static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size) 450static inline int usb_make_path (struct usb_device *dev, char *buf,
451 size_t size)
444{ 452{
445 int actual; 453 int actual;
446 actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, dev->devpath); 454 actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name,
455 dev->devpath);
447 return (actual >= (int)size) ? -1 : actual; 456 return (actual >= (int)size) ? -1 : actual;
448} 457}
449 458
450/*-------------------------------------------------------------------------*/ 459/*-------------------------------------------------------------------------*/
451 460
452#define USB_DEVICE_ID_MATCH_DEVICE (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) 461#define USB_DEVICE_ID_MATCH_DEVICE \
453#define USB_DEVICE_ID_MATCH_DEV_RANGE (USB_DEVICE_ID_MATCH_DEV_LO | USB_DEVICE_ID_MATCH_DEV_HI) 462 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
454#define USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION (USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_RANGE) 463#define USB_DEVICE_ID_MATCH_DEV_RANGE \
464 (USB_DEVICE_ID_MATCH_DEV_LO | USB_DEVICE_ID_MATCH_DEV_HI)
465#define USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION \
466 (USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_RANGE)
455#define USB_DEVICE_ID_MATCH_DEV_INFO \ 467#define USB_DEVICE_ID_MATCH_DEV_INFO \
456 (USB_DEVICE_ID_MATCH_DEV_CLASS | USB_DEVICE_ID_MATCH_DEV_SUBCLASS | USB_DEVICE_ID_MATCH_DEV_PROTOCOL) 468 (USB_DEVICE_ID_MATCH_DEV_CLASS | \
469 USB_DEVICE_ID_MATCH_DEV_SUBCLASS | \
470 USB_DEVICE_ID_MATCH_DEV_PROTOCOL)
457#define USB_DEVICE_ID_MATCH_INT_INFO \ 471#define USB_DEVICE_ID_MATCH_INT_INFO \
458 (USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS | USB_DEVICE_ID_MATCH_INT_PROTOCOL) 472 (USB_DEVICE_ID_MATCH_INT_CLASS | \
473 USB_DEVICE_ID_MATCH_INT_SUBCLASS | \
474 USB_DEVICE_ID_MATCH_INT_PROTOCOL)
459 475
460/** 476/**
461 * USB_DEVICE - macro used to describe a specific usb device 477 * USB_DEVICE - macro used to describe a specific usb device
@@ -466,9 +482,11 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
466 * specific device. 482 * specific device.
467 */ 483 */
468#define USB_DEVICE(vend,prod) \ 484#define USB_DEVICE(vend,prod) \
469 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), .idProduct = (prod) 485 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \
486 .idProduct = (prod)
470/** 487/**
471 * USB_DEVICE_VER - macro used to describe a specific usb device with a version range 488 * USB_DEVICE_VER - macro used to describe a specific usb device with a
489 * version range
472 * @vend: the 16 bit USB Vendor ID 490 * @vend: the 16 bit USB Vendor ID
473 * @prod: the 16 bit USB Product ID 491 * @prod: the 16 bit USB Product ID
474 * @lo: the bcdDevice_lo value 492 * @lo: the bcdDevice_lo value
@@ -478,7 +496,9 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
478 * specific device, with a version range. 496 * specific device, with a version range.
479 */ 497 */
480#define USB_DEVICE_VER(vend,prod,lo,hi) \ 498#define USB_DEVICE_VER(vend,prod,lo,hi) \
481 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, .idVendor = (vend), .idProduct = (prod), .bcdDevice_lo = (lo), .bcdDevice_hi = (hi) 499 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \
500 .idVendor = (vend), .idProduct = (prod), \
501 .bcdDevice_lo = (lo), .bcdDevice_hi = (hi)
482 502
483/** 503/**
484 * USB_DEVICE_INFO - macro used to describe a class of usb devices 504 * USB_DEVICE_INFO - macro used to describe a class of usb devices
@@ -490,7 +510,8 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
490 * specific class of devices. 510 * specific class of devices.
491 */ 511 */
492#define USB_DEVICE_INFO(cl,sc,pr) \ 512#define USB_DEVICE_INFO(cl,sc,pr) \
493 .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), .bDeviceSubClass = (sc), .bDeviceProtocol = (pr) 513 .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), \
514 .bDeviceSubClass = (sc), .bDeviceProtocol = (pr)
494 515
495/** 516/**
496 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces 517 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces
@@ -502,9 +523,10 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
502 * specific class of interfaces. 523 * specific class of interfaces.
503 */ 524 */
504#define USB_INTERFACE_INFO(cl,sc,pr) \ 525#define USB_INTERFACE_INFO(cl,sc,pr) \
505 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) 526 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \
527 .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr)
506 528
507/* -------------------------------------------------------------------------- */ 529/* ----------------------------------------------------------------------- */
508 530
509/** 531/**
510 * struct usb_driver - identifies USB driver to usbcore 532 * struct usb_driver - identifies USB driver to usbcore
@@ -557,7 +579,8 @@ struct usb_driver {
557 579
558 void (*disconnect) (struct usb_interface *intf); 580 void (*disconnect) (struct usb_interface *intf);
559 581
560 int (*ioctl) (struct usb_interface *intf, unsigned int code, void *buf); 582 int (*ioctl) (struct usb_interface *intf, unsigned int code,
583 void *buf);
561 584
562 int (*suspend) (struct usb_interface *intf, pm_message_t message); 585 int (*suspend) (struct usb_interface *intf, pm_message_t message);
563 int (*resume) (struct usb_interface *intf); 586 int (*resume) (struct usb_interface *intf);
@@ -572,10 +595,8 @@ extern struct bus_type usb_bus_type;
572 595
573/** 596/**
574 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number 597 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number
575 * @name: devfs name for this driver. Will also be used by the driver 598 * @name: the usb class device name for this driver. Will show up in sysfs.
576 * class code to create a usb class device.
577 * @fops: pointer to the struct file_operations of this driver. 599 * @fops: pointer to the struct file_operations of this driver.
578 * @mode: the mode for the devfs file to be created for this driver.
579 * @minor_base: the start of the minor range for this driver. 600 * @minor_base: the start of the minor range for this driver.
580 * 601 *
581 * This structure is used for the usb_register_dev() and 602 * This structure is used for the usb_register_dev() and
@@ -585,8 +606,7 @@ extern struct bus_type usb_bus_type;
585struct usb_class_driver { 606struct usb_class_driver {
586 char *name; 607 char *name;
587 struct file_operations *fops; 608 struct file_operations *fops;
588 mode_t mode; 609 int minor_base;
589 int minor_base;
590}; 610};
591 611
592/* 612/*
@@ -603,7 +623,7 @@ extern void usb_deregister_dev(struct usb_interface *intf,
603 623
604extern int usb_disabled(void); 624extern int usb_disabled(void);
605 625
606/* -------------------------------------------------------------------------- */ 626/* ----------------------------------------------------------------------- */
607 627
608/* 628/*
609 * URB support, for asynchronous request completions 629 * URB support, for asynchronous request completions
@@ -613,12 +633,14 @@ extern int usb_disabled(void);
613 * urb->transfer_flags: 633 * urb->transfer_flags:
614 */ 634 */
615#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ 635#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */
616#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */ 636#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame
637 * ignored */
617#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ 638#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
618#define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */ 639#define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */
619#define URB_NO_FSBR 0x0020 /* UHCI-specific */ 640#define URB_NO_FSBR 0x0020 /* UHCI-specific */
620#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */ 641#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */
621#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */ 642#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
643 * needed */
622 644
623struct usb_iso_packet_descriptor { 645struct usb_iso_packet_descriptor {
624 unsigned int offset; 646 unsigned int offset;
@@ -806,7 +828,8 @@ struct urb
806 u8 reject; /* submissions will fail */ 828 u8 reject; /* submissions will fail */
807 829
808 /* public, documented fields in the urb that can be used by drivers */ 830 /* public, documented fields in the urb that can be used by drivers */
809 struct list_head urb_list; /* list head for use by the urb owner */ 831 struct list_head urb_list; /* list head for use by the urb's
832 * current owner */
810 struct usb_device *dev; /* (in) pointer to associated device */ 833 struct usb_device *dev; /* (in) pointer to associated device */
811 unsigned int pipe; /* (in) pipe information */ 834 unsigned int pipe; /* (in) pipe information */
812 int status; /* (return) non-ISO status */ 835 int status; /* (return) non-ISO status */
@@ -819,14 +842,16 @@ struct urb
819 dma_addr_t setup_dma; /* (in) dma addr for setup_packet */ 842 dma_addr_t setup_dma; /* (in) dma addr for setup_packet */
820 int start_frame; /* (modify) start frame (ISO) */ 843 int start_frame; /* (modify) start frame (ISO) */
821 int number_of_packets; /* (in) number of ISO packets */ 844 int number_of_packets; /* (in) number of ISO packets */
822 int interval; /* (modify) transfer interval (INT/ISO) */ 845 int interval; /* (modify) transfer interval
846 * (INT/ISO) */
823 int error_count; /* (return) number of ISO errors */ 847 int error_count; /* (return) number of ISO errors */
824 void *context; /* (in) context for completion */ 848 void *context; /* (in) context for completion */
825 usb_complete_t complete; /* (in) completion routine */ 849 usb_complete_t complete; /* (in) completion routine */
826 struct usb_iso_packet_descriptor iso_frame_desc[0]; /* (in) ISO ONLY */ 850 struct usb_iso_packet_descriptor iso_frame_desc[0];
851 /* (in) ISO ONLY */
827}; 852};
828 853
829/* -------------------------------------------------------------------------- */ 854/* ----------------------------------------------------------------------- */
830 855
831/** 856/**
832 * usb_fill_control_urb - initializes a control urb 857 * usb_fill_control_urb - initializes a control urb
@@ -974,11 +999,6 @@ extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
974 void *data, int len, int *actual_length, 999 void *data, int len, int *actual_length,
975 int timeout); 1000 int timeout);
976 1001
977/* selective suspend/resume */
978extern int usb_suspend_device(struct usb_device *dev, pm_message_t message);
979extern int usb_resume_device(struct usb_device *dev);
980
981
982/* wrappers around usb_control_msg() for the most common standard requests */ 1002/* wrappers around usb_control_msg() for the most common standard requests */
983extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype, 1003extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype,
984 unsigned char descindex, void *buf, int size); 1004 unsigned char descindex, void *buf, int size);
@@ -1056,7 +1076,7 @@ void usb_sg_cancel (struct usb_sg_request *io);
1056void usb_sg_wait (struct usb_sg_request *io); 1076void usb_sg_wait (struct usb_sg_request *io);
1057 1077
1058 1078
1059/* -------------------------------------------------------------------------- */ 1079/* ----------------------------------------------------------------------- */
1060 1080
1061/* 1081/*
1062 * For various legacy reasons, Linux has a small cookie that's paired with 1082 * For various legacy reasons, Linux has a small cookie that's paired with
@@ -1097,23 +1117,34 @@ void usb_sg_wait (struct usb_sg_request *io);
1097/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */ 1117/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
1098#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1) 1118#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
1099#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep))) 1119#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
1100#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | ((bit) << (ep))) 1120#define usb_settoggle(dev, ep, out, bit) \
1121 ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | \
1122 ((bit) << (ep)))
1101 1123
1102 1124
1103static inline unsigned int __create_pipe(struct usb_device *dev, unsigned int endpoint) 1125static inline unsigned int __create_pipe(struct usb_device *dev,
1126 unsigned int endpoint)
1104{ 1127{
1105 return (dev->devnum << 8) | (endpoint << 15); 1128 return (dev->devnum << 8) | (endpoint << 15);
1106} 1129}
1107 1130
1108/* Create various pipes... */ 1131/* Create various pipes... */
1109#define usb_sndctrlpipe(dev,endpoint) ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint)) 1132#define usb_sndctrlpipe(dev,endpoint) \
1110#define usb_rcvctrlpipe(dev,endpoint) ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1133 ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint))
1111#define usb_sndisocpipe(dev,endpoint) ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint)) 1134#define usb_rcvctrlpipe(dev,endpoint) \
1112#define usb_rcvisocpipe(dev,endpoint) ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1135 ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
1113#define usb_sndbulkpipe(dev,endpoint) ((PIPE_BULK << 30) | __create_pipe(dev,endpoint)) 1136#define usb_sndisocpipe(dev,endpoint) \
1114#define usb_rcvbulkpipe(dev,endpoint) ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1137 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint))
1115#define usb_sndintpipe(dev,endpoint) ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint)) 1138#define usb_rcvisocpipe(dev,endpoint) \
1116#define usb_rcvintpipe(dev,endpoint) ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1139 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
1140#define usb_sndbulkpipe(dev,endpoint) \
1141 ((PIPE_BULK << 30) | __create_pipe(dev,endpoint))
1142#define usb_rcvbulkpipe(dev,endpoint) \
1143 ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
1144#define usb_sndintpipe(dev,endpoint) \
1145 ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint))
1146#define usb_rcvintpipe(dev,endpoint) \
1147 ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
1117 1148
1118/*-------------------------------------------------------------------------*/ 1149/*-------------------------------------------------------------------------*/
1119 1150
@@ -1137,17 +1168,29 @@ usb_maxpacket(struct usb_device *udev, int pipe, int is_out)
1137 return le16_to_cpu(ep->desc.wMaxPacketSize); 1168 return le16_to_cpu(ep->desc.wMaxPacketSize);
1138} 1169}
1139 1170
1140/* -------------------------------------------------------------------------- */ 1171/* ----------------------------------------------------------------------- */
1172
1173/* Events from the usb core */
1174#define USB_DEVICE_ADD 0x0001
1175#define USB_DEVICE_REMOVE 0x0002
1176#define USB_BUS_ADD 0x0003
1177#define USB_BUS_REMOVE 0x0004
1178extern void usb_register_notify(struct notifier_block *nb);
1179extern void usb_unregister_notify(struct notifier_block *nb);
1141 1180
1142#ifdef DEBUG 1181#ifdef DEBUG
1143#define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg) 1182#define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , \
1183 __FILE__ , ## arg)
1144#else 1184#else
1145#define dbg(format, arg...) do {} while (0) 1185#define dbg(format, arg...) do {} while (0)
1146#endif 1186#endif
1147 1187
1148#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , __FILE__ , ## arg) 1188#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
1149#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , __FILE__ , ## arg) 1189 __FILE__ , ## arg)
1150#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , __FILE__ , ## arg) 1190#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , \
1191 __FILE__ , ## arg)
1192#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , \
1193 __FILE__ , ## arg)
1151 1194
1152 1195
1153#endif /* __KERNEL__ */ 1196#endif /* __KERNEL__ */
diff --git a/include/linux/usb_otg.h b/include/linux/usb_otg.h
index c6683146e9b0..f827f6e203c2 100644
--- a/include/linux/usb_otg.h
+++ b/include/linux/usb_otg.h
@@ -63,6 +63,10 @@ struct otg_transceiver {
63 int (*set_power)(struct otg_transceiver *otg, 63 int (*set_power)(struct otg_transceiver *otg,
64 unsigned mA); 64 unsigned mA);
65 65
66 /* for non-OTG B devices: set transceiver into suspend mode */
67 int (*set_suspend)(struct otg_transceiver *otg,
68 int suspend);
69
66 /* for B devices only: start session with A-Host */ 70 /* for B devices only: start session with A-Host */
67 int (*start_srp)(struct otg_transceiver *otg); 71 int (*start_srp)(struct otg_transceiver *otg);
68 72
@@ -108,6 +112,15 @@ otg_set_power(struct otg_transceiver *otg, unsigned mA)
108} 112}
109 113
110static inline int 114static inline int
115otg_set_suspend(struct otg_transceiver *otg, int suspend)
116{
117 if (otg->set_suspend != NULL)
118 return otg->set_suspend(otg, suspend);
119 else
120 return 0;
121}
122
123static inline int
111otg_start_srp(struct otg_transceiver *otg) 124otg_start_srp(struct otg_transceiver *otg)
112{ 125{
113 return otg->start_srp(otg); 126 return otg->start_srp(otg);
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 9facf733800c..8859f0b41543 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -140,6 +140,12 @@ struct usbdevfs_urb32 {
140 compat_caddr_t usercontext; /* unused */ 140 compat_caddr_t usercontext; /* unused */
141 struct usbdevfs_iso_packet_desc iso_frame_desc[0]; 141 struct usbdevfs_iso_packet_desc iso_frame_desc[0];
142}; 142};
143
144struct usbdevfs_ioctl32 {
145 s32 ifno;
146 s32 ioctl_code;
147 compat_caddr_t data;
148};
143#endif 149#endif
144 150
145#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) 151#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
@@ -160,6 +166,7 @@ struct usbdevfs_urb32 {
160#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) 166#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
161#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) 167#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo)
162#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl) 168#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl)
169#define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32)
163#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo) 170#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo)
164#define USBDEVFS_RESET _IO('U', 20) 171#define USBDEVFS_RESET _IO('U', 20)
165#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int) 172#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)