diff options
65 files changed, 2273 insertions, 821 deletions
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig index 2c3fd2007676..a45627547d03 100644 --- a/arch/powerpc/configs/g5_defconfig +++ b/arch/powerpc/configs/g5_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.16-rc2 | 3 | # Linux kernel version: 2.6.17-rc1 |
4 | # Fri Feb 10 17:33:08 2006 | 4 | # Wed Apr 19 13:24:37 2006 |
5 | # | 5 | # |
6 | CONFIG_PPC64=y | 6 | CONFIG_PPC64=y |
7 | CONFIG_64BIT=y | 7 | CONFIG_64BIT=y |
@@ -9,6 +9,7 @@ CONFIG_PPC_MERGE=y | |||
9 | CONFIG_MMU=y | 9 | CONFIG_MMU=y |
10 | CONFIG_GENERIC_HARDIRQS=y | 10 | CONFIG_GENERIC_HARDIRQS=y |
11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | 11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y |
12 | CONFIG_GENERIC_HWEIGHT=y | ||
12 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 13 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
13 | CONFIG_PPC=y | 14 | CONFIG_PPC=y |
14 | CONFIG_EARLY_PRINTK=y | 15 | CONFIG_EARLY_PRINTK=y |
@@ -29,6 +30,7 @@ CONFIG_POWER4=y | |||
29 | CONFIG_PPC_FPU=y | 30 | CONFIG_PPC_FPU=y |
30 | CONFIG_ALTIVEC=y | 31 | CONFIG_ALTIVEC=y |
31 | CONFIG_PPC_STD_MMU=y | 32 | CONFIG_PPC_STD_MMU=y |
33 | CONFIG_VIRT_CPU_ACCOUNTING=y | ||
32 | CONFIG_SMP=y | 34 | CONFIG_SMP=y |
33 | CONFIG_NR_CPUS=4 | 35 | CONFIG_NR_CPUS=4 |
34 | 36 | ||
@@ -53,6 +55,7 @@ CONFIG_SYSCTL=y | |||
53 | CONFIG_IKCONFIG=y | 55 | CONFIG_IKCONFIG=y |
54 | CONFIG_IKCONFIG_PROC=y | 56 | CONFIG_IKCONFIG_PROC=y |
55 | # CONFIG_CPUSETS is not set | 57 | # CONFIG_CPUSETS is not set |
58 | # CONFIG_RELAY is not set | ||
56 | CONFIG_INITRAMFS_SOURCE="" | 59 | CONFIG_INITRAMFS_SOURCE="" |
57 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | 60 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y |
58 | # CONFIG_EMBEDDED is not set | 61 | # CONFIG_EMBEDDED is not set |
@@ -67,10 +70,6 @@ CONFIG_BASE_FULL=y | |||
67 | CONFIG_FUTEX=y | 70 | CONFIG_FUTEX=y |
68 | CONFIG_EPOLL=y | 71 | CONFIG_EPOLL=y |
69 | CONFIG_SHMEM=y | 72 | CONFIG_SHMEM=y |
70 | CONFIG_CC_ALIGN_FUNCTIONS=0 | ||
71 | CONFIG_CC_ALIGN_LABELS=0 | ||
72 | CONFIG_CC_ALIGN_LOOPS=0 | ||
73 | CONFIG_CC_ALIGN_JUMPS=0 | ||
74 | CONFIG_SLAB=y | 73 | CONFIG_SLAB=y |
75 | # CONFIG_TINY_SHMEM is not set | 74 | # CONFIG_TINY_SHMEM is not set |
76 | CONFIG_BASE_SMALL=0 | 75 | CONFIG_BASE_SMALL=0 |
@@ -82,7 +81,6 @@ CONFIG_BASE_SMALL=0 | |||
82 | CONFIG_MODULES=y | 81 | CONFIG_MODULES=y |
83 | CONFIG_MODULE_UNLOAD=y | 82 | CONFIG_MODULE_UNLOAD=y |
84 | # CONFIG_MODULE_FORCE_UNLOAD is not set | 83 | # CONFIG_MODULE_FORCE_UNLOAD is not set |
85 | CONFIG_OBSOLETE_MODPARM=y | ||
86 | CONFIG_MODVERSIONS=y | 84 | CONFIG_MODVERSIONS=y |
87 | CONFIG_MODULE_SRCVERSION_ALL=y | 85 | CONFIG_MODULE_SRCVERSION_ALL=y |
88 | CONFIG_KMOD=y | 86 | CONFIG_KMOD=y |
@@ -91,6 +89,7 @@ CONFIG_STOP_MACHINE=y | |||
91 | # | 89 | # |
92 | # Block layer | 90 | # Block layer |
93 | # | 91 | # |
92 | # CONFIG_BLK_DEV_IO_TRACE is not set | ||
94 | 93 | ||
95 | # | 94 | # |
96 | # IO Schedulers | 95 | # IO Schedulers |
@@ -185,7 +184,6 @@ CONFIG_GENERIC_ISA_DMA=y | |||
185 | # CONFIG_PPC_INDIRECT_PCI is not set | 184 | # CONFIG_PPC_INDIRECT_PCI is not set |
186 | CONFIG_PCI=y | 185 | CONFIG_PCI=y |
187 | CONFIG_PCI_DOMAINS=y | 186 | CONFIG_PCI_DOMAINS=y |
188 | CONFIG_PCI_LEGACY_PROC=y | ||
189 | # CONFIG_PCI_DEBUG is not set | 187 | # CONFIG_PCI_DEBUG is not set |
190 | 188 | ||
191 | # | 189 | # |
@@ -227,6 +225,7 @@ CONFIG_SYN_COOKIES=y | |||
227 | CONFIG_INET_AH=m | 225 | CONFIG_INET_AH=m |
228 | CONFIG_INET_ESP=m | 226 | CONFIG_INET_ESP=m |
229 | CONFIG_INET_IPCOMP=m | 227 | CONFIG_INET_IPCOMP=m |
228 | CONFIG_INET_XFRM_TUNNEL=m | ||
230 | CONFIG_INET_TUNNEL=y | 229 | CONFIG_INET_TUNNEL=y |
231 | CONFIG_INET_DIAG=y | 230 | CONFIG_INET_DIAG=y |
232 | CONFIG_INET_TCP_DIAG=y | 231 | CONFIG_INET_TCP_DIAG=y |
@@ -238,6 +237,8 @@ CONFIG_TCP_CONG_BIC=y | |||
238 | # | 237 | # |
239 | # CONFIG_IP_VS is not set | 238 | # CONFIG_IP_VS is not set |
240 | # CONFIG_IPV6 is not set | 239 | # CONFIG_IPV6 is not set |
240 | # CONFIG_INET6_XFRM_TUNNEL is not set | ||
241 | # CONFIG_INET6_TUNNEL is not set | ||
241 | CONFIG_NETFILTER=y | 242 | CONFIG_NETFILTER=y |
242 | # CONFIG_NETFILTER_DEBUG is not set | 243 | # CONFIG_NETFILTER_DEBUG is not set |
243 | 244 | ||
@@ -261,6 +262,7 @@ CONFIG_IP_NF_IRC=m | |||
261 | CONFIG_IP_NF_TFTP=m | 262 | CONFIG_IP_NF_TFTP=m |
262 | CONFIG_IP_NF_AMANDA=m | 263 | CONFIG_IP_NF_AMANDA=m |
263 | # CONFIG_IP_NF_PPTP is not set | 264 | # CONFIG_IP_NF_PPTP is not set |
265 | # CONFIG_IP_NF_H323 is not set | ||
264 | CONFIG_IP_NF_QUEUE=m | 266 | CONFIG_IP_NF_QUEUE=m |
265 | 267 | ||
266 | # | 268 | # |
@@ -513,6 +515,7 @@ CONFIG_MD_RAID0=y | |||
513 | CONFIG_MD_RAID1=y | 515 | CONFIG_MD_RAID1=y |
514 | CONFIG_MD_RAID10=m | 516 | CONFIG_MD_RAID10=m |
515 | CONFIG_MD_RAID5=y | 517 | CONFIG_MD_RAID5=y |
518 | # CONFIG_MD_RAID5_RESHAPE is not set | ||
516 | CONFIG_MD_RAID6=m | 519 | CONFIG_MD_RAID6=m |
517 | CONFIG_MD_MULTIPATH=m | 520 | CONFIG_MD_MULTIPATH=m |
518 | CONFIG_MD_FAULTY=m | 521 | CONFIG_MD_FAULTY=m |
@@ -761,7 +764,6 @@ CONFIG_LEGACY_PTY_COUNT=256 | |||
761 | # Watchdog Cards | 764 | # Watchdog Cards |
762 | # | 765 | # |
763 | # CONFIG_WATCHDOG is not set | 766 | # CONFIG_WATCHDOG is not set |
764 | # CONFIG_RTC is not set | ||
765 | CONFIG_GEN_RTC=y | 767 | CONFIG_GEN_RTC=y |
766 | # CONFIG_GEN_RTC_X is not set | 768 | # CONFIG_GEN_RTC_X is not set |
767 | # CONFIG_DTLK is not set | 769 | # CONFIG_DTLK is not set |
@@ -772,6 +774,7 @@ CONFIG_GEN_RTC=y | |||
772 | # Ftape, the floppy tape device driver | 774 | # Ftape, the floppy tape device driver |
773 | # | 775 | # |
774 | CONFIG_AGP=m | 776 | CONFIG_AGP=m |
777 | # CONFIG_AGP_VIA is not set | ||
775 | CONFIG_AGP_UNINORTH=m | 778 | CONFIG_AGP_UNINORTH=m |
776 | # CONFIG_DRM is not set | 779 | # CONFIG_DRM is not set |
777 | CONFIG_RAW_DRIVER=y | 780 | CONFIG_RAW_DRIVER=y |
@@ -813,7 +816,6 @@ CONFIG_I2C_POWERMAC=y | |||
813 | # CONFIG_I2C_PARPORT_LIGHT is not set | 816 | # CONFIG_I2C_PARPORT_LIGHT is not set |
814 | # CONFIG_I2C_PROSAVAGE is not set | 817 | # CONFIG_I2C_PROSAVAGE is not set |
815 | # CONFIG_I2C_SAVAGE4 is not set | 818 | # CONFIG_I2C_SAVAGE4 is not set |
816 | # CONFIG_SCx200_ACB is not set | ||
817 | # CONFIG_I2C_SIS5595 is not set | 819 | # CONFIG_I2C_SIS5595 is not set |
818 | # CONFIG_I2C_SIS630 is not set | 820 | # CONFIG_I2C_SIS630 is not set |
819 | # CONFIG_I2C_SIS96X is not set | 821 | # CONFIG_I2C_SIS96X is not set |
@@ -832,9 +834,7 @@ CONFIG_I2C_POWERMAC=y | |||
832 | # CONFIG_SENSORS_PCF8574 is not set | 834 | # CONFIG_SENSORS_PCF8574 is not set |
833 | # CONFIG_SENSORS_PCA9539 is not set | 835 | # CONFIG_SENSORS_PCA9539 is not set |
834 | # CONFIG_SENSORS_PCF8591 is not set | 836 | # CONFIG_SENSORS_PCF8591 is not set |
835 | # CONFIG_SENSORS_RTC8564 is not set | ||
836 | # CONFIG_SENSORS_MAX6875 is not set | 837 | # CONFIG_SENSORS_MAX6875 is not set |
837 | # CONFIG_RTC_X1205_I2C is not set | ||
838 | # CONFIG_I2C_DEBUG_CORE is not set | 838 | # CONFIG_I2C_DEBUG_CORE is not set |
839 | # CONFIG_I2C_DEBUG_ALGO is not set | 839 | # CONFIG_I2C_DEBUG_ALGO is not set |
840 | # CONFIG_I2C_DEBUG_BUS is not set | 840 | # CONFIG_I2C_DEBUG_BUS is not set |
@@ -862,10 +862,6 @@ CONFIG_I2C_POWERMAC=y | |||
862 | # | 862 | # |
863 | 863 | ||
864 | # | 864 | # |
865 | # Multimedia Capabilities Port drivers | ||
866 | # | ||
867 | |||
868 | # | ||
869 | # Multimedia devices | 865 | # Multimedia devices |
870 | # | 866 | # |
871 | # CONFIG_VIDEO_DEV is not set | 867 | # CONFIG_VIDEO_DEV is not set |
@@ -874,6 +870,7 @@ CONFIG_I2C_POWERMAC=y | |||
874 | # Digital Video Broadcasting Devices | 870 | # Digital Video Broadcasting Devices |
875 | # | 871 | # |
876 | # CONFIG_DVB is not set | 872 | # CONFIG_DVB is not set |
873 | # CONFIG_USB_DABUSB is not set | ||
877 | 874 | ||
878 | # | 875 | # |
879 | # Graphics support | 876 | # Graphics support |
@@ -883,6 +880,7 @@ CONFIG_FB_CFB_FILLRECT=y | |||
883 | CONFIG_FB_CFB_COPYAREA=y | 880 | CONFIG_FB_CFB_COPYAREA=y |
884 | CONFIG_FB_CFB_IMAGEBLIT=y | 881 | CONFIG_FB_CFB_IMAGEBLIT=y |
885 | CONFIG_FB_MACMODES=y | 882 | CONFIG_FB_MACMODES=y |
883 | CONFIG_FB_FIRMWARE_EDID=y | ||
886 | CONFIG_FB_MODE_HELPERS=y | 884 | CONFIG_FB_MODE_HELPERS=y |
887 | CONFIG_FB_TILEBLITTING=y | 885 | CONFIG_FB_TILEBLITTING=y |
888 | # CONFIG_FB_CIRRUS is not set | 886 | # CONFIG_FB_CIRRUS is not set |
@@ -901,7 +899,6 @@ CONFIG_FB_NVIDIA=y | |||
901 | CONFIG_FB_NVIDIA_I2C=y | 899 | CONFIG_FB_NVIDIA_I2C=y |
902 | # CONFIG_FB_RIVA is not set | 900 | # CONFIG_FB_RIVA is not set |
903 | # CONFIG_FB_MATROX is not set | 901 | # CONFIG_FB_MATROX is not set |
904 | # CONFIG_FB_RADEON_OLD is not set | ||
905 | CONFIG_FB_RADEON=y | 902 | CONFIG_FB_RADEON=y |
906 | CONFIG_FB_RADEON_I2C=y | 903 | CONFIG_FB_RADEON_I2C=y |
907 | # CONFIG_FB_RADEON_DEBUG is not set | 904 | # CONFIG_FB_RADEON_DEBUG is not set |
@@ -958,9 +955,11 @@ CONFIG_SND_SEQUENCER=m | |||
958 | CONFIG_SND_OSSEMUL=y | 955 | CONFIG_SND_OSSEMUL=y |
959 | CONFIG_SND_MIXER_OSS=m | 956 | CONFIG_SND_MIXER_OSS=m |
960 | CONFIG_SND_PCM_OSS=m | 957 | CONFIG_SND_PCM_OSS=m |
958 | CONFIG_SND_PCM_OSS_PLUGINS=y | ||
961 | CONFIG_SND_SEQUENCER_OSS=y | 959 | CONFIG_SND_SEQUENCER_OSS=y |
962 | # CONFIG_SND_DYNAMIC_MINORS is not set | 960 | # CONFIG_SND_DYNAMIC_MINORS is not set |
963 | CONFIG_SND_SUPPORT_OLD_API=y | 961 | CONFIG_SND_SUPPORT_OLD_API=y |
962 | CONFIG_SND_VERBOSE_PROCFS=y | ||
964 | # CONFIG_SND_VERBOSE_PRINTK is not set | 963 | # CONFIG_SND_VERBOSE_PRINTK is not set |
965 | # CONFIG_SND_DEBUG is not set | 964 | # CONFIG_SND_DEBUG is not set |
966 | 965 | ||
@@ -977,6 +976,7 @@ CONFIG_SND_SUPPORT_OLD_API=y | |||
977 | # PCI devices | 976 | # PCI devices |
978 | # | 977 | # |
979 | # CONFIG_SND_AD1889 is not set | 978 | # CONFIG_SND_AD1889 is not set |
979 | # CONFIG_SND_ALS300 is not set | ||
980 | # CONFIG_SND_ALS4000 is not set | 980 | # CONFIG_SND_ALS4000 is not set |
981 | # CONFIG_SND_ALI5451 is not set | 981 | # CONFIG_SND_ALI5451 is not set |
982 | # CONFIG_SND_ATIIXP is not set | 982 | # CONFIG_SND_ATIIXP is not set |
@@ -1009,6 +1009,7 @@ CONFIG_SND_SUPPORT_OLD_API=y | |||
1009 | # CONFIG_SND_MIXART is not set | 1009 | # CONFIG_SND_MIXART is not set |
1010 | # CONFIG_SND_NM256 is not set | 1010 | # CONFIG_SND_NM256 is not set |
1011 | # CONFIG_SND_PCXHR is not set | 1011 | # CONFIG_SND_PCXHR is not set |
1012 | # CONFIG_SND_RIPTIDE is not set | ||
1012 | # CONFIG_SND_RME32 is not set | 1013 | # CONFIG_SND_RME32 is not set |
1013 | # CONFIG_SND_RME96 is not set | 1014 | # CONFIG_SND_RME96 is not set |
1014 | # CONFIG_SND_RME9652 is not set | 1015 | # CONFIG_SND_RME9652 is not set |
@@ -1041,6 +1042,7 @@ CONFIG_SND_USB_AUDIO=m | |||
1041 | # | 1042 | # |
1042 | CONFIG_USB_ARCH_HAS_HCD=y | 1043 | CONFIG_USB_ARCH_HAS_HCD=y |
1043 | CONFIG_USB_ARCH_HAS_OHCI=y | 1044 | CONFIG_USB_ARCH_HAS_OHCI=y |
1045 | CONFIG_USB_ARCH_HAS_EHCI=y | ||
1044 | CONFIG_USB=y | 1046 | CONFIG_USB=y |
1045 | # CONFIG_USB_DEBUG is not set | 1047 | # CONFIG_USB_DEBUG is not set |
1046 | 1048 | ||
@@ -1068,7 +1070,6 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y | |||
1068 | # | 1070 | # |
1069 | # USB Device Class drivers | 1071 | # USB Device Class drivers |
1070 | # | 1072 | # |
1071 | # CONFIG_OBSOLETE_OSS_USB_DRIVER is not set | ||
1072 | CONFIG_USB_ACM=m | 1073 | CONFIG_USB_ACM=m |
1073 | CONFIG_USB_PRINTER=y | 1074 | CONFIG_USB_PRINTER=y |
1074 | 1075 | ||
@@ -1126,15 +1127,6 @@ CONFIG_USB_HIDDEV=y | |||
1126 | # CONFIG_USB_MICROTEK is not set | 1127 | # CONFIG_USB_MICROTEK is not set |
1127 | 1128 | ||
1128 | # | 1129 | # |
1129 | # USB Multimedia devices | ||
1130 | # | ||
1131 | # CONFIG_USB_DABUSB is not set | ||
1132 | |||
1133 | # | ||
1134 | # Video4Linux support is needed for USB Multimedia device support | ||
1135 | # | ||
1136 | |||
1137 | # | ||
1138 | # USB Network Adapters | 1130 | # USB Network Adapters |
1139 | # | 1131 | # |
1140 | CONFIG_USB_CATC=m | 1132 | CONFIG_USB_CATC=m |
@@ -1194,6 +1186,7 @@ CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y | |||
1194 | CONFIG_USB_SERIAL_KLSI=m | 1186 | CONFIG_USB_SERIAL_KLSI=m |
1195 | CONFIG_USB_SERIAL_KOBIL_SCT=m | 1187 | CONFIG_USB_SERIAL_KOBIL_SCT=m |
1196 | CONFIG_USB_SERIAL_MCT_U232=m | 1188 | CONFIG_USB_SERIAL_MCT_U232=m |
1189 | # CONFIG_USB_SERIAL_NAVMAN is not set | ||
1197 | CONFIG_USB_SERIAL_PL2303=m | 1190 | CONFIG_USB_SERIAL_PL2303=m |
1198 | # CONFIG_USB_SERIAL_HP4X is not set | 1191 | # CONFIG_USB_SERIAL_HP4X is not set |
1199 | CONFIG_USB_SERIAL_SAFE=m | 1192 | CONFIG_USB_SERIAL_SAFE=m |
@@ -1237,17 +1230,23 @@ CONFIG_USB_EZUSB=y | |||
1237 | # CONFIG_MMC is not set | 1230 | # CONFIG_MMC is not set |
1238 | 1231 | ||
1239 | # | 1232 | # |
1233 | # LED devices | ||
1234 | # | ||
1235 | # CONFIG_NEW_LEDS is not set | ||
1236 | |||
1237 | # | ||
1240 | # InfiniBand support | 1238 | # InfiniBand support |
1241 | # | 1239 | # |
1242 | # CONFIG_INFINIBAND is not set | 1240 | # CONFIG_INFINIBAND is not set |
1243 | 1241 | ||
1244 | # | 1242 | # |
1245 | # SN Devices | 1243 | # EDAC - error detection and reporting (RAS) (EXPERIMENTAL) |
1246 | # | 1244 | # |
1247 | 1245 | ||
1248 | # | 1246 | # |
1249 | # EDAC - error detection and reporting (RAS) | 1247 | # Real Time Clock |
1250 | # | 1248 | # |
1249 | # CONFIG_RTC_CLASS is not set | ||
1251 | 1250 | ||
1252 | # | 1251 | # |
1253 | # File systems | 1252 | # File systems |
@@ -1319,7 +1318,6 @@ CONFIG_TMPFS=y | |||
1319 | CONFIG_HUGETLBFS=y | 1318 | CONFIG_HUGETLBFS=y |
1320 | CONFIG_HUGETLB_PAGE=y | 1319 | CONFIG_HUGETLB_PAGE=y |
1321 | CONFIG_RAMFS=y | 1320 | CONFIG_RAMFS=y |
1322 | # CONFIG_RELAYFS_FS is not set | ||
1323 | # CONFIG_CONFIGFS_FS is not set | 1321 | # CONFIG_CONFIGFS_FS is not set |
1324 | 1322 | ||
1325 | # | 1323 | # |
diff --git a/arch/powerpc/configs/iseries_defconfig b/arch/powerpc/configs/iseries_defconfig index 1816a46742f6..a95e455a1944 100644 --- a/arch/powerpc/configs/iseries_defconfig +++ b/arch/powerpc/configs/iseries_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.16-rc6 | 3 | # Linux kernel version: 2.6.17-rc1 |
4 | # Wed Mar 15 16:19:52 2006 | 4 | # Wed Apr 19 11:46:44 2006 |
5 | # | 5 | # |
6 | CONFIG_PPC64=y | 6 | CONFIG_PPC64=y |
7 | CONFIG_64BIT=y | 7 | CONFIG_64BIT=y |
@@ -9,6 +9,7 @@ CONFIG_PPC_MERGE=y | |||
9 | CONFIG_MMU=y | 9 | CONFIG_MMU=y |
10 | CONFIG_GENERIC_HARDIRQS=y | 10 | CONFIG_GENERIC_HARDIRQS=y |
11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | 11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y |
12 | CONFIG_GENERIC_HWEIGHT=y | ||
12 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 13 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
13 | CONFIG_PPC=y | 14 | CONFIG_PPC=y |
14 | CONFIG_EARLY_PRINTK=y | 15 | CONFIG_EARLY_PRINTK=y |
@@ -30,6 +31,7 @@ CONFIG_POWER4=y | |||
30 | CONFIG_PPC_FPU=y | 31 | CONFIG_PPC_FPU=y |
31 | # CONFIG_ALTIVEC is not set | 32 | # CONFIG_ALTIVEC is not set |
32 | CONFIG_PPC_STD_MMU=y | 33 | CONFIG_PPC_STD_MMU=y |
34 | CONFIG_VIRT_CPU_ACCOUNTING=y | ||
33 | CONFIG_SMP=y | 35 | CONFIG_SMP=y |
34 | CONFIG_NR_CPUS=32 | 36 | CONFIG_NR_CPUS=32 |
35 | 37 | ||
@@ -55,6 +57,7 @@ CONFIG_AUDITSYSCALL=y | |||
55 | CONFIG_IKCONFIG=y | 57 | CONFIG_IKCONFIG=y |
56 | CONFIG_IKCONFIG_PROC=y | 58 | CONFIG_IKCONFIG_PROC=y |
57 | # CONFIG_CPUSETS is not set | 59 | # CONFIG_CPUSETS is not set |
60 | # CONFIG_RELAY is not set | ||
58 | CONFIG_INITRAMFS_SOURCE="" | 61 | CONFIG_INITRAMFS_SOURCE="" |
59 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | 62 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y |
60 | # CONFIG_EMBEDDED is not set | 63 | # CONFIG_EMBEDDED is not set |
@@ -69,10 +72,6 @@ CONFIG_BASE_FULL=y | |||
69 | CONFIG_FUTEX=y | 72 | CONFIG_FUTEX=y |
70 | CONFIG_EPOLL=y | 73 | CONFIG_EPOLL=y |
71 | CONFIG_SHMEM=y | 74 | CONFIG_SHMEM=y |
72 | CONFIG_CC_ALIGN_FUNCTIONS=0 | ||
73 | CONFIG_CC_ALIGN_LABELS=0 | ||
74 | CONFIG_CC_ALIGN_LOOPS=0 | ||
75 | CONFIG_CC_ALIGN_JUMPS=0 | ||
76 | CONFIG_SLAB=y | 75 | CONFIG_SLAB=y |
77 | # CONFIG_TINY_SHMEM is not set | 76 | # CONFIG_TINY_SHMEM is not set |
78 | CONFIG_BASE_SMALL=0 | 77 | CONFIG_BASE_SMALL=0 |
@@ -84,7 +83,6 @@ CONFIG_BASE_SMALL=0 | |||
84 | CONFIG_MODULES=y | 83 | CONFIG_MODULES=y |
85 | CONFIG_MODULE_UNLOAD=y | 84 | CONFIG_MODULE_UNLOAD=y |
86 | # CONFIG_MODULE_FORCE_UNLOAD is not set | 85 | # CONFIG_MODULE_FORCE_UNLOAD is not set |
87 | CONFIG_OBSOLETE_MODPARM=y | ||
88 | CONFIG_MODVERSIONS=y | 86 | CONFIG_MODVERSIONS=y |
89 | CONFIG_MODULE_SRCVERSION_ALL=y | 87 | CONFIG_MODULE_SRCVERSION_ALL=y |
90 | CONFIG_KMOD=y | 88 | CONFIG_KMOD=y |
@@ -93,6 +91,7 @@ CONFIG_STOP_MACHINE=y | |||
93 | # | 91 | # |
94 | # Block layer | 92 | # Block layer |
95 | # | 93 | # |
94 | # CONFIG_BLK_DEV_IO_TRACE is not set | ||
96 | 95 | ||
97 | # | 96 | # |
98 | # IO Schedulers | 97 | # IO Schedulers |
@@ -165,7 +164,6 @@ CONFIG_GENERIC_ISA_DMA=y | |||
165 | # CONFIG_PPC_INDIRECT_PCI is not set | 164 | # CONFIG_PPC_INDIRECT_PCI is not set |
166 | CONFIG_PCI=y | 165 | CONFIG_PCI=y |
167 | CONFIG_PCI_DOMAINS=y | 166 | CONFIG_PCI_DOMAINS=y |
168 | CONFIG_PCI_LEGACY_PROC=y | ||
169 | # CONFIG_PCI_DEBUG is not set | 167 | # CONFIG_PCI_DEBUG is not set |
170 | 168 | ||
171 | # | 169 | # |
@@ -207,6 +205,7 @@ CONFIG_SYN_COOKIES=y | |||
207 | CONFIG_INET_AH=m | 205 | CONFIG_INET_AH=m |
208 | CONFIG_INET_ESP=m | 206 | CONFIG_INET_ESP=m |
209 | CONFIG_INET_IPCOMP=m | 207 | CONFIG_INET_IPCOMP=m |
208 | CONFIG_INET_XFRM_TUNNEL=m | ||
210 | CONFIG_INET_TUNNEL=y | 209 | CONFIG_INET_TUNNEL=y |
211 | CONFIG_INET_DIAG=y | 210 | CONFIG_INET_DIAG=y |
212 | CONFIG_INET_TCP_DIAG=y | 211 | CONFIG_INET_TCP_DIAG=y |
@@ -218,6 +217,8 @@ CONFIG_TCP_CONG_BIC=y | |||
218 | # | 217 | # |
219 | # CONFIG_IP_VS is not set | 218 | # CONFIG_IP_VS is not set |
220 | # CONFIG_IPV6 is not set | 219 | # CONFIG_IPV6 is not set |
220 | # CONFIG_INET6_XFRM_TUNNEL is not set | ||
221 | # CONFIG_INET6_TUNNEL is not set | ||
221 | CONFIG_NETFILTER=y | 222 | CONFIG_NETFILTER=y |
222 | # CONFIG_NETFILTER_DEBUG is not set | 223 | # CONFIG_NETFILTER_DEBUG is not set |
223 | 224 | ||
@@ -236,11 +237,14 @@ CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m | |||
236 | CONFIG_NETFILTER_XT_MATCH_CONNMARK=m | 237 | CONFIG_NETFILTER_XT_MATCH_CONNMARK=m |
237 | CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m | 238 | CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m |
238 | # CONFIG_NETFILTER_XT_MATCH_DCCP is not set | 239 | # CONFIG_NETFILTER_XT_MATCH_DCCP is not set |
240 | # CONFIG_NETFILTER_XT_MATCH_ESP is not set | ||
239 | CONFIG_NETFILTER_XT_MATCH_HELPER=m | 241 | CONFIG_NETFILTER_XT_MATCH_HELPER=m |
240 | CONFIG_NETFILTER_XT_MATCH_LENGTH=m | 242 | CONFIG_NETFILTER_XT_MATCH_LENGTH=m |
241 | CONFIG_NETFILTER_XT_MATCH_LIMIT=m | 243 | CONFIG_NETFILTER_XT_MATCH_LIMIT=m |
242 | CONFIG_NETFILTER_XT_MATCH_MAC=m | 244 | CONFIG_NETFILTER_XT_MATCH_MAC=m |
243 | CONFIG_NETFILTER_XT_MATCH_MARK=m | 245 | CONFIG_NETFILTER_XT_MATCH_MARK=m |
246 | # CONFIG_NETFILTER_XT_MATCH_POLICY is not set | ||
247 | # CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set | ||
244 | CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m | 248 | CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m |
245 | CONFIG_NETFILTER_XT_MATCH_REALM=m | 249 | CONFIG_NETFILTER_XT_MATCH_REALM=m |
246 | CONFIG_NETFILTER_XT_MATCH_SCTP=m | 250 | CONFIG_NETFILTER_XT_MATCH_SCTP=m |
@@ -262,20 +266,19 @@ CONFIG_IP_NF_IRC=m | |||
262 | CONFIG_IP_NF_TFTP=m | 266 | CONFIG_IP_NF_TFTP=m |
263 | CONFIG_IP_NF_AMANDA=m | 267 | CONFIG_IP_NF_AMANDA=m |
264 | # CONFIG_IP_NF_PPTP is not set | 268 | # CONFIG_IP_NF_PPTP is not set |
269 | # CONFIG_IP_NF_H323 is not set | ||
265 | CONFIG_IP_NF_QUEUE=m | 270 | CONFIG_IP_NF_QUEUE=m |
266 | CONFIG_IP_NF_IPTABLES=m | 271 | CONFIG_IP_NF_IPTABLES=m |
267 | CONFIG_IP_NF_MATCH_IPRANGE=m | 272 | CONFIG_IP_NF_MATCH_IPRANGE=m |
268 | CONFIG_IP_NF_MATCH_MULTIPORT=m | ||
269 | CONFIG_IP_NF_MATCH_TOS=m | 273 | CONFIG_IP_NF_MATCH_TOS=m |
270 | CONFIG_IP_NF_MATCH_RECENT=m | 274 | CONFIG_IP_NF_MATCH_RECENT=m |
271 | CONFIG_IP_NF_MATCH_ECN=m | 275 | CONFIG_IP_NF_MATCH_ECN=m |
272 | CONFIG_IP_NF_MATCH_DSCP=m | 276 | CONFIG_IP_NF_MATCH_DSCP=m |
273 | CONFIG_IP_NF_MATCH_AH_ESP=m | 277 | # CONFIG_IP_NF_MATCH_AH is not set |
274 | CONFIG_IP_NF_MATCH_TTL=m | 278 | CONFIG_IP_NF_MATCH_TTL=m |
275 | CONFIG_IP_NF_MATCH_OWNER=m | 279 | CONFIG_IP_NF_MATCH_OWNER=m |
276 | CONFIG_IP_NF_MATCH_ADDRTYPE=m | 280 | CONFIG_IP_NF_MATCH_ADDRTYPE=m |
277 | CONFIG_IP_NF_MATCH_HASHLIMIT=m | 281 | CONFIG_IP_NF_MATCH_HASHLIMIT=m |
278 | CONFIG_IP_NF_MATCH_POLICY=m | ||
279 | CONFIG_IP_NF_FILTER=m | 282 | CONFIG_IP_NF_FILTER=m |
280 | CONFIG_IP_NF_TARGET_REJECT=m | 283 | CONFIG_IP_NF_TARGET_REJECT=m |
281 | CONFIG_IP_NF_TARGET_LOG=m | 284 | CONFIG_IP_NF_TARGET_LOG=m |
@@ -479,6 +482,7 @@ CONFIG_MD_RAID0=y | |||
479 | CONFIG_MD_RAID1=y | 482 | CONFIG_MD_RAID1=y |
480 | CONFIG_MD_RAID10=m | 483 | CONFIG_MD_RAID10=m |
481 | CONFIG_MD_RAID5=y | 484 | CONFIG_MD_RAID5=y |
485 | # CONFIG_MD_RAID5_RESHAPE is not set | ||
482 | CONFIG_MD_RAID6=m | 486 | CONFIG_MD_RAID6=m |
483 | CONFIG_MD_MULTIPATH=m | 487 | CONFIG_MD_MULTIPATH=m |
484 | CONFIG_MD_FAULTY=m | 488 | CONFIG_MD_FAULTY=m |
@@ -702,7 +706,6 @@ CONFIG_LEGACY_PTY_COUNT=256 | |||
702 | # Watchdog Cards | 706 | # Watchdog Cards |
703 | # | 707 | # |
704 | # CONFIG_WATCHDOG is not set | 708 | # CONFIG_WATCHDOG is not set |
705 | # CONFIG_RTC is not set | ||
706 | CONFIG_GEN_RTC=y | 709 | CONFIG_GEN_RTC=y |
707 | # CONFIG_GEN_RTC_X is not set | 710 | # CONFIG_GEN_RTC_X is not set |
708 | # CONFIG_DTLK is not set | 711 | # CONFIG_DTLK is not set |
@@ -751,10 +754,6 @@ CONFIG_MAX_RAW_DEVS=256 | |||
751 | # | 754 | # |
752 | 755 | ||
753 | # | 756 | # |
754 | # Multimedia Capabilities Port drivers | ||
755 | # | ||
756 | |||
757 | # | ||
758 | # Multimedia devices | 757 | # Multimedia devices |
759 | # | 758 | # |
760 | # CONFIG_VIDEO_DEV is not set | 759 | # CONFIG_VIDEO_DEV is not set |
@@ -779,6 +778,7 @@ CONFIG_MAX_RAW_DEVS=256 | |||
779 | # | 778 | # |
780 | CONFIG_USB_ARCH_HAS_HCD=y | 779 | CONFIG_USB_ARCH_HAS_HCD=y |
781 | CONFIG_USB_ARCH_HAS_OHCI=y | 780 | CONFIG_USB_ARCH_HAS_OHCI=y |
781 | CONFIG_USB_ARCH_HAS_EHCI=y | ||
782 | # CONFIG_USB is not set | 782 | # CONFIG_USB is not set |
783 | 783 | ||
784 | # | 784 | # |
@@ -796,6 +796,11 @@ CONFIG_USB_ARCH_HAS_OHCI=y | |||
796 | # CONFIG_MMC is not set | 796 | # CONFIG_MMC is not set |
797 | 797 | ||
798 | # | 798 | # |
799 | # LED devices | ||
800 | # | ||
801 | # CONFIG_NEW_LEDS is not set | ||
802 | |||
803 | # | ||
799 | # InfiniBand support | 804 | # InfiniBand support |
800 | # | 805 | # |
801 | # CONFIG_INFINIBAND is not set | 806 | # CONFIG_INFINIBAND is not set |
@@ -805,6 +810,11 @@ CONFIG_USB_ARCH_HAS_OHCI=y | |||
805 | # | 810 | # |
806 | 811 | ||
807 | # | 812 | # |
813 | # Real Time Clock | ||
814 | # | ||
815 | # CONFIG_RTC_CLASS is not set | ||
816 | |||
817 | # | ||
808 | # File systems | 818 | # File systems |
809 | # | 819 | # |
810 | CONFIG_EXT2_FS=y | 820 | CONFIG_EXT2_FS=y |
@@ -878,7 +888,6 @@ CONFIG_TMPFS=y | |||
878 | # CONFIG_HUGETLBFS is not set | 888 | # CONFIG_HUGETLBFS is not set |
879 | # CONFIG_HUGETLB_PAGE is not set | 889 | # CONFIG_HUGETLB_PAGE is not set |
880 | CONFIG_RAMFS=y | 890 | CONFIG_RAMFS=y |
881 | # CONFIG_RELAYFS_FS is not set | ||
882 | # CONFIG_CONFIGFS_FS is not set | 891 | # CONFIG_CONFIGFS_FS is not set |
883 | 892 | ||
884 | # | 893 | # |
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index daaf038a1faa..58e68ce09b0f 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_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.16-rc2 | 3 | # Linux kernel version: 2.6.17-rc1 |
4 | # Fri Feb 10 17:33:32 2006 | 4 | # Wed Apr 19 11:48:00 2006 |
5 | # | 5 | # |
6 | CONFIG_PPC64=y | 6 | CONFIG_PPC64=y |
7 | CONFIG_64BIT=y | 7 | CONFIG_64BIT=y |
@@ -9,6 +9,7 @@ CONFIG_PPC_MERGE=y | |||
9 | CONFIG_MMU=y | 9 | CONFIG_MMU=y |
10 | CONFIG_GENERIC_HARDIRQS=y | 10 | CONFIG_GENERIC_HARDIRQS=y |
11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | 11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y |
12 | CONFIG_GENERIC_HWEIGHT=y | ||
12 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 13 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
13 | CONFIG_PPC=y | 14 | CONFIG_PPC=y |
14 | CONFIG_EARLY_PRINTK=y | 15 | CONFIG_EARLY_PRINTK=y |
@@ -30,6 +31,7 @@ CONFIG_POWER4=y | |||
30 | CONFIG_PPC_FPU=y | 31 | CONFIG_PPC_FPU=y |
31 | CONFIG_ALTIVEC=y | 32 | CONFIG_ALTIVEC=y |
32 | CONFIG_PPC_STD_MMU=y | 33 | CONFIG_PPC_STD_MMU=y |
34 | CONFIG_VIRT_CPU_ACCOUNTING=y | ||
33 | CONFIG_SMP=y | 35 | CONFIG_SMP=y |
34 | CONFIG_NR_CPUS=128 | 36 | CONFIG_NR_CPUS=128 |
35 | 37 | ||
@@ -55,6 +57,7 @@ CONFIG_AUDITSYSCALL=y | |||
55 | CONFIG_IKCONFIG=y | 57 | CONFIG_IKCONFIG=y |
56 | CONFIG_IKCONFIG_PROC=y | 58 | CONFIG_IKCONFIG_PROC=y |
57 | CONFIG_CPUSETS=y | 59 | CONFIG_CPUSETS=y |
60 | # CONFIG_RELAY is not set | ||
58 | CONFIG_INITRAMFS_SOURCE="" | 61 | CONFIG_INITRAMFS_SOURCE="" |
59 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | 62 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y |
60 | # CONFIG_EMBEDDED is not set | 63 | # CONFIG_EMBEDDED is not set |
@@ -69,10 +72,6 @@ CONFIG_BASE_FULL=y | |||
69 | CONFIG_FUTEX=y | 72 | CONFIG_FUTEX=y |
70 | CONFIG_EPOLL=y | 73 | CONFIG_EPOLL=y |
71 | CONFIG_SHMEM=y | 74 | CONFIG_SHMEM=y |
72 | CONFIG_CC_ALIGN_FUNCTIONS=0 | ||
73 | CONFIG_CC_ALIGN_LABELS=0 | ||
74 | CONFIG_CC_ALIGN_LOOPS=0 | ||
75 | CONFIG_CC_ALIGN_JUMPS=0 | ||
76 | CONFIG_SLAB=y | 75 | CONFIG_SLAB=y |
77 | # CONFIG_TINY_SHMEM is not set | 76 | # CONFIG_TINY_SHMEM is not set |
78 | CONFIG_BASE_SMALL=0 | 77 | CONFIG_BASE_SMALL=0 |
@@ -84,7 +83,6 @@ CONFIG_BASE_SMALL=0 | |||
84 | CONFIG_MODULES=y | 83 | CONFIG_MODULES=y |
85 | CONFIG_MODULE_UNLOAD=y | 84 | CONFIG_MODULE_UNLOAD=y |
86 | # CONFIG_MODULE_FORCE_UNLOAD is not set | 85 | # CONFIG_MODULE_FORCE_UNLOAD is not set |
87 | CONFIG_OBSOLETE_MODPARM=y | ||
88 | CONFIG_MODVERSIONS=y | 86 | CONFIG_MODVERSIONS=y |
89 | CONFIG_MODULE_SRCVERSION_ALL=y | 87 | CONFIG_MODULE_SRCVERSION_ALL=y |
90 | CONFIG_KMOD=y | 88 | CONFIG_KMOD=y |
@@ -93,6 +91,7 @@ CONFIG_STOP_MACHINE=y | |||
93 | # | 91 | # |
94 | # Block layer | 92 | # Block layer |
95 | # | 93 | # |
94 | # CONFIG_BLK_DEV_IO_TRACE is not set | ||
96 | 95 | ||
97 | # | 96 | # |
98 | # IO Schedulers | 97 | # IO Schedulers |
@@ -188,7 +187,6 @@ CONFIG_PPC_I8259=y | |||
188 | # CONFIG_PPC_INDIRECT_PCI is not set | 187 | # CONFIG_PPC_INDIRECT_PCI is not set |
189 | CONFIG_PCI=y | 188 | CONFIG_PCI=y |
190 | CONFIG_PCI_DOMAINS=y | 189 | CONFIG_PCI_DOMAINS=y |
191 | CONFIG_PCI_LEGACY_PROC=y | ||
192 | # CONFIG_PCI_DEBUG is not set | 190 | # CONFIG_PCI_DEBUG is not set |
193 | 191 | ||
194 | # | 192 | # |
@@ -235,6 +233,7 @@ CONFIG_SYN_COOKIES=y | |||
235 | CONFIG_INET_AH=m | 233 | CONFIG_INET_AH=m |
236 | CONFIG_INET_ESP=m | 234 | CONFIG_INET_ESP=m |
237 | CONFIG_INET_IPCOMP=m | 235 | CONFIG_INET_IPCOMP=m |
236 | CONFIG_INET_XFRM_TUNNEL=m | ||
238 | CONFIG_INET_TUNNEL=y | 237 | CONFIG_INET_TUNNEL=y |
239 | CONFIG_INET_DIAG=y | 238 | CONFIG_INET_DIAG=y |
240 | CONFIG_INET_TCP_DIAG=y | 239 | CONFIG_INET_TCP_DIAG=y |
@@ -246,6 +245,8 @@ CONFIG_TCP_CONG_BIC=y | |||
246 | # | 245 | # |
247 | # CONFIG_IP_VS is not set | 246 | # CONFIG_IP_VS is not set |
248 | # CONFIG_IPV6 is not set | 247 | # CONFIG_IPV6 is not set |
248 | # CONFIG_INET6_XFRM_TUNNEL is not set | ||
249 | # CONFIG_INET6_TUNNEL is not set | ||
249 | CONFIG_NETFILTER=y | 250 | CONFIG_NETFILTER=y |
250 | # CONFIG_NETFILTER_DEBUG is not set | 251 | # CONFIG_NETFILTER_DEBUG is not set |
251 | 252 | ||
@@ -272,6 +273,7 @@ CONFIG_IP_NF_IRC=m | |||
272 | CONFIG_IP_NF_TFTP=m | 273 | CONFIG_IP_NF_TFTP=m |
273 | CONFIG_IP_NF_AMANDA=m | 274 | CONFIG_IP_NF_AMANDA=m |
274 | # CONFIG_IP_NF_PPTP is not set | 275 | # CONFIG_IP_NF_PPTP is not set |
276 | # CONFIG_IP_NF_H323 is not set | ||
275 | CONFIG_IP_NF_QUEUE=m | 277 | CONFIG_IP_NF_QUEUE=m |
276 | 278 | ||
277 | # | 279 | # |
@@ -519,6 +521,7 @@ CONFIG_MD_RAID0=y | |||
519 | CONFIG_MD_RAID1=y | 521 | CONFIG_MD_RAID1=y |
520 | CONFIG_MD_RAID10=m | 522 | CONFIG_MD_RAID10=m |
521 | CONFIG_MD_RAID5=y | 523 | CONFIG_MD_RAID5=y |
524 | # CONFIG_MD_RAID5_RESHAPE is not set | ||
522 | CONFIG_MD_RAID6=m | 525 | CONFIG_MD_RAID6=m |
523 | CONFIG_MD_MULTIPATH=m | 526 | CONFIG_MD_MULTIPATH=m |
524 | CONFIG_MD_FAULTY=m | 527 | CONFIG_MD_FAULTY=m |
@@ -750,6 +753,7 @@ CONFIG_HW_CONSOLE=y | |||
750 | # | 753 | # |
751 | CONFIG_SERIAL_8250=y | 754 | CONFIG_SERIAL_8250=y |
752 | CONFIG_SERIAL_8250_CONSOLE=y | 755 | CONFIG_SERIAL_8250_CONSOLE=y |
756 | CONFIG_SERIAL_8250_PCI=y | ||
753 | CONFIG_SERIAL_8250_NR_UARTS=4 | 757 | CONFIG_SERIAL_8250_NR_UARTS=4 |
754 | CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | 758 | CONFIG_SERIAL_8250_RUNTIME_UARTS=4 |
755 | # CONFIG_SERIAL_8250_EXTENDED is not set | 759 | # CONFIG_SERIAL_8250_EXTENDED is not set |
@@ -767,7 +771,9 @@ CONFIG_LEGACY_PTY_COUNT=256 | |||
767 | # CONFIG_PRINTER is not set | 771 | # CONFIG_PRINTER is not set |
768 | # CONFIG_PPDEV is not set | 772 | # CONFIG_PPDEV is not set |
769 | # CONFIG_TIPAR is not set | 773 | # CONFIG_TIPAR is not set |
774 | CONFIG_HVC_DRIVER=y | ||
770 | CONFIG_HVC_CONSOLE=y | 775 | CONFIG_HVC_CONSOLE=y |
776 | # CONFIG_HVC_RTAS is not set | ||
771 | CONFIG_HVCS=m | 777 | CONFIG_HVCS=m |
772 | 778 | ||
773 | # | 779 | # |
@@ -779,7 +785,6 @@ CONFIG_HVCS=m | |||
779 | # Watchdog Cards | 785 | # Watchdog Cards |
780 | # | 786 | # |
781 | # CONFIG_WATCHDOG is not set | 787 | # CONFIG_WATCHDOG is not set |
782 | # CONFIG_RTC is not set | ||
783 | CONFIG_GEN_RTC=y | 788 | CONFIG_GEN_RTC=y |
784 | # CONFIG_GEN_RTC_X is not set | 789 | # CONFIG_GEN_RTC_X is not set |
785 | # CONFIG_DTLK is not set | 790 | # CONFIG_DTLK is not set |
@@ -830,7 +835,6 @@ CONFIG_I2C_ALGOBIT=y | |||
830 | # CONFIG_I2C_PARPORT_LIGHT is not set | 835 | # CONFIG_I2C_PARPORT_LIGHT is not set |
831 | # CONFIG_I2C_PROSAVAGE is not set | 836 | # CONFIG_I2C_PROSAVAGE is not set |
832 | # CONFIG_I2C_SAVAGE4 is not set | 837 | # CONFIG_I2C_SAVAGE4 is not set |
833 | # CONFIG_SCx200_ACB is not set | ||
834 | # CONFIG_I2C_SIS5595 is not set | 838 | # CONFIG_I2C_SIS5595 is not set |
835 | # CONFIG_I2C_SIS630 is not set | 839 | # CONFIG_I2C_SIS630 is not set |
836 | # CONFIG_I2C_SIS96X is not set | 840 | # CONFIG_I2C_SIS96X is not set |
@@ -849,9 +853,7 @@ CONFIG_I2C_ALGOBIT=y | |||
849 | # CONFIG_SENSORS_PCF8574 is not set | 853 | # CONFIG_SENSORS_PCF8574 is not set |
850 | # CONFIG_SENSORS_PCA9539 is not set | 854 | # CONFIG_SENSORS_PCA9539 is not set |
851 | # CONFIG_SENSORS_PCF8591 is not set | 855 | # CONFIG_SENSORS_PCF8591 is not set |
852 | # CONFIG_SENSORS_RTC8564 is not set | ||
853 | # CONFIG_SENSORS_MAX6875 is not set | 856 | # CONFIG_SENSORS_MAX6875 is not set |
854 | # CONFIG_RTC_X1205_I2C is not set | ||
855 | # CONFIG_I2C_DEBUG_CORE is not set | 857 | # CONFIG_I2C_DEBUG_CORE is not set |
856 | # CONFIG_I2C_DEBUG_ALGO is not set | 858 | # CONFIG_I2C_DEBUG_ALGO is not set |
857 | # CONFIG_I2C_DEBUG_BUS is not set | 859 | # CONFIG_I2C_DEBUG_BUS is not set |
@@ -879,10 +881,6 @@ CONFIG_I2C_ALGOBIT=y | |||
879 | # | 881 | # |
880 | 882 | ||
881 | # | 883 | # |
882 | # Multimedia Capabilities Port drivers | ||
883 | # | ||
884 | |||
885 | # | ||
886 | # Multimedia devices | 884 | # Multimedia devices |
887 | # | 885 | # |
888 | # CONFIG_VIDEO_DEV is not set | 886 | # CONFIG_VIDEO_DEV is not set |
@@ -891,6 +889,7 @@ CONFIG_I2C_ALGOBIT=y | |||
891 | # Digital Video Broadcasting Devices | 889 | # Digital Video Broadcasting Devices |
892 | # | 890 | # |
893 | # CONFIG_DVB is not set | 891 | # CONFIG_DVB is not set |
892 | # CONFIG_USB_DABUSB is not set | ||
894 | 893 | ||
895 | # | 894 | # |
896 | # Graphics support | 895 | # Graphics support |
@@ -900,6 +899,7 @@ CONFIG_FB_CFB_FILLRECT=y | |||
900 | CONFIG_FB_CFB_COPYAREA=y | 899 | CONFIG_FB_CFB_COPYAREA=y |
901 | CONFIG_FB_CFB_IMAGEBLIT=y | 900 | CONFIG_FB_CFB_IMAGEBLIT=y |
902 | CONFIG_FB_MACMODES=y | 901 | CONFIG_FB_MACMODES=y |
902 | CONFIG_FB_FIRMWARE_EDID=y | ||
903 | CONFIG_FB_MODE_HELPERS=y | 903 | CONFIG_FB_MODE_HELPERS=y |
904 | CONFIG_FB_TILEBLITTING=y | 904 | CONFIG_FB_TILEBLITTING=y |
905 | # CONFIG_FB_CIRRUS is not set | 905 | # CONFIG_FB_CIRRUS is not set |
@@ -919,7 +919,6 @@ CONFIG_FB_MATROX_MYSTIQUE=y | |||
919 | CONFIG_FB_MATROX_G=y | 919 | CONFIG_FB_MATROX_G=y |
920 | # CONFIG_FB_MATROX_I2C is not set | 920 | # CONFIG_FB_MATROX_I2C is not set |
921 | CONFIG_FB_MATROX_MULTIHEAD=y | 921 | CONFIG_FB_MATROX_MULTIHEAD=y |
922 | # CONFIG_FB_RADEON_OLD is not set | ||
923 | CONFIG_FB_RADEON=y | 922 | CONFIG_FB_RADEON=y |
924 | CONFIG_FB_RADEON_I2C=y | 923 | CONFIG_FB_RADEON_I2C=y |
925 | # CONFIG_FB_RADEON_DEBUG is not set | 924 | # CONFIG_FB_RADEON_DEBUG is not set |
@@ -968,6 +967,7 @@ CONFIG_LCD_DEVICE=y | |||
968 | # | 967 | # |
969 | CONFIG_USB_ARCH_HAS_HCD=y | 968 | CONFIG_USB_ARCH_HAS_HCD=y |
970 | CONFIG_USB_ARCH_HAS_OHCI=y | 969 | CONFIG_USB_ARCH_HAS_OHCI=y |
970 | CONFIG_USB_ARCH_HAS_EHCI=y | ||
971 | CONFIG_USB=y | 971 | CONFIG_USB=y |
972 | # CONFIG_USB_DEBUG is not set | 972 | # CONFIG_USB_DEBUG is not set |
973 | 973 | ||
@@ -1048,15 +1048,6 @@ CONFIG_USB_HIDDEV=y | |||
1048 | # CONFIG_USB_MICROTEK is not set | 1048 | # CONFIG_USB_MICROTEK is not set |
1049 | 1049 | ||
1050 | # | 1050 | # |
1051 | # USB Multimedia devices | ||
1052 | # | ||
1053 | # CONFIG_USB_DABUSB is not set | ||
1054 | |||
1055 | # | ||
1056 | # Video4Linux support is needed for USB Multimedia device support | ||
1057 | # | ||
1058 | |||
1059 | # | ||
1060 | # USB Network Adapters | 1051 | # USB Network Adapters |
1061 | # | 1052 | # |
1062 | # CONFIG_USB_CATC is not set | 1053 | # CONFIG_USB_CATC is not set |
@@ -1109,6 +1100,11 @@ CONFIG_USB_MON=y | |||
1109 | # CONFIG_MMC is not set | 1100 | # CONFIG_MMC is not set |
1110 | 1101 | ||
1111 | # | 1102 | # |
1103 | # LED devices | ||
1104 | # | ||
1105 | # CONFIG_NEW_LEDS is not set | ||
1106 | |||
1107 | # | ||
1112 | # InfiniBand support | 1108 | # InfiniBand support |
1113 | # | 1109 | # |
1114 | CONFIG_INFINIBAND=m | 1110 | CONFIG_INFINIBAND=m |
@@ -1121,12 +1117,13 @@ CONFIG_INFINIBAND_IPOIB=m | |||
1121 | # CONFIG_INFINIBAND_SRP is not set | 1117 | # CONFIG_INFINIBAND_SRP is not set |
1122 | 1118 | ||
1123 | # | 1119 | # |
1124 | # SN Devices | 1120 | # EDAC - error detection and reporting (RAS) (EXPERIMENTAL) |
1125 | # | 1121 | # |
1126 | 1122 | ||
1127 | # | 1123 | # |
1128 | # EDAC - error detection and reporting (RAS) | 1124 | # Real Time Clock |
1129 | # | 1125 | # |
1126 | # CONFIG_RTC_CLASS is not set | ||
1130 | 1127 | ||
1131 | # | 1128 | # |
1132 | # File systems | 1129 | # File systems |
@@ -1202,7 +1199,6 @@ CONFIG_TMPFS=y | |||
1202 | CONFIG_HUGETLBFS=y | 1199 | CONFIG_HUGETLBFS=y |
1203 | CONFIG_HUGETLB_PAGE=y | 1200 | CONFIG_HUGETLB_PAGE=y |
1204 | CONFIG_RAMFS=y | 1201 | CONFIG_RAMFS=y |
1205 | # CONFIG_RELAYFS_FS is not set | ||
1206 | # CONFIG_CONFIGFS_FS is not set | 1202 | # CONFIG_CONFIGFS_FS is not set |
1207 | 1203 | ||
1208 | # | 1204 | # |
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index d9a7fdef59b9..4eba60a32890 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c | |||
@@ -61,6 +61,7 @@ __setup("iommu=", setup_iommu); | |||
61 | static unsigned long iommu_range_alloc(struct iommu_table *tbl, | 61 | static unsigned long iommu_range_alloc(struct iommu_table *tbl, |
62 | unsigned long npages, | 62 | unsigned long npages, |
63 | unsigned long *handle, | 63 | unsigned long *handle, |
64 | unsigned long mask, | ||
64 | unsigned int align_order) | 65 | unsigned int align_order) |
65 | { | 66 | { |
66 | unsigned long n, end, i, start; | 67 | unsigned long n, end, i, start; |
@@ -97,9 +98,21 @@ static unsigned long iommu_range_alloc(struct iommu_table *tbl, | |||
97 | */ | 98 | */ |
98 | if (start >= limit) | 99 | if (start >= limit) |
99 | start = largealloc ? tbl->it_largehint : tbl->it_hint; | 100 | start = largealloc ? tbl->it_largehint : tbl->it_hint; |
100 | 101 | ||
101 | again: | 102 | again: |
102 | 103 | ||
104 | if (limit + tbl->it_offset > mask) { | ||
105 | limit = mask - tbl->it_offset + 1; | ||
106 | /* If we're constrained on address range, first try | ||
107 | * at the masked hint to avoid O(n) search complexity, | ||
108 | * but on second pass, start at 0. | ||
109 | */ | ||
110 | if ((start & mask) >= limit || pass > 0) | ||
111 | start = 0; | ||
112 | else | ||
113 | start &= mask; | ||
114 | } | ||
115 | |||
103 | n = find_next_zero_bit(tbl->it_map, limit, start); | 116 | n = find_next_zero_bit(tbl->it_map, limit, start); |
104 | 117 | ||
105 | /* Align allocation */ | 118 | /* Align allocation */ |
@@ -150,14 +163,14 @@ static unsigned long iommu_range_alloc(struct iommu_table *tbl, | |||
150 | 163 | ||
151 | static dma_addr_t iommu_alloc(struct iommu_table *tbl, void *page, | 164 | static dma_addr_t iommu_alloc(struct iommu_table *tbl, void *page, |
152 | unsigned int npages, enum dma_data_direction direction, | 165 | unsigned int npages, enum dma_data_direction direction, |
153 | unsigned int align_order) | 166 | unsigned long mask, unsigned int align_order) |
154 | { | 167 | { |
155 | unsigned long entry, flags; | 168 | unsigned long entry, flags; |
156 | dma_addr_t ret = DMA_ERROR_CODE; | 169 | dma_addr_t ret = DMA_ERROR_CODE; |
157 | 170 | ||
158 | spin_lock_irqsave(&(tbl->it_lock), flags); | 171 | spin_lock_irqsave(&(tbl->it_lock), flags); |
159 | 172 | ||
160 | entry = iommu_range_alloc(tbl, npages, NULL, align_order); | 173 | entry = iommu_range_alloc(tbl, npages, NULL, mask, align_order); |
161 | 174 | ||
162 | if (unlikely(entry == DMA_ERROR_CODE)) { | 175 | if (unlikely(entry == DMA_ERROR_CODE)) { |
163 | spin_unlock_irqrestore(&(tbl->it_lock), flags); | 176 | spin_unlock_irqrestore(&(tbl->it_lock), flags); |
@@ -236,7 +249,7 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, | |||
236 | 249 | ||
237 | int iommu_map_sg(struct device *dev, struct iommu_table *tbl, | 250 | int iommu_map_sg(struct device *dev, struct iommu_table *tbl, |
238 | struct scatterlist *sglist, int nelems, | 251 | struct scatterlist *sglist, int nelems, |
239 | enum dma_data_direction direction) | 252 | unsigned long mask, enum dma_data_direction direction) |
240 | { | 253 | { |
241 | dma_addr_t dma_next = 0, dma_addr; | 254 | dma_addr_t dma_next = 0, dma_addr; |
242 | unsigned long flags; | 255 | unsigned long flags; |
@@ -274,7 +287,7 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl, | |||
274 | vaddr = (unsigned long)page_address(s->page) + s->offset; | 287 | vaddr = (unsigned long)page_address(s->page) + s->offset; |
275 | npages = PAGE_ALIGN(vaddr + slen) - (vaddr & PAGE_MASK); | 288 | npages = PAGE_ALIGN(vaddr + slen) - (vaddr & PAGE_MASK); |
276 | npages >>= PAGE_SHIFT; | 289 | npages >>= PAGE_SHIFT; |
277 | entry = iommu_range_alloc(tbl, npages, &handle, 0); | 290 | entry = iommu_range_alloc(tbl, npages, &handle, mask >> PAGE_SHIFT, 0); |
278 | 291 | ||
279 | DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen); | 292 | DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen); |
280 | 293 | ||
@@ -479,7 +492,8 @@ void iommu_free_table(struct device_node *dn) | |||
479 | * byte within the page as vaddr. | 492 | * byte within the page as vaddr. |
480 | */ | 493 | */ |
481 | dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, | 494 | dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, |
482 | size_t size, enum dma_data_direction direction) | 495 | size_t size, unsigned long mask, |
496 | enum dma_data_direction direction) | ||
483 | { | 497 | { |
484 | dma_addr_t dma_handle = DMA_ERROR_CODE; | 498 | dma_addr_t dma_handle = DMA_ERROR_CODE; |
485 | unsigned long uaddr; | 499 | unsigned long uaddr; |
@@ -492,7 +506,8 @@ dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, | |||
492 | npages >>= PAGE_SHIFT; | 506 | npages >>= PAGE_SHIFT; |
493 | 507 | ||
494 | if (tbl) { | 508 | if (tbl) { |
495 | dma_handle = iommu_alloc(tbl, vaddr, npages, direction, 0); | 509 | dma_handle = iommu_alloc(tbl, vaddr, npages, direction, |
510 | mask >> PAGE_SHIFT, 0); | ||
496 | if (dma_handle == DMA_ERROR_CODE) { | 511 | if (dma_handle == DMA_ERROR_CODE) { |
497 | if (printk_ratelimit()) { | 512 | if (printk_ratelimit()) { |
498 | printk(KERN_INFO "iommu_alloc failed, " | 513 | printk(KERN_INFO "iommu_alloc failed, " |
@@ -521,7 +536,7 @@ void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, | |||
521 | * to the dma address (mapping) of the first page. | 536 | * to the dma address (mapping) of the first page. |
522 | */ | 537 | */ |
523 | void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, | 538 | void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, |
524 | dma_addr_t *dma_handle, gfp_t flag) | 539 | dma_addr_t *dma_handle, unsigned long mask, gfp_t flag) |
525 | { | 540 | { |
526 | void *ret = NULL; | 541 | void *ret = NULL; |
527 | dma_addr_t mapping; | 542 | dma_addr_t mapping; |
@@ -551,7 +566,8 @@ void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, | |||
551 | memset(ret, 0, size); | 566 | memset(ret, 0, size); |
552 | 567 | ||
553 | /* Set up tces to cover the allocated range */ | 568 | /* Set up tces to cover the allocated range */ |
554 | mapping = iommu_alloc(tbl, ret, npages, DMA_BIDIRECTIONAL, order); | 569 | mapping = iommu_alloc(tbl, ret, npages, DMA_BIDIRECTIONAL, |
570 | mask >> PAGE_SHIFT, order); | ||
555 | if (mapping == DMA_ERROR_CODE) { | 571 | if (mapping == DMA_ERROR_CODE) { |
556 | free_pages((unsigned long)ret, order); | 572 | free_pages((unsigned long)ret, order); |
557 | ret = NULL; | 573 | ret = NULL; |
diff --git a/arch/powerpc/kernel/pci_iommu.c b/arch/powerpc/kernel/pci_iommu.c index c336f3e31cff..c1d95e14bbed 100644 --- a/arch/powerpc/kernel/pci_iommu.c +++ b/arch/powerpc/kernel/pci_iommu.c | |||
@@ -59,6 +59,25 @@ static inline struct iommu_table *devnode_table(struct device *dev) | |||
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | static inline unsigned long device_to_mask(struct device *hwdev) | ||
63 | { | ||
64 | struct pci_dev *pdev; | ||
65 | |||
66 | if (!hwdev) { | ||
67 | pdev = ppc64_isabridge_dev; | ||
68 | if (!pdev) /* This is the best guess we can do */ | ||
69 | return 0xfffffffful; | ||
70 | } else | ||
71 | pdev = to_pci_dev(hwdev); | ||
72 | |||
73 | if (pdev->dma_mask) | ||
74 | return pdev->dma_mask; | ||
75 | |||
76 | /* Assume devices without mask can take 32 bit addresses */ | ||
77 | return 0xfffffffful; | ||
78 | } | ||
79 | |||
80 | |||
62 | /* Allocates a contiguous real buffer and creates mappings over it. | 81 | /* Allocates a contiguous real buffer and creates mappings over it. |
63 | * Returns the virtual address of the buffer and sets dma_handle | 82 | * Returns the virtual address of the buffer and sets dma_handle |
64 | * to the dma address (mapping) of the first page. | 83 | * to the dma address (mapping) of the first page. |
@@ -67,7 +86,7 @@ static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size, | |||
67 | dma_addr_t *dma_handle, gfp_t flag) | 86 | dma_addr_t *dma_handle, gfp_t flag) |
68 | { | 87 | { |
69 | return iommu_alloc_coherent(devnode_table(hwdev), size, dma_handle, | 88 | return iommu_alloc_coherent(devnode_table(hwdev), size, dma_handle, |
70 | flag); | 89 | device_to_mask(hwdev), flag); |
71 | } | 90 | } |
72 | 91 | ||
73 | static void pci_iommu_free_coherent(struct device *hwdev, size_t size, | 92 | static void pci_iommu_free_coherent(struct device *hwdev, size_t size, |
@@ -85,7 +104,8 @@ static void pci_iommu_free_coherent(struct device *hwdev, size_t size, | |||
85 | static dma_addr_t pci_iommu_map_single(struct device *hwdev, void *vaddr, | 104 | static dma_addr_t pci_iommu_map_single(struct device *hwdev, void *vaddr, |
86 | size_t size, enum dma_data_direction direction) | 105 | size_t size, enum dma_data_direction direction) |
87 | { | 106 | { |
88 | return iommu_map_single(devnode_table(hwdev), vaddr, size, direction); | 107 | return iommu_map_single(devnode_table(hwdev), vaddr, size, |
108 | device_to_mask(hwdev), direction); | ||
89 | } | 109 | } |
90 | 110 | ||
91 | 111 | ||
@@ -100,7 +120,7 @@ static int pci_iommu_map_sg(struct device *pdev, struct scatterlist *sglist, | |||
100 | int nelems, enum dma_data_direction direction) | 120 | int nelems, enum dma_data_direction direction) |
101 | { | 121 | { |
102 | return iommu_map_sg(pdev, devnode_table(pdev), sglist, | 122 | return iommu_map_sg(pdev, devnode_table(pdev), sglist, |
103 | nelems, direction); | 123 | nelems, device_to_mask(pdev), direction); |
104 | } | 124 | } |
105 | 125 | ||
106 | static void pci_iommu_unmap_sg(struct device *pdev, struct scatterlist *sglist, | 126 | static void pci_iommu_unmap_sg(struct device *pdev, struct scatterlist *sglist, |
@@ -112,7 +132,19 @@ static void pci_iommu_unmap_sg(struct device *pdev, struct scatterlist *sglist, | |||
112 | /* We support DMA to/from any memory page via the iommu */ | 132 | /* We support DMA to/from any memory page via the iommu */ |
113 | static int pci_iommu_dma_supported(struct device *dev, u64 mask) | 133 | static int pci_iommu_dma_supported(struct device *dev, u64 mask) |
114 | { | 134 | { |
115 | return 1; | 135 | struct iommu_table *tbl = devnode_table(dev); |
136 | |||
137 | if (!tbl || tbl->it_offset > mask) { | ||
138 | printk(KERN_INFO "Warning: IOMMU table offset too big for device mask\n"); | ||
139 | if (tbl) | ||
140 | printk(KERN_INFO "mask: 0x%08lx, table offset: 0x%08lx\n", | ||
141 | mask, tbl->it_offset); | ||
142 | else | ||
143 | printk(KERN_INFO "mask: 0x%08lx, table unavailable\n", | ||
144 | mask); | ||
145 | return 0; | ||
146 | } else | ||
147 | return 1; | ||
116 | } | 148 | } |
117 | 149 | ||
118 | void pci_iommu_init(void) | 150 | void pci_iommu_init(void) |
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index dfa5398ab3c8..4b052ae5dc34 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c | |||
@@ -81,6 +81,7 @@ EXPORT_SYMBOL(strcat); | |||
81 | EXPORT_SYMBOL(strlen); | 81 | EXPORT_SYMBOL(strlen); |
82 | EXPORT_SYMBOL(strcmp); | 82 | EXPORT_SYMBOL(strcmp); |
83 | EXPORT_SYMBOL(strcasecmp); | 83 | EXPORT_SYMBOL(strcasecmp); |
84 | EXPORT_SYMBOL(strncasecmp); | ||
84 | 85 | ||
85 | EXPORT_SYMBOL(csum_partial); | 86 | EXPORT_SYMBOL(csum_partial); |
86 | EXPORT_SYMBOL(csum_partial_copy_generic); | 87 | EXPORT_SYMBOL(csum_partial_copy_generic); |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 4336390bcf34..1cb69e8fb0b1 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -62,7 +62,7 @@ static int __initdata dt_root_addr_cells; | |||
62 | static int __initdata dt_root_size_cells; | 62 | static int __initdata dt_root_size_cells; |
63 | 63 | ||
64 | #ifdef CONFIG_PPC64 | 64 | #ifdef CONFIG_PPC64 |
65 | static int __initdata iommu_is_off; | 65 | int __initdata iommu_is_off; |
66 | int __initdata iommu_force_on; | 66 | int __initdata iommu_force_on; |
67 | unsigned long tce_alloc_start, tce_alloc_end; | 67 | unsigned long tce_alloc_start, tce_alloc_end; |
68 | #endif | 68 | #endif |
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S index a14c96403840..8d1522690501 100644 --- a/arch/powerpc/kernel/systbl.S +++ b/arch/powerpc/kernel/systbl.S | |||
@@ -324,3 +324,8 @@ COMPAT_SYS(ppoll) | |||
324 | SYSCALL(unshare) | 324 | SYSCALL(unshare) |
325 | SYSCALL(splice) | 325 | SYSCALL(splice) |
326 | SYSCALL(tee) | 326 | SYSCALL(tee) |
327 | |||
328 | /* | ||
329 | * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c | ||
330 | * as well when appropriate. | ||
331 | */ | ||
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index 13c655ba2841..971020cf3f7d 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c | |||
@@ -202,7 +202,7 @@ static dma_addr_t vio_map_single(struct device *dev, void *vaddr, | |||
202 | size_t size, enum dma_data_direction direction) | 202 | size_t size, enum dma_data_direction direction) |
203 | { | 203 | { |
204 | return iommu_map_single(to_vio_dev(dev)->iommu_table, vaddr, size, | 204 | return iommu_map_single(to_vio_dev(dev)->iommu_table, vaddr, size, |
205 | direction); | 205 | ~0ul, direction); |
206 | } | 206 | } |
207 | 207 | ||
208 | static void vio_unmap_single(struct device *dev, dma_addr_t dma_handle, | 208 | static void vio_unmap_single(struct device *dev, dma_addr_t dma_handle, |
@@ -216,7 +216,7 @@ static int vio_map_sg(struct device *dev, struct scatterlist *sglist, | |||
216 | int nelems, enum dma_data_direction direction) | 216 | int nelems, enum dma_data_direction direction) |
217 | { | 217 | { |
218 | return iommu_map_sg(dev, to_vio_dev(dev)->iommu_table, sglist, | 218 | return iommu_map_sg(dev, to_vio_dev(dev)->iommu_table, sglist, |
219 | nelems, direction); | 219 | nelems, ~0ul, direction); |
220 | } | 220 | } |
221 | 221 | ||
222 | static void vio_unmap_sg(struct device *dev, struct scatterlist *sglist, | 222 | static void vio_unmap_sg(struct device *dev, struct scatterlist *sglist, |
@@ -229,7 +229,7 @@ static void *vio_alloc_coherent(struct device *dev, size_t size, | |||
229 | dma_addr_t *dma_handle, gfp_t flag) | 229 | dma_addr_t *dma_handle, gfp_t flag) |
230 | { | 230 | { |
231 | return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size, | 231 | return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size, |
232 | dma_handle, flag); | 232 | dma_handle, ~0ul, flag); |
233 | } | 233 | } |
234 | 234 | ||
235 | static void vio_free_coherent(struct device *dev, size_t size, | 235 | static void vio_free_coherent(struct device *dev, size_t size, |
diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c b/arch/powerpc/platforms/cell/spu_callbacks.c index 6594bec73882..deb3afb94484 100644 --- a/arch/powerpc/platforms/cell/spu_callbacks.c +++ b/arch/powerpc/platforms/cell/spu_callbacks.c | |||
@@ -317,17 +317,16 @@ void *spu_syscall_table[] = { | |||
317 | [__NR_ppoll] sys_ni_syscall, /* sys_ppoll */ | 317 | [__NR_ppoll] sys_ni_syscall, /* sys_ppoll */ |
318 | [__NR_unshare] sys_unshare, | 318 | [__NR_unshare] sys_unshare, |
319 | [__NR_splice] sys_splice, | 319 | [__NR_splice] sys_splice, |
320 | [__NR_tee] sys_tee, | ||
320 | }; | 321 | }; |
321 | 322 | ||
322 | long spu_sys_callback(struct spu_syscall_block *s) | 323 | long spu_sys_callback(struct spu_syscall_block *s) |
323 | { | 324 | { |
324 | long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6); | 325 | long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6); |
325 | 326 | ||
326 | BUILD_BUG_ON(ARRAY_SIZE(spu_syscall_table) != __NR_syscalls); | ||
327 | |||
328 | syscall = spu_syscall_table[s->nr_ret]; | 327 | syscall = spu_syscall_table[s->nr_ret]; |
329 | 328 | ||
330 | if (s->nr_ret >= __NR_syscalls) { | 329 | if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) { |
331 | pr_debug("%s: invalid syscall #%ld", __FUNCTION__, s->nr_ret); | 330 | pr_debug("%s: invalid syscall #%ld", __FUNCTION__, s->nr_ret); |
332 | return -ENOSYS; | 331 | return -ENOSYS; |
333 | } | 332 | } |
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c index e14f9ac55cf4..df2343e1956b 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c | |||
@@ -231,6 +231,14 @@ static u8 kw_i2c_wait_interrupt(struct pmac_i2c_host_kw *host) | |||
231 | return isr; | 231 | return isr; |
232 | } | 232 | } |
233 | 233 | ||
234 | static void kw_i2c_do_stop(struct pmac_i2c_host_kw *host, int result) | ||
235 | { | ||
236 | kw_write_reg(reg_control, KW_I2C_CTL_STOP); | ||
237 | host->state = state_stop; | ||
238 | host->result = result; | ||
239 | } | ||
240 | |||
241 | |||
234 | static void kw_i2c_handle_interrupt(struct pmac_i2c_host_kw *host, u8 isr) | 242 | static void kw_i2c_handle_interrupt(struct pmac_i2c_host_kw *host, u8 isr) |
235 | { | 243 | { |
236 | u8 ack; | 244 | u8 ack; |
@@ -246,42 +254,36 @@ static void kw_i2c_handle_interrupt(struct pmac_i2c_host_kw *host, u8 isr) | |||
246 | } | 254 | } |
247 | 255 | ||
248 | if (isr == 0) { | 256 | if (isr == 0) { |
257 | printk(KERN_WARNING "low_i2c: Timeout in i2c transfer" | ||
258 | " on keywest !\n"); | ||
249 | if (host->state != state_stop) { | 259 | if (host->state != state_stop) { |
250 | DBG_LOW("KW: Timeout !\n"); | 260 | kw_i2c_do_stop(host, -EIO); |
251 | host->result = -EIO; | 261 | return; |
252 | goto stop; | ||
253 | } | ||
254 | if (host->state == state_stop) { | ||
255 | ack = kw_read_reg(reg_status); | ||
256 | if (ack & KW_I2C_STAT_BUSY) | ||
257 | kw_write_reg(reg_status, 0); | ||
258 | host->state = state_idle; | ||
259 | kw_write_reg(reg_ier, 0x00); | ||
260 | if (!host->polled) | ||
261 | complete(&host->complete); | ||
262 | } | 262 | } |
263 | ack = kw_read_reg(reg_status); | ||
264 | if (ack & KW_I2C_STAT_BUSY) | ||
265 | kw_write_reg(reg_status, 0); | ||
266 | host->state = state_idle; | ||
267 | kw_write_reg(reg_ier, 0x00); | ||
268 | if (!host->polled) | ||
269 | complete(&host->complete); | ||
263 | return; | 270 | return; |
264 | } | 271 | } |
265 | 272 | ||
266 | if (isr & KW_I2C_IRQ_ADDR) { | 273 | if (isr & KW_I2C_IRQ_ADDR) { |
267 | ack = kw_read_reg(reg_status); | 274 | ack = kw_read_reg(reg_status); |
268 | if (host->state != state_addr) { | 275 | if (host->state != state_addr) { |
269 | kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR); | ||
270 | WRONG_STATE("KW_I2C_IRQ_ADDR"); | 276 | WRONG_STATE("KW_I2C_IRQ_ADDR"); |
271 | host->result = -EIO; | 277 | kw_i2c_do_stop(host, -EIO); |
272 | goto stop; | ||
273 | } | 278 | } |
274 | if ((ack & KW_I2C_STAT_LAST_AAK) == 0) { | 279 | if ((ack & KW_I2C_STAT_LAST_AAK) == 0) { |
275 | host->result = -ENODEV; | 280 | host->result = -ENXIO; |
276 | DBG_LOW("KW: NAK on address\n"); | ||
277 | host->state = state_stop; | 281 | host->state = state_stop; |
278 | return; | 282 | DBG_LOW("KW: NAK on address\n"); |
279 | } else { | 283 | } else { |
280 | if (host->len == 0) { | 284 | if (host->len == 0) |
281 | kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR); | 285 | kw_i2c_do_stop(host, 0); |
282 | goto stop; | 286 | else if (host->rw) { |
283 | } | ||
284 | if (host->rw) { | ||
285 | host->state = state_read; | 287 | host->state = state_read; |
286 | if (host->len > 1) | 288 | if (host->len > 1) |
287 | kw_write_reg(reg_control, | 289 | kw_write_reg(reg_control, |
@@ -308,25 +310,19 @@ static void kw_i2c_handle_interrupt(struct pmac_i2c_host_kw *host, u8 isr) | |||
308 | ack = kw_read_reg(reg_status); | 310 | ack = kw_read_reg(reg_status); |
309 | if ((ack & KW_I2C_STAT_LAST_AAK) == 0) { | 311 | if ((ack & KW_I2C_STAT_LAST_AAK) == 0) { |
310 | DBG_LOW("KW: nack on data write\n"); | 312 | DBG_LOW("KW: nack on data write\n"); |
311 | host->result = -EIO; | 313 | host->result = -EFBIG; |
312 | goto stop; | 314 | host->state = state_stop; |
313 | } else if (host->len) { | 315 | } else if (host->len) { |
314 | kw_write_reg(reg_data, *(host->data++)); | 316 | kw_write_reg(reg_data, *(host->data++)); |
315 | host->len--; | 317 | host->len--; |
316 | } else { | 318 | } else |
317 | kw_write_reg(reg_control, KW_I2C_CTL_STOP); | 319 | kw_i2c_do_stop(host, 0); |
318 | host->state = state_stop; | ||
319 | host->result = 0; | ||
320 | } | ||
321 | kw_write_reg(reg_isr, KW_I2C_IRQ_DATA); | ||
322 | } else { | 320 | } else { |
323 | kw_write_reg(reg_isr, KW_I2C_IRQ_DATA); | ||
324 | WRONG_STATE("KW_I2C_IRQ_DATA"); | 321 | WRONG_STATE("KW_I2C_IRQ_DATA"); |
325 | if (host->state != state_stop) { | 322 | if (host->state != state_stop) |
326 | host->result = -EIO; | 323 | kw_i2c_do_stop(host, -EIO); |
327 | goto stop; | ||
328 | } | ||
329 | } | 324 | } |
325 | kw_write_reg(reg_isr, KW_I2C_IRQ_DATA); | ||
330 | } | 326 | } |
331 | 327 | ||
332 | if (isr & KW_I2C_IRQ_STOP) { | 328 | if (isr & KW_I2C_IRQ_STOP) { |
@@ -340,14 +336,10 @@ static void kw_i2c_handle_interrupt(struct pmac_i2c_host_kw *host, u8 isr) | |||
340 | complete(&host->complete); | 336 | complete(&host->complete); |
341 | } | 337 | } |
342 | 338 | ||
339 | /* Below should only happen in manual mode which we don't use ... */ | ||
343 | if (isr & KW_I2C_IRQ_START) | 340 | if (isr & KW_I2C_IRQ_START) |
344 | kw_write_reg(reg_isr, KW_I2C_IRQ_START); | 341 | kw_write_reg(reg_isr, KW_I2C_IRQ_START); |
345 | 342 | ||
346 | return; | ||
347 | stop: | ||
348 | kw_write_reg(reg_control, KW_I2C_CTL_STOP); | ||
349 | host->state = state_stop; | ||
350 | return; | ||
351 | } | 343 | } |
352 | 344 | ||
353 | /* Interrupt handler */ | 345 | /* Interrupt handler */ |
@@ -544,11 +536,11 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) | |||
544 | return NULL; | 536 | return NULL; |
545 | } | 537 | } |
546 | 538 | ||
547 | /* Make sure IRA is disabled */ | 539 | /* Make sure IRQ is disabled */ |
548 | kw_write_reg(reg_ier, 0); | 540 | kw_write_reg(reg_ier, 0); |
549 | 541 | ||
550 | /* Request chip interrupt */ | 542 | /* Request chip interrupt */ |
551 | if (request_irq(host->irq, kw_i2c_irq, SA_SHIRQ, "keywest i2c", host)) | 543 | if (request_irq(host->irq, kw_i2c_irq, 0, "keywest i2c", host)) |
552 | host->irq = NO_IRQ; | 544 | host->irq = NO_IRQ; |
553 | 545 | ||
554 | printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n", | 546 | printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n", |
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 61d317428610..38087bd6e3cf 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c | |||
@@ -49,6 +49,7 @@ | |||
49 | 49 | ||
50 | #include "dart.h" | 50 | #include "dart.h" |
51 | 51 | ||
52 | extern int iommu_is_off; | ||
52 | extern int iommu_force_on; | 53 | extern int iommu_force_on; |
53 | 54 | ||
54 | /* Physical base address and size of the DART table */ | 55 | /* Physical base address and size of the DART table */ |
@@ -329,10 +330,17 @@ void iommu_init_early_dart(void) | |||
329 | 330 | ||
330 | void __init alloc_dart_table(void) | 331 | void __init alloc_dart_table(void) |
331 | { | 332 | { |
332 | /* Only reserve DART space if machine has more than 2GB of RAM | 333 | /* Only reserve DART space if machine has more than 1GB of RAM |
333 | * or if requested with iommu=on on cmdline. | 334 | * or if requested with iommu=on on cmdline. |
335 | * | ||
336 | * 1GB of RAM is picked as limit because some default devices | ||
337 | * (i.e. Airport Extreme) have 30 bit address range limits. | ||
334 | */ | 338 | */ |
335 | if (lmb_end_of_DRAM() <= 0x80000000ull && !iommu_force_on) | 339 | |
340 | if (iommu_is_off) | ||
341 | return; | ||
342 | |||
343 | if (!iommu_force_on && lmb_end_of_DRAM() <= 0x40000000ull) | ||
336 | return; | 344 | return; |
337 | 345 | ||
338 | /* 512 pages (2MB) is max DART tablesize. */ | 346 | /* 512 pages (2MB) is max DART tablesize. */ |
diff --git a/arch/ppc/kernel/asm-offsets.c b/arch/ppc/kernel/asm-offsets.c index 77e4dc780f8c..cc7c4aea9397 100644 --- a/arch/ppc/kernel/asm-offsets.c +++ b/arch/ppc/kernel/asm-offsets.c | |||
@@ -134,6 +134,7 @@ main(void) | |||
134 | DEFINE(TI_TASK, offsetof(struct thread_info, task)); | 134 | DEFINE(TI_TASK, offsetof(struct thread_info, task)); |
135 | DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); | 135 | DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); |
136 | DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); | 136 | DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); |
137 | DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, flags)); | ||
137 | DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); | 138 | DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); |
138 | DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); | 139 | DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); |
139 | 140 | ||
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S index 5891ecbdc703..1adc9145516f 100644 --- a/arch/ppc/kernel/entry.S +++ b/arch/ppc/kernel/entry.S | |||
@@ -128,29 +128,26 @@ transfer_to_handler: | |||
128 | stw r12,4(r11) | 128 | stw r12,4(r11) |
129 | #endif | 129 | #endif |
130 | b 3f | 130 | b 3f |
131 | |||
131 | 2: /* if from kernel, check interrupted DOZE/NAP mode and | 132 | 2: /* if from kernel, check interrupted DOZE/NAP mode and |
132 | * check for stack overflow | 133 | * check for stack overflow |
133 | */ | 134 | */ |
135 | lwz r9,THREAD_INFO-THREAD(r12) | ||
136 | cmplw r1,r9 /* if r1 <= current->thread_info */ | ||
137 | ble- stack_ovf /* then the kernel stack overflowed */ | ||
138 | 5: | ||
134 | #ifdef CONFIG_6xx | 139 | #ifdef CONFIG_6xx |
135 | mfspr r11,SPRN_HID0 | 140 | tophys(r9,r9) /* check local flags */ |
136 | mtcr r11 | 141 | lwz r12,TI_LOCAL_FLAGS(r9) |
137 | BEGIN_FTR_SECTION | 142 | mtcrf 0x01,r12 |
138 | bt- 8,4f /* Check DOZE */ | 143 | bt- 31-TLF_NAPPING,4f |
139 | END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE) | ||
140 | BEGIN_FTR_SECTION | ||
141 | bt- 9,4f /* Check NAP */ | ||
142 | END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP) | ||
143 | #endif /* CONFIG_6xx */ | 144 | #endif /* CONFIG_6xx */ |
144 | .globl transfer_to_handler_cont | 145 | .globl transfer_to_handler_cont |
145 | transfer_to_handler_cont: | 146 | transfer_to_handler_cont: |
146 | lwz r11,THREAD_INFO-THREAD(r12) | ||
147 | cmplw r1,r11 /* if r1 <= current->thread_info */ | ||
148 | ble- stack_ovf /* then the kernel stack overflowed */ | ||
149 | 3: | 147 | 3: |
150 | mflr r9 | 148 | mflr r9 |
151 | lwz r11,0(r9) /* virtual address of handler */ | 149 | lwz r11,0(r9) /* virtual address of handler */ |
152 | lwz r9,4(r9) /* where to go when done */ | 150 | lwz r9,4(r9) /* where to go when done */ |
153 | FIX_SRR1(r10,r12) | ||
154 | mtspr SPRN_SRR0,r11 | 151 | mtspr SPRN_SRR0,r11 |
155 | mtspr SPRN_SRR1,r10 | 152 | mtspr SPRN_SRR1,r10 |
156 | mtlr r9 | 153 | mtlr r9 |
@@ -158,7 +155,9 @@ transfer_to_handler_cont: | |||
158 | RFI /* jump to handler, enable MMU */ | 155 | RFI /* jump to handler, enable MMU */ |
159 | 156 | ||
160 | #ifdef CONFIG_6xx | 157 | #ifdef CONFIG_6xx |
161 | 4: b power_save_6xx_restore | 158 | 4: rlwinm r12,r12,0,~_TLF_NAPPING |
159 | stw r12,TI_LOCAL_FLAGS(r9) | ||
160 | b power_save_6xx_restore | ||
162 | #endif | 161 | #endif |
163 | 162 | ||
164 | /* | 163 | /* |
@@ -167,10 +166,10 @@ transfer_to_handler_cont: | |||
167 | */ | 166 | */ |
168 | stack_ovf: | 167 | stack_ovf: |
169 | /* sometimes we use a statically-allocated stack, which is OK. */ | 168 | /* sometimes we use a statically-allocated stack, which is OK. */ |
170 | lis r11,_end@h | 169 | lis r12,_end@h |
171 | ori r11,r11,_end@l | 170 | ori r12,r12,_end@l |
172 | cmplw r1,r11 | 171 | cmplw r1,r12 |
173 | ble 3b /* r1 <= &_end is OK */ | 172 | ble 5b /* r1 <= &_end is OK */ |
174 | SAVE_NVGPRS(r11) | 173 | SAVE_NVGPRS(r11) |
175 | addi r3,r1,STACK_FRAME_OVERHEAD | 174 | addi r3,r1,STACK_FRAME_OVERHEAD |
176 | lis r1,init_thread_union@ha | 175 | lis r1,init_thread_union@ha |
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index 865ba74991a9..b250b1b539b6 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c | |||
@@ -94,6 +94,7 @@ EXPORT_SYMBOL(strcat); | |||
94 | EXPORT_SYMBOL(strlen); | 94 | EXPORT_SYMBOL(strlen); |
95 | EXPORT_SYMBOL(strcmp); | 95 | EXPORT_SYMBOL(strcmp); |
96 | EXPORT_SYMBOL(strcasecmp); | 96 | EXPORT_SYMBOL(strcasecmp); |
97 | EXPORT_SYMBOL(strncasecmp); | ||
97 | EXPORT_SYMBOL(__div64_32); | 98 | EXPORT_SYMBOL(__div64_32); |
98 | 99 | ||
99 | EXPORT_SYMBOL(csum_partial); | 100 | EXPORT_SYMBOL(csum_partial); |
diff --git a/arch/x86_64/ia32/Makefile b/arch/x86_64/ia32/Makefile index 929e6b0771f8..e9263b4975e0 100644 --- a/arch/x86_64/ia32/Makefile +++ b/arch/x86_64/ia32/Makefile | |||
@@ -27,5 +27,5 @@ $(obj)/vsyscall-sysenter.so $(obj)/vsyscall-syscall.so: \ | |||
27 | $(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE | 27 | $(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE |
28 | $(call if_changed,syscall) | 28 | $(call if_changed,syscall) |
29 | 29 | ||
30 | AFLAGS_vsyscall-sysenter.o = -m32 | 30 | AFLAGS_vsyscall-sysenter.o = -m32 -Wa,-32 |
31 | AFLAGS_vsyscall-syscall.o = -m32 | 31 | AFLAGS_vsyscall-syscall.o = -m32 -Wa,-32 |
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c index a6c01e121266..9d3d76c85ae7 100644 --- a/arch/x86_64/kernel/pci-gart.c +++ b/arch/x86_64/kernel/pci-gart.c | |||
@@ -112,10 +112,6 @@ static unsigned long alloc_iommu(int size) | |||
112 | static void free_iommu(unsigned long offset, int size) | 112 | static void free_iommu(unsigned long offset, int size) |
113 | { | 113 | { |
114 | unsigned long flags; | 114 | unsigned long flags; |
115 | if (size == 1) { | ||
116 | clear_bit(offset, iommu_gart_bitmap); | ||
117 | return; | ||
118 | } | ||
119 | spin_lock_irqsave(&iommu_bitmap_lock, flags); | 115 | spin_lock_irqsave(&iommu_bitmap_lock, flags); |
120 | __clear_bit_string(iommu_gart_bitmap, offset, size); | 116 | __clear_bit_string(iommu_gart_bitmap, offset, size); |
121 | spin_unlock_irqrestore(&iommu_bitmap_lock, flags); | 117 | spin_unlock_irqrestore(&iommu_bitmap_lock, flags); |
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c index cc02573a3271..b2fac14baac0 100644 --- a/arch/x86_64/mm/numa.c +++ b/arch/x86_64/mm/numa.c | |||
@@ -188,11 +188,13 @@ void __init setup_node_zones(int nodeid) | |||
188 | memory. */ | 188 | memory. */ |
189 | memmapsize = sizeof(struct page) * (end_pfn-start_pfn); | 189 | memmapsize = sizeof(struct page) * (end_pfn-start_pfn); |
190 | limit = end_pfn << PAGE_SHIFT; | 190 | limit = end_pfn << PAGE_SHIFT; |
191 | #ifdef CONFIG_FLAT_NODE_MEM_MAP | ||
191 | NODE_DATA(nodeid)->node_mem_map = | 192 | NODE_DATA(nodeid)->node_mem_map = |
192 | __alloc_bootmem_core(NODE_DATA(nodeid)->bdata, | 193 | __alloc_bootmem_core(NODE_DATA(nodeid)->bdata, |
193 | memmapsize, SMP_CACHE_BYTES, | 194 | memmapsize, SMP_CACHE_BYTES, |
194 | round_down(limit - memmapsize, PAGE_SIZE), | 195 | round_down(limit - memmapsize, PAGE_SIZE), |
195 | limit); | 196 | limit); |
197 | #endif | ||
196 | 198 | ||
197 | size_zones(zones, holes, start_pfn, end_pfn); | 199 | size_zones(zones, holes, start_pfn, end_pfn); |
198 | free_area_init_node(nodeid, NODE_DATA(nodeid), zones, | 200 | free_area_init_node(nodeid, NODE_DATA(nodeid), zones, |
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index e1aadae00623..cb76e5ca9a23 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h | |||
@@ -889,7 +889,6 @@ extern int drm_lock_free(drm_device_t * dev, | |||
889 | /* Buffer management support (drm_bufs.h) */ | 889 | /* Buffer management support (drm_bufs.h) */ |
890 | extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); | 890 | extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); |
891 | extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request); | 891 | extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request); |
892 | extern int drm_addbufs_fb(drm_device_t *dev, drm_buf_desc_t *request); | ||
893 | extern int drm_addmap(drm_device_t * dev, unsigned int offset, | 892 | extern int drm_addmap(drm_device_t * dev, unsigned int offset, |
894 | unsigned int size, drm_map_type_t type, | 893 | unsigned int size, drm_map_type_t type, |
895 | drm_map_flags_t flags, drm_local_map_t ** map_ptr); | 894 | drm_map_flags_t flags, drm_local_map_t ** map_ptr); |
diff --git a/drivers/char/drm/drm_agpsupport.c b/drivers/char/drm/drm_agpsupport.c index fabc930c67a2..40bfd9b01e39 100644 --- a/drivers/char/drm/drm_agpsupport.c +++ b/drivers/char/drm/drm_agpsupport.c | |||
@@ -503,8 +503,6 @@ int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start) | |||
503 | return agp_bind_memory(handle, start); | 503 | return agp_bind_memory(handle, start); |
504 | } | 504 | } |
505 | 505 | ||
506 | EXPORT_SYMBOL(drm_agp_bind_memory); | ||
507 | |||
508 | /** Calls agp_unbind_memory() */ | 506 | /** Calls agp_unbind_memory() */ |
509 | int drm_agp_unbind_memory(DRM_AGP_MEM * handle) | 507 | int drm_agp_unbind_memory(DRM_AGP_MEM * handle) |
510 | { | 508 | { |
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c index 8a9cf12e6183..006b06d29727 100644 --- a/drivers/char/drm/drm_bufs.c +++ b/drivers/char/drm/drm_bufs.c | |||
@@ -386,7 +386,6 @@ int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map) | |||
386 | 386 | ||
387 | return 0; | 387 | return 0; |
388 | } | 388 | } |
389 | EXPORT_SYMBOL(drm_rmmap_locked); | ||
390 | 389 | ||
391 | int drm_rmmap(drm_device_t *dev, drm_local_map_t *map) | 390 | int drm_rmmap(drm_device_t *dev, drm_local_map_t *map) |
392 | { | 391 | { |
@@ -398,7 +397,6 @@ int drm_rmmap(drm_device_t *dev, drm_local_map_t *map) | |||
398 | 397 | ||
399 | return ret; | 398 | return ret; |
400 | } | 399 | } |
401 | EXPORT_SYMBOL(drm_rmmap); | ||
402 | 400 | ||
403 | /* The rmmap ioctl appears to be unnecessary. All mappings are torn down on | 401 | /* The rmmap ioctl appears to be unnecessary. All mappings are torn down on |
404 | * the last close of the device, and this is necessary for cleanup when things | 402 | * the last close of the device, and this is necessary for cleanup when things |
@@ -1053,7 +1051,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) | |||
1053 | return 0; | 1051 | return 0; |
1054 | } | 1052 | } |
1055 | 1053 | ||
1056 | int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) | 1054 | static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) |
1057 | { | 1055 | { |
1058 | drm_device_dma_t *dma = dev->dma; | 1056 | drm_device_dma_t *dma = dev->dma; |
1059 | drm_buf_entry_t *entry; | 1057 | drm_buf_entry_t *entry; |
@@ -1212,7 +1210,6 @@ int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) | |||
1212 | atomic_dec(&dev->buf_alloc); | 1210 | atomic_dec(&dev->buf_alloc); |
1213 | return 0; | 1211 | return 0; |
1214 | } | 1212 | } |
1215 | EXPORT_SYMBOL(drm_addbufs_fb); | ||
1216 | 1213 | ||
1217 | 1214 | ||
1218 | /** | 1215 | /** |
diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c index 68073e14fdec..9a842a36bb27 100644 --- a/drivers/char/drm/drm_stub.c +++ b/drivers/char/drm/drm_stub.c | |||
@@ -229,8 +229,6 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, | |||
229 | return ret; | 229 | return ret; |
230 | } | 230 | } |
231 | 231 | ||
232 | EXPORT_SYMBOL(drm_get_dev); | ||
233 | |||
234 | /** | 232 | /** |
235 | * Put a device minor number. | 233 | * Put a device minor number. |
236 | * | 234 | * |
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c index b108c7f913b2..26bdf2ca59d7 100644 --- a/drivers/char/drm/r300_cmdbuf.c +++ b/drivers/char/drm/r300_cmdbuf.c | |||
@@ -723,7 +723,7 @@ static int r300_scratch(drm_radeon_private_t *dev_priv, | |||
723 | 723 | ||
724 | dev_priv->scratch_ages[header.scratch.reg]++; | 724 | dev_priv->scratch_ages[header.scratch.reg]++; |
725 | 725 | ||
726 | ref_age_base = *(u32 **)cmdbuf->buf; | 726 | ref_age_base = (u32 *)(unsigned long)*((uint64_t *)cmdbuf->buf); |
727 | 727 | ||
728 | cmdbuf->buf += sizeof(u64); | 728 | cmdbuf->buf += sizeof(u64); |
729 | cmdbuf->bufsz -= sizeof(u64); | 729 | cmdbuf->bufsz -= sizeof(u64); |
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index b543821d8cb4..56c8243cdb73 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c | |||
@@ -390,7 +390,8 @@ scdrv_init(void) | |||
390 | format_module_id(devnamep, geo_module(geoid), | 390 | format_module_id(devnamep, geo_module(geoid), |
391 | MODULE_FORMAT_BRIEF); | 391 | MODULE_FORMAT_BRIEF); |
392 | devnamep = devname + strlen(devname); | 392 | devnamep = devname + strlen(devname); |
393 | sprintf(devnamep, "#%d", geo_slab(geoid)); | 393 | sprintf(devnamep, "^%d#%d", geo_slot(geoid), |
394 | geo_slab(geoid)); | ||
394 | 395 | ||
395 | /* allocate sysctl device data */ | 396 | /* allocate sysctl device data */ |
396 | scd = kzalloc(sizeof (struct sysctl_data_s), | 397 | scd = kzalloc(sizeof (struct sysctl_data_s), |
diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig index a6873bf89ffa..1efde3b27619 100644 --- a/drivers/char/tpm/Kconfig +++ b/drivers/char/tpm/Kconfig | |||
@@ -20,9 +20,18 @@ config TCG_TPM | |||
20 | Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI | 20 | Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI |
21 | and CONFIG_PNPACPI. | 21 | and CONFIG_PNPACPI. |
22 | 22 | ||
23 | config TCG_TIS | ||
24 | tristate "TPM Interface Specification 1.2 Interface" | ||
25 | depends on TCG_TPM | ||
26 | ---help--- | ||
27 | If you have a TPM security chip that is compliant with the | ||
28 | TCG TIS 1.2 TPM specification say Yes and it will be accessible | ||
29 | from within Linux. To compile this driver as a module, choose | ||
30 | M here; the module will be called tpm_tis. | ||
31 | |||
23 | config TCG_NSC | 32 | config TCG_NSC |
24 | tristate "National Semiconductor TPM Interface" | 33 | tristate "National Semiconductor TPM Interface" |
25 | depends on TCG_TPM | 34 | depends on TCG_TPM && PNPACPI |
26 | ---help--- | 35 | ---help--- |
27 | If you have a TPM security chip from National Semicondutor | 36 | If you have a TPM security chip from National Semicondutor |
28 | say Yes and it will be accessible from within Linux. To | 37 | say Yes and it will be accessible from within Linux. To |
diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile index ba4582d160fd..ea3a1e02a824 100644 --- a/drivers/char/tpm/Makefile +++ b/drivers/char/tpm/Makefile | |||
@@ -5,6 +5,7 @@ obj-$(CONFIG_TCG_TPM) += tpm.o | |||
5 | ifdef CONFIG_ACPI | 5 | ifdef CONFIG_ACPI |
6 | obj-$(CONFIG_TCG_TPM) += tpm_bios.o | 6 | obj-$(CONFIG_TCG_TPM) += tpm_bios.o |
7 | endif | 7 | endif |
8 | obj-$(CONFIG_TCG_TIS) += tpm_tis.o | ||
8 | obj-$(CONFIG_TCG_NSC) += tpm_nsc.o | 9 | obj-$(CONFIG_TCG_NSC) += tpm_nsc.o |
9 | obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o | 10 | obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o |
10 | obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o | 11 | obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 5a3870477ef1..6889e7db3aff 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -32,12 +32,291 @@ enum tpm_const { | |||
32 | TPM_MINOR = 224, /* officially assigned */ | 32 | TPM_MINOR = 224, /* officially assigned */ |
33 | TPM_BUFSIZE = 2048, | 33 | TPM_BUFSIZE = 2048, |
34 | TPM_NUM_DEVICES = 256, | 34 | TPM_NUM_DEVICES = 256, |
35 | TPM_NUM_MASK_ENTRIES = TPM_NUM_DEVICES / (8 * sizeof(int)) | ||
36 | }; | 35 | }; |
37 | 36 | ||
37 | enum tpm_duration { | ||
38 | TPM_SHORT = 0, | ||
39 | TPM_MEDIUM = 1, | ||
40 | TPM_LONG = 2, | ||
41 | TPM_UNDEFINED, | ||
42 | }; | ||
43 | |||
44 | #define TPM_MAX_ORDINAL 243 | ||
45 | #define TPM_MAX_PROTECTED_ORDINAL 12 | ||
46 | #define TPM_PROTECTED_ORDINAL_MASK 0xFF | ||
47 | |||
38 | static LIST_HEAD(tpm_chip_list); | 48 | static LIST_HEAD(tpm_chip_list); |
39 | static DEFINE_SPINLOCK(driver_lock); | 49 | static DEFINE_SPINLOCK(driver_lock); |
40 | static int dev_mask[TPM_NUM_MASK_ENTRIES]; | 50 | static DECLARE_BITMAP(dev_mask, TPM_NUM_DEVICES); |
51 | |||
52 | /* | ||
53 | * Array with one entry per ordinal defining the maximum amount | ||
54 | * of time the chip could take to return the result. The ordinal | ||
55 | * designation of short, medium or long is defined in a table in | ||
56 | * TCG Specification TPM Main Part 2 TPM Structures Section 17. The | ||
57 | * values of the SHORT, MEDIUM, and LONG durations are retrieved | ||
58 | * from the chip during initialization with a call to tpm_get_timeouts. | ||
59 | */ | ||
60 | static const u8 tpm_protected_ordinal_duration[TPM_MAX_PROTECTED_ORDINAL] = { | ||
61 | TPM_UNDEFINED, /* 0 */ | ||
62 | TPM_UNDEFINED, | ||
63 | TPM_UNDEFINED, | ||
64 | TPM_UNDEFINED, | ||
65 | TPM_UNDEFINED, | ||
66 | TPM_UNDEFINED, /* 5 */ | ||
67 | TPM_UNDEFINED, | ||
68 | TPM_UNDEFINED, | ||
69 | TPM_UNDEFINED, | ||
70 | TPM_UNDEFINED, | ||
71 | TPM_SHORT, /* 10 */ | ||
72 | TPM_SHORT, | ||
73 | }; | ||
74 | |||
75 | static const u8 tpm_ordinal_duration[TPM_MAX_ORDINAL] = { | ||
76 | TPM_UNDEFINED, /* 0 */ | ||
77 | TPM_UNDEFINED, | ||
78 | TPM_UNDEFINED, | ||
79 | TPM_UNDEFINED, | ||
80 | TPM_UNDEFINED, | ||
81 | TPM_UNDEFINED, /* 5 */ | ||
82 | TPM_UNDEFINED, | ||
83 | TPM_UNDEFINED, | ||
84 | TPM_UNDEFINED, | ||
85 | TPM_UNDEFINED, | ||
86 | TPM_SHORT, /* 10 */ | ||
87 | TPM_SHORT, | ||
88 | TPM_MEDIUM, | ||
89 | TPM_LONG, | ||
90 | TPM_LONG, | ||
91 | TPM_MEDIUM, /* 15 */ | ||
92 | TPM_SHORT, | ||
93 | TPM_SHORT, | ||
94 | TPM_MEDIUM, | ||
95 | TPM_LONG, | ||
96 | TPM_SHORT, /* 20 */ | ||
97 | TPM_SHORT, | ||
98 | TPM_MEDIUM, | ||
99 | TPM_MEDIUM, | ||
100 | TPM_MEDIUM, | ||
101 | TPM_SHORT, /* 25 */ | ||
102 | TPM_SHORT, | ||
103 | TPM_MEDIUM, | ||
104 | TPM_SHORT, | ||
105 | TPM_SHORT, | ||
106 | TPM_MEDIUM, /* 30 */ | ||
107 | TPM_LONG, | ||
108 | TPM_MEDIUM, | ||
109 | TPM_SHORT, | ||
110 | TPM_SHORT, | ||
111 | TPM_SHORT, /* 35 */ | ||
112 | TPM_MEDIUM, | ||
113 | TPM_MEDIUM, | ||
114 | TPM_UNDEFINED, | ||
115 | TPM_UNDEFINED, | ||
116 | TPM_MEDIUM, /* 40 */ | ||
117 | TPM_LONG, | ||
118 | TPM_MEDIUM, | ||
119 | TPM_SHORT, | ||
120 | TPM_SHORT, | ||
121 | TPM_SHORT, /* 45 */ | ||
122 | TPM_SHORT, | ||
123 | TPM_SHORT, | ||
124 | TPM_SHORT, | ||
125 | TPM_LONG, | ||
126 | TPM_MEDIUM, /* 50 */ | ||
127 | TPM_MEDIUM, | ||
128 | TPM_UNDEFINED, | ||
129 | TPM_UNDEFINED, | ||
130 | TPM_UNDEFINED, | ||
131 | TPM_UNDEFINED, /* 55 */ | ||
132 | TPM_UNDEFINED, | ||
133 | TPM_UNDEFINED, | ||
134 | TPM_UNDEFINED, | ||
135 | TPM_UNDEFINED, | ||
136 | TPM_MEDIUM, /* 60 */ | ||
137 | TPM_MEDIUM, | ||
138 | TPM_MEDIUM, | ||
139 | TPM_SHORT, | ||
140 | TPM_SHORT, | ||
141 | TPM_MEDIUM, /* 65 */ | ||
142 | TPM_UNDEFINED, | ||
143 | TPM_UNDEFINED, | ||
144 | TPM_UNDEFINED, | ||
145 | TPM_UNDEFINED, | ||
146 | TPM_SHORT, /* 70 */ | ||
147 | TPM_SHORT, | ||
148 | TPM_UNDEFINED, | ||
149 | TPM_UNDEFINED, | ||
150 | TPM_UNDEFINED, | ||
151 | TPM_UNDEFINED, /* 75 */ | ||
152 | TPM_UNDEFINED, | ||
153 | TPM_UNDEFINED, | ||
154 | TPM_UNDEFINED, | ||
155 | TPM_UNDEFINED, | ||
156 | TPM_LONG, /* 80 */ | ||
157 | TPM_UNDEFINED, | ||
158 | TPM_MEDIUM, | ||
159 | TPM_LONG, | ||
160 | TPM_SHORT, | ||
161 | TPM_UNDEFINED, /* 85 */ | ||
162 | TPM_UNDEFINED, | ||
163 | TPM_UNDEFINED, | ||
164 | TPM_UNDEFINED, | ||
165 | TPM_UNDEFINED, | ||
166 | TPM_SHORT, /* 90 */ | ||
167 | TPM_SHORT, | ||
168 | TPM_SHORT, | ||
169 | TPM_SHORT, | ||
170 | TPM_SHORT, | ||
171 | TPM_UNDEFINED, /* 95 */ | ||
172 | TPM_UNDEFINED, | ||
173 | TPM_UNDEFINED, | ||
174 | TPM_UNDEFINED, | ||
175 | TPM_UNDEFINED, | ||
176 | TPM_MEDIUM, /* 100 */ | ||
177 | TPM_SHORT, | ||
178 | TPM_SHORT, | ||
179 | TPM_UNDEFINED, | ||
180 | TPM_UNDEFINED, | ||
181 | TPM_UNDEFINED, /* 105 */ | ||
182 | TPM_UNDEFINED, | ||
183 | TPM_UNDEFINED, | ||
184 | TPM_UNDEFINED, | ||
185 | TPM_UNDEFINED, | ||
186 | TPM_SHORT, /* 110 */ | ||
187 | TPM_SHORT, | ||
188 | TPM_SHORT, | ||
189 | TPM_SHORT, | ||
190 | TPM_SHORT, | ||
191 | TPM_SHORT, /* 115 */ | ||
192 | TPM_SHORT, | ||
193 | TPM_SHORT, | ||
194 | TPM_UNDEFINED, | ||
195 | TPM_UNDEFINED, | ||
196 | TPM_LONG, /* 120 */ | ||
197 | TPM_LONG, | ||
198 | TPM_MEDIUM, | ||
199 | TPM_UNDEFINED, | ||
200 | TPM_SHORT, | ||
201 | TPM_SHORT, /* 125 */ | ||
202 | TPM_SHORT, | ||
203 | TPM_LONG, | ||
204 | TPM_SHORT, | ||
205 | TPM_SHORT, | ||
206 | TPM_SHORT, /* 130 */ | ||
207 | TPM_MEDIUM, | ||
208 | TPM_UNDEFINED, | ||
209 | TPM_SHORT, | ||
210 | TPM_MEDIUM, | ||
211 | TPM_UNDEFINED, /* 135 */ | ||
212 | TPM_UNDEFINED, | ||
213 | TPM_UNDEFINED, | ||
214 | TPM_UNDEFINED, | ||
215 | TPM_UNDEFINED, | ||
216 | TPM_SHORT, /* 140 */ | ||
217 | TPM_SHORT, | ||
218 | TPM_UNDEFINED, | ||
219 | TPM_UNDEFINED, | ||
220 | TPM_UNDEFINED, | ||
221 | TPM_UNDEFINED, /* 145 */ | ||
222 | TPM_UNDEFINED, | ||
223 | TPM_UNDEFINED, | ||
224 | TPM_UNDEFINED, | ||
225 | TPM_UNDEFINED, | ||
226 | TPM_SHORT, /* 150 */ | ||
227 | TPM_MEDIUM, | ||
228 | TPM_MEDIUM, | ||
229 | TPM_SHORT, | ||
230 | TPM_SHORT, | ||
231 | TPM_UNDEFINED, /* 155 */ | ||
232 | TPM_UNDEFINED, | ||
233 | TPM_UNDEFINED, | ||
234 | TPM_UNDEFINED, | ||
235 | TPM_UNDEFINED, | ||
236 | TPM_SHORT, /* 160 */ | ||
237 | TPM_SHORT, | ||
238 | TPM_SHORT, | ||
239 | TPM_SHORT, | ||
240 | TPM_UNDEFINED, | ||
241 | TPM_UNDEFINED, /* 165 */ | ||
242 | TPM_UNDEFINED, | ||
243 | TPM_UNDEFINED, | ||
244 | TPM_UNDEFINED, | ||
245 | TPM_UNDEFINED, | ||
246 | TPM_LONG, /* 170 */ | ||
247 | TPM_UNDEFINED, | ||
248 | TPM_UNDEFINED, | ||
249 | TPM_UNDEFINED, | ||
250 | TPM_UNDEFINED, | ||
251 | TPM_UNDEFINED, /* 175 */ | ||
252 | TPM_UNDEFINED, | ||
253 | TPM_UNDEFINED, | ||
254 | TPM_UNDEFINED, | ||
255 | TPM_UNDEFINED, | ||
256 | TPM_MEDIUM, /* 180 */ | ||
257 | TPM_SHORT, | ||
258 | TPM_MEDIUM, | ||
259 | TPM_MEDIUM, | ||
260 | TPM_MEDIUM, | ||
261 | TPM_MEDIUM, /* 185 */ | ||
262 | TPM_SHORT, | ||
263 | TPM_UNDEFINED, | ||
264 | TPM_UNDEFINED, | ||
265 | TPM_UNDEFINED, | ||
266 | TPM_UNDEFINED, /* 190 */ | ||
267 | TPM_UNDEFINED, | ||
268 | TPM_UNDEFINED, | ||
269 | TPM_UNDEFINED, | ||
270 | TPM_UNDEFINED, | ||
271 | TPM_UNDEFINED, /* 195 */ | ||
272 | TPM_UNDEFINED, | ||
273 | TPM_UNDEFINED, | ||
274 | TPM_UNDEFINED, | ||
275 | TPM_UNDEFINED, | ||
276 | TPM_SHORT, /* 200 */ | ||
277 | TPM_UNDEFINED, | ||
278 | TPM_UNDEFINED, | ||
279 | TPM_UNDEFINED, | ||
280 | TPM_SHORT, | ||
281 | TPM_SHORT, /* 205 */ | ||
282 | TPM_SHORT, | ||
283 | TPM_SHORT, | ||
284 | TPM_SHORT, | ||
285 | TPM_SHORT, | ||
286 | TPM_MEDIUM, /* 210 */ | ||
287 | TPM_UNDEFINED, | ||
288 | TPM_MEDIUM, | ||
289 | TPM_MEDIUM, | ||
290 | TPM_MEDIUM, | ||
291 | TPM_UNDEFINED, /* 215 */ | ||
292 | TPM_MEDIUM, | ||
293 | TPM_UNDEFINED, | ||
294 | TPM_UNDEFINED, | ||
295 | TPM_SHORT, | ||
296 | TPM_SHORT, /* 220 */ | ||
297 | TPM_SHORT, | ||
298 | TPM_SHORT, | ||
299 | TPM_SHORT, | ||
300 | TPM_SHORT, | ||
301 | TPM_UNDEFINED, /* 225 */ | ||
302 | TPM_UNDEFINED, | ||
303 | TPM_UNDEFINED, | ||
304 | TPM_UNDEFINED, | ||
305 | TPM_UNDEFINED, | ||
306 | TPM_SHORT, /* 230 */ | ||
307 | TPM_LONG, | ||
308 | TPM_MEDIUM, | ||
309 | TPM_UNDEFINED, | ||
310 | TPM_UNDEFINED, | ||
311 | TPM_UNDEFINED, /* 235 */ | ||
312 | TPM_UNDEFINED, | ||
313 | TPM_UNDEFINED, | ||
314 | TPM_UNDEFINED, | ||
315 | TPM_UNDEFINED, | ||
316 | TPM_SHORT, /* 240 */ | ||
317 | TPM_UNDEFINED, | ||
318 | TPM_MEDIUM, | ||
319 | }; | ||
41 | 320 | ||
42 | static void user_reader_timeout(unsigned long ptr) | 321 | static void user_reader_timeout(unsigned long ptr) |
43 | { | 322 | { |
@@ -46,7 +325,7 @@ static void user_reader_timeout(unsigned long ptr) | |||
46 | schedule_work(&chip->work); | 325 | schedule_work(&chip->work); |
47 | } | 326 | } |
48 | 327 | ||
49 | static void timeout_work(void * ptr) | 328 | static void timeout_work(void *ptr) |
50 | { | 329 | { |
51 | struct tpm_chip *chip = ptr; | 330 | struct tpm_chip *chip = ptr; |
52 | 331 | ||
@@ -57,17 +336,43 @@ static void timeout_work(void * ptr) | |||
57 | } | 336 | } |
58 | 337 | ||
59 | /* | 338 | /* |
339 | * Returns max number of jiffies to wait | ||
340 | */ | ||
341 | unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, | ||
342 | u32 ordinal) | ||
343 | { | ||
344 | int duration_idx = TPM_UNDEFINED; | ||
345 | int duration = 0; | ||
346 | |||
347 | if (ordinal < TPM_MAX_ORDINAL) | ||
348 | duration_idx = tpm_ordinal_duration[ordinal]; | ||
349 | else if ((ordinal & TPM_PROTECTED_ORDINAL_MASK) < | ||
350 | TPM_MAX_PROTECTED_ORDINAL) | ||
351 | duration_idx = | ||
352 | tpm_protected_ordinal_duration[ordinal & | ||
353 | TPM_PROTECTED_ORDINAL_MASK]; | ||
354 | |||
355 | if (duration_idx != TPM_UNDEFINED) | ||
356 | duration = chip->vendor.duration[duration_idx]; | ||
357 | if (duration <= 0) | ||
358 | return 2 * 60 * HZ; | ||
359 | else | ||
360 | return duration; | ||
361 | } | ||
362 | EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); | ||
363 | |||
364 | /* | ||
60 | * Internal kernel interface to transmit TPM commands | 365 | * Internal kernel interface to transmit TPM commands |
61 | */ | 366 | */ |
62 | static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, | 367 | static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, |
63 | size_t bufsiz) | 368 | size_t bufsiz) |
64 | { | 369 | { |
65 | ssize_t rc; | 370 | ssize_t rc; |
66 | u32 count; | 371 | u32 count, ordinal; |
67 | unsigned long stop; | 372 | unsigned long stop; |
68 | 373 | ||
69 | count = be32_to_cpu(*((__be32 *) (buf + 2))); | 374 | count = be32_to_cpu(*((__be32 *) (buf + 2))); |
70 | 375 | ordinal = be32_to_cpu(*((__be32 *) (buf + 6))); | |
71 | if (count == 0) | 376 | if (count == 0) |
72 | return -ENODATA; | 377 | return -ENODATA; |
73 | if (count > bufsiz) { | 378 | if (count > bufsiz) { |
@@ -78,21 +383,23 @@ static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, | |||
78 | 383 | ||
79 | down(&chip->tpm_mutex); | 384 | down(&chip->tpm_mutex); |
80 | 385 | ||
81 | if ((rc = chip->vendor->send(chip, (u8 *) buf, count)) < 0) { | 386 | if ((rc = chip->vendor.send(chip, (u8 *) buf, count)) < 0) { |
82 | dev_err(chip->dev, | 387 | dev_err(chip->dev, |
83 | "tpm_transmit: tpm_send: error %zd\n", rc); | 388 | "tpm_transmit: tpm_send: error %zd\n", rc); |
84 | goto out; | 389 | goto out; |
85 | } | 390 | } |
86 | 391 | ||
87 | stop = jiffies + 2 * 60 * HZ; | 392 | if (chip->vendor.irq) |
393 | goto out_recv; | ||
394 | |||
395 | stop = jiffies + tpm_calc_ordinal_duration(chip, ordinal); | ||
88 | do { | 396 | do { |
89 | u8 status = chip->vendor->status(chip); | 397 | u8 status = chip->vendor.status(chip); |
90 | if ((status & chip->vendor->req_complete_mask) == | 398 | if ((status & chip->vendor.req_complete_mask) == |
91 | chip->vendor->req_complete_val) { | 399 | chip->vendor.req_complete_val) |
92 | goto out_recv; | 400 | goto out_recv; |
93 | } | ||
94 | 401 | ||
95 | if ((status == chip->vendor->req_canceled)) { | 402 | if ((status == chip->vendor.req_canceled)) { |
96 | dev_err(chip->dev, "Operation Canceled\n"); | 403 | dev_err(chip->dev, "Operation Canceled\n"); |
97 | rc = -ECANCELED; | 404 | rc = -ECANCELED; |
98 | goto out; | 405 | goto out; |
@@ -102,14 +409,13 @@ static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, | |||
102 | rmb(); | 409 | rmb(); |
103 | } while (time_before(jiffies, stop)); | 410 | } while (time_before(jiffies, stop)); |
104 | 411 | ||
105 | 412 | chip->vendor.cancel(chip); | |
106 | chip->vendor->cancel(chip); | ||
107 | dev_err(chip->dev, "Operation Timed out\n"); | 413 | dev_err(chip->dev, "Operation Timed out\n"); |
108 | rc = -ETIME; | 414 | rc = -ETIME; |
109 | goto out; | 415 | goto out; |
110 | 416 | ||
111 | out_recv: | 417 | out_recv: |
112 | rc = chip->vendor->recv(chip, (u8 *) buf, bufsiz); | 418 | rc = chip->vendor.recv(chip, (u8 *) buf, bufsiz); |
113 | if (rc < 0) | 419 | if (rc < 0) |
114 | dev_err(chip->dev, | 420 | dev_err(chip->dev, |
115 | "tpm_transmit: tpm_recv: error %zd\n", rc); | 421 | "tpm_transmit: tpm_recv: error %zd\n", rc); |
@@ -119,17 +425,247 @@ out: | |||
119 | } | 425 | } |
120 | 426 | ||
121 | #define TPM_DIGEST_SIZE 20 | 427 | #define TPM_DIGEST_SIZE 20 |
122 | #define CAP_PCR_RESULT_SIZE 18 | 428 | #define TPM_ERROR_SIZE 10 |
123 | static const u8 cap_pcr[] = { | 429 | #define TPM_RET_CODE_IDX 6 |
430 | #define TPM_GET_CAP_RET_SIZE_IDX 10 | ||
431 | #define TPM_GET_CAP_RET_UINT32_1_IDX 14 | ||
432 | #define TPM_GET_CAP_RET_UINT32_2_IDX 18 | ||
433 | #define TPM_GET_CAP_RET_UINT32_3_IDX 22 | ||
434 | #define TPM_GET_CAP_RET_UINT32_4_IDX 26 | ||
435 | #define TPM_GET_CAP_PERM_DISABLE_IDX 16 | ||
436 | #define TPM_GET_CAP_PERM_INACTIVE_IDX 18 | ||
437 | #define TPM_GET_CAP_RET_BOOL_1_IDX 14 | ||
438 | #define TPM_GET_CAP_TEMP_INACTIVE_IDX 16 | ||
439 | |||
440 | #define TPM_CAP_IDX 13 | ||
441 | #define TPM_CAP_SUBCAP_IDX 21 | ||
442 | |||
443 | enum tpm_capabilities { | ||
444 | TPM_CAP_FLAG = 4, | ||
445 | TPM_CAP_PROP = 5, | ||
446 | }; | ||
447 | |||
448 | enum tpm_sub_capabilities { | ||
449 | TPM_CAP_PROP_PCR = 0x1, | ||
450 | TPM_CAP_PROP_MANUFACTURER = 0x3, | ||
451 | TPM_CAP_FLAG_PERM = 0x8, | ||
452 | TPM_CAP_FLAG_VOL = 0x9, | ||
453 | TPM_CAP_PROP_OWNER = 0x11, | ||
454 | TPM_CAP_PROP_TIS_TIMEOUT = 0x15, | ||
455 | TPM_CAP_PROP_TIS_DURATION = 0x20, | ||
456 | }; | ||
457 | |||
458 | /* | ||
459 | * This is a semi generic GetCapability command for use | ||
460 | * with the capability type TPM_CAP_PROP or TPM_CAP_FLAG | ||
461 | * and their associated sub_capabilities. | ||
462 | */ | ||
463 | |||
464 | static const u8 tpm_cap[] = { | ||
124 | 0, 193, /* TPM_TAG_RQU_COMMAND */ | 465 | 0, 193, /* TPM_TAG_RQU_COMMAND */ |
125 | 0, 0, 0, 22, /* length */ | 466 | 0, 0, 0, 22, /* length */ |
126 | 0, 0, 0, 101, /* TPM_ORD_GetCapability */ | 467 | 0, 0, 0, 101, /* TPM_ORD_GetCapability */ |
127 | 0, 0, 0, 5, | 468 | 0, 0, 0, 0, /* TPM_CAP_<TYPE> */ |
128 | 0, 0, 0, 4, | 469 | 0, 0, 0, 4, /* TPM_CAP_SUB_<TYPE> size */ |
129 | 0, 0, 1, 1 | 470 | 0, 0, 1, 0 /* TPM_CAP_SUB_<TYPE> */ |
130 | }; | 471 | }; |
131 | 472 | ||
132 | #define READ_PCR_RESULT_SIZE 30 | 473 | static ssize_t transmit_cmd(struct tpm_chip *chip, u8 *data, int len, |
474 | char *desc) | ||
475 | { | ||
476 | int err; | ||
477 | |||
478 | len = tpm_transmit(chip, data, len); | ||
479 | if (len < 0) | ||
480 | return len; | ||
481 | if (len == TPM_ERROR_SIZE) { | ||
482 | err = be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX))); | ||
483 | dev_dbg(chip->dev, "A TPM error (%d) occurred %s\n", err, desc); | ||
484 | return err; | ||
485 | } | ||
486 | return 0; | ||
487 | } | ||
488 | |||
489 | void tpm_gen_interrupt(struct tpm_chip *chip) | ||
490 | { | ||
491 | u8 data[max_t(int, ARRAY_SIZE(tpm_cap), 30)]; | ||
492 | ssize_t rc; | ||
493 | |||
494 | memcpy(data, tpm_cap, sizeof(tpm_cap)); | ||
495 | data[TPM_CAP_IDX] = TPM_CAP_PROP; | ||
496 | data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_TIS_TIMEOUT; | ||
497 | |||
498 | rc = transmit_cmd(chip, data, sizeof(data), | ||
499 | "attempting to determine the timeouts"); | ||
500 | } | ||
501 | EXPORT_SYMBOL_GPL(tpm_gen_interrupt); | ||
502 | |||
503 | void tpm_get_timeouts(struct tpm_chip *chip) | ||
504 | { | ||
505 | u8 data[max_t(int, ARRAY_SIZE(tpm_cap), 30)]; | ||
506 | ssize_t rc; | ||
507 | u32 timeout; | ||
508 | |||
509 | memcpy(data, tpm_cap, sizeof(tpm_cap)); | ||
510 | data[TPM_CAP_IDX] = TPM_CAP_PROP; | ||
511 | data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_TIS_TIMEOUT; | ||
512 | |||
513 | rc = transmit_cmd(chip, data, sizeof(data), | ||
514 | "attempting to determine the timeouts"); | ||
515 | if (rc) | ||
516 | goto duration; | ||
517 | |||
518 | if (be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_SIZE_IDX))) | ||
519 | != 4 * sizeof(u32)) | ||
520 | goto duration; | ||
521 | |||
522 | /* Don't overwrite default if value is 0 */ | ||
523 | timeout = | ||
524 | be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX))); | ||
525 | if (timeout) | ||
526 | chip->vendor.timeout_a = msecs_to_jiffies(timeout); | ||
527 | timeout = | ||
528 | be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_2_IDX))); | ||
529 | if (timeout) | ||
530 | chip->vendor.timeout_b = msecs_to_jiffies(timeout); | ||
531 | timeout = | ||
532 | be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_3_IDX))); | ||
533 | if (timeout) | ||
534 | chip->vendor.timeout_c = msecs_to_jiffies(timeout); | ||
535 | timeout = | ||
536 | be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_4_IDX))); | ||
537 | if (timeout) | ||
538 | chip->vendor.timeout_d = msecs_to_jiffies(timeout); | ||
539 | |||
540 | duration: | ||
541 | memcpy(data, tpm_cap, sizeof(tpm_cap)); | ||
542 | data[TPM_CAP_IDX] = TPM_CAP_PROP; | ||
543 | data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_TIS_DURATION; | ||
544 | |||
545 | rc = transmit_cmd(chip, data, sizeof(data), | ||
546 | "attempting to determine the durations"); | ||
547 | if (rc) | ||
548 | return; | ||
549 | |||
550 | if (be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_SIZE_IDX))) | ||
551 | != 3 * sizeof(u32)) | ||
552 | return; | ||
553 | |||
554 | chip->vendor.duration[TPM_SHORT] = | ||
555 | msecs_to_jiffies(be32_to_cpu | ||
556 | (*((__be32 *) (data + | ||
557 | TPM_GET_CAP_RET_UINT32_1_IDX)))); | ||
558 | chip->vendor.duration[TPM_MEDIUM] = | ||
559 | msecs_to_jiffies(be32_to_cpu | ||
560 | (*((__be32 *) (data + | ||
561 | TPM_GET_CAP_RET_UINT32_2_IDX)))); | ||
562 | chip->vendor.duration[TPM_LONG] = | ||
563 | msecs_to_jiffies(be32_to_cpu | ||
564 | (*((__be32 *) (data + | ||
565 | TPM_GET_CAP_RET_UINT32_3_IDX)))); | ||
566 | } | ||
567 | EXPORT_SYMBOL_GPL(tpm_get_timeouts); | ||
568 | |||
569 | void tpm_continue_selftest(struct tpm_chip *chip) | ||
570 | { | ||
571 | u8 data[] = { | ||
572 | 0, 193, /* TPM_TAG_RQU_COMMAND */ | ||
573 | 0, 0, 0, 10, /* length */ | ||
574 | 0, 0, 0, 83, /* TPM_ORD_GetCapability */ | ||
575 | }; | ||
576 | |||
577 | tpm_transmit(chip, data, sizeof(data)); | ||
578 | } | ||
579 | EXPORT_SYMBOL_GPL(tpm_continue_selftest); | ||
580 | |||
581 | ssize_t tpm_show_enabled(struct device * dev, struct device_attribute * attr, | ||
582 | char *buf) | ||
583 | { | ||
584 | u8 data[max_t(int, ARRAY_SIZE(tpm_cap), 35)]; | ||
585 | ssize_t rc; | ||
586 | |||
587 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
588 | if (chip == NULL) | ||
589 | return -ENODEV; | ||
590 | |||
591 | memcpy(data, tpm_cap, sizeof(tpm_cap)); | ||
592 | data[TPM_CAP_IDX] = TPM_CAP_FLAG; | ||
593 | data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_PERM; | ||
594 | |||
595 | rc = transmit_cmd(chip, data, sizeof(data), | ||
596 | "attemtping to determine the permanent state"); | ||
597 | if (rc) | ||
598 | return 0; | ||
599 | return sprintf(buf, "%d\n", !data[TPM_GET_CAP_PERM_DISABLE_IDX]); | ||
600 | } | ||
601 | EXPORT_SYMBOL_GPL(tpm_show_enabled); | ||
602 | |||
603 | ssize_t tpm_show_active(struct device * dev, struct device_attribute * attr, | ||
604 | char *buf) | ||
605 | { | ||
606 | u8 data[max_t(int, ARRAY_SIZE(tpm_cap), 35)]; | ||
607 | ssize_t rc; | ||
608 | |||
609 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
610 | if (chip == NULL) | ||
611 | return -ENODEV; | ||
612 | |||
613 | memcpy(data, tpm_cap, sizeof(tpm_cap)); | ||
614 | data[TPM_CAP_IDX] = TPM_CAP_FLAG; | ||
615 | data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_PERM; | ||
616 | |||
617 | rc = transmit_cmd(chip, data, sizeof(data), | ||
618 | "attemtping to determine the permanent state"); | ||
619 | if (rc) | ||
620 | return 0; | ||
621 | return sprintf(buf, "%d\n", !data[TPM_GET_CAP_PERM_INACTIVE_IDX]); | ||
622 | } | ||
623 | EXPORT_SYMBOL_GPL(tpm_show_active); | ||
624 | |||
625 | ssize_t tpm_show_owned(struct device * dev, struct device_attribute * attr, | ||
626 | char *buf) | ||
627 | { | ||
628 | u8 data[sizeof(tpm_cap)]; | ||
629 | ssize_t rc; | ||
630 | |||
631 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
632 | if (chip == NULL) | ||
633 | return -ENODEV; | ||
634 | |||
635 | memcpy(data, tpm_cap, sizeof(tpm_cap)); | ||
636 | data[TPM_CAP_IDX] = TPM_CAP_PROP; | ||
637 | data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_OWNER; | ||
638 | |||
639 | rc = transmit_cmd(chip, data, sizeof(data), | ||
640 | "attempting to determine the owner state"); | ||
641 | if (rc) | ||
642 | return 0; | ||
643 | return sprintf(buf, "%d\n", data[TPM_GET_CAP_RET_BOOL_1_IDX]); | ||
644 | } | ||
645 | EXPORT_SYMBOL_GPL(tpm_show_owned); | ||
646 | |||
647 | ssize_t tpm_show_temp_deactivated(struct device * dev, | ||
648 | struct device_attribute * attr, char *buf) | ||
649 | { | ||
650 | u8 data[sizeof(tpm_cap)]; | ||
651 | ssize_t rc; | ||
652 | |||
653 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
654 | if (chip == NULL) | ||
655 | return -ENODEV; | ||
656 | |||
657 | memcpy(data, tpm_cap, sizeof(tpm_cap)); | ||
658 | data[TPM_CAP_IDX] = TPM_CAP_FLAG; | ||
659 | data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_VOL; | ||
660 | |||
661 | rc = transmit_cmd(chip, data, sizeof(data), | ||
662 | "attempting to determine the temporary state"); | ||
663 | if (rc) | ||
664 | return 0; | ||
665 | return sprintf(buf, "%d\n", data[TPM_GET_CAP_TEMP_INACTIVE_IDX]); | ||
666 | } | ||
667 | EXPORT_SYMBOL_GPL(tpm_show_temp_deactivated); | ||
668 | |||
133 | static const u8 pcrread[] = { | 669 | static const u8 pcrread[] = { |
134 | 0, 193, /* TPM_TAG_RQU_COMMAND */ | 670 | 0, 193, /* TPM_TAG_RQU_COMMAND */ |
135 | 0, 0, 0, 14, /* length */ | 671 | 0, 0, 0, 14, /* length */ |
@@ -140,8 +676,8 @@ static const u8 pcrread[] = { | |||
140 | ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr, | 676 | ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr, |
141 | char *buf) | 677 | char *buf) |
142 | { | 678 | { |
143 | u8 data[READ_PCR_RESULT_SIZE]; | 679 | u8 data[max_t(int, max(ARRAY_SIZE(tpm_cap), ARRAY_SIZE(pcrread)), 30)]; |
144 | ssize_t len; | 680 | ssize_t rc; |
145 | int i, j, num_pcrs; | 681 | int i, j, num_pcrs; |
146 | __be32 index; | 682 | __be32 index; |
147 | char *str = buf; | 683 | char *str = buf; |
@@ -150,29 +686,24 @@ ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr, | |||
150 | if (chip == NULL) | 686 | if (chip == NULL) |
151 | return -ENODEV; | 687 | return -ENODEV; |
152 | 688 | ||
153 | memcpy(data, cap_pcr, sizeof(cap_pcr)); | 689 | memcpy(data, tpm_cap, sizeof(tpm_cap)); |
154 | if ((len = tpm_transmit(chip, data, sizeof(data))) | 690 | data[TPM_CAP_IDX] = TPM_CAP_PROP; |
155 | < CAP_PCR_RESULT_SIZE) { | 691 | data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_PCR; |
156 | dev_dbg(chip->dev, "A TPM error (%d) occurred " | 692 | |
157 | "attempting to determine the number of PCRS\n", | 693 | rc = transmit_cmd(chip, data, sizeof(data), |
158 | be32_to_cpu(*((__be32 *) (data + 6)))); | 694 | "attempting to determine the number of PCRS"); |
695 | if (rc) | ||
159 | return 0; | 696 | return 0; |
160 | } | ||
161 | 697 | ||
162 | num_pcrs = be32_to_cpu(*((__be32 *) (data + 14))); | 698 | num_pcrs = be32_to_cpu(*((__be32 *) (data + 14))); |
163 | |||
164 | for (i = 0; i < num_pcrs; i++) { | 699 | for (i = 0; i < num_pcrs; i++) { |
165 | memcpy(data, pcrread, sizeof(pcrread)); | 700 | memcpy(data, pcrread, sizeof(pcrread)); |
166 | index = cpu_to_be32(i); | 701 | index = cpu_to_be32(i); |
167 | memcpy(data + 10, &index, 4); | 702 | memcpy(data + 10, &index, 4); |
168 | if ((len = tpm_transmit(chip, data, sizeof(data))) | 703 | rc = transmit_cmd(chip, data, sizeof(data), |
169 | < READ_PCR_RESULT_SIZE){ | 704 | "attempting to read a PCR"); |
170 | dev_dbg(chip->dev, "A TPM error (%d) occurred" | 705 | if (rc) |
171 | " attempting to read PCR %d of %d\n", | ||
172 | be32_to_cpu(*((__be32 *) (data + 6))), | ||
173 | i, num_pcrs); | ||
174 | goto out; | 706 | goto out; |
175 | } | ||
176 | str += sprintf(str, "PCR-%02d: ", i); | 707 | str += sprintf(str, "PCR-%02d: ", i); |
177 | for (j = 0; j < TPM_DIGEST_SIZE; j++) | 708 | for (j = 0; j < TPM_DIGEST_SIZE; j++) |
178 | str += sprintf(str, "%02X ", *(data + 10 + j)); | 709 | str += sprintf(str, "%02X ", *(data + 10 + j)); |
@@ -194,7 +725,7 @@ ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr, | |||
194 | char *buf) | 725 | char *buf) |
195 | { | 726 | { |
196 | u8 *data; | 727 | u8 *data; |
197 | ssize_t len; | 728 | ssize_t err; |
198 | int i, rc; | 729 | int i, rc; |
199 | char *str = buf; | 730 | char *str = buf; |
200 | 731 | ||
@@ -208,14 +739,10 @@ ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr, | |||
208 | 739 | ||
209 | memcpy(data, readpubek, sizeof(readpubek)); | 740 | memcpy(data, readpubek, sizeof(readpubek)); |
210 | 741 | ||
211 | if ((len = tpm_transmit(chip, data, READ_PUBEK_RESULT_SIZE)) < | 742 | err = transmit_cmd(chip, data, READ_PUBEK_RESULT_SIZE, |
212 | READ_PUBEK_RESULT_SIZE) { | 743 | "attempting to read the PUBEK"); |
213 | dev_dbg(chip->dev, "A TPM error (%d) occurred " | 744 | if (err) |
214 | "attempting to read the PUBEK\n", | ||
215 | be32_to_cpu(*((__be32 *) (data + 6)))); | ||
216 | rc = 0; | ||
217 | goto out; | 745 | goto out; |
218 | } | ||
219 | 746 | ||
220 | /* | 747 | /* |
221 | ignore header 10 bytes | 748 | ignore header 10 bytes |
@@ -245,67 +772,110 @@ ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr, | |||
245 | if ((i + 1) % 16 == 0) | 772 | if ((i + 1) % 16 == 0) |
246 | str += sprintf(str, "\n"); | 773 | str += sprintf(str, "\n"); |
247 | } | 774 | } |
248 | rc = str - buf; | ||
249 | out: | 775 | out: |
776 | rc = str - buf; | ||
250 | kfree(data); | 777 | kfree(data); |
251 | return rc; | 778 | return rc; |
252 | } | 779 | } |
253 | EXPORT_SYMBOL_GPL(tpm_show_pubek); | 780 | EXPORT_SYMBOL_GPL(tpm_show_pubek); |
254 | 781 | ||
255 | #define CAP_VER_RESULT_SIZE 18 | 782 | #define CAP_VERSION_1_1 6 |
783 | #define CAP_VERSION_1_2 0x1A | ||
784 | #define CAP_VERSION_IDX 13 | ||
256 | static const u8 cap_version[] = { | 785 | static const u8 cap_version[] = { |
257 | 0, 193, /* TPM_TAG_RQU_COMMAND */ | 786 | 0, 193, /* TPM_TAG_RQU_COMMAND */ |
258 | 0, 0, 0, 18, /* length */ | 787 | 0, 0, 0, 18, /* length */ |
259 | 0, 0, 0, 101, /* TPM_ORD_GetCapability */ | 788 | 0, 0, 0, 101, /* TPM_ORD_GetCapability */ |
260 | 0, 0, 0, 6, | 789 | 0, 0, 0, 0, |
261 | 0, 0, 0, 0 | 790 | 0, 0, 0, 0 |
262 | }; | 791 | }; |
263 | 792 | ||
264 | #define CAP_MANUFACTURER_RESULT_SIZE 18 | ||
265 | static const u8 cap_manufacturer[] = { | ||
266 | 0, 193, /* TPM_TAG_RQU_COMMAND */ | ||
267 | 0, 0, 0, 22, /* length */ | ||
268 | 0, 0, 0, 101, /* TPM_ORD_GetCapability */ | ||
269 | 0, 0, 0, 5, | ||
270 | 0, 0, 0, 4, | ||
271 | 0, 0, 1, 3 | ||
272 | }; | ||
273 | |||
274 | ssize_t tpm_show_caps(struct device *dev, struct device_attribute *attr, | 793 | ssize_t tpm_show_caps(struct device *dev, struct device_attribute *attr, |
275 | char *buf) | 794 | char *buf) |
276 | { | 795 | { |
277 | u8 data[sizeof(cap_manufacturer)]; | 796 | u8 data[max_t(int, max(ARRAY_SIZE(tpm_cap), ARRAY_SIZE(cap_version)), 30)]; |
278 | ssize_t len; | 797 | ssize_t rc; |
279 | char *str = buf; | 798 | char *str = buf; |
280 | 799 | ||
281 | struct tpm_chip *chip = dev_get_drvdata(dev); | 800 | struct tpm_chip *chip = dev_get_drvdata(dev); |
282 | if (chip == NULL) | 801 | if (chip == NULL) |
283 | return -ENODEV; | 802 | return -ENODEV; |
284 | 803 | ||
285 | memcpy(data, cap_manufacturer, sizeof(cap_manufacturer)); | 804 | memcpy(data, tpm_cap, sizeof(tpm_cap)); |
805 | data[TPM_CAP_IDX] = TPM_CAP_PROP; | ||
806 | data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_MANUFACTURER; | ||
286 | 807 | ||
287 | if ((len = tpm_transmit(chip, data, sizeof(data))) < | 808 | rc = transmit_cmd(chip, data, sizeof(data), |
288 | CAP_MANUFACTURER_RESULT_SIZE) | 809 | "attempting to determine the manufacturer"); |
289 | return len; | 810 | if (rc) |
811 | return 0; | ||
290 | 812 | ||
291 | str += sprintf(str, "Manufacturer: 0x%x\n", | 813 | str += sprintf(str, "Manufacturer: 0x%x\n", |
292 | be32_to_cpu(*((__be32 *) (data + 14)))); | 814 | be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX)))); |
293 | 815 | ||
294 | memcpy(data, cap_version, sizeof(cap_version)); | 816 | memcpy(data, cap_version, sizeof(cap_version)); |
817 | data[CAP_VERSION_IDX] = CAP_VERSION_1_1; | ||
818 | rc = transmit_cmd(chip, data, sizeof(data), | ||
819 | "attempting to determine the 1.1 version"); | ||
820 | if (rc) | ||
821 | goto out; | ||
295 | 822 | ||
296 | if ((len = tpm_transmit(chip, data, sizeof(data))) < | 823 | str += sprintf(str, |
297 | CAP_VER_RESULT_SIZE) | 824 | "TCG version: %d.%d\nFirmware version: %d.%d\n", |
298 | return len; | 825 | (int) data[14], (int) data[15], (int) data[16], |
299 | 826 | (int) data[17]); | |
300 | str += | ||
301 | sprintf(str, "TCG version: %d.%d\nFirmware version: %d.%d\n", | ||
302 | (int) data[14], (int) data[15], (int) data[16], | ||
303 | (int) data[17]); | ||
304 | 827 | ||
828 | out: | ||
305 | return str - buf; | 829 | return str - buf; |
306 | } | 830 | } |
307 | EXPORT_SYMBOL_GPL(tpm_show_caps); | 831 | EXPORT_SYMBOL_GPL(tpm_show_caps); |
308 | 832 | ||
833 | ssize_t tpm_show_caps_1_2(struct device * dev, | ||
834 | struct device_attribute * attr, char *buf) | ||
835 | { | ||
836 | u8 data[max_t(int, max(ARRAY_SIZE(tpm_cap), ARRAY_SIZE(cap_version)), 30)]; | ||
837 | ssize_t len; | ||
838 | char *str = buf; | ||
839 | |||
840 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
841 | if (chip == NULL) | ||
842 | return -ENODEV; | ||
843 | |||
844 | memcpy(data, tpm_cap, sizeof(tpm_cap)); | ||
845 | data[TPM_CAP_IDX] = TPM_CAP_PROP; | ||
846 | data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_MANUFACTURER; | ||
847 | |||
848 | if ((len = tpm_transmit(chip, data, sizeof(data))) <= | ||
849 | TPM_ERROR_SIZE) { | ||
850 | dev_dbg(chip->dev, "A TPM error (%d) occurred " | ||
851 | "attempting to determine the manufacturer\n", | ||
852 | be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX)))); | ||
853 | return 0; | ||
854 | } | ||
855 | |||
856 | str += sprintf(str, "Manufacturer: 0x%x\n", | ||
857 | be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX)))); | ||
858 | |||
859 | memcpy(data, cap_version, sizeof(cap_version)); | ||
860 | data[CAP_VERSION_IDX] = CAP_VERSION_1_2; | ||
861 | |||
862 | if ((len = tpm_transmit(chip, data, sizeof(data))) <= | ||
863 | TPM_ERROR_SIZE) { | ||
864 | dev_err(chip->dev, "A TPM error (%d) occurred " | ||
865 | "attempting to determine the 1.2 version\n", | ||
866 | be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX)))); | ||
867 | goto out; | ||
868 | } | ||
869 | str += sprintf(str, | ||
870 | "TCG version: %d.%d\nFirmware version: %d.%d\n", | ||
871 | (int) data[16], (int) data[17], (int) data[18], | ||
872 | (int) data[19]); | ||
873 | |||
874 | out: | ||
875 | return str - buf; | ||
876 | } | ||
877 | EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); | ||
878 | |||
309 | ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, | 879 | ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, |
310 | const char *buf, size_t count) | 880 | const char *buf, size_t count) |
311 | { | 881 | { |
@@ -313,7 +883,7 @@ ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, | |||
313 | if (chip == NULL) | 883 | if (chip == NULL) |
314 | return 0; | 884 | return 0; |
315 | 885 | ||
316 | chip->vendor->cancel(chip); | 886 | chip->vendor.cancel(chip); |
317 | return count; | 887 | return count; |
318 | } | 888 | } |
319 | EXPORT_SYMBOL_GPL(tpm_store_cancel); | 889 | EXPORT_SYMBOL_GPL(tpm_store_cancel); |
@@ -329,7 +899,7 @@ int tpm_open(struct inode *inode, struct file *file) | |||
329 | spin_lock(&driver_lock); | 899 | spin_lock(&driver_lock); |
330 | 900 | ||
331 | list_for_each_entry(pos, &tpm_chip_list, list) { | 901 | list_for_each_entry(pos, &tpm_chip_list, list) { |
332 | if (pos->vendor->miscdev.minor == minor) { | 902 | if (pos->vendor.miscdev.minor == minor) { |
333 | chip = pos; | 903 | chip = pos; |
334 | break; | 904 | break; |
335 | } | 905 | } |
@@ -387,7 +957,7 @@ int tpm_release(struct inode *inode, struct file *file) | |||
387 | EXPORT_SYMBOL_GPL(tpm_release); | 957 | EXPORT_SYMBOL_GPL(tpm_release); |
388 | 958 | ||
389 | ssize_t tpm_write(struct file *file, const char __user *buf, | 959 | ssize_t tpm_write(struct file *file, const char __user *buf, |
390 | size_t size, loff_t * off) | 960 | size_t size, loff_t *off) |
391 | { | 961 | { |
392 | struct tpm_chip *chip = file->private_data; | 962 | struct tpm_chip *chip = file->private_data; |
393 | int in_size = size, out_size; | 963 | int in_size = size, out_size; |
@@ -419,11 +989,10 @@ ssize_t tpm_write(struct file *file, const char __user *buf, | |||
419 | 989 | ||
420 | return in_size; | 990 | return in_size; |
421 | } | 991 | } |
422 | |||
423 | EXPORT_SYMBOL_GPL(tpm_write); | 992 | EXPORT_SYMBOL_GPL(tpm_write); |
424 | 993 | ||
425 | ssize_t tpm_read(struct file * file, char __user *buf, | 994 | ssize_t tpm_read(struct file *file, char __user *buf, |
426 | size_t size, loff_t * off) | 995 | size_t size, loff_t *off) |
427 | { | 996 | { |
428 | struct tpm_chip *chip = file->private_data; | 997 | struct tpm_chip *chip = file->private_data; |
429 | int ret_size; | 998 | int ret_size; |
@@ -462,14 +1031,13 @@ void tpm_remove_hardware(struct device *dev) | |||
462 | spin_unlock(&driver_lock); | 1031 | spin_unlock(&driver_lock); |
463 | 1032 | ||
464 | dev_set_drvdata(dev, NULL); | 1033 | dev_set_drvdata(dev, NULL); |
465 | misc_deregister(&chip->vendor->miscdev); | 1034 | misc_deregister(&chip->vendor.miscdev); |
466 | kfree(chip->vendor->miscdev.name); | 1035 | kfree(chip->vendor.miscdev.name); |
467 | 1036 | ||
468 | sysfs_remove_group(&dev->kobj, chip->vendor->attr_group); | 1037 | sysfs_remove_group(&dev->kobj, chip->vendor.attr_group); |
469 | tpm_bios_log_teardown(chip->bios_dir); | 1038 | tpm_bios_log_teardown(chip->bios_dir); |
470 | 1039 | ||
471 | dev_mask[chip->dev_num / TPM_NUM_MASK_ENTRIES ] &= | 1040 | clear_bit(chip->dev_num, dev_mask); |
472 | ~(1 << (chip->dev_num % TPM_NUM_MASK_ENTRIES)); | ||
473 | 1041 | ||
474 | kfree(chip); | 1042 | kfree(chip); |
475 | 1043 | ||
@@ -520,18 +1088,18 @@ EXPORT_SYMBOL_GPL(tpm_pm_resume); | |||
520 | * upon errant exit from this function specific probe function should call | 1088 | * upon errant exit from this function specific probe function should call |
521 | * pci_disable_device | 1089 | * pci_disable_device |
522 | */ | 1090 | */ |
523 | int tpm_register_hardware(struct device *dev, struct tpm_vendor_specific *entry) | 1091 | struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vendor_specific |
1092 | *entry) | ||
524 | { | 1093 | { |
525 | #define DEVNAME_SIZE 7 | 1094 | #define DEVNAME_SIZE 7 |
526 | 1095 | ||
527 | char *devname; | 1096 | char *devname; |
528 | struct tpm_chip *chip; | 1097 | struct tpm_chip *chip; |
529 | int i, j; | ||
530 | 1098 | ||
531 | /* Driver specific per-device data */ | 1099 | /* Driver specific per-device data */ |
532 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 1100 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
533 | if (chip == NULL) | 1101 | if (chip == NULL) |
534 | return -ENOMEM; | 1102 | return NULL; |
535 | 1103 | ||
536 | init_MUTEX(&chip->buffer_mutex); | 1104 | init_MUTEX(&chip->buffer_mutex); |
537 | init_MUTEX(&chip->tpm_mutex); | 1105 | init_MUTEX(&chip->tpm_mutex); |
@@ -543,45 +1111,37 @@ int tpm_register_hardware(struct device *dev, struct tpm_vendor_specific *entry) | |||
543 | chip->user_read_timer.function = user_reader_timeout; | 1111 | chip->user_read_timer.function = user_reader_timeout; |
544 | chip->user_read_timer.data = (unsigned long) chip; | 1112 | chip->user_read_timer.data = (unsigned long) chip; |
545 | 1113 | ||
546 | chip->vendor = entry; | 1114 | memcpy(&chip->vendor, entry, sizeof(struct tpm_vendor_specific)); |
547 | |||
548 | chip->dev_num = -1; | ||
549 | 1115 | ||
550 | for (i = 0; i < TPM_NUM_MASK_ENTRIES; i++) | 1116 | chip->dev_num = find_first_zero_bit(dev_mask, TPM_NUM_DEVICES); |
551 | for (j = 0; j < 8 * sizeof(int); j++) | ||
552 | if ((dev_mask[i] & (1 << j)) == 0) { | ||
553 | chip->dev_num = | ||
554 | i * TPM_NUM_MASK_ENTRIES + j; | ||
555 | dev_mask[i] |= 1 << j; | ||
556 | goto dev_num_search_complete; | ||
557 | } | ||
558 | 1117 | ||
559 | dev_num_search_complete: | 1118 | if (chip->dev_num >= TPM_NUM_DEVICES) { |
560 | if (chip->dev_num < 0) { | ||
561 | dev_err(dev, "No available tpm device numbers\n"); | 1119 | dev_err(dev, "No available tpm device numbers\n"); |
562 | kfree(chip); | 1120 | kfree(chip); |
563 | return -ENODEV; | 1121 | return NULL; |
564 | } else if (chip->dev_num == 0) | 1122 | } else if (chip->dev_num == 0) |
565 | chip->vendor->miscdev.minor = TPM_MINOR; | 1123 | chip->vendor.miscdev.minor = TPM_MINOR; |
566 | else | 1124 | else |
567 | chip->vendor->miscdev.minor = MISC_DYNAMIC_MINOR; | 1125 | chip->vendor.miscdev.minor = MISC_DYNAMIC_MINOR; |
1126 | |||
1127 | set_bit(chip->dev_num, dev_mask); | ||
568 | 1128 | ||
569 | devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL); | 1129 | devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL); |
570 | scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); | 1130 | scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); |
571 | chip->vendor->miscdev.name = devname; | 1131 | chip->vendor.miscdev.name = devname; |
572 | 1132 | ||
573 | chip->vendor->miscdev.dev = dev; | 1133 | chip->vendor.miscdev.dev = dev; |
574 | chip->dev = get_device(dev); | 1134 | chip->dev = get_device(dev); |
575 | 1135 | ||
576 | if (misc_register(&chip->vendor->miscdev)) { | 1136 | if (misc_register(&chip->vendor.miscdev)) { |
577 | dev_err(chip->dev, | 1137 | dev_err(chip->dev, |
578 | "unable to misc_register %s, minor %d\n", | 1138 | "unable to misc_register %s, minor %d\n", |
579 | chip->vendor->miscdev.name, | 1139 | chip->vendor.miscdev.name, |
580 | chip->vendor->miscdev.minor); | 1140 | chip->vendor.miscdev.minor); |
581 | put_device(dev); | 1141 | put_device(dev); |
1142 | clear_bit(chip->dev_num, dev_mask); | ||
582 | kfree(chip); | 1143 | kfree(chip); |
583 | dev_mask[i] &= !(1 << j); | 1144 | return NULL; |
584 | return -ENODEV; | ||
585 | } | 1145 | } |
586 | 1146 | ||
587 | spin_lock(&driver_lock); | 1147 | spin_lock(&driver_lock); |
@@ -592,11 +1152,11 @@ dev_num_search_complete: | |||
592 | 1152 | ||
593 | spin_unlock(&driver_lock); | 1153 | spin_unlock(&driver_lock); |
594 | 1154 | ||
595 | sysfs_create_group(&dev->kobj, chip->vendor->attr_group); | 1155 | sysfs_create_group(&dev->kobj, chip->vendor.attr_group); |
596 | 1156 | ||
597 | chip->bios_dir = tpm_bios_log_setup(devname); | 1157 | chip->bios_dir = tpm_bios_log_setup(devname); |
598 | 1158 | ||
599 | return 0; | 1159 | return chip; |
600 | } | 1160 | } |
601 | EXPORT_SYMBOL_GPL(tpm_register_hardware); | 1161 | EXPORT_SYMBOL_GPL(tpm_register_hardware); |
602 | 1162 | ||
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index dec0224b4478..54a4c804e25f 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -42,18 +42,30 @@ extern ssize_t tpm_show_pcrs(struct device *, struct device_attribute *attr, | |||
42 | char *); | 42 | char *); |
43 | extern ssize_t tpm_show_caps(struct device *, struct device_attribute *attr, | 43 | extern ssize_t tpm_show_caps(struct device *, struct device_attribute *attr, |
44 | char *); | 44 | char *); |
45 | extern ssize_t tpm_show_caps_1_2(struct device *, struct device_attribute *attr, | ||
46 | char *); | ||
45 | extern ssize_t tpm_store_cancel(struct device *, struct device_attribute *attr, | 47 | extern ssize_t tpm_store_cancel(struct device *, struct device_attribute *attr, |
46 | const char *, size_t); | 48 | const char *, size_t); |
49 | extern ssize_t tpm_show_enabled(struct device *, struct device_attribute *attr, | ||
50 | char *); | ||
51 | extern ssize_t tpm_show_active(struct device *, struct device_attribute *attr, | ||
52 | char *); | ||
53 | extern ssize_t tpm_show_owned(struct device *, struct device_attribute *attr, | ||
54 | char *); | ||
55 | extern ssize_t tpm_show_temp_deactivated(struct device *, | ||
56 | struct device_attribute *attr, char *); | ||
47 | 57 | ||
48 | struct tpm_chip; | 58 | struct tpm_chip; |
49 | 59 | ||
50 | struct tpm_vendor_specific { | 60 | struct tpm_vendor_specific { |
51 | u8 req_complete_mask; | 61 | const u8 req_complete_mask; |
52 | u8 req_complete_val; | 62 | const u8 req_complete_val; |
53 | u8 req_canceled; | 63 | const u8 req_canceled; |
54 | void __iomem *iobase; /* ioremapped address */ | 64 | void __iomem *iobase; /* ioremapped address */ |
55 | unsigned long base; /* TPM base address */ | 65 | unsigned long base; /* TPM base address */ |
56 | 66 | ||
67 | int irq; | ||
68 | |||
57 | int region_size; | 69 | int region_size; |
58 | int have_region; | 70 | int have_region; |
59 | 71 | ||
@@ -63,6 +75,13 @@ struct tpm_vendor_specific { | |||
63 | u8 (*status) (struct tpm_chip *); | 75 | u8 (*status) (struct tpm_chip *); |
64 | struct miscdevice miscdev; | 76 | struct miscdevice miscdev; |
65 | struct attribute_group *attr_group; | 77 | struct attribute_group *attr_group; |
78 | struct list_head list; | ||
79 | int locality; | ||
80 | unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* jiffies */ | ||
81 | unsigned long duration[3]; /* jiffies */ | ||
82 | |||
83 | wait_queue_head_t read_queue; | ||
84 | wait_queue_head_t int_queue; | ||
66 | }; | 85 | }; |
67 | 86 | ||
68 | struct tpm_chip { | 87 | struct tpm_chip { |
@@ -81,13 +100,15 @@ struct tpm_chip { | |||
81 | struct work_struct work; | 100 | struct work_struct work; |
82 | struct semaphore tpm_mutex; /* tpm is processing */ | 101 | struct semaphore tpm_mutex; /* tpm is processing */ |
83 | 102 | ||
84 | struct tpm_vendor_specific *vendor; | 103 | struct tpm_vendor_specific vendor; |
85 | 104 | ||
86 | struct dentry **bios_dir; | 105 | struct dentry **bios_dir; |
87 | 106 | ||
88 | struct list_head list; | 107 | struct list_head list; |
89 | }; | 108 | }; |
90 | 109 | ||
110 | #define to_tpm_chip(n) container_of(n, struct tpm_chip, vendor) | ||
111 | |||
91 | static inline int tpm_read_index(int base, int index) | 112 | static inline int tpm_read_index(int base, int index) |
92 | { | 113 | { |
93 | outb(index, base); | 114 | outb(index, base); |
@@ -100,8 +121,12 @@ static inline void tpm_write_index(int base, int index, int value) | |||
100 | outb(value & 0xFF, base+1); | 121 | outb(value & 0xFF, base+1); |
101 | } | 122 | } |
102 | 123 | ||
103 | extern int tpm_register_hardware(struct device *, | 124 | extern void tpm_get_timeouts(struct tpm_chip *); |
104 | struct tpm_vendor_specific *); | 125 | extern void tpm_gen_interrupt(struct tpm_chip *); |
126 | extern void tpm_continue_selftest(struct tpm_chip *); | ||
127 | extern unsigned long tpm_calc_ordinal_duration(struct tpm_chip *, u32); | ||
128 | extern struct tpm_chip* tpm_register_hardware(struct device *, | ||
129 | const struct tpm_vendor_specific *); | ||
105 | extern int tpm_open(struct inode *, struct file *); | 130 | extern int tpm_open(struct inode *, struct file *); |
106 | extern int tpm_release(struct inode *, struct file *); | 131 | extern int tpm_release(struct inode *, struct file *); |
107 | extern ssize_t tpm_write(struct file *, const char __user *, size_t, | 132 | extern ssize_t tpm_write(struct file *, const char __user *, size_t, |
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c index ff3654964fe3..58a258cec153 100644 --- a/drivers/char/tpm/tpm_atmel.c +++ b/drivers/char/tpm/tpm_atmel.c | |||
@@ -47,12 +47,12 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) | |||
47 | return -EIO; | 47 | return -EIO; |
48 | 48 | ||
49 | for (i = 0; i < 6; i++) { | 49 | for (i = 0; i < 6; i++) { |
50 | status = ioread8(chip->vendor->iobase + 1); | 50 | status = ioread8(chip->vendor.iobase + 1); |
51 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { | 51 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { |
52 | dev_err(chip->dev, "error reading header\n"); | 52 | dev_err(chip->dev, "error reading header\n"); |
53 | return -EIO; | 53 | return -EIO; |
54 | } | 54 | } |
55 | *buf++ = ioread8(chip->vendor->iobase); | 55 | *buf++ = ioread8(chip->vendor.iobase); |
56 | } | 56 | } |
57 | 57 | ||
58 | /* size of the data received */ | 58 | /* size of the data received */ |
@@ -63,7 +63,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) | |||
63 | dev_err(chip->dev, | 63 | dev_err(chip->dev, |
64 | "Recv size(%d) less than available space\n", size); | 64 | "Recv size(%d) less than available space\n", size); |
65 | for (; i < size; i++) { /* clear the waiting data anyway */ | 65 | for (; i < size; i++) { /* clear the waiting data anyway */ |
66 | status = ioread8(chip->vendor->iobase + 1); | 66 | status = ioread8(chip->vendor.iobase + 1); |
67 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { | 67 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { |
68 | dev_err(chip->dev, "error reading data\n"); | 68 | dev_err(chip->dev, "error reading data\n"); |
69 | return -EIO; | 69 | return -EIO; |
@@ -74,16 +74,16 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) | |||
74 | 74 | ||
75 | /* read all the data available */ | 75 | /* read all the data available */ |
76 | for (; i < size; i++) { | 76 | for (; i < size; i++) { |
77 | status = ioread8(chip->vendor->iobase + 1); | 77 | status = ioread8(chip->vendor.iobase + 1); |
78 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { | 78 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { |
79 | dev_err(chip->dev, "error reading data\n"); | 79 | dev_err(chip->dev, "error reading data\n"); |
80 | return -EIO; | 80 | return -EIO; |
81 | } | 81 | } |
82 | *buf++ = ioread8(chip->vendor->iobase); | 82 | *buf++ = ioread8(chip->vendor.iobase); |
83 | } | 83 | } |
84 | 84 | ||
85 | /* make sure data available is gone */ | 85 | /* make sure data available is gone */ |
86 | status = ioread8(chip->vendor->iobase + 1); | 86 | status = ioread8(chip->vendor.iobase + 1); |
87 | 87 | ||
88 | if (status & ATML_STATUS_DATA_AVAIL) { | 88 | if (status & ATML_STATUS_DATA_AVAIL) { |
89 | dev_err(chip->dev, "data available is stuck\n"); | 89 | dev_err(chip->dev, "data available is stuck\n"); |
@@ -100,7 +100,7 @@ static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) | |||
100 | dev_dbg(chip->dev, "tpm_atml_send:\n"); | 100 | dev_dbg(chip->dev, "tpm_atml_send:\n"); |
101 | for (i = 0; i < count; i++) { | 101 | for (i = 0; i < count; i++) { |
102 | dev_dbg(chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); | 102 | dev_dbg(chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); |
103 | iowrite8(buf[i], chip->vendor->iobase); | 103 | iowrite8(buf[i], chip->vendor.iobase); |
104 | } | 104 | } |
105 | 105 | ||
106 | return count; | 106 | return count; |
@@ -108,12 +108,12 @@ static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) | |||
108 | 108 | ||
109 | static void tpm_atml_cancel(struct tpm_chip *chip) | 109 | static void tpm_atml_cancel(struct tpm_chip *chip) |
110 | { | 110 | { |
111 | iowrite8(ATML_STATUS_ABORT, chip->vendor->iobase + 1); | 111 | iowrite8(ATML_STATUS_ABORT, chip->vendor.iobase + 1); |
112 | } | 112 | } |
113 | 113 | ||
114 | static u8 tpm_atml_status(struct tpm_chip *chip) | 114 | static u8 tpm_atml_status(struct tpm_chip *chip) |
115 | { | 115 | { |
116 | return ioread8(chip->vendor->iobase + 1); | 116 | return ioread8(chip->vendor.iobase + 1); |
117 | } | 117 | } |
118 | 118 | ||
119 | static struct file_operations atmel_ops = { | 119 | static struct file_operations atmel_ops = { |
@@ -140,7 +140,7 @@ static struct attribute* atmel_attrs[] = { | |||
140 | 140 | ||
141 | static struct attribute_group atmel_attr_grp = { .attrs = atmel_attrs }; | 141 | static struct attribute_group atmel_attr_grp = { .attrs = atmel_attrs }; |
142 | 142 | ||
143 | static struct tpm_vendor_specific tpm_atmel = { | 143 | static const struct tpm_vendor_specific tpm_atmel = { |
144 | .recv = tpm_atml_recv, | 144 | .recv = tpm_atml_recv, |
145 | .send = tpm_atml_send, | 145 | .send = tpm_atml_send, |
146 | .cancel = tpm_atml_cancel, | 146 | .cancel = tpm_atml_cancel, |
@@ -159,10 +159,10 @@ static void atml_plat_remove(void) | |||
159 | struct tpm_chip *chip = dev_get_drvdata(&pdev->dev); | 159 | struct tpm_chip *chip = dev_get_drvdata(&pdev->dev); |
160 | 160 | ||
161 | if (chip) { | 161 | if (chip) { |
162 | if (chip->vendor->have_region) | 162 | if (chip->vendor.have_region) |
163 | atmel_release_region(chip->vendor->base, | 163 | atmel_release_region(chip->vendor.base, |
164 | chip->vendor->region_size); | 164 | chip->vendor.region_size); |
165 | atmel_put_base_addr(chip->vendor); | 165 | atmel_put_base_addr(chip->vendor.iobase); |
166 | tpm_remove_hardware(chip->dev); | 166 | tpm_remove_hardware(chip->dev); |
167 | platform_device_unregister(pdev); | 167 | platform_device_unregister(pdev); |
168 | } | 168 | } |
@@ -179,18 +179,22 @@ static struct device_driver atml_drv = { | |||
179 | static int __init init_atmel(void) | 179 | static int __init init_atmel(void) |
180 | { | 180 | { |
181 | int rc = 0; | 181 | int rc = 0; |
182 | void __iomem *iobase = NULL; | ||
183 | int have_region, region_size; | ||
184 | unsigned long base; | ||
185 | struct tpm_chip *chip; | ||
182 | 186 | ||
183 | driver_register(&atml_drv); | 187 | driver_register(&atml_drv); |
184 | 188 | ||
185 | if ((tpm_atmel.iobase = atmel_get_base_addr(&tpm_atmel)) == NULL) { | 189 | if ((iobase = atmel_get_base_addr(&base, ®ion_size)) == NULL) { |
186 | rc = -ENODEV; | 190 | rc = -ENODEV; |
187 | goto err_unreg_drv; | 191 | goto err_unreg_drv; |
188 | } | 192 | } |
189 | 193 | ||
190 | tpm_atmel.have_region = | 194 | have_region = |
191 | (atmel_request_region | 195 | (atmel_request_region |
192 | (tpm_atmel.base, tpm_atmel.region_size, | 196 | (tpm_atmel.base, region_size, "tpm_atmel0") == NULL) ? 0 : 1; |
193 | "tpm_atmel0") == NULL) ? 0 : 1; | 197 | |
194 | 198 | ||
195 | if (IS_ERR | 199 | if (IS_ERR |
196 | (pdev = | 200 | (pdev = |
@@ -199,17 +203,25 @@ static int __init init_atmel(void) | |||
199 | goto err_rel_reg; | 203 | goto err_rel_reg; |
200 | } | 204 | } |
201 | 205 | ||
202 | if ((rc = tpm_register_hardware(&pdev->dev, &tpm_atmel)) < 0) | 206 | if (!(chip = tpm_register_hardware(&pdev->dev, &tpm_atmel))) { |
207 | rc = -ENODEV; | ||
203 | goto err_unreg_dev; | 208 | goto err_unreg_dev; |
209 | } | ||
210 | |||
211 | chip->vendor.iobase = iobase; | ||
212 | chip->vendor.base = base; | ||
213 | chip->vendor.have_region = have_region; | ||
214 | chip->vendor.region_size = region_size; | ||
215 | |||
204 | return 0; | 216 | return 0; |
205 | 217 | ||
206 | err_unreg_dev: | 218 | err_unreg_dev: |
207 | platform_device_unregister(pdev); | 219 | platform_device_unregister(pdev); |
208 | err_rel_reg: | 220 | err_rel_reg: |
209 | atmel_put_base_addr(&tpm_atmel); | 221 | atmel_put_base_addr(iobase); |
210 | if (tpm_atmel.have_region) | 222 | if (have_region) |
211 | atmel_release_region(tpm_atmel.base, | 223 | atmel_release_region(base, |
212 | tpm_atmel.region_size); | 224 | region_size); |
213 | err_unreg_drv: | 225 | err_unreg_drv: |
214 | driver_unregister(&atml_drv); | 226 | driver_unregister(&atml_drv); |
215 | return rc; | 227 | return rc; |
diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h index d3478aaadd77..2e68eeb8a2cd 100644 --- a/drivers/char/tpm/tpm_atmel.h +++ b/drivers/char/tpm/tpm_atmel.h | |||
@@ -28,13 +28,12 @@ | |||
28 | #define atmel_request_region request_mem_region | 28 | #define atmel_request_region request_mem_region |
29 | #define atmel_release_region release_mem_region | 29 | #define atmel_release_region release_mem_region |
30 | 30 | ||
31 | static inline void atmel_put_base_addr(struct tpm_vendor_specific | 31 | static inline void atmel_put_base_addr(void __iomem *iobase) |
32 | *vendor) | ||
33 | { | 32 | { |
34 | iounmap(vendor->iobase); | 33 | iounmap(iobase); |
35 | } | 34 | } |
36 | 35 | ||
37 | static void __iomem * atmel_get_base_addr(struct tpm_vendor_specific *vendor) | 36 | static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size) |
38 | { | 37 | { |
39 | struct device_node *dn; | 38 | struct device_node *dn; |
40 | unsigned long address, size; | 39 | unsigned long address, size; |
@@ -71,9 +70,9 @@ static void __iomem * atmel_get_base_addr(struct tpm_vendor_specific *vendor) | |||
71 | else | 70 | else |
72 | size = reg[naddrc]; | 71 | size = reg[naddrc]; |
73 | 72 | ||
74 | vendor->base = address; | 73 | *base = address; |
75 | vendor->region_size = size; | 74 | *region_size = size; |
76 | return ioremap(vendor->base, vendor->region_size); | 75 | return ioremap(*base, *region_size); |
77 | } | 76 | } |
78 | #else | 77 | #else |
79 | #define atmel_getb(chip, offset) inb(chip->vendor->base + offset) | 78 | #define atmel_getb(chip, offset) inb(chip->vendor->base + offset) |
@@ -106,14 +105,12 @@ static int atmel_verify_tpm11(void) | |||
106 | return 0; | 105 | return 0; |
107 | } | 106 | } |
108 | 107 | ||
109 | static inline void atmel_put_base_addr(struct tpm_vendor_specific | 108 | static inline void atmel_put_base_addr(void __iomem *iobase) |
110 | *vendor) | ||
111 | { | 109 | { |
112 | } | 110 | } |
113 | 111 | ||
114 | /* Determine where to talk to device */ | 112 | /* Determine where to talk to device */ |
115 | static void __iomem * atmel_get_base_addr(struct tpm_vendor_specific | 113 | static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size) |
116 | *vendor) | ||
117 | { | 114 | { |
118 | int lo, hi; | 115 | int lo, hi; |
119 | 116 | ||
@@ -123,9 +120,9 @@ static void __iomem * atmel_get_base_addr(struct tpm_vendor_specific | |||
123 | lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO); | 120 | lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO); |
124 | hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI); | 121 | hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI); |
125 | 122 | ||
126 | vendor->base = (hi << 8) | lo; | 123 | *base = (hi << 8) | lo; |
127 | vendor->region_size = 2; | 124 | *region_size = 2; |
128 | 125 | ||
129 | return ioport_map(vendor->base, vendor->region_size); | 126 | return ioport_map(*base, *region_size); |
130 | } | 127 | } |
131 | #endif | 128 | #endif |
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c index 537aa45d8c67..e45f0d3d12de 100644 --- a/drivers/char/tpm/tpm_bios.c +++ b/drivers/char/tpm/tpm_bios.c | |||
@@ -29,6 +29,11 @@ | |||
29 | #define MAX_TEXT_EVENT 1000 /* Max event string length */ | 29 | #define MAX_TEXT_EVENT 1000 /* Max event string length */ |
30 | #define ACPI_TCPA_SIG "TCPA" /* 0x41504354 /'TCPA' */ | 30 | #define ACPI_TCPA_SIG "TCPA" /* 0x41504354 /'TCPA' */ |
31 | 31 | ||
32 | enum bios_platform_class { | ||
33 | BIOS_CLIENT = 0x00, | ||
34 | BIOS_SERVER = 0x01, | ||
35 | }; | ||
36 | |||
32 | struct tpm_bios_log { | 37 | struct tpm_bios_log { |
33 | void *bios_event_log; | 38 | void *bios_event_log; |
34 | void *bios_event_log_end; | 39 | void *bios_event_log_end; |
@@ -36,9 +41,18 @@ struct tpm_bios_log { | |||
36 | 41 | ||
37 | struct acpi_tcpa { | 42 | struct acpi_tcpa { |
38 | struct acpi_table_header hdr; | 43 | struct acpi_table_header hdr; |
39 | u16 reserved; | 44 | u16 platform_class; |
40 | u32 log_max_len __attribute__ ((packed)); | 45 | union { |
41 | u32 log_start_addr __attribute__ ((packed)); | 46 | struct client_hdr { |
47 | u32 log_max_len __attribute__ ((packed)); | ||
48 | u64 log_start_addr __attribute__ ((packed)); | ||
49 | } client; | ||
50 | struct server_hdr { | ||
51 | u16 reserved; | ||
52 | u64 log_max_len __attribute__ ((packed)); | ||
53 | u64 log_start_addr __attribute__ ((packed)); | ||
54 | } server; | ||
55 | }; | ||
42 | }; | 56 | }; |
43 | 57 | ||
44 | struct tcpa_event { | 58 | struct tcpa_event { |
@@ -120,6 +134,7 @@ static const char* tcpa_pc_event_id_strings[] = { | |||
120 | "S-CRTM Version", | 134 | "S-CRTM Version", |
121 | "S-CRTM Contents", | 135 | "S-CRTM Contents", |
122 | "S-CRTM POST Contents", | 136 | "S-CRTM POST Contents", |
137 | "POST Contents", | ||
123 | }; | 138 | }; |
124 | 139 | ||
125 | /* returns pointer to start of pos. entry of tcg log */ | 140 | /* returns pointer to start of pos. entry of tcg log */ |
@@ -306,6 +321,7 @@ static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v) | |||
306 | /* 5th: delimiter */ | 321 | /* 5th: delimiter */ |
307 | seq_putc(m, '\0'); | 322 | seq_putc(m, '\0'); |
308 | 323 | ||
324 | kfree(eventname); | ||
309 | return 0; | 325 | return 0; |
310 | } | 326 | } |
311 | 327 | ||
@@ -353,6 +369,7 @@ static int tpm_ascii_bios_measurements_show(struct seq_file *m, void *v) | |||
353 | /* 4th: eventname <= max + \'0' delimiter */ | 369 | /* 4th: eventname <= max + \'0' delimiter */ |
354 | seq_printf(m, " %s\n", eventname); | 370 | seq_printf(m, " %s\n", eventname); |
355 | 371 | ||
372 | kfree(eventname); | ||
356 | return 0; | 373 | return 0; |
357 | } | 374 | } |
358 | 375 | ||
@@ -376,6 +393,7 @@ static int read_log(struct tpm_bios_log *log) | |||
376 | struct acpi_tcpa *buff; | 393 | struct acpi_tcpa *buff; |
377 | acpi_status status; | 394 | acpi_status status; |
378 | struct acpi_table_header *virt; | 395 | struct acpi_table_header *virt; |
396 | u64 len, start; | ||
379 | 397 | ||
380 | if (log->bios_event_log != NULL) { | 398 | if (log->bios_event_log != NULL) { |
381 | printk(KERN_ERR | 399 | printk(KERN_ERR |
@@ -396,27 +414,37 @@ static int read_log(struct tpm_bios_log *log) | |||
396 | return -EIO; | 414 | return -EIO; |
397 | } | 415 | } |
398 | 416 | ||
399 | if (buff->log_max_len == 0) { | 417 | switch(buff->platform_class) { |
418 | case BIOS_SERVER: | ||
419 | len = buff->server.log_max_len; | ||
420 | start = buff->server.log_start_addr; | ||
421 | break; | ||
422 | case BIOS_CLIENT: | ||
423 | default: | ||
424 | len = buff->client.log_max_len; | ||
425 | start = buff->client.log_start_addr; | ||
426 | break; | ||
427 | } | ||
428 | if (!len) { | ||
400 | printk(KERN_ERR "%s: ERROR - TCPA log area empty\n", __func__); | 429 | printk(KERN_ERR "%s: ERROR - TCPA log area empty\n", __func__); |
401 | return -EIO; | 430 | return -EIO; |
402 | } | 431 | } |
403 | 432 | ||
404 | /* malloc EventLog space */ | 433 | /* malloc EventLog space */ |
405 | log->bios_event_log = kmalloc(buff->log_max_len, GFP_KERNEL); | 434 | log->bios_event_log = kmalloc(len, GFP_KERNEL); |
406 | if (!log->bios_event_log) { | 435 | if (!log->bios_event_log) { |
407 | printk | 436 | printk("%s: ERROR - Not enough Memory for BIOS measurements\n", |
408 | ("%s: ERROR - Not enough Memory for BIOS measurements\n", | 437 | __func__); |
409 | __func__); | ||
410 | return -ENOMEM; | 438 | return -ENOMEM; |
411 | } | 439 | } |
412 | 440 | ||
413 | log->bios_event_log_end = log->bios_event_log + buff->log_max_len; | 441 | log->bios_event_log_end = log->bios_event_log + len; |
414 | 442 | ||
415 | acpi_os_map_memory(buff->log_start_addr, buff->log_max_len, (void *) &virt); | 443 | acpi_os_map_memory(start, len, (void *) &virt); |
416 | 444 | ||
417 | memcpy(log->bios_event_log, virt, buff->log_max_len); | 445 | memcpy(log->bios_event_log, virt, len); |
418 | 446 | ||
419 | acpi_os_unmap_memory(virt, buff->log_max_len); | 447 | acpi_os_unmap_memory(virt, len); |
420 | return 0; | 448 | return 0; |
421 | } | 449 | } |
422 | 450 | ||
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c index 24095f6ee6da..adfff21beb21 100644 --- a/drivers/char/tpm/tpm_infineon.c +++ b/drivers/char/tpm/tpm_infineon.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * License. | 15 | * License. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/init.h> | ||
18 | #include <linux/pnp.h> | 19 | #include <linux/pnp.h> |
19 | #include "tpm.h" | 20 | #include "tpm.h" |
20 | 21 | ||
@@ -104,7 +105,7 @@ static int empty_fifo(struct tpm_chip *chip, int clear_wrfifo) | |||
104 | 105 | ||
105 | if (clear_wrfifo) { | 106 | if (clear_wrfifo) { |
106 | for (i = 0; i < 4096; i++) { | 107 | for (i = 0; i < 4096; i++) { |
107 | status = inb(chip->vendor->base + WRFIFO); | 108 | status = inb(chip->vendor.base + WRFIFO); |
108 | if (status == 0xff) { | 109 | if (status == 0xff) { |
109 | if (check == 5) | 110 | if (check == 5) |
110 | break; | 111 | break; |
@@ -124,8 +125,8 @@ static int empty_fifo(struct tpm_chip *chip, int clear_wrfifo) | |||
124 | */ | 125 | */ |
125 | i = 0; | 126 | i = 0; |
126 | do { | 127 | do { |
127 | status = inb(chip->vendor->base + RDFIFO); | 128 | status = inb(chip->vendor.base + RDFIFO); |
128 | status = inb(chip->vendor->base + STAT); | 129 | status = inb(chip->vendor.base + STAT); |
129 | i++; | 130 | i++; |
130 | if (i == TPM_MAX_TRIES) | 131 | if (i == TPM_MAX_TRIES) |
131 | return -EIO; | 132 | return -EIO; |
@@ -138,7 +139,7 @@ static int wait(struct tpm_chip *chip, int wait_for_bit) | |||
138 | int status; | 139 | int status; |
139 | int i; | 140 | int i; |
140 | for (i = 0; i < TPM_MAX_TRIES; i++) { | 141 | for (i = 0; i < TPM_MAX_TRIES; i++) { |
141 | status = inb(chip->vendor->base + STAT); | 142 | status = inb(chip->vendor.base + STAT); |
142 | /* check the status-register if wait_for_bit is set */ | 143 | /* check the status-register if wait_for_bit is set */ |
143 | if (status & 1 << wait_for_bit) | 144 | if (status & 1 << wait_for_bit) |
144 | break; | 145 | break; |
@@ -157,7 +158,7 @@ static int wait(struct tpm_chip *chip, int wait_for_bit) | |||
157 | static void wait_and_send(struct tpm_chip *chip, u8 sendbyte) | 158 | static void wait_and_send(struct tpm_chip *chip, u8 sendbyte) |
158 | { | 159 | { |
159 | wait(chip, STAT_XFE); | 160 | wait(chip, STAT_XFE); |
160 | outb(sendbyte, chip->vendor->base + WRFIFO); | 161 | outb(sendbyte, chip->vendor.base + WRFIFO); |
161 | } | 162 | } |
162 | 163 | ||
163 | /* Note: WTX means Waiting-Time-Extension. Whenever the TPM needs more | 164 | /* Note: WTX means Waiting-Time-Extension. Whenever the TPM needs more |
@@ -204,7 +205,7 @@ recv_begin: | |||
204 | ret = wait(chip, STAT_RDA); | 205 | ret = wait(chip, STAT_RDA); |
205 | if (ret) | 206 | if (ret) |
206 | return -EIO; | 207 | return -EIO; |
207 | buf[i] = inb(chip->vendor->base + RDFIFO); | 208 | buf[i] = inb(chip->vendor.base + RDFIFO); |
208 | } | 209 | } |
209 | 210 | ||
210 | if (buf[0] != TPM_VL_VER) { | 211 | if (buf[0] != TPM_VL_VER) { |
@@ -219,7 +220,7 @@ recv_begin: | |||
219 | 220 | ||
220 | for (i = 0; i < size; i++) { | 221 | for (i = 0; i < size; i++) { |
221 | wait(chip, STAT_RDA); | 222 | wait(chip, STAT_RDA); |
222 | buf[i] = inb(chip->vendor->base + RDFIFO); | 223 | buf[i] = inb(chip->vendor.base + RDFIFO); |
223 | } | 224 | } |
224 | 225 | ||
225 | if ((size == 0x6D00) && (buf[1] == 0x80)) { | 226 | if ((size == 0x6D00) && (buf[1] == 0x80)) { |
@@ -268,7 +269,7 @@ static int tpm_inf_send(struct tpm_chip *chip, u8 * buf, size_t count) | |||
268 | u8 count_high, count_low, count_4, count_3, count_2, count_1; | 269 | u8 count_high, count_low, count_4, count_3, count_2, count_1; |
269 | 270 | ||
270 | /* Disabling Reset, LP and IRQC */ | 271 | /* Disabling Reset, LP and IRQC */ |
271 | outb(RESET_LP_IRQC_DISABLE, chip->vendor->base + CMD); | 272 | outb(RESET_LP_IRQC_DISABLE, chip->vendor.base + CMD); |
272 | 273 | ||
273 | ret = empty_fifo(chip, 1); | 274 | ret = empty_fifo(chip, 1); |
274 | if (ret) { | 275 | if (ret) { |
@@ -319,7 +320,7 @@ static void tpm_inf_cancel(struct tpm_chip *chip) | |||
319 | 320 | ||
320 | static u8 tpm_inf_status(struct tpm_chip *chip) | 321 | static u8 tpm_inf_status(struct tpm_chip *chip) |
321 | { | 322 | { |
322 | return inb(chip->vendor->base + STAT); | 323 | return inb(chip->vendor.base + STAT); |
323 | } | 324 | } |
324 | 325 | ||
325 | static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL); | 326 | static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL); |
@@ -346,7 +347,7 @@ static struct file_operations inf_ops = { | |||
346 | .release = tpm_release, | 347 | .release = tpm_release, |
347 | }; | 348 | }; |
348 | 349 | ||
349 | static struct tpm_vendor_specific tpm_inf = { | 350 | static const struct tpm_vendor_specific tpm_inf = { |
350 | .recv = tpm_inf_recv, | 351 | .recv = tpm_inf_recv, |
351 | .send = tpm_inf_send, | 352 | .send = tpm_inf_send, |
352 | .cancel = tpm_inf_cancel, | 353 | .cancel = tpm_inf_cancel, |
@@ -375,6 +376,7 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, | |||
375 | int version[2]; | 376 | int version[2]; |
376 | int productid[2]; | 377 | int productid[2]; |
377 | char chipname[20]; | 378 | char chipname[20]; |
379 | struct tpm_chip *chip; | ||
378 | 380 | ||
379 | /* read IO-ports through PnP */ | 381 | /* read IO-ports through PnP */ |
380 | if (pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && | 382 | if (pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && |
@@ -395,14 +397,13 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, | |||
395 | goto err_last; | 397 | goto err_last; |
396 | } | 398 | } |
397 | /* publish my base address and request region */ | 399 | /* publish my base address and request region */ |
398 | tpm_inf.base = TPM_INF_BASE; | ||
399 | if (request_region | 400 | if (request_region |
400 | (tpm_inf.base, TPM_INF_PORT_LEN, "tpm_infineon0") == NULL) { | 401 | (TPM_INF_BASE, TPM_INF_PORT_LEN, "tpm_infineon0") == NULL) { |
401 | rc = -EINVAL; | 402 | rc = -EINVAL; |
402 | goto err_last; | 403 | goto err_last; |
403 | } | 404 | } |
404 | if (request_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN, | 405 | if (request_region |
405 | "tpm_infineon0") == NULL) { | 406 | (TPM_INF_ADDR, TPM_INF_ADDR_LEN, "tpm_infineon0") == NULL) { |
406 | rc = -EINVAL; | 407 | rc = -EINVAL; |
407 | goto err_last; | 408 | goto err_last; |
408 | } | 409 | } |
@@ -442,9 +443,9 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, | |||
442 | 443 | ||
443 | /* configure TPM with IO-ports */ | 444 | /* configure TPM with IO-ports */ |
444 | outb(IOLIMH, TPM_INF_ADDR); | 445 | outb(IOLIMH, TPM_INF_ADDR); |
445 | outb(((tpm_inf.base >> 8) & 0xff), TPM_INF_DATA); | 446 | outb(((TPM_INF_BASE >> 8) & 0xff), TPM_INF_DATA); |
446 | outb(IOLIML, TPM_INF_ADDR); | 447 | outb(IOLIML, TPM_INF_ADDR); |
447 | outb((tpm_inf.base & 0xff), TPM_INF_DATA); | 448 | outb((TPM_INF_BASE & 0xff), TPM_INF_DATA); |
448 | 449 | ||
449 | /* control if IO-ports are set correctly */ | 450 | /* control if IO-ports are set correctly */ |
450 | outb(IOLIMH, TPM_INF_ADDR); | 451 | outb(IOLIMH, TPM_INF_ADDR); |
@@ -452,10 +453,10 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, | |||
452 | outb(IOLIML, TPM_INF_ADDR); | 453 | outb(IOLIML, TPM_INF_ADDR); |
453 | iol = inb(TPM_INF_DATA); | 454 | iol = inb(TPM_INF_DATA); |
454 | 455 | ||
455 | if ((ioh << 8 | iol) != tpm_inf.base) { | 456 | if ((ioh << 8 | iol) != TPM_INF_BASE) { |
456 | dev_err(&dev->dev, | 457 | dev_err(&dev->dev, |
457 | "Could not set IO-ports to 0x%lx\n", | 458 | "Could not set IO-ports to 0x%x\n", |
458 | tpm_inf.base); | 459 | TPM_INF_BASE); |
459 | rc = -EIO; | 460 | rc = -EIO; |
460 | goto err_release_region; | 461 | goto err_release_region; |
461 | } | 462 | } |
@@ -466,15 +467,15 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, | |||
466 | outb(DISABLE_REGISTER_PAIR, TPM_INF_ADDR); | 467 | outb(DISABLE_REGISTER_PAIR, TPM_INF_ADDR); |
467 | 468 | ||
468 | /* disable RESET, LP and IRQC */ | 469 | /* disable RESET, LP and IRQC */ |
469 | outb(RESET_LP_IRQC_DISABLE, tpm_inf.base + CMD); | 470 | outb(RESET_LP_IRQC_DISABLE, TPM_INF_BASE + CMD); |
470 | 471 | ||
471 | /* Finally, we're done, print some infos */ | 472 | /* Finally, we're done, print some infos */ |
472 | dev_info(&dev->dev, "TPM found: " | 473 | dev_info(&dev->dev, "TPM found: " |
473 | "config base 0x%x, " | 474 | "config base 0x%x, " |
474 | "io base 0x%x, " | 475 | "io base 0x%x, " |
475 | "chip version %02x%02x, " | 476 | "chip version 0x%02x%02x, " |
476 | "vendor id %x%x (Infineon), " | 477 | "vendor id 0x%x%x (Infineon), " |
477 | "product id %02x%02x" | 478 | "product id 0x%02x%02x" |
478 | "%s\n", | 479 | "%s\n", |
479 | TPM_INF_ADDR, | 480 | TPM_INF_ADDR, |
480 | TPM_INF_BASE, | 481 | TPM_INF_BASE, |
@@ -482,11 +483,10 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, | |||
482 | vendorid[0], vendorid[1], | 483 | vendorid[0], vendorid[1], |
483 | productid[0], productid[1], chipname); | 484 | productid[0], productid[1], chipname); |
484 | 485 | ||
485 | rc = tpm_register_hardware(&dev->dev, &tpm_inf); | 486 | if (!(chip = tpm_register_hardware(&dev->dev, &tpm_inf))) { |
486 | if (rc < 0) { | ||
487 | rc = -ENODEV; | ||
488 | goto err_release_region; | 487 | goto err_release_region; |
489 | } | 488 | } |
489 | chip->vendor.base = TPM_INF_BASE; | ||
490 | return 0; | 490 | return 0; |
491 | } else { | 491 | } else { |
492 | rc = -ENODEV; | 492 | rc = -ENODEV; |
@@ -494,7 +494,7 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, | |||
494 | } | 494 | } |
495 | 495 | ||
496 | err_release_region: | 496 | err_release_region: |
497 | release_region(tpm_inf.base, TPM_INF_PORT_LEN); | 497 | release_region(TPM_INF_BASE, TPM_INF_PORT_LEN); |
498 | release_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN); | 498 | release_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN); |
499 | 499 | ||
500 | err_last: | 500 | err_last: |
@@ -506,7 +506,8 @@ static __devexit void tpm_inf_pnp_remove(struct pnp_dev *dev) | |||
506 | struct tpm_chip *chip = pnp_get_drvdata(dev); | 506 | struct tpm_chip *chip = pnp_get_drvdata(dev); |
507 | 507 | ||
508 | if (chip) { | 508 | if (chip) { |
509 | release_region(chip->vendor->base, TPM_INF_PORT_LEN); | 509 | release_region(TPM_INF_BASE, TPM_INF_PORT_LEN); |
510 | release_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN); | ||
510 | tpm_remove_hardware(chip->dev); | 511 | tpm_remove_hardware(chip->dev); |
511 | } | 512 | } |
512 | } | 513 | } |
@@ -520,7 +521,7 @@ static struct pnp_driver tpm_inf_pnp = { | |||
520 | }, | 521 | }, |
521 | .id_table = tpm_pnp_tbl, | 522 | .id_table = tpm_pnp_tbl, |
522 | .probe = tpm_inf_pnp_probe, | 523 | .probe = tpm_inf_pnp_probe, |
523 | .remove = tpm_inf_pnp_remove, | 524 | .remove = __devexit_p(tpm_inf_pnp_remove), |
524 | }; | 525 | }; |
525 | 526 | ||
526 | static int __init init_inf(void) | 527 | static int __init init_inf(void) |
@@ -538,5 +539,5 @@ module_exit(cleanup_inf); | |||
538 | 539 | ||
539 | MODULE_AUTHOR("Marcel Selhorst <selhorst@crypto.rub.de>"); | 540 | MODULE_AUTHOR("Marcel Selhorst <selhorst@crypto.rub.de>"); |
540 | MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2"); | 541 | MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2"); |
541 | MODULE_VERSION("1.7"); | 542 | MODULE_VERSION("1.8"); |
542 | MODULE_LICENSE("GPL"); | 543 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c index 680a8e331887..4c8bc06c7d95 100644 --- a/drivers/char/tpm/tpm_nsc.c +++ b/drivers/char/tpm/tpm_nsc.c | |||
@@ -71,7 +71,7 @@ static int wait_for_stat(struct tpm_chip *chip, u8 mask, u8 val, u8 * data) | |||
71 | unsigned long stop; | 71 | unsigned long stop; |
72 | 72 | ||
73 | /* status immediately available check */ | 73 | /* status immediately available check */ |
74 | *data = inb(chip->vendor->base + NSC_STATUS); | 74 | *data = inb(chip->vendor.base + NSC_STATUS); |
75 | if ((*data & mask) == val) | 75 | if ((*data & mask) == val) |
76 | return 0; | 76 | return 0; |
77 | 77 | ||
@@ -79,7 +79,7 @@ static int wait_for_stat(struct tpm_chip *chip, u8 mask, u8 val, u8 * data) | |||
79 | stop = jiffies + 10 * HZ; | 79 | stop = jiffies + 10 * HZ; |
80 | do { | 80 | do { |
81 | msleep(TPM_TIMEOUT); | 81 | msleep(TPM_TIMEOUT); |
82 | *data = inb(chip->vendor->base + 1); | 82 | *data = inb(chip->vendor.base + 1); |
83 | if ((*data & mask) == val) | 83 | if ((*data & mask) == val) |
84 | return 0; | 84 | return 0; |
85 | } | 85 | } |
@@ -94,9 +94,9 @@ static int nsc_wait_for_ready(struct tpm_chip *chip) | |||
94 | unsigned long stop; | 94 | unsigned long stop; |
95 | 95 | ||
96 | /* status immediately available check */ | 96 | /* status immediately available check */ |
97 | status = inb(chip->vendor->base + NSC_STATUS); | 97 | status = inb(chip->vendor.base + NSC_STATUS); |
98 | if (status & NSC_STATUS_OBF) | 98 | if (status & NSC_STATUS_OBF) |
99 | status = inb(chip->vendor->base + NSC_DATA); | 99 | status = inb(chip->vendor.base + NSC_DATA); |
100 | if (status & NSC_STATUS_RDY) | 100 | if (status & NSC_STATUS_RDY) |
101 | return 0; | 101 | return 0; |
102 | 102 | ||
@@ -104,9 +104,9 @@ static int nsc_wait_for_ready(struct tpm_chip *chip) | |||
104 | stop = jiffies + 100; | 104 | stop = jiffies + 100; |
105 | do { | 105 | do { |
106 | msleep(TPM_TIMEOUT); | 106 | msleep(TPM_TIMEOUT); |
107 | status = inb(chip->vendor->base + NSC_STATUS); | 107 | status = inb(chip->vendor.base + NSC_STATUS); |
108 | if (status & NSC_STATUS_OBF) | 108 | if (status & NSC_STATUS_OBF) |
109 | status = inb(chip->vendor->base + NSC_DATA); | 109 | status = inb(chip->vendor.base + NSC_DATA); |
110 | if (status & NSC_STATUS_RDY) | 110 | if (status & NSC_STATUS_RDY) |
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
@@ -132,7 +132,7 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count) | |||
132 | return -EIO; | 132 | return -EIO; |
133 | } | 133 | } |
134 | if ((data = | 134 | if ((data = |
135 | inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_NORMAL) { | 135 | inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_NORMAL) { |
136 | dev_err(chip->dev, "not in normal mode (0x%x)\n", | 136 | dev_err(chip->dev, "not in normal mode (0x%x)\n", |
137 | data); | 137 | data); |
138 | return -EIO; | 138 | return -EIO; |
@@ -148,7 +148,7 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count) | |||
148 | } | 148 | } |
149 | if (data & NSC_STATUS_F0) | 149 | if (data & NSC_STATUS_F0) |
150 | break; | 150 | break; |
151 | *p = inb(chip->vendor->base + NSC_DATA); | 151 | *p = inb(chip->vendor.base + NSC_DATA); |
152 | } | 152 | } |
153 | 153 | ||
154 | if ((data & NSC_STATUS_F0) == 0 && | 154 | if ((data & NSC_STATUS_F0) == 0 && |
@@ -156,7 +156,7 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count) | |||
156 | dev_err(chip->dev, "F0 not set\n"); | 156 | dev_err(chip->dev, "F0 not set\n"); |
157 | return -EIO; | 157 | return -EIO; |
158 | } | 158 | } |
159 | if ((data = inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_EOC) { | 159 | if ((data = inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_EOC) { |
160 | dev_err(chip->dev, | 160 | dev_err(chip->dev, |
161 | "expected end of command(0x%x)\n", data); | 161 | "expected end of command(0x%x)\n", data); |
162 | return -EIO; | 162 | return -EIO; |
@@ -182,7 +182,7 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count) | |||
182 | * fix it. Not sure why this is needed, we followed the flow | 182 | * fix it. Not sure why this is needed, we followed the flow |
183 | * chart in the manual to the letter. | 183 | * chart in the manual to the letter. |
184 | */ | 184 | */ |
185 | outb(NSC_COMMAND_CANCEL, chip->vendor->base + NSC_COMMAND); | 185 | outb(NSC_COMMAND_CANCEL, chip->vendor.base + NSC_COMMAND); |
186 | 186 | ||
187 | if (nsc_wait_for_ready(chip) != 0) | 187 | if (nsc_wait_for_ready(chip) != 0) |
188 | return -EIO; | 188 | return -EIO; |
@@ -192,7 +192,7 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count) | |||
192 | return -EIO; | 192 | return -EIO; |
193 | } | 193 | } |
194 | 194 | ||
195 | outb(NSC_COMMAND_NORMAL, chip->vendor->base + NSC_COMMAND); | 195 | outb(NSC_COMMAND_NORMAL, chip->vendor.base + NSC_COMMAND); |
196 | if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) { | 196 | if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) { |
197 | dev_err(chip->dev, "IBR timeout\n"); | 197 | dev_err(chip->dev, "IBR timeout\n"); |
198 | return -EIO; | 198 | return -EIO; |
@@ -204,26 +204,26 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count) | |||
204 | "IBF timeout (while writing data)\n"); | 204 | "IBF timeout (while writing data)\n"); |
205 | return -EIO; | 205 | return -EIO; |
206 | } | 206 | } |
207 | outb(buf[i], chip->vendor->base + NSC_DATA); | 207 | outb(buf[i], chip->vendor.base + NSC_DATA); |
208 | } | 208 | } |
209 | 209 | ||
210 | if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { | 210 | if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { |
211 | dev_err(chip->dev, "IBF timeout\n"); | 211 | dev_err(chip->dev, "IBF timeout\n"); |
212 | return -EIO; | 212 | return -EIO; |
213 | } | 213 | } |
214 | outb(NSC_COMMAND_EOC, chip->vendor->base + NSC_COMMAND); | 214 | outb(NSC_COMMAND_EOC, chip->vendor.base + NSC_COMMAND); |
215 | 215 | ||
216 | return count; | 216 | return count; |
217 | } | 217 | } |
218 | 218 | ||
219 | static void tpm_nsc_cancel(struct tpm_chip *chip) | 219 | static void tpm_nsc_cancel(struct tpm_chip *chip) |
220 | { | 220 | { |
221 | outb(NSC_COMMAND_CANCEL, chip->vendor->base + NSC_COMMAND); | 221 | outb(NSC_COMMAND_CANCEL, chip->vendor.base + NSC_COMMAND); |
222 | } | 222 | } |
223 | 223 | ||
224 | static u8 tpm_nsc_status(struct tpm_chip *chip) | 224 | static u8 tpm_nsc_status(struct tpm_chip *chip) |
225 | { | 225 | { |
226 | return inb(chip->vendor->base + NSC_STATUS); | 226 | return inb(chip->vendor.base + NSC_STATUS); |
227 | } | 227 | } |
228 | 228 | ||
229 | static struct file_operations nsc_ops = { | 229 | static struct file_operations nsc_ops = { |
@@ -250,7 +250,7 @@ static struct attribute * nsc_attrs[] = { | |||
250 | 250 | ||
251 | static struct attribute_group nsc_attr_grp = { .attrs = nsc_attrs }; | 251 | static struct attribute_group nsc_attr_grp = { .attrs = nsc_attrs }; |
252 | 252 | ||
253 | static struct tpm_vendor_specific tpm_nsc = { | 253 | static const struct tpm_vendor_specific tpm_nsc = { |
254 | .recv = tpm_nsc_recv, | 254 | .recv = tpm_nsc_recv, |
255 | .send = tpm_nsc_send, | 255 | .send = tpm_nsc_send, |
256 | .cancel = tpm_nsc_cancel, | 256 | .cancel = tpm_nsc_cancel, |
@@ -268,7 +268,7 @@ static void __devexit tpm_nsc_remove(struct device *dev) | |||
268 | { | 268 | { |
269 | struct tpm_chip *chip = dev_get_drvdata(dev); | 269 | struct tpm_chip *chip = dev_get_drvdata(dev); |
270 | if ( chip ) { | 270 | if ( chip ) { |
271 | release_region(chip->vendor->base, 2); | 271 | release_region(chip->vendor.base, 2); |
272 | tpm_remove_hardware(chip->dev); | 272 | tpm_remove_hardware(chip->dev); |
273 | } | 273 | } |
274 | } | 274 | } |
@@ -286,7 +286,8 @@ static int __init init_nsc(void) | |||
286 | int rc = 0; | 286 | int rc = 0; |
287 | int lo, hi; | 287 | int lo, hi; |
288 | int nscAddrBase = TPM_ADDR; | 288 | int nscAddrBase = TPM_ADDR; |
289 | 289 | struct tpm_chip *chip; | |
290 | unsigned long base; | ||
290 | 291 | ||
291 | /* verify that it is a National part (SID) */ | 292 | /* verify that it is a National part (SID) */ |
292 | if (tpm_read_index(TPM_ADDR, NSC_SID_INDEX) != 0xEF) { | 293 | if (tpm_read_index(TPM_ADDR, NSC_SID_INDEX) != 0xEF) { |
@@ -300,7 +301,7 @@ static int __init init_nsc(void) | |||
300 | 301 | ||
301 | hi = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_HI); | 302 | hi = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_HI); |
302 | lo = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_LO); | 303 | lo = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_LO); |
303 | tpm_nsc.base = (hi<<8) | lo; | 304 | base = (hi<<8) | lo; |
304 | 305 | ||
305 | /* enable the DPM module */ | 306 | /* enable the DPM module */ |
306 | tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01); | 307 | tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01); |
@@ -320,13 +321,15 @@ static int __init init_nsc(void) | |||
320 | if ((rc = platform_device_register(pdev)) < 0) | 321 | if ((rc = platform_device_register(pdev)) < 0) |
321 | goto err_free_dev; | 322 | goto err_free_dev; |
322 | 323 | ||
323 | if (request_region(tpm_nsc.base, 2, "tpm_nsc0") == NULL ) { | 324 | if (request_region(base, 2, "tpm_nsc0") == NULL ) { |
324 | rc = -EBUSY; | 325 | rc = -EBUSY; |
325 | goto err_unreg_dev; | 326 | goto err_unreg_dev; |
326 | } | 327 | } |
327 | 328 | ||
328 | if ((rc = tpm_register_hardware(&pdev->dev, &tpm_nsc)) < 0) | 329 | if (!(chip = tpm_register_hardware(&pdev->dev, &tpm_nsc))) { |
330 | rc = -ENODEV; | ||
329 | goto err_rel_reg; | 331 | goto err_rel_reg; |
332 | } | ||
330 | 333 | ||
331 | dev_dbg(&pdev->dev, "NSC TPM detected\n"); | 334 | dev_dbg(&pdev->dev, "NSC TPM detected\n"); |
332 | dev_dbg(&pdev->dev, | 335 | dev_dbg(&pdev->dev, |
@@ -361,10 +364,12 @@ static int __init init_nsc(void) | |||
361 | "NSC TPM revision %d\n", | 364 | "NSC TPM revision %d\n", |
362 | tpm_read_index(nscAddrBase, 0x27) & 0x1F); | 365 | tpm_read_index(nscAddrBase, 0x27) & 0x1F); |
363 | 366 | ||
367 | chip->vendor.base = base; | ||
368 | |||
364 | return 0; | 369 | return 0; |
365 | 370 | ||
366 | err_rel_reg: | 371 | err_rel_reg: |
367 | release_region(tpm_nsc.base, 2); | 372 | release_region(base, 2); |
368 | err_unreg_dev: | 373 | err_unreg_dev: |
369 | platform_device_unregister(pdev); | 374 | platform_device_unregister(pdev); |
370 | err_free_dev: | 375 | err_free_dev: |
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c new file mode 100644 index 000000000000..b9cae9a238bb --- /dev/null +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -0,0 +1,669 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005, 2006 IBM Corporation | ||
3 | * | ||
4 | * Authors: | ||
5 | * Leendert van Doorn <leendert@watson.ibm.com> | ||
6 | * Kylene Hall <kjhall@us.ibm.com> | ||
7 | * | ||
8 | * Device driver for TCG/TCPA TPM (trusted platform module). | ||
9 | * Specifications at www.trustedcomputinggroup.org | ||
10 | * | ||
11 | * This device driver implements the TPM interface as defined in | ||
12 | * the TCG TPM Interface Spec version 1.2, revision 1.0. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License as | ||
16 | * published by the Free Software Foundation, version 2 of the | ||
17 | * License. | ||
18 | */ | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/moduleparam.h> | ||
22 | #include <linux/pnp.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/wait.h> | ||
25 | #include "tpm.h" | ||
26 | |||
27 | #define TPM_HEADER_SIZE 10 | ||
28 | |||
29 | enum tis_access { | ||
30 | TPM_ACCESS_VALID = 0x80, | ||
31 | TPM_ACCESS_ACTIVE_LOCALITY = 0x20, | ||
32 | TPM_ACCESS_REQUEST_PENDING = 0x04, | ||
33 | TPM_ACCESS_REQUEST_USE = 0x02, | ||
34 | }; | ||
35 | |||
36 | enum tis_status { | ||
37 | TPM_STS_VALID = 0x80, | ||
38 | TPM_STS_COMMAND_READY = 0x40, | ||
39 | TPM_STS_GO = 0x20, | ||
40 | TPM_STS_DATA_AVAIL = 0x10, | ||
41 | TPM_STS_DATA_EXPECT = 0x08, | ||
42 | }; | ||
43 | |||
44 | enum tis_int_flags { | ||
45 | TPM_GLOBAL_INT_ENABLE = 0x80000000, | ||
46 | TPM_INTF_BURST_COUNT_STATIC = 0x100, | ||
47 | TPM_INTF_CMD_READY_INT = 0x080, | ||
48 | TPM_INTF_INT_EDGE_FALLING = 0x040, | ||
49 | TPM_INTF_INT_EDGE_RISING = 0x020, | ||
50 | TPM_INTF_INT_LEVEL_LOW = 0x010, | ||
51 | TPM_INTF_INT_LEVEL_HIGH = 0x008, | ||
52 | TPM_INTF_LOCALITY_CHANGE_INT = 0x004, | ||
53 | TPM_INTF_STS_VALID_INT = 0x002, | ||
54 | TPM_INTF_DATA_AVAIL_INT = 0x001, | ||
55 | }; | ||
56 | |||
57 | enum tis_defaults { | ||
58 | TIS_MEM_BASE = 0xFED4000, | ||
59 | TIS_MEM_LEN = 0x5000, | ||
60 | TIS_SHORT_TIMEOUT = 750, /* ms */ | ||
61 | TIS_LONG_TIMEOUT = 2000, /* 2 sec */ | ||
62 | }; | ||
63 | |||
64 | #define TPM_ACCESS(l) (0x0000 | ((l) << 12)) | ||
65 | #define TPM_INT_ENABLE(l) (0x0008 | ((l) << 12)) | ||
66 | #define TPM_INT_VECTOR(l) (0x000C | ((l) << 12)) | ||
67 | #define TPM_INT_STATUS(l) (0x0010 | ((l) << 12)) | ||
68 | #define TPM_INTF_CAPS(l) (0x0014 | ((l) << 12)) | ||
69 | #define TPM_STS(l) (0x0018 | ((l) << 12)) | ||
70 | #define TPM_DATA_FIFO(l) (0x0024 | ((l) << 12)) | ||
71 | |||
72 | #define TPM_DID_VID(l) (0x0F00 | ((l) << 12)) | ||
73 | #define TPM_RID(l) (0x0F04 | ((l) << 12)) | ||
74 | |||
75 | static LIST_HEAD(tis_chips); | ||
76 | static DEFINE_SPINLOCK(tis_lock); | ||
77 | |||
78 | static int check_locality(struct tpm_chip *chip, int l) | ||
79 | { | ||
80 | if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & | ||
81 | (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) == | ||
82 | (TPM_ACCESS_ACTIVE_LOCALITY | TPM_ACCESS_VALID)) | ||
83 | return chip->vendor.locality = l; | ||
84 | |||
85 | return -1; | ||
86 | } | ||
87 | |||
88 | static void release_locality(struct tpm_chip *chip, int l, int force) | ||
89 | { | ||
90 | if (force || (ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & | ||
91 | (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) == | ||
92 | (TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID)) | ||
93 | iowrite8(TPM_ACCESS_ACTIVE_LOCALITY, | ||
94 | chip->vendor.iobase + TPM_ACCESS(l)); | ||
95 | } | ||
96 | |||
97 | static int request_locality(struct tpm_chip *chip, int l) | ||
98 | { | ||
99 | unsigned long stop; | ||
100 | long rc; | ||
101 | |||
102 | if (check_locality(chip, l) >= 0) | ||
103 | return l; | ||
104 | |||
105 | iowrite8(TPM_ACCESS_REQUEST_USE, | ||
106 | chip->vendor.iobase + TPM_ACCESS(l)); | ||
107 | |||
108 | if (chip->vendor.irq) { | ||
109 | rc = wait_event_interruptible_timeout(chip->vendor.int_queue, | ||
110 | (check_locality | ||
111 | (chip, l) >= 0), | ||
112 | chip->vendor.timeout_a); | ||
113 | if (rc > 0) | ||
114 | return l; | ||
115 | |||
116 | } else { | ||
117 | /* wait for burstcount */ | ||
118 | stop = jiffies + chip->vendor.timeout_a; | ||
119 | do { | ||
120 | if (check_locality(chip, l) >= 0) | ||
121 | return l; | ||
122 | msleep(TPM_TIMEOUT); | ||
123 | } | ||
124 | while (time_before(jiffies, stop)); | ||
125 | } | ||
126 | return -1; | ||
127 | } | ||
128 | |||
129 | static u8 tpm_tis_status(struct tpm_chip *chip) | ||
130 | { | ||
131 | return ioread8(chip->vendor.iobase + | ||
132 | TPM_STS(chip->vendor.locality)); | ||
133 | } | ||
134 | |||
135 | static void tpm_tis_ready(struct tpm_chip *chip) | ||
136 | { | ||
137 | /* this causes the current command to be aborted */ | ||
138 | iowrite8(TPM_STS_COMMAND_READY, | ||
139 | chip->vendor.iobase + TPM_STS(chip->vendor.locality)); | ||
140 | } | ||
141 | |||
142 | static int get_burstcount(struct tpm_chip *chip) | ||
143 | { | ||
144 | unsigned long stop; | ||
145 | int burstcnt; | ||
146 | |||
147 | /* wait for burstcount */ | ||
148 | /* which timeout value, spec has 2 answers (c & d) */ | ||
149 | stop = jiffies + chip->vendor.timeout_d; | ||
150 | do { | ||
151 | burstcnt = ioread8(chip->vendor.iobase + | ||
152 | TPM_STS(chip->vendor.locality) + 1); | ||
153 | burstcnt += ioread8(chip->vendor.iobase + | ||
154 | TPM_STS(chip->vendor.locality) + | ||
155 | 2) << 8; | ||
156 | if (burstcnt) | ||
157 | return burstcnt; | ||
158 | msleep(TPM_TIMEOUT); | ||
159 | } while (time_before(jiffies, stop)); | ||
160 | return -EBUSY; | ||
161 | } | ||
162 | |||
163 | static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout, | ||
164 | wait_queue_head_t *queue) | ||
165 | { | ||
166 | unsigned long stop; | ||
167 | long rc; | ||
168 | u8 status; | ||
169 | |||
170 | /* check current status */ | ||
171 | status = tpm_tis_status(chip); | ||
172 | if ((status & mask) == mask) | ||
173 | return 0; | ||
174 | |||
175 | if (chip->vendor.irq) { | ||
176 | rc = wait_event_interruptible_timeout(*queue, | ||
177 | ((tpm_tis_status | ||
178 | (chip) & mask) == | ||
179 | mask), timeout); | ||
180 | if (rc > 0) | ||
181 | return 0; | ||
182 | } else { | ||
183 | stop = jiffies + timeout; | ||
184 | do { | ||
185 | msleep(TPM_TIMEOUT); | ||
186 | status = tpm_tis_status(chip); | ||
187 | if ((status & mask) == mask) | ||
188 | return 0; | ||
189 | } while (time_before(jiffies, stop)); | ||
190 | } | ||
191 | return -ETIME; | ||
192 | } | ||
193 | |||
194 | static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count) | ||
195 | { | ||
196 | int size = 0, burstcnt; | ||
197 | while (size < count && | ||
198 | wait_for_stat(chip, | ||
199 | TPM_STS_DATA_AVAIL | TPM_STS_VALID, | ||
200 | chip->vendor.timeout_c, | ||
201 | &chip->vendor.read_queue) | ||
202 | == 0) { | ||
203 | burstcnt = get_burstcount(chip); | ||
204 | for (; burstcnt > 0 && size < count; burstcnt--) | ||
205 | buf[size++] = ioread8(chip->vendor.iobase + | ||
206 | TPM_DATA_FIFO(chip->vendor. | ||
207 | locality)); | ||
208 | } | ||
209 | return size; | ||
210 | } | ||
211 | |||
212 | static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count) | ||
213 | { | ||
214 | int size = 0; | ||
215 | int expected, status; | ||
216 | |||
217 | if (count < TPM_HEADER_SIZE) { | ||
218 | size = -EIO; | ||
219 | goto out; | ||
220 | } | ||
221 | |||
222 | /* read first 10 bytes, including tag, paramsize, and result */ | ||
223 | if ((size = | ||
224 | recv_data(chip, buf, TPM_HEADER_SIZE)) < TPM_HEADER_SIZE) { | ||
225 | dev_err(chip->dev, "Unable to read header\n"); | ||
226 | goto out; | ||
227 | } | ||
228 | |||
229 | expected = be32_to_cpu(*(__be32 *) (buf + 2)); | ||
230 | if (expected > count) { | ||
231 | size = -EIO; | ||
232 | goto out; | ||
233 | } | ||
234 | |||
235 | if ((size += | ||
236 | recv_data(chip, &buf[TPM_HEADER_SIZE], | ||
237 | expected - TPM_HEADER_SIZE)) < expected) { | ||
238 | dev_err(chip->dev, "Unable to read remainder of result\n"); | ||
239 | size = -ETIME; | ||
240 | goto out; | ||
241 | } | ||
242 | |||
243 | wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, | ||
244 | &chip->vendor.int_queue); | ||
245 | status = tpm_tis_status(chip); | ||
246 | if (status & TPM_STS_DATA_AVAIL) { /* retry? */ | ||
247 | dev_err(chip->dev, "Error left over data\n"); | ||
248 | size = -EIO; | ||
249 | goto out; | ||
250 | } | ||
251 | |||
252 | out: | ||
253 | tpm_tis_ready(chip); | ||
254 | release_locality(chip, chip->vendor.locality, 0); | ||
255 | return size; | ||
256 | } | ||
257 | |||
258 | /* | ||
259 | * If interrupts are used (signaled by an irq set in the vendor structure) | ||
260 | * tpm.c can skip polling for the data to be available as the interrupt is | ||
261 | * waited for here | ||
262 | */ | ||
263 | static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len) | ||
264 | { | ||
265 | int rc, status, burstcnt; | ||
266 | size_t count = 0; | ||
267 | u32 ordinal; | ||
268 | |||
269 | if (request_locality(chip, 0) < 0) | ||
270 | return -EBUSY; | ||
271 | |||
272 | status = tpm_tis_status(chip); | ||
273 | if ((status & TPM_STS_COMMAND_READY) == 0) { | ||
274 | tpm_tis_ready(chip); | ||
275 | if (wait_for_stat | ||
276 | (chip, TPM_STS_COMMAND_READY, chip->vendor.timeout_b, | ||
277 | &chip->vendor.int_queue) < 0) { | ||
278 | rc = -ETIME; | ||
279 | goto out_err; | ||
280 | } | ||
281 | } | ||
282 | |||
283 | while (count < len - 1) { | ||
284 | burstcnt = get_burstcount(chip); | ||
285 | for (; burstcnt > 0 && count < len - 1; burstcnt--) { | ||
286 | iowrite8(buf[count], chip->vendor.iobase + | ||
287 | TPM_DATA_FIFO(chip->vendor.locality)); | ||
288 | count++; | ||
289 | } | ||
290 | |||
291 | wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, | ||
292 | &chip->vendor.int_queue); | ||
293 | status = tpm_tis_status(chip); | ||
294 | if ((status & TPM_STS_DATA_EXPECT) == 0) { | ||
295 | rc = -EIO; | ||
296 | goto out_err; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | /* write last byte */ | ||
301 | iowrite8(buf[count], | ||
302 | chip->vendor.iobase + | ||
303 | TPM_DATA_FIFO(chip->vendor.locality)); | ||
304 | wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, | ||
305 | &chip->vendor.int_queue); | ||
306 | status = tpm_tis_status(chip); | ||
307 | if ((status & TPM_STS_DATA_EXPECT) != 0) { | ||
308 | rc = -EIO; | ||
309 | goto out_err; | ||
310 | } | ||
311 | |||
312 | /* go and do it */ | ||
313 | iowrite8(TPM_STS_GO, | ||
314 | chip->vendor.iobase + TPM_STS(chip->vendor.locality)); | ||
315 | |||
316 | if (chip->vendor.irq) { | ||
317 | ordinal = be32_to_cpu(*((__be32 *) (buf + 6))); | ||
318 | if (wait_for_stat | ||
319 | (chip, TPM_STS_DATA_AVAIL | TPM_STS_VALID, | ||
320 | tpm_calc_ordinal_duration(chip, ordinal), | ||
321 | &chip->vendor.read_queue) < 0) { | ||
322 | rc = -ETIME; | ||
323 | goto out_err; | ||
324 | } | ||
325 | } | ||
326 | return len; | ||
327 | out_err: | ||
328 | tpm_tis_ready(chip); | ||
329 | release_locality(chip, chip->vendor.locality, 0); | ||
330 | return rc; | ||
331 | } | ||
332 | |||
333 | static struct file_operations tis_ops = { | ||
334 | .owner = THIS_MODULE, | ||
335 | .llseek = no_llseek, | ||
336 | .open = tpm_open, | ||
337 | .read = tpm_read, | ||
338 | .write = tpm_write, | ||
339 | .release = tpm_release, | ||
340 | }; | ||
341 | |||
342 | static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL); | ||
343 | static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL); | ||
344 | static DEVICE_ATTR(enabled, S_IRUGO, tpm_show_enabled, NULL); | ||
345 | static DEVICE_ATTR(active, S_IRUGO, tpm_show_active, NULL); | ||
346 | static DEVICE_ATTR(owned, S_IRUGO, tpm_show_owned, NULL); | ||
347 | static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, | ||
348 | NULL); | ||
349 | static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); | ||
350 | static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); | ||
351 | |||
352 | static struct attribute *tis_attrs[] = { | ||
353 | &dev_attr_pubek.attr, | ||
354 | &dev_attr_pcrs.attr, | ||
355 | &dev_attr_enabled.attr, | ||
356 | &dev_attr_active.attr, | ||
357 | &dev_attr_owned.attr, | ||
358 | &dev_attr_temp_deactivated.attr, | ||
359 | &dev_attr_caps.attr, | ||
360 | &dev_attr_cancel.attr, NULL, | ||
361 | }; | ||
362 | |||
363 | static struct attribute_group tis_attr_grp = { | ||
364 | .attrs = tis_attrs | ||
365 | }; | ||
366 | |||
367 | static struct tpm_vendor_specific tpm_tis = { | ||
368 | .status = tpm_tis_status, | ||
369 | .recv = tpm_tis_recv, | ||
370 | .send = tpm_tis_send, | ||
371 | .cancel = tpm_tis_ready, | ||
372 | .req_complete_mask = TPM_STS_DATA_AVAIL | TPM_STS_VALID, | ||
373 | .req_complete_val = TPM_STS_DATA_AVAIL | TPM_STS_VALID, | ||
374 | .req_canceled = TPM_STS_COMMAND_READY, | ||
375 | .attr_group = &tis_attr_grp, | ||
376 | .miscdev = { | ||
377 | .fops = &tis_ops,}, | ||
378 | }; | ||
379 | |||
380 | static irqreturn_t tis_int_probe(int irq, void *dev_id, struct pt_regs *regs) | ||
381 | { | ||
382 | struct tpm_chip *chip = (struct tpm_chip *) dev_id; | ||
383 | u32 interrupt; | ||
384 | |||
385 | interrupt = ioread32(chip->vendor.iobase + | ||
386 | TPM_INT_STATUS(chip->vendor.locality)); | ||
387 | |||
388 | if (interrupt == 0) | ||
389 | return IRQ_NONE; | ||
390 | |||
391 | chip->vendor.irq = irq; | ||
392 | |||
393 | /* Clear interrupts handled with TPM_EOI */ | ||
394 | iowrite32(interrupt, | ||
395 | chip->vendor.iobase + | ||
396 | TPM_INT_STATUS(chip->vendor.locality)); | ||
397 | return IRQ_HANDLED; | ||
398 | } | ||
399 | |||
400 | static irqreturn_t tis_int_handler(int irq, void *dev_id, struct pt_regs *regs) | ||
401 | { | ||
402 | struct tpm_chip *chip = (struct tpm_chip *) dev_id; | ||
403 | u32 interrupt; | ||
404 | int i; | ||
405 | |||
406 | interrupt = ioread32(chip->vendor.iobase + | ||
407 | TPM_INT_STATUS(chip->vendor.locality)); | ||
408 | |||
409 | if (interrupt == 0) | ||
410 | return IRQ_NONE; | ||
411 | |||
412 | if (interrupt & TPM_INTF_DATA_AVAIL_INT) | ||
413 | wake_up_interruptible(&chip->vendor.read_queue); | ||
414 | if (interrupt & TPM_INTF_LOCALITY_CHANGE_INT) | ||
415 | for (i = 0; i < 5; i++) | ||
416 | if (check_locality(chip, i) >= 0) | ||
417 | break; | ||
418 | if (interrupt & | ||
419 | (TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_STS_VALID_INT | | ||
420 | TPM_INTF_CMD_READY_INT)) | ||
421 | wake_up_interruptible(&chip->vendor.int_queue); | ||
422 | |||
423 | /* Clear interrupts handled with TPM_EOI */ | ||
424 | iowrite32(interrupt, | ||
425 | chip->vendor.iobase + | ||
426 | TPM_INT_STATUS(chip->vendor.locality)); | ||
427 | return IRQ_HANDLED; | ||
428 | } | ||
429 | |||
430 | static int interrupts = 1; | ||
431 | module_param(interrupts, bool, 0444); | ||
432 | MODULE_PARM_DESC(interrupts, "Enable interrupts"); | ||
433 | |||
434 | static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | ||
435 | const struct pnp_device_id *pnp_id) | ||
436 | { | ||
437 | u32 vendor, intfcaps, intmask; | ||
438 | int rc, i; | ||
439 | unsigned long start, len; | ||
440 | struct tpm_chip *chip; | ||
441 | |||
442 | start = pnp_mem_start(pnp_dev, 0); | ||
443 | len = pnp_mem_len(pnp_dev, 0); | ||
444 | |||
445 | if (!start) | ||
446 | start = TIS_MEM_BASE; | ||
447 | if (!len) | ||
448 | len = TIS_MEM_LEN; | ||
449 | |||
450 | if (!(chip = tpm_register_hardware(&pnp_dev->dev, &tpm_tis))) | ||
451 | return -ENODEV; | ||
452 | |||
453 | chip->vendor.iobase = ioremap(start, len); | ||
454 | if (!chip->vendor.iobase) { | ||
455 | rc = -EIO; | ||
456 | goto out_err; | ||
457 | } | ||
458 | |||
459 | vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); | ||
460 | if ((vendor & 0xFFFF) == 0xFFFF) { | ||
461 | rc = -ENODEV; | ||
462 | goto out_err; | ||
463 | } | ||
464 | |||
465 | /* Default timeouts */ | ||
466 | chip->vendor.timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT); | ||
467 | chip->vendor.timeout_b = msecs_to_jiffies(TIS_LONG_TIMEOUT); | ||
468 | chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT); | ||
469 | chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT); | ||
470 | |||
471 | dev_info(&pnp_dev->dev, | ||
472 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", | ||
473 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); | ||
474 | |||
475 | /* Figure out the capabilities */ | ||
476 | intfcaps = | ||
477 | ioread32(chip->vendor.iobase + | ||
478 | TPM_INTF_CAPS(chip->vendor.locality)); | ||
479 | dev_dbg(&pnp_dev->dev, "TPM interface capabilities (0x%x):\n", | ||
480 | intfcaps); | ||
481 | if (intfcaps & TPM_INTF_BURST_COUNT_STATIC) | ||
482 | dev_dbg(&pnp_dev->dev, "\tBurst Count Static\n"); | ||
483 | if (intfcaps & TPM_INTF_CMD_READY_INT) | ||
484 | dev_dbg(&pnp_dev->dev, "\tCommand Ready Int Support\n"); | ||
485 | if (intfcaps & TPM_INTF_INT_EDGE_FALLING) | ||
486 | dev_dbg(&pnp_dev->dev, "\tInterrupt Edge Falling\n"); | ||
487 | if (intfcaps & TPM_INTF_INT_EDGE_RISING) | ||
488 | dev_dbg(&pnp_dev->dev, "\tInterrupt Edge Rising\n"); | ||
489 | if (intfcaps & TPM_INTF_INT_LEVEL_LOW) | ||
490 | dev_dbg(&pnp_dev->dev, "\tInterrupt Level Low\n"); | ||
491 | if (intfcaps & TPM_INTF_INT_LEVEL_HIGH) | ||
492 | dev_dbg(&pnp_dev->dev, "\tInterrupt Level High\n"); | ||
493 | if (intfcaps & TPM_INTF_LOCALITY_CHANGE_INT) | ||
494 | dev_dbg(&pnp_dev->dev, "\tLocality Change Int Support\n"); | ||
495 | if (intfcaps & TPM_INTF_STS_VALID_INT) | ||
496 | dev_dbg(&pnp_dev->dev, "\tSts Valid Int Support\n"); | ||
497 | if (intfcaps & TPM_INTF_DATA_AVAIL_INT) | ||
498 | dev_dbg(&pnp_dev->dev, "\tData Avail Int Support\n"); | ||
499 | |||
500 | if (request_locality(chip, 0) != 0) { | ||
501 | rc = -ENODEV; | ||
502 | goto out_err; | ||
503 | } | ||
504 | |||
505 | /* INTERRUPT Setup */ | ||
506 | init_waitqueue_head(&chip->vendor.read_queue); | ||
507 | init_waitqueue_head(&chip->vendor.int_queue); | ||
508 | |||
509 | intmask = | ||
510 | ioread32(chip->vendor.iobase + | ||
511 | TPM_INT_ENABLE(chip->vendor.locality)); | ||
512 | |||
513 | intmask |= TPM_INTF_CMD_READY_INT | ||
514 | | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT | ||
515 | | TPM_INTF_STS_VALID_INT; | ||
516 | |||
517 | iowrite32(intmask, | ||
518 | chip->vendor.iobase + | ||
519 | TPM_INT_ENABLE(chip->vendor.locality)); | ||
520 | if (interrupts) { | ||
521 | chip->vendor.irq = | ||
522 | ioread8(chip->vendor.iobase + | ||
523 | TPM_INT_VECTOR(chip->vendor.locality)); | ||
524 | |||
525 | for (i = 3; i < 16 && chip->vendor.irq == 0; i++) { | ||
526 | iowrite8(i, chip->vendor.iobase + | ||
527 | TPM_INT_VECTOR(chip->vendor.locality)); | ||
528 | if (request_irq | ||
529 | (i, tis_int_probe, SA_SHIRQ, | ||
530 | chip->vendor.miscdev.name, chip) != 0) { | ||
531 | dev_info(chip->dev, | ||
532 | "Unable to request irq: %d for probe\n", | ||
533 | i); | ||
534 | continue; | ||
535 | } | ||
536 | |||
537 | /* Clear all existing */ | ||
538 | iowrite32(ioread32 | ||
539 | (chip->vendor.iobase + | ||
540 | TPM_INT_STATUS(chip->vendor.locality)), | ||
541 | chip->vendor.iobase + | ||
542 | TPM_INT_STATUS(chip->vendor.locality)); | ||
543 | |||
544 | /* Turn on */ | ||
545 | iowrite32(intmask | TPM_GLOBAL_INT_ENABLE, | ||
546 | chip->vendor.iobase + | ||
547 | TPM_INT_ENABLE(chip->vendor.locality)); | ||
548 | |||
549 | /* Generate Interrupts */ | ||
550 | tpm_gen_interrupt(chip); | ||
551 | |||
552 | /* Turn off */ | ||
553 | iowrite32(intmask, | ||
554 | chip->vendor.iobase + | ||
555 | TPM_INT_ENABLE(chip->vendor.locality)); | ||
556 | free_irq(i, chip); | ||
557 | } | ||
558 | } | ||
559 | if (chip->vendor.irq) { | ||
560 | iowrite8(chip->vendor.irq, | ||
561 | chip->vendor.iobase + | ||
562 | TPM_INT_VECTOR(chip->vendor.locality)); | ||
563 | if (request_irq | ||
564 | (chip->vendor.irq, tis_int_handler, SA_SHIRQ, | ||
565 | chip->vendor.miscdev.name, chip) != 0) { | ||
566 | dev_info(chip->dev, | ||
567 | "Unable to request irq: %d for use\n", | ||
568 | chip->vendor.irq); | ||
569 | chip->vendor.irq = 0; | ||
570 | } else { | ||
571 | /* Clear all existing */ | ||
572 | iowrite32(ioread32 | ||
573 | (chip->vendor.iobase + | ||
574 | TPM_INT_STATUS(chip->vendor.locality)), | ||
575 | chip->vendor.iobase + | ||
576 | TPM_INT_STATUS(chip->vendor.locality)); | ||
577 | |||
578 | /* Turn on */ | ||
579 | iowrite32(intmask | TPM_GLOBAL_INT_ENABLE, | ||
580 | chip->vendor.iobase + | ||
581 | TPM_INT_ENABLE(chip->vendor.locality)); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | INIT_LIST_HEAD(&chip->vendor.list); | ||
586 | spin_lock(&tis_lock); | ||
587 | list_add(&chip->vendor.list, &tis_chips); | ||
588 | spin_unlock(&tis_lock); | ||
589 | |||
590 | tpm_get_timeouts(chip); | ||
591 | tpm_continue_selftest(chip); | ||
592 | |||
593 | return 0; | ||
594 | out_err: | ||
595 | if (chip->vendor.iobase) | ||
596 | iounmap(chip->vendor.iobase); | ||
597 | tpm_remove_hardware(chip->dev); | ||
598 | return rc; | ||
599 | } | ||
600 | |||
601 | static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) | ||
602 | { | ||
603 | return tpm_pm_suspend(&dev->dev, msg); | ||
604 | } | ||
605 | |||
606 | static int tpm_tis_pnp_resume(struct pnp_dev *dev) | ||
607 | { | ||
608 | return tpm_pm_resume(&dev->dev); | ||
609 | } | ||
610 | |||
611 | static struct pnp_device_id tpm_pnp_tbl[] __devinitdata = { | ||
612 | {"PNP0C31", 0}, /* TPM */ | ||
613 | {"ATM1200", 0}, /* Atmel */ | ||
614 | {"IFX0102", 0}, /* Infineon */ | ||
615 | {"BCM0101", 0}, /* Broadcom */ | ||
616 | {"NSC1200", 0}, /* National */ | ||
617 | /* Add new here */ | ||
618 | {"", 0}, /* User Specified */ | ||
619 | {"", 0} /* Terminator */ | ||
620 | }; | ||
621 | |||
622 | static struct pnp_driver tis_pnp_driver = { | ||
623 | .name = "tpm_tis", | ||
624 | .id_table = tpm_pnp_tbl, | ||
625 | .probe = tpm_tis_pnp_init, | ||
626 | .suspend = tpm_tis_pnp_suspend, | ||
627 | .resume = tpm_tis_pnp_resume, | ||
628 | }; | ||
629 | |||
630 | #define TIS_HID_USR_IDX sizeof(tpm_pnp_tbl)/sizeof(struct pnp_device_id) -2 | ||
631 | module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id, | ||
632 | sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); | ||
633 | MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); | ||
634 | |||
635 | static int __init init_tis(void) | ||
636 | { | ||
637 | return pnp_register_driver(&tis_pnp_driver); | ||
638 | } | ||
639 | |||
640 | static void __exit cleanup_tis(void) | ||
641 | { | ||
642 | struct tpm_vendor_specific *i, *j; | ||
643 | struct tpm_chip *chip; | ||
644 | spin_lock(&tis_lock); | ||
645 | list_for_each_entry_safe(i, j, &tis_chips, list) { | ||
646 | chip = to_tpm_chip(i); | ||
647 | iowrite32(~TPM_GLOBAL_INT_ENABLE & | ||
648 | ioread32(chip->vendor.iobase + | ||
649 | TPM_INT_ENABLE(chip->vendor. | ||
650 | locality)), | ||
651 | chip->vendor.iobase + | ||
652 | TPM_INT_ENABLE(chip->vendor.locality)); | ||
653 | release_locality(chip, chip->vendor.locality, 1); | ||
654 | if (chip->vendor.irq) | ||
655 | free_irq(chip->vendor.irq, chip); | ||
656 | iounmap(i->iobase); | ||
657 | list_del(&i->list); | ||
658 | tpm_remove_hardware(chip->dev); | ||
659 | } | ||
660 | spin_unlock(&tis_lock); | ||
661 | pnp_unregister_driver(&tis_pnp_driver); | ||
662 | } | ||
663 | |||
664 | module_init(init_tis); | ||
665 | module_exit(cleanup_tis); | ||
666 | MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)"); | ||
667 | MODULE_DESCRIPTION("TPM Driver"); | ||
668 | MODULE_VERSION("2.0"); | ||
669 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index f86ed6af3aa2..eb41aba3ddef 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
@@ -5,8 +5,6 @@ | |||
5 | * Tilman Schmidt <tilman@imap.cc>, | 5 | * Tilman Schmidt <tilman@imap.cc>, |
6 | * Stefan Eilers. | 6 | * Stefan Eilers. |
7 | * | 7 | * |
8 | * Based on usb-gigaset.c. | ||
9 | * | ||
10 | * ===================================================================== | 8 | * ===================================================================== |
11 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
12 | * modify it under the terms of the GNU General Public License as | 10 | * modify it under the terms of the GNU General Public License as |
@@ -46,19 +44,20 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode"); | |||
46 | #define GIGASET_DEVFSNAME "gig/bas/" | 44 | #define GIGASET_DEVFSNAME "gig/bas/" |
47 | #define GIGASET_DEVNAME "ttyGB" | 45 | #define GIGASET_DEVNAME "ttyGB" |
48 | 46 | ||
49 | #define IF_WRITEBUF 256 //FIXME | 47 | /* length limit according to Siemens 3070usb-protokoll.doc ch. 2.1 */ |
48 | #define IF_WRITEBUF 264 | ||
50 | 49 | ||
51 | /* Values for the Gigaset 307x */ | 50 | /* Values for the Gigaset 307x */ |
52 | #define USB_GIGA_VENDOR_ID 0x0681 | 51 | #define USB_GIGA_VENDOR_ID 0x0681 |
53 | #define USB_GIGA_PRODUCT_ID 0x0001 | 52 | #define USB_3070_PRODUCT_ID 0x0001 |
54 | #define USB_4175_PRODUCT_ID 0x0002 | 53 | #define USB_3075_PRODUCT_ID 0x0002 |
55 | #define USB_SX303_PRODUCT_ID 0x0021 | 54 | #define USB_SX303_PRODUCT_ID 0x0021 |
56 | #define USB_SX353_PRODUCT_ID 0x0022 | 55 | #define USB_SX353_PRODUCT_ID 0x0022 |
57 | 56 | ||
58 | /* table of devices that work with this driver */ | 57 | /* table of devices that work with this driver */ |
59 | static struct usb_device_id gigaset_table [] = { | 58 | static struct usb_device_id gigaset_table [] = { |
60 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_GIGA_PRODUCT_ID) }, | 59 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3070_PRODUCT_ID) }, |
61 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_4175_PRODUCT_ID) }, | 60 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3075_PRODUCT_ID) }, |
62 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) }, | 61 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) }, |
63 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX353_PRODUCT_ID) }, | 62 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX353_PRODUCT_ID) }, |
64 | { } /* Terminating entry */ | 63 | { } /* Terminating entry */ |
@@ -77,6 +76,10 @@ static int gigaset_probe(struct usb_interface *interface, | |||
77 | /* Function will be called if the device is unplugged */ | 76 | /* Function will be called if the device is unplugged */ |
78 | static void gigaset_disconnect(struct usb_interface *interface); | 77 | static void gigaset_disconnect(struct usb_interface *interface); |
79 | 78 | ||
79 | static void read_ctrl_callback(struct urb *, struct pt_regs *); | ||
80 | static void stopurbs(struct bas_bc_state *); | ||
81 | static int atwrite_submit(struct cardstate *, unsigned char *, int); | ||
82 | static int start_cbsend(struct cardstate *); | ||
80 | 83 | ||
81 | /*==============================================================================*/ | 84 | /*==============================================================================*/ |
82 | 85 | ||
@@ -111,12 +114,14 @@ struct bas_cardstate { | |||
111 | }; | 114 | }; |
112 | 115 | ||
113 | /* status of direct USB connection to 307x base (bits in basstate) */ | 116 | /* status of direct USB connection to 307x base (bits in basstate) */ |
114 | #define BS_ATOPEN 0x001 | 117 | #define BS_ATOPEN 0x001 /* AT channel open */ |
115 | #define BS_B1OPEN 0x002 | 118 | #define BS_B1OPEN 0x002 /* B channel 1 open */ |
116 | #define BS_B2OPEN 0x004 | 119 | #define BS_B2OPEN 0x004 /* B channel 2 open */ |
117 | #define BS_ATREADY 0x008 | 120 | #define BS_ATREADY 0x008 /* base ready for AT command */ |
118 | #define BS_INIT 0x010 | 121 | #define BS_INIT 0x010 /* base has signalled INIT_OK */ |
119 | #define BS_ATTIMER 0x020 | 122 | #define BS_ATTIMER 0x020 /* waiting for HD_READY_SEND_ATDATA */ |
123 | #define BS_ATRDPEND 0x040 /* urb_cmd_in in use */ | ||
124 | #define BS_ATWRPEND 0x080 /* urb_cmd_out in use */ | ||
120 | 125 | ||
121 | 126 | ||
122 | static struct gigaset_driver *driver = NULL; | 127 | static struct gigaset_driver *driver = NULL; |
@@ -130,6 +135,47 @@ static struct usb_driver gigaset_usb_driver = { | |||
130 | .id_table = gigaset_table, | 135 | .id_table = gigaset_table, |
131 | }; | 136 | }; |
132 | 137 | ||
138 | /* get message text for usb_submit_urb return code | ||
139 | */ | ||
140 | static char *get_usb_rcmsg(int rc) | ||
141 | { | ||
142 | static char unkmsg[28]; | ||
143 | |||
144 | switch (rc) { | ||
145 | case 0: | ||
146 | return "success"; | ||
147 | case -ENOMEM: | ||
148 | return "out of memory"; | ||
149 | case -ENODEV: | ||
150 | return "device not present"; | ||
151 | case -ENOENT: | ||
152 | return "endpoint not present"; | ||
153 | case -ENXIO: | ||
154 | return "URB type not supported"; | ||
155 | case -EINVAL: | ||
156 | return "invalid argument"; | ||
157 | case -EAGAIN: | ||
158 | return "start frame too early or too much scheduled"; | ||
159 | case -EFBIG: | ||
160 | return "too many isochronous frames requested"; | ||
161 | case -EPIPE: | ||
162 | return "endpoint stalled"; | ||
163 | case -EMSGSIZE: | ||
164 | return "invalid packet size"; | ||
165 | case -ENOSPC: | ||
166 | return "would overcommit USB bandwidth"; | ||
167 | case -ESHUTDOWN: | ||
168 | return "device shut down"; | ||
169 | case -EPERM: | ||
170 | return "reject flag set"; | ||
171 | case -EHOSTUNREACH: | ||
172 | return "device suspended"; | ||
173 | default: | ||
174 | snprintf(unkmsg, sizeof(unkmsg), "unknown error %d", rc); | ||
175 | return unkmsg; | ||
176 | } | ||
177 | } | ||
178 | |||
133 | /* get message text for USB status code | 179 | /* get message text for USB status code |
134 | */ | 180 | */ |
135 | static char *get_usb_statmsg(int status) | 181 | static char *get_usb_statmsg(int status) |
@@ -140,43 +186,37 @@ static char *get_usb_statmsg(int status) | |||
140 | case 0: | 186 | case 0: |
141 | return "success"; | 187 | return "success"; |
142 | case -ENOENT: | 188 | case -ENOENT: |
143 | return "canceled"; | 189 | return "unlinked (sync)"; |
144 | case -ECONNRESET: | ||
145 | return "canceled (async)"; | ||
146 | case -EINPROGRESS: | 190 | case -EINPROGRESS: |
147 | return "pending"; | 191 | return "pending"; |
148 | case -EPROTO: | 192 | case -EPROTO: |
149 | return "bit stuffing or unknown USB error"; | 193 | return "bit stuffing error, timeout, or unknown USB error"; |
150 | case -EILSEQ: | 194 | case -EILSEQ: |
151 | return "Illegal byte sequence (CRC mismatch)"; | 195 | return "CRC mismatch, timeout, or unknown USB error"; |
152 | case -EPIPE: | ||
153 | return "babble detect or endpoint stalled"; | ||
154 | case -ENOSR: | ||
155 | return "buffer error"; | ||
156 | case -ETIMEDOUT: | 196 | case -ETIMEDOUT: |
157 | return "timed out"; | 197 | return "timed out"; |
158 | case -ENODEV: | 198 | case -EPIPE: |
159 | return "device not present"; | 199 | return "endpoint stalled"; |
200 | case -ECOMM: | ||
201 | return "IN buffer overrun"; | ||
202 | case -ENOSR: | ||
203 | return "OUT buffer underrun"; | ||
204 | case -EOVERFLOW: | ||
205 | return "too much data"; | ||
160 | case -EREMOTEIO: | 206 | case -EREMOTEIO: |
161 | return "short packet detected"; | 207 | return "short packet detected"; |
208 | case -ENODEV: | ||
209 | return "device removed"; | ||
162 | case -EXDEV: | 210 | case -EXDEV: |
163 | return "partial isochronous transfer"; | 211 | return "partial isochronous transfer"; |
164 | case -EINVAL: | 212 | case -EINVAL: |
165 | return "invalid argument"; | 213 | return "invalid argument"; |
166 | case -ENXIO: | 214 | case -ECONNRESET: |
167 | return "URB already queued"; | 215 | return "unlinked (async)"; |
168 | case -EAGAIN: | ||
169 | return "isochronous start frame too early or too much scheduled"; | ||
170 | case -EFBIG: | ||
171 | return "too many isochronous frames requested"; | ||
172 | case -EMSGSIZE: | ||
173 | return "endpoint message size zero"; | ||
174 | case -ESHUTDOWN: | 216 | case -ESHUTDOWN: |
175 | return "endpoint shutdown"; | 217 | return "device shut down"; |
176 | case -EBUSY: | ||
177 | return "another request pending"; | ||
178 | default: | 218 | default: |
179 | snprintf(unkmsg, sizeof(unkmsg), "unknown error %d", status); | 219 | snprintf(unkmsg, sizeof(unkmsg), "unknown status %d", status); |
180 | return unkmsg; | 220 | return unkmsg; |
181 | } | 221 | } |
182 | } | 222 | } |
@@ -277,18 +317,17 @@ static inline void error_hangup(struct bc_state *bcs) | |||
277 | gig_dbg(DEBUG_ANY, "%s: scheduling HUP for channel %d", | 317 | gig_dbg(DEBUG_ANY, "%s: scheduling HUP for channel %d", |
278 | __func__, bcs->channel); | 318 | __func__, bcs->channel); |
279 | 319 | ||
280 | if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) { | 320 | if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) |
281 | //FIXME what should we do? | 321 | dev_err(cs->dev, "event queue full\n"); |
282 | return; | ||
283 | } | ||
284 | 322 | ||
285 | gigaset_schedule_event(cs); | 323 | gigaset_schedule_event(cs); |
286 | } | 324 | } |
287 | 325 | ||
288 | /* error_reset | 326 | /* error_reset |
289 | * reset Gigaset device because of an unrecoverable error | 327 | * reset Gigaset device because of an unrecoverable error |
290 | * This function may be called from any context and takes care of scheduling | 328 | * This function may be called from any context, and should take care of |
291 | * the necessary actions for execution outside of interrupt context. | 329 | * scheduling the necessary actions for execution outside of interrupt context. |
330 | * Right now, it just generates a kernel message calling for help. | ||
292 | * argument: | 331 | * argument: |
293 | * controller state structure | 332 | * controller state structure |
294 | */ | 333 | */ |
@@ -364,36 +403,38 @@ static void cmd_in_timeout(unsigned long data) | |||
364 | { | 403 | { |
365 | struct cardstate *cs = (struct cardstate *) data; | 404 | struct cardstate *cs = (struct cardstate *) data; |
366 | struct bas_cardstate *ucs = cs->hw.bas; | 405 | struct bas_cardstate *ucs = cs->hw.bas; |
367 | unsigned long flags; | ||
368 | 406 | ||
369 | spin_lock_irqsave(&cs->lock, flags); | ||
370 | if (unlikely(!cs->connected)) { | ||
371 | gig_dbg(DEBUG_USBREQ, "%s: disconnected", __func__); | ||
372 | spin_unlock_irqrestore(&cs->lock, flags); | ||
373 | return; | ||
374 | } | ||
375 | if (!ucs->rcvbuf_size) { | 407 | if (!ucs->rcvbuf_size) { |
376 | gig_dbg(DEBUG_USBREQ, "%s: no receive in progress", __func__); | 408 | gig_dbg(DEBUG_USBREQ, "%s: no receive in progress", __func__); |
377 | spin_unlock_irqrestore(&cs->lock, flags); | ||
378 | return; | 409 | return; |
379 | } | 410 | } |
380 | spin_unlock_irqrestore(&cs->lock, flags); | ||
381 | 411 | ||
382 | dev_err(cs->dev, "timeout reading AT response\n"); | 412 | dev_err(cs->dev, "timeout reading AT response\n"); |
383 | error_reset(cs); //FIXME retry? | 413 | error_reset(cs); //FIXME retry? |
384 | } | 414 | } |
385 | 415 | ||
416 | /* set/clear bits in base connection state, return previous state | ||
417 | */ | ||
418 | inline static int update_basstate(struct bas_cardstate *ucs, | ||
419 | int set, int clear) | ||
420 | { | ||
421 | unsigned long flags; | ||
422 | int state; | ||
386 | 423 | ||
387 | static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs); | 424 | spin_lock_irqsave(&ucs->lock, flags); |
425 | state = atomic_read(&ucs->basstate); | ||
426 | atomic_set(&ucs->basstate, (state & ~clear) | set); | ||
427 | spin_unlock_irqrestore(&ucs->lock, flags); | ||
428 | return state; | ||
429 | } | ||
388 | 430 | ||
389 | /* atread_submit | 431 | /* atread_submit |
390 | * submit an HD_READ_ATMESSAGE command URB | 432 | * submit an HD_READ_ATMESSAGE command URB and optionally start a timeout |
391 | * parameters: | 433 | * parameters: |
392 | * cs controller state structure | 434 | * cs controller state structure |
393 | * timeout timeout in 1/10 sec., 0: none | 435 | * timeout timeout in 1/10 sec., 0: none |
394 | * return value: | 436 | * return value: |
395 | * 0 on success | 437 | * 0 on success |
396 | * -EINVAL if a NULL pointer is encountered somewhere | ||
397 | * -EBUSY if another request is pending | 438 | * -EBUSY if another request is pending |
398 | * any URB submission error code | 439 | * any URB submission error code |
399 | */ | 440 | */ |
@@ -405,7 +446,7 @@ static int atread_submit(struct cardstate *cs, int timeout) | |||
405 | gig_dbg(DEBUG_USBREQ, "-------> HD_READ_ATMESSAGE (%d)", | 446 | gig_dbg(DEBUG_USBREQ, "-------> HD_READ_ATMESSAGE (%d)", |
406 | ucs->rcvbuf_size); | 447 | ucs->rcvbuf_size); |
407 | 448 | ||
408 | if (ucs->urb_cmd_in->status == -EINPROGRESS) { | 449 | if (update_basstate(ucs, BS_ATRDPEND, 0) & BS_ATRDPEND) { |
409 | dev_err(cs->dev, | 450 | dev_err(cs->dev, |
410 | "could not submit HD_READ_ATMESSAGE: URB busy\n"); | 451 | "could not submit HD_READ_ATMESSAGE: URB busy\n"); |
411 | return -EBUSY; | 452 | return -EBUSY; |
@@ -423,6 +464,7 @@ static int atread_submit(struct cardstate *cs, int timeout) | |||
423 | read_ctrl_callback, cs->inbuf); | 464 | read_ctrl_callback, cs->inbuf); |
424 | 465 | ||
425 | if ((ret = usb_submit_urb(ucs->urb_cmd_in, SLAB_ATOMIC)) != 0) { | 466 | if ((ret = usb_submit_urb(ucs->urb_cmd_in, SLAB_ATOMIC)) != 0) { |
467 | update_basstate(ucs, 0, BS_ATRDPEND); | ||
426 | dev_err(cs->dev, "could not submit HD_READ_ATMESSAGE: %s\n", | 468 | dev_err(cs->dev, "could not submit HD_READ_ATMESSAGE: %s\n", |
427 | get_usb_statmsg(ret)); | 469 | get_usb_statmsg(ret)); |
428 | return ret; | 470 | return ret; |
@@ -438,26 +480,6 @@ static int atread_submit(struct cardstate *cs, int timeout) | |||
438 | return 0; | 480 | return 0; |
439 | } | 481 | } |
440 | 482 | ||
441 | static void stopurbs(struct bas_bc_state *); | ||
442 | static int start_cbsend(struct cardstate *); | ||
443 | |||
444 | /* set/clear bits in base connection state | ||
445 | */ | ||
446 | inline static void update_basstate(struct bas_cardstate *ucs, | ||
447 | int set, int clear) | ||
448 | { | ||
449 | unsigned long flags; | ||
450 | int state; | ||
451 | |||
452 | spin_lock_irqsave(&ucs->lock, flags); | ||
453 | state = atomic_read(&ucs->basstate); | ||
454 | state &= ~clear; | ||
455 | state |= set; | ||
456 | atomic_set(&ucs->basstate, state); | ||
457 | spin_unlock_irqrestore(&ucs->lock, flags); | ||
458 | } | ||
459 | |||
460 | |||
461 | /* read_int_callback | 483 | /* read_int_callback |
462 | * USB completion handler for interrupt pipe input | 484 | * USB completion handler for interrupt pipe input |
463 | * called by the USB subsystem in interrupt context | 485 | * called by the USB subsystem in interrupt context |
@@ -471,20 +493,25 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
471 | struct bas_cardstate *ucs = cs->hw.bas; | 493 | struct bas_cardstate *ucs = cs->hw.bas; |
472 | struct bc_state *bcs; | 494 | struct bc_state *bcs; |
473 | unsigned long flags; | 495 | unsigned long flags; |
474 | int status; | 496 | int rc; |
475 | unsigned l; | 497 | unsigned l; |
476 | int channel; | 498 | int channel; |
477 | 499 | ||
478 | switch (urb->status) { | 500 | switch (urb->status) { |
479 | case 0: /* success */ | 501 | case 0: /* success */ |
480 | break; | 502 | break; |
481 | case -ENOENT: /* canceled */ | 503 | case -ENOENT: /* cancelled */ |
482 | case -ECONNRESET: /* canceled (async) */ | 504 | case -ECONNRESET: /* cancelled (async) */ |
483 | case -EINPROGRESS: /* pending */ | 505 | case -EINPROGRESS: /* pending */ |
484 | /* ignore silently */ | 506 | /* ignore silently */ |
485 | gig_dbg(DEBUG_USBREQ, "%s: %s", | 507 | gig_dbg(DEBUG_USBREQ, "%s: %s", |
486 | __func__, get_usb_statmsg(urb->status)); | 508 | __func__, get_usb_statmsg(urb->status)); |
487 | return; | 509 | return; |
510 | case -ENODEV: /* device removed */ | ||
511 | case -ESHUTDOWN: /* device shut down */ | ||
512 | //FIXME use this as disconnect indicator? | ||
513 | gig_dbg(DEBUG_USBREQ, "%s: device disconnected", __func__); | ||
514 | return; | ||
488 | default: /* severe trouble */ | 515 | default: /* severe trouble */ |
489 | dev_warn(cs->dev, "interrupt read: %s\n", | 516 | dev_warn(cs->dev, "interrupt read: %s\n", |
490 | get_usb_statmsg(urb->status)); | 517 | get_usb_statmsg(urb->status)); |
@@ -492,6 +519,13 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
492 | goto resubmit; | 519 | goto resubmit; |
493 | } | 520 | } |
494 | 521 | ||
522 | /* drop incomplete packets even if the missing bytes wouldn't matter */ | ||
523 | if (unlikely(urb->actual_length < 3)) { | ||
524 | dev_warn(cs->dev, "incomplete interrupt packet (%d bytes)\n", | ||
525 | urb->actual_length); | ||
526 | goto resubmit; | ||
527 | } | ||
528 | |||
495 | l = (unsigned) ucs->int_in_buf[1] + | 529 | l = (unsigned) ucs->int_in_buf[1] + |
496 | (((unsigned) ucs->int_in_buf[2]) << 8); | 530 | (((unsigned) ucs->int_in_buf[2]) << 8); |
497 | 531 | ||
@@ -558,25 +592,28 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
558 | } | 592 | } |
559 | spin_lock_irqsave(&cs->lock, flags); | 593 | spin_lock_irqsave(&cs->lock, flags); |
560 | if (ucs->rcvbuf_size) { | 594 | if (ucs->rcvbuf_size) { |
561 | spin_unlock_irqrestore(&cs->lock, flags); | 595 | /* throw away previous buffer - we have no queue */ |
562 | dev_err(cs->dev, | 596 | dev_err(cs->dev, |
563 | "receive AT data overrun, %d bytes lost\n", l); | 597 | "receive AT data overrun, %d bytes lost\n", |
564 | error_reset(cs); //FIXME reschedule | 598 | ucs->rcvbuf_size); |
565 | break; | 599 | kfree(ucs->rcvbuf); |
600 | ucs->rcvbuf_size = 0; | ||
566 | } | 601 | } |
567 | if ((ucs->rcvbuf = kmalloc(l, GFP_ATOMIC)) == NULL) { | 602 | if ((ucs->rcvbuf = kmalloc(l, GFP_ATOMIC)) == NULL) { |
568 | spin_unlock_irqrestore(&cs->lock, flags); | 603 | spin_unlock_irqrestore(&cs->lock, flags); |
569 | dev_err(cs->dev, "out of memory, %d bytes lost\n", l); | 604 | dev_err(cs->dev, "out of memory receiving AT data\n"); |
570 | error_reset(cs); //FIXME reschedule | 605 | error_reset(cs); |
571 | break; | 606 | break; |
572 | } | 607 | } |
573 | ucs->rcvbuf_size = l; | 608 | ucs->rcvbuf_size = l; |
574 | ucs->retry_cmd_in = 0; | 609 | ucs->retry_cmd_in = 0; |
575 | if ((status = atread_submit(cs, BAS_TIMEOUT)) < 0) { | 610 | if ((rc = atread_submit(cs, BAS_TIMEOUT)) < 0) { |
576 | kfree(ucs->rcvbuf); | 611 | kfree(ucs->rcvbuf); |
577 | ucs->rcvbuf = NULL; | 612 | ucs->rcvbuf = NULL; |
578 | ucs->rcvbuf_size = 0; | 613 | ucs->rcvbuf_size = 0; |
579 | error_reset(cs); //FIXME reschedule | 614 | if (rc != -ENODEV) |
615 | //FIXME corrective action? | ||
616 | error_reset(cs); | ||
580 | } | 617 | } |
581 | spin_unlock_irqrestore(&cs->lock, flags); | 618 | spin_unlock_irqrestore(&cs->lock, flags); |
582 | break; | 619 | break; |
@@ -598,12 +635,10 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
598 | check_pending(ucs); | 635 | check_pending(ucs); |
599 | 636 | ||
600 | resubmit: | 637 | resubmit: |
601 | spin_lock_irqsave(&cs->lock, flags); | 638 | rc = usb_submit_urb(urb, SLAB_ATOMIC); |
602 | status = cs->connected ? usb_submit_urb(urb, SLAB_ATOMIC) : -ENODEV; | 639 | if (unlikely(rc != 0 && rc != -ENODEV)) { |
603 | spin_unlock_irqrestore(&cs->lock, flags); | ||
604 | if (unlikely(status)) { | ||
605 | dev_err(cs->dev, "could not resubmit interrupt URB: %s\n", | 640 | dev_err(cs->dev, "could not resubmit interrupt URB: %s\n", |
606 | get_usb_statmsg(status)); | 641 | get_usb_rcmsg(rc)); |
607 | error_reset(cs); | 642 | error_reset(cs); |
608 | } | 643 | } |
609 | } | 644 | } |
@@ -622,18 +657,12 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) | |||
622 | struct bas_cardstate *ucs = cs->hw.bas; | 657 | struct bas_cardstate *ucs = cs->hw.bas; |
623 | int have_data = 0; | 658 | int have_data = 0; |
624 | unsigned numbytes; | 659 | unsigned numbytes; |
625 | unsigned long flags; | 660 | int rc; |
626 | 661 | ||
627 | spin_lock_irqsave(&cs->lock, flags); | 662 | update_basstate(ucs, 0, BS_ATRDPEND); |
628 | if (unlikely(!cs->connected)) { | ||
629 | warn("%s: disconnected", __func__); | ||
630 | spin_unlock_irqrestore(&cs->lock, flags); | ||
631 | return; | ||
632 | } | ||
633 | 663 | ||
634 | if (!ucs->rcvbuf_size) { | 664 | if (!ucs->rcvbuf_size) { |
635 | dev_warn(cs->dev, "%s: no receive in progress\n", __func__); | 665 | dev_warn(cs->dev, "%s: no receive in progress\n", __func__); |
636 | spin_unlock_irqrestore(&cs->lock, flags); | ||
637 | return; | 666 | return; |
638 | } | 667 | } |
639 | 668 | ||
@@ -666,9 +695,11 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) | |||
666 | } | 695 | } |
667 | break; | 696 | break; |
668 | 697 | ||
669 | case -ENOENT: /* canceled */ | 698 | case -ENOENT: /* cancelled */ |
670 | case -ECONNRESET: /* canceled (async) */ | 699 | case -ECONNRESET: /* cancelled (async) */ |
671 | case -EINPROGRESS: /* pending */ | 700 | case -EINPROGRESS: /* pending */ |
701 | case -ENODEV: /* device removed */ | ||
702 | case -ESHUTDOWN: /* device shut down */ | ||
672 | /* no action necessary */ | 703 | /* no action necessary */ |
673 | gig_dbg(DEBUG_USBREQ, "%s: %s", | 704 | gig_dbg(DEBUG_USBREQ, "%s: %s", |
674 | __func__, get_usb_statmsg(urb->status)); | 705 | __func__, get_usb_statmsg(urb->status)); |
@@ -681,11 +712,11 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) | |||
681 | if (ucs->retry_cmd_in++ < BAS_RETRY) { | 712 | if (ucs->retry_cmd_in++ < BAS_RETRY) { |
682 | dev_notice(cs->dev, "control read: retry %d\n", | 713 | dev_notice(cs->dev, "control read: retry %d\n", |
683 | ucs->retry_cmd_in); | 714 | ucs->retry_cmd_in); |
684 | if (atread_submit(cs, BAS_TIMEOUT) >= 0) { | 715 | rc = atread_submit(cs, BAS_TIMEOUT); |
685 | /* resubmitted - bypass regular exit block */ | 716 | if (rc >= 0 || rc == -ENODEV) |
686 | spin_unlock_irqrestore(&cs->lock, flags); | 717 | /* resubmitted or disconnected */ |
718 | /* - bypass regular exit block */ | ||
687 | return; | 719 | return; |
688 | } | ||
689 | } else { | 720 | } else { |
690 | dev_err(cs->dev, | 721 | dev_err(cs->dev, |
691 | "control read: giving up after %d tries\n", | 722 | "control read: giving up after %d tries\n", |
@@ -697,7 +728,6 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) | |||
697 | kfree(ucs->rcvbuf); | 728 | kfree(ucs->rcvbuf); |
698 | ucs->rcvbuf = NULL; | 729 | ucs->rcvbuf = NULL; |
699 | ucs->rcvbuf_size = 0; | 730 | ucs->rcvbuf_size = 0; |
700 | spin_unlock_irqrestore(&cs->lock, flags); | ||
701 | if (have_data) { | 731 | if (have_data) { |
702 | gig_dbg(DEBUG_INTR, "%s-->BH", __func__); | 732 | gig_dbg(DEBUG_INTR, "%s-->BH", __func__); |
703 | gigaset_schedule_event(cs); | 733 | gigaset_schedule_event(cs); |
@@ -719,8 +749,11 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs) | |||
719 | int i, rc; | 749 | int i, rc; |
720 | 750 | ||
721 | /* status codes not worth bothering the tasklet with */ | 751 | /* status codes not worth bothering the tasklet with */ |
722 | if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || | 752 | if (unlikely(urb->status == -ENOENT || |
723 | urb->status == -EINPROGRESS)) { | 753 | urb->status == -ECONNRESET || |
754 | urb->status == -EINPROGRESS || | ||
755 | urb->status == -ENODEV || | ||
756 | urb->status == -ESHUTDOWN)) { | ||
724 | gig_dbg(DEBUG_ISO, "%s: %s", | 757 | gig_dbg(DEBUG_ISO, "%s: %s", |
725 | __func__, get_usb_statmsg(urb->status)); | 758 | __func__, get_usb_statmsg(urb->status)); |
726 | return; | 759 | return; |
@@ -740,9 +773,9 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs) | |||
740 | for (i = 0; i < BAS_NUMFRAMES; i++) { | 773 | for (i = 0; i < BAS_NUMFRAMES; i++) { |
741 | ubc->isoinlost += urb->iso_frame_desc[i].actual_length; | 774 | ubc->isoinlost += urb->iso_frame_desc[i].actual_length; |
742 | if (unlikely(urb->iso_frame_desc[i].status != 0 && | 775 | if (unlikely(urb->iso_frame_desc[i].status != 0 && |
743 | urb->iso_frame_desc[i].status != -EINPROGRESS)) { | 776 | urb->iso_frame_desc[i].status != |
777 | -EINPROGRESS)) | ||
744 | ubc->loststatus = urb->iso_frame_desc[i].status; | 778 | ubc->loststatus = urb->iso_frame_desc[i].status; |
745 | } | ||
746 | urb->iso_frame_desc[i].status = 0; | 779 | urb->iso_frame_desc[i].status = 0; |
747 | urb->iso_frame_desc[i].actual_length = 0; | 780 | urb->iso_frame_desc[i].actual_length = 0; |
748 | } | 781 | } |
@@ -754,10 +787,10 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs) | |||
754 | gig_dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit", | 787 | gig_dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit", |
755 | __func__); | 788 | __func__); |
756 | rc = usb_submit_urb(urb, SLAB_ATOMIC); | 789 | rc = usb_submit_urb(urb, SLAB_ATOMIC); |
757 | if (unlikely(rc != 0)) { | 790 | if (unlikely(rc != 0 && rc != -ENODEV)) { |
758 | dev_err(bcs->cs->dev, | 791 | dev_err(bcs->cs->dev, |
759 | "could not resubmit isochronous read " | 792 | "could not resubmit isochronous read " |
760 | "URB: %s\n", get_usb_statmsg(rc)); | 793 | "URB: %s\n", get_usb_rcmsg(rc)); |
761 | dump_urb(DEBUG_ISO, "isoc read", urb); | 794 | dump_urb(DEBUG_ISO, "isoc read", urb); |
762 | error_hangup(bcs); | 795 | error_hangup(bcs); |
763 | } | 796 | } |
@@ -780,8 +813,11 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs) | |||
780 | unsigned long flags; | 813 | unsigned long flags; |
781 | 814 | ||
782 | /* status codes not worth bothering the tasklet with */ | 815 | /* status codes not worth bothering the tasklet with */ |
783 | if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || | 816 | if (unlikely(urb->status == -ENOENT || |
784 | urb->status == -EINPROGRESS)) { | 817 | urb->status == -ECONNRESET || |
818 | urb->status == -EINPROGRESS || | ||
819 | urb->status == -ENODEV || | ||
820 | urb->status == -ESHUTDOWN)) { | ||
785 | gig_dbg(DEBUG_ISO, "%s: %s", | 821 | gig_dbg(DEBUG_ISO, "%s: %s", |
786 | __func__, get_usb_statmsg(urb->status)); | 822 | __func__, get_usb_statmsg(urb->status)); |
787 | return; | 823 | return; |
@@ -822,7 +858,6 @@ static int starturbs(struct bc_state *bcs) | |||
822 | for (k = 0; k < BAS_INURBS; k++) { | 858 | for (k = 0; k < BAS_INURBS; k++) { |
823 | urb = ubc->isoinurbs[k]; | 859 | urb = ubc->isoinurbs[k]; |
824 | if (!urb) { | 860 | if (!urb) { |
825 | dev_err(bcs->cs->dev, "isoinurbs[%d]==NULL\n", k); | ||
826 | rc = -EFAULT; | 861 | rc = -EFAULT; |
827 | goto error; | 862 | goto error; |
828 | } | 863 | } |
@@ -844,12 +879,8 @@ static int starturbs(struct bc_state *bcs) | |||
844 | } | 879 | } |
845 | 880 | ||
846 | dump_urb(DEBUG_ISO, "Initial isoc read", urb); | 881 | dump_urb(DEBUG_ISO, "Initial isoc read", urb); |
847 | if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) { | 882 | if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) |
848 | dev_err(bcs->cs->dev, | ||
849 | "could not submit isochronous read URB %d: %s\n", | ||
850 | k, get_usb_statmsg(rc)); | ||
851 | goto error; | 883 | goto error; |
852 | } | ||
853 | } | 884 | } |
854 | 885 | ||
855 | /* initialize L2 transmission */ | 886 | /* initialize L2 transmission */ |
@@ -859,7 +890,6 @@ static int starturbs(struct bc_state *bcs) | |||
859 | for (k = 0; k < BAS_OUTURBS; ++k) { | 890 | for (k = 0; k < BAS_OUTURBS; ++k) { |
860 | urb = ubc->isoouturbs[k].urb; | 891 | urb = ubc->isoouturbs[k].urb; |
861 | if (!urb) { | 892 | if (!urb) { |
862 | dev_err(bcs->cs->dev, "isoouturbs[%d].urb==NULL\n", k); | ||
863 | rc = -EFAULT; | 893 | rc = -EFAULT; |
864 | goto error; | 894 | goto error; |
865 | } | 895 | } |
@@ -885,12 +915,8 @@ static int starturbs(struct bc_state *bcs) | |||
885 | for (k = 0; k < 2; ++k) { | 915 | for (k = 0; k < 2; ++k) { |
886 | dump_urb(DEBUG_ISO, "Initial isoc write", urb); | 916 | dump_urb(DEBUG_ISO, "Initial isoc write", urb); |
887 | rc = usb_submit_urb(ubc->isoouturbs[k].urb, SLAB_ATOMIC); | 917 | rc = usb_submit_urb(ubc->isoouturbs[k].urb, SLAB_ATOMIC); |
888 | if (rc != 0) { | 918 | if (rc != 0) |
889 | dev_err(bcs->cs->dev, | ||
890 | "could not submit isochronous write URB %d: %s\n", | ||
891 | k, get_usb_statmsg(rc)); | ||
892 | goto error; | 919 | goto error; |
893 | } | ||
894 | } | 920 | } |
895 | dump_urb(DEBUG_ISO, "Initial isoc write (free)", urb); | 921 | dump_urb(DEBUG_ISO, "Initial isoc write (free)", urb); |
896 | ubc->isooutfree = &ubc->isoouturbs[2]; | 922 | ubc->isooutfree = &ubc->isoouturbs[2]; |
@@ -916,15 +942,15 @@ static void stopurbs(struct bas_bc_state *ubc) | |||
916 | for (k = 0; k < BAS_INURBS; ++k) { | 942 | for (k = 0; k < BAS_INURBS; ++k) { |
917 | rc = usb_unlink_urb(ubc->isoinurbs[k]); | 943 | rc = usb_unlink_urb(ubc->isoinurbs[k]); |
918 | gig_dbg(DEBUG_ISO, | 944 | gig_dbg(DEBUG_ISO, |
919 | "%s: isoc input URB %d unlinked, result = %d", | 945 | "%s: isoc input URB %d unlinked, result = %s", |
920 | __func__, k, rc); | 946 | __func__, k, get_usb_rcmsg(rc)); |
921 | } | 947 | } |
922 | 948 | ||
923 | for (k = 0; k < BAS_OUTURBS; ++k) { | 949 | for (k = 0; k < BAS_OUTURBS; ++k) { |
924 | rc = usb_unlink_urb(ubc->isoouturbs[k].urb); | 950 | rc = usb_unlink_urb(ubc->isoouturbs[k].urb); |
925 | gig_dbg(DEBUG_ISO, | 951 | gig_dbg(DEBUG_ISO, |
926 | "%s: isoc output URB %d unlinked, result = %d", | 952 | "%s: isoc output URB %d unlinked, result = %s", |
927 | __func__, k, rc); | 953 | __func__, k, get_usb_rcmsg(rc)); |
928 | } | 954 | } |
929 | } | 955 | } |
930 | 956 | ||
@@ -934,7 +960,7 @@ static void stopurbs(struct bas_bc_state *ubc) | |||
934 | /* submit_iso_write_urb | 960 | /* submit_iso_write_urb |
935 | * fill and submit the next isochronous write URB | 961 | * fill and submit the next isochronous write URB |
936 | * parameters: | 962 | * parameters: |
937 | * bcs B channel state structure | 963 | * ucx context structure containing URB |
938 | * return value: | 964 | * return value: |
939 | * number of frames submitted in URB | 965 | * number of frames submitted in URB |
940 | * 0 if URB not submitted because no data available (isooutbuf busy) | 966 | * 0 if URB not submitted because no data available (isooutbuf busy) |
@@ -946,7 +972,6 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx) | |||
946 | struct bas_bc_state *ubc = ucx->bcs->hw.bas; | 972 | struct bas_bc_state *ubc = ucx->bcs->hw.bas; |
947 | struct usb_iso_packet_descriptor *ifd; | 973 | struct usb_iso_packet_descriptor *ifd; |
948 | int corrbytes, nframe, rc; | 974 | int corrbytes, nframe, rc; |
949 | unsigned long flags; | ||
950 | 975 | ||
951 | /* urb->dev is clobbered by USB subsystem */ | 976 | /* urb->dev is clobbered by USB subsystem */ |
952 | urb->dev = ucx->bcs->cs->hw.bas->udev; | 977 | urb->dev = ucx->bcs->cs->hw.bas->udev; |
@@ -992,20 +1017,22 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx) | |||
992 | ifd->status = 0; | 1017 | ifd->status = 0; |
993 | ifd->actual_length = 0; | 1018 | ifd->actual_length = 0; |
994 | } | 1019 | } |
995 | if ((urb->number_of_packets = nframe) > 0) { | 1020 | if (unlikely(nframe == 0)) |
996 | spin_lock_irqsave(&ucx->bcs->cs->lock, flags); | 1021 | return 0; /* no data to send */ |
997 | rc = ucx->bcs->cs->connected ? usb_submit_urb(urb, SLAB_ATOMIC) : -ENODEV; | 1022 | urb->number_of_packets = nframe; |
998 | spin_unlock_irqrestore(&ucx->bcs->cs->lock, flags); | ||
999 | 1023 | ||
1000 | if (rc) { | 1024 | rc = usb_submit_urb(urb, SLAB_ATOMIC); |
1025 | if (unlikely(rc)) { | ||
1026 | if (rc == -ENODEV) | ||
1027 | /* device removed - give up silently */ | ||
1028 | gig_dbg(DEBUG_ISO, "%s: disconnected", __func__); | ||
1029 | else | ||
1001 | dev_err(ucx->bcs->cs->dev, | 1030 | dev_err(ucx->bcs->cs->dev, |
1002 | "could not submit isochronous write URB: %s\n", | 1031 | "could not submit isochronous write URB: %s\n", |
1003 | get_usb_statmsg(rc)); | 1032 | get_usb_rcmsg(rc)); |
1004 | dump_urb(DEBUG_ISO, "isoc write", urb); | 1033 | return rc; |
1005 | return rc; | ||
1006 | } | ||
1007 | ++ubc->numsub; | ||
1008 | } | 1034 | } |
1035 | ++ubc->numsub; | ||
1009 | return nframe; | 1036 | return nframe; |
1010 | } | 1037 | } |
1011 | 1038 | ||
@@ -1028,6 +1055,7 @@ static void write_iso_tasklet(unsigned long data) | |||
1028 | int i; | 1055 | int i; |
1029 | struct sk_buff *skb; | 1056 | struct sk_buff *skb; |
1030 | int len; | 1057 | int len; |
1058 | int rc; | ||
1031 | 1059 | ||
1032 | /* loop while completed URBs arrive in time */ | 1060 | /* loop while completed URBs arrive in time */ |
1033 | for (;;) { | 1061 | for (;;) { |
@@ -1057,7 +1085,8 @@ static void write_iso_tasklet(unsigned long data) | |||
1057 | ubc->isooutfree = NULL; | 1085 | ubc->isooutfree = NULL; |
1058 | spin_unlock_irqrestore(&ubc->isooutlock, flags); | 1086 | spin_unlock_irqrestore(&ubc->isooutlock, flags); |
1059 | if (next) { | 1087 | if (next) { |
1060 | if (submit_iso_write_urb(next) <= 0) { | 1088 | rc = submit_iso_write_urb(next); |
1089 | if (unlikely(rc <= 0 && rc != -ENODEV)) { | ||
1061 | /* could not submit URB, put it back */ | 1090 | /* could not submit URB, put it back */ |
1062 | spin_lock_irqsave(&ubc->isooutlock, flags); | 1091 | spin_lock_irqsave(&ubc->isooutlock, flags); |
1063 | if (ubc->isooutfree == NULL) { | 1092 | if (ubc->isooutfree == NULL) { |
@@ -1077,17 +1106,18 @@ static void write_iso_tasklet(unsigned long data) | |||
1077 | /* process completed URB */ | 1106 | /* process completed URB */ |
1078 | urb = done->urb; | 1107 | urb = done->urb; |
1079 | switch (urb->status) { | 1108 | switch (urb->status) { |
1109 | case -EXDEV: /* partial completion */ | ||
1110 | gig_dbg(DEBUG_ISO, "%s: URB partially completed", | ||
1111 | __func__); | ||
1112 | /* fall through - what's the difference anyway? */ | ||
1080 | case 0: /* normal completion */ | 1113 | case 0: /* normal completion */ |
1081 | break; | 1114 | /* inspect individual frames |
1082 | case -EXDEV: /* inspect individual frames */ | 1115 | * assumptions (for lack of documentation): |
1083 | /* assumptions (for lack of documentation): | 1116 | * - actual_length bytes of first frame in error are |
1084 | * - actual_length bytes of the frame in error are | ||
1085 | * successfully sent | 1117 | * successfully sent |
1086 | * - all following frames are not sent at all | 1118 | * - all following frames are not sent at all |
1087 | */ | 1119 | */ |
1088 | gig_dbg(DEBUG_ISO, "%s: URB partially completed", | 1120 | offset = done->limit; /* default (no error) */ |
1089 | __func__); | ||
1090 | offset = done->limit; /* just in case */ | ||
1091 | for (i = 0; i < BAS_NUMFRAMES; i++) { | 1121 | for (i = 0; i < BAS_NUMFRAMES; i++) { |
1092 | ifd = &urb->iso_frame_desc[i]; | 1122 | ifd = &urb->iso_frame_desc[i]; |
1093 | if (ifd->status || | 1123 | if (ifd->status || |
@@ -1122,7 +1152,7 @@ static void write_iso_tasklet(unsigned long data) | |||
1122 | } | 1152 | } |
1123 | #endif | 1153 | #endif |
1124 | break; | 1154 | break; |
1125 | case -EPIPE: //FIXME is this the code for "underrun"? | 1155 | case -EPIPE: /* stall - probably underrun */ |
1126 | dev_err(cs->dev, "isochronous write stalled\n"); | 1156 | dev_err(cs->dev, "isochronous write stalled\n"); |
1127 | error_hangup(bcs); | 1157 | error_hangup(bcs); |
1128 | break; | 1158 | break; |
@@ -1142,7 +1172,8 @@ static void write_iso_tasklet(unsigned long data) | |||
1142 | spin_unlock_irqrestore(&ubc->isooutlock, flags); | 1172 | spin_unlock_irqrestore(&ubc->isooutlock, flags); |
1143 | if (next) { | 1173 | if (next) { |
1144 | /* only one URB still active - resubmit one */ | 1174 | /* only one URB still active - resubmit one */ |
1145 | if (submit_iso_write_urb(next) <= 0) { | 1175 | rc = submit_iso_write_urb(next); |
1176 | if (unlikely(rc <= 0 && rc != -ENODEV)) { | ||
1146 | /* couldn't submit */ | 1177 | /* couldn't submit */ |
1147 | error_hangup(bcs); | 1178 | error_hangup(bcs); |
1148 | } | 1179 | } |
@@ -1222,10 +1253,9 @@ static void read_iso_tasklet(unsigned long data) | |||
1222 | break; | 1253 | break; |
1223 | case -ENOENT: | 1254 | case -ENOENT: |
1224 | case -ECONNRESET: | 1255 | case -ECONNRESET: |
1225 | gig_dbg(DEBUG_ISO, "%s: URB canceled", __func__); | 1256 | case -EINPROGRESS: |
1226 | continue; /* -> skip */ | 1257 | gig_dbg(DEBUG_ISO, "%s: %s", |
1227 | case -EINPROGRESS: /* huh? */ | 1258 | __func__, get_usb_statmsg(urb->status)); |
1228 | gig_dbg(DEBUG_ISO, "%s: URB still pending", __func__); | ||
1229 | continue; /* -> skip */ | 1259 | continue; /* -> skip */ |
1230 | case -EPIPE: | 1260 | case -EPIPE: |
1231 | dev_err(cs->dev, "isochronous read stalled\n"); | 1261 | dev_err(cs->dev, "isochronous read stalled\n"); |
@@ -1290,13 +1320,11 @@ static void read_iso_tasklet(unsigned long data) | |||
1290 | urb->dev = bcs->cs->hw.bas->udev; | 1320 | urb->dev = bcs->cs->hw.bas->udev; |
1291 | urb->transfer_flags = URB_ISO_ASAP; | 1321 | urb->transfer_flags = URB_ISO_ASAP; |
1292 | urb->number_of_packets = BAS_NUMFRAMES; | 1322 | urb->number_of_packets = BAS_NUMFRAMES; |
1293 | spin_lock_irqsave(&cs->lock, flags); | 1323 | rc = usb_submit_urb(urb, SLAB_ATOMIC); |
1294 | rc = cs->connected ? usb_submit_urb(urb, SLAB_ATOMIC) : -ENODEV; | 1324 | if (unlikely(rc != 0 && rc != -ENODEV)) { |
1295 | spin_unlock_irqrestore(&cs->lock, flags); | ||
1296 | if (rc) { | ||
1297 | dev_err(cs->dev, | 1325 | dev_err(cs->dev, |
1298 | "could not resubmit isochronous read URB: %s\n", | 1326 | "could not resubmit isochronous read URB: %s\n", |
1299 | get_usb_statmsg(rc)); | 1327 | get_usb_rcmsg(rc)); |
1300 | dump_urb(DEBUG_ISO, "resubmit iso read", urb); | 1328 | dump_urb(DEBUG_ISO, "resubmit iso read", urb); |
1301 | error_hangup(bcs); | 1329 | error_hangup(bcs); |
1302 | } | 1330 | } |
@@ -1397,7 +1425,6 @@ static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs) | |||
1397 | * timeout timeout in seconds (0: no timeout) | 1425 | * timeout timeout in seconds (0: no timeout) |
1398 | * return value: | 1426 | * return value: |
1399 | * 0 on success | 1427 | * 0 on success |
1400 | * -EINVAL if a NULL pointer is encountered somewhere | ||
1401 | * -EBUSY if another request is pending | 1428 | * -EBUSY if another request is pending |
1402 | * any URB submission error code | 1429 | * any URB submission error code |
1403 | */ | 1430 | */ |
@@ -1418,12 +1445,6 @@ static int req_submit(struct bc_state *bcs, int req, int val, int timeout) | |||
1418 | req, ucs->pending); | 1445 | req, ucs->pending); |
1419 | return -EBUSY; | 1446 | return -EBUSY; |
1420 | } | 1447 | } |
1421 | if (ucs->urb_ctrl->status == -EINPROGRESS) { | ||
1422 | spin_unlock_irqrestore(&ucs->lock, flags); | ||
1423 | dev_err(bcs->cs->dev, | ||
1424 | "could not submit request 0x%02x: URB busy\n", req); | ||
1425 | return -EBUSY; | ||
1426 | } | ||
1427 | 1448 | ||
1428 | ucs->dr_ctrl.bRequestType = OUT_VENDOR_REQ; | 1449 | ucs->dr_ctrl.bRequestType = OUT_VENDOR_REQ; |
1429 | ucs->dr_ctrl.bRequest = req; | 1450 | ucs->dr_ctrl.bRequest = req; |
@@ -1465,22 +1486,36 @@ static int req_submit(struct bc_state *bcs, int req, int val, int timeout) | |||
1465 | static int gigaset_init_bchannel(struct bc_state *bcs) | 1486 | static int gigaset_init_bchannel(struct bc_state *bcs) |
1466 | { | 1487 | { |
1467 | int req, ret; | 1488 | int req, ret; |
1489 | unsigned long flags; | ||
1490 | |||
1491 | spin_lock_irqsave(&bcs->cs->lock, flags); | ||
1492 | if (unlikely(!bcs->cs->connected)) { | ||
1493 | gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); | ||
1494 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | ||
1495 | return -ENODEV; | ||
1496 | } | ||
1468 | 1497 | ||
1469 | if ((ret = starturbs(bcs)) < 0) { | 1498 | if ((ret = starturbs(bcs)) < 0) { |
1470 | dev_err(bcs->cs->dev, | 1499 | dev_err(bcs->cs->dev, |
1471 | "could not start isochronous I/O for channel %d\n", | 1500 | "could not start isochronous I/O for channel B%d: %s\n", |
1472 | bcs->channel + 1); | 1501 | bcs->channel + 1, |
1473 | error_hangup(bcs); | 1502 | ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret)); |
1503 | if (ret != -ENODEV) | ||
1504 | error_hangup(bcs); | ||
1505 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | ||
1474 | return ret; | 1506 | return ret; |
1475 | } | 1507 | } |
1476 | 1508 | ||
1477 | req = bcs->channel ? HD_OPEN_B2CHANNEL : HD_OPEN_B1CHANNEL; | 1509 | req = bcs->channel ? HD_OPEN_B2CHANNEL : HD_OPEN_B1CHANNEL; |
1478 | if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) { | 1510 | if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) { |
1479 | dev_err(bcs->cs->dev, "could not open channel %d: %s\n", | 1511 | dev_err(bcs->cs->dev, "could not open channel B%d\n", |
1480 | bcs->channel + 1, get_usb_statmsg(ret)); | 1512 | bcs->channel + 1); |
1481 | stopurbs(bcs->hw.bas); | 1513 | stopurbs(bcs->hw.bas); |
1482 | error_hangup(bcs); | 1514 | if (ret != -ENODEV) |
1515 | error_hangup(bcs); | ||
1483 | } | 1516 | } |
1517 | |||
1518 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | ||
1484 | return ret; | 1519 | return ret; |
1485 | } | 1520 | } |
1486 | 1521 | ||
@@ -1497,19 +1532,30 @@ static int gigaset_init_bchannel(struct bc_state *bcs) | |||
1497 | static int gigaset_close_bchannel(struct bc_state *bcs) | 1532 | static int gigaset_close_bchannel(struct bc_state *bcs) |
1498 | { | 1533 | { |
1499 | int req, ret; | 1534 | int req, ret; |
1535 | unsigned long flags; | ||
1536 | |||
1537 | spin_lock_irqsave(&bcs->cs->lock, flags); | ||
1538 | if (unlikely(!bcs->cs->connected)) { | ||
1539 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | ||
1540 | gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); | ||
1541 | return -ENODEV; | ||
1542 | } | ||
1500 | 1543 | ||
1501 | if (!(atomic_read(&bcs->cs->hw.bas->basstate) & | 1544 | if (!(atomic_read(&bcs->cs->hw.bas->basstate) & |
1502 | (bcs->channel ? BS_B2OPEN : BS_B1OPEN))) { | 1545 | (bcs->channel ? BS_B2OPEN : BS_B1OPEN))) { |
1503 | /* channel not running: just signal common.c */ | 1546 | /* channel not running: just signal common.c */ |
1547 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | ||
1504 | gigaset_bchannel_down(bcs); | 1548 | gigaset_bchannel_down(bcs); |
1505 | return 0; | 1549 | return 0; |
1506 | } | 1550 | } |
1507 | 1551 | ||
1552 | /* channel running: tell device to close it */ | ||
1508 | req = bcs->channel ? HD_CLOSE_B2CHANNEL : HD_CLOSE_B1CHANNEL; | 1553 | req = bcs->channel ? HD_CLOSE_B2CHANNEL : HD_CLOSE_B1CHANNEL; |
1509 | if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) | 1554 | if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) |
1510 | dev_err(bcs->cs->dev, | 1555 | dev_err(bcs->cs->dev, "closing channel B%d failed\n", |
1511 | "could not submit HD_CLOSE_BxCHANNEL request: %s\n", | 1556 | bcs->channel + 1); |
1512 | get_usb_statmsg(ret)); | 1557 | |
1558 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | ||
1513 | return ret; | 1559 | return ret; |
1514 | } | 1560 | } |
1515 | 1561 | ||
@@ -1545,8 +1591,6 @@ static void complete_cb(struct cardstate *cs) | |||
1545 | kfree(cb); | 1591 | kfree(cb); |
1546 | } | 1592 | } |
1547 | 1593 | ||
1548 | static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len); | ||
1549 | |||
1550 | /* write_command_callback | 1594 | /* write_command_callback |
1551 | * USB completion handler for AT command transmission | 1595 | * USB completion handler for AT command transmission |
1552 | * called by the USB subsystem in interrupt context | 1596 | * called by the USB subsystem in interrupt context |
@@ -1560,13 +1604,17 @@ static void write_command_callback(struct urb *urb, struct pt_regs *regs) | |||
1560 | struct bas_cardstate *ucs = cs->hw.bas; | 1604 | struct bas_cardstate *ucs = cs->hw.bas; |
1561 | unsigned long flags; | 1605 | unsigned long flags; |
1562 | 1606 | ||
1607 | update_basstate(ucs, 0, BS_ATWRPEND); | ||
1608 | |||
1563 | /* check status */ | 1609 | /* check status */ |
1564 | switch (urb->status) { | 1610 | switch (urb->status) { |
1565 | case 0: /* normal completion */ | 1611 | case 0: /* normal completion */ |
1566 | break; | 1612 | break; |
1567 | case -ENOENT: /* canceled */ | 1613 | case -ENOENT: /* cancelled */ |
1568 | case -ECONNRESET: /* canceled (async) */ | 1614 | case -ECONNRESET: /* cancelled (async) */ |
1569 | case -EINPROGRESS: /* pending */ | 1615 | case -EINPROGRESS: /* pending */ |
1616 | case -ENODEV: /* device removed */ | ||
1617 | case -ESHUTDOWN: /* device shut down */ | ||
1570 | /* ignore silently */ | 1618 | /* ignore silently */ |
1571 | gig_dbg(DEBUG_USBREQ, "%s: %s", | 1619 | gig_dbg(DEBUG_USBREQ, "%s: %s", |
1572 | __func__, get_usb_statmsg(urb->status)); | 1620 | __func__, get_usb_statmsg(urb->status)); |
@@ -1627,19 +1675,17 @@ static void atrdy_timeout(unsigned long data) | |||
1627 | * len length of command to send | 1675 | * len length of command to send |
1628 | * return value: | 1676 | * return value: |
1629 | * 0 on success | 1677 | * 0 on success |
1630 | * -EFAULT if a NULL pointer is encountered somewhere | ||
1631 | * -EBUSY if another request is pending | 1678 | * -EBUSY if another request is pending |
1632 | * any URB submission error code | 1679 | * any URB submission error code |
1633 | */ | 1680 | */ |
1634 | static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) | 1681 | static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) |
1635 | { | 1682 | { |
1636 | struct bas_cardstate *ucs = cs->hw.bas; | 1683 | struct bas_cardstate *ucs = cs->hw.bas; |
1637 | unsigned long flags; | 1684 | int rc; |
1638 | int ret; | ||
1639 | 1685 | ||
1640 | gig_dbg(DEBUG_USBREQ, "-------> HD_WRITE_ATMESSAGE (%d)", len); | 1686 | gig_dbg(DEBUG_USBREQ, "-------> HD_WRITE_ATMESSAGE (%d)", len); |
1641 | 1687 | ||
1642 | if (ucs->urb_cmd_out->status == -EINPROGRESS) { | 1688 | if (update_basstate(ucs, BS_ATWRPEND, 0) & BS_ATWRPEND) { |
1643 | dev_err(cs->dev, | 1689 | dev_err(cs->dev, |
1644 | "could not submit HD_WRITE_ATMESSAGE: URB busy\n"); | 1690 | "could not submit HD_WRITE_ATMESSAGE: URB busy\n"); |
1645 | return -EBUSY; | 1691 | return -EBUSY; |
@@ -1654,29 +1700,22 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) | |||
1654 | usb_sndctrlpipe(ucs->udev, 0), | 1700 | usb_sndctrlpipe(ucs->udev, 0), |
1655 | (unsigned char*) &ucs->dr_cmd_out, buf, len, | 1701 | (unsigned char*) &ucs->dr_cmd_out, buf, len, |
1656 | write_command_callback, cs); | 1702 | write_command_callback, cs); |
1657 | 1703 | rc = usb_submit_urb(ucs->urb_cmd_out, SLAB_ATOMIC); | |
1658 | spin_lock_irqsave(&cs->lock, flags); | 1704 | if (unlikely(rc)) { |
1659 | ret = cs->connected ? usb_submit_urb(ucs->urb_cmd_out, SLAB_ATOMIC) : -ENODEV; | 1705 | update_basstate(ucs, 0, BS_ATWRPEND); |
1660 | spin_unlock_irqrestore(&cs->lock, flags); | ||
1661 | |||
1662 | if (ret) { | ||
1663 | dev_err(cs->dev, "could not submit HD_WRITE_ATMESSAGE: %s\n", | 1706 | dev_err(cs->dev, "could not submit HD_WRITE_ATMESSAGE: %s\n", |
1664 | get_usb_statmsg(ret)); | 1707 | get_usb_rcmsg(rc)); |
1665 | return ret; | 1708 | return rc; |
1666 | } | 1709 | } |
1667 | 1710 | ||
1668 | /* submitted successfully */ | 1711 | /* submitted successfully, start timeout if necessary */ |
1669 | update_basstate(ucs, 0, BS_ATREADY); | 1712 | if (!(update_basstate(ucs, BS_ATTIMER, BS_ATREADY) & BS_ATTIMER)) { |
1670 | |||
1671 | /* start timeout if necessary */ | ||
1672 | if (!(atomic_read(&ucs->basstate) & BS_ATTIMER)) { | ||
1673 | gig_dbg(DEBUG_OUTPUT, "setting ATREADY timeout of %d/10 secs", | 1713 | gig_dbg(DEBUG_OUTPUT, "setting ATREADY timeout of %d/10 secs", |
1674 | ATRDY_TIMEOUT); | 1714 | ATRDY_TIMEOUT); |
1675 | ucs->timer_atrdy.expires = jiffies + ATRDY_TIMEOUT * HZ / 10; | 1715 | ucs->timer_atrdy.expires = jiffies + ATRDY_TIMEOUT * HZ / 10; |
1676 | ucs->timer_atrdy.data = (unsigned long) cs; | 1716 | ucs->timer_atrdy.data = (unsigned long) cs; |
1677 | ucs->timer_atrdy.function = atrdy_timeout; | 1717 | ucs->timer_atrdy.function = atrdy_timeout; |
1678 | add_timer(&ucs->timer_atrdy); | 1718 | add_timer(&ucs->timer_atrdy); |
1679 | update_basstate(ucs, BS_ATTIMER, 0); | ||
1680 | } | 1719 | } |
1681 | return 0; | 1720 | return 0; |
1682 | } | 1721 | } |
@@ -1702,7 +1741,6 @@ static int start_cbsend(struct cardstate *cs) | |||
1702 | gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "AT channel not open"); | 1741 | gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "AT channel not open"); |
1703 | rc = req_submit(cs->bcs, HD_OPEN_ATCHANNEL, 0, BAS_TIMEOUT); | 1742 | rc = req_submit(cs->bcs, HD_OPEN_ATCHANNEL, 0, BAS_TIMEOUT); |
1704 | if (rc < 0) { | 1743 | if (rc < 0) { |
1705 | dev_err(cs->dev, "could not open AT channel\n"); | ||
1706 | /* flush command queue */ | 1744 | /* flush command queue */ |
1707 | spin_lock_irqsave(&cs->cmdlock, flags); | 1745 | spin_lock_irqsave(&cs->cmdlock, flags); |
1708 | while (cs->cmdbuf != NULL) | 1746 | while (cs->cmdbuf != NULL) |
@@ -1786,8 +1824,14 @@ static int gigaset_write_cmd(struct cardstate *cs, | |||
1786 | cs->lastcmdbuf = cb; | 1824 | cs->lastcmdbuf = cb; |
1787 | spin_unlock_irqrestore(&cs->cmdlock, flags); | 1825 | spin_unlock_irqrestore(&cs->cmdlock, flags); |
1788 | 1826 | ||
1827 | spin_lock_irqsave(&cs->lock, flags); | ||
1828 | if (unlikely(!cs->connected)) { | ||
1829 | spin_unlock_irqrestore(&cs->lock, flags); | ||
1830 | gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); | ||
1831 | return -ENODEV; | ||
1832 | } | ||
1789 | status = start_cbsend(cs); | 1833 | status = start_cbsend(cs); |
1790 | 1834 | spin_unlock_irqrestore(&cs->lock, flags); | |
1791 | return status < 0 ? status : len; | 1835 | return status < 0 ? status : len; |
1792 | } | 1836 | } |
1793 | 1837 | ||
@@ -1849,12 +1893,32 @@ static int gigaset_brkchars(struct cardstate *cs, const unsigned char buf[6]) | |||
1849 | */ | 1893 | */ |
1850 | static int gigaset_freebcshw(struct bc_state *bcs) | 1894 | static int gigaset_freebcshw(struct bc_state *bcs) |
1851 | { | 1895 | { |
1852 | if (!bcs->hw.bas) | 1896 | struct bas_bc_state *ubc = bcs->hw.bas; |
1897 | int i; | ||
1898 | |||
1899 | if (!ubc) | ||
1853 | return 0; | 1900 | return 0; |
1854 | 1901 | ||
1855 | if (bcs->hw.bas->isooutbuf) | 1902 | /* kill URBs and tasklets before freeing - better safe than sorry */ |
1856 | kfree(bcs->hw.bas->isooutbuf); | 1903 | atomic_set(&ubc->running, 0); |
1857 | kfree(bcs->hw.bas); | 1904 | for (i = 0; i < BAS_OUTURBS; ++i) |
1905 | if (ubc->isoouturbs[i].urb) { | ||
1906 | gig_dbg(DEBUG_INIT, "%s: killing iso out URB %d", | ||
1907 | __func__, i); | ||
1908 | usb_kill_urb(ubc->isoouturbs[i].urb); | ||
1909 | usb_free_urb(ubc->isoouturbs[i].urb); | ||
1910 | } | ||
1911 | for (i = 0; i < BAS_INURBS; ++i) | ||
1912 | if (ubc->isoinurbs[i]) { | ||
1913 | gig_dbg(DEBUG_INIT, "%s: killing iso in URB %d", | ||
1914 | __func__, i); | ||
1915 | usb_kill_urb(ubc->isoinurbs[i]); | ||
1916 | usb_free_urb(ubc->isoinurbs[i]); | ||
1917 | } | ||
1918 | tasklet_kill(&ubc->sent_tasklet); | ||
1919 | tasklet_kill(&ubc->rcvd_tasklet); | ||
1920 | kfree(ubc->isooutbuf); | ||
1921 | kfree(ubc); | ||
1858 | bcs->hw.bas = NULL; | 1922 | bcs->hw.bas = NULL; |
1859 | return 1; | 1923 | return 1; |
1860 | } | 1924 | } |
@@ -1931,13 +1995,9 @@ static void gigaset_reinitbcshw(struct bc_state *bcs) | |||
1931 | 1995 | ||
1932 | static void gigaset_freecshw(struct cardstate *cs) | 1996 | static void gigaset_freecshw(struct cardstate *cs) |
1933 | { | 1997 | { |
1934 | struct bas_cardstate *ucs = cs->hw.bas; | 1998 | /* timers, URBs and rcvbuf are disposed of in disconnect */ |
1935 | |||
1936 | del_timer(&ucs->timer_ctrl); | ||
1937 | del_timer(&ucs->timer_atrdy); | ||
1938 | del_timer(&ucs->timer_cmd_in); | ||
1939 | |||
1940 | kfree(cs->hw.bas); | 1999 | kfree(cs->hw.bas); |
2000 | cs->hw.bas = NULL; | ||
1941 | } | 2001 | } |
1942 | 2002 | ||
1943 | static int gigaset_initcshw(struct cardstate *cs) | 2003 | static int gigaset_initcshw(struct cardstate *cs) |
@@ -2041,23 +2101,13 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2041 | struct bas_bc_state *ubc; | 2101 | struct bas_bc_state *ubc; |
2042 | struct usb_endpoint_descriptor *endpoint; | 2102 | struct usb_endpoint_descriptor *endpoint; |
2043 | int i, j; | 2103 | int i, j; |
2044 | int ret; | 2104 | int rc; |
2045 | 2105 | ||
2046 | gig_dbg(DEBUG_ANY, | 2106 | gig_dbg(DEBUG_ANY, |
2047 | "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", | 2107 | "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", |
2048 | __func__, le16_to_cpu(udev->descriptor.idVendor), | 2108 | __func__, le16_to_cpu(udev->descriptor.idVendor), |
2049 | le16_to_cpu(udev->descriptor.idProduct)); | 2109 | le16_to_cpu(udev->descriptor.idProduct)); |
2050 | 2110 | ||
2051 | /* See if the device offered us matches what we can accept */ | ||
2052 | if ((le16_to_cpu(udev->descriptor.idVendor) != USB_GIGA_VENDOR_ID) || | ||
2053 | (le16_to_cpu(udev->descriptor.idProduct) != USB_GIGA_PRODUCT_ID && | ||
2054 | le16_to_cpu(udev->descriptor.idProduct) != USB_4175_PRODUCT_ID && | ||
2055 | le16_to_cpu(udev->descriptor.idProduct) != USB_SX303_PRODUCT_ID && | ||
2056 | le16_to_cpu(udev->descriptor.idProduct) != USB_SX353_PRODUCT_ID)) { | ||
2057 | gig_dbg(DEBUG_ANY, "%s: unmatched ID - exiting", __func__); | ||
2058 | return -ENODEV; | ||
2059 | } | ||
2060 | |||
2061 | /* set required alternate setting */ | 2111 | /* set required alternate setting */ |
2062 | hostif = interface->cur_altsetting; | 2112 | hostif = interface->cur_altsetting; |
2063 | if (hostif->desc.bAlternateSetting != 3) { | 2113 | if (hostif->desc.bAlternateSetting != 3) { |
@@ -2105,45 +2155,22 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2105 | * - three for the different uses of the default control pipe | 2155 | * - three for the different uses of the default control pipe |
2106 | * - three for each isochronous pipe | 2156 | * - three for each isochronous pipe |
2107 | */ | 2157 | */ |
2108 | ucs->urb_int_in = usb_alloc_urb(0, SLAB_KERNEL); | 2158 | if (!(ucs->urb_int_in = usb_alloc_urb(0, SLAB_KERNEL)) || |
2109 | if (!ucs->urb_int_in) { | 2159 | !(ucs->urb_cmd_in = usb_alloc_urb(0, SLAB_KERNEL)) || |
2110 | dev_err(cs->dev, "no free urbs available\n"); | 2160 | !(ucs->urb_cmd_out = usb_alloc_urb(0, SLAB_KERNEL)) || |
2111 | goto error; | 2161 | !(ucs->urb_ctrl = usb_alloc_urb(0, SLAB_KERNEL))) |
2112 | } | 2162 | goto allocerr; |
2113 | ucs->urb_cmd_in = usb_alloc_urb(0, SLAB_KERNEL); | ||
2114 | if (!ucs->urb_cmd_in) { | ||
2115 | dev_err(cs->dev, "no free urbs available\n"); | ||
2116 | goto error; | ||
2117 | } | ||
2118 | ucs->urb_cmd_out = usb_alloc_urb(0, SLAB_KERNEL); | ||
2119 | if (!ucs->urb_cmd_out) { | ||
2120 | dev_err(cs->dev, "no free urbs available\n"); | ||
2121 | goto error; | ||
2122 | } | ||
2123 | ucs->urb_ctrl = usb_alloc_urb(0, SLAB_KERNEL); | ||
2124 | if (!ucs->urb_ctrl) { | ||
2125 | dev_err(cs->dev, "no free urbs available\n"); | ||
2126 | goto error; | ||
2127 | } | ||
2128 | 2163 | ||
2129 | for (j = 0; j < 2; ++j) { | 2164 | for (j = 0; j < 2; ++j) { |
2130 | ubc = cs->bcs[j].hw.bas; | 2165 | ubc = cs->bcs[j].hw.bas; |
2131 | for (i = 0; i < BAS_OUTURBS; ++i) { | 2166 | for (i = 0; i < BAS_OUTURBS; ++i) |
2132 | ubc->isoouturbs[i].urb = | 2167 | if (!(ubc->isoouturbs[i].urb = |
2133 | usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL); | 2168 | usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL))) |
2134 | if (!ubc->isoouturbs[i].urb) { | 2169 | goto allocerr; |
2135 | dev_err(cs->dev, "no free urbs available\n"); | 2170 | for (i = 0; i < BAS_INURBS; ++i) |
2136 | goto error; | 2171 | if (!(ubc->isoinurbs[i] = |
2137 | } | 2172 | usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL))) |
2138 | } | 2173 | goto allocerr; |
2139 | for (i = 0; i < BAS_INURBS; ++i) { | ||
2140 | ubc->isoinurbs[i] = | ||
2141 | usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL); | ||
2142 | if (!ubc->isoinurbs[i]) { | ||
2143 | dev_err(cs->dev, "no free urbs available\n"); | ||
2144 | goto error; | ||
2145 | } | ||
2146 | } | ||
2147 | } | 2174 | } |
2148 | 2175 | ||
2149 | ucs->rcvbuf = NULL; | 2176 | ucs->rcvbuf = NULL; |
@@ -2156,15 +2183,14 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2156 | (endpoint->bEndpointAddress) & 0x0f), | 2183 | (endpoint->bEndpointAddress) & 0x0f), |
2157 | ucs->int_in_buf, 3, read_int_callback, cs, | 2184 | ucs->int_in_buf, 3, read_int_callback, cs, |
2158 | endpoint->bInterval); | 2185 | endpoint->bInterval); |
2159 | ret = usb_submit_urb(ucs->urb_int_in, SLAB_KERNEL); | 2186 | if ((rc = usb_submit_urb(ucs->urb_int_in, SLAB_KERNEL)) != 0) { |
2160 | if (ret) { | ||
2161 | dev_err(cs->dev, "could not submit interrupt URB: %s\n", | 2187 | dev_err(cs->dev, "could not submit interrupt URB: %s\n", |
2162 | get_usb_statmsg(ret)); | 2188 | get_usb_rcmsg(rc)); |
2163 | goto error; | 2189 | goto error; |
2164 | } | 2190 | } |
2165 | 2191 | ||
2166 | /* tell the device that the driver is ready */ | 2192 | /* tell the device that the driver is ready */ |
2167 | if ((ret = req_submit(cs->bcs, HD_DEVICE_INIT_ACK, 0, 0)) != 0) | 2193 | if ((rc = req_submit(cs->bcs, HD_DEVICE_INIT_ACK, 0, 0)) != 0) |
2168 | goto error; | 2194 | goto error; |
2169 | 2195 | ||
2170 | /* tell common part that the device is ready */ | 2196 | /* tell common part that the device is ready */ |
@@ -2179,6 +2205,8 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2179 | 2205 | ||
2180 | return 0; | 2206 | return 0; |
2181 | 2207 | ||
2208 | allocerr: | ||
2209 | dev_err(cs->dev, "could not allocate URBs\n"); | ||
2182 | error: | 2210 | error: |
2183 | freeurbs(cs); | 2211 | freeurbs(cs); |
2184 | usb_set_intfdata(interface, NULL); | 2212 | usb_set_intfdata(interface, NULL); |
@@ -2193,19 +2221,34 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
2193 | { | 2221 | { |
2194 | struct cardstate *cs; | 2222 | struct cardstate *cs; |
2195 | struct bas_cardstate *ucs; | 2223 | struct bas_cardstate *ucs; |
2224 | int j; | ||
2196 | 2225 | ||
2197 | cs = usb_get_intfdata(interface); | 2226 | cs = usb_get_intfdata(interface); |
2198 | 2227 | ||
2199 | ucs = cs->hw.bas; | 2228 | ucs = cs->hw.bas; |
2200 | 2229 | ||
2201 | dev_info(cs->dev, "disconnecting Gigaset base\n"); | 2230 | dev_info(cs->dev, "disconnecting Gigaset base\n"); |
2231 | |||
2232 | /* mark base as not ready, all channels disconnected */ | ||
2233 | atomic_set(&ucs->basstate, 0); | ||
2234 | |||
2235 | /* tell LL all channels are down */ | ||
2236 | //FIXME shouldn't gigaset_stop() do this? | ||
2237 | for (j = 0; j < 2; ++j) | ||
2238 | gigaset_bchannel_down(cs->bcs + j); | ||
2239 | |||
2240 | /* stop driver (common part) */ | ||
2202 | gigaset_stop(cs); | 2241 | gigaset_stop(cs); |
2242 | |||
2243 | /* stop timers and URBs, free ressources */ | ||
2244 | del_timer_sync(&ucs->timer_ctrl); | ||
2245 | del_timer_sync(&ucs->timer_atrdy); | ||
2246 | del_timer_sync(&ucs->timer_cmd_in); | ||
2203 | freeurbs(cs); | 2247 | freeurbs(cs); |
2204 | usb_set_intfdata(interface, NULL); | 2248 | usb_set_intfdata(interface, NULL); |
2205 | kfree(ucs->rcvbuf); | 2249 | kfree(ucs->rcvbuf); |
2206 | ucs->rcvbuf = NULL; | 2250 | ucs->rcvbuf = NULL; |
2207 | ucs->rcvbuf_size = 0; | 2251 | ucs->rcvbuf_size = 0; |
2208 | atomic_set(&ucs->basstate, 0); | ||
2209 | usb_put_dev(ucs->udev); | 2252 | usb_put_dev(ucs->udev); |
2210 | ucs->interface = NULL; | 2253 | ucs->interface = NULL; |
2211 | ucs->udev = NULL; | 2254 | ucs->udev = NULL; |
@@ -2277,6 +2320,8 @@ error: if (cardstate) | |||
2277 | */ | 2320 | */ |
2278 | static void __exit bas_gigaset_exit(void) | 2321 | static void __exit bas_gigaset_exit(void) |
2279 | { | 2322 | { |
2323 | struct bas_cardstate *ucs = cardstate->hw.bas; | ||
2324 | |||
2280 | gigaset_blockdriver(driver); /* => probe will fail | 2325 | gigaset_blockdriver(driver); /* => probe will fail |
2281 | * => no gigaset_start any more | 2326 | * => no gigaset_start any more |
2282 | */ | 2327 | */ |
@@ -2284,14 +2329,26 @@ static void __exit bas_gigaset_exit(void) | |||
2284 | gigaset_shutdown(cardstate); | 2329 | gigaset_shutdown(cardstate); |
2285 | /* from now on, no isdn callback should be possible */ | 2330 | /* from now on, no isdn callback should be possible */ |
2286 | 2331 | ||
2287 | if (atomic_read(&cardstate->hw.bas->basstate) & BS_ATOPEN) { | 2332 | /* close all still open channels */ |
2288 | gig_dbg(DEBUG_ANY, "closing AT channel"); | 2333 | if (atomic_read(&ucs->basstate) & BS_B1OPEN) { |
2289 | if (req_submit(cardstate->bcs, | 2334 | gig_dbg(DEBUG_INIT, "closing B1 channel"); |
2290 | HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT) >= 0) { | 2335 | usb_control_msg(ucs->udev, usb_sndctrlpipe(ucs->udev, 0), |
2291 | /* successfully submitted */ | 2336 | HD_CLOSE_B1CHANNEL, OUT_VENDOR_REQ, 0, 0, |
2292 | //FIXME wait for completion? | 2337 | NULL, 0, BAS_TIMEOUT); |
2293 | } | 2338 | } |
2339 | if (atomic_read(&ucs->basstate) & BS_B2OPEN) { | ||
2340 | gig_dbg(DEBUG_INIT, "closing B2 channel"); | ||
2341 | usb_control_msg(ucs->udev, usb_sndctrlpipe(ucs->udev, 0), | ||
2342 | HD_CLOSE_B2CHANNEL, OUT_VENDOR_REQ, 0, 0, | ||
2343 | NULL, 0, BAS_TIMEOUT); | ||
2344 | } | ||
2345 | if (atomic_read(&ucs->basstate) & BS_ATOPEN) { | ||
2346 | gig_dbg(DEBUG_INIT, "closing AT channel"); | ||
2347 | usb_control_msg(ucs->udev, usb_sndctrlpipe(ucs->udev, 0), | ||
2348 | HD_CLOSE_ATCHANNEL, OUT_VENDOR_REQ, 0, 0, | ||
2349 | NULL, 0, BAS_TIMEOUT); | ||
2294 | } | 2350 | } |
2351 | atomic_set(&ucs->basstate, 0); | ||
2295 | 2352 | ||
2296 | /* deregister this driver with the USB subsystem */ | 2353 | /* deregister this driver with the USB subsystem */ |
2297 | usb_deregister(&gigaset_usb_driver); | 2354 | usb_deregister(&gigaset_usb_driver); |
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index 749b3da1236e..e55767b2ccd3 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c | |||
@@ -781,8 +781,7 @@ error: if (cs) | |||
781 | } | 781 | } |
782 | EXPORT_SYMBOL_GPL(gigaset_initcs); | 782 | EXPORT_SYMBOL_GPL(gigaset_initcs); |
783 | 783 | ||
784 | /* ReInitialize the b-channel structure */ | 784 | /* ReInitialize the b-channel structure on hangup */ |
785 | /* e.g. called on hangup, disconnect */ | ||
786 | void gigaset_bcs_reinit(struct bc_state *bcs) | 785 | void gigaset_bcs_reinit(struct bc_state *bcs) |
787 | { | 786 | { |
788 | struct sk_buff *skb; | 787 | struct sk_buff *skb; |
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c index 1ba3424a286b..18e05c09b71c 100644 --- a/drivers/isdn/gigaset/ev-layer.c +++ b/drivers/isdn/gigaset/ev-layer.c | |||
@@ -373,6 +373,9 @@ struct reply_t gigaset_tab_cid_m10x[] = /* for M10x */ | |||
373 | 373 | ||
374 | {EV_TIMEOUT, 750,750, -1, 0, 0, {ACT_CONNTIMEOUT}}, | 374 | {EV_TIMEOUT, 750,750, -1, 0, 0, {ACT_CONNTIMEOUT}}, |
375 | 375 | ||
376 | /* B channel closed (general case) */ | ||
377 | {EV_BC_CLOSED, -1, -1, -1, -1,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME | ||
378 | |||
376 | /* misc. */ | 379 | /* misc. */ |
377 | {EV_PROTO_L2, -1, -1, -1, -1,-1, {ACT_PROTO_L2}}, //FIXME | 380 | {EV_PROTO_L2, -1, -1, -1, -1,-1, {ACT_PROTO_L2}}, //FIXME |
378 | 381 | ||
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index 9d21ba8757b0..22b9693f7c0a 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h | |||
@@ -75,7 +75,7 @@ extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */ | |||
75 | * e.g. 'insmod usb_gigaset.o debug=0x2c' will set DEBUG_OPEN, DEBUG_CMD and | 75 | * e.g. 'insmod usb_gigaset.o debug=0x2c' will set DEBUG_OPEN, DEBUG_CMD and |
76 | * DEBUG_INTR. | 76 | * DEBUG_INTR. |
77 | */ | 77 | */ |
78 | enum debuglevel { /* up to 24 bits (atomic_t) */ | 78 | enum debuglevel { |
79 | DEBUG_REG = 0x0002, /* serial port I/O register operations */ | 79 | DEBUG_REG = 0x0002, /* serial port I/O register operations */ |
80 | DEBUG_OPEN = 0x0004, /* open/close serial port */ | 80 | DEBUG_OPEN = 0x0004, /* open/close serial port */ |
81 | DEBUG_INTR = 0x0008, /* interrupt processing */ | 81 | DEBUG_INTR = 0x0008, /* interrupt processing */ |
@@ -141,7 +141,7 @@ enum debuglevel { /* up to 24 bits (atomic_t) */ | |||
141 | printk(KERN_DEBUG KBUILD_MODNAME ": " format "\n", \ | 141 | printk(KERN_DEBUG KBUILD_MODNAME ": " format "\n", \ |
142 | ## arg); \ | 142 | ## arg); \ |
143 | } while (0) | 143 | } while (0) |
144 | #define DEBUG_DEFAULT (DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ) | 144 | #define DEBUG_DEFAULT (DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ) |
145 | 145 | ||
146 | #else | 146 | #else |
147 | 147 | ||
@@ -627,8 +627,7 @@ struct gigaset_ops { | |||
627 | /* Called by gigaset_freecs() for freeing bcs->hw.xxx */ | 627 | /* Called by gigaset_freecs() for freeing bcs->hw.xxx */ |
628 | int (*freebcshw)(struct bc_state *bcs); | 628 | int (*freebcshw)(struct bc_state *bcs); |
629 | 629 | ||
630 | /* Called by gigaset_stop() or gigaset_bchannel_down() for resetting | 630 | /* Called by gigaset_bchannel_down() for resetting bcs->hw.xxx */ |
631 | bcs->hw.xxx */ | ||
632 | void (*reinitbcshw)(struct bc_state *bcs); | 631 | void (*reinitbcshw)(struct bc_state *bcs); |
633 | 632 | ||
634 | /* Called by gigaset_initcs() for setting up cs->hw.xxx */ | 633 | /* Called by gigaset_initcs() for setting up cs->hw.xxx */ |
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c index 0815dbfb8291..1654fa413575 100644 --- a/drivers/isdn/gigaset/i4l.c +++ b/drivers/isdn/gigaset/i4l.c | |||
@@ -73,7 +73,7 @@ static int writebuf_from_LL(int driverID, int channel, int ack, | |||
73 | len, skblen, (unsigned) skb->head[0], (unsigned) skb->head[1]); | 73 | len, skblen, (unsigned) skb->head[0], (unsigned) skb->head[1]); |
74 | 74 | ||
75 | /* pass to device-specific module */ | 75 | /* pass to device-specific module */ |
76 | return cs->ops->send_skb(bcs, skb); //FIXME cs->ops->send_skb() must handle !cs->connected correctly | 76 | return cs->ops->send_skb(bcs, skb); |
77 | } | 77 | } |
78 | 78 | ||
79 | void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb) | 79 | void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb) |
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index 45f017ed6e8c..8667daaa1a82 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c | |||
@@ -992,14 +992,18 @@ int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb) | |||
992 | int len = skb->len; | 992 | int len = skb->len; |
993 | unsigned long flags; | 993 | unsigned long flags; |
994 | 994 | ||
995 | spin_lock_irqsave(&bcs->cs->lock, flags); | ||
996 | if (!bcs->cs->connected) { | ||
997 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | ||
998 | return -ENODEV; | ||
999 | } | ||
1000 | |||
995 | skb_queue_tail(&bcs->squeue, skb); | 1001 | skb_queue_tail(&bcs->squeue, skb); |
996 | gig_dbg(DEBUG_ISO, "%s: skb queued, qlen=%d", | 1002 | gig_dbg(DEBUG_ISO, "%s: skb queued, qlen=%d", |
997 | __func__, skb_queue_len(&bcs->squeue)); | 1003 | __func__, skb_queue_len(&bcs->squeue)); |
998 | 1004 | ||
999 | /* tasklet submits URB if necessary */ | 1005 | /* tasklet submits URB if necessary */ |
1000 | spin_lock_irqsave(&bcs->cs->lock, flags); | 1006 | tasklet_schedule(&bcs->hw.bas->sent_tasklet); |
1001 | if (bcs->cs->connected) | ||
1002 | tasklet_schedule(&bcs->hw.bas->sent_tasklet); | ||
1003 | spin_unlock_irqrestore(&bcs->cs->lock, flags); | 1007 | spin_unlock_irqrestore(&bcs->cs->lock, flags); |
1004 | 1008 | ||
1005 | return len; /* ok so far */ | 1009 | return len; /* ok so far */ |
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 5ebfd1d138da..5282fec17075 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c | |||
@@ -627,8 +627,8 @@ thermostat_init(void) | |||
627 | if(therm_type == ADT7460) | 627 | if(therm_type == ADT7460) |
628 | device_create_file(&of_dev->dev, &dev_attr_sensor2_fan_speed); | 628 | device_create_file(&of_dev->dev, &dev_attr_sensor2_fan_speed); |
629 | 629 | ||
630 | #ifndef CONFIG_I2C_KEYWEST | 630 | #ifndef CONFIG_I2C_POWERMAC |
631 | request_module("i2c-keywest"); | 631 | request_module("i2c-powermac"); |
632 | #endif | 632 | #endif |
633 | 633 | ||
634 | return i2c_add_driver(&thermostat_driver); | 634 | return i2c_add_driver(&thermostat_driver); |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 506e777c5f06..d090df413049 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -1639,6 +1639,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1639 | PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), | 1639 | PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), |
1640 | PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2), | 1640 | PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2), |
1641 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd), | 1641 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd), |
1642 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d), | ||
1642 | PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), | 1643 | PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), |
1643 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-T", 0x5261440f, 0x6705fcaa), | 1644 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-T", 0x5261440f, 0x6705fcaa), |
1644 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FastEther PCC-TX", 0x5261440f, 0x485e85d9), | 1645 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FastEther PCC-TX", 0x5261440f, 0x485e85d9), |
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index cba6c9eef28e..61cb4b29f55c 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -250,7 +250,7 @@ config M32R_CFC_NUM | |||
250 | 250 | ||
251 | config PCMCIA_VRC4171 | 251 | config PCMCIA_VRC4171 |
252 | tristate "NEC VRC4171 Card Controllers support" | 252 | tristate "NEC VRC4171 Card Controllers support" |
253 | depends on VRC4171 && PCMCIA | 253 | depends on CPU_VR41XX && ISA && PCMCIA |
254 | 254 | ||
255 | config PCMCIA_VRC4173 | 255 | config PCMCIA_VRC4173 |
256 | tristate "NEC VRC4173 CARDU support" | 256 | tristate "NEC VRC4173 CARDU support" |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index ae10d1eed65e..48d3b3d30c21 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -236,11 +236,11 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv) | |||
236 | /** | 236 | /** |
237 | * pcmcia_load_firmware - load CIS from userspace if device-provided is broken | 237 | * pcmcia_load_firmware - load CIS from userspace if device-provided is broken |
238 | * @dev - the pcmcia device which needs a CIS override | 238 | * @dev - the pcmcia device which needs a CIS override |
239 | * @filename - requested filename in /lib/firmware/cis/ | 239 | * @filename - requested filename in /lib/firmware/ |
240 | * | 240 | * |
241 | * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if | 241 | * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if |
242 | * the one provided by the card is broken. The firmware files reside in | 242 | * the one provided by the card is broken. The firmware files reside in |
243 | * /lib/firmware/cis/ in userspace. | 243 | * /lib/firmware/ in userspace. |
244 | */ | 244 | */ |
245 | static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | 245 | static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) |
246 | { | 246 | { |
@@ -298,9 +298,6 @@ static inline int pcmcia_load_firmware(struct pcmcia_device *dev, char * filenam | |||
298 | * | 298 | * |
299 | * Registers a PCMCIA driver with the PCMCIA bus core. | 299 | * Registers a PCMCIA driver with the PCMCIA bus core. |
300 | */ | 300 | */ |
301 | static int pcmcia_device_probe(struct device *dev); | ||
302 | static int pcmcia_device_remove(struct device * dev); | ||
303 | |||
304 | int pcmcia_register_driver(struct pcmcia_driver *driver) | 301 | int pcmcia_register_driver(struct pcmcia_driver *driver) |
305 | { | 302 | { |
306 | if (!driver) | 303 | if (!driver) |
@@ -400,7 +397,7 @@ static int pcmcia_device_probe(struct device * dev) | |||
400 | * call which will then check whether there are two | 397 | * call which will then check whether there are two |
401 | * pseudo devices, and if not, add the second one. | 398 | * pseudo devices, and if not, add the second one. |
402 | */ | 399 | */ |
403 | did = (struct pcmcia_device_id *) p_dev->dev.driver_data; | 400 | did = p_dev->dev.driver_data; |
404 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && | 401 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && |
405 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) | 402 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) |
406 | pcmcia_add_pseudo_device(p_dev->socket); | 403 | pcmcia_add_pseudo_device(p_dev->socket); |
@@ -448,7 +445,6 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
448 | return; | 445 | return; |
449 | } | 446 | } |
450 | 447 | ||
451 | |||
452 | static int pcmcia_device_remove(struct device * dev) | 448 | static int pcmcia_device_remove(struct device * dev) |
453 | { | 449 | { |
454 | struct pcmcia_device *p_dev; | 450 | struct pcmcia_device *p_dev; |
@@ -463,7 +459,7 @@ static int pcmcia_device_remove(struct device * dev) | |||
463 | * pseudo multi-function card, we need to unbind | 459 | * pseudo multi-function card, we need to unbind |
464 | * all devices | 460 | * all devices |
465 | */ | 461 | */ |
466 | did = (struct pcmcia_device_id *) p_dev->dev.driver_data; | 462 | did = p_dev->dev.driver_data; |
467 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && | 463 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && |
468 | (p_dev->socket->device_count != 0) && | 464 | (p_dev->socket->device_count != 0) && |
469 | (p_dev->device_no == 0)) | 465 | (p_dev->device_no == 0)) |
@@ -476,6 +472,8 @@ static int pcmcia_device_remove(struct device * dev) | |||
476 | if (p_drv->remove) | 472 | if (p_drv->remove) |
477 | p_drv->remove(p_dev); | 473 | p_drv->remove(p_dev); |
478 | 474 | ||
475 | p_dev->dev_node = NULL; | ||
476 | |||
479 | /* check for proper unloading */ | 477 | /* check for proper unloading */ |
480 | if (p_dev->_irq || p_dev->_io || p_dev->_locked) | 478 | if (p_dev->_irq || p_dev->_io || p_dev->_locked) |
481 | printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", | 479 | printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", |
@@ -628,7 +626,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
628 | } | 626 | } |
629 | 627 | ||
630 | /* Add to the list in pcmcia_bus_socket */ | 628 | /* Add to the list in pcmcia_bus_socket */ |
631 | list_add_tail(&p_dev->socket_device_list, &s->devices_list); | 629 | list_add(&p_dev->socket_device_list, &s->devices_list); |
632 | 630 | ||
633 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 631 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
634 | 632 | ||
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 45063b4e5b78..3131bb0a0095 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -88,7 +88,6 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base, | |||
88 | } | 88 | } |
89 | if ((s->features & SS_CAP_STATIC_MAP) && s->io_offset) { | 89 | if ((s->features & SS_CAP_STATIC_MAP) && s->io_offset) { |
90 | *base = s->io_offset | (*base & 0x0fff); | 90 | *base = s->io_offset | (*base & 0x0fff); |
91 | s->io[0].res->flags = (s->io[0].res->flags & ~IORESOURCE_BITS) | (attr & IORESOURCE_BITS); | ||
92 | return 0; | 91 | return 0; |
93 | } | 92 | } |
94 | /* Check for an already-allocated window that must conflict with | 93 | /* Check for an already-allocated window that must conflict with |
@@ -209,7 +208,6 @@ int pccard_get_configuration_info(struct pcmcia_socket *s, | |||
209 | if (!(s->state & SOCKET_PRESENT)) | 208 | if (!(s->state & SOCKET_PRESENT)) |
210 | return CS_NO_CARD; | 209 | return CS_NO_CARD; |
211 | 210 | ||
212 | config->Function = p_dev->func; | ||
213 | 211 | ||
214 | #ifdef CONFIG_CARDBUS | 212 | #ifdef CONFIG_CARDBUS |
215 | if (s->state & SOCKET_CARDBUS) { | 213 | if (s->state & SOCKET_CARDBUS) { |
@@ -223,14 +221,22 @@ int pccard_get_configuration_info(struct pcmcia_socket *s, | |||
223 | config->AssignedIRQ = s->irq.AssignedIRQ; | 221 | config->AssignedIRQ = s->irq.AssignedIRQ; |
224 | if (config->AssignedIRQ) | 222 | if (config->AssignedIRQ) |
225 | config->Attributes |= CONF_ENABLE_IRQ; | 223 | config->Attributes |= CONF_ENABLE_IRQ; |
226 | config->BasePort1 = s->io[0].res->start; | 224 | if (s->io[0].res) { |
227 | config->NumPorts1 = s->io[0].res->end - config->BasePort1 + 1; | 225 | config->BasePort1 = s->io[0].res->start; |
226 | config->NumPorts1 = s->io[0].res->end - config->BasePort1 + 1; | ||
227 | } | ||
228 | } | 228 | } |
229 | return CS_SUCCESS; | 229 | return CS_SUCCESS; |
230 | } | 230 | } |
231 | #endif | 231 | #endif |
232 | 232 | ||
233 | c = (p_dev) ? p_dev->function_config : NULL; | 233 | if (p_dev) { |
234 | c = p_dev->function_config; | ||
235 | config->Function = p_dev->func; | ||
236 | } else { | ||
237 | c = NULL; | ||
238 | config->Function = 0; | ||
239 | } | ||
234 | 240 | ||
235 | if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { | 241 | if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { |
236 | config->Attributes = 0; | 242 | config->Attributes = 0; |
@@ -947,7 +953,5 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev) { | |||
947 | pcmcia_release_irq(p_dev, &p_dev->irq); | 953 | pcmcia_release_irq(p_dev, &p_dev->irq); |
948 | if (&p_dev->win) | 954 | if (&p_dev->win) |
949 | pcmcia_release_window(p_dev->win); | 955 | pcmcia_release_window(p_dev->win); |
950 | |||
951 | p_dev->dev_node = NULL; | ||
952 | } | 956 | } |
953 | EXPORT_SYMBOL(pcmcia_disable_device); | 957 | EXPORT_SYMBOL(pcmcia_disable_device); |
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 8a2de038882e..1a27ecb46c9a 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,7 +1,11 @@ | |||
1 | Version 1.42 | 1 | Version 1.42 |
2 | ------------ | 2 | ------------ |
3 | Fix slow oplock break when mounted to different servers at the same time and | 3 | Fix slow oplock break when mounted to different servers at the same time and |
4 | the tids match and we try to find matching fid on wrong server. | 4 | the tids match and we try to find matching fid on wrong server. Fix read |
5 | looping when signing required by server (2.6.16 kernel only). Fix readdir | ||
6 | vs. rename race which could cause each to hang. Return . and .. even | ||
7 | if server does not. Allow searches to skip first three entries and | ||
8 | begin at any location. Fix oops in find_writeable_file. | ||
5 | 9 | ||
6 | Version 1.41 | 10 | Version 1.41 |
7 | ------------ | 11 | ------------ |
diff --git a/fs/cifs/README b/fs/cifs/README index b2b4d0803761..0355003f4f0a 100644 --- a/fs/cifs/README +++ b/fs/cifs/README | |||
@@ -511,6 +511,14 @@ LinuxExtensionsEnabled If set to one then the client will attempt to | |||
511 | support and want to map the uid and gid fields | 511 | support and want to map the uid and gid fields |
512 | to values supplied at mount (rather than the | 512 | to values supplied at mount (rather than the |
513 | actual values, then set this to zero. (default 1) | 513 | actual values, then set this to zero. (default 1) |
514 | Experimental When set to 1 used to enable certain experimental | ||
515 | features (currently enables multipage writes | ||
516 | when signing is enabled, the multipage write | ||
517 | performance enhancement was disabled when | ||
518 | signing turned on in case buffer was modified | ||
519 | just before it was sent, also this flag will | ||
520 | be used to use the new experimental sessionsetup | ||
521 | code). | ||
514 | 522 | ||
515 | These experimental features and tracing can be enabled by changing flags in | 523 | These experimental features and tracing can be enabled by changing flags in |
516 | /proc/fs/cifs (after the cifs module has been installed or built into the | 524 | /proc/fs/cifs (after the cifs module has been installed or built into the |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index d4b713e5affb..c262d8874ce9 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/vfs.h> | 33 | #include <linux/vfs.h> |
34 | #include <linux/mempool.h> | 34 | #include <linux/mempool.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/kthread.h> | ||
36 | #include "cifsfs.h" | 37 | #include "cifsfs.h" |
37 | #include "cifspdu.h" | 38 | #include "cifspdu.h" |
38 | #define DECLARE_GLOBALS_HERE | 39 | #define DECLARE_GLOBALS_HERE |
@@ -75,9 +76,6 @@ unsigned int cifs_max_pending = CIFS_MAX_REQ; | |||
75 | module_param(cifs_max_pending, int, 0); | 76 | module_param(cifs_max_pending, int, 0); |
76 | MODULE_PARM_DESC(cifs_max_pending,"Simultaneous requests to server. Default: 50 Range: 2 to 256"); | 77 | MODULE_PARM_DESC(cifs_max_pending,"Simultaneous requests to server. Default: 50 Range: 2 to 256"); |
77 | 78 | ||
78 | static DECLARE_COMPLETION(cifs_oplock_exited); | ||
79 | static DECLARE_COMPLETION(cifs_dnotify_exited); | ||
80 | |||
81 | extern mempool_t *cifs_sm_req_poolp; | 79 | extern mempool_t *cifs_sm_req_poolp; |
82 | extern mempool_t *cifs_req_poolp; | 80 | extern mempool_t *cifs_req_poolp; |
83 | extern mempool_t *cifs_mid_poolp; | 81 | extern mempool_t *cifs_mid_poolp; |
@@ -841,10 +839,6 @@ static int cifs_oplock_thread(void * dummyarg) | |||
841 | __u16 netfid; | 839 | __u16 netfid; |
842 | int rc; | 840 | int rc; |
843 | 841 | ||
844 | daemonize("cifsoplockd"); | ||
845 | allow_signal(SIGTERM); | ||
846 | |||
847 | oplockThread = current; | ||
848 | do { | 842 | do { |
849 | if (try_to_freeze()) | 843 | if (try_to_freeze()) |
850 | continue; | 844 | continue; |
@@ -900,9 +894,9 @@ static int cifs_oplock_thread(void * dummyarg) | |||
900 | set_current_state(TASK_INTERRUPTIBLE); | 894 | set_current_state(TASK_INTERRUPTIBLE); |
901 | schedule_timeout(1); /* yield in case q were corrupt */ | 895 | schedule_timeout(1); /* yield in case q were corrupt */ |
902 | } | 896 | } |
903 | } while(!signal_pending(current)); | 897 | } while (!kthread_should_stop()); |
904 | oplockThread = NULL; | 898 | |
905 | complete_and_exit (&cifs_oplock_exited, 0); | 899 | return 0; |
906 | } | 900 | } |
907 | 901 | ||
908 | static int cifs_dnotify_thread(void * dummyarg) | 902 | static int cifs_dnotify_thread(void * dummyarg) |
@@ -910,10 +904,6 @@ static int cifs_dnotify_thread(void * dummyarg) | |||
910 | struct list_head *tmp; | 904 | struct list_head *tmp; |
911 | struct cifsSesInfo *ses; | 905 | struct cifsSesInfo *ses; |
912 | 906 | ||
913 | daemonize("cifsdnotifyd"); | ||
914 | allow_signal(SIGTERM); | ||
915 | |||
916 | dnotifyThread = current; | ||
917 | do { | 907 | do { |
918 | if(try_to_freeze()) | 908 | if(try_to_freeze()) |
919 | continue; | 909 | continue; |
@@ -931,8 +921,9 @@ static int cifs_dnotify_thread(void * dummyarg) | |||
931 | wake_up_all(&ses->server->response_q); | 921 | wake_up_all(&ses->server->response_q); |
932 | } | 922 | } |
933 | read_unlock(&GlobalSMBSeslock); | 923 | read_unlock(&GlobalSMBSeslock); |
934 | } while(!signal_pending(current)); | 924 | } while (!kthread_should_stop()); |
935 | complete_and_exit (&cifs_dnotify_exited, 0); | 925 | |
926 | return 0; | ||
936 | } | 927 | } |
937 | 928 | ||
938 | static int __init | 929 | static int __init |
@@ -982,32 +973,48 @@ init_cifs(void) | |||
982 | } | 973 | } |
983 | 974 | ||
984 | rc = cifs_init_inodecache(); | 975 | rc = cifs_init_inodecache(); |
985 | if (!rc) { | 976 | if (rc) |
986 | rc = cifs_init_mids(); | 977 | goto out_clean_proc; |
987 | if (!rc) { | 978 | |
988 | rc = cifs_init_request_bufs(); | 979 | rc = cifs_init_mids(); |
989 | if (!rc) { | 980 | if (rc) |
990 | rc = register_filesystem(&cifs_fs_type); | 981 | goto out_destroy_inodecache; |
991 | if (!rc) { | 982 | |
992 | rc = (int)kernel_thread(cifs_oplock_thread, NULL, | 983 | rc = cifs_init_request_bufs(); |
993 | CLONE_FS | CLONE_FILES | CLONE_VM); | 984 | if (rc) |
994 | if(rc > 0) { | 985 | goto out_destroy_mids; |
995 | rc = (int)kernel_thread(cifs_dnotify_thread, NULL, | 986 | |
996 | CLONE_FS | CLONE_FILES | CLONE_VM); | 987 | rc = register_filesystem(&cifs_fs_type); |
997 | if(rc > 0) | 988 | if (rc) |
998 | return 0; | 989 | goto out_destroy_request_bufs; |
999 | else | 990 | |
1000 | cERROR(1,("error %d create dnotify thread", rc)); | 991 | oplockThread = kthread_run(cifs_oplock_thread, NULL, "cifsoplockd"); |
1001 | } else { | 992 | if (IS_ERR(oplockThread)) { |
1002 | cERROR(1,("error %d create oplock thread",rc)); | 993 | rc = PTR_ERR(oplockThread); |
1003 | } | 994 | cERROR(1,("error %d create oplock thread", rc)); |
1004 | } | 995 | goto out_unregister_filesystem; |
1005 | cifs_destroy_request_bufs(); | ||
1006 | } | ||
1007 | cifs_destroy_mids(); | ||
1008 | } | ||
1009 | cifs_destroy_inodecache(); | ||
1010 | } | 996 | } |
997 | |||
998 | dnotifyThread = kthread_run(cifs_dnotify_thread, NULL, "cifsdnotifyd"); | ||
999 | if (IS_ERR(dnotifyThread)) { | ||
1000 | rc = PTR_ERR(dnotifyThread); | ||
1001 | cERROR(1,("error %d create dnotify thread", rc)); | ||
1002 | goto out_stop_oplock_thread; | ||
1003 | } | ||
1004 | |||
1005 | return 0; | ||
1006 | |||
1007 | out_stop_oplock_thread: | ||
1008 | kthread_stop(oplockThread); | ||
1009 | out_unregister_filesystem: | ||
1010 | unregister_filesystem(&cifs_fs_type); | ||
1011 | out_destroy_request_bufs: | ||
1012 | cifs_destroy_request_bufs(); | ||
1013 | out_destroy_mids: | ||
1014 | cifs_destroy_mids(); | ||
1015 | out_destroy_inodecache: | ||
1016 | cifs_destroy_inodecache(); | ||
1017 | out_clean_proc: | ||
1011 | #ifdef CONFIG_PROC_FS | 1018 | #ifdef CONFIG_PROC_FS |
1012 | cifs_proc_clean(); | 1019 | cifs_proc_clean(); |
1013 | #endif | 1020 | #endif |
@@ -1025,14 +1032,8 @@ exit_cifs(void) | |||
1025 | cifs_destroy_inodecache(); | 1032 | cifs_destroy_inodecache(); |
1026 | cifs_destroy_mids(); | 1033 | cifs_destroy_mids(); |
1027 | cifs_destroy_request_bufs(); | 1034 | cifs_destroy_request_bufs(); |
1028 | if(oplockThread) { | 1035 | kthread_stop(oplockThread); |
1029 | send_sig(SIGTERM, oplockThread, 1); | 1036 | kthread_stop(dnotifyThread); |
1030 | wait_for_completion(&cifs_oplock_exited); | ||
1031 | } | ||
1032 | if(dnotifyThread) { | ||
1033 | send_sig(SIGTERM, dnotifyThread, 1); | ||
1034 | wait_for_completion(&cifs_dnotify_exited); | ||
1035 | } | ||
1036 | } | 1037 | } |
1037 | 1038 | ||
1038 | MODULE_AUTHOR("Steve French <sfrench@us.ibm.com>"); | 1039 | MODULE_AUTHOR("Steve French <sfrench@us.ibm.com>"); |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index d705500aa283..fd36892eda55 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -3119,7 +3119,7 @@ findFirstRetry: | |||
3119 | psrch_inf->endOfSearch = FALSE; | 3119 | psrch_inf->endOfSearch = FALSE; |
3120 | 3120 | ||
3121 | psrch_inf->entries_in_buffer = le16_to_cpu(parms->SearchCount); | 3121 | psrch_inf->entries_in_buffer = le16_to_cpu(parms->SearchCount); |
3122 | psrch_inf->index_of_last_entry = | 3122 | psrch_inf->index_of_last_entry = 2 /* skip . and .. */ + |
3123 | psrch_inf->entries_in_buffer; | 3123 | psrch_inf->entries_in_buffer; |
3124 | *pnetfid = parms->SearchHandle; | 3124 | *pnetfid = parms->SearchHandle; |
3125 | } else { | 3125 | } else { |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 0b86d5ca9014..aaf151cb5822 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -3447,7 +3447,10 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, | |||
3447 | pSesInfo->server->secMode, | 3447 | pSesInfo->server->secMode, |
3448 | pSesInfo->server->capabilities, | 3448 | pSesInfo->server->capabilities, |
3449 | pSesInfo->server->timeZone)); | 3449 | pSesInfo->server->timeZone)); |
3450 | if (extended_security | 3450 | if(experimEnabled > 1) |
3451 | rc = CIFS_SessSetup(xid, pSesInfo, CIFS_NTLM /* type */, | ||
3452 | &ntlmv2_flag, nls_info); | ||
3453 | else if (extended_security | ||
3451 | && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY) | 3454 | && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY) |
3452 | && (pSesInfo->server->secType == NTLMSSP)) { | 3455 | && (pSesInfo->server->secType == NTLMSSP)) { |
3453 | cFYI(1, ("New style sesssetup")); | 3456 | cFYI(1, ("New style sesssetup")); |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 1d0ca3eaaca5..82315edc77d7 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -139,9 +139,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
139 | cifs_sb = CIFS_SB(inode->i_sb); | 139 | cifs_sb = CIFS_SB(inode->i_sb); |
140 | pTcon = cifs_sb->tcon; | 140 | pTcon = cifs_sb->tcon; |
141 | 141 | ||
142 | mutex_lock(&direntry->d_sb->s_vfs_rename_mutex); | ||
143 | full_path = build_path_from_dentry(direntry); | 142 | full_path = build_path_from_dentry(direntry); |
144 | mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex); | ||
145 | if(full_path == NULL) { | 143 | if(full_path == NULL) { |
146 | FreeXid(xid); | 144 | FreeXid(xid); |
147 | return -ENOMEM; | 145 | return -ENOMEM; |
@@ -316,9 +314,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, | |||
316 | cifs_sb = CIFS_SB(inode->i_sb); | 314 | cifs_sb = CIFS_SB(inode->i_sb); |
317 | pTcon = cifs_sb->tcon; | 315 | pTcon = cifs_sb->tcon; |
318 | 316 | ||
319 | mutex_lock(&direntry->d_sb->s_vfs_rename_mutex); | ||
320 | full_path = build_path_from_dentry(direntry); | 317 | full_path = build_path_from_dentry(direntry); |
321 | mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex); | ||
322 | if(full_path == NULL) | 318 | if(full_path == NULL) |
323 | rc = -ENOMEM; | 319 | rc = -ENOMEM; |
324 | else if (pTcon->ses->capabilities & CAP_UNIX) { | 320 | else if (pTcon->ses->capabilities & CAP_UNIX) { |
@@ -440,6 +436,20 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name | |||
440 | cifs_sb = CIFS_SB(parent_dir_inode->i_sb); | 436 | cifs_sb = CIFS_SB(parent_dir_inode->i_sb); |
441 | pTcon = cifs_sb->tcon; | 437 | pTcon = cifs_sb->tcon; |
442 | 438 | ||
439 | /* | ||
440 | * Don't allow the separator character in a path component. | ||
441 | * The VFS will not allow "/", but "\" is allowed by posix. | ||
442 | */ | ||
443 | if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)) { | ||
444 | int i; | ||
445 | for (i = 0; i < direntry->d_name.len; i++) | ||
446 | if (direntry->d_name.name[i] == '\\') { | ||
447 | cFYI(1, ("Invalid file name")); | ||
448 | FreeXid(xid); | ||
449 | return ERR_PTR(-EINVAL); | ||
450 | } | ||
451 | } | ||
452 | |||
443 | /* can not grab the rename sem here since it would | 453 | /* can not grab the rename sem here since it would |
444 | deadlock in the cases (beginning of sys_rename itself) | 454 | deadlock in the cases (beginning of sys_rename itself) |
445 | in which we already have the sb rename sem */ | 455 | in which we already have the sb rename sem */ |
diff --git a/fs/cifs/fcntl.c b/fs/cifs/fcntl.c index ec4dfe9bf5ef..633a93811328 100644 --- a/fs/cifs/fcntl.c +++ b/fs/cifs/fcntl.c | |||
@@ -86,9 +86,7 @@ int cifs_dir_notify(struct file * file, unsigned long arg) | |||
86 | cifs_sb = CIFS_SB(file->f_dentry->d_sb); | 86 | cifs_sb = CIFS_SB(file->f_dentry->d_sb); |
87 | pTcon = cifs_sb->tcon; | 87 | pTcon = cifs_sb->tcon; |
88 | 88 | ||
89 | mutex_lock(&file->f_dentry->d_sb->s_vfs_rename_mutex); | ||
90 | full_path = build_path_from_dentry(file->f_dentry); | 89 | full_path = build_path_from_dentry(file->f_dentry); |
91 | mutex_unlock(&file->f_dentry->d_sb->s_vfs_rename_mutex); | ||
92 | 90 | ||
93 | if(full_path == NULL) { | 91 | if(full_path == NULL) { |
94 | rc = -ENOMEM; | 92 | rc = -ENOMEM; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 5c497c529772..e152bf6afa60 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -203,9 +203,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | mutex_lock(&inode->i_sb->s_vfs_rename_mutex); | ||
207 | full_path = build_path_from_dentry(file->f_dentry); | 206 | full_path = build_path_from_dentry(file->f_dentry); |
208 | mutex_unlock(&inode->i_sb->s_vfs_rename_mutex); | ||
209 | if (full_path == NULL) { | 207 | if (full_path == NULL) { |
210 | FreeXid(xid); | 208 | FreeXid(xid); |
211 | return -ENOMEM; | 209 | return -ENOMEM; |
@@ -906,8 +904,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data, | |||
906 | if (rc != 0) | 904 | if (rc != 0) |
907 | break; | 905 | break; |
908 | } | 906 | } |
909 | /* BB FIXME We can not sign across two buffers yet */ | 907 | if(experimEnabled || (pTcon->ses->server->secMode & |
910 | if((pTcon->ses->server->secMode & | ||
911 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) == 0) { | 908 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) == 0) { |
912 | struct kvec iov[2]; | 909 | struct kvec iov[2]; |
913 | unsigned int len; | 910 | unsigned int len; |
@@ -923,13 +920,13 @@ static ssize_t cifs_write(struct file *file, const char *write_data, | |||
923 | *poffset, &bytes_written, | 920 | *poffset, &bytes_written, |
924 | iov, 1, long_op); | 921 | iov, 1, long_op); |
925 | } else | 922 | } else |
926 | /* BB FIXME fixup indentation of line below */ | 923 | rc = CIFSSMBWrite(xid, pTcon, |
927 | rc = CIFSSMBWrite(xid, pTcon, | 924 | open_file->netfid, |
928 | open_file->netfid, | 925 | min_t(const int, cifs_sb->wsize, |
929 | min_t(const int, cifs_sb->wsize, | 926 | write_size - total_written), |
930 | write_size - total_written), | 927 | *poffset, &bytes_written, |
931 | *poffset, &bytes_written, | 928 | write_data + total_written, |
932 | write_data + total_written, NULL, long_op); | 929 | NULL, long_op); |
933 | } | 930 | } |
934 | if (rc || (bytes_written == 0)) { | 931 | if (rc || (bytes_written == 0)) { |
935 | if (total_written) | 932 | if (total_written) |
@@ -968,6 +965,16 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode) | |||
968 | struct cifsFileInfo *open_file; | 965 | struct cifsFileInfo *open_file; |
969 | int rc; | 966 | int rc; |
970 | 967 | ||
968 | /* Having a null inode here (because mapping->host was set to zero by | ||
969 | the VFS or MM) should not happen but we had reports of on oops (due to | ||
970 | it being zero) during stress testcases so we need to check for it */ | ||
971 | |||
972 | if(cifs_inode == NULL) { | ||
973 | cERROR(1,("Null inode passed to cifs_writeable_file")); | ||
974 | dump_stack(); | ||
975 | return NULL; | ||
976 | } | ||
977 | |||
971 | read_lock(&GlobalSMBSeslock); | 978 | read_lock(&GlobalSMBSeslock); |
972 | list_for_each_entry(open_file, &cifs_inode->openFileList, flist) { | 979 | list_for_each_entry(open_file, &cifs_inode->openFileList, flist) { |
973 | if (open_file->closePend) | 980 | if (open_file->closePend) |
@@ -1093,12 +1100,11 @@ static int cifs_writepages(struct address_space *mapping, | |||
1093 | if (cifs_sb->wsize < PAGE_CACHE_SIZE) | 1100 | if (cifs_sb->wsize < PAGE_CACHE_SIZE) |
1094 | return generic_writepages(mapping, wbc); | 1101 | return generic_writepages(mapping, wbc); |
1095 | 1102 | ||
1096 | /* BB FIXME we do not have code to sign across multiple buffers yet, | ||
1097 | so go to older writepage style write which we can sign if needed */ | ||
1098 | if((cifs_sb->tcon->ses) && (cifs_sb->tcon->ses->server)) | 1103 | if((cifs_sb->tcon->ses) && (cifs_sb->tcon->ses->server)) |
1099 | if(cifs_sb->tcon->ses->server->secMode & | 1104 | if(cifs_sb->tcon->ses->server->secMode & |
1100 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) | 1105 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) |
1101 | return generic_writepages(mapping, wbc); | 1106 | if(!experimEnabled) |
1107 | return generic_writepages(mapping, wbc); | ||
1102 | 1108 | ||
1103 | /* | 1109 | /* |
1104 | * BB: Is this meaningful for a non-block-device file system? | 1110 | * BB: Is this meaningful for a non-block-device file system? |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 957ddd1571c6..4093764ef461 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -722,9 +722,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
722 | cifs_sb = CIFS_SB(inode->i_sb); | 722 | cifs_sb = CIFS_SB(inode->i_sb); |
723 | pTcon = cifs_sb->tcon; | 723 | pTcon = cifs_sb->tcon; |
724 | 724 | ||
725 | mutex_lock(&inode->i_sb->s_vfs_rename_mutex); | ||
726 | full_path = build_path_from_dentry(direntry); | 725 | full_path = build_path_from_dentry(direntry); |
727 | mutex_unlock(&inode->i_sb->s_vfs_rename_mutex); | ||
728 | if (full_path == NULL) { | 726 | if (full_path == NULL) { |
729 | FreeXid(xid); | 727 | FreeXid(xid); |
730 | return -ENOMEM; | 728 | return -ENOMEM; |
@@ -807,9 +805,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) | |||
807 | cifs_sb = CIFS_SB(inode->i_sb); | 805 | cifs_sb = CIFS_SB(inode->i_sb); |
808 | pTcon = cifs_sb->tcon; | 806 | pTcon = cifs_sb->tcon; |
809 | 807 | ||
810 | mutex_lock(&inode->i_sb->s_vfs_rename_mutex); | ||
811 | full_path = build_path_from_dentry(direntry); | 808 | full_path = build_path_from_dentry(direntry); |
812 | mutex_unlock(&inode->i_sb->s_vfs_rename_mutex); | ||
813 | if (full_path == NULL) { | 809 | if (full_path == NULL) { |
814 | FreeXid(xid); | 810 | FreeXid(xid); |
815 | return -ENOMEM; | 811 | return -ENOMEM; |
@@ -1141,9 +1137,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1141 | rc = 0; | 1137 | rc = 0; |
1142 | } | 1138 | } |
1143 | 1139 | ||
1144 | mutex_lock(&direntry->d_sb->s_vfs_rename_mutex); | ||
1145 | full_path = build_path_from_dentry(direntry); | 1140 | full_path = build_path_from_dentry(direntry); |
1146 | mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex); | ||
1147 | if (full_path == NULL) { | 1141 | if (full_path == NULL) { |
1148 | FreeXid(xid); | 1142 | FreeXid(xid); |
1149 | return -ENOMEM; | 1143 | return -ENOMEM; |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 9562f5bba65c..2ec99f833142 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -48,10 +48,8 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, | |||
48 | /* No need to check for cross device links since server will do that | 48 | /* No need to check for cross device links since server will do that |
49 | BB note DFS case in future though (when we may have to check) */ | 49 | BB note DFS case in future though (when we may have to check) */ |
50 | 50 | ||
51 | mutex_lock(&inode->i_sb->s_vfs_rename_mutex); | ||
52 | fromName = build_path_from_dentry(old_file); | 51 | fromName = build_path_from_dentry(old_file); |
53 | toName = build_path_from_dentry(direntry); | 52 | toName = build_path_from_dentry(direntry); |
54 | mutex_unlock(&inode->i_sb->s_vfs_rename_mutex); | ||
55 | if((fromName == NULL) || (toName == NULL)) { | 53 | if((fromName == NULL) || (toName == NULL)) { |
56 | rc = -ENOMEM; | 54 | rc = -ENOMEM; |
57 | goto cifs_hl_exit; | 55 | goto cifs_hl_exit; |
@@ -103,9 +101,7 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd) | |||
103 | 101 | ||
104 | xid = GetXid(); | 102 | xid = GetXid(); |
105 | 103 | ||
106 | mutex_lock(&direntry->d_sb->s_vfs_rename_mutex); | ||
107 | full_path = build_path_from_dentry(direntry); | 104 | full_path = build_path_from_dentry(direntry); |
108 | mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex); | ||
109 | 105 | ||
110 | if (!full_path) | 106 | if (!full_path) |
111 | goto out_no_free; | 107 | goto out_no_free; |
@@ -164,9 +160,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname) | |||
164 | cifs_sb = CIFS_SB(inode->i_sb); | 160 | cifs_sb = CIFS_SB(inode->i_sb); |
165 | pTcon = cifs_sb->tcon; | 161 | pTcon = cifs_sb->tcon; |
166 | 162 | ||
167 | mutex_lock(&inode->i_sb->s_vfs_rename_mutex); | ||
168 | full_path = build_path_from_dentry(direntry); | 163 | full_path = build_path_from_dentry(direntry); |
169 | mutex_unlock(&inode->i_sb->s_vfs_rename_mutex); | ||
170 | 164 | ||
171 | if(full_path == NULL) { | 165 | if(full_path == NULL) { |
172 | FreeXid(xid); | 166 | FreeXid(xid); |
diff --git a/fs/cifs/ntlmssp.c b/fs/cifs/ntlmssp.c index 78866f925747..115359cc7a32 100644 --- a/fs/cifs/ntlmssp.c +++ b/fs/cifs/ntlmssp.c | |||
@@ -121,6 +121,20 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, const int type, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | /* copy session key */ | ||
125 | |||
126 | /* if Unicode, align strings to two byte boundary */ | ||
127 | |||
128 | /* copy user name */ /* BB Do we need to special case null user name? */ | ||
129 | |||
130 | /* copy domain name */ | ||
131 | |||
132 | /* copy Linux version */ | ||
133 | |||
134 | /* copy network operating system name */ | ||
135 | |||
136 | /* update bcc and smb buffer length */ | ||
137 | |||
124 | /* rc = SendReceive2(xid, ses, iov, num_iovecs, &resp_buf_type, 0); */ | 138 | /* rc = SendReceive2(xid, ses, iov, num_iovecs, &resp_buf_type, 0); */ |
125 | /* SMB request buf freed in SendReceive2 */ | 139 | /* SMB request buf freed in SendReceive2 */ |
126 | 140 | ||
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 2f6e2825571e..b689c5035124 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -404,9 +404,7 @@ static int initiate_cifs_search(const int xid, struct file *file) | |||
404 | if(pTcon == NULL) | 404 | if(pTcon == NULL) |
405 | return -EINVAL; | 405 | return -EINVAL; |
406 | 406 | ||
407 | mutex_lock(&file->f_dentry->d_sb->s_vfs_rename_mutex); | ||
408 | full_path = build_path_from_dentry(file->f_dentry); | 407 | full_path = build_path_from_dentry(file->f_dentry); |
409 | mutex_unlock(&file->f_dentry->d_sb->s_vfs_rename_mutex); | ||
410 | 408 | ||
411 | if(full_path == NULL) { | 409 | if(full_path == NULL) { |
412 | return -ENOMEM; | 410 | return -ENOMEM; |
@@ -592,6 +590,13 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
592 | first_entry_in_buffer = | 590 | first_entry_in_buffer = |
593 | cifsFile->srch_inf.index_of_last_entry - | 591 | cifsFile->srch_inf.index_of_last_entry - |
594 | cifsFile->srch_inf.entries_in_buffer; | 592 | cifsFile->srch_inf.entries_in_buffer; |
593 | |||
594 | /* if first entry in buf is zero then is first buffer | ||
595 | in search response data which means it is likely . and .. | ||
596 | will be in this buffer, although some servers do not return | ||
597 | . and .. for the root of a drive and for those we need | ||
598 | to start two entries earlier */ | ||
599 | |||
595 | /* dump_cifs_file_struct(file, "In fce ");*/ | 600 | /* dump_cifs_file_struct(file, "In fce ");*/ |
596 | if(((index_to_find < cifsFile->srch_inf.index_of_last_entry) && | 601 | if(((index_to_find < cifsFile->srch_inf.index_of_last_entry) && |
597 | is_dir_changed(file)) || | 602 | is_dir_changed(file)) || |
@@ -634,23 +639,14 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
634 | char * end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + | 639 | char * end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + |
635 | smbCalcSize((struct smb_hdr *) | 640 | smbCalcSize((struct smb_hdr *) |
636 | cifsFile->srch_inf.ntwrk_buf_start); | 641 | cifsFile->srch_inf.ntwrk_buf_start); |
642 | |||
643 | current_entry = cifsFile->srch_inf.srch_entries_start; | ||
637 | first_entry_in_buffer = cifsFile->srch_inf.index_of_last_entry | 644 | first_entry_in_buffer = cifsFile->srch_inf.index_of_last_entry |
638 | - cifsFile->srch_inf.entries_in_buffer; | 645 | - cifsFile->srch_inf.entries_in_buffer; |
639 | pos_in_buf = index_to_find - first_entry_in_buffer; | 646 | pos_in_buf = index_to_find - first_entry_in_buffer; |
640 | cFYI(1,("found entry - pos_in_buf %d",pos_in_buf)); | 647 | cFYI(1,("found entry - pos_in_buf %d",pos_in_buf)); |
641 | current_entry = cifsFile->srch_inf.srch_entries_start; | ||
642 | for(i=0;(i<(pos_in_buf)) && (current_entry != NULL);i++) { | 648 | for(i=0;(i<(pos_in_buf)) && (current_entry != NULL);i++) { |
643 | /* go entry by entry figuring out which is first */ | 649 | /* go entry by entry figuring out which is first */ |
644 | /* if( . or ..) | ||
645 | skip */ | ||
646 | rc = cifs_entry_is_dot(current_entry,cifsFile); | ||
647 | if(rc == 1) /* is . or .. so skip */ { | ||
648 | cFYI(1,("Entry is .")); /* BB removeme BB */ | ||
649 | /* continue; */ | ||
650 | } else if (rc == 2 ) { | ||
651 | cFYI(1,("Entry is ..")); /* BB removeme BB */ | ||
652 | /* continue; */ | ||
653 | } | ||
654 | current_entry = nxt_dir_entry(current_entry,end_of_smb); | 650 | current_entry = nxt_dir_entry(current_entry,end_of_smb); |
655 | } | 651 | } |
656 | if((current_entry == NULL) && (i < pos_in_buf)) { | 652 | if((current_entry == NULL) && (i < pos_in_buf)) { |
@@ -770,6 +766,11 @@ static int cifs_filldir(char *pfindEntry, struct file *file, | |||
770 | if(file->f_dentry == NULL) | 766 | if(file->f_dentry == NULL) |
771 | return -ENOENT; | 767 | return -ENOENT; |
772 | 768 | ||
769 | rc = cifs_entry_is_dot(pfindEntry,pCifsF); | ||
770 | /* skip . and .. since we added them first */ | ||
771 | if(rc != 0) | ||
772 | return 0; | ||
773 | |||
773 | cifs_sb = CIFS_SB(file->f_dentry->d_sb); | 774 | cifs_sb = CIFS_SB(file->f_dentry->d_sb); |
774 | 775 | ||
775 | qstring.name = scratch_buf; | 776 | qstring.name = scratch_buf; |
@@ -898,22 +899,22 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
898 | 899 | ||
899 | switch ((int) file->f_pos) { | 900 | switch ((int) file->f_pos) { |
900 | case 0: | 901 | case 0: |
901 | /*if (filldir(direntry, ".", 1, file->f_pos, | 902 | if (filldir(direntry, ".", 1, file->f_pos, |
902 | file->f_dentry->d_inode->i_ino, DT_DIR) < 0) { | 903 | file->f_dentry->d_inode->i_ino, DT_DIR) < 0) { |
903 | cERROR(1, ("Filldir for current dir failed ")); | 904 | cERROR(1, ("Filldir for current dir failed")); |
904 | rc = -ENOMEM; | 905 | rc = -ENOMEM; |
905 | break; | 906 | break; |
906 | } | 907 | } |
907 | file->f_pos++; */ | 908 | file->f_pos++; |
908 | case 1: | 909 | case 1: |
909 | /* if (filldir(direntry, "..", 2, file->f_pos, | 910 | if (filldir(direntry, "..", 2, file->f_pos, |
910 | file->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) { | 911 | file->f_dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) { |
911 | cERROR(1, ("Filldir for parent dir failed ")); | 912 | cERROR(1, ("Filldir for parent dir failed ")); |
912 | rc = -ENOMEM; | 913 | rc = -ENOMEM; |
913 | break; | 914 | break; |
914 | } | 915 | } |
915 | file->f_pos++; */ | 916 | file->f_pos++; |
916 | case 2: | 917 | default: |
917 | /* 1) If search is active, | 918 | /* 1) If search is active, |
918 | is in current search buffer? | 919 | is in current search buffer? |
919 | if it before then restart search | 920 | if it before then restart search |
@@ -927,7 +928,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
927 | return rc; | 928 | return rc; |
928 | } | 929 | } |
929 | } | 930 | } |
930 | default: | ||
931 | if(file->private_data == NULL) { | 931 | if(file->private_data == NULL) { |
932 | rc = -EINVAL; | 932 | rc = -EINVAL; |
933 | FreeXid(xid); | 933 | FreeXid(xid); |
@@ -947,8 +947,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
947 | kfree(cifsFile->search_resume_name); | 947 | kfree(cifsFile->search_resume_name); |
948 | cifsFile->search_resume_name = NULL; */ | 948 | cifsFile->search_resume_name = NULL; */ |
949 | 949 | ||
950 | /* BB account for . and .. in f_pos as special case */ | ||
951 | |||
952 | rc = find_cifs_entry(xid,pTcon, file, | 950 | rc = find_cifs_entry(xid,pTcon, file, |
953 | ¤t_entry,&num_to_fill); | 951 | ¤t_entry,&num_to_fill); |
954 | if(rc) { | 952 | if(rc) { |
@@ -977,7 +975,8 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
977 | num_to_fill, i)); | 975 | num_to_fill, i)); |
978 | break; | 976 | break; |
979 | } | 977 | } |
980 | 978 | /* if buggy server returns . and .. late do | |
979 | we want to check for that here? */ | ||
981 | rc = cifs_filldir(current_entry, file, | 980 | rc = cifs_filldir(current_entry, file, |
982 | filldir, direntry,tmp_buf); | 981 | filldir, direntry,tmp_buf); |
983 | file->f_pos++; | 982 | file->f_pos++; |
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 3938444d87b2..7754d641775e 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
@@ -62,9 +62,7 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name) | |||
62 | cifs_sb = CIFS_SB(sb); | 62 | cifs_sb = CIFS_SB(sb); |
63 | pTcon = cifs_sb->tcon; | 63 | pTcon = cifs_sb->tcon; |
64 | 64 | ||
65 | mutex_lock(&sb->s_vfs_rename_mutex); | ||
66 | full_path = build_path_from_dentry(direntry); | 65 | full_path = build_path_from_dentry(direntry); |
67 | mutex_unlock(&sb->s_vfs_rename_mutex); | ||
68 | if(full_path == NULL) { | 66 | if(full_path == NULL) { |
69 | FreeXid(xid); | 67 | FreeXid(xid); |
70 | return -ENOMEM; | 68 | return -ENOMEM; |
@@ -116,9 +114,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name, | |||
116 | cifs_sb = CIFS_SB(sb); | 114 | cifs_sb = CIFS_SB(sb); |
117 | pTcon = cifs_sb->tcon; | 115 | pTcon = cifs_sb->tcon; |
118 | 116 | ||
119 | mutex_lock(&sb->s_vfs_rename_mutex); | ||
120 | full_path = build_path_from_dentry(direntry); | 117 | full_path = build_path_from_dentry(direntry); |
121 | mutex_unlock(&sb->s_vfs_rename_mutex); | ||
122 | if(full_path == NULL) { | 118 | if(full_path == NULL) { |
123 | FreeXid(xid); | 119 | FreeXid(xid); |
124 | return -ENOMEM; | 120 | return -ENOMEM; |
@@ -223,9 +219,7 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name, | |||
223 | cifs_sb = CIFS_SB(sb); | 219 | cifs_sb = CIFS_SB(sb); |
224 | pTcon = cifs_sb->tcon; | 220 | pTcon = cifs_sb->tcon; |
225 | 221 | ||
226 | mutex_lock(&sb->s_vfs_rename_mutex); | ||
227 | full_path = build_path_from_dentry(direntry); | 222 | full_path = build_path_from_dentry(direntry); |
228 | mutex_unlock(&sb->s_vfs_rename_mutex); | ||
229 | if(full_path == NULL) { | 223 | if(full_path == NULL) { |
230 | FreeXid(xid); | 224 | FreeXid(xid); |
231 | return -ENOMEM; | 225 | return -ENOMEM; |
@@ -341,9 +335,7 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size) | |||
341 | cifs_sb = CIFS_SB(sb); | 335 | cifs_sb = CIFS_SB(sb); |
342 | pTcon = cifs_sb->tcon; | 336 | pTcon = cifs_sb->tcon; |
343 | 337 | ||
344 | mutex_lock(&sb->s_vfs_rename_mutex); | ||
345 | full_path = build_path_from_dentry(direntry); | 338 | full_path = build_path_from_dentry(direntry); |
346 | mutex_unlock(&sb->s_vfs_rename_mutex); | ||
347 | if(full_path == NULL) { | 339 | if(full_path == NULL) { |
348 | FreeXid(xid); | 340 | FreeXid(xid); |
349 | return -ENOMEM; | 341 | return -ENOMEM; |
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index 58c418fbca2c..97ae1b92bc47 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -408,8 +408,9 @@ int reiserfs_cache_default_acl(struct inode *inode) | |||
408 | acl = reiserfs_get_acl(inode, ACL_TYPE_DEFAULT); | 408 | acl = reiserfs_get_acl(inode, ACL_TYPE_DEFAULT); |
409 | reiserfs_read_unlock_xattrs(inode->i_sb); | 409 | reiserfs_read_unlock_xattrs(inode->i_sb); |
410 | reiserfs_read_unlock_xattr_i(inode); | 410 | reiserfs_read_unlock_xattr_i(inode); |
411 | ret = acl ? 1 : 0; | 411 | ret = (acl && !IS_ERR(acl)); |
412 | posix_acl_release(acl); | 412 | if (ret) |
413 | posix_acl_release(acl); | ||
413 | } | 414 | } |
414 | 415 | ||
415 | return ret; | 416 | return ret; |
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h index d5677cbec200..18ca29e9105a 100644 --- a/include/asm-powerpc/iommu.h +++ b/include/asm-powerpc/iommu.h | |||
@@ -70,17 +70,18 @@ extern void iommu_free_table(struct device_node *dn); | |||
70 | extern struct iommu_table *iommu_init_table(struct iommu_table * tbl); | 70 | extern struct iommu_table *iommu_init_table(struct iommu_table * tbl); |
71 | 71 | ||
72 | extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl, | 72 | extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl, |
73 | struct scatterlist *sglist, int nelems, | 73 | struct scatterlist *sglist, int nelems, unsigned long mask, |
74 | enum dma_data_direction direction); | 74 | enum dma_data_direction direction); |
75 | extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, | 75 | extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, |
76 | int nelems, enum dma_data_direction direction); | 76 | int nelems, enum dma_data_direction direction); |
77 | 77 | ||
78 | extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, | 78 | extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, |
79 | dma_addr_t *dma_handle, gfp_t flag); | 79 | dma_addr_t *dma_handle, unsigned long mask, gfp_t flag); |
80 | extern void iommu_free_coherent(struct iommu_table *tbl, size_t size, | 80 | extern void iommu_free_coherent(struct iommu_table *tbl, size_t size, |
81 | void *vaddr, dma_addr_t dma_handle); | 81 | void *vaddr, dma_addr_t dma_handle); |
82 | extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, | 82 | extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, |
83 | size_t size, enum dma_data_direction direction); | 83 | size_t size, unsigned long mask, |
84 | enum dma_data_direction direction); | ||
84 | extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, | 85 | extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, |
85 | size_t size, enum dma_data_direction direction); | 86 | size_t size, enum dma_data_direction direction); |
86 | 87 | ||
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h index 5ed847680754..0f9254c18914 100644 --- a/include/asm-powerpc/machdep.h +++ b/include/asm-powerpc/machdep.h | |||
@@ -253,7 +253,11 @@ extern struct machdep_calls *machine_id; | |||
253 | 253 | ||
254 | #define __machine_desc __attribute__ ((__section__ (".machine.desc"))) | 254 | #define __machine_desc __attribute__ ((__section__ (".machine.desc"))) |
255 | 255 | ||
256 | #define define_machine(name) struct machdep_calls mach_##name __machine_desc = | 256 | #define define_machine(name) \ |
257 | extern struct machdep_calls mach_##name; \ | ||
258 | EXPORT_SYMBOL(mach_##name); \ | ||
259 | struct machdep_calls mach_##name __machine_desc = | ||
260 | |||
257 | #define machine_is(name) \ | 261 | #define machine_is(name) \ |
258 | ({ \ | 262 | ({ \ |
259 | extern struct machdep_calls mach_##name \ | 263 | extern struct machdep_calls mach_##name \ |
diff --git a/mm/shmem.c b/mm/shmem.c index 37eaf42ed2c6..4c5e68e4e9ae 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -46,6 +46,8 @@ | |||
46 | #include <linux/mempolicy.h> | 46 | #include <linux/mempolicy.h> |
47 | #include <linux/namei.h> | 47 | #include <linux/namei.h> |
48 | #include <linux/ctype.h> | 48 | #include <linux/ctype.h> |
49 | #include <linux/migrate.h> | ||
50 | |||
49 | #include <asm/uaccess.h> | 51 | #include <asm/uaccess.h> |
50 | #include <asm/div64.h> | 52 | #include <asm/div64.h> |
51 | #include <asm/pgtable.h> | 53 | #include <asm/pgtable.h> |
@@ -2173,6 +2175,7 @@ static struct address_space_operations shmem_aops = { | |||
2173 | .prepare_write = shmem_prepare_write, | 2175 | .prepare_write = shmem_prepare_write, |
2174 | .commit_write = simple_commit_write, | 2176 | .commit_write = simple_commit_write, |
2175 | #endif | 2177 | #endif |
2178 | .migratepage = migrate_page, | ||
2176 | }; | 2179 | }; |
2177 | 2180 | ||
2178 | static struct file_operations shmem_file_operations = { | 2181 | static struct file_operations shmem_file_operations = { |
diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c index 81315996c0f1..882ae98a41b1 100644 --- a/sound/oss/dmasound/tas_common.c +++ b/sound/oss/dmasound/tas_common.c | |||
@@ -195,8 +195,8 @@ tas_init(int driver_id, const char *driver_name) | |||
195 | 195 | ||
196 | printk(KERN_INFO "tas driver [%s])\n", driver_name); | 196 | printk(KERN_INFO "tas driver [%s])\n", driver_name); |
197 | 197 | ||
198 | #ifndef CONFIG_I2C_KEYWEST | 198 | #ifndef CONFIG_I2C_POWERMAC |
199 | request_module("i2c-keywest"); | 199 | request_module("i2c-powermac"); |
200 | #endif | 200 | #endif |
201 | tas_node = find_devices("deq"); | 201 | tas_node = find_devices("deq"); |
202 | if (tas_node == NULL) | 202 | if (tas_node == NULL) |
diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c index aa09ebd9ffb8..46eebf5610e3 100644 --- a/sound/ppc/daca.c +++ b/sound/ppc/daca.c | |||
@@ -255,7 +255,7 @@ int __init snd_pmac_daca_init(struct snd_pmac *chip) | |||
255 | 255 | ||
256 | #ifdef CONFIG_KMOD | 256 | #ifdef CONFIG_KMOD |
257 | if (current->fs->root) | 257 | if (current->fs->root) |
258 | request_module("i2c-keywest"); | 258 | request_module("i2c-powermac"); |
259 | #endif /* CONFIG_KMOD */ | 259 | #endif /* CONFIG_KMOD */ |
260 | 260 | ||
261 | mix = kmalloc(sizeof(*mix), GFP_KERNEL); | 261 | mix = kmalloc(sizeof(*mix), GFP_KERNEL); |
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 1146dd882bb1..70e4ebc70260 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c | |||
@@ -1313,7 +1313,7 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip) | |||
1313 | 1313 | ||
1314 | #ifdef CONFIG_KMOD | 1314 | #ifdef CONFIG_KMOD |
1315 | if (current->fs->root) | 1315 | if (current->fs->root) |
1316 | request_module("i2c-keywest"); | 1316 | request_module("i2c-powermac"); |
1317 | #endif /* CONFIG_KMOD */ | 1317 | #endif /* CONFIG_KMOD */ |
1318 | 1318 | ||
1319 | mix = kmalloc(sizeof(*mix), GFP_KERNEL); | 1319 | mix = kmalloc(sizeof(*mix), GFP_KERNEL); |