aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2007-05-01 00:24:54 -0400
committerDmitry Torokhov <dtor@insightbb.com>2007-05-01 00:24:54 -0400
commitbc95f3669f5e6f63cf0b84fe4922c3c6dd4aa775 (patch)
tree427fcf2a7287c16d4b5aa6cbf494d59579a6a8b1 /drivers/char
parent3d29cdff999c37b3876082278a8134a0642a02cd (diff)
parentdc87c3985e9b442c60994308a96f887579addc39 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/usb/input/Makefile drivers/usb/input/gtco.c
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Kconfig48
-rw-r--r--drivers/char/agp/Makefile3
-rw-r--r--drivers/char/agp/agp.h8
-rw-r--r--drivers/char/agp/ali-agp.c6
-rw-r--r--drivers/char/agp/amd-k7-agp.c6
-rw-r--r--drivers/char/agp/amd64-agp.c4
-rw-r--r--drivers/char/agp/ati-agp.c4
-rw-r--r--drivers/char/agp/efficeon-agp.c6
-rw-r--r--drivers/char/agp/generic.c2
-rw-r--r--drivers/char/agp/hp-agp.c2
-rw-r--r--drivers/char/agp/i460-agp.c4
-rw-r--r--drivers/char/agp/intel-agp.c55
-rw-r--r--drivers/char/agp/nvidia-agp.c6
-rw-r--r--drivers/char/agp/parisc-agp.c4
-rw-r--r--drivers/char/agp/sgi-agp.c2
-rw-r--r--drivers/char/agp/sis-agp.c2
-rw-r--r--drivers/char/agp/sworks-agp.c6
-rw-r--r--drivers/char/agp/uninorth-agp.c8
-rw-r--r--drivers/char/agp/via-agp.c6
-rw-r--r--drivers/char/briq_panel.c7
-rw-r--r--drivers/char/cyclades.c1
-rw-r--r--drivers/char/drm/Makefile2
-rw-r--r--drivers/char/drm/ffb_context.c544
-rw-r--r--drivers/char/drm/ffb_drv.c355
-rw-r--r--drivers/char/drm/ffb_drv.h379
-rw-r--r--drivers/char/ds1286.c9
-rw-r--r--drivers/char/epca.c17
-rw-r--r--drivers/char/generic_serial.c7
-rw-r--r--drivers/char/hvc_console.c65
-rw-r--r--drivers/char/hvc_iseries.c2
-rw-r--r--drivers/char/hvc_vio.c2
-rw-r--r--drivers/char/hvsi.c4
-rw-r--r--drivers/char/ip2/i2lib.c4
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c5
-rw-r--r--drivers/char/lcd.c173
-rw-r--r--drivers/char/lcd.h32
-rw-r--r--drivers/char/mem.c2
-rw-r--r--drivers/char/mwave/3780i.c14
-rw-r--r--drivers/char/mxser.c48
-rw-r--r--drivers/char/mxser_new.c45
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c3
-rw-r--r--drivers/char/pcmcia/synclink_cs.c2
-rw-r--r--drivers/char/random.c38
-rw-r--r--drivers/char/rio/rio_linux.c2
-rw-r--r--drivers/char/sonypi.c53
-rw-r--r--drivers/char/tpm/tpm_atmel.h4
-rw-r--r--drivers/char/tty_io.c26
-rw-r--r--drivers/char/vt.c21
-rw-r--r--drivers/char/vt_ioctl.c18
-rw-r--r--drivers/char/watchdog/Kconfig3
-rw-r--r--drivers/char/watchdog/machzwd.c24
51 files changed, 354 insertions, 1739 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index d0a6dc53213c..d0c978fbc204 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -386,6 +386,39 @@ config AU1000_SERIAL_CONSOLE
386 If you have an Alchemy AU1000 processor (MIPS based) and you want 386 If you have an Alchemy AU1000 processor (MIPS based) and you want
387 to use a console on a serial port, say Y. Otherwise, say N. 387 to use a console on a serial port, say Y. Otherwise, say N.
388 388
389config SERIAL_DEC
390 bool "DECstation serial support"
391 depends on MACH_DECSTATION
392 default y
393 help
394 This selects whether you want to be asked about drivers for
395 DECstation serial ports.
396
397 Note that the answer to this question won't directly affect the
398 kernel: saying N will just cause the configurator to skip all
399 the questions about DECstation serial ports.
400
401config SERIAL_DEC_CONSOLE
402 bool "Support for console on a DECstation serial port"
403 depends on SERIAL_DEC
404 default y
405 help
406 If you say Y here, it will be possible to use a serial port as the
407 system console (the system console is the device which receives all
408 kernel messages and warnings and which allows logins in single user
409 mode). Note that the firmware uses ttyS0 as the serial console on
410 the Maxine and ttyS2 on the others.
411
412 If unsure, say Y.
413
414config ZS
415 bool "Z85C30 Serial Support"
416 depends on SERIAL_DEC
417 default y
418 help
419 Documentation on the Zilog 85C350 serial communications controller
420 is downloadable at <http://www.zilog.com/pdfs/serial/z85c30.pdf>
421
389config A2232 422config A2232
390 tristate "Commodore A2232 serial support (EXPERIMENTAL)" 423 tristate "Commodore A2232 serial support (EXPERIMENTAL)"
391 depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP 424 depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP
@@ -1026,16 +1059,17 @@ config MMTIMER
1026source "drivers/char/tpm/Kconfig" 1059source "drivers/char/tpm/Kconfig"
1027 1060
1028config TELCLOCK 1061config TELCLOCK
1029 tristate "Telecom clock driver for MPBL0010 ATCA SBC" 1062 tristate "Telecom clock driver for ATCA SBC"
1030 depends on EXPERIMENTAL && X86 1063 depends on EXPERIMENTAL && X86
1031 default n 1064 default n
1032 help 1065 help
1033 The telecom clock device is specific to the MPBL0010 ATCA computer and 1066 The telecom clock device is specific to the MPCBL0010 and MPCBL0050
1034 allows direct userspace access to the configuration of the telecom clock 1067 ATCA computers and allows direct userspace access to the
1035 configuration settings. This device is used for hardware synchronization 1068 configuration of the telecom clock configuration settings. This
1036 across the ATCA backplane fabric. Upon loading, the driver exports a 1069 device is used for hardware synchronization across the ATCA backplane
1037 sysfs directory, /sys/devices/platform/telco_clock, with a number of 1070 fabric. Upon loading, the driver exports a sysfs directory,
1038 files for controlling the behavior of this hardware. 1071 /sys/devices/platform/telco_clock, with a number of files for
1072 controlling the behavior of this hardware.
1039 1073
1040endmenu 1074endmenu
1041 1075
diff --git a/drivers/char/agp/Makefile b/drivers/char/agp/Makefile
index a0d04a23dacd..627f542827c7 100644
--- a/drivers/char/agp/Makefile
+++ b/drivers/char/agp/Makefile
@@ -1,7 +1,8 @@
1agpgart-y := backend.o frontend.o generic.o isoch.o 1agpgart-y := backend.o frontend.o generic.o isoch.o
2 2
3agpgart-$(CONFIG_COMPAT) += compat_ioctl.o
4
3obj-$(CONFIG_AGP) += agpgart.o 5obj-$(CONFIG_AGP) += agpgart.o
4obj-$(CONFIG_COMPAT) += compat_ioctl.o
5obj-$(CONFIG_AGP_ALI) += ali-agp.o 6obj-$(CONFIG_AGP_ALI) += ali-agp.o
6obj-$(CONFIG_AGP_ATI) += ati-agp.o 7obj-$(CONFIG_AGP_ATI) += ati-agp.o
7obj-$(CONFIG_AGP_AMD) += amd-k7-agp.o 8obj-$(CONFIG_AGP_AMD) += amd-k7-agp.o
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index 9bd68d9f0f59..fdbca25a3948 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -93,12 +93,12 @@ struct aper_size_info_fixed {
93 93
94struct agp_bridge_driver { 94struct agp_bridge_driver {
95 struct module *owner; 95 struct module *owner;
96 void *aperture_sizes; 96 const void *aperture_sizes;
97 int num_aperture_sizes; 97 int num_aperture_sizes;
98 enum aper_size_type size_type; 98 enum aper_size_type size_type;
99 int cant_use_aperture; 99 int cant_use_aperture;
100 int needs_scratch_page; 100 int needs_scratch_page;
101 struct gatt_mask *masks; 101 const struct gatt_mask *masks;
102 int (*fetch_size)(void); 102 int (*fetch_size)(void);
103 int (*configure)(void); 103 int (*configure)(void);
104 void (*agp_enable)(struct agp_bridge_data *, u32); 104 void (*agp_enable)(struct agp_bridge_data *, u32);
@@ -119,7 +119,7 @@ struct agp_bridge_driver {
119 119
120struct agp_bridge_data { 120struct agp_bridge_data {
121 const struct agp_version *version; 121 const struct agp_version *version;
122 struct agp_bridge_driver *driver; 122 const struct agp_bridge_driver *driver;
123 struct vm_operations_struct *vm_ops; 123 struct vm_operations_struct *vm_ops;
124 void *previous_size; 124 void *previous_size;
125 void *current_size; 125 void *current_size;
@@ -290,7 +290,7 @@ void agp3_generic_cleanup(void);
290 290
291/* aperture sizes have been standardised since v3 */ 291/* aperture sizes have been standardised since v3 */
292#define AGP_GENERIC_SIZES_ENTRIES 11 292#define AGP_GENERIC_SIZES_ENTRIES 11
293extern struct aper_size_info_16 agp3_generic_sizes[]; 293extern const struct aper_size_info_16 agp3_generic_sizes[];
294 294
295#define virt_to_gart(x) (phys_to_gart(virt_to_phys(x))) 295#define virt_to_gart(x) (phys_to_gart(virt_to_phys(x)))
296#define gart_to_virt(x) (phys_to_virt(gart_to_phys(x))) 296#define gart_to_virt(x) (phys_to_virt(gart_to_phys(x)))
diff --git a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c
index 98177a93076f..5b684fddcc03 100644
--- a/drivers/char/agp/ali-agp.c
+++ b/drivers/char/agp/ali-agp.c
@@ -182,7 +182,7 @@ static void m1541_destroy_page(void * addr)
182 182
183/* Setup function */ 183/* Setup function */
184 184
185static struct aper_size_info_32 ali_generic_sizes[7] = 185static const struct aper_size_info_32 ali_generic_sizes[7] =
186{ 186{
187 {256, 65536, 6, 10}, 187 {256, 65536, 6, 10},
188 {128, 32768, 5, 9}, 188 {128, 32768, 5, 9},
@@ -193,7 +193,7 @@ static struct aper_size_info_32 ali_generic_sizes[7] =
193 {4, 1024, 0, 3} 193 {4, 1024, 0, 3}
194}; 194};
195 195
196static struct agp_bridge_driver ali_generic_bridge = { 196static const struct agp_bridge_driver ali_generic_bridge = {
197 .owner = THIS_MODULE, 197 .owner = THIS_MODULE,
198 .aperture_sizes = ali_generic_sizes, 198 .aperture_sizes = ali_generic_sizes,
199 .size_type = U32_APER_SIZE, 199 .size_type = U32_APER_SIZE,
@@ -217,7 +217,7 @@ static struct agp_bridge_driver ali_generic_bridge = {
217 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 217 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
218}; 218};
219 219
220static struct agp_bridge_driver ali_m1541_bridge = { 220static const struct agp_bridge_driver ali_m1541_bridge = {
221 .owner = THIS_MODULE, 221 .owner = THIS_MODULE,
222 .aperture_sizes = ali_generic_sizes, 222 .aperture_sizes = ali_generic_sizes,
223 .size_type = U32_APER_SIZE, 223 .size_type = U32_APER_SIZE,
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 3d8d448bf394..e6c534e62846 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -344,7 +344,7 @@ static int amd_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
344 return 0; 344 return 0;
345} 345}
346 346
347static struct aper_size_info_lvl2 amd_irongate_sizes[7] = 347static const struct aper_size_info_lvl2 amd_irongate_sizes[7] =
348{ 348{
349 {2048, 524288, 0x0000000c}, 349 {2048, 524288, 0x0000000c},
350 {1024, 262144, 0x0000000a}, 350 {1024, 262144, 0x0000000a},
@@ -355,12 +355,12 @@ static struct aper_size_info_lvl2 amd_irongate_sizes[7] =
355 {32, 8192, 0x00000000} 355 {32, 8192, 0x00000000}
356}; 356};
357 357
358static struct gatt_mask amd_irongate_masks[] = 358static const struct gatt_mask amd_irongate_masks[] =
359{ 359{
360 {.mask = 1, .type = 0} 360 {.mask = 1, .type = 0}
361}; 361};
362 362
363static struct agp_bridge_driver amd_irongate_driver = { 363static const struct agp_bridge_driver amd_irongate_driver = {
364 .owner = THIS_MODULE, 364 .owner = THIS_MODULE,
365 .aperture_sizes = amd_irongate_sizes, 365 .aperture_sizes = amd_irongate_sizes,
366 .size_type = LVL2_APER_SIZE, 366 .size_type = LVL2_APER_SIZE,
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 636d984ed4a6..485720486d60 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -192,7 +192,7 @@ static u64 amd64_configure (struct pci_dev *hammer, u64 gatt_table)
192} 192}
193 193
194 194
195static struct aper_size_info_32 amd_8151_sizes[7] = 195static const struct aper_size_info_32 amd_8151_sizes[7] =
196{ 196{
197 {2048, 524288, 9, 0x00000000 }, /* 0 0 0 0 0 0 */ 197 {2048, 524288, 9, 0x00000000 }, /* 0 0 0 0 0 0 */
198 {1024, 262144, 8, 0x00000400 }, /* 1 0 0 0 0 0 */ 198 {1024, 262144, 8, 0x00000400 }, /* 1 0 0 0 0 0 */
@@ -232,7 +232,7 @@ static void amd64_cleanup(void)
232} 232}
233 233
234 234
235static struct agp_bridge_driver amd_8151_driver = { 235static const struct agp_bridge_driver amd_8151_driver = {
236 .owner = THIS_MODULE, 236 .owner = THIS_MODULE,
237 .aperture_sizes = amd_8151_sizes, 237 .aperture_sizes = amd_8151_sizes,
238 .size_type = U32_APER_SIZE, 238 .size_type = U32_APER_SIZE,
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 77c9ad68fba9..780e59e588ad 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -24,7 +24,7 @@
24#define ATI_GART_CACHE_ENTRY_CNTRL 0x10 24#define ATI_GART_CACHE_ENTRY_CNTRL 0x10
25 25
26 26
27static struct aper_size_info_lvl2 ati_generic_sizes[7] = 27static const struct aper_size_info_lvl2 ati_generic_sizes[7] =
28{ 28{
29 {2048, 524288, 0x0000000c}, 29 {2048, 524288, 0x0000000c},
30 {1024, 262144, 0x0000000a}, 30 {1024, 262144, 0x0000000a},
@@ -410,7 +410,7 @@ static int ati_free_gatt_table(struct agp_bridge_data *bridge)
410 return 0; 410 return 0;
411} 411}
412 412
413static struct agp_bridge_driver ati_generic_bridge = { 413static const struct agp_bridge_driver ati_generic_bridge = {
414 .owner = THIS_MODULE, 414 .owner = THIS_MODULE,
415 .aperture_sizes = ati_generic_sizes, 415 .aperture_sizes = ati_generic_sizes,
416 .size_type = LVL2_APER_SIZE, 416 .size_type = LVL2_APER_SIZE,
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index 658cb1a72d2c..df8da7262853 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -59,7 +59,7 @@ static struct _efficeon_private {
59 unsigned long l1_table[EFFICEON_L1_SIZE]; 59 unsigned long l1_table[EFFICEON_L1_SIZE];
60} efficeon_private; 60} efficeon_private;
61 61
62static struct gatt_mask efficeon_generic_masks[] = 62static const struct gatt_mask efficeon_generic_masks[] =
63{ 63{
64 {.mask = 0x00000001, .type = 0} 64 {.mask = 0x00000001, .type = 0}
65}; 65};
@@ -70,7 +70,7 @@ static inline unsigned long efficeon_mask_memory(unsigned long addr)
70 return addr | 0x00000001; 70 return addr | 0x00000001;
71} 71}
72 72
73static struct aper_size_info_lvl2 efficeon_generic_sizes[4] = 73static const struct aper_size_info_lvl2 efficeon_generic_sizes[4] =
74{ 74{
75 {256, 65536, 0}, 75 {256, 65536, 0},
76 {128, 32768, 32}, 76 {128, 32768, 32},
@@ -309,7 +309,7 @@ static int efficeon_remove_memory(struct agp_memory * mem, off_t pg_start, int t
309} 309}
310 310
311 311
312static struct agp_bridge_driver efficeon_driver = { 312static const struct agp_bridge_driver efficeon_driver = {
313 .owner = THIS_MODULE, 313 .owner = THIS_MODULE,
314 .aperture_sizes = efficeon_generic_sizes, 314 .aperture_sizes = efficeon_generic_sizes,
315 .size_type = LVL2_APER_SIZE, 315 .size_type = LVL2_APER_SIZE,
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 7923337c3d26..f902d71947ba 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -1340,7 +1340,7 @@ void agp3_generic_cleanup(void)
1340} 1340}
1341EXPORT_SYMBOL(agp3_generic_cleanup); 1341EXPORT_SYMBOL(agp3_generic_cleanup);
1342 1342
1343struct aper_size_info_16 agp3_generic_sizes[AGP_GENERIC_SIZES_ENTRIES] = 1343const struct aper_size_info_16 agp3_generic_sizes[AGP_GENERIC_SIZES_ENTRIES] =
1344{ 1344{
1345 {4096, 1048576, 10,0x000}, 1345 {4096, 1048576, 10,0x000},
1346 {2048, 524288, 9, 0x800}, 1346 {2048, 524288, 9, 0x800},
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c
index 847deabf7f9b..bcdb149c8179 100644
--- a/drivers/char/agp/hp-agp.c
+++ b/drivers/char/agp/hp-agp.c
@@ -419,7 +419,7 @@ hp_zx1_enable (struct agp_bridge_data *bridge, u32 mode)
419 agp_device_command(command, (mode & AGP8X_MODE) != 0); 419 agp_device_command(command, (mode & AGP8X_MODE) != 0);
420} 420}
421 421
422struct agp_bridge_driver hp_zx1_driver = { 422const struct agp_bridge_driver hp_zx1_driver = {
423 .owner = THIS_MODULE, 423 .owner = THIS_MODULE,
424 .size_type = FIXED_APER_SIZE, 424 .size_type = FIXED_APER_SIZE,
425 .configure = hp_zx1_configure, 425 .configure = hp_zx1_configure,
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c
index 3e7618653abd..53354bf83af7 100644
--- a/drivers/char/agp/i460-agp.c
+++ b/drivers/char/agp/i460-agp.c
@@ -78,7 +78,7 @@ static struct {
78 } *lp_desc; 78 } *lp_desc;
79} i460; 79} i460;
80 80
81static struct aper_size_info_8 i460_sizes[3] = 81static const struct aper_size_info_8 i460_sizes[3] =
82{ 82{
83 /* 83 /*
84 * The 32GB aperture is only available with a 4M GART page size. Due to the 84 * The 32GB aperture is only available with a 4M GART page size. Due to the
@@ -550,7 +550,7 @@ static unsigned long i460_mask_memory (struct agp_bridge_data *bridge,
550 | (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xfffff000) >> 12); 550 | (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xfffff000) >> 12);
551} 551}
552 552
553struct agp_bridge_driver intel_i460_driver = { 553const struct agp_bridge_driver intel_i460_driver = {
554 .owner = THIS_MODULE, 554 .owner = THIS_MODULE,
555 .aperture_sizes = i460_sizes, 555 .aperture_sizes = i460_sizes,
556 .size_type = U8_APER_SIZE, 556 .size_type = U8_APER_SIZE,
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 06b0bb6d982f..55392a45a14b 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -18,11 +18,14 @@
18#define PCI_DEVICE_ID_INTEL_82965Q_IG 0x2992 18#define PCI_DEVICE_ID_INTEL_82965Q_IG 0x2992
19#define PCI_DEVICE_ID_INTEL_82965G_HB 0x29A0 19#define PCI_DEVICE_ID_INTEL_82965G_HB 0x29A0
20#define PCI_DEVICE_ID_INTEL_82965G_IG 0x29A2 20#define PCI_DEVICE_ID_INTEL_82965G_IG 0x29A2
21#define PCI_DEVICE_ID_INTEL_82965GM_HB 0x2A00
22#define PCI_DEVICE_ID_INTEL_82965GM_IG 0x2A02
21 23
22#define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \ 24#define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \
23 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \ 25 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \
24 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \ 26 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \
25 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB) 27 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \
28 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB)
26 29
27 30
28extern int agp_memory_reserved; 31extern int agp_memory_reserved;
@@ -63,7 +66,7 @@ extern int agp_memory_reserved;
63#define INTEL_I7505_AGPCTRL 0x70 66#define INTEL_I7505_AGPCTRL 0x70
64#define INTEL_I7505_MCHCFG 0x50 67#define INTEL_I7505_MCHCFG 0x50
65 68
66static struct aper_size_info_fixed intel_i810_sizes[] = 69static const struct aper_size_info_fixed intel_i810_sizes[] =
67{ 70{
68 {64, 16384, 4}, 71 {64, 16384, 4},
69 /* The 32M mode still requires a 64k gatt */ 72 /* The 32M mode still requires a 64k gatt */
@@ -428,9 +431,8 @@ static void intel_i830_init_gtt_entries(void)
428 431
429 if (IS_I965) { 432 if (IS_I965) {
430 u32 pgetbl_ctl; 433 u32 pgetbl_ctl;
434 pgetbl_ctl = readl(intel_i830_private.registers+I810_PGETBL_CTL);
431 435
432 pci_read_config_dword(agp_bridge->dev, I810_PGETBL_CTL,
433 &pgetbl_ctl);
434 /* The 965 has a field telling us the size of the GTT, 436 /* The 965 has a field telling us the size of the GTT,
435 * which may be larger than what is necessary to map the 437 * which may be larger than what is necessary to map the
436 * aperture. 438 * aperture.
@@ -1365,18 +1367,18 @@ static int intel_7505_configure(void)
1365} 1367}
1366 1368
1367/* Setup function */ 1369/* Setup function */
1368static struct gatt_mask intel_generic_masks[] = 1370static const struct gatt_mask intel_generic_masks[] =
1369{ 1371{
1370 {.mask = 0x00000017, .type = 0} 1372 {.mask = 0x00000017, .type = 0}
1371}; 1373};
1372 1374
1373static struct aper_size_info_8 intel_815_sizes[2] = 1375static const struct aper_size_info_8 intel_815_sizes[2] =
1374{ 1376{
1375 {64, 16384, 4, 0}, 1377 {64, 16384, 4, 0},
1376 {32, 8192, 3, 8}, 1378 {32, 8192, 3, 8},
1377}; 1379};
1378 1380
1379static struct aper_size_info_8 intel_8xx_sizes[7] = 1381static const struct aper_size_info_8 intel_8xx_sizes[7] =
1380{ 1382{
1381 {256, 65536, 6, 0}, 1383 {256, 65536, 6, 0},
1382 {128, 32768, 5, 32}, 1384 {128, 32768, 5, 32},
@@ -1387,7 +1389,7 @@ static struct aper_size_info_8 intel_8xx_sizes[7] =
1387 {4, 1024, 0, 63} 1389 {4, 1024, 0, 63}
1388}; 1390};
1389 1391
1390static struct aper_size_info_16 intel_generic_sizes[7] = 1392static const struct aper_size_info_16 intel_generic_sizes[7] =
1391{ 1393{
1392 {256, 65536, 6, 0}, 1394 {256, 65536, 6, 0},
1393 {128, 32768, 5, 32}, 1395 {128, 32768, 5, 32},
@@ -1398,7 +1400,7 @@ static struct aper_size_info_16 intel_generic_sizes[7] =
1398 {4, 1024, 0, 63} 1400 {4, 1024, 0, 63}
1399}; 1401};
1400 1402
1401static struct aper_size_info_8 intel_830mp_sizes[4] = 1403static const struct aper_size_info_8 intel_830mp_sizes[4] =
1402{ 1404{
1403 {256, 65536, 6, 0}, 1405 {256, 65536, 6, 0},
1404 {128, 32768, 5, 32}, 1406 {128, 32768, 5, 32},
@@ -1406,7 +1408,7 @@ static struct aper_size_info_8 intel_830mp_sizes[4] =
1406 {32, 8192, 3, 56} 1408 {32, 8192, 3, 56}
1407}; 1409};
1408 1410
1409static struct agp_bridge_driver intel_generic_driver = { 1411static const struct agp_bridge_driver intel_generic_driver = {
1410 .owner = THIS_MODULE, 1412 .owner = THIS_MODULE,
1411 .aperture_sizes = intel_generic_sizes, 1413 .aperture_sizes = intel_generic_sizes,
1412 .size_type = U16_APER_SIZE, 1414 .size_type = U16_APER_SIZE,
@@ -1430,7 +1432,7 @@ static struct agp_bridge_driver intel_generic_driver = {
1430 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1432 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1431}; 1433};
1432 1434
1433static struct agp_bridge_driver intel_810_driver = { 1435static const struct agp_bridge_driver intel_810_driver = {
1434 .owner = THIS_MODULE, 1436 .owner = THIS_MODULE,
1435 .aperture_sizes = intel_i810_sizes, 1437 .aperture_sizes = intel_i810_sizes,
1436 .size_type = FIXED_APER_SIZE, 1438 .size_type = FIXED_APER_SIZE,
@@ -1455,7 +1457,7 @@ static struct agp_bridge_driver intel_810_driver = {
1455 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1457 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1456}; 1458};
1457 1459
1458static struct agp_bridge_driver intel_815_driver = { 1460static const struct agp_bridge_driver intel_815_driver = {
1459 .owner = THIS_MODULE, 1461 .owner = THIS_MODULE,
1460 .aperture_sizes = intel_815_sizes, 1462 .aperture_sizes = intel_815_sizes,
1461 .size_type = U8_APER_SIZE, 1463 .size_type = U8_APER_SIZE,
@@ -1479,7 +1481,7 @@ static struct agp_bridge_driver intel_815_driver = {
1479 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1481 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1480}; 1482};
1481 1483
1482static struct agp_bridge_driver intel_830_driver = { 1484static const struct agp_bridge_driver intel_830_driver = {
1483 .owner = THIS_MODULE, 1485 .owner = THIS_MODULE,
1484 .aperture_sizes = intel_i830_sizes, 1486 .aperture_sizes = intel_i830_sizes,
1485 .size_type = FIXED_APER_SIZE, 1487 .size_type = FIXED_APER_SIZE,
@@ -1504,7 +1506,7 @@ static struct agp_bridge_driver intel_830_driver = {
1504 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1506 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1505}; 1507};
1506 1508
1507static struct agp_bridge_driver intel_820_driver = { 1509static const struct agp_bridge_driver intel_820_driver = {
1508 .owner = THIS_MODULE, 1510 .owner = THIS_MODULE,
1509 .aperture_sizes = intel_8xx_sizes, 1511 .aperture_sizes = intel_8xx_sizes,
1510 .size_type = U8_APER_SIZE, 1512 .size_type = U8_APER_SIZE,
@@ -1528,7 +1530,7 @@ static struct agp_bridge_driver intel_820_driver = {
1528 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1530 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1529}; 1531};
1530 1532
1531static struct agp_bridge_driver intel_830mp_driver = { 1533static const struct agp_bridge_driver intel_830mp_driver = {
1532 .owner = THIS_MODULE, 1534 .owner = THIS_MODULE,
1533 .aperture_sizes = intel_830mp_sizes, 1535 .aperture_sizes = intel_830mp_sizes,
1534 .size_type = U8_APER_SIZE, 1536 .size_type = U8_APER_SIZE,
@@ -1552,7 +1554,7 @@ static struct agp_bridge_driver intel_830mp_driver = {
1552 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1554 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1553}; 1555};
1554 1556
1555static struct agp_bridge_driver intel_840_driver = { 1557static const struct agp_bridge_driver intel_840_driver = {
1556 .owner = THIS_MODULE, 1558 .owner = THIS_MODULE,
1557 .aperture_sizes = intel_8xx_sizes, 1559 .aperture_sizes = intel_8xx_sizes,
1558 .size_type = U8_APER_SIZE, 1560 .size_type = U8_APER_SIZE,
@@ -1576,7 +1578,7 @@ static struct agp_bridge_driver intel_840_driver = {
1576 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1578 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1577}; 1579};
1578 1580
1579static struct agp_bridge_driver intel_845_driver = { 1581static const struct agp_bridge_driver intel_845_driver = {
1580 .owner = THIS_MODULE, 1582 .owner = THIS_MODULE,
1581 .aperture_sizes = intel_8xx_sizes, 1583 .aperture_sizes = intel_8xx_sizes,
1582 .size_type = U8_APER_SIZE, 1584 .size_type = U8_APER_SIZE,
@@ -1600,7 +1602,7 @@ static struct agp_bridge_driver intel_845_driver = {
1600 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1602 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1601}; 1603};
1602 1604
1603static struct agp_bridge_driver intel_850_driver = { 1605static const struct agp_bridge_driver intel_850_driver = {
1604 .owner = THIS_MODULE, 1606 .owner = THIS_MODULE,
1605 .aperture_sizes = intel_8xx_sizes, 1607 .aperture_sizes = intel_8xx_sizes,
1606 .size_type = U8_APER_SIZE, 1608 .size_type = U8_APER_SIZE,
@@ -1624,7 +1626,7 @@ static struct agp_bridge_driver intel_850_driver = {
1624 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1626 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1625}; 1627};
1626 1628
1627static struct agp_bridge_driver intel_860_driver = { 1629static const struct agp_bridge_driver intel_860_driver = {
1628 .owner = THIS_MODULE, 1630 .owner = THIS_MODULE,
1629 .aperture_sizes = intel_8xx_sizes, 1631 .aperture_sizes = intel_8xx_sizes,
1630 .size_type = U8_APER_SIZE, 1632 .size_type = U8_APER_SIZE,
@@ -1648,7 +1650,7 @@ static struct agp_bridge_driver intel_860_driver = {
1648 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1650 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1649}; 1651};
1650 1652
1651static struct agp_bridge_driver intel_915_driver = { 1653static const struct agp_bridge_driver intel_915_driver = {
1652 .owner = THIS_MODULE, 1654 .owner = THIS_MODULE,
1653 .aperture_sizes = intel_i830_sizes, 1655 .aperture_sizes = intel_i830_sizes,
1654 .size_type = FIXED_APER_SIZE, 1656 .size_type = FIXED_APER_SIZE,
@@ -1673,7 +1675,7 @@ static struct agp_bridge_driver intel_915_driver = {
1673 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1675 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1674}; 1676};
1675 1677
1676static struct agp_bridge_driver intel_i965_driver = { 1678static const struct agp_bridge_driver intel_i965_driver = {
1677 .owner = THIS_MODULE, 1679 .owner = THIS_MODULE,
1678 .aperture_sizes = intel_i830_sizes, 1680 .aperture_sizes = intel_i830_sizes,
1679 .size_type = FIXED_APER_SIZE, 1681 .size_type = FIXED_APER_SIZE,
@@ -1698,7 +1700,7 @@ static struct agp_bridge_driver intel_i965_driver = {
1698 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1700 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1699}; 1701};
1700 1702
1701static struct agp_bridge_driver intel_7505_driver = { 1703static const struct agp_bridge_driver intel_7505_driver = {
1702 .owner = THIS_MODULE, 1704 .owner = THIS_MODULE,
1703 .aperture_sizes = intel_8xx_sizes, 1705 .aperture_sizes = intel_8xx_sizes,
1704 .size_type = U8_APER_SIZE, 1706 .size_type = U8_APER_SIZE,
@@ -1921,7 +1923,13 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
1921 bridge->driver = &intel_845_driver; 1923 bridge->driver = &intel_845_driver;
1922 name = "965G"; 1924 name = "965G";
1923 break; 1925 break;
1924 1926 case PCI_DEVICE_ID_INTEL_82965GM_HB:
1927 if (find_i830(PCI_DEVICE_ID_INTEL_82965GM_IG))
1928 bridge->driver = &intel_i965_driver;
1929 else
1930 bridge->driver = &intel_845_driver;
1931 name = "965GM";
1932 break;
1925 case PCI_DEVICE_ID_INTEL_7505_0: 1933 case PCI_DEVICE_ID_INTEL_7505_0:
1926 bridge->driver = &intel_7505_driver; 1934 bridge->driver = &intel_7505_driver;
1927 name = "E7505"; 1935 name = "E7505";
@@ -2080,6 +2088,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
2080 ID(PCI_DEVICE_ID_INTEL_82965G_1_HB), 2088 ID(PCI_DEVICE_ID_INTEL_82965G_1_HB),
2081 ID(PCI_DEVICE_ID_INTEL_82965Q_HB), 2089 ID(PCI_DEVICE_ID_INTEL_82965Q_HB),
2082 ID(PCI_DEVICE_ID_INTEL_82965G_HB), 2090 ID(PCI_DEVICE_ID_INTEL_82965G_HB),
2091 ID(PCI_DEVICE_ID_INTEL_82965GM_HB),
2083 { } 2092 { }
2084}; 2093};
2085 2094
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index 2563286b2fcf..0c9dab557c94 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -272,7 +272,7 @@ static void nvidia_tlbflush(struct agp_memory *mem)
272} 272}
273 273
274 274
275static struct aper_size_info_8 nvidia_generic_sizes[5] = 275static const struct aper_size_info_8 nvidia_generic_sizes[5] =
276{ 276{
277 {512, 131072, 7, 0}, 277 {512, 131072, 7, 0},
278 {256, 65536, 6, 8}, 278 {256, 65536, 6, 8},
@@ -283,13 +283,13 @@ static struct aper_size_info_8 nvidia_generic_sizes[5] =
283}; 283};
284 284
285 285
286static struct gatt_mask nvidia_generic_masks[] = 286static const struct gatt_mask nvidia_generic_masks[] =
287{ 287{
288 { .mask = 1, .type = 0} 288 { .mask = 1, .type = 0}
289}; 289};
290 290
291 291
292static struct agp_bridge_driver nvidia_driver = { 292static const struct agp_bridge_driver nvidia_driver = {
293 .owner = THIS_MODULE, 293 .owner = THIS_MODULE,
294 .aperture_sizes = nvidia_generic_sizes, 294 .aperture_sizes = nvidia_generic_sizes,
295 .size_type = U8_APER_SIZE, 295 .size_type = U8_APER_SIZE,
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c
index b7b4590673ae..3d83b461ccad 100644
--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -210,7 +210,7 @@ parisc_agp_enable(struct agp_bridge_data *bridge, u32 mode)
210 agp_device_command(command, (mode & AGP8X_MODE) != 0); 210 agp_device_command(command, (mode & AGP8X_MODE) != 0);
211} 211}
212 212
213struct agp_bridge_driver parisc_agp_driver = { 213static const struct agp_bridge_driver parisc_agp_driver = {
214 .owner = THIS_MODULE, 214 .owner = THIS_MODULE,
215 .size_type = FIXED_APER_SIZE, 215 .size_type = FIXED_APER_SIZE,
216 .configure = parisc_agp_configure, 216 .configure = parisc_agp_configure,
@@ -236,7 +236,7 @@ static int __init
236agp_ioc_init(void __iomem *ioc_regs) 236agp_ioc_init(void __iomem *ioc_regs)
237{ 237{
238 struct _parisc_agp_info *info = &parisc_agp_info; 238 struct _parisc_agp_info *info = &parisc_agp_info;
239 u64 *iova_base, *io_pdir, io_tlb_ps; 239 u64 iova_base, *io_pdir, io_tlb_ps;
240 int io_tlb_shift; 240 int io_tlb_shift;
241 241
242 printk(KERN_INFO DRVPFX "IO PDIR shared with sba_iommu\n"); 242 printk(KERN_INFO DRVPFX "IO PDIR shared with sba_iommu\n");
diff --git a/drivers/char/agp/sgi-agp.c b/drivers/char/agp/sgi-agp.c
index 92d1dc45b9be..ee8f50edde1b 100644
--- a/drivers/char/agp/sgi-agp.c
+++ b/drivers/char/agp/sgi-agp.c
@@ -247,7 +247,7 @@ static struct agp_bridge_data *sgi_tioca_find_bridge(struct pci_dev *pdev)
247 return bridge; 247 return bridge;
248} 248}
249 249
250struct agp_bridge_driver sgi_tioca_driver = { 250const struct agp_bridge_driver sgi_tioca_driver = {
251 .owner = THIS_MODULE, 251 .owner = THIS_MODULE,
252 .size_type = U16_APER_SIZE, 252 .size_type = U16_APER_SIZE,
253 .configure = sgi_tioca_configure, 253 .configure = sgi_tioca_configure,
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
index 60342b708152..125f4282d955 100644
--- a/drivers/char/agp/sis-agp.c
+++ b/drivers/char/agp/sis-agp.c
@@ -108,7 +108,7 @@ static void sis_delayed_enable(struct agp_bridge_data *bridge, u32 mode)
108 } 108 }
109} 109}
110 110
111static struct aper_size_info_8 sis_generic_sizes[7] = 111static const struct aper_size_info_8 sis_generic_sizes[7] =
112{ 112{
113 {256, 65536, 6, 99}, 113 {256, 65536, 6, 99},
114 {128, 32768, 5, 83}, 114 {128, 32768, 5, 83},
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
index 9f5ae7714f85..55212a3811fd 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -385,12 +385,12 @@ static int serverworks_remove_memory(struct agp_memory *mem, off_t pg_start,
385 return 0; 385 return 0;
386} 386}
387 387
388static struct gatt_mask serverworks_masks[] = 388static const struct gatt_mask serverworks_masks[] =
389{ 389{
390 {.mask = 1, .type = 0} 390 {.mask = 1, .type = 0}
391}; 391};
392 392
393static struct aper_size_info_lvl2 serverworks_sizes[7] = 393static const struct aper_size_info_lvl2 serverworks_sizes[7] =
394{ 394{
395 {2048, 524288, 0x80000000}, 395 {2048, 524288, 0x80000000},
396 {1024, 262144, 0xc0000000}, 396 {1024, 262144, 0xc0000000},
@@ -423,7 +423,7 @@ static void serverworks_agp_enable(struct agp_bridge_data *bridge, u32 mode)
423 agp_device_command(command, 0); 423 agp_device_command(command, 0);
424} 424}
425 425
426static struct agp_bridge_driver sworks_driver = { 426static const struct agp_bridge_driver sworks_driver = {
427 .owner = THIS_MODULE, 427 .owner = THIS_MODULE,
428 .aperture_sizes = serverworks_sizes, 428 .aperture_sizes = serverworks_sizes,
429 .size_type = LVL2_APER_SIZE, 429 .size_type = LVL2_APER_SIZE,
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 6c45702e542c..91b062126a68 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -460,7 +460,7 @@ void null_cache_flush(void)
460 460
461/* Setup function */ 461/* Setup function */
462 462
463static struct aper_size_info_32 uninorth_sizes[7] = 463static const struct aper_size_info_32 uninorth_sizes[7] =
464{ 464{
465#if 0 /* Not sure uninorth supports that high aperture sizes */ 465#if 0 /* Not sure uninorth supports that high aperture sizes */
466 {256, 65536, 6, 64}, 466 {256, 65536, 6, 64},
@@ -477,7 +477,7 @@ static struct aper_size_info_32 uninorth_sizes[7] =
477 * Not sure that u3 supports that high aperture sizes but it 477 * Not sure that u3 supports that high aperture sizes but it
478 * would strange if it did not :) 478 * would strange if it did not :)
479 */ 479 */
480static struct aper_size_info_32 u3_sizes[8] = 480static const struct aper_size_info_32 u3_sizes[8] =
481{ 481{
482 {512, 131072, 7, 128}, 482 {512, 131072, 7, 128},
483 {256, 65536, 6, 64}, 483 {256, 65536, 6, 64},
@@ -489,7 +489,7 @@ static struct aper_size_info_32 u3_sizes[8] =
489 {4, 1024, 0, 1} 489 {4, 1024, 0, 1}
490}; 490};
491 491
492struct agp_bridge_driver uninorth_agp_driver = { 492const struct agp_bridge_driver uninorth_agp_driver = {
493 .owner = THIS_MODULE, 493 .owner = THIS_MODULE,
494 .aperture_sizes = (void *)uninorth_sizes, 494 .aperture_sizes = (void *)uninorth_sizes,
495 .size_type = U32_APER_SIZE, 495 .size_type = U32_APER_SIZE,
@@ -514,7 +514,7 @@ struct agp_bridge_driver uninorth_agp_driver = {
514 .cant_use_aperture = 1, 514 .cant_use_aperture = 1,
515}; 515};
516 516
517struct agp_bridge_driver u3_agp_driver = { 517const struct agp_bridge_driver u3_agp_driver = {
518 .owner = THIS_MODULE, 518 .owner = THIS_MODULE,
519 .aperture_sizes = (void *)u3_sizes, 519 .aperture_sizes = (void *)u3_sizes,
520 .size_type = U32_APER_SIZE, 520 .size_type = U32_APER_SIZE,
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index 2e7c04370cd9..a2bb4eccaab4 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -89,7 +89,7 @@ static void via_tlbflush(struct agp_memory *mem)
89} 89}
90 90
91 91
92static struct aper_size_info_8 via_generic_sizes[9] = 92static const struct aper_size_info_8 via_generic_sizes[9] =
93{ 93{
94 {256, 65536, 6, 0}, 94 {256, 65536, 6, 0},
95 {128, 32768, 5, 128}, 95 {128, 32768, 5, 128},
@@ -170,7 +170,7 @@ static void via_tlbflush_agp3(struct agp_memory *mem)
170} 170}
171 171
172 172
173static struct agp_bridge_driver via_agp3_driver = { 173static const struct agp_bridge_driver via_agp3_driver = {
174 .owner = THIS_MODULE, 174 .owner = THIS_MODULE,
175 .aperture_sizes = agp3_generic_sizes, 175 .aperture_sizes = agp3_generic_sizes,
176 .size_type = U8_APER_SIZE, 176 .size_type = U8_APER_SIZE,
@@ -194,7 +194,7 @@ static struct agp_bridge_driver via_agp3_driver = {
194 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 194 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
195}; 195};
196 196
197static struct agp_bridge_driver via_driver = { 197static const struct agp_bridge_driver via_driver = {
198 .owner = THIS_MODULE, 198 .owner = THIS_MODULE,
199 .aperture_sizes = via_generic_sizes, 199 .aperture_sizes = via_generic_sizes,
200 .size_type = U8_APER_SIZE, 200 .size_type = U8_APER_SIZE,
diff --git a/drivers/char/briq_panel.c b/drivers/char/briq_panel.c
index 8dcf9d20f449..c70d52ace8b2 100644
--- a/drivers/char/briq_panel.c
+++ b/drivers/char/briq_panel.c
@@ -202,13 +202,16 @@ static struct miscdevice briq_panel_miscdev = {
202 202
203static int __init briq_panel_init(void) 203static int __init briq_panel_init(void)
204{ 204{
205 struct device_node *root = find_path_device("/"); 205 struct device_node *root = of_find_node_by_path("/");
206 const char *machine; 206 const char *machine;
207 int i; 207 int i;
208 208
209 machine = get_property(root, "model", NULL); 209 machine = get_property(root, "model", NULL);
210 if (!machine || strncmp(machine, "TotalImpact,BRIQ-1", 18) != 0) 210 if (!machine || strncmp(machine, "TotalImpact,BRIQ-1", 18) != 0) {
211 of_node_put(root);
211 return -ENODEV; 212 return -ENODEV;
213 }
214 of_node_put(root);
212 215
213 printk(KERN_INFO 216 printk(KERN_INFO
214 "briq_panel: v%s Dr. Karsten Jeppesen (kj@totalimpact.com)\n", 217 "briq_panel: v%s Dr. Karsten Jeppesen (kj@totalimpact.com)\n",
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 54df35527bc5..16dc5d1d3cb4 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -3501,6 +3501,7 @@ get_serial_info(struct cyclades_port *info,
3501 tmp.irq = cinfo->irq; 3501 tmp.irq = cinfo->irq;
3502 tmp.flags = info->flags; 3502 tmp.flags = info->flags;
3503 tmp.close_delay = info->close_delay; 3503 tmp.close_delay = info->close_delay;
3504 tmp.closing_wait = info->closing_wait;
3504 tmp.baud_base = info->baud; 3505 tmp.baud_base = info->baud;
3505 tmp.custom_divisor = info->custom_divisor; 3506 tmp.custom_divisor = info->custom_divisor;
3506 tmp.hub6 = 0; /*!!! */ 3507 tmp.hub6 = 0; /*!!! */
diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile
index 3ad0f648c6b2..6915a0599dfb 100644
--- a/drivers/char/drm/Makefile
+++ b/drivers/char/drm/Makefile
@@ -15,7 +15,6 @@ i810-objs := i810_drv.o i810_dma.o
15i830-objs := i830_drv.o i830_dma.o i830_irq.o 15i830-objs := i830_drv.o i830_dma.o i830_irq.o
16i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o 16i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o
17radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o 17radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
18ffb-objs := ffb_drv.o ffb_context.o
19sis-objs := sis_drv.o sis_mm.o 18sis-objs := sis_drv.o sis_mm.o
20savage-objs := savage_drv.o savage_bci.o savage_state.o 19savage-objs := savage_drv.o savage_bci.o savage_state.o
21via-objs := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o 20via-objs := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o
@@ -36,7 +35,6 @@ obj-$(CONFIG_DRM_MGA) += mga.o
36obj-$(CONFIG_DRM_I810) += i810.o 35obj-$(CONFIG_DRM_I810) += i810.o
37obj-$(CONFIG_DRM_I830) += i830.o 36obj-$(CONFIG_DRM_I830) += i830.o
38obj-$(CONFIG_DRM_I915) += i915.o 37obj-$(CONFIG_DRM_I915) += i915.o
39obj-$(CONFIG_DRM_FFB) += ffb.o
40obj-$(CONFIG_DRM_SIS) += sis.o 38obj-$(CONFIG_DRM_SIS) += sis.o
41obj-$(CONFIG_DRM_SAVAGE)+= savage.o 39obj-$(CONFIG_DRM_SAVAGE)+= savage.o
42obj-$(CONFIG_DRM_VIA) +=via.o 40obj-$(CONFIG_DRM_VIA) +=via.o
diff --git a/drivers/char/drm/ffb_context.c b/drivers/char/drm/ffb_context.c
deleted file mode 100644
index ac9ab40d57aa..000000000000
--- a/drivers/char/drm/ffb_context.c
+++ /dev/null
@@ -1,544 +0,0 @@
1/* $Id: ffb_context.c,v 1.5 2001/08/09 17:47:51 davem Exp $
2 * ffb_context.c: Creator/Creator3D DRI/DRM context switching.
3 *
4 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
5 *
6 * Almost entirely stolen from tdfx_context.c, see there
7 * for authors.
8 */
9
10#include <asm/upa.h>
11
12#include "ffb.h"
13#include "drmP.h"
14
15#include "ffb_drv.h"
16
17static int DRM(alloc_queue) (drm_device_t * dev, int is_2d_only) {
18 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
19 int i;
20
21 for (i = 0; i < FFB_MAX_CTXS; i++) {
22 if (fpriv->hw_state[i] == NULL)
23 break;
24 }
25 if (i == FFB_MAX_CTXS)
26 return -1;
27
28 fpriv->hw_state[i] = kmalloc(sizeof(struct ffb_hw_context), GFP_KERNEL);
29 if (fpriv->hw_state[i] == NULL)
30 return -1;
31
32 fpriv->hw_state[i]->is_2d_only = is_2d_only;
33
34 /* Plus one because 0 is the special DRM_KERNEL_CONTEXT. */
35 return i + 1;
36}
37
38static void ffb_save_context(ffb_dev_priv_t * fpriv, int idx)
39{
40 ffb_fbcPtr ffb = fpriv->regs;
41 struct ffb_hw_context *ctx;
42 int i;
43
44 ctx = fpriv->hw_state[idx - 1];
45 if (idx == 0 || ctx == NULL)
46 return;
47
48 if (ctx->is_2d_only) {
49 /* 2D applications only care about certain pieces
50 * of state.
51 */
52 ctx->drawop = upa_readl(&ffb->drawop);
53 ctx->ppc = upa_readl(&ffb->ppc);
54 ctx->wid = upa_readl(&ffb->wid);
55 ctx->fg = upa_readl(&ffb->fg);
56 ctx->bg = upa_readl(&ffb->bg);
57 ctx->xclip = upa_readl(&ffb->xclip);
58 ctx->fbc = upa_readl(&ffb->fbc);
59 ctx->rop = upa_readl(&ffb->rop);
60 ctx->cmp = upa_readl(&ffb->cmp);
61 ctx->matchab = upa_readl(&ffb->matchab);
62 ctx->magnab = upa_readl(&ffb->magnab);
63 ctx->pmask = upa_readl(&ffb->pmask);
64 ctx->xpmask = upa_readl(&ffb->xpmask);
65 ctx->lpat = upa_readl(&ffb->lpat);
66 ctx->fontxy = upa_readl(&ffb->fontxy);
67 ctx->fontw = upa_readl(&ffb->fontw);
68 ctx->fontinc = upa_readl(&ffb->fontinc);
69
70 /* stencil/stencilctl only exists on FFB2+ and later
71 * due to the introduction of 3DRAM-III.
72 */
73 if (fpriv->ffb_type == ffb2_vertical_plus ||
74 fpriv->ffb_type == ffb2_horizontal_plus) {
75 ctx->stencil = upa_readl(&ffb->stencil);
76 ctx->stencilctl = upa_readl(&ffb->stencilctl);
77 }
78
79 for (i = 0; i < 32; i++)
80 ctx->area_pattern[i] = upa_readl(&ffb->pattern[i]);
81 ctx->ucsr = upa_readl(&ffb->ucsr);
82 return;
83 }
84
85 /* Fetch drawop. */
86 ctx->drawop = upa_readl(&ffb->drawop);
87
88 /* If we were saving the vertex registers, this is where
89 * we would do it. We would save 32 32-bit words starting
90 * at ffb->suvtx.
91 */
92
93 /* Capture rendering attributes. */
94
95 ctx->ppc = upa_readl(&ffb->ppc); /* Pixel Processor Control */
96 ctx->wid = upa_readl(&ffb->wid); /* Current WID */
97 ctx->fg = upa_readl(&ffb->fg); /* Constant FG color */
98 ctx->bg = upa_readl(&ffb->bg); /* Constant BG color */
99 ctx->consty = upa_readl(&ffb->consty); /* Constant Y */
100 ctx->constz = upa_readl(&ffb->constz); /* Constant Z */
101 ctx->xclip = upa_readl(&ffb->xclip); /* X plane clip */
102 ctx->dcss = upa_readl(&ffb->dcss); /* Depth Cue Scale Slope */
103 ctx->vclipmin = upa_readl(&ffb->vclipmin); /* Primary XY clip, minimum */
104 ctx->vclipmax = upa_readl(&ffb->vclipmax); /* Primary XY clip, maximum */
105 ctx->vclipzmin = upa_readl(&ffb->vclipzmin); /* Primary Z clip, minimum */
106 ctx->vclipzmax = upa_readl(&ffb->vclipzmax); /* Primary Z clip, maximum */
107 ctx->dcsf = upa_readl(&ffb->dcsf); /* Depth Cue Scale Front Bound */
108 ctx->dcsb = upa_readl(&ffb->dcsb); /* Depth Cue Scale Back Bound */
109 ctx->dczf = upa_readl(&ffb->dczf); /* Depth Cue Scale Z Front */
110 ctx->dczb = upa_readl(&ffb->dczb); /* Depth Cue Scale Z Back */
111 ctx->blendc = upa_readl(&ffb->blendc); /* Alpha Blend Control */
112 ctx->blendc1 = upa_readl(&ffb->blendc1); /* Alpha Blend Color 1 */
113 ctx->blendc2 = upa_readl(&ffb->blendc2); /* Alpha Blend Color 2 */
114 ctx->fbc = upa_readl(&ffb->fbc); /* Frame Buffer Control */
115 ctx->rop = upa_readl(&ffb->rop); /* Raster Operation */
116 ctx->cmp = upa_readl(&ffb->cmp); /* Compare Controls */
117 ctx->matchab = upa_readl(&ffb->matchab); /* Buffer A/B Match Ops */
118 ctx->matchc = upa_readl(&ffb->matchc); /* Buffer C Match Ops */
119 ctx->magnab = upa_readl(&ffb->magnab); /* Buffer A/B Magnitude Ops */
120 ctx->magnc = upa_readl(&ffb->magnc); /* Buffer C Magnitude Ops */
121 ctx->pmask = upa_readl(&ffb->pmask); /* RGB Plane Mask */
122 ctx->xpmask = upa_readl(&ffb->xpmask); /* X Plane Mask */
123 ctx->ypmask = upa_readl(&ffb->ypmask); /* Y Plane Mask */
124 ctx->zpmask = upa_readl(&ffb->zpmask); /* Z Plane Mask */
125
126 /* Auxiliary Clips. */
127 ctx->auxclip0min = upa_readl(&ffb->auxclip[0].min);
128 ctx->auxclip0max = upa_readl(&ffb->auxclip[0].max);
129 ctx->auxclip1min = upa_readl(&ffb->auxclip[1].min);
130 ctx->auxclip1max = upa_readl(&ffb->auxclip[1].max);
131 ctx->auxclip2min = upa_readl(&ffb->auxclip[2].min);
132 ctx->auxclip2max = upa_readl(&ffb->auxclip[2].max);
133 ctx->auxclip3min = upa_readl(&ffb->auxclip[3].min);
134 ctx->auxclip3max = upa_readl(&ffb->auxclip[3].max);
135
136 ctx->lpat = upa_readl(&ffb->lpat); /* Line Pattern */
137 ctx->fontxy = upa_readl(&ffb->fontxy); /* XY Font Coordinate */
138 ctx->fontw = upa_readl(&ffb->fontw); /* Font Width */
139 ctx->fontinc = upa_readl(&ffb->fontinc); /* Font X/Y Increment */
140
141 /* These registers/features only exist on FFB2 and later chips. */
142 if (fpriv->ffb_type >= ffb2_prototype) {
143 ctx->dcss1 = upa_readl(&ffb->dcss1); /* Depth Cue Scale Slope 1 */
144 ctx->dcss2 = upa_readl(&ffb->dcss2); /* Depth Cue Scale Slope 2 */
145 ctx->dcss2 = upa_readl(&ffb->dcss3); /* Depth Cue Scale Slope 3 */
146 ctx->dcs2 = upa_readl(&ffb->dcs2); /* Depth Cue Scale 2 */
147 ctx->dcs3 = upa_readl(&ffb->dcs3); /* Depth Cue Scale 3 */
148 ctx->dcs4 = upa_readl(&ffb->dcs4); /* Depth Cue Scale 4 */
149 ctx->dcd2 = upa_readl(&ffb->dcd2); /* Depth Cue Depth 2 */
150 ctx->dcd3 = upa_readl(&ffb->dcd3); /* Depth Cue Depth 3 */
151 ctx->dcd4 = upa_readl(&ffb->dcd4); /* Depth Cue Depth 4 */
152
153 /* And stencil/stencilctl only exists on FFB2+ and later
154 * due to the introduction of 3DRAM-III.
155 */
156 if (fpriv->ffb_type == ffb2_vertical_plus ||
157 fpriv->ffb_type == ffb2_horizontal_plus) {
158 ctx->stencil = upa_readl(&ffb->stencil);
159 ctx->stencilctl = upa_readl(&ffb->stencilctl);
160 }
161 }
162
163 /* Save the 32x32 area pattern. */
164 for (i = 0; i < 32; i++)
165 ctx->area_pattern[i] = upa_readl(&ffb->pattern[i]);
166
167 /* Finally, stash away the User Constol/Status Register. */
168 ctx->ucsr = upa_readl(&ffb->ucsr);
169}
170
171static void ffb_restore_context(ffb_dev_priv_t * fpriv, int old, int idx)
172{
173 ffb_fbcPtr ffb = fpriv->regs;
174 struct ffb_hw_context *ctx;
175 int i;
176
177 ctx = fpriv->hw_state[idx - 1];
178 if (idx == 0 || ctx == NULL)
179 return;
180
181 if (ctx->is_2d_only) {
182 /* 2D applications only care about certain pieces
183 * of state.
184 */
185 upa_writel(ctx->drawop, &ffb->drawop);
186
187 /* If we were restoring the vertex registers, this is where
188 * we would do it. We would restore 32 32-bit words starting
189 * at ffb->suvtx.
190 */
191
192 upa_writel(ctx->ppc, &ffb->ppc);
193 upa_writel(ctx->wid, &ffb->wid);
194 upa_writel(ctx->fg, &ffb->fg);
195 upa_writel(ctx->bg, &ffb->bg);
196 upa_writel(ctx->xclip, &ffb->xclip);
197 upa_writel(ctx->fbc, &ffb->fbc);
198 upa_writel(ctx->rop, &ffb->rop);
199 upa_writel(ctx->cmp, &ffb->cmp);
200 upa_writel(ctx->matchab, &ffb->matchab);
201 upa_writel(ctx->magnab, &ffb->magnab);
202 upa_writel(ctx->pmask, &ffb->pmask);
203 upa_writel(ctx->xpmask, &ffb->xpmask);
204 upa_writel(ctx->lpat, &ffb->lpat);
205 upa_writel(ctx->fontxy, &ffb->fontxy);
206 upa_writel(ctx->fontw, &ffb->fontw);
207 upa_writel(ctx->fontinc, &ffb->fontinc);
208
209 /* stencil/stencilctl only exists on FFB2+ and later
210 * due to the introduction of 3DRAM-III.
211 */
212 if (fpriv->ffb_type == ffb2_vertical_plus ||
213 fpriv->ffb_type == ffb2_horizontal_plus) {
214 upa_writel(ctx->stencil, &ffb->stencil);
215 upa_writel(ctx->stencilctl, &ffb->stencilctl);
216 upa_writel(0x80000000, &ffb->fbc);
217 upa_writel((ctx->stencilctl | 0x80000),
218 &ffb->rawstencilctl);
219 upa_writel(ctx->fbc, &ffb->fbc);
220 }
221
222 for (i = 0; i < 32; i++)
223 upa_writel(ctx->area_pattern[i], &ffb->pattern[i]);
224 upa_writel((ctx->ucsr & 0xf0000), &ffb->ucsr);
225 return;
226 }
227
228 /* Restore drawop. */
229 upa_writel(ctx->drawop, &ffb->drawop);
230
231 /* If we were restoring the vertex registers, this is where
232 * we would do it. We would restore 32 32-bit words starting
233 * at ffb->suvtx.
234 */
235
236 /* Restore rendering attributes. */
237
238 upa_writel(ctx->ppc, &ffb->ppc); /* Pixel Processor Control */
239 upa_writel(ctx->wid, &ffb->wid); /* Current WID */
240 upa_writel(ctx->fg, &ffb->fg); /* Constant FG color */
241 upa_writel(ctx->bg, &ffb->bg); /* Constant BG color */
242 upa_writel(ctx->consty, &ffb->consty); /* Constant Y */
243 upa_writel(ctx->constz, &ffb->constz); /* Constant Z */
244 upa_writel(ctx->xclip, &ffb->xclip); /* X plane clip */
245 upa_writel(ctx->dcss, &ffb->dcss); /* Depth Cue Scale Slope */
246 upa_writel(ctx->vclipmin, &ffb->vclipmin); /* Primary XY clip, minimum */
247 upa_writel(ctx->vclipmax, &ffb->vclipmax); /* Primary XY clip, maximum */
248 upa_writel(ctx->vclipzmin, &ffb->vclipzmin); /* Primary Z clip, minimum */
249 upa_writel(ctx->vclipzmax, &ffb->vclipzmax); /* Primary Z clip, maximum */
250 upa_writel(ctx->dcsf, &ffb->dcsf); /* Depth Cue Scale Front Bound */
251 upa_writel(ctx->dcsb, &ffb->dcsb); /* Depth Cue Scale Back Bound */
252 upa_writel(ctx->dczf, &ffb->dczf); /* Depth Cue Scale Z Front */
253 upa_writel(ctx->dczb, &ffb->dczb); /* Depth Cue Scale Z Back */
254 upa_writel(ctx->blendc, &ffb->blendc); /* Alpha Blend Control */
255 upa_writel(ctx->blendc1, &ffb->blendc1); /* Alpha Blend Color 1 */
256 upa_writel(ctx->blendc2, &ffb->blendc2); /* Alpha Blend Color 2 */
257 upa_writel(ctx->fbc, &ffb->fbc); /* Frame Buffer Control */
258 upa_writel(ctx->rop, &ffb->rop); /* Raster Operation */
259 upa_writel(ctx->cmp, &ffb->cmp); /* Compare Controls */
260 upa_writel(ctx->matchab, &ffb->matchab); /* Buffer A/B Match Ops */
261 upa_writel(ctx->matchc, &ffb->matchc); /* Buffer C Match Ops */
262 upa_writel(ctx->magnab, &ffb->magnab); /* Buffer A/B Magnitude Ops */
263 upa_writel(ctx->magnc, &ffb->magnc); /* Buffer C Magnitude Ops */
264 upa_writel(ctx->pmask, &ffb->pmask); /* RGB Plane Mask */
265 upa_writel(ctx->xpmask, &ffb->xpmask); /* X Plane Mask */
266 upa_writel(ctx->ypmask, &ffb->ypmask); /* Y Plane Mask */
267 upa_writel(ctx->zpmask, &ffb->zpmask); /* Z Plane Mask */
268
269 /* Auxiliary Clips. */
270 upa_writel(ctx->auxclip0min, &ffb->auxclip[0].min);
271 upa_writel(ctx->auxclip0max, &ffb->auxclip[0].max);
272 upa_writel(ctx->auxclip1min, &ffb->auxclip[1].min);
273 upa_writel(ctx->auxclip1max, &ffb->auxclip[1].max);
274 upa_writel(ctx->auxclip2min, &ffb->auxclip[2].min);
275 upa_writel(ctx->auxclip2max, &ffb->auxclip[2].max);
276 upa_writel(ctx->auxclip3min, &ffb->auxclip[3].min);
277 upa_writel(ctx->auxclip3max, &ffb->auxclip[3].max);
278
279 upa_writel(ctx->lpat, &ffb->lpat); /* Line Pattern */
280 upa_writel(ctx->fontxy, &ffb->fontxy); /* XY Font Coordinate */
281 upa_writel(ctx->fontw, &ffb->fontw); /* Font Width */
282 upa_writel(ctx->fontinc, &ffb->fontinc); /* Font X/Y Increment */
283
284 /* These registers/features only exist on FFB2 and later chips. */
285 if (fpriv->ffb_type >= ffb2_prototype) {
286 upa_writel(ctx->dcss1, &ffb->dcss1); /* Depth Cue Scale Slope 1 */
287 upa_writel(ctx->dcss2, &ffb->dcss2); /* Depth Cue Scale Slope 2 */
288 upa_writel(ctx->dcss3, &ffb->dcss2); /* Depth Cue Scale Slope 3 */
289 upa_writel(ctx->dcs2, &ffb->dcs2); /* Depth Cue Scale 2 */
290 upa_writel(ctx->dcs3, &ffb->dcs3); /* Depth Cue Scale 3 */
291 upa_writel(ctx->dcs4, &ffb->dcs4); /* Depth Cue Scale 4 */
292 upa_writel(ctx->dcd2, &ffb->dcd2); /* Depth Cue Depth 2 */
293 upa_writel(ctx->dcd3, &ffb->dcd3); /* Depth Cue Depth 3 */
294 upa_writel(ctx->dcd4, &ffb->dcd4); /* Depth Cue Depth 4 */
295
296 /* And stencil/stencilctl only exists on FFB2+ and later
297 * due to the introduction of 3DRAM-III.
298 */
299 if (fpriv->ffb_type == ffb2_vertical_plus ||
300 fpriv->ffb_type == ffb2_horizontal_plus) {
301 /* Unfortunately, there is a hardware bug on
302 * the FFB2+ chips which prevents a normal write
303 * to the stencil control register from working
304 * as it should.
305 *
306 * The state controlled by the FFB stencilctl register
307 * really gets transferred to the per-buffer instances
308 * of the stencilctl register in the 3DRAM chips.
309 *
310 * The bug is that FFB does not update buffer C correctly,
311 * so we have to do it by hand for them.
312 */
313
314 /* This will update buffers A and B. */
315 upa_writel(ctx->stencil, &ffb->stencil);
316 upa_writel(ctx->stencilctl, &ffb->stencilctl);
317
318 /* Force FFB to use buffer C 3dram regs. */
319 upa_writel(0x80000000, &ffb->fbc);
320 upa_writel((ctx->stencilctl | 0x80000),
321 &ffb->rawstencilctl);
322
323 /* Now restore the correct FBC controls. */
324 upa_writel(ctx->fbc, &ffb->fbc);
325 }
326 }
327
328 /* Restore the 32x32 area pattern. */
329 for (i = 0; i < 32; i++)
330 upa_writel(ctx->area_pattern[i], &ffb->pattern[i]);
331
332 /* Finally, stash away the User Constol/Status Register.
333 * The only state we really preserve here is the picking
334 * control.
335 */
336 upa_writel((ctx->ucsr & 0xf0000), &ffb->ucsr);
337}
338
339#define FFB_UCSR_FB_BUSY 0x01000000
340#define FFB_UCSR_RP_BUSY 0x02000000
341#define FFB_UCSR_ALL_BUSY (FFB_UCSR_RP_BUSY|FFB_UCSR_FB_BUSY)
342
343static void FFBWait(ffb_fbcPtr ffb)
344{
345 int limit = 100000;
346
347 do {
348 u32 regval = upa_readl(&ffb->ucsr);
349
350 if ((regval & FFB_UCSR_ALL_BUSY) == 0)
351 break;
352 } while (--limit);
353}
354
355int ffb_driver_context_switch(drm_device_t * dev, int old, int new)
356{
357 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
358
359#ifdef DRM_DMA_HISTOGRAM
360 dev->ctx_start = get_cycles();
361#endif
362
363 DRM_DEBUG("Context switch from %d to %d\n", old, new);
364
365 if (new == dev->last_context || dev->last_context == 0) {
366 dev->last_context = new;
367 return 0;
368 }
369
370 FFBWait(fpriv->regs);
371 ffb_save_context(fpriv, old);
372 ffb_restore_context(fpriv, old, new);
373 FFBWait(fpriv->regs);
374
375 dev->last_context = new;
376
377 return 0;
378}
379
380int ffb_driver_resctx(struct inode *inode, struct file *filp, unsigned int cmd,
381 unsigned long arg)
382{
383 drm_ctx_res_t res;
384 drm_ctx_t ctx;
385 int i;
386
387 DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS);
388 if (copy_from_user(&res, (drm_ctx_res_t __user *) arg, sizeof(res)))
389 return -EFAULT;
390 if (res.count >= DRM_RESERVED_CONTEXTS) {
391 memset(&ctx, 0, sizeof(ctx));
392 for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
393 ctx.handle = i;
394 if (copy_to_user(&res.contexts[i], &i, sizeof(i)))
395 return -EFAULT;
396 }
397 }
398 res.count = DRM_RESERVED_CONTEXTS;
399 if (copy_to_user((drm_ctx_res_t __user *) arg, &res, sizeof(res)))
400 return -EFAULT;
401 return 0;
402}
403
404int ffb_driver_addctx(struct inode *inode, struct file *filp, unsigned int cmd,
405 unsigned long arg)
406{
407 drm_file_t *priv = filp->private_data;
408 drm_device_t *dev = priv->dev;
409 drm_ctx_t ctx;
410 int idx;
411
412 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
413 return -EFAULT;
414 idx = DRM(alloc_queue) (dev, (ctx.flags & _DRM_CONTEXT_2DONLY));
415 if (idx < 0)
416 return -ENFILE;
417
418 DRM_DEBUG("%d\n", ctx.handle);
419 ctx.handle = idx;
420 if (copy_to_user((drm_ctx_t __user *) arg, &ctx, sizeof(ctx)))
421 return -EFAULT;
422 return 0;
423}
424
425int ffb_driver_modctx(struct inode *inode, struct file *filp, unsigned int cmd,
426 unsigned long arg)
427{
428 drm_file_t *priv = filp->private_data;
429 drm_device_t *dev = priv->dev;
430 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
431 struct ffb_hw_context *hwctx;
432 drm_ctx_t ctx;
433 int idx;
434
435 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
436 return -EFAULT;
437
438 idx = ctx.handle;
439 if (idx <= 0 || idx >= FFB_MAX_CTXS)
440 return -EINVAL;
441
442 hwctx = fpriv->hw_state[idx - 1];
443 if (hwctx == NULL)
444 return -EINVAL;
445
446 if ((ctx.flags & _DRM_CONTEXT_2DONLY) == 0)
447 hwctx->is_2d_only = 0;
448 else
449 hwctx->is_2d_only = 1;
450
451 return 0;
452}
453
454int ffb_driver_getctx(struct inode *inode, struct file *filp, unsigned int cmd,
455 unsigned long arg)
456{
457 drm_file_t *priv = filp->private_data;
458 drm_device_t *dev = priv->dev;
459 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
460 struct ffb_hw_context *hwctx;
461 drm_ctx_t ctx;
462 int idx;
463
464 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
465 return -EFAULT;
466
467 idx = ctx.handle;
468 if (idx <= 0 || idx >= FFB_MAX_CTXS)
469 return -EINVAL;
470
471 hwctx = fpriv->hw_state[idx - 1];
472 if (hwctx == NULL)
473 return -EINVAL;
474
475 if (hwctx->is_2d_only != 0)
476 ctx.flags = _DRM_CONTEXT_2DONLY;
477 else
478 ctx.flags = 0;
479
480 if (copy_to_user((drm_ctx_t __user *) arg, &ctx, sizeof(ctx)))
481 return -EFAULT;
482
483 return 0;
484}
485
486int ffb_driver_switchctx(struct inode *inode, struct file *filp,
487 unsigned int cmd, unsigned long arg)
488{
489 drm_file_t *priv = filp->private_data;
490 drm_device_t *dev = priv->dev;
491 drm_ctx_t ctx;
492
493 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
494 return -EFAULT;
495 DRM_DEBUG("%d\n", ctx.handle);
496 return ffb_driver_context_switch(dev, dev->last_context, ctx.handle);
497}
498
499int ffb_driver_newctx(struct inode *inode, struct file *filp, unsigned int cmd,
500 unsigned long arg)
501{
502 drm_ctx_t ctx;
503
504 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
505 return -EFAULT;
506 DRM_DEBUG("%d\n", ctx.handle);
507
508 return 0;
509}
510
511int ffb_driver_rmctx(struct inode *inode, struct file *filp, unsigned int cmd,
512 unsigned long arg)
513{
514 drm_ctx_t ctx;
515 drm_file_t *priv = filp->private_data;
516 drm_device_t *dev = priv->dev;
517 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
518 int idx;
519
520 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
521 return -EFAULT;
522 DRM_DEBUG("%d\n", ctx.handle);
523
524 idx = ctx.handle - 1;
525 if (idx < 0 || idx >= FFB_MAX_CTXS)
526 return -EINVAL;
527
528 kfree(fpriv->hw_state[idx]);
529 fpriv->hw_state[idx] = NULL;
530 return 0;
531}
532
533void ffb_set_context_ioctls(void)
534{
535 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)].func = ffb_driver_addctx;
536 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)].func = ffb_driver_rmctx;
537 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)].func = ffb_driver_modctx;
538 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)].func = ffb_driver_getctx;
539 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)].func =
540 ffb_driver_switchctx;
541 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)].func = ffb_driver_newctx;
542 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)].func = ffb_driver_resctx;
543
544}
diff --git a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c
deleted file mode 100644
index 9a19879e3b68..000000000000
--- a/drivers/char/drm/ffb_drv.c
+++ /dev/null
@@ -1,355 +0,0 @@
1/* $Id: ffb_drv.c,v 1.16 2001/10/18 16:00:24 davem Exp $
2 * ffb_drv.c: Creator/Creator3D direct rendering driver.
3 *
4 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
5 */
6
7#include "ffb.h"
8#include "drmP.h"
9
10#include "ffb_drv.h"
11
12#include <linux/smp_lock.h>
13#include <asm/shmparam.h>
14#include <asm/oplib.h>
15#include <asm/upa.h>
16
17#define DRIVER_AUTHOR "David S. Miller"
18
19#define DRIVER_NAME "ffb"
20#define DRIVER_DESC "Creator/Creator3D"
21#define DRIVER_DATE "20000517"
22
23#define DRIVER_MAJOR 0
24#define DRIVER_MINOR 0
25#define DRIVER_PATCHLEVEL 1
26
27typedef struct _ffb_position_t {
28 int node;
29 int root;
30} ffb_position_t;
31
32static ffb_position_t *ffb_position;
33
34static void get_ffb_type(ffb_dev_priv_t * ffb_priv, int instance)
35{
36 volatile unsigned char *strap_bits;
37 unsigned char val;
38
39 strap_bits = (volatile unsigned char *)
40 (ffb_priv->card_phys_base + 0x00200000UL);
41
42 /* Don't ask, you have to read the value twice for whatever
43 * reason to get correct contents.
44 */
45 val = upa_readb(strap_bits);
46 val = upa_readb(strap_bits);
47 switch (val & 0x78) {
48 case (0x0 << 5) | (0x0 << 3):
49 ffb_priv->ffb_type = ffb1_prototype;
50 printk("ffb%d: Detected FFB1 pre-FCS prototype\n", instance);
51 break;
52 case (0x0 << 5) | (0x1 << 3):
53 ffb_priv->ffb_type = ffb1_standard;
54 printk("ffb%d: Detected FFB1\n", instance);
55 break;
56 case (0x0 << 5) | (0x3 << 3):
57 ffb_priv->ffb_type = ffb1_speedsort;
58 printk("ffb%d: Detected FFB1-SpeedSort\n", instance);
59 break;
60 case (0x1 << 5) | (0x0 << 3):
61 ffb_priv->ffb_type = ffb2_prototype;
62 printk("ffb%d: Detected FFB2/vertical pre-FCS prototype\n",
63 instance);
64 break;
65 case (0x1 << 5) | (0x1 << 3):
66 ffb_priv->ffb_type = ffb2_vertical;
67 printk("ffb%d: Detected FFB2/vertical\n", instance);
68 break;
69 case (0x1 << 5) | (0x2 << 3):
70 ffb_priv->ffb_type = ffb2_vertical_plus;
71 printk("ffb%d: Detected FFB2+/vertical\n", instance);
72 break;
73 case (0x2 << 5) | (0x0 << 3):
74 ffb_priv->ffb_type = ffb2_horizontal;
75 printk("ffb%d: Detected FFB2/horizontal\n", instance);
76 break;
77 case (0x2 << 5) | (0x2 << 3):
78 ffb_priv->ffb_type = ffb2_horizontal;
79 printk("ffb%d: Detected FFB2+/horizontal\n", instance);
80 break;
81 default:
82 ffb_priv->ffb_type = ffb2_vertical;
83 printk("ffb%d: Unknown boardID[%08x], assuming FFB2\n",
84 instance, val);
85 break;
86 };
87}
88
89static void ffb_apply_upa_parent_ranges(int parent,
90 struct linux_prom64_registers *regs)
91{
92 struct linux_prom64_ranges ranges[PROMREG_MAX];
93 char name[128];
94 int len, i;
95
96 prom_getproperty(parent, "name", name, sizeof(name));
97 if (strcmp(name, "upa") != 0)
98 return;
99
100 len =
101 prom_getproperty(parent, "ranges", (void *)ranges, sizeof(ranges));
102 if (len <= 0)
103 return;
104
105 len /= sizeof(struct linux_prom64_ranges);
106 for (i = 0; i < len; i++) {
107 struct linux_prom64_ranges *rng = &ranges[i];
108 u64 phys_addr = regs->phys_addr;
109
110 if (phys_addr >= rng->ot_child_base &&
111 phys_addr < (rng->ot_child_base + rng->or_size)) {
112 regs->phys_addr -= rng->ot_child_base;
113 regs->phys_addr += rng->ot_parent_base;
114 return;
115 }
116 }
117
118 return;
119}
120
121static int ffb_init_one(drm_device_t * dev, int prom_node, int parent_node,
122 int instance)
123{
124 struct linux_prom64_registers regs[2 * PROMREG_MAX];
125 ffb_dev_priv_t *ffb_priv = (ffb_dev_priv_t *) dev->dev_private;
126 int i;
127
128 ffb_priv->prom_node = prom_node;
129 if (prom_getproperty(ffb_priv->prom_node, "reg",
130 (void *)regs, sizeof(regs)) <= 0) {
131 return -EINVAL;
132 }
133 ffb_apply_upa_parent_ranges(parent_node, &regs[0]);
134 ffb_priv->card_phys_base = regs[0].phys_addr;
135 ffb_priv->regs = (ffb_fbcPtr)
136 (regs[0].phys_addr + 0x00600000UL);
137 get_ffb_type(ffb_priv, instance);
138 for (i = 0; i < FFB_MAX_CTXS; i++)
139 ffb_priv->hw_state[i] = NULL;
140
141 return 0;
142}
143
144static drm_map_t *ffb_find_map(struct file *filp, unsigned long off)
145{
146 drm_file_t *priv = filp->private_data;
147 drm_device_t *dev;
148 drm_map_list_t *r_list;
149 struct list_head *list;
150 drm_map_t *map;
151
152 if (!priv || (dev = priv->dev) == NULL)
153 return NULL;
154
155 list_for_each(list, &dev->maplist->head) {
156 r_list = (drm_map_list_t *) list;
157 map = r_list->map;
158 if (!map)
159 continue;
160 if (r_list->user_token == off)
161 return map;
162 }
163
164 return NULL;
165}
166
167unsigned long ffb_get_unmapped_area(struct file *filp,
168 unsigned long hint,
169 unsigned long len,
170 unsigned long pgoff, unsigned long flags)
171{
172 drm_map_t *map = ffb_find_map(filp, pgoff << PAGE_SHIFT);
173 unsigned long addr = -ENOMEM;
174
175 if (!map)
176 return get_unmapped_area(NULL, hint, len, pgoff, flags);
177
178 if (map->type == _DRM_FRAME_BUFFER || map->type == _DRM_REGISTERS) {
179#ifdef HAVE_ARCH_FB_UNMAPPED_AREA
180 addr = get_fb_unmapped_area(filp, hint, len, pgoff, flags);
181#else
182 addr = get_unmapped_area(NULL, hint, len, pgoff, flags);
183#endif
184 } else if (map->type == _DRM_SHM && SHMLBA > PAGE_SIZE) {
185 unsigned long slack = SHMLBA - PAGE_SIZE;
186
187 addr = get_unmapped_area(NULL, hint, len + slack, pgoff, flags);
188 if (!(addr & ~PAGE_MASK)) {
189 unsigned long kvirt = (unsigned long)map->handle;
190
191 if ((kvirt & (SHMLBA - 1)) != (addr & (SHMLBA - 1))) {
192 unsigned long koff, aoff;
193
194 koff = kvirt & (SHMLBA - 1);
195 aoff = addr & (SHMLBA - 1);
196 if (koff < aoff)
197 koff += SHMLBA;
198
199 addr += (koff - aoff);
200 }
201 }
202 } else {
203 addr = get_unmapped_area(NULL, hint, len, pgoff, flags);
204 }
205
206 return addr;
207}
208
209static int ffb_presetup(drm_device_t * dev)
210{
211 ffb_dev_priv_t *ffb_priv;
212 int ret = 0;
213 int i = 0;
214
215 /* Check for the case where no device was found. */
216 if (ffb_position == NULL)
217 return -ENODEV;
218
219 /* code used to use numdevs no numdevs anymore */
220 ffb_priv = kmalloc(sizeof(ffb_dev_priv_t), GFP_KERNEL);
221 if (!ffb_priv)
222 return -ENOMEM;
223 memset(ffb_priv, 0, sizeof(*ffb_priv));
224 dev->dev_private = ffb_priv;
225
226 ret = ffb_init_one(dev, ffb_position[i].node, ffb_position[i].root, i);
227 return ret;
228}
229
230static void ffb_driver_release(drm_device_t * dev, struct file *filp)
231{
232 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
233 int context = _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock);
234 int idx;
235
236 idx = context - 1;
237 if (fpriv &&
238 context != DRM_KERNEL_CONTEXT && fpriv->hw_state[idx] != NULL) {
239 kfree(fpriv->hw_state[idx]);
240 fpriv->hw_state[idx] = NULL;
241 }
242}
243
244static void ffb_driver_pretakedown(drm_device_t * dev)
245{
246 kfree(dev->dev_private);
247}
248
249static int ffb_driver_postcleanup(drm_device_t * dev)
250{
251 kfree(ffb_position);
252 return 0;
253}
254
255static void ffb_driver_kernel_context_switch_unlock(struct drm_device *dev,
256 drm_lock_t * lock)
257{
258 dev->lock.filp = 0;
259 {
260 __volatile__ unsigned int *plock = &dev->lock.hw_lock->lock;
261 unsigned int old, new, prev, ctx;
262
263 ctx = lock->context;
264 do {
265 old = *plock;
266 new = ctx;
267 prev = cmpxchg(plock, old, new);
268 } while (prev != old);
269 }
270 wake_up_interruptible(&dev->lock.lock_queue);
271}
272
273static unsigned long ffb_driver_get_map_ofs(drm_map_t * map)
274{
275 return (map->offset & 0xffffffff);
276}
277
278static unsigned long ffb_driver_get_reg_ofs(drm_device_t * dev)
279{
280 ffb_dev_priv_t *ffb_priv = (ffb_dev_priv_t *) dev->dev_private;
281
282 if (ffb_priv)
283 return ffb_priv->card_phys_base;
284
285 return 0;
286}
287
288static int postinit(struct drm_device *dev, unsigned long flags)
289{
290 DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
291 DRIVER_NAME,
292 DRIVER_MAJOR,
293 DRIVER_MINOR, DRIVER_PATCHLEVEL, DRIVER_DATE, dev->minor);
294 return 0;
295}
296
297static int version(drm_version_t * version)
298{
299 int len;
300
301 version->version_major = DRIVER_MAJOR;
302 version->version_minor = DRIVER_MINOR;
303 version->version_patchlevel = DRIVER_PATCHLEVEL;
304 DRM_COPY(version->name, DRIVER_NAME);
305 DRM_COPY(version->date, DRIVER_DATE);
306 DRM_COPY(version->desc, DRIVER_DESC);
307 return 0;
308}
309
310static drm_ioctl_desc_t ioctls[] = {
311
312};
313
314static struct drm_driver driver = {
315 .driver_features = 0,
316 .dev_priv_size = sizeof(u32),
317 .release = ffb_driver_release,
318 .presetup = ffb_presetup,
319 .pretakedown = ffb_driver_pretakedown,
320 .postcleanup = ffb_driver_postcleanup,
321 .kernel_context_switch = ffb_driver_context_switch,
322 .kernel_context_switch_unlock = ffb_driver_kernel_context_switch_unlock,
323 .get_map_ofs = ffb_driver_get_map_ofs,
324 .get_reg_ofs = ffb_driver_get_reg_ofs,
325 .postinit = postinit,
326 .version = version,
327 .ioctls = ioctls,
328 .num_ioctls = DRM_ARRAY_SIZE(ioctls),
329 .fops = {
330 .owner = THIS_MODULE,
331 .open = drm_open,
332 .release = drm_release,
333 .ioctl = drm_ioctl,
334 .mmap = drm_mmap,
335 .poll = drm_poll,
336 .fasync = drm_fasync,
337 }
338 ,
339};
340
341static int __init ffb_init(void)
342{
343 return -ENODEV;
344}
345
346static void __exit ffb_exit(void)
347{
348}
349
350module_init(ffb_init);
351module_exit(ffb_exit);
352
353MODULE_AUTHOR(DRIVER_AUTHOR);
354MODULE_DESCRIPTION(DRIVER_DESC);
355MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/char/drm/ffb_drv.h b/drivers/char/drm/ffb_drv.h
deleted file mode 100644
index 582afa6dd2b4..000000000000
--- a/drivers/char/drm/ffb_drv.h
+++ /dev/null
@@ -1,379 +0,0 @@
1/* $Id: ffb_drv.h,v 1.1 2000/06/01 04:24:39 davem Exp $
2 * ffb_drv.h: Creator/Creator3D direct rendering driver.
3 *
4 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
5 */
6
7/* Auxilliary clips. */
8typedef struct {
9 volatile unsigned int min;
10 volatile unsigned int max;
11} ffb_auxclip, *ffb_auxclipPtr;
12
13/* FFB register set. */
14typedef struct _ffb_fbc {
15 /* Next vertex registers, on the right we list which drawops
16 * use said register and the logical name the register has in
17 * that context.
18 *//* DESCRIPTION DRAWOP(NAME) */
19 /*0x00*/ unsigned int pad1[3];
20 /* Reserved */
21 /*0x0c*/ volatile unsigned int alpha;
22 /* ALPHA Transparency */
23 /*0x10*/ volatile unsigned int red;
24 /* RED */
25 /*0x14*/ volatile unsigned int green;
26 /* GREEN */
27 /*0x18*/ volatile unsigned int blue;
28 /* BLUE */
29 /*0x1c*/ volatile unsigned int z;
30 /* DEPTH */
31 /*0x20*/ volatile unsigned int y;
32 /* Y triangle(DOYF) */
33 /* aadot(DYF) */
34 /* ddline(DYF) */
35 /* aaline(DYF) */
36 /*0x24*/ volatile unsigned int x;
37 /* X triangle(DOXF) */
38 /* aadot(DXF) */
39 /* ddline(DXF) */
40 /* aaline(DXF) */
41 /*0x28*/ unsigned int pad2[2];
42 /* Reserved */
43 /*0x30*/ volatile unsigned int ryf;
44 /* Y (alias to DOYF) ddline(RYF) */
45 /* aaline(RYF) */
46 /* triangle(RYF) */
47 /*0x34*/ volatile unsigned int rxf;
48 /* X ddline(RXF) */
49 /* aaline(RXF) */
50 /* triangle(RXF) */
51 /*0x38*/ unsigned int pad3[2];
52 /* Reserved */
53 /*0x40*/ volatile unsigned int dmyf;
54 /* Y (alias to DOYF) triangle(DMYF) */
55 /*0x44*/ volatile unsigned int dmxf;
56 /* X triangle(DMXF) */
57 /*0x48*/ unsigned int pad4[2];
58 /* Reserved */
59 /*0x50*/ volatile unsigned int ebyi;
60 /* Y (alias to RYI) polygon(EBYI) */
61 /*0x54*/ volatile unsigned int ebxi;
62 /* X polygon(EBXI) */
63 /*0x58*/ unsigned int pad5[2];
64 /* Reserved */
65 /*0x60*/ volatile unsigned int by;
66 /* Y brline(RYI) */
67 /* fastfill(OP) */
68 /* polygon(YI) */
69 /* rectangle(YI) */
70 /* bcopy(SRCY) */
71 /* vscroll(SRCY) */
72 /*0x64*/ volatile unsigned int bx;
73 /* X brline(RXI) */
74 /* polygon(XI) */
75 /* rectangle(XI) */
76 /* bcopy(SRCX) */
77 /* vscroll(SRCX) */
78 /* fastfill(GO) */
79 /*0x68*/ volatile unsigned int dy;
80 /* destination Y fastfill(DSTY) */
81 /* bcopy(DSRY) */
82 /* vscroll(DSRY) */
83 /*0x6c*/ volatile unsigned int dx;
84 /* destination X fastfill(DSTX) */
85 /* bcopy(DSTX) */
86 /* vscroll(DSTX) */
87 /*0x70*/ volatile unsigned int bh;
88 /* Y (alias to RYI) brline(DYI) */
89 /* dot(DYI) */
90 /* polygon(ETYI) */
91 /* Height fastfill(H) */
92 /* bcopy(H) */
93 /* vscroll(H) */
94 /* Y count fastfill(NY) */
95 /*0x74*/ volatile unsigned int bw;
96 /* X dot(DXI) */
97 /* brline(DXI) */
98 /* polygon(ETXI) */
99 /* fastfill(W) */
100 /* bcopy(W) */
101 /* vscroll(W) */
102 /* fastfill(NX) */
103 /*0x78*/ unsigned int pad6[2];
104 /* Reserved */
105 /*0x80*/ unsigned int pad7[32];
106 /* Reserved */
107
108 /* Setup Unit's vertex state register */
109/*100*/ volatile unsigned int suvtx;
110 /*104*/ unsigned int pad8[63];
111 /* Reserved */
112
113 /* Frame Buffer Control Registers */
114 /*200*/ volatile unsigned int ppc;
115 /* Pixel Processor Control */
116 /*204*/ volatile unsigned int wid;
117 /* Current WID */
118 /*208*/ volatile unsigned int fg;
119 /* FG data */
120 /*20c*/ volatile unsigned int bg;
121 /* BG data */
122 /*210*/ volatile unsigned int consty;
123 /* Constant Y */
124 /*214*/ volatile unsigned int constz;
125 /* Constant Z */
126 /*218*/ volatile unsigned int xclip;
127 /* X Clip */
128 /*21c*/ volatile unsigned int dcss;
129 /* Depth Cue Scale Slope */
130 /*220*/ volatile unsigned int vclipmin;
131 /* Viewclip XY Min Bounds */
132 /*224*/ volatile unsigned int vclipmax;
133 /* Viewclip XY Max Bounds */
134 /*228*/ volatile unsigned int vclipzmin;
135 /* Viewclip Z Min Bounds */
136 /*22c*/ volatile unsigned int vclipzmax;
137 /* Viewclip Z Max Bounds */
138 /*230*/ volatile unsigned int dcsf;
139 /* Depth Cue Scale Front Bound */
140 /*234*/ volatile unsigned int dcsb;
141 /* Depth Cue Scale Back Bound */
142 /*238*/ volatile unsigned int dczf;
143 /* Depth Cue Z Front */
144 /*23c*/ volatile unsigned int dczb;
145 /* Depth Cue Z Back */
146 /*240*/ unsigned int pad9;
147 /* Reserved */
148 /*244*/ volatile unsigned int blendc;
149 /* Alpha Blend Control */
150 /*248*/ volatile unsigned int blendc1;
151 /* Alpha Blend Color 1 */
152 /*24c*/ volatile unsigned int blendc2;
153 /* Alpha Blend Color 2 */
154 /*250*/ volatile unsigned int fbramitc;
155 /* FB RAM Interleave Test Control */
156 /*254*/ volatile unsigned int fbc;
157 /* Frame Buffer Control */
158 /*258*/ volatile unsigned int rop;
159 /* Raster OPeration */
160 /*25c*/ volatile unsigned int cmp;
161 /* Frame Buffer Compare */
162 /*260*/ volatile unsigned int matchab;
163 /* Buffer AB Match Mask */
164 /*264*/ volatile unsigned int matchc;
165 /* Buffer C(YZ) Match Mask */
166 /*268*/ volatile unsigned int magnab;
167 /* Buffer AB Magnitude Mask */
168 /*26c*/ volatile unsigned int magnc;
169 /* Buffer C(YZ) Magnitude Mask */
170 /*270*/ volatile unsigned int fbcfg0;
171 /* Frame Buffer Config 0 */
172 /*274*/ volatile unsigned int fbcfg1;
173 /* Frame Buffer Config 1 */
174 /*278*/ volatile unsigned int fbcfg2;
175 /* Frame Buffer Config 2 */
176 /*27c*/ volatile unsigned int fbcfg3;
177 /* Frame Buffer Config 3 */
178 /*280*/ volatile unsigned int ppcfg;
179 /* Pixel Processor Config */
180 /*284*/ volatile unsigned int pick;
181 /* Picking Control */
182 /*288*/ volatile unsigned int fillmode;
183 /* FillMode */
184 /*28c*/ volatile unsigned int fbramwac;
185 /* FB RAM Write Address Control */
186 /*290*/ volatile unsigned int pmask;
187 /* RGB PlaneMask */
188 /*294*/ volatile unsigned int xpmask;
189 /* X PlaneMask */
190 /*298*/ volatile unsigned int ypmask;
191 /* Y PlaneMask */
192 /*29c*/ volatile unsigned int zpmask;
193 /* Z PlaneMask */
194 /*2a0*/ ffb_auxclip auxclip[4];
195 /* Auxilliary Viewport Clip */
196
197 /* New 3dRAM III support regs */
198/*2c0*/ volatile unsigned int rawblend2;
199/*2c4*/ volatile unsigned int rawpreblend;
200/*2c8*/ volatile unsigned int rawstencil;
201/*2cc*/ volatile unsigned int rawstencilctl;
202/*2d0*/ volatile unsigned int threedram1;
203/*2d4*/ volatile unsigned int threedram2;
204/*2d8*/ volatile unsigned int passin;
205/*2dc*/ volatile unsigned int rawclrdepth;
206/*2e0*/ volatile unsigned int rawpmask;
207/*2e4*/ volatile unsigned int rawcsrc;
208/*2e8*/ volatile unsigned int rawmatch;
209/*2ec*/ volatile unsigned int rawmagn;
210/*2f0*/ volatile unsigned int rawropblend;
211/*2f4*/ volatile unsigned int rawcmp;
212/*2f8*/ volatile unsigned int rawwac;
213/*2fc*/ volatile unsigned int fbramid;
214
215 /*300*/ volatile unsigned int drawop;
216 /* Draw OPeration */
217 /*304*/ unsigned int pad10[2];
218 /* Reserved */
219 /*30c*/ volatile unsigned int lpat;
220 /* Line Pattern control */
221 /*310*/ unsigned int pad11;
222 /* Reserved */
223 /*314*/ volatile unsigned int fontxy;
224 /* XY Font coordinate */
225 /*318*/ volatile unsigned int fontw;
226 /* Font Width */
227 /*31c*/ volatile unsigned int fontinc;
228 /* Font Increment */
229 /*320*/ volatile unsigned int font;
230 /* Font bits */
231 /*324*/ unsigned int pad12[3];
232 /* Reserved */
233/*330*/ volatile unsigned int blend2;
234/*334*/ volatile unsigned int preblend;
235/*338*/ volatile unsigned int stencil;
236/*33c*/ volatile unsigned int stencilctl;
237
238 /*340*/ unsigned int pad13[4];
239 /* Reserved */
240 /*350*/ volatile unsigned int dcss1;
241 /* Depth Cue Scale Slope 1 */
242 /*354*/ volatile unsigned int dcss2;
243 /* Depth Cue Scale Slope 2 */
244 /*358*/ volatile unsigned int dcss3;
245 /* Depth Cue Scale Slope 3 */
246/*35c*/ volatile unsigned int widpmask;
247/*360*/ volatile unsigned int dcs2;
248/*364*/ volatile unsigned int dcs3;
249/*368*/ volatile unsigned int dcs4;
250 /*36c*/ unsigned int pad14;
251 /* Reserved */
252/*370*/ volatile unsigned int dcd2;
253/*374*/ volatile unsigned int dcd3;
254/*378*/ volatile unsigned int dcd4;
255 /*37c*/ unsigned int pad15;
256 /* Reserved */
257 /*380*/ volatile unsigned int pattern[32];
258 /* area Pattern */
259 /*400*/ unsigned int pad16[8];
260 /* Reserved */
261 /*420*/ volatile unsigned int reset;
262 /* chip RESET */
263 /*424*/ unsigned int pad17[247];
264 /* Reserved */
265 /*800*/ volatile unsigned int devid;
266 /* Device ID */
267 /*804*/ unsigned int pad18[63];
268 /* Reserved */
269 /*900*/ volatile unsigned int ucsr;
270 /* User Control & Status Register */
271 /*904*/ unsigned int pad19[31];
272 /* Reserved */
273 /*980*/ volatile unsigned int mer;
274 /* Mode Enable Register */
275 /*984*/ unsigned int pad20[1439];
276 /* Reserved */
277} ffb_fbc, *ffb_fbcPtr;
278
279struct ffb_hw_context {
280 int is_2d_only;
281
282 unsigned int ppc;
283 unsigned int wid;
284 unsigned int fg;
285 unsigned int bg;
286 unsigned int consty;
287 unsigned int constz;
288 unsigned int xclip;
289 unsigned int dcss;
290 unsigned int vclipmin;
291 unsigned int vclipmax;
292 unsigned int vclipzmin;
293 unsigned int vclipzmax;
294 unsigned int dcsf;
295 unsigned int dcsb;
296 unsigned int dczf;
297 unsigned int dczb;
298 unsigned int blendc;
299 unsigned int blendc1;
300 unsigned int blendc2;
301 unsigned int fbc;
302 unsigned int rop;
303 unsigned int cmp;
304 unsigned int matchab;
305 unsigned int matchc;
306 unsigned int magnab;
307 unsigned int magnc;
308 unsigned int pmask;
309 unsigned int xpmask;
310 unsigned int ypmask;
311 unsigned int zpmask;
312 unsigned int auxclip0min;
313 unsigned int auxclip0max;
314 unsigned int auxclip1min;
315 unsigned int auxclip1max;
316 unsigned int auxclip2min;
317 unsigned int auxclip2max;
318 unsigned int auxclip3min;
319 unsigned int auxclip3max;
320 unsigned int drawop;
321 unsigned int lpat;
322 unsigned int fontxy;
323 unsigned int fontw;
324 unsigned int fontinc;
325 unsigned int area_pattern[32];
326 unsigned int ucsr;
327 unsigned int stencil;
328 unsigned int stencilctl;
329 unsigned int dcss1;
330 unsigned int dcss2;
331 unsigned int dcss3;
332 unsigned int dcs2;
333 unsigned int dcs3;
334 unsigned int dcs4;
335 unsigned int dcd2;
336 unsigned int dcd3;
337 unsigned int dcd4;
338 unsigned int mer;
339};
340
341#define FFB_MAX_CTXS 32
342
343enum ffb_chip_type {
344 ffb1_prototype = 0, /* Early pre-FCS FFB */
345 ffb1_standard, /* First FCS FFB, 100Mhz UPA, 66MHz gclk */
346 ffb1_speedsort, /* Second FCS FFB, 100Mhz UPA, 75MHz gclk */
347 ffb2_prototype, /* Early pre-FCS vertical FFB2 */
348 ffb2_vertical, /* First FCS FFB2/vertical, 100Mhz UPA, 100MHZ gclk,
349 75(SingleBuffer)/83(DoubleBuffer) MHz fclk */
350 ffb2_vertical_plus, /* Second FCS FFB2/vertical, same timings */
351 ffb2_horizontal, /* First FCS FFB2/horizontal, same timings as FFB2/vert */
352 ffb2_horizontal_plus, /* Second FCS FFB2/horizontal, same timings */
353 afb_m3, /* FCS Elite3D, 3 float chips */
354 afb_m6 /* FCS Elite3D, 6 float chips */
355};
356
357typedef struct ffb_dev_priv {
358 /* Misc software state. */
359 int prom_node;
360 enum ffb_chip_type ffb_type;
361 u64 card_phys_base;
362 struct miscdevice miscdev;
363
364 /* Controller registers. */
365 ffb_fbcPtr regs;
366
367 /* Context table. */
368 struct ffb_hw_context *hw_state[FFB_MAX_CTXS];
369} ffb_dev_priv_t;
370
371extern unsigned long ffb_get_unmapped_area(struct file *filp,
372 unsigned long hint,
373 unsigned long len,
374 unsigned long pgoff,
375 unsigned long flags);
376extern void ffb_set_context_ioctls(void);
377extern drm_ioctl_desc_t DRM(ioctls)[];
378
379extern int ffb_driver_context_switch(drm_device_t * dev, int old, int new);
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
index 6d58b0370802..59146e3365ba 100644
--- a/drivers/char/ds1286.c
+++ b/drivers/char/ds1286.c
@@ -197,6 +197,7 @@ static int ds1286_ioctl(struct inode *inode, struct file *file,
197 197
198 hrs = alm_tm.tm_hour; 198 hrs = alm_tm.tm_hour;
199 min = alm_tm.tm_min; 199 min = alm_tm.tm_min;
200 sec = alm_tm.tm_sec;
200 201
201 if (hrs >= 24) 202 if (hrs >= 24)
202 hrs = 0xff; 203 hrs = 0xff;
@@ -204,9 +205,11 @@ static int ds1286_ioctl(struct inode *inode, struct file *file,
204 if (min >= 60) 205 if (min >= 60)
205 min = 0xff; 206 min = 0xff;
206 207
207 BIN_TO_BCD(sec); 208 if (sec != 0)
208 BIN_TO_BCD(min); 209 return -EINVAL;
209 BIN_TO_BCD(hrs); 210
211 min = BIN2BCD(min);
212 min = BIN2BCD(hrs);
210 213
211 spin_lock(&ds1286_lock); 214 spin_lock(&ds1286_lock);
212 rtc_write(hrs, RTC_HOURS_ALARM); 215 rtc_write(hrs, RTC_HOURS_ALARM);
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index 88fc24fc4392..de5be30484ad 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -209,7 +209,6 @@ static void digi_send_break(struct channel *ch, int msec);
209static void setup_empty_event(struct tty_struct *tty, struct channel *ch); 209static void setup_empty_event(struct tty_struct *tty, struct channel *ch);
210void epca_setup(char *, int *); 210void epca_setup(char *, int *);
211 211
212static int get_termio(struct tty_struct *, struct termio __user *);
213static int pc_write(struct tty_struct *, const unsigned char *, int); 212static int pc_write(struct tty_struct *, const unsigned char *, int);
214static int pc_init(void); 213static int pc_init(void);
215static int init_PCI(void); 214static int init_PCI(void);
@@ -2362,15 +2361,6 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file,
2362 2361
2363 switch (cmd) 2362 switch (cmd)
2364 { /* Begin switch cmd */ 2363 { /* Begin switch cmd */
2365
2366#if 0 /* Handled by calling layer properly */
2367 case TCGETS:
2368 if (copy_to_user(argp, tty->termios, sizeof(struct ktermios)))
2369 return -EFAULT;
2370 return 0;
2371 case TCGETA:
2372 return get_termio(tty, argp);
2373#endif
2374 case TCSBRK: /* SVID version: non-zero arg --> no break */ 2364 case TCSBRK: /* SVID version: non-zero arg --> no break */
2375 retval = tty_check_change(tty); 2365 retval = tty_check_change(tty);
2376 if (retval) 2366 if (retval)
@@ -2735,13 +2725,6 @@ static void setup_empty_event(struct tty_struct *tty, struct channel *ch)
2735 memoff(ch); 2725 memoff(ch);
2736} /* End setup_empty_event */ 2726} /* End setup_empty_event */
2737 2727
2738/* --------------------- Begin get_termio ----------------------- */
2739
2740static int get_termio(struct tty_struct * tty, struct termio __user * termio)
2741{ /* Begin get_termio */
2742 return kernel_termios_to_user_termio(termio, tty->termios);
2743} /* End get_termio */
2744
2745/* ---------------------- Begin epca_setup -------------------------- */ 2728/* ---------------------- Begin epca_setup -------------------------- */
2746void epca_setup(char *str, int *ints) 2729void epca_setup(char *str, int *ints)
2747{ /* Begin epca_setup */ 2730{ /* Begin epca_setup */
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 337bbcdcf13d..8ea02755b1c9 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -710,12 +710,6 @@ void gs_close(struct tty_struct * tty, struct file * filp)
710} 710}
711 711
712 712
713static unsigned int gs_baudrates[] = {
714 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
715 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600
716};
717
718
719void gs_set_termios (struct tty_struct * tty, 713void gs_set_termios (struct tty_struct * tty,
720 struct ktermios * old_termios) 714 struct ktermios * old_termios)
721{ 715{
@@ -771,7 +765,6 @@ void gs_set_termios (struct tty_struct * tty,
771 765
772 baudrate = tty_get_baud_rate(tty); 766 baudrate = tty_get_baud_rate(tty);
773 767
774 baudrate = gs_baudrates[baudrate];
775 if ((tiosp->c_cflag & CBAUD) == B38400) { 768 if ((tiosp->c_cflag & CBAUD) == B38400) {
776 if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 769 if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
777 baudrate = 57600; 770 baudrate = 57600;
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index cc2cd46bedc6..0f9ed7b46a6d 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -47,8 +47,6 @@
47#define HVC_MAJOR 229 47#define HVC_MAJOR 229
48#define HVC_MINOR 0 48#define HVC_MINOR 0
49 49
50#define TIMEOUT (10)
51
52/* 50/*
53 * Wait this long per iteration while trying to push buffered data to the 51 * Wait this long per iteration while trying to push buffered data to the
54 * hypervisor before allowing the tty to complete a close operation. 52 * hypervisor before allowing the tty to complete a close operation.
@@ -104,12 +102,12 @@ static DEFINE_SPINLOCK(hvc_structs_lock);
104/* 102/*
105 * This value is used to assign a tty->index value to a hvc_struct based 103 * This value is used to assign a tty->index value to a hvc_struct based
106 * upon order of exposure via hvc_probe(), when we can not match it to 104 * upon order of exposure via hvc_probe(), when we can not match it to
107 * a console canidate registered with hvc_instantiate(). 105 * a console candidate registered with hvc_instantiate().
108 */ 106 */
109static int last_hvc = -1; 107static int last_hvc = -1;
110 108
111/* 109/*
112 * Do not call this function with either the hvc_strucst_lock or the hvc_struct 110 * Do not call this function with either the hvc_structs_lock or the hvc_struct
113 * lock held. If successful, this function increments the kobject reference 111 * lock held. If successful, this function increments the kobject reference
114 * count against the target hvc_struct so it should be released when finished. 112 * count against the target hvc_struct so it should be released when finished.
115 */ 113 */
@@ -162,7 +160,7 @@ void hvc_console_print(struct console *co, const char *b, unsigned count)
162 if (index >= MAX_NR_HVC_CONSOLES) 160 if (index >= MAX_NR_HVC_CONSOLES)
163 return; 161 return;
164 162
165 /* This console adapter was removed so it is not useable. */ 163 /* This console adapter was removed so it is not usable. */
166 if (vtermnos[index] < 0) 164 if (vtermnos[index] < 0)
167 return; 165 return;
168 166
@@ -220,7 +218,7 @@ struct console hvc_con_driver = {
220}; 218};
221 219
222/* 220/*
223 * Early console initialization. Preceeds driver initialization. 221 * Early console initialization. Precedes driver initialization.
224 * 222 *
225 * (1) we are first, and the user specified another driver 223 * (1) we are first, and the user specified another driver
226 * -- index will remain -1 224 * -- index will remain -1
@@ -257,7 +255,7 @@ int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops)
257 if (vtermnos[index] != -1) 255 if (vtermnos[index] != -1)
258 return -1; 256 return -1;
259 257
260 /* make sure no no tty has been registerd in this index */ 258 /* make sure no no tty has been registered in this index */
261 hp = hvc_get_by_index(index); 259 hp = hvc_get_by_index(index);
262 if (hp) { 260 if (hp) {
263 kobject_put(&hp->kobj); 261 kobject_put(&hp->kobj);
@@ -267,7 +265,7 @@ int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops)
267 vtermnos[index] = vtermno; 265 vtermnos[index] = vtermno;
268 cons_ops[index] = ops; 266 cons_ops[index] = ops;
269 267
270 /* reserve all indices upto and including this index */ 268 /* reserve all indices up to and including this index */
271 if (last_hvc < index) 269 if (last_hvc < index)
272 last_hvc = index; 270 last_hvc = index;
273 271
@@ -316,7 +314,7 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
316{ 314{
317 struct hvc_struct *hp; 315 struct hvc_struct *hp;
318 unsigned long flags; 316 unsigned long flags;
319 int irq = NO_IRQ; 317 int irq = 0;
320 int rc = 0; 318 int rc = 0;
321 struct kobject *kobjp; 319 struct kobject *kobjp;
322 320
@@ -338,14 +336,14 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
338 hp->tty = tty; 336 hp->tty = tty;
339 /* Save for request_irq outside of spin_lock. */ 337 /* Save for request_irq outside of spin_lock. */
340 irq = hp->irq; 338 irq = hp->irq;
341 if (irq != NO_IRQ) 339 if (irq)
342 hp->irq_requested = 1; 340 hp->irq_requested = 1;
343 341
344 kobjp = &hp->kobj; 342 kobjp = &hp->kobj;
345 343
346 spin_unlock_irqrestore(&hp->lock, flags); 344 spin_unlock_irqrestore(&hp->lock, flags);
347 /* check error, fallback to non-irq */ 345 /* check error, fallback to non-irq */
348 if (irq != NO_IRQ) 346 if (irq)
349 rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED, "hvc_console", hp); 347 rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED, "hvc_console", hp);
350 348
351 /* 349 /*
@@ -373,7 +371,7 @@ static void hvc_close(struct tty_struct *tty, struct file * filp)
373{ 371{
374 struct hvc_struct *hp; 372 struct hvc_struct *hp;
375 struct kobject *kobjp; 373 struct kobject *kobjp;
376 int irq = NO_IRQ; 374 int irq = 0;
377 unsigned long flags; 375 unsigned long flags;
378 376
379 if (tty_hung_up_p(filp)) 377 if (tty_hung_up_p(filp))
@@ -407,7 +405,7 @@ static void hvc_close(struct tty_struct *tty, struct file * filp)
407 */ 405 */
408 tty_wait_until_sent(tty, HVC_CLOSE_WAIT); 406 tty_wait_until_sent(tty, HVC_CLOSE_WAIT);
409 407
410 if (irq != NO_IRQ) 408 if (irq)
411 free_irq(irq, hp); 409 free_irq(irq, hp);
412 410
413 } else { 411 } else {
@@ -424,7 +422,7 @@ static void hvc_hangup(struct tty_struct *tty)
424{ 422{
425 struct hvc_struct *hp = tty->driver_data; 423 struct hvc_struct *hp = tty->driver_data;
426 unsigned long flags; 424 unsigned long flags;
427 int irq = NO_IRQ; 425 int irq = 0;
428 int temp_open_count; 426 int temp_open_count;
429 struct kobject *kobjp; 427 struct kobject *kobjp;
430 428
@@ -453,7 +451,7 @@ static void hvc_hangup(struct tty_struct *tty)
453 irq = hp->irq; 451 irq = hp->irq;
454 hp->irq_requested = 0; 452 hp->irq_requested = 0;
455 spin_unlock_irqrestore(&hp->lock, flags); 453 spin_unlock_irqrestore(&hp->lock, flags);
456 if (irq != NO_IRQ) 454 if (irq)
457 free_irq(irq, hp); 455 free_irq(irq, hp);
458 while(temp_open_count) { 456 while(temp_open_count) {
459 --temp_open_count; 457 --temp_open_count;
@@ -528,7 +526,7 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count
528 526
529/* 527/*
530 * This is actually a contract between the driver and the tty layer outlining 528 * This is actually a contract between the driver and the tty layer outlining
531 * how much write room the driver can guarentee will be sent OR BUFFERED. This 529 * how much write room the driver can guarantee will be sent OR BUFFERED. This
532 * driver MUST honor the return value. 530 * driver MUST honor the return value.
533 */ 531 */
534static int hvc_write_room(struct tty_struct *tty) 532static int hvc_write_room(struct tty_struct *tty)
@@ -550,6 +548,18 @@ static int hvc_chars_in_buffer(struct tty_struct *tty)
550 return hp->n_outbuf; 548 return hp->n_outbuf;
551} 549}
552 550
551/*
552 * timeout will vary between the MIN and MAX values defined here. By default
553 * and during console activity we will use a default MIN_TIMEOUT of 10. When
554 * the console is idle, we increase the timeout value on each pass through
555 * msleep until we reach the max. This may be noticeable as a brief (average
556 * one second) delay on the console before the console responds to input when
557 * there has been no input for some time.
558 */
559#define MIN_TIMEOUT (10)
560#define MAX_TIMEOUT (2000)
561static u32 timeout = MIN_TIMEOUT;
562
553#define HVC_POLL_READ 0x00000001 563#define HVC_POLL_READ 0x00000001
554#define HVC_POLL_WRITE 0x00000002 564#define HVC_POLL_WRITE 0x00000002
555 565
@@ -583,7 +593,7 @@ static int hvc_poll(struct hvc_struct *hp)
583 /* If we aren't interrupt driven and aren't throttled, we always 593 /* If we aren't interrupt driven and aren't throttled, we always
584 * request a reschedule 594 * request a reschedule
585 */ 595 */
586 if (hp->irq == NO_IRQ) 596 if (hp->irq == 0)
587 poll_mask |= HVC_POLL_READ; 597 poll_mask |= HVC_POLL_READ;
588 598
589 /* Read data if any */ 599 /* Read data if any */
@@ -642,9 +652,14 @@ static int hvc_poll(struct hvc_struct *hp)
642 bail: 652 bail:
643 spin_unlock_irqrestore(&hp->lock, flags); 653 spin_unlock_irqrestore(&hp->lock, flags);
644 654
645 if (read_total) 655 if (read_total) {
656 /* Activity is occurring, so reset the polling backoff value to
657 a minimum for performance. */
658 timeout = MIN_TIMEOUT;
659
646 tty_flip_buffer_push(tty); 660 tty_flip_buffer_push(tty);
647 661 }
662
648 return poll_mask; 663 return poll_mask;
649} 664}
650 665
@@ -688,8 +703,12 @@ int khvcd(void *unused)
688 if (!hvc_kicked) { 703 if (!hvc_kicked) {
689 if (poll_mask == 0) 704 if (poll_mask == 0)
690 schedule(); 705 schedule();
691 else 706 else {
692 msleep_interruptible(TIMEOUT); 707 if (timeout < MAX_TIMEOUT)
708 timeout += (timeout >> 6) + 1;
709
710 msleep_interruptible(timeout);
711 }
693 } 712 }
694 __set_current_state(TASK_RUNNING); 713 __set_current_state(TASK_RUNNING);
695 } while (!kthread_should_stop()); 714 } while (!kthread_should_stop());
@@ -794,7 +813,7 @@ int __devexit hvc_remove(struct hvc_struct *hp)
794 813
795 /* 814 /*
796 * We 'put' the instance that was grabbed when the kobject instance 815 * We 'put' the instance that was grabbed when the kobject instance
797 * was intialized using kobject_init(). Let the last holder of this 816 * was initialized using kobject_init(). Let the last holder of this
798 * kobject cause it to be removed, which will probably be the tty_hangup 817 * kobject cause it to be removed, which will probably be the tty_hangup
799 * below. 818 * below.
800 */ 819 */
@@ -850,7 +869,7 @@ int __init hvc_init(void)
850} 869}
851module_init(hvc_init); 870module_init(hvc_init);
852 871
853/* This isn't particularily necessary due to this being a console driver 872/* This isn't particularly necessary due to this being a console driver
854 * but it is nice to be thorough. 873 * but it is nice to be thorough.
855 */ 874 */
856static void __exit hvc_exit(void) 875static void __exit hvc_exit(void)
diff --git a/drivers/char/hvc_iseries.c b/drivers/char/hvc_iseries.c
index f144a947bd17..ec420fe8a908 100644
--- a/drivers/char/hvc_iseries.c
+++ b/drivers/char/hvc_iseries.c
@@ -575,7 +575,7 @@ static int hvc_find_vtys(void)
575 (num_found >= VTTY_PORTS)) 575 (num_found >= VTTY_PORTS))
576 break; 576 break;
577 577
578 vtermno = get_property(vty, "reg", NULL); 578 vtermno = of_get_property(vty, "reg", NULL);
579 if (!vtermno) 579 if (!vtermno)
580 continue; 580 continue;
581 581
diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c
index f9c00844d2bf..94a542e20efb 100644
--- a/drivers/char/hvc_vio.c
+++ b/drivers/char/hvc_vio.c
@@ -153,7 +153,7 @@ static int hvc_find_vtys(void)
153 if (num_found >= MAX_NR_HVC_CONSOLES) 153 if (num_found >= MAX_NR_HVC_CONSOLES)
154 break; 154 break;
155 155
156 vtermno = get_property(vty, "reg", NULL); 156 vtermno = of_get_property(vty, "reg", NULL);
157 if (!vtermno) 157 if (!vtermno)
158 continue; 158 continue;
159 159
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index 50315d6364fd..d5a752da322f 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -1279,8 +1279,8 @@ static int __init hvsi_console_init(void)
1279 struct hvsi_struct *hp; 1279 struct hvsi_struct *hp;
1280 const uint32_t *vtermno, *irq; 1280 const uint32_t *vtermno, *irq;
1281 1281
1282 vtermno = get_property(vty, "reg", NULL); 1282 vtermno = of_get_property(vty, "reg", NULL);
1283 irq = get_property(vty, "interrupts", NULL); 1283 irq = of_get_property(vty, "interrupts", NULL);
1284 if (!vtermno || !irq) 1284 if (!vtermno || !irq)
1285 continue; 1285 continue;
1286 1286
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c
index f86fa0c55d36..e46120d05b68 100644
--- a/drivers/char/ip2/i2lib.c
+++ b/drivers/char/ip2/i2lib.c
@@ -80,7 +80,7 @@ static int i2RetryFlushOutput(i2ChanStrPtr);
80// Not a documented part of the library routines (careful...) but the Diagnostic 80// Not a documented part of the library routines (careful...) but the Diagnostic
81// i2diag.c finds them useful to help the throughput in certain limited 81// i2diag.c finds them useful to help the throughput in certain limited
82// single-threaded operations. 82// single-threaded operations.
83static inline void iiSendPendingMail(i2eBordStrPtr); 83static void iiSendPendingMail(i2eBordStrPtr);
84static void serviceOutgoingFifo(i2eBordStrPtr); 84static void serviceOutgoingFifo(i2eBordStrPtr);
85 85
86// Functions defined in ip2.c as part of interrupt handling 86// Functions defined in ip2.c as part of interrupt handling
@@ -166,7 +166,7 @@ static void iiSendPendingMail_t(unsigned long data)
166// If any outgoing mail bits are set and there is outgoing mailbox is empty, 166// If any outgoing mail bits are set and there is outgoing mailbox is empty,
167// send the mail and clear the bits. 167// send the mail and clear the bits.
168//****************************************************************************** 168//******************************************************************************
169static inline void 169static void
170iiSendPendingMail(i2eBordStrPtr pB) 170iiSendPendingMail(i2eBordStrPtr pB)
171{ 171{
172 if (pB->i2eOutMailWaiting && (!pB->i2eWaitingForEmptyFifo) ) 172 if (pB->i2eOutMailWaiting && (!pB->i2eWaitingForEmptyFifo) )
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index a7b33d2f5991..e22146546add 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2478,6 +2478,11 @@ static __devinit void default_find_bmc(void)
2478 if (!info) 2478 if (!info)
2479 return; 2479 return;
2480 2480
2481#ifdef CONFIG_PPC_MERGE
2482 if (check_legacy_ioport(ipmi_defaults[i].port))
2483 continue;
2484#endif
2485
2481 info->addr_source = NULL; 2486 info->addr_source = NULL;
2482 2487
2483 info->si_type = ipmi_defaults[i].type; 2488 info->si_type = ipmi_defaults[i].type;
diff --git a/drivers/char/lcd.c b/drivers/char/lcd.c
index d649abbf0857..1f0962616ee5 100644
--- a/drivers/char/lcd.c
+++ b/drivers/char/lcd.c
@@ -11,9 +11,6 @@
11 * March 2001: Ported from 2.0.34 by Liam Davies 11 * March 2001: Ported from 2.0.34 by Liam Davies
12 * 12 *
13 */ 13 */
14
15#define RTC_IO_EXTENT 0x10 /*Only really two ports, but... */
16
17#include <linux/types.h> 14#include <linux/types.h>
18#include <linux/errno.h> 15#include <linux/errno.h>
19#include <linux/miscdevice.h> 16#include <linux/miscdevice.h>
@@ -32,8 +29,6 @@
32 29
33#include "lcd.h" 30#include "lcd.h"
34 31
35static DEFINE_SPINLOCK(lcd_lock);
36
37static int lcd_ioctl(struct inode *inode, struct file *file, 32static int lcd_ioctl(struct inode *inode, struct file *file,
38 unsigned int cmd, unsigned long arg); 33 unsigned int cmd, unsigned long arg);
39 34
@@ -409,138 +404,6 @@ static int lcd_ioctl(struct inode *inode, struct file *file,
409 break; 404 break;
410 } 405 }
411 406
412// Erase the flash
413
414 case FLASH_Erase:{
415
416 int ctr = 0;
417
418 if ( !capable(CAP_SYS_ADMIN) ) return -EPERM;
419
420 pr_info(LCD "Erasing Flash\n");
421
422 // Chip Erase Sequence
423 WRITE_FLASH(kFlash_Addr1, kFlash_Data1);
424 WRITE_FLASH(kFlash_Addr2, kFlash_Data2);
425 WRITE_FLASH(kFlash_Addr1, kFlash_Erase3);
426 WRITE_FLASH(kFlash_Addr1, kFlash_Data1);
427 WRITE_FLASH(kFlash_Addr2, kFlash_Data2);
428 WRITE_FLASH(kFlash_Addr1, kFlash_Erase6);
429
430 while ((!dqpoll(0x00000000, 0xFF))
431 && (!timeout(0x00000000))) {
432 ctr++;
433 }
434
435 if (READ_FLASH(0x07FFF0) == 0xFF) {
436 pr_info(LCD "Erase Successful\n");
437 } else if (timeout) {
438 pr_info(LCD "Erase Timed Out\n");
439 }
440
441 break;
442 }
443
444// burn the flash
445
446 case FLASH_Burn:{
447
448 volatile unsigned long burn_addr;
449 unsigned long flags;
450 unsigned int i, index;
451 unsigned char *rom;
452
453
454 struct lcd_display display;
455
456 if ( !capable(CAP_SYS_ADMIN) ) return -EPERM;
457
458 if (copy_from_user
459 (&display, (struct lcd_display *) arg,
460 sizeof(struct lcd_display)))
461 return -EFAULT;
462 rom = kmalloc((128), GFP_ATOMIC);
463 if (rom == NULL) {
464 printk(KERN_ERR LCD "kmalloc() failed in %s\n",
465 __FUNCTION__);
466 return -ENOMEM;
467 }
468
469 pr_info(LCD "Starting Flash burn\n");
470 for (i = 0; i < FLASH_SIZE; i = i + 128) {
471
472 if (copy_from_user
473 (rom, display.RomImage + i, 128)) {
474 kfree(rom);
475 return -EFAULT;
476 }
477 burn_addr = kFlashBase + i;
478 spin_lock_irqsave(&lcd_lock, flags);
479 for (index = 0; index < (128); index++) {
480
481 WRITE_FLASH(kFlash_Addr1,
482 kFlash_Data1);
483 WRITE_FLASH(kFlash_Addr2,
484 kFlash_Data2);
485 WRITE_FLASH(kFlash_Addr1,
486 kFlash_Prog);
487 *((volatile unsigned char *)burn_addr) =
488 (volatile unsigned char) rom[index];
489
490 while ((!dqpoll (burn_addr,
491 (volatile unsigned char)
492 rom[index])) &&
493 (!timeout(burn_addr))) { }
494 burn_addr++;
495 }
496 spin_unlock_irqrestore(&lcd_lock, flags);
497 if (* ((volatile unsigned char *)
498 (burn_addr - 1)) ==
499 (volatile unsigned char)
500 rom[index - 1]) {
501 } else if (timeout) {
502 pr_info(LCD "Flash burn timed out\n");
503 }
504
505
506 }
507 kfree(rom);
508
509 pr_info(LCD "Flash successfully burned\n");
510
511 break;
512 }
513
514// read the flash all at once
515
516 case FLASH_Read:{
517
518 unsigned char *user_bytes;
519 volatile unsigned long read_addr;
520 unsigned int i;
521
522 user_bytes =
523 &(((struct lcd_display *) arg)->RomImage[0]);
524
525 if (!access_ok
526 (VERIFY_WRITE, user_bytes, FLASH_SIZE))
527 return -EFAULT;
528
529 pr_info(LCD "Reading Flash");
530 for (i = 0; i < FLASH_SIZE; i++) {
531 unsigned char tmp_byte;
532 read_addr = kFlashBase + i;
533 tmp_byte =
534 *((volatile unsigned char *)
535 read_addr);
536 if (__put_user(tmp_byte, &user_bytes[i]))
537 return -EFAULT;
538 }
539
540
541 break;
542 }
543
544 default: 407 default:
545 return -EINVAL; 408 return -EINVAL;
546 409
@@ -644,42 +507,6 @@ static void __exit lcd_exit(void)
644 misc_deregister(&lcd_dev); 507 misc_deregister(&lcd_dev);
645} 508}
646 509
647//
648// Function: dqpoll
649//
650// Description: Polls the data lines to see if the flash is busy
651//
652// In: address, byte data
653//
654// Out: 0 = busy, 1 = write or erase complete
655//
656//
657
658static int dqpoll(volatile unsigned long address, volatile unsigned char data)
659{
660 volatile unsigned char dq7;
661
662 dq7 = data & 0x80;
663
664 return ((READ_FLASH(address) & 0x80) == dq7);
665}
666
667//
668// Function: timeout
669//
670// Description: Checks to see if erase or write has timed out
671// By polling dq5
672//
673// In: address
674//
675//
676// Out: 0 = not timed out, 1 = timed out
677
678static int timeout(volatile unsigned long address)
679{
680 return (READ_FLASH(address) & 0x20) == 0x20;
681}
682
683module_init(lcd_init); 510module_init(lcd_init);
684module_exit(lcd_exit); 511module_exit(lcd_exit);
685 512
diff --git a/drivers/char/lcd.h b/drivers/char/lcd.h
index a8d4ae737158..290b3ff23b03 100644
--- a/drivers/char/lcd.h
+++ b/drivers/char/lcd.h
@@ -14,11 +14,7 @@
14 14
15// function headers 15// function headers
16 16
17static int dqpoll(volatile unsigned long, volatile unsigned char );
18static int timeout(volatile unsigned long);
19
20#define LCD_CHARS_PER_LINE 40 17#define LCD_CHARS_PER_LINE 40
21#define FLASH_SIZE 524288
22#define MAX_IDLE_TIME 120 18#define MAX_IDLE_TIME 120
23 19
24struct lcd_display { 20struct lcd_display {
@@ -54,26 +50,6 @@ struct lcd_display {
54#define LCDTimeoutValue 0xfff 50#define LCDTimeoutValue 0xfff
55 51
56 52
57// Flash definitions AMD 29F040
58#define kFlashBase 0x0FC00000
59
60#define kFlash_Addr1 0x5555
61#define kFlash_Addr2 0x2AAA
62#define kFlash_Data1 0xAA
63#define kFlash_Data2 0x55
64#define kFlash_Prog 0xA0
65#define kFlash_Erase3 0x80
66#define kFlash_Erase6 0x10
67#define kFlash_Read 0xF0
68
69#define kFlash_ID 0x90
70#define kFlash_VenAddr 0x00
71#define kFlash_DevAddr 0x01
72#define kFlash_VenID 0x01
73#define kFlash_DevID 0xA4 // 29F040
74//#define kFlash_DevID 0xAD // 29F016
75
76
77// Macros 53// Macros
78 54
79#define LCDWriteData(x) outl((x << 24), kLCD_DR) 55#define LCDWriteData(x) outl((x << 24), kLCD_DR)
@@ -89,9 +65,6 @@ struct lcd_display {
89#define WRITE_GAL(x,y) outl(y, 0x04000000 | (x)) 65#define WRITE_GAL(x,y) outl(y, 0x04000000 | (x))
90#define BusyCheck() while ((LCDReadInst & 0x80) == 0x80) 66#define BusyCheck() while ((LCDReadInst & 0x80) == 0x80)
91 67
92#define WRITE_FLASH(x,y) outb((char)y, kFlashBase | (x))
93#define READ_FLASH(x) (inb(kFlashBase | (x)))
94
95 68
96 69
97/* 70/*
@@ -124,11 +97,6 @@ struct lcd_display {
124// Button defs 97// Button defs
125#define BUTTON_Read 50 98#define BUTTON_Read 50
126 99
127// Flash command codes
128#define FLASH_Erase 60
129#define FLASH_Burn 61
130#define FLASH_Read 62
131
132 100
133// Ethernet LINK check hackaroo 101// Ethernet LINK check hackaroo
134#define LINK_Check 90 102#define LINK_Check 90
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index f5c160caf9f4..5f066963f171 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -248,7 +248,7 @@ static unsigned long get_unmapped_area_mem(struct file *file,
248{ 248{
249 if (!valid_mmap_phys_addr_range(pgoff, len)) 249 if (!valid_mmap_phys_addr_range(pgoff, len))
250 return (unsigned long) -EINVAL; 250 return (unsigned long) -EINVAL;
251 return pgoff; 251 return pgoff << PAGE_SHIFT;
252} 252}
253 253
254/* can't do an in-place private mapping if there's no MMU */ 254/* can't do an in-place private mapping if there's no MMU */
diff --git a/drivers/char/mwave/3780i.c b/drivers/char/mwave/3780i.c
index 4e4865e90e50..492dbfb2efd6 100644
--- a/drivers/char/mwave/3780i.c
+++ b/drivers/char/mwave/3780i.c
@@ -63,8 +63,6 @@
63#include "3780i.h" 63#include "3780i.h"
64 64
65static DEFINE_SPINLOCK(dsp_lock); 65static DEFINE_SPINLOCK(dsp_lock);
66static unsigned long flags;
67
68 66
69static void PaceMsaAccess(unsigned short usDspBaseIO) 67static void PaceMsaAccess(unsigned short usDspBaseIO)
70{ 68{
@@ -76,6 +74,7 @@ static void PaceMsaAccess(unsigned short usDspBaseIO)
76unsigned short dsp3780I_ReadMsaCfg(unsigned short usDspBaseIO, 74unsigned short dsp3780I_ReadMsaCfg(unsigned short usDspBaseIO,
77 unsigned long ulMsaAddr) 75 unsigned long ulMsaAddr)
78{ 76{
77 unsigned long flags;
79 unsigned short val; 78 unsigned short val;
80 79
81 PRINTK_3(TRACE_3780I, 80 PRINTK_3(TRACE_3780I,
@@ -96,6 +95,7 @@ unsigned short dsp3780I_ReadMsaCfg(unsigned short usDspBaseIO,
96void dsp3780I_WriteMsaCfg(unsigned short usDspBaseIO, 95void dsp3780I_WriteMsaCfg(unsigned short usDspBaseIO,
97 unsigned long ulMsaAddr, unsigned short usValue) 96 unsigned long ulMsaAddr, unsigned short usValue)
98{ 97{
98 unsigned long flags;
99 99
100 PRINTK_4(TRACE_3780I, 100 PRINTK_4(TRACE_3780I,
101 "3780i::dsp3780i_WriteMsaCfg entry usDspBaseIO %x ulMsaAddr %lx usValue %x\n", 101 "3780i::dsp3780i_WriteMsaCfg entry usDspBaseIO %x ulMsaAddr %lx usValue %x\n",
@@ -175,6 +175,7 @@ int dsp3780I_EnableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings,
175 unsigned short *pIrqMap, 175 unsigned short *pIrqMap,
176 unsigned short *pDmaMap) 176 unsigned short *pDmaMap)
177{ 177{
178 unsigned long flags;
178 unsigned short usDspBaseIO = pSettings->usDspBaseIO; 179 unsigned short usDspBaseIO = pSettings->usDspBaseIO;
179 int i; 180 int i;
180 DSP_UART_CFG_1 rUartCfg1; 181 DSP_UART_CFG_1 rUartCfg1;
@@ -354,6 +355,7 @@ int dsp3780I_EnableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings,
354 355
355int dsp3780I_DisableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings) 356int dsp3780I_DisableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings)
356{ 357{
358 unsigned long flags;
357 unsigned short usDspBaseIO = pSettings->usDspBaseIO; 359 unsigned short usDspBaseIO = pSettings->usDspBaseIO;
358 DSP_ISA_SLAVE_CONTROL rSlaveControl; 360 DSP_ISA_SLAVE_CONTROL rSlaveControl;
359 361
@@ -383,6 +385,7 @@ int dsp3780I_DisableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings)
383 385
384int dsp3780I_Reset(DSP_3780I_CONFIG_SETTINGS * pSettings) 386int dsp3780I_Reset(DSP_3780I_CONFIG_SETTINGS * pSettings)
385{ 387{
388 unsigned long flags;
386 unsigned short usDspBaseIO = pSettings->usDspBaseIO; 389 unsigned short usDspBaseIO = pSettings->usDspBaseIO;
387 DSP_BOOT_DOMAIN rBootDomain; 390 DSP_BOOT_DOMAIN rBootDomain;
388 DSP_HBRIDGE_CONTROL rHBridgeControl; 391 DSP_HBRIDGE_CONTROL rHBridgeControl;
@@ -427,6 +430,7 @@ int dsp3780I_Reset(DSP_3780I_CONFIG_SETTINGS * pSettings)
427 430
428int dsp3780I_Run(DSP_3780I_CONFIG_SETTINGS * pSettings) 431int dsp3780I_Run(DSP_3780I_CONFIG_SETTINGS * pSettings)
429{ 432{
433 unsigned long flags;
430 unsigned short usDspBaseIO = pSettings->usDspBaseIO; 434 unsigned short usDspBaseIO = pSettings->usDspBaseIO;
431 DSP_BOOT_DOMAIN rBootDomain; 435 DSP_BOOT_DOMAIN rBootDomain;
432 DSP_HBRIDGE_CONTROL rHBridgeControl; 436 DSP_HBRIDGE_CONTROL rHBridgeControl;
@@ -473,6 +477,7 @@ int dsp3780I_Run(DSP_3780I_CONFIG_SETTINGS * pSettings)
473int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void __user *pvBuffer, 477int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void __user *pvBuffer,
474 unsigned uCount, unsigned long ulDSPAddr) 478 unsigned uCount, unsigned long ulDSPAddr)
475{ 479{
480 unsigned long flags;
476 unsigned short __user *pusBuffer = pvBuffer; 481 unsigned short __user *pusBuffer = pvBuffer;
477 unsigned short val; 482 unsigned short val;
478 483
@@ -514,6 +519,7 @@ int dsp3780I_ReadAndClearDStore(unsigned short usDspBaseIO,
514 void __user *pvBuffer, unsigned uCount, 519 void __user *pvBuffer, unsigned uCount,
515 unsigned long ulDSPAddr) 520 unsigned long ulDSPAddr)
516{ 521{
522 unsigned long flags;
517 unsigned short __user *pusBuffer = pvBuffer; 523 unsigned short __user *pusBuffer = pvBuffer;
518 unsigned short val; 524 unsigned short val;
519 525
@@ -555,6 +561,7 @@ int dsp3780I_ReadAndClearDStore(unsigned short usDspBaseIO,
555int dsp3780I_WriteDStore(unsigned short usDspBaseIO, void __user *pvBuffer, 561int dsp3780I_WriteDStore(unsigned short usDspBaseIO, void __user *pvBuffer,
556 unsigned uCount, unsigned long ulDSPAddr) 562 unsigned uCount, unsigned long ulDSPAddr)
557{ 563{
564 unsigned long flags;
558 unsigned short __user *pusBuffer = pvBuffer; 565 unsigned short __user *pusBuffer = pvBuffer;
559 566
560 567
@@ -596,6 +603,7 @@ int dsp3780I_WriteDStore(unsigned short usDspBaseIO, void __user *pvBuffer,
596int dsp3780I_ReadIStore(unsigned short usDspBaseIO, void __user *pvBuffer, 603int dsp3780I_ReadIStore(unsigned short usDspBaseIO, void __user *pvBuffer,
597 unsigned uCount, unsigned long ulDSPAddr) 604 unsigned uCount, unsigned long ulDSPAddr)
598{ 605{
606 unsigned long flags;
599 unsigned short __user *pusBuffer = pvBuffer; 607 unsigned short __user *pusBuffer = pvBuffer;
600 608
601 PRINTK_5(TRACE_3780I, 609 PRINTK_5(TRACE_3780I,
@@ -643,6 +651,7 @@ int dsp3780I_ReadIStore(unsigned short usDspBaseIO, void __user *pvBuffer,
643int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void __user *pvBuffer, 651int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void __user *pvBuffer,
644 unsigned uCount, unsigned long ulDSPAddr) 652 unsigned uCount, unsigned long ulDSPAddr)
645{ 653{
654 unsigned long flags;
646 unsigned short __user *pusBuffer = pvBuffer; 655 unsigned short __user *pusBuffer = pvBuffer;
647 656
648 PRINTK_5(TRACE_3780I, 657 PRINTK_5(TRACE_3780I,
@@ -691,6 +700,7 @@ int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void __user *pvBuffer,
691int dsp3780I_GetIPCSource(unsigned short usDspBaseIO, 700int dsp3780I_GetIPCSource(unsigned short usDspBaseIO,
692 unsigned short *pusIPCSource) 701 unsigned short *pusIPCSource)
693{ 702{
703 unsigned long flags;
694 DSP_HBRIDGE_CONTROL rHBridgeControl; 704 DSP_HBRIDGE_CONTROL rHBridgeControl;
695 unsigned short temp; 705 unsigned short temp;
696 706
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index a61fb6da5d03..80a01150b86c 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -1338,43 +1338,23 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c
1338 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) 1338 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
1339 * Caller should use TIOCGICOUNT to see which one it was 1339 * Caller should use TIOCGICOUNT to see which one it was
1340 */ 1340 */
1341 case TIOCMIWAIT: { 1341 case TIOCMIWAIT:
1342 DECLARE_WAITQUEUE(wait, current); 1342 spin_lock_irqsave(&info->slock, flags);
1343 int ret; 1343 cnow = info->icount; /* note the counters on entry */
1344 spin_unlock_irqrestore(&info->slock, flags);
1345
1346 wait_event_interruptible(info->delta_msr_wait, ({
1347 cprev = cnow;
1344 spin_lock_irqsave(&info->slock, flags); 1348 spin_lock_irqsave(&info->slock, flags);
1345 cprev = info->icount; /* note the counters on entry */ 1349 cnow = info->icount; /* atomic copy */
1346 spin_unlock_irqrestore(&info->slock, flags); 1350 spin_unlock_irqrestore(&info->slock, flags);
1347 1351
1348 add_wait_queue(&info->delta_msr_wait, &wait); 1352 ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
1349 while (1) { 1353 ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
1350 spin_lock_irqsave(&info->slock, flags); 1354 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
1351 cnow = info->icount; /* atomic copy */ 1355 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts));
1352 spin_unlock_irqrestore(&info->slock, flags); 1356 }));
1353 1357 break;
1354 set_current_state(TASK_INTERRUPTIBLE);
1355 if (((arg & TIOCM_RNG) &&
1356 (cnow.rng != cprev.rng)) ||
1357 ((arg & TIOCM_DSR) &&
1358 (cnow.dsr != cprev.dsr)) ||
1359 ((arg & TIOCM_CD) &&
1360 (cnow.dcd != cprev.dcd)) ||
1361 ((arg & TIOCM_CTS) &&
1362 (cnow.cts != cprev.cts))) {
1363 ret = 0;
1364 break;
1365 }
1366 /* see if a signal did it */
1367 if (signal_pending(current)) {
1368 ret = -ERESTARTSYS;
1369 break;
1370 }
1371 cprev = cnow;
1372 }
1373 current->state = TASK_RUNNING;
1374 remove_wait_queue(&info->delta_msr_wait, &wait);
1375 break;
1376 }
1377 /* NOTREACHED */
1378 /* 1358 /*
1379 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1359 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
1380 * Return: write counters to the user passed counter struct 1360 * Return: write counters to the user passed counter struct
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index 9af07e4999d5..f7603b6aeb87 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -1758,43 +1758,23 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
1758 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) 1758 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
1759 * Caller should use TIOCGICOUNT to see which one it was 1759 * Caller should use TIOCGICOUNT to see which one it was
1760 */ 1760 */
1761 case TIOCMIWAIT: { 1761 case TIOCMIWAIT:
1762 DECLARE_WAITQUEUE(wait, current);
1763 int ret;
1764 spin_lock_irqsave(&info->slock, flags); 1762 spin_lock_irqsave(&info->slock, flags);
1765 cprev = info->icount; /* note the counters on entry */ 1763 cnow = info->icount; /* note the counters on entry */
1766 spin_unlock_irqrestore(&info->slock, flags); 1764 spin_unlock_irqrestore(&info->slock, flags);
1767 1765
1768 add_wait_queue(&info->delta_msr_wait, &wait); 1766 wait_event_interruptible(info->delta_msr_wait, ({
1769 while (1) { 1767 cprev = cnow;
1770 spin_lock_irqsave(&info->slock, flags); 1768 spin_lock_irqsave(&info->slock, flags);
1771 cnow = info->icount; /* atomic copy */ 1769 cnow = info->icount; /* atomic copy */
1772 spin_unlock_irqrestore(&info->slock, flags); 1770 spin_unlock_irqrestore(&info->slock, flags);
1773 1771
1774 set_current_state(TASK_INTERRUPTIBLE); 1772 ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
1775 if (((arg & TIOCM_RNG) && 1773 ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
1776 (cnow.rng != cprev.rng)) || 1774 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
1777 ((arg & TIOCM_DSR) && 1775 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts));
1778 (cnow.dsr != cprev.dsr)) || 1776 }));
1779 ((arg & TIOCM_CD) &&
1780 (cnow.dcd != cprev.dcd)) ||
1781 ((arg & TIOCM_CTS) &&
1782 (cnow.cts != cprev.cts))) {
1783 ret = 0;
1784 break;
1785 }
1786 /* see if a signal did it */
1787 if (signal_pending(current)) {
1788 ret = -ERESTARTSYS;
1789 break;
1790 }
1791 cprev = cnow;
1792 }
1793 current->state = TASK_RUNNING;
1794 remove_wait_queue(&info->delta_msr_wait, &wait);
1795 break; 1777 break;
1796 }
1797 /* NOTREACHED */
1798 /* 1778 /*
1799 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1779 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
1800 * Return: write counters to the user passed counter struct 1780 * Return: write counters to the user passed counter struct
@@ -2230,7 +2210,14 @@ end_intr:
2230 port->mon_data.rxcnt += cnt; 2210 port->mon_data.rxcnt += cnt;
2231 port->mon_data.up_rxcnt += cnt; 2211 port->mon_data.up_rxcnt += cnt;
2232 2212
2213 /*
2214 * We are called from an interrupt context with &port->slock
2215 * being held. Drop it temporarily in order to prevent
2216 * recursive locking.
2217 */
2218 spin_unlock(&port->slock);
2233 tty_flip_buffer_push(tty); 2219 tty_flip_buffer_push(tty);
2220 spin_lock(&port->slock);
2234} 2221}
2235 2222
2236static void mxser_transmit_chars(struct mxser_port *port) 2223static void mxser_transmit_chars(struct mxser_port *port)
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 0e82968c2f38..f2e4ec4fd407 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -273,6 +273,7 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf,
273 DEBUGP(6, dev, "BytesToRead=%lu\n", bytes_to_read); 273 DEBUGP(6, dev, "BytesToRead=%lu\n", bytes_to_read);
274 274
275 min_bytes_to_read = min(count, bytes_to_read + 5); 275 min_bytes_to_read = min(count, bytes_to_read + 5);
276 min_bytes_to_read = min_t(size_t, min_bytes_to_read, READ_WRITE_BUFFER_SIZE);
276 277
277 DEBUGP(6, dev, "Min=%lu\n", min_bytes_to_read); 278 DEBUGP(6, dev, "Min=%lu\n", min_bytes_to_read);
278 279
@@ -340,7 +341,7 @@ static ssize_t cm4040_write(struct file *filp, const char __user *buf,
340 return 0; 341 return 0;
341 } 342 }
342 343
343 if (count < 5) { 344 if ((count < 5) || (count > READ_WRITE_BUFFER_SIZE)) {
344 DEBUGP(2, dev, "<- cm4040_write buffersize=%Zd < 5\n", count); 345 DEBUGP(2, dev, "<- cm4040_write buffersize=%Zd < 5\n", count);
345 return -EIO; 346 return -EIO;
346 } 347 }
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 8d025e9b5bce..157b1d09ab55 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -4169,7 +4169,7 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
4169 netif_stop_queue(dev); 4169 netif_stop_queue(dev);
4170 4170
4171 /* copy data to device buffers */ 4171 /* copy data to device buffers */
4172 memcpy(info->tx_buf, skb->data, skb->len); 4172 skb_copy_from_linear_data(skb, info->tx_buf, skb->len);
4173 info->tx_get = 0; 4173 info->tx_get = 0;
4174 info->tx_put = info->tx_count = skb->len; 4174 info->tx_put = info->tx_count = skb->len;
4175 4175
diff --git a/drivers/char/random.c b/drivers/char/random.c
index b9dc7aa1dfb3..46c1b97748b6 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -881,15 +881,15 @@ EXPORT_SYMBOL(get_random_bytes);
881 */ 881 */
882static void init_std_data(struct entropy_store *r) 882static void init_std_data(struct entropy_store *r)
883{ 883{
884 struct timeval tv; 884 ktime_t now;
885 unsigned long flags; 885 unsigned long flags;
886 886
887 spin_lock_irqsave(&r->lock, flags); 887 spin_lock_irqsave(&r->lock, flags);
888 r->entropy_count = 0; 888 r->entropy_count = 0;
889 spin_unlock_irqrestore(&r->lock, flags); 889 spin_unlock_irqrestore(&r->lock, flags);
890 890
891 do_gettimeofday(&tv); 891 now = ktime_get_real();
892 add_entropy_words(r, (__u32 *)&tv, sizeof(tv)/4); 892 add_entropy_words(r, (__u32 *)&now, sizeof(now)/4);
893 add_entropy_words(r, (__u32 *)utsname(), 893 add_entropy_words(r, (__u32 *)utsname(),
894 sizeof(*(utsname()))/4); 894 sizeof(*(utsname()))/4);
895} 895}
@@ -911,14 +911,12 @@ void rand_initialize_irq(int irq)
911 return; 911 return;
912 912
913 /* 913 /*
914 * If kmalloc returns null, we just won't use that entropy 914 * If kzalloc returns null, we just won't use that entropy
915 * source. 915 * source.
916 */ 916 */
917 state = kmalloc(sizeof(struct timer_rand_state), GFP_KERNEL); 917 state = kzalloc(sizeof(struct timer_rand_state), GFP_KERNEL);
918 if (state) { 918 if (state)
919 memset(state, 0, sizeof(struct timer_rand_state));
920 irq_timer_state[irq] = state; 919 irq_timer_state[irq] = state;
921 }
922} 920}
923 921
924#ifdef CONFIG_BLOCK 922#ifdef CONFIG_BLOCK
@@ -927,14 +925,12 @@ void rand_initialize_disk(struct gendisk *disk)
927 struct timer_rand_state *state; 925 struct timer_rand_state *state;
928 926
929 /* 927 /*
930 * If kmalloc returns null, we just won't use that entropy 928 * If kzalloc returns null, we just won't use that entropy
931 * source. 929 * source.
932 */ 930 */
933 state = kmalloc(sizeof(struct timer_rand_state), GFP_KERNEL); 931 state = kzalloc(sizeof(struct timer_rand_state), GFP_KERNEL);
934 if (state) { 932 if (state)
935 memset(state, 0, sizeof(struct timer_rand_state));
936 disk->random = state; 933 disk->random = state;
937 }
938} 934}
939#endif 935#endif
940 936
@@ -1469,7 +1465,6 @@ late_initcall(seqgen_init);
1469__u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr, 1465__u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr,
1470 __be16 sport, __be16 dport) 1466 __be16 sport, __be16 dport)
1471{ 1467{
1472 struct timeval tv;
1473 __u32 seq; 1468 __u32 seq;
1474 __u32 hash[12]; 1469 __u32 hash[12];
1475 struct keydata *keyptr = get_keyptr(); 1470 struct keydata *keyptr = get_keyptr();
@@ -1485,8 +1480,7 @@ __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr,
1485 seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK; 1480 seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK;
1486 seq += keyptr->count; 1481 seq += keyptr->count;
1487 1482
1488 do_gettimeofday(&tv); 1483 seq += ktime_get_real().tv64;
1489 seq += tv.tv_usec + tv.tv_sec * 1000000;
1490 1484
1491 return seq; 1485 return seq;
1492} 1486}
@@ -1521,7 +1515,6 @@ __u32 secure_ip_id(__be32 daddr)
1521__u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, 1515__u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
1522 __be16 sport, __be16 dport) 1516 __be16 sport, __be16 dport)
1523{ 1517{
1524 struct timeval tv;
1525 __u32 seq; 1518 __u32 seq;
1526 __u32 hash[4]; 1519 __u32 hash[4];
1527 struct keydata *keyptr = get_keyptr(); 1520 struct keydata *keyptr = get_keyptr();
@@ -1543,12 +1536,11 @@ __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
1543 * As close as possible to RFC 793, which 1536 * As close as possible to RFC 793, which
1544 * suggests using a 250 kHz clock. 1537 * suggests using a 250 kHz clock.
1545 * Further reading shows this assumes 2 Mb/s networks. 1538 * Further reading shows this assumes 2 Mb/s networks.
1546 * For 10 Mb/s Ethernet, a 1 MHz clock is appropriate. 1539 * For 10 Gb/s Ethernet, a 1 GHz clock is appropriate.
1547 * That's funny, Linux has one built in! Use it! 1540 * That's funny, Linux has one built in! Use it!
1548 * (Networks are faster now - should this be increased?) 1541 * (Networks are faster now - should this be increased?)
1549 */ 1542 */
1550 do_gettimeofday(&tv); 1543 seq += ktime_get_real().tv64;
1551 seq += tv.tv_usec + tv.tv_sec * 1000000;
1552#if 0 1544#if 0
1553 printk("init_seq(%lx, %lx, %d, %d) = %d\n", 1545 printk("init_seq(%lx, %lx, %d, %d) = %d\n",
1554 saddr, daddr, sport, dport, seq); 1546 saddr, daddr, sport, dport, seq);
@@ -1556,8 +1548,6 @@ __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
1556 return seq; 1548 return seq;
1557} 1549}
1558 1550
1559EXPORT_SYMBOL(secure_tcp_sequence_number);
1560
1561/* Generate secure starting point for ephemeral IPV4 transport port search */ 1551/* Generate secure starting point for ephemeral IPV4 transport port search */
1562u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport) 1552u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport)
1563{ 1553{
@@ -1598,7 +1588,6 @@ u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, __be16
1598u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, 1588u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
1599 __be16 sport, __be16 dport) 1589 __be16 sport, __be16 dport)
1600{ 1590{
1601 struct timeval tv;
1602 u64 seq; 1591 u64 seq;
1603 __u32 hash[4]; 1592 __u32 hash[4];
1604 struct keydata *keyptr = get_keyptr(); 1593 struct keydata *keyptr = get_keyptr();
@@ -1611,8 +1600,7 @@ u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
1611 seq = half_md4_transform(hash, keyptr->secret); 1600 seq = half_md4_transform(hash, keyptr->secret);
1612 seq |= ((u64)keyptr->count) << (32 - HASH_BITS); 1601 seq |= ((u64)keyptr->count) << (32 - HASH_BITS);
1613 1602
1614 do_gettimeofday(&tv); 1603 seq += ktime_get_real().tv64;
1615 seq += tv.tv_usec + tv.tv_sec * 1000000;
1616 seq &= (1ull << 48) - 1; 1604 seq &= (1ull << 48) - 1;
1617#if 0 1605#if 0
1618 printk("dccp init_seq(%lx, %lx, %d, %d) = %d\n", 1606 printk("dccp init_seq(%lx, %lx, %d, %d) = %d\n",
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index 85c161845260..294e9cb0c449 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -1146,7 +1146,7 @@ static int __init rio_init(void)
1146 rio_dprintk(RIO_DEBUG_INIT, "Enabling interrupts on rio card.\n"); 1146 rio_dprintk(RIO_DEBUG_INIT, "Enabling interrupts on rio card.\n");
1147 hp->Mode |= RIO_PCI_INT_ENABLE; 1147 hp->Mode |= RIO_PCI_INT_ENABLE;
1148 } else 1148 } else
1149 hp->Mode &= !RIO_PCI_INT_ENABLE; 1149 hp->Mode &= ~RIO_PCI_INT_ENABLE;
1150 rio_dprintk(RIO_DEBUG_INIT, "New Mode: %x\n", hp->Mode); 1150 rio_dprintk(RIO_DEBUG_INIT, "New Mode: %x\n", hp->Mode);
1151 rio_start_card_running(hp); 1151 rio_start_card_running(hp);
1152 } 1152 }
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 78237577b05a..3ef593a9015f 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -1,6 +1,8 @@
1/* 1/*
2 * Sony Programmable I/O Control Device driver for VAIO 2 * Sony Programmable I/O Control Device driver for VAIO
3 * 3 *
4 * Copyright (C) 2007 Mattia Dongili <malattia@linux.it>
5 *
4 * Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net> 6 * Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net>
5 * 7 *
6 * Copyright (C) 2005 Narayanan R S <nars@kadamba.org> 8 * Copyright (C) 2005 Narayanan R S <nars@kadamba.org>
@@ -95,6 +97,11 @@ module_param(useinput, int, 0444);
95MODULE_PARM_DESC(useinput, 97MODULE_PARM_DESC(useinput,
96 "set this if you would like sonypi to feed events to the input subsystem"); 98 "set this if you would like sonypi to feed events to the input subsystem");
97 99
100static int check_ioport = 1;
101module_param(check_ioport, int, 0444);
102MODULE_PARM_DESC(check_ioport,
103 "set this to 0 if you think the automatic ioport check for sony-laptop is wrong");
104
98#define SONYPI_DEVICE_MODEL_TYPE1 1 105#define SONYPI_DEVICE_MODEL_TYPE1 1
99#define SONYPI_DEVICE_MODEL_TYPE2 2 106#define SONYPI_DEVICE_MODEL_TYPE2 2
100#define SONYPI_DEVICE_MODEL_TYPE3 3 107#define SONYPI_DEVICE_MODEL_TYPE3 3
@@ -477,7 +484,7 @@ static struct sonypi_device {
477 u16 evtype_offset; 484 u16 evtype_offset;
478 int camera_power; 485 int camera_power;
479 int bluetooth_power; 486 int bluetooth_power;
480 struct semaphore lock; 487 struct mutex lock;
481 struct kfifo *fifo; 488 struct kfifo *fifo;
482 spinlock_t fifo_lock; 489 spinlock_t fifo_lock;
483 wait_queue_head_t fifo_proc_list; 490 wait_queue_head_t fifo_proc_list;
@@ -884,7 +891,7 @@ int sonypi_camera_command(int command, u8 value)
884 if (!camera) 891 if (!camera)
885 return -EIO; 892 return -EIO;
886 893
887 down(&sonypi_device.lock); 894 mutex_lock(&sonypi_device.lock);
888 895
889 switch (command) { 896 switch (command) {
890 case SONYPI_COMMAND_SETCAMERA: 897 case SONYPI_COMMAND_SETCAMERA:
@@ -919,7 +926,7 @@ int sonypi_camera_command(int command, u8 value)
919 command); 926 command);
920 break; 927 break;
921 } 928 }
922 up(&sonypi_device.lock); 929 mutex_unlock(&sonypi_device.lock);
923 return 0; 930 return 0;
924} 931}
925 932
@@ -938,20 +945,20 @@ static int sonypi_misc_fasync(int fd, struct file *filp, int on)
938static int sonypi_misc_release(struct inode *inode, struct file *file) 945static int sonypi_misc_release(struct inode *inode, struct file *file)
939{ 946{
940 sonypi_misc_fasync(-1, file, 0); 947 sonypi_misc_fasync(-1, file, 0);
941 down(&sonypi_device.lock); 948 mutex_lock(&sonypi_device.lock);
942 sonypi_device.open_count--; 949 sonypi_device.open_count--;
943 up(&sonypi_device.lock); 950 mutex_unlock(&sonypi_device.lock);
944 return 0; 951 return 0;
945} 952}
946 953
947static int sonypi_misc_open(struct inode *inode, struct file *file) 954static int sonypi_misc_open(struct inode *inode, struct file *file)
948{ 955{
949 down(&sonypi_device.lock); 956 mutex_lock(&sonypi_device.lock);
950 /* Flush input queue on first open */ 957 /* Flush input queue on first open */
951 if (!sonypi_device.open_count) 958 if (!sonypi_device.open_count)
952 kfifo_reset(sonypi_device.fifo); 959 kfifo_reset(sonypi_device.fifo);
953 sonypi_device.open_count++; 960 sonypi_device.open_count++;
954 up(&sonypi_device.lock); 961 mutex_unlock(&sonypi_device.lock);
955 return 0; 962 return 0;
956} 963}
957 964
@@ -1001,7 +1008,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
1001 u8 val8; 1008 u8 val8;
1002 u16 val16; 1009 u16 val16;
1003 1010
1004 down(&sonypi_device.lock); 1011 mutex_lock(&sonypi_device.lock);
1005 switch (cmd) { 1012 switch (cmd) {
1006 case SONYPI_IOCGBRT: 1013 case SONYPI_IOCGBRT:
1007 if (sonypi_ec_read(SONYPI_LCD_LIGHT, &val8)) { 1014 if (sonypi_ec_read(SONYPI_LCD_LIGHT, &val8)) {
@@ -1101,7 +1108,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
1101 default: 1108 default:
1102 ret = -EINVAL; 1109 ret = -EINVAL;
1103 } 1110 }
1104 up(&sonypi_device.lock); 1111 mutex_unlock(&sonypi_device.lock);
1105 return ret; 1112 return ret;
1106} 1113}
1107 1114
@@ -1260,6 +1267,28 @@ static int __devinit sonypi_create_input_devices(void)
1260static int __devinit sonypi_setup_ioports(struct sonypi_device *dev, 1267static int __devinit sonypi_setup_ioports(struct sonypi_device *dev,
1261 const struct sonypi_ioport_list *ioport_list) 1268 const struct sonypi_ioport_list *ioport_list)
1262{ 1269{
1270 /* try to detect if sony-laptop is being used and thus
1271 * has already requested one of the known ioports.
1272 * As in the deprecated check_region this is racy has we have
1273 * multiple ioports available and one of them can be requested
1274 * between this check and the subsequent request. Anyway, as an
1275 * attempt to be some more user-friendly as we currently are,
1276 * this is enough.
1277 */
1278 const struct sonypi_ioport_list *check = ioport_list;
1279 while (check_ioport && check->port1) {
1280 if (!request_region(check->port1,
1281 sonypi_device.region_size,
1282 "Sony Programable I/O Device Check")) {
1283 printk(KERN_ERR "sonypi: ioport 0x%.4x busy, using sony-laptop? "
1284 "if not use check_ioport=0\n",
1285 check->port1);
1286 return -EBUSY;
1287 }
1288 release_region(check->port1, sonypi_device.region_size);
1289 check++;
1290 }
1291
1263 while (ioport_list->port1) { 1292 while (ioport_list->port1) {
1264 1293
1265 if (request_region(ioport_list->port1, 1294 if (request_region(ioport_list->port1,
@@ -1321,6 +1350,10 @@ static int __devinit sonypi_probe(struct platform_device *dev)
1321 struct pci_dev *pcidev; 1350 struct pci_dev *pcidev;
1322 int error; 1351 int error;
1323 1352
1353 printk(KERN_WARNING "sonypi: please try the sony-laptop module instead "
1354 "and report failures, see also "
1355 "http://www.linux.it/~malattia/wiki/index.php/Sony_drivers\n");
1356
1324 spin_lock_init(&sonypi_device.fifo_lock); 1357 spin_lock_init(&sonypi_device.fifo_lock);
1325 sonypi_device.fifo = kfifo_alloc(SONYPI_BUF_SIZE, GFP_KERNEL, 1358 sonypi_device.fifo = kfifo_alloc(SONYPI_BUF_SIZE, GFP_KERNEL,
1326 &sonypi_device.fifo_lock); 1359 &sonypi_device.fifo_lock);
@@ -1330,7 +1363,7 @@ static int __devinit sonypi_probe(struct platform_device *dev)
1330 } 1363 }
1331 1364
1332 init_waitqueue_head(&sonypi_device.fifo_proc_list); 1365 init_waitqueue_head(&sonypi_device.fifo_proc_list);
1333 init_MUTEX(&sonypi_device.lock); 1366 mutex_init(&sonypi_device.lock);
1334 sonypi_device.bluetooth_power = -1; 1367 sonypi_device.bluetooth_power = -1;
1335 1368
1336 if ((pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, 1369 if ((pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h
index aefd683c60b7..3c852009196e 100644
--- a/drivers/char/tpm/tpm_atmel.h
+++ b/drivers/char/tpm/tpm_atmel.h
@@ -53,8 +53,8 @@ static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size)
53 } 53 }
54 54
55 reg = get_property(dn, "reg", &reglen); 55 reg = get_property(dn, "reg", &reglen);
56 naddrc = prom_n_addr_cells(dn); 56 naddrc = of_n_addr_cells(dn);
57 nsizec = prom_n_size_cells(dn); 57 nsizec = of_n_size_cells(dn);
58 58
59 of_node_put(dn); 59 of_node_put(dn);
60 60
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 5289254e7ab3..7a32df594907 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1376,6 +1376,8 @@ static void do_tty_hangup(struct work_struct *work)
1376 read_unlock(&tasklist_lock); 1376 read_unlock(&tasklist_lock);
1377 1377
1378 tty->flags = 0; 1378 tty->flags = 0;
1379 put_pid(tty->session);
1380 put_pid(tty->pgrp);
1379 tty->session = NULL; 1381 tty->session = NULL;
1380 tty->pgrp = NULL; 1382 tty->pgrp = NULL;
1381 tty->ctrl_status = 0; 1383 tty->ctrl_status = 0;
@@ -1533,7 +1535,7 @@ void disassociate_ctty(int on_exit)
1533 1535
1534 spin_lock_irq(&current->sighand->siglock); 1536 spin_lock_irq(&current->sighand->siglock);
1535 tty_pgrp = current->signal->tty_old_pgrp; 1537 tty_pgrp = current->signal->tty_old_pgrp;
1536 current->signal->tty_old_pgrp = 0; 1538 current->signal->tty_old_pgrp = NULL;
1537 spin_unlock_irq(&current->sighand->siglock); 1539 spin_unlock_irq(&current->sighand->siglock);
1538 put_pid(tty_pgrp); 1540 put_pid(tty_pgrp);
1539 1541
@@ -1901,6 +1903,20 @@ static int init_dev(struct tty_driver *driver, int idx,
1901 /* check whether we're reopening an existing tty */ 1903 /* check whether we're reopening an existing tty */
1902 if (driver->flags & TTY_DRIVER_DEVPTS_MEM) { 1904 if (driver->flags & TTY_DRIVER_DEVPTS_MEM) {
1903 tty = devpts_get_tty(idx); 1905 tty = devpts_get_tty(idx);
1906 /*
1907 * If we don't have a tty here on a slave open, it's because
1908 * the master already started the close process and there's
1909 * no relation between devpts file and tty anymore.
1910 */
1911 if (!tty && driver->subtype == PTY_TYPE_SLAVE) {
1912 retval = -EIO;
1913 goto end_init;
1914 }
1915 /*
1916 * It's safe from now on because init_dev() is called with
1917 * tty_mutex held and release_dev() won't change tty->count
1918 * or tty->flags without having to grab tty_mutex
1919 */
1904 if (tty && driver->subtype == PTY_TYPE_MASTER) 1920 if (tty && driver->subtype == PTY_TYPE_MASTER)
1905 tty = tty->link; 1921 tty = tty->link;
1906 } else { 1922 } else {
@@ -3713,15 +3729,14 @@ int tty_register_driver(struct tty_driver *driver)
3713 3729
3714 if (!driver->major) { 3730 if (!driver->major) {
3715 error = alloc_chrdev_region(&dev, driver->minor_start, driver->num, 3731 error = alloc_chrdev_region(&dev, driver->minor_start, driver->num,
3716 (char*)driver->name); 3732 driver->name);
3717 if (!error) { 3733 if (!error) {
3718 driver->major = MAJOR(dev); 3734 driver->major = MAJOR(dev);
3719 driver->minor_start = MINOR(dev); 3735 driver->minor_start = MINOR(dev);
3720 } 3736 }
3721 } else { 3737 } else {
3722 dev = MKDEV(driver->major, driver->minor_start); 3738 dev = MKDEV(driver->major, driver->minor_start);
3723 error = register_chrdev_region(dev, driver->num, 3739 error = register_chrdev_region(dev, driver->num, driver->name);
3724 (char*)driver->name);
3725 } 3740 }
3726 if (error < 0) { 3741 if (error < 0) {
3727 kfree(p); 3742 kfree(p);
@@ -3828,6 +3843,9 @@ static struct pid *__proc_set_tty(struct task_struct *tsk, struct tty_struct *tt
3828{ 3843{
3829 struct pid *old_pgrp; 3844 struct pid *old_pgrp;
3830 if (tty) { 3845 if (tty) {
3846 /* We should not have a session or pgrp to here but.... */
3847 put_pid(tty->session);
3848 put_pid(tty->pgrp);
3831 tty->session = get_pid(task_session(tsk)); 3849 tty->session = get_pid(task_session(tsk));
3832 tty->pgrp = get_pid(task_pgrp(tsk)); 3850 tty->pgrp = get_pid(task_pgrp(tsk));
3833 } 3851 }
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index c3f8e383933b..1bbb45b937fd 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -724,6 +724,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
724 return -ENOMEM; 724 return -ENOMEM;
725 memset(vc, 0, sizeof(*vc)); 725 memset(vc, 0, sizeof(*vc));
726 vc_cons[currcons].d = vc; 726 vc_cons[currcons].d = vc;
727 INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
727 visual_init(vc, currcons, 1); 728 visual_init(vc, currcons, 1);
728 if (!*vc->vc_uni_pagedir_loc) 729 if (!*vc->vc_uni_pagedir_loc)
729 con_set_default_unimap(vc); 730 con_set_default_unimap(vc);
@@ -2185,10 +2186,28 @@ static void console_callback(struct work_struct *ignored)
2185 release_console_sem(); 2186 release_console_sem();
2186} 2187}
2187 2188
2188void set_console(int nr) 2189int set_console(int nr)
2189{ 2190{
2191 struct vc_data *vc = vc_cons[fg_console].d;
2192
2193 if (!vc_cons_allocated(nr) || vt_dont_switch ||
2194 (vc->vt_mode.mode == VT_AUTO && vc->vc_mode == KD_GRAPHICS)) {
2195
2196 /*
2197 * Console switch will fail in console_callback() or
2198 * change_console() so there is no point scheduling
2199 * the callback
2200 *
2201 * Existing set_console() users don't check the return
2202 * value so this shouldn't break anything
2203 */
2204 return -EINVAL;
2205 }
2206
2190 want_console = nr; 2207 want_console = nr;
2191 schedule_console_callback(); 2208 schedule_console_callback();
2209
2210 return 0;
2192} 2211}
2193 2212
2194struct tty_driver *console_driver; 2213struct tty_driver *console_driver;
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 3a5d301e783b..c9f2dd620e87 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -34,7 +34,7 @@
34#include <linux/kbd_diacr.h> 34#include <linux/kbd_diacr.h>
35#include <linux/selection.h> 35#include <linux/selection.h>
36 36
37static char vt_dont_switch; 37char vt_dont_switch;
38extern struct tty_driver *console_driver; 38extern struct tty_driver *console_driver;
39 39
40#define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count) 40#define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count)
@@ -1039,10 +1039,22 @@ int vt_waitactive(int vt)
1039 1039
1040 add_wait_queue(&vt_activate_queue, &wait); 1040 add_wait_queue(&vt_activate_queue, &wait);
1041 for (;;) { 1041 for (;;) {
1042 set_current_state(TASK_INTERRUPTIBLE);
1043 retval = 0; 1042 retval = 0;
1044 if (vt == fg_console) 1043
1044 /*
1045 * Synchronize with redraw_screen(). By acquiring the console
1046 * semaphore we make sure that the console switch is completed
1047 * before we return. If we didn't wait for the semaphore, we
1048 * could return at a point where fg_console has already been
1049 * updated, but the console switch hasn't been completed.
1050 */
1051 acquire_console_sem();
1052 set_current_state(TASK_INTERRUPTIBLE);
1053 if (vt == fg_console) {
1054 release_console_sem();
1045 break; 1055 break;
1056 }
1057 release_console_sem();
1046 retval = -EINTR; 1058 retval = -EINTR;
1047 if (signal_pending(current)) 1059 if (signal_pending(current))
1048 break; 1060 break;
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig
index ea09d0c974ea..60198a78974c 100644
--- a/drivers/char/watchdog/Kconfig
+++ b/drivers/char/watchdog/Kconfig
@@ -301,6 +301,7 @@ config I6300ESB_WDT
301config I8XX_TCO 301config I8XX_TCO
302 tristate "Intel i8xx TCO Timer/Watchdog" 302 tristate "Intel i8xx TCO Timer/Watchdog"
303 depends on WATCHDOG && (X86 || IA64) && PCI 303 depends on WATCHDOG && (X86 || IA64) && PCI
304 default n
304 ---help--- 305 ---help---
305 Hardware driver for the TCO timer built into the Intel 82801 306 Hardware driver for the TCO timer built into the Intel 82801
306 I/O Controller Hub family. The TCO (Total Cost of Ownership) 307 I/O Controller Hub family. The TCO (Total Cost of Ownership)
@@ -547,7 +548,7 @@ config MV64X60_WDT
547 depends on WATCHDOG && MV64X60 548 depends on WATCHDOG && MV64X60
548 549
549config BOOKE_WDT 550config BOOKE_WDT
550 tristate "PowerPC Book-E Watchdog Timer" 551 bool "PowerPC Book-E Watchdog Timer"
551 depends on WATCHDOG && (BOOKE || 4xx) 552 depends on WATCHDOG && (BOOKE || 4xx)
552 ---help--- 553 ---help---
553 Please see Documentation/watchdog/watchdog-api.txt for 554 Please see Documentation/watchdog/watchdog-api.txt for
diff --git a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c
index 81fb3dec180f..76c7fa37fa6c 100644
--- a/drivers/char/watchdog/machzwd.c
+++ b/drivers/char/watchdog/machzwd.c
@@ -314,21 +314,21 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
314{ 314{
315 void __user *argp = (void __user *)arg; 315 void __user *argp = (void __user *)arg;
316 int __user *p = argp; 316 int __user *p = argp;
317 switch(cmd){ 317 switch (cmd) {
318 case WDIOC_GETSUPPORT: 318 case WDIOC_GETSUPPORT:
319 if (copy_to_user(argp, &zf_info, sizeof(zf_info))) 319 if (copy_to_user(argp, &zf_info, sizeof(zf_info)))
320 return -EFAULT; 320 return -EFAULT;
321 break; 321 break;
322 322
323 case WDIOC_GETSTATUS: 323 case WDIOC_GETSTATUS:
324 return put_user(0, p); 324 return put_user(0, p);
325 325
326 case WDIOC_KEEPALIVE: 326 case WDIOC_KEEPALIVE:
327 zf_ping(NULL); 327 zf_ping(0);
328 break; 328 break;
329 329
330 default: 330 default:
331 return -ENOTTY; 331 return -ENOTTY;
332 } 332 }
333 333
334 return 0; 334 return 0;