aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/keyboard/hil_kbd.c28
-rw-r--r--drivers/input/keyboard/hilkbd.c8
-rw-r--r--drivers/input/mouse/hil_ptr.c33
-rw-r--r--drivers/input/serio/gscps2.c17
-rw-r--r--drivers/input/serio/hil_mlc.c14
-rw-r--r--drivers/input/serio/hp_sdc.c8
-rw-r--r--drivers/net/lasi_82596.c30
-rw-r--r--drivers/parisc/asp.c6
-rw-r--r--drivers/parisc/ccio-dma.c142
-rw-r--r--drivers/parisc/ccio-rm-dma.c2
-rw-r--r--drivers/parisc/dino.c42
-rw-r--r--drivers/parisc/eisa.c4
-rw-r--r--drivers/parisc/gsc.c11
-rw-r--r--drivers/parisc/hppb.c10
-rw-r--r--drivers/parisc/iosapic.c2
-rw-r--r--drivers/parisc/lasi.c4
-rw-r--r--drivers/parisc/lba_pci.c14
-rw-r--r--drivers/parisc/led.c225
-rw-r--r--drivers/parisc/pdc_stable.c2
-rw-r--r--drivers/parisc/sba_iommu.c164
-rw-r--r--drivers/parisc/superio.c3
-rw-r--r--drivers/parisc/wax.c2
-rw-r--r--drivers/parport/parport_gsc.c5
-rw-r--r--drivers/scsi/lasi700.c6
-rw-r--r--drivers/scsi/zalon.c4
-rw-r--r--drivers/serial/8250_gsc.c6
-rw-r--r--drivers/serial/mux.c11
-rw-r--r--drivers/video/console/Kconfig8
-rw-r--r--drivers/video/console/sticore.c126
29 files changed, 536 insertions, 401 deletions
diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c
index ef78bffed5e7..0a90962c38e7 100644
--- a/drivers/input/keyboard/hil_kbd.c
+++ b/drivers/input/keyboard/hil_kbd.c
@@ -204,7 +204,7 @@ static irqreturn_t hil_kbd_interrupt(struct serio *serio,
204 hil_packet packet; 204 hil_packet packet;
205 int idx; 205 int idx;
206 206
207 kbd = (struct hil_kbd *)serio->private; 207 kbd = serio_get_drvdata(serio);
208 if (kbd == NULL) { 208 if (kbd == NULL) {
209 BUG(); 209 BUG();
210 return IRQ_HANDLED; 210 return IRQ_HANDLED;
@@ -234,7 +234,7 @@ static void hil_kbd_disconnect(struct serio *serio)
234{ 234{
235 struct hil_kbd *kbd; 235 struct hil_kbd *kbd;
236 236
237 kbd = (struct hil_kbd *)serio->private; 237 kbd = serio_get_drvdata(serio);
238 if (kbd == NULL) { 238 if (kbd == NULL) {
239 BUG(); 239 BUG();
240 return; 240 return;
@@ -245,20 +245,20 @@ static void hil_kbd_disconnect(struct serio *serio)
245 kfree(kbd); 245 kfree(kbd);
246} 246}
247 247
248static void hil_kbd_connect(struct serio *serio, struct serio_driver *drv) 248static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
249{ 249{
250 struct hil_kbd *kbd; 250 struct hil_kbd *kbd;
251 uint8_t did, *idd; 251 uint8_t did, *idd;
252 int i; 252 int i;
253 253
254 if (serio->type != (SERIO_HIL_MLC | SERIO_HIL)) return; 254 kbd = kmalloc(sizeof(*kbd), GFP_KERNEL);
255 255 if (!kbd)
256 if (!(kbd = kmalloc(sizeof(struct hil_kbd), GFP_KERNEL))) return; 256 return -ENOMEM;
257 memset(kbd, 0, sizeof(struct hil_kbd)); 257 memset(kbd, 0, sizeof(struct hil_kbd));
258 258
259 if (serio_open(serio, drv)) goto bail0; 259 if (serio_open(serio, drv)) goto bail0;
260 260
261 serio->private = kbd; 261 serio_set_drvdata(serio, kbd);
262 kbd->serio = serio; 262 kbd->serio = serio;
263 kbd->dev.private = kbd; 263 kbd->dev.private = kbd;
264 264
@@ -342,19 +342,31 @@ static void hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
342 down(&(kbd->sem)); 342 down(&(kbd->sem));
343 up(&(kbd->sem)); 343 up(&(kbd->sem));
344 344
345 return; 345 return 0;
346 bail1: 346 bail1:
347 serio_close(serio); 347 serio_close(serio);
348 bail0: 348 bail0:
349 kfree(kbd); 349 kfree(kbd);
350 serio_set_drvdata(serio, NULL);
351 return -EIO;
350} 352}
351 353
354static struct serio_device_id hil_kbd_ids[] = {
355 {
356 .type = SERIO_HIL_MLC,
357 .proto = SERIO_HIL,
358 .id = SERIO_ANY,
359 .extra = SERIO_ANY,
360 },
361 { 0 }
362};
352 363
353struct serio_driver hil_kbd_serio_drv = { 364struct serio_driver hil_kbd_serio_drv = {
354 .driver = { 365 .driver = {
355 .name = "hil_kbd", 366 .name = "hil_kbd",
356 }, 367 },
357 .description = "HP HIL keyboard driver", 368 .description = "HP HIL keyboard driver",
369 .id_table = hil_kbd_ids,
358 .connect = hil_kbd_connect, 370 .connect = hil_kbd_connect,
359 .disconnect = hil_kbd_disconnect, 371 .disconnect = hil_kbd_disconnect,
360 .interrupt = hil_kbd_interrupt 372 .interrupt = hil_kbd_interrupt
diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c
index eecb77db0847..e95bc052e32a 100644
--- a/drivers/input/keyboard/hilkbd.c
+++ b/drivers/input/keyboard/hilkbd.c
@@ -22,7 +22,7 @@
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/input.h> 23#include <linux/input.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/irq.h> 25#include <linux/interrupt.h>
26#include <linux/hil.h> 26#include <linux/hil.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28 28
@@ -278,11 +278,11 @@ static int __init
278hil_init_chip(struct parisc_device *dev) 278hil_init_chip(struct parisc_device *dev)
279{ 279{
280 if (!dev->irq) { 280 if (!dev->irq) {
281 printk(KERN_WARNING "HIL: IRQ not found for HIL bus at 0x%08lx\n", dev->hpa); 281 printk(KERN_WARNING "HIL: IRQ not found for HIL bus at 0x%08lx\n", dev->hpa.start);
282 return -ENODEV; 282 return -ENODEV;
283 } 283 }
284 284
285 hil_base = dev->hpa; 285 hil_base = dev->hpa.start;
286 hil_irq = dev->irq; 286 hil_irq = dev->irq;
287 hil_dev.dev_id = dev; 287 hil_dev.dev_id = dev;
288 288
@@ -299,7 +299,7 @@ static struct parisc_device_id hil_tbl[] = {
299MODULE_DEVICE_TABLE(parisc, hil_tbl); 299MODULE_DEVICE_TABLE(parisc, hil_tbl);
300 300
301static struct parisc_driver hil_driver = { 301static struct parisc_driver hil_driver = {
302 .name = "HIL", 302 .name = "hil",
303 .id_table = hil_tbl, 303 .id_table = hil_tbl,
304 .probe = hil_init_chip, 304 .probe = hil_init_chip,
305}; 305};
diff --git a/drivers/input/mouse/hil_ptr.c b/drivers/input/mouse/hil_ptr.c
index bc22849c6c79..c2bf2ed07dc6 100644
--- a/drivers/input/mouse/hil_ptr.c
+++ b/drivers/input/mouse/hil_ptr.c
@@ -196,7 +196,7 @@ static irqreturn_t hil_ptr_interrupt(struct serio *serio,
196 hil_packet packet; 196 hil_packet packet;
197 int idx; 197 int idx;
198 198
199 ptr = (struct hil_ptr *)serio->private; 199 ptr = serio_get_drvdata(serio);
200 if (ptr == NULL) { 200 if (ptr == NULL) {
201 BUG(); 201 BUG();
202 return IRQ_HANDLED; 202 return IRQ_HANDLED;
@@ -227,7 +227,7 @@ static void hil_ptr_disconnect(struct serio *serio)
227{ 227{
228 struct hil_ptr *ptr; 228 struct hil_ptr *ptr;
229 229
230 ptr = (struct hil_ptr *)serio->private; 230 ptr = serio_get_drvdata(serio);
231 if (ptr == NULL) { 231 if (ptr == NULL) {
232 BUG(); 232 BUG();
233 return; 233 return;
@@ -238,21 +238,19 @@ static void hil_ptr_disconnect(struct serio *serio)
238 kfree(ptr); 238 kfree(ptr);
239} 239}
240 240
241static void hil_ptr_connect(struct serio *serio, struct serio_driver *driver) 241static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
242{ 242{
243 struct hil_ptr *ptr; 243 struct hil_ptr *ptr;
244 char *txt; 244 char *txt;
245 unsigned int i, naxsets, btntype; 245 unsigned int i, naxsets, btntype;
246 uint8_t did, *idd; 246 uint8_t did, *idd;
247 247
248 if (serio->type != (SERIO_HIL_MLC | SERIO_HIL)) return; 248 if (!(ptr = kmalloc(sizeof(struct hil_ptr), GFP_KERNEL))) return -ENOMEM;
249
250 if (!(ptr = kmalloc(sizeof(struct hil_ptr), GFP_KERNEL))) return;
251 memset(ptr, 0, sizeof(struct hil_ptr)); 249 memset(ptr, 0, sizeof(struct hil_ptr));
252 250
253 if (serio_open(serio, driver)) goto bail0; 251 if (serio_open(serio, driver)) goto bail0;
254 252
255 serio->private = ptr; 253 serio_set_drvdata(serio, ptr);
256 ptr->serio = serio; 254 ptr->serio = serio;
257 ptr->dev.private = ptr; 255 ptr->dev.private = ptr;
258 256
@@ -380,23 +378,34 @@ static void hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
380 (btntype == BTN_MOUSE) ? "HIL mouse":"HIL tablet or touchpad", 378 (btntype == BTN_MOUSE) ? "HIL mouse":"HIL tablet or touchpad",
381 did); 379 did);
382 380
383 return; 381 return 0;
384 bail1: 382 bail1:
385 serio_close(serio); 383 serio_close(serio);
386 bail0: 384 bail0:
387 kfree(ptr); 385 kfree(ptr);
388 return; 386 serio_set_drvdata(serio, NULL);
387 return -ENODEV;
389} 388}
390 389
390static struct serio_device_id hil_ptr_ids[] = {
391 {
392 .type = SERIO_HIL_MLC,
393 .proto = SERIO_HIL,
394 .id = SERIO_ANY,
395 .extra = SERIO_ANY,
396 },
397 { 0 }
398};
391 399
392static struct serio_driver hil_ptr_serio_driver = { 400static struct serio_driver hil_ptr_serio_driver = {
393 .driver = { 401 .driver = {
394 .name = "hil_ptr", 402 .name = "hil_ptr",
395 }, 403 },
396 .description = "HP HIL mouse/tablet driver", 404 .description = "HP HIL mouse/tablet driver",
397 .connect = hil_ptr_connect, 405 .id_table = hil_ptr_ids,
398 .disconnect = hil_ptr_disconnect, 406 .connect = hil_ptr_connect,
399 .interrupt = hil_ptr_interrupt 407 .disconnect = hil_ptr_disconnect,
408 .interrupt = hil_ptr_interrupt
400}; 409};
401 410
402static int __init hil_ptr_init(void) 411static int __init hil_ptr_init(void)
diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c
index 897e4c12b642..a7b0de0f92b2 100644
--- a/drivers/input/serio/gscps2.c
+++ b/drivers/input/serio/gscps2.c
@@ -211,9 +211,6 @@ static void gscps2_reset(struct gscps2port *ps2port)
211 writeb(0xff, addr+GSC_RESET); 211 writeb(0xff, addr+GSC_RESET);
212 gscps2_flush(ps2port); 212 gscps2_flush(ps2port);
213 spin_unlock_irqrestore(&ps2port->lock, flags); 213 spin_unlock_irqrestore(&ps2port->lock, flags);
214
215 /* enable it */
216 gscps2_enable(ps2port, ENABLE);
217} 214}
218 215
219static LIST_HEAD(ps2port_list); 216static LIST_HEAD(ps2port_list);
@@ -307,6 +304,9 @@ static int gscps2_open(struct serio *port)
307 304
308 gscps2_reset(ps2port); 305 gscps2_reset(ps2port);
309 306
307 /* enable it */
308 gscps2_enable(ps2port, ENABLE);
309
310 gscps2_interrupt(0, NULL, NULL); 310 gscps2_interrupt(0, NULL, NULL);
311 311
312 return 0; 312 return 0;
@@ -331,7 +331,7 @@ static int __init gscps2_probe(struct parisc_device *dev)
331{ 331{
332 struct gscps2port *ps2port; 332 struct gscps2port *ps2port;
333 struct serio *serio; 333 struct serio *serio;
334 unsigned long hpa = dev->hpa; 334 unsigned long hpa = dev->hpa.start;
335 int ret; 335 int ret;
336 336
337 if (!dev->irq) 337 if (!dev->irq)
@@ -370,8 +370,6 @@ static int __init gscps2_probe(struct parisc_device *dev)
370 serio->port_data = ps2port; 370 serio->port_data = ps2port;
371 serio->dev.parent = &dev->dev; 371 serio->dev.parent = &dev->dev;
372 372
373 list_add_tail(&ps2port->node, &ps2port_list);
374
375 ret = -EBUSY; 373 ret = -EBUSY;
376 if (request_irq(dev->irq, gscps2_interrupt, SA_SHIRQ, ps2port->port->name, ps2port)) 374 if (request_irq(dev->irq, gscps2_interrupt, SA_SHIRQ, ps2port->port->name, ps2port))
377 goto fail_miserably; 375 goto fail_miserably;
@@ -396,15 +394,16 @@ static int __init gscps2_probe(struct parisc_device *dev)
396 394
397 serio_register_port(ps2port->port); 395 serio_register_port(ps2port->port);
398 396
397 list_add_tail(&ps2port->node, &ps2port_list);
398
399 return 0; 399 return 0;
400 400
401fail: 401fail:
402 free_irq(dev->irq, ps2port); 402 free_irq(dev->irq, ps2port);
403 403
404fail_miserably: 404fail_miserably:
405 list_del(&ps2port->node);
406 iounmap(ps2port->addr); 405 iounmap(ps2port->addr);
407 release_mem_region(dev->hpa, GSC_STATUS + 4); 406 release_mem_region(dev->hpa.start, GSC_STATUS + 4);
408 407
409fail_nomem: 408fail_nomem:
410 kfree(ps2port); 409 kfree(ps2port);
@@ -444,7 +443,7 @@ static struct parisc_device_id gscps2_device_tbl[] = {
444}; 443};
445 444
446static struct parisc_driver parisc_ps2_driver = { 445static struct parisc_driver parisc_ps2_driver = {
447 .name = "GSC PS2", 446 .name = "gsc_ps2",
448 .id_table = gscps2_device_tbl, 447 .id_table = gscps2_device_tbl,
449 .probe = gscps2_probe, 448 .probe = gscps2_probe,
450 .remove = gscps2_remove, 449 .remove = gscps2_remove,
diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c
index c243cb6fdfc4..5704204964a3 100644
--- a/drivers/input/serio/hil_mlc.c
+++ b/drivers/input/serio/hil_mlc.c
@@ -801,7 +801,8 @@ static int hil_mlc_serio_open(struct serio *serio) {
801 struct hil_mlc_serio_map *map; 801 struct hil_mlc_serio_map *map;
802 struct hil_mlc *mlc; 802 struct hil_mlc *mlc;
803 803
804 if (serio->private != NULL) return -EBUSY; 804 if (serio_get_drvdata(serio) != NULL)
805 return -EBUSY;
805 806
806 map = serio->port_data; 807 map = serio->port_data;
807 if (map == NULL) { 808 if (map == NULL) {
@@ -832,11 +833,18 @@ static void hil_mlc_serio_close(struct serio *serio) {
832 return; 833 return;
833 } 834 }
834 835
835 serio->private = NULL; 836 serio_set_drvdata(serio, NULL);
836 serio->drv = NULL; 837 serio->drv = NULL;
837 /* TODO wake up interruptable */ 838 /* TODO wake up interruptable */
838} 839}
839 840
841static struct serio_device_id hil_mlc_serio_id = {
842 .type = SERIO_HIL_MLC,
843 .proto = SERIO_HIL,
844 .extra = SERIO_ANY,
845 .id = SERIO_ANY,
846};
847
840int hil_mlc_register(hil_mlc *mlc) { 848int hil_mlc_register(hil_mlc *mlc) {
841 int i; 849 int i;
842 unsigned long flags; 850 unsigned long flags;
@@ -867,7 +875,7 @@ int hil_mlc_register(hil_mlc *mlc) {
867 mlc_serio = kmalloc(sizeof(*mlc_serio), GFP_KERNEL); 875 mlc_serio = kmalloc(sizeof(*mlc_serio), GFP_KERNEL);
868 mlc->serio[i] = mlc_serio; 876 mlc->serio[i] = mlc_serio;
869 memset(mlc_serio, 0, sizeof(*mlc_serio)); 877 memset(mlc_serio, 0, sizeof(*mlc_serio));
870 mlc_serio->type = SERIO_HIL | SERIO_HIL_MLC; 878 mlc_serio->id = hil_mlc_serio_id;
871 mlc_serio->write = hil_mlc_serio_write; 879 mlc_serio->write = hil_mlc_serio_write;
872 mlc_serio->open = hil_mlc_serio_open; 880 mlc_serio->open = hil_mlc_serio_open;
873 mlc_serio->close = hil_mlc_serio_close; 881 mlc_serio->close = hil_mlc_serio_close;
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c
index 7629452dd64b..a10348bb25e9 100644
--- a/drivers/input/serio/hp_sdc.c
+++ b/drivers/input/serio/hp_sdc.c
@@ -764,7 +764,7 @@ MODULE_DEVICE_TABLE(parisc, hp_sdc_tbl);
764static int __init hp_sdc_init_hppa(struct parisc_device *d); 764static int __init hp_sdc_init_hppa(struct parisc_device *d);
765 765
766static struct parisc_driver hp_sdc_driver = { 766static struct parisc_driver hp_sdc_driver = {
767 .name = "HP SDC", 767 .name = "hp_sdc",
768 .id_table = hp_sdc_tbl, 768 .id_table = hp_sdc_tbl,
769 .probe = hp_sdc_init_hppa, 769 .probe = hp_sdc_init_hppa,
770}; 770};
@@ -875,9 +875,9 @@ static int __init hp_sdc_init_hppa(struct parisc_device *d)
875 hp_sdc.dev = d; 875 hp_sdc.dev = d;
876 hp_sdc.irq = d->irq; 876 hp_sdc.irq = d->irq;
877 hp_sdc.nmi = d->aux_irq; 877 hp_sdc.nmi = d->aux_irq;
878 hp_sdc.base_io = d->hpa; 878 hp_sdc.base_io = d->hpa.start;
879 hp_sdc.data_io = d->hpa + 0x800; 879 hp_sdc.data_io = d->hpa.start + 0x800;
880 hp_sdc.status_io = d->hpa + 0x801; 880 hp_sdc.status_io = d->hpa.start + 0x801;
881 881
882 return hp_sdc_init(); 882 return hp_sdc_init();
883} 883}
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
index 41bad07ac1ac..f7b7238d8352 100644
--- a/drivers/net/lasi_82596.c
+++ b/drivers/net/lasi_82596.c
@@ -415,6 +415,10 @@ static int rx_ring_size = RX_RING_SIZE;
415static int ticks_limit = 100; 415static int ticks_limit = 100;
416static int max_cmd_backlog = TX_RING_SIZE-1; 416static int max_cmd_backlog = TX_RING_SIZE-1;
417 417
418#ifdef CONFIG_NET_POLL_CONTROLLER
419static void i596_poll_controller(struct net_device *dev);
420#endif
421
418 422
419static inline void CA(struct net_device *dev) 423static inline void CA(struct net_device *dev)
420{ 424{
@@ -636,11 +640,11 @@ static int init_i596_mem(struct net_device *dev)
636 640
637 disable_irq(dev->irq); /* disable IRQs from LAN */ 641 disable_irq(dev->irq); /* disable IRQs from LAN */
638 DEB(DEB_INIT, 642 DEB(DEB_INIT,
639 printk("RESET 82596 port: %p (with IRQ %d disabled)\n", 643 printk("RESET 82596 port: %lx (with IRQ %d disabled)\n",
640 (void*)(dev->base_addr + PA_I82596_RESET), 644 (dev->base_addr + PA_I82596_RESET),
641 dev->irq)); 645 dev->irq));
642 646
643 gsc_writel(0, (void*)(dev->base_addr + PA_I82596_RESET)); /* Hard Reset */ 647 gsc_writel(0, (dev->base_addr + PA_I82596_RESET)); /* Hard Reset */
644 udelay(100); /* Wait 100us - seems to help */ 648 udelay(100); /* Wait 100us - seems to help */
645 649
646 /* change the scp address */ 650 /* change the scp address */
@@ -1209,6 +1213,9 @@ static int __devinit i82596_probe(struct net_device *dev,
1209 dev->set_multicast_list = set_multicast_list; 1213 dev->set_multicast_list = set_multicast_list;
1210 dev->tx_timeout = i596_tx_timeout; 1214 dev->tx_timeout = i596_tx_timeout;
1211 dev->watchdog_timeo = TX_TIMEOUT; 1215 dev->watchdog_timeo = TX_TIMEOUT;
1216#ifdef CONFIG_NET_POLL_CONTROLLER
1217 dev->poll_controller = i596_poll_controller;
1218#endif
1212 1219
1213 dev->priv = (void *)(dev->mem_start); 1220 dev->priv = (void *)(dev->mem_start);
1214 1221
@@ -1242,6 +1249,14 @@ static int __devinit i82596_probe(struct net_device *dev,
1242 return 0; 1249 return 0;
1243} 1250}
1244 1251
1252#ifdef CONFIG_NET_POLL_CONTROLLER
1253static void i596_poll_controller(struct net_device *dev)
1254{
1255 disable_irq(dev->irq);
1256 i596_interrupt(dev->irq, dev, NULL);
1257 enable_irq(dev->irq);
1258}
1259#endif
1245 1260
1246static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs) 1261static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1247{ 1262{
@@ -1528,17 +1543,18 @@ lan_init_chip(struct parisc_device *dev)
1528 1543
1529 if (!dev->irq) { 1544 if (!dev->irq) {
1530 printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n", 1545 printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n",
1531 __FILE__, dev->hpa); 1546 __FILE__, dev->hpa.start);
1532 return -ENODEV; 1547 return -ENODEV;
1533 } 1548 }
1534 1549
1535 printk(KERN_INFO "Found i82596 at 0x%lx, IRQ %d\n", dev->hpa, dev->irq); 1550 printk(KERN_INFO "Found i82596 at 0x%lx, IRQ %d\n", dev->hpa.start,
1551 dev->irq);
1536 1552
1537 netdevice = alloc_etherdev(0); 1553 netdevice = alloc_etherdev(0);
1538 if (!netdevice) 1554 if (!netdevice)
1539 return -ENOMEM; 1555 return -ENOMEM;
1540 1556
1541 netdevice->base_addr = dev->hpa; 1557 netdevice->base_addr = dev->hpa.start;
1542 netdevice->irq = dev->irq; 1558 netdevice->irq = dev->irq;
1543 1559
1544 retval = i82596_probe(netdevice, &dev->dev); 1560 retval = i82596_probe(netdevice, &dev->dev);
@@ -1566,7 +1582,7 @@ static struct parisc_device_id lan_tbl[] = {
1566MODULE_DEVICE_TABLE(parisc, lan_tbl); 1582MODULE_DEVICE_TABLE(parisc, lan_tbl);
1567 1583
1568static struct parisc_driver lan_driver = { 1584static struct parisc_driver lan_driver = {
1569 .name = "Apricot", 1585 .name = "lasi_82596",
1570 .id_table = lan_tbl, 1586 .id_table = lan_tbl,
1571 .probe = lan_init_chip, 1587 .probe = lan_init_chip,
1572}; 1588};
diff --git a/drivers/parisc/asp.c b/drivers/parisc/asp.c
index 388609967133..558420bc9f88 100644
--- a/drivers/parisc/asp.c
+++ b/drivers/parisc/asp.c
@@ -77,12 +77,12 @@ asp_init_chip(struct parisc_device *dev)
77 struct gsc_irq gsc_irq; 77 struct gsc_irq gsc_irq;
78 int ret; 78 int ret;
79 79
80 asp.version = gsc_readb(dev->hpa + ASP_VER_OFFSET) & 0xf; 80 asp.version = gsc_readb(dev->hpa.start + ASP_VER_OFFSET) & 0xf;
81 asp.name = (asp.version == 1) ? "Asp" : "Cutoff"; 81 asp.name = (asp.version == 1) ? "Asp" : "Cutoff";
82 asp.hpa = ASP_INTERRUPT_ADDR; 82 asp.hpa = ASP_INTERRUPT_ADDR;
83 83
84 printk(KERN_INFO "%s version %d at 0x%lx found.\n", 84 printk(KERN_INFO "%s version %d at 0x%lx found.\n",
85 asp.name, asp.version, dev->hpa); 85 asp.name, asp.version, dev->hpa.start);
86 86
87 /* the IRQ ASP should use */ 87 /* the IRQ ASP should use */
88 ret = -EBUSY; 88 ret = -EBUSY;
@@ -126,7 +126,7 @@ static struct parisc_device_id asp_tbl[] = {
126}; 126};
127 127
128struct parisc_driver asp_driver = { 128struct parisc_driver asp_driver = {
129 .name = "Asp", 129 .name = "asp",
130 .id_table = asp_tbl, 130 .id_table = asp_tbl,
131 .probe = asp_init_chip, 131 .probe = asp_init_chip,
132}; 132};
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index a3bd91a61827..9e0229f7e25f 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -100,9 +100,9 @@
100#define DBG_RUN_SG(x...) 100#define DBG_RUN_SG(x...)
101#endif 101#endif
102 102
103#define CCIO_INLINE /* inline */ 103#define CCIO_INLINE inline
104#define WRITE_U32(value, addr) gsc_writel(value, (u32 *)(addr)) 104#define WRITE_U32(value, addr) __raw_writel(value, addr)
105#define READ_U32(addr) gsc_readl((u32 *)(addr)) 105#define READ_U32(addr) __raw_readl(addr)
106 106
107#define U2_IOA_RUNWAY 0x580 107#define U2_IOA_RUNWAY 0x580
108#define U2_BC_GSC 0x501 108#define U2_BC_GSC 0x501
@@ -115,28 +115,28 @@
115 115
116struct ioa_registers { 116struct ioa_registers {
117 /* Runway Supervisory Set */ 117 /* Runway Supervisory Set */
118 volatile int32_t unused1[12]; 118 int32_t unused1[12];
119 volatile uint32_t io_command; /* Offset 12 */ 119 uint32_t io_command; /* Offset 12 */
120 volatile uint32_t io_status; /* Offset 13 */ 120 uint32_t io_status; /* Offset 13 */
121 volatile uint32_t io_control; /* Offset 14 */ 121 uint32_t io_control; /* Offset 14 */
122 volatile int32_t unused2[1]; 122 int32_t unused2[1];
123 123
124 /* Runway Auxiliary Register Set */ 124 /* Runway Auxiliary Register Set */
125 volatile uint32_t io_err_resp; /* Offset 0 */ 125 uint32_t io_err_resp; /* Offset 0 */
126 volatile uint32_t io_err_info; /* Offset 1 */ 126 uint32_t io_err_info; /* Offset 1 */
127 volatile uint32_t io_err_req; /* Offset 2 */ 127 uint32_t io_err_req; /* Offset 2 */
128 volatile uint32_t io_err_resp_hi; /* Offset 3 */ 128 uint32_t io_err_resp_hi; /* Offset 3 */
129 volatile uint32_t io_tlb_entry_m; /* Offset 4 */ 129 uint32_t io_tlb_entry_m; /* Offset 4 */
130 volatile uint32_t io_tlb_entry_l; /* Offset 5 */ 130 uint32_t io_tlb_entry_l; /* Offset 5 */
131 volatile uint32_t unused3[1]; 131 uint32_t unused3[1];
132 volatile uint32_t io_pdir_base; /* Offset 7 */ 132 uint32_t io_pdir_base; /* Offset 7 */
133 volatile uint32_t io_io_low_hv; /* Offset 8 */ 133 uint32_t io_io_low_hv; /* Offset 8 */
134 volatile uint32_t io_io_high_hv; /* Offset 9 */ 134 uint32_t io_io_high_hv; /* Offset 9 */
135 volatile uint32_t unused4[1]; 135 uint32_t unused4[1];
136 volatile uint32_t io_chain_id_mask; /* Offset 11 */ 136 uint32_t io_chain_id_mask; /* Offset 11 */
137 volatile uint32_t unused5[2]; 137 uint32_t unused5[2];
138 volatile uint32_t io_io_low; /* Offset 14 */ 138 uint32_t io_io_low; /* Offset 14 */
139 volatile uint32_t io_io_high; /* Offset 15 */ 139 uint32_t io_io_high; /* Offset 15 */
140}; 140};
141 141
142/* 142/*
@@ -226,7 +226,7 @@ struct ioa_registers {
226*/ 226*/
227 227
228struct ioc { 228struct ioc {
229 struct ioa_registers *ioc_hpa; /* I/O MMU base address */ 229 struct ioa_registers __iomem *ioc_regs; /* I/O MMU base address */
230 u8 *res_map; /* resource map, bit == pdir entry */ 230 u8 *res_map; /* resource map, bit == pdir entry */
231 u64 *pdir_base; /* physical base address */ 231 u64 *pdir_base; /* physical base address */
232 u32 pdir_size; /* bytes, function of IOV Space size */ 232 u32 pdir_size; /* bytes, function of IOV Space size */
@@ -595,7 +595,7 @@ ccio_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
595 ** Grab virtual index [0:11] 595 ** Grab virtual index [0:11]
596 ** Deposit virt_idx bits into I/O PDIR word 596 ** Deposit virt_idx bits into I/O PDIR word
597 */ 597 */
598 asm volatile ("lci 0(%%sr1, %1), %0" : "=r" (ci) : "r" (vba)); 598 asm volatile ("lci %%r0(%%sr1, %1), %0" : "=r" (ci) : "r" (vba));
599 asm volatile ("extru %1,19,12,%0" : "+r" (ci) : "r" (ci)); 599 asm volatile ("extru %1,19,12,%0" : "+r" (ci) : "r" (ci));
600 asm volatile ("depw %1,15,12,%0" : "+r" (pa) : "r" (ci)); 600 asm volatile ("depw %1,15,12,%0" : "+r" (pa) : "r" (ci));
601 601
@@ -613,7 +613,7 @@ ccio_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
613 ** the real mode coherence index generation of U2, the PDIR entry 613 ** the real mode coherence index generation of U2, the PDIR entry
614 ** must be flushed to memory to retain coherence." 614 ** must be flushed to memory to retain coherence."
615 */ 615 */
616 asm volatile("fdc 0(%0)" : : "r" (pdir_ptr)); 616 asm volatile("fdc %%r0(%0)" : : "r" (pdir_ptr));
617 asm volatile("sync"); 617 asm volatile("sync");
618} 618}
619 619
@@ -636,7 +636,7 @@ ccio_clear_io_tlb(struct ioc *ioc, dma_addr_t iovp, size_t byte_cnt)
636 byte_cnt += chain_size; 636 byte_cnt += chain_size;
637 637
638 while(byte_cnt > chain_size) { 638 while(byte_cnt > chain_size) {
639 WRITE_U32(CMD_TLB_PURGE | iovp, &ioc->ioc_hpa->io_command); 639 WRITE_U32(CMD_TLB_PURGE | iovp, &ioc->ioc_regs->io_command);
640 iovp += chain_size; 640 iovp += chain_size;
641 byte_cnt -= chain_size; 641 byte_cnt -= chain_size;
642 } 642 }
@@ -684,7 +684,7 @@ ccio_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
684 ** Hopefully someone figures out how to patch (NOP) the 684 ** Hopefully someone figures out how to patch (NOP) the
685 ** FDC/SYNC out at boot time. 685 ** FDC/SYNC out at boot time.
686 */ 686 */
687 asm volatile("fdc 0(%0)" : : "r" (pdir_ptr[7])); 687 asm volatile("fdc %%r0(%0)" : : "r" (pdir_ptr[7]));
688 688
689 iovp += IOVP_SIZE; 689 iovp += IOVP_SIZE;
690 byte_cnt -= IOVP_SIZE; 690 byte_cnt -= IOVP_SIZE;
@@ -1251,7 +1251,7 @@ static struct parisc_device_id ccio_tbl[] = {
1251static int ccio_probe(struct parisc_device *dev); 1251static int ccio_probe(struct parisc_device *dev);
1252 1252
1253static struct parisc_driver ccio_driver = { 1253static struct parisc_driver ccio_driver = {
1254 .name = "U2:Uturn", 1254 .name = "ccio",
1255 .id_table = ccio_tbl, 1255 .id_table = ccio_tbl,
1256 .probe = ccio_probe, 1256 .probe = ccio_probe,
1257}; 1257};
@@ -1314,14 +1314,13 @@ ccio_ioc_init(struct ioc *ioc)
1314 1314
1315 ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64); 1315 ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64);
1316 1316
1317 BUG_ON(ioc->pdir_size >= 4 * 1024 * 1024); /* max pdir size < 4MB */ 1317 BUG_ON(ioc->pdir_size > 8 * 1024 * 1024); /* max pdir size <= 8MB */
1318 1318
1319 /* Verify it's a power of two */ 1319 /* Verify it's a power of two */
1320 BUG_ON((1 << get_order(ioc->pdir_size)) != (ioc->pdir_size >> PAGE_SHIFT)); 1320 BUG_ON((1 << get_order(ioc->pdir_size)) != (ioc->pdir_size >> PAGE_SHIFT));
1321 1321
1322 DBG_INIT("%s() hpa 0x%lx mem %luMB IOV %dMB (%d bits)\n", 1322 DBG_INIT("%s() hpa 0x%p mem %luMB IOV %dMB (%d bits)\n",
1323 __FUNCTION__, 1323 __FUNCTION__, ioc->ioc_regs,
1324 ioc->ioc_hpa,
1325 (unsigned long) num_physpages >> (20 - PAGE_SHIFT), 1324 (unsigned long) num_physpages >> (20 - PAGE_SHIFT),
1326 iova_space_size>>20, 1325 iova_space_size>>20,
1327 iov_order + PAGE_SHIFT); 1326 iov_order + PAGE_SHIFT);
@@ -1329,13 +1328,12 @@ ccio_ioc_init(struct ioc *ioc)
1329 ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL, 1328 ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL,
1330 get_order(ioc->pdir_size)); 1329 get_order(ioc->pdir_size));
1331 if(NULL == ioc->pdir_base) { 1330 if(NULL == ioc->pdir_base) {
1332 panic("%s:%s() could not allocate I/O Page Table\n", __FILE__, 1331 panic("%s() could not allocate I/O Page Table\n", __FUNCTION__);
1333 __FUNCTION__);
1334 } 1332 }
1335 memset(ioc->pdir_base, 0, ioc->pdir_size); 1333 memset(ioc->pdir_base, 0, ioc->pdir_size);
1336 1334
1337 BUG_ON((((unsigned long)ioc->pdir_base) & PAGE_MASK) != (unsigned long)ioc->pdir_base); 1335 BUG_ON((((unsigned long)ioc->pdir_base) & PAGE_MASK) != (unsigned long)ioc->pdir_base);
1338 DBG_INIT(" base %p", ioc->pdir_base); 1336 DBG_INIT(" base %p\n", ioc->pdir_base);
1339 1337
1340 /* resource map size dictated by pdir_size */ 1338 /* resource map size dictated by pdir_size */
1341 ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3; 1339 ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3;
@@ -1344,8 +1342,7 @@ ccio_ioc_init(struct ioc *ioc)
1344 ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL, 1342 ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL,
1345 get_order(ioc->res_size)); 1343 get_order(ioc->res_size));
1346 if(NULL == ioc->res_map) { 1344 if(NULL == ioc->res_map) {
1347 panic("%s:%s() could not allocate resource map\n", __FILE__, 1345 panic("%s() could not allocate resource map\n", __FUNCTION__);
1348 __FUNCTION__);
1349 } 1346 }
1350 memset(ioc->res_map, 0, ioc->res_size); 1347 memset(ioc->res_map, 0, ioc->res_size);
1351 1348
@@ -1366,44 +1363,58 @@ ccio_ioc_init(struct ioc *ioc)
1366 ** Initialize IOA hardware 1363 ** Initialize IOA hardware
1367 */ 1364 */
1368 WRITE_U32(CCIO_CHAINID_MASK << ioc->chainid_shift, 1365 WRITE_U32(CCIO_CHAINID_MASK << ioc->chainid_shift,
1369 &ioc->ioc_hpa->io_chain_id_mask); 1366 &ioc->ioc_regs->io_chain_id_mask);
1370 1367
1371 WRITE_U32(virt_to_phys(ioc->pdir_base), 1368 WRITE_U32(virt_to_phys(ioc->pdir_base),
1372 &ioc->ioc_hpa->io_pdir_base); 1369 &ioc->ioc_regs->io_pdir_base);
1373 1370
1374 /* 1371 /*
1375 ** Go to "Virtual Mode" 1372 ** Go to "Virtual Mode"
1376 */ 1373 */
1377 WRITE_U32(IOA_NORMAL_MODE, &ioc->ioc_hpa->io_control); 1374 WRITE_U32(IOA_NORMAL_MODE, &ioc->ioc_regs->io_control);
1378 1375
1379 /* 1376 /*
1380 ** Initialize all I/O TLB entries to 0 (Valid bit off). 1377 ** Initialize all I/O TLB entries to 0 (Valid bit off).
1381 */ 1378 */
1382 WRITE_U32(0, &ioc->ioc_hpa->io_tlb_entry_m); 1379 WRITE_U32(0, &ioc->ioc_regs->io_tlb_entry_m);
1383 WRITE_U32(0, &ioc->ioc_hpa->io_tlb_entry_l); 1380 WRITE_U32(0, &ioc->ioc_regs->io_tlb_entry_l);
1384 1381
1385 for(i = 1 << CCIO_CHAINID_SHIFT; i ; i--) { 1382 for(i = 1 << CCIO_CHAINID_SHIFT; i ; i--) {
1386 WRITE_U32((CMD_TLB_DIRECT_WRITE | (i << ioc->chainid_shift)), 1383 WRITE_U32((CMD_TLB_DIRECT_WRITE | (i << ioc->chainid_shift)),
1387 &ioc->ioc_hpa->io_command); 1384 &ioc->ioc_regs->io_command);
1388 } 1385 }
1389} 1386}
1390 1387
1391static void 1388static void
1392ccio_init_resource(struct resource *res, char *name, unsigned long ioaddr) 1389ccio_init_resource(struct resource *res, char *name, void __iomem *ioaddr)
1393{ 1390{
1394 int result; 1391 int result;
1395 1392
1396 res->parent = NULL; 1393 res->parent = NULL;
1397 res->flags = IORESOURCE_MEM; 1394 res->flags = IORESOURCE_MEM;
1398 res->start = (unsigned long)(signed) __raw_readl(ioaddr) << 16; 1395 /*
1399 res->end = (unsigned long)(signed) (__raw_readl(ioaddr + 4) << 16) - 1; 1396 * bracing ((signed) ...) are required for 64bit kernel because
1397 * we only want to sign extend the lower 16 bits of the register.
1398 * The upper 16-bits of range registers are hardcoded to 0xffff.
1399 */
1400 res->start = (unsigned long)((signed) READ_U32(ioaddr) << 16);
1401 res->end = (unsigned long)((signed) (READ_U32(ioaddr + 4) << 16) - 1);
1400 res->name = name; 1402 res->name = name;
1403 /*
1404 * Check if this MMIO range is disable
1405 */
1401 if (res->end + 1 == res->start) 1406 if (res->end + 1 == res->start)
1402 return; 1407 return;
1403 result = request_resource(&iomem_resource, res); 1408
1409 /* On some platforms (e.g. K-Class), we have already registered
1410 * resources for devices reported by firmware. Some are children
1411 * of ccio.
1412 * "insert" ccio ranges in the mmio hierarchy (/proc/iomem).
1413 */
1414 result = insert_resource(&iomem_resource, res);
1404 if (result < 0) { 1415 if (result < 0) {
1405 printk(KERN_ERR "%s: failed to claim CCIO bus address space (%08lx,%08lx)\n", 1416 printk(KERN_ERR "%s() failed to claim CCIO bus address space (%08lx,%08lx)\n",
1406 __FILE__, res->start, res->end); 1417 __FUNCTION__, res->start, res->end);
1407 } 1418 }
1408} 1419}
1409 1420
@@ -1414,9 +1425,8 @@ static void __init ccio_init_resources(struct ioc *ioc)
1414 1425
1415 sprintf(name, "GSC Bus [%d/]", ioc->hw_path); 1426 sprintf(name, "GSC Bus [%d/]", ioc->hw_path);
1416 1427
1417 ccio_init_resource(res, name, (unsigned long)&ioc->ioc_hpa->io_io_low); 1428 ccio_init_resource(res, name, &ioc->ioc_regs->io_io_low);
1418 ccio_init_resource(res + 1, name, 1429 ccio_init_resource(res + 1, name, &ioc->ioc_regs->io_io_low_hv);
1419 (unsigned long)&ioc->ioc_hpa->io_io_low_hv);
1420} 1430}
1421 1431
1422static int new_ioc_area(struct resource *res, unsigned long size, 1432static int new_ioc_area(struct resource *res, unsigned long size,
@@ -1427,7 +1437,12 @@ static int new_ioc_area(struct resource *res, unsigned long size,
1427 1437
1428 res->start = (max - size + 1) &~ (align - 1); 1438 res->start = (max - size + 1) &~ (align - 1);
1429 res->end = res->start + size; 1439 res->end = res->start + size;
1430 if (!request_resource(&iomem_resource, res)) 1440
1441 /* We might be trying to expand the MMIO range to include
1442 * a child device that has already registered it's MMIO space.
1443 * Use "insert" instead of request_resource().
1444 */
1445 if (!insert_resource(&iomem_resource, res))
1431 return 0; 1446 return 0;
1432 1447
1433 return new_ioc_area(res, size, min, max - size, align); 1448 return new_ioc_area(res, size, min, max - size, align);
@@ -1486,15 +1501,15 @@ int ccio_allocate_resource(const struct parisc_device *dev,
1486 1501
1487 if (!expand_ioc_area(parent, size, min, max, align)) { 1502 if (!expand_ioc_area(parent, size, min, max, align)) {
1488 __raw_writel(((parent->start)>>16) | 0xffff0000, 1503 __raw_writel(((parent->start)>>16) | 0xffff0000,
1489 (unsigned long)&(ioc->ioc_hpa->io_io_low)); 1504 &ioc->ioc_regs->io_io_low);
1490 __raw_writel(((parent->end)>>16) | 0xffff0000, 1505 __raw_writel(((parent->end)>>16) | 0xffff0000,
1491 (unsigned long)&(ioc->ioc_hpa->io_io_high)); 1506 &ioc->ioc_regs->io_io_high);
1492 } else if (!expand_ioc_area(parent + 1, size, min, max, align)) { 1507 } else if (!expand_ioc_area(parent + 1, size, min, max, align)) {
1493 parent++; 1508 parent++;
1494 __raw_writel(((parent->start)>>16) | 0xffff0000, 1509 __raw_writel(((parent->start)>>16) | 0xffff0000,
1495 (unsigned long)&(ioc->ioc_hpa->io_io_low_hv)); 1510 &ioc->ioc_regs->io_io_low_hv);
1496 __raw_writel(((parent->end)>>16) | 0xffff0000, 1511 __raw_writel(((parent->end)>>16) | 0xffff0000,
1497 (unsigned long)&(ioc->ioc_hpa->io_io_high_hv)); 1512 &ioc->ioc_regs->io_io_high_hv);
1498 } else { 1513 } else {
1499 return -EBUSY; 1514 return -EBUSY;
1500 } 1515 }
@@ -1521,7 +1536,12 @@ int ccio_request_resource(const struct parisc_device *dev,
1521 return -EBUSY; 1536 return -EBUSY;
1522 } 1537 }
1523 1538
1524 return request_resource(parent, res); 1539 /* "transparent" bus bridges need to register MMIO resources
1540 * firmware assigned them. e.g. children of hppb.c (e.g. K-class)
1541 * registered their resources in the PDC "bus walk" (See
1542 * arch/parisc/kernel/inventory.c).
1543 */
1544 return insert_resource(parent, res);
1525} 1545}
1526 1546
1527/** 1547/**
@@ -1546,7 +1566,7 @@ static int ccio_probe(struct parisc_device *dev)
1546 1566
1547 ioc->name = dev->id.hversion == U2_IOA_RUNWAY ? "U2" : "UTurn"; 1567 ioc->name = dev->id.hversion == U2_IOA_RUNWAY ? "U2" : "UTurn";
1548 1568
1549 printk(KERN_INFO "Found %s at 0x%lx\n", ioc->name, dev->hpa); 1569 printk(KERN_INFO "Found %s at 0x%lx\n", ioc->name, dev->hpa.start);
1550 1570
1551 for (i = 0; i < ioc_count; i++) { 1571 for (i = 0; i < ioc_count; i++) {
1552 ioc_p = &(*ioc_p)->next; 1572 ioc_p = &(*ioc_p)->next;
@@ -1554,7 +1574,7 @@ static int ccio_probe(struct parisc_device *dev)
1554 *ioc_p = ioc; 1574 *ioc_p = ioc;
1555 1575
1556 ioc->hw_path = dev->hw_path; 1576 ioc->hw_path = dev->hw_path;
1557 ioc->ioc_hpa = (struct ioa_registers *)dev->hpa; 1577 ioc->ioc_regs = ioremap(dev->hpa.start, 4096);
1558 ccio_ioc_init(ioc); 1578 ccio_ioc_init(ioc);
1559 ccio_init_resources(ioc); 1579 ccio_init_resources(ioc);
1560 hppa_dma_ops = &ccio_ops; 1580 hppa_dma_ops = &ccio_ops;
diff --git a/drivers/parisc/ccio-rm-dma.c b/drivers/parisc/ccio-rm-dma.c
index 57e6385976e2..356b8357bccc 100644
--- a/drivers/parisc/ccio-rm-dma.c
+++ b/drivers/parisc/ccio-rm-dma.c
@@ -167,7 +167,7 @@ ccio_probe(struct parisc_device *dev)
167{ 167{
168 printk(KERN_INFO "%s found %s at 0x%lx\n", MODULE_NAME, 168 printk(KERN_INFO "%s found %s at 0x%lx\n", MODULE_NAME,
169 dev->id.hversion == U2_BC_GSC ? "U2" : "UTurn", 169 dev->id.hversion == U2_BC_GSC ? "U2" : "UTurn",
170 dev->hpa); 170 dev->hpa.start);
171 171
172/* 172/*
173** FIXME - should check U2 registers to verify it's really running 173** FIXME - should check U2 registers to verify it's really running
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index 2f2dbef2c3b7..5ab75334c579 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -178,6 +178,8 @@ static int dino_cfg_read(struct pci_bus *bus, unsigned int devfn, int where,
178 void __iomem *base_addr = d->hba.base_addr; 178 void __iomem *base_addr = d->hba.base_addr;
179 unsigned long flags; 179 unsigned long flags;
180 180
181 DBG("%s: %p, %d, %d, %d\n", __FUNCTION__, base_addr, devfn, where,
182 size);
181 spin_lock_irqsave(&d->dinosaur_pen, flags); 183 spin_lock_irqsave(&d->dinosaur_pen, flags);
182 184
183 /* tell HW which CFG address */ 185 /* tell HW which CFG address */
@@ -211,6 +213,8 @@ static int dino_cfg_write(struct pci_bus *bus, unsigned int devfn, int where,
211 void __iomem *base_addr = d->hba.base_addr; 213 void __iomem *base_addr = d->hba.base_addr;
212 unsigned long flags; 214 unsigned long flags;
213 215
216 DBG("%s: %p, %d, %d, %d\n", __FUNCTION__, base_addr, devfn, where,
217 size);
214 spin_lock_irqsave(&d->dinosaur_pen, flags); 218 spin_lock_irqsave(&d->dinosaur_pen, flags);
215 219
216 /* avoid address stepping feature */ 220 /* avoid address stepping feature */
@@ -295,7 +299,7 @@ static void dino_disable_irq(unsigned int irq)
295 struct dino_device *dino_dev = irq_desc[irq].handler_data; 299 struct dino_device *dino_dev = irq_desc[irq].handler_data;
296 int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, irq); 300 int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, irq);
297 301
298 DBG(KERN_WARNING "%s(0x%p, %d)\n", __FUNCTION__, irq_dev, irq); 302 DBG(KERN_WARNING "%s(0x%p, %d)\n", __FUNCTION__, dino_dev, irq);
299 303
300 /* Clear the matching bit in the IMR register */ 304 /* Clear the matching bit in the IMR register */
301 dino_dev->imr &= ~(DINO_MASK_IRQ(local_irq)); 305 dino_dev->imr &= ~(DINO_MASK_IRQ(local_irq));
@@ -308,7 +312,7 @@ static void dino_enable_irq(unsigned int irq)
308 int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, irq); 312 int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, irq);
309 u32 tmp; 313 u32 tmp;
310 314
311 DBG(KERN_WARNING "%s(0x%p, %d)\n", __FUNCTION__, irq_dev, irq); 315 DBG(KERN_WARNING "%s(0x%p, %d)\n", __FUNCTION__, dino_dev, irq);
312 316
313 /* 317 /*
314 ** clear pending IRQ bits 318 ** clear pending IRQ bits
@@ -490,7 +494,7 @@ dino_card_setup(struct pci_bus *bus, void __iomem *base_addr)
490 if (res->start == F_EXTEND(0xf0000000UL | (i * _8MB))) 494 if (res->start == F_EXTEND(0xf0000000UL | (i * _8MB)))
491 break; 495 break;
492 } 496 }
493 DBG("DINO GSC WRITE i=%d, start=%lx, dino addr = %lx\n", 497 DBG("DINO GSC WRITE i=%d, start=%lx, dino addr = %p\n",
494 i, res->start, base_addr + DINO_IO_ADDR_EN); 498 i, res->start, base_addr + DINO_IO_ADDR_EN);
495 __raw_writel(1 << i, base_addr + DINO_IO_ADDR_EN); 499 __raw_writel(1 << i, base_addr + DINO_IO_ADDR_EN);
496} 500}
@@ -683,6 +687,14 @@ static void __init
683dino_card_init(struct dino_device *dino_dev) 687dino_card_init(struct dino_device *dino_dev)
684{ 688{
685 u32 brdg_feat = 0x00784e05; 689 u32 brdg_feat = 0x00784e05;
690 unsigned long status;
691
692 status = __raw_readl(dino_dev->hba.base_addr+DINO_IO_STATUS);
693 if (status & 0x0000ff80) {
694 __raw_writel(0x00000005,
695 dino_dev->hba.base_addr+DINO_IO_COMMAND);
696 udelay(1);
697 }
686 698
687 __raw_writel(0x00000000, dino_dev->hba.base_addr+DINO_GMASK); 699 __raw_writel(0x00000000, dino_dev->hba.base_addr+DINO_GMASK);
688 __raw_writel(0x00000001, dino_dev->hba.base_addr+DINO_IO_FBB_EN); 700 __raw_writel(0x00000001, dino_dev->hba.base_addr+DINO_IO_FBB_EN);
@@ -902,15 +914,15 @@ void ccio_cujo20_fixup(struct parisc_device *dev, u32 iovp);
902** If so, initialize the chip appropriately (card-mode vs bridge mode). 914** If so, initialize the chip appropriately (card-mode vs bridge mode).
903** Much of the initialization is common though. 915** Much of the initialization is common though.
904*/ 916*/
905static int __init 917static int __init dino_probe(struct parisc_device *dev)
906dino_driver_callback(struct parisc_device *dev)
907{ 918{
908 struct dino_device *dino_dev; // Dino specific control struct 919 struct dino_device *dino_dev; // Dino specific control struct
909 const char *version = "unknown"; 920 const char *version = "unknown";
910 char *name; 921 char *name;
911 int is_cujo = 0; 922 int is_cujo = 0;
912 struct pci_bus *bus; 923 struct pci_bus *bus;
913 924 unsigned long hpa = dev->hpa.start;
925
914 name = "Dino"; 926 name = "Dino";
915 if (is_card_dino(&dev->id)) { 927 if (is_card_dino(&dev->id)) {
916 version = "3.x (card mode)"; 928 version = "3.x (card mode)";
@@ -928,11 +940,11 @@ dino_driver_callback(struct parisc_device *dev)
928 } 940 }
929 } 941 }
930 942
931 printk("%s version %s found at 0x%lx\n", name, version, dev->hpa); 943 printk("%s version %s found at 0x%lx\n", name, version, hpa);
932 944
933 if (!request_mem_region(dev->hpa, PAGE_SIZE, name)) { 945 if (!request_mem_region(hpa, PAGE_SIZE, name)) {
934 printk(KERN_ERR "DINO: Hey! Someone took my MMIO space (0x%ld)!\n", 946 printk(KERN_ERR "DINO: Hey! Someone took my MMIO space (0x%ld)!\n",
935 dev->hpa); 947 hpa);
936 return 1; 948 return 1;
937 } 949 }
938 950
@@ -940,12 +952,12 @@ dino_driver_callback(struct parisc_device *dev)
940 if (is_cujo && dev->id.hversion_rev == 1) { 952 if (is_cujo && dev->id.hversion_rev == 1) {
941#ifdef CONFIG_IOMMU_CCIO 953#ifdef CONFIG_IOMMU_CCIO
942 printk(KERN_WARNING "Enabling Cujo 2.0 bug workaround\n"); 954 printk(KERN_WARNING "Enabling Cujo 2.0 bug workaround\n");
943 if (dev->hpa == (unsigned long)CUJO_RAVEN_ADDR) { 955 if (hpa == (unsigned long)CUJO_RAVEN_ADDR) {
944 ccio_cujo20_fixup(dev, CUJO_RAVEN_BADPAGE); 956 ccio_cujo20_fixup(dev, CUJO_RAVEN_BADPAGE);
945 } else if (dev->hpa == (unsigned long)CUJO_FIREHAWK_ADDR) { 957 } else if (hpa == (unsigned long)CUJO_FIREHAWK_ADDR) {
946 ccio_cujo20_fixup(dev, CUJO_FIREHAWK_BADPAGE); 958 ccio_cujo20_fixup(dev, CUJO_FIREHAWK_BADPAGE);
947 } else { 959 } else {
948 printk("Don't recognise Cujo at address 0x%lx, not enabling workaround\n", dev->hpa); 960 printk("Don't recognise Cujo at address 0x%lx, not enabling workaround\n", hpa);
949 } 961 }
950#endif 962#endif
951 } else if (!is_cujo && !is_card_dino(&dev->id) && 963 } else if (!is_cujo && !is_card_dino(&dev->id) &&
@@ -970,7 +982,7 @@ dino_driver_callback(struct parisc_device *dev)
970 memset(dino_dev, 0, sizeof(struct dino_device)); 982 memset(dino_dev, 0, sizeof(struct dino_device));
971 983
972 dino_dev->hba.dev = dev; 984 dino_dev->hba.dev = dev;
973 dino_dev->hba.base_addr = ioremap(dev->hpa, 4096); /* faster access */ 985 dino_dev->hba.base_addr = ioremap(hpa, 4096);
974 dino_dev->hba.lmmio_space_offset = 0; /* CPU addrs == bus addrs */ 986 dino_dev->hba.lmmio_space_offset = 0; /* CPU addrs == bus addrs */
975 spin_lock_init(&dino_dev->dinosaur_pen); 987 spin_lock_init(&dino_dev->dinosaur_pen);
976 dino_dev->hba.iommu = ccio_get_iommu(dev); 988 dino_dev->hba.iommu = ccio_get_iommu(dev);
@@ -1027,9 +1039,9 @@ static struct parisc_device_id dino_tbl[] = {
1027}; 1039};
1028 1040
1029static struct parisc_driver dino_driver = { 1041static struct parisc_driver dino_driver = {
1030 .name = "Dino", 1042 .name = "dino",
1031 .id_table = dino_tbl, 1043 .id_table = dino_tbl,
1032 .probe = dino_driver_callback, 1044 .probe = dino_probe,
1033}; 1045};
1034 1046
1035/* 1047/*
diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c
index 043d47aea75b..6362bf99eff6 100644
--- a/drivers/parisc/eisa.c
+++ b/drivers/parisc/eisa.c
@@ -315,7 +315,7 @@ static int __devinit eisa_probe(struct parisc_device *dev)
315 char *name = is_mongoose(dev) ? "Mongoose" : "Wax"; 315 char *name = is_mongoose(dev) ? "Mongoose" : "Wax";
316 316
317 printk(KERN_INFO "%s EISA Adapter found at 0x%08lx\n", 317 printk(KERN_INFO "%s EISA Adapter found at 0x%08lx\n",
318 name, dev->hpa); 318 name, dev->hpa.start);
319 319
320 eisa_dev.hba.dev = dev; 320 eisa_dev.hba.dev = dev;
321 eisa_dev.hba.iommu = ccio_get_iommu(dev); 321 eisa_dev.hba.iommu = ccio_get_iommu(dev);
@@ -397,7 +397,7 @@ static struct parisc_device_id eisa_tbl[] = {
397MODULE_DEVICE_TABLE(parisc, eisa_tbl); 397MODULE_DEVICE_TABLE(parisc, eisa_tbl);
398 398
399static struct parisc_driver eisa_driver = { 399static struct parisc_driver eisa_driver = {
400 .name = "EISA Bus Adapter", 400 .name = "eisa_ba",
401 .id_table = eisa_tbl, 401 .id_table = eisa_tbl,
402 .probe = eisa_probe, 402 .probe = eisa_probe,
403}; 403};
diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c
index af5e02526a18..16d40f95978d 100644
--- a/drivers/parisc/gsc.c
+++ b/drivers/parisc/gsc.c
@@ -183,12 +183,20 @@ void gsc_asic_assign_irq(struct gsc_asic *asic, int local_irq, int *irqp)
183 *irqp = irq; 183 *irqp = irq;
184} 184}
185 185
186static struct device *next_device(struct klist_iter *i)
187{
188 struct klist_node * n = klist_next(i);
189 return n ? container_of(n, struct device, knode_parent) : NULL;
190}
191
186void gsc_fixup_irqs(struct parisc_device *parent, void *ctrl, 192void gsc_fixup_irqs(struct parisc_device *parent, void *ctrl,
187 void (*choose_irq)(struct parisc_device *, void *)) 193 void (*choose_irq)(struct parisc_device *, void *))
188{ 194{
189 struct device *dev; 195 struct device *dev;
196 struct klist_iter i;
190 197
191 list_for_each_entry(dev, &parent->dev.children, node) { 198 klist_iter_init(&parent->dev.klist_children, &i);
199 while ((dev = next_device(&i))) {
192 struct parisc_device *padev = to_parisc_device(dev); 200 struct parisc_device *padev = to_parisc_device(dev);
193 201
194 /* work-around for 715/64 and others which have parent 202 /* work-around for 715/64 and others which have parent
@@ -197,6 +205,7 @@ void gsc_fixup_irqs(struct parisc_device *parent, void *ctrl,
197 return gsc_fixup_irqs(padev, ctrl, choose_irq); 205 return gsc_fixup_irqs(padev, ctrl, choose_irq);
198 choose_irq(padev, ctrl); 206 choose_irq(padev, ctrl);
199 } 207 }
208 klist_iter_exit(&i);
200} 209}
201 210
202int gsc_common_setup(struct parisc_device *parent, struct gsc_asic *gsc_asic) 211int gsc_common_setup(struct parisc_device *parent, struct gsc_asic *gsc_asic)
diff --git a/drivers/parisc/hppb.c b/drivers/parisc/hppb.c
index e869c6020370..5edf93f80757 100644
--- a/drivers/parisc/hppb.c
+++ b/drivers/parisc/hppb.c
@@ -68,14 +68,14 @@ static int hppb_probe(struct parisc_device *dev)
68 memset(card->next, '\0', sizeof(struct hppb_card)); 68 memset(card->next, '\0', sizeof(struct hppb_card));
69 card = card->next; 69 card = card->next;
70 } 70 }
71 printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa); 71 printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa.start);
72 72
73 card->hpa = dev->hpa; 73 card->hpa = dev->hpa.start;
74 card->mmio_region.name = "HP-PB Bus"; 74 card->mmio_region.name = "HP-PB Bus";
75 card->mmio_region.flags = IORESOURCE_MEM; 75 card->mmio_region.flags = IORESOURCE_MEM;
76 76
77 card->mmio_region.start = __raw_readl(dev->hpa + IO_IO_LOW); 77 card->mmio_region.start = gsc_readl(dev->hpa.start + IO_IO_LOW);
78 card->mmio_region.end = __raw_readl(dev->hpa + IO_IO_HIGH) - 1; 78 card->mmio_region.end = gsc_readl(dev->hpa.start + IO_IO_HIGH) - 1;
79 79
80 status = ccio_request_resource(dev, &card->mmio_region); 80 status = ccio_request_resource(dev, &card->mmio_region);
81 if(status < 0) { 81 if(status < 0) {
@@ -93,7 +93,7 @@ static struct parisc_device_id hppb_tbl[] = {
93}; 93};
94 94
95static struct parisc_driver hppb_driver = { 95static struct parisc_driver hppb_driver = {
96 .name = "Gecko Boa", 96 .name = "gecko_boa",
97 .id_table = hppb_tbl, 97 .id_table = hppb_tbl,
98 .probe = hppb_probe, 98 .probe = hppb_probe,
99}; 99};
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c
index 7a57c1b8373f..a39fbfef789a 100644
--- a/drivers/parisc/iosapic.c
+++ b/drivers/parisc/iosapic.c
@@ -244,7 +244,7 @@ static struct irt_entry *iosapic_alloc_irt(int num_entries)
244 * 4-byte alignment on 32-bit kernels 244 * 4-byte alignment on 32-bit kernels
245 */ 245 */
246 a = (unsigned long)kmalloc(sizeof(struct irt_entry) * num_entries + 8, GFP_KERNEL); 246 a = (unsigned long)kmalloc(sizeof(struct irt_entry) * num_entries + 8, GFP_KERNEL);
247 a = (a + 7) & ~7; 247 a = (a + 7UL) & ~7UL;
248 return (struct irt_entry *)a; 248 return (struct irt_entry *)a;
249} 249}
250 250
diff --git a/drivers/parisc/lasi.c b/drivers/parisc/lasi.c
index cb84a4e84a2f..a8c20396ffbe 100644
--- a/drivers/parisc/lasi.c
+++ b/drivers/parisc/lasi.c
@@ -175,7 +175,7 @@ lasi_init_chip(struct parisc_device *dev)
175 return -ENOMEM; 175 return -ENOMEM;
176 176
177 lasi->name = "Lasi"; 177 lasi->name = "Lasi";
178 lasi->hpa = dev->hpa; 178 lasi->hpa = dev->hpa.start;
179 179
180 /* Check the 4-bit (yes, only 4) version register */ 180 /* Check the 4-bit (yes, only 4) version register */
181 lasi->version = gsc_readl(lasi->hpa + LASI_VER) & 0xf; 181 lasi->version = gsc_readl(lasi->hpa + LASI_VER) & 0xf;
@@ -233,7 +233,7 @@ static struct parisc_device_id lasi_tbl[] = {
233}; 233};
234 234
235struct parisc_driver lasi_driver = { 235struct parisc_driver lasi_driver = {
236 .name = "Lasi", 236 .name = "lasi",
237 .id_table = lasi_tbl, 237 .id_table = lasi_tbl,
238 .probe = lasi_init_chip, 238 .probe = lasi_init_chip,
239}; 239};
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index 7fdd80b7eb47..5e495dcbc58a 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -1288,7 +1288,7 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1288 ** Adjust "window" for this rope. 1288 ** Adjust "window" for this rope.
1289 */ 1289 */
1290 rsize /= ROPES_PER_IOC; 1290 rsize /= ROPES_PER_IOC;
1291 r->start += (rsize + 1) * LBA_NUM(pa_dev->hpa); 1291 r->start += (rsize + 1) * LBA_NUM(pa_dev->hpa.start);
1292 r->end = r->start + rsize; 1292 r->end = r->start + rsize;
1293 } else { 1293 } else {
1294 r->end = r->start = 0; /* Not enabled. */ 1294 r->end = r->start = 0; /* Not enabled. */
@@ -1458,7 +1458,7 @@ lba_driver_probe(struct parisc_device *dev)
1458 u32 func_class; 1458 u32 func_class;
1459 void *tmp_obj; 1459 void *tmp_obj;
1460 char *version; 1460 char *version;
1461 void __iomem *addr = ioremap(dev->hpa, 4096); 1461 void __iomem *addr = ioremap(dev->hpa.start, 4096);
1462 1462
1463 /* Read HW Rev First */ 1463 /* Read HW Rev First */
1464 func_class = READ_REG32(addr + LBA_FCLASS); 1464 func_class = READ_REG32(addr + LBA_FCLASS);
@@ -1476,7 +1476,7 @@ lba_driver_probe(struct parisc_device *dev)
1476 } 1476 }
1477 1477
1478 printk(KERN_INFO "%s version %s (0x%x) found at 0x%lx\n", 1478 printk(KERN_INFO "%s version %s (0x%x) found at 0x%lx\n",
1479 MODULE_NAME, version, func_class & 0xf, dev->hpa); 1479 MODULE_NAME, version, func_class & 0xf, dev->hpa.start);
1480 1480
1481 if (func_class < 2) { 1481 if (func_class < 2) {
1482 printk(KERN_WARNING "Can't support LBA older than " 1482 printk(KERN_WARNING "Can't support LBA older than "
@@ -1503,17 +1503,17 @@ lba_driver_probe(struct parisc_device *dev)
1503 * but for the mask for func_class. 1503 * but for the mask for func_class.
1504 */ 1504 */
1505 printk(KERN_INFO "%s version %s (0x%x) found at 0x%lx\n", 1505 printk(KERN_INFO "%s version %s (0x%x) found at 0x%lx\n",
1506 MODULE_NAME, version, func_class & 0xff, dev->hpa); 1506 MODULE_NAME, version, func_class & 0xff, dev->hpa.start);
1507 cfg_ops = &mercury_cfg_ops; 1507 cfg_ops = &mercury_cfg_ops;
1508 } else { 1508 } else {
1509 printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa); 1509 printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa.start);
1510 return -ENODEV; 1510 return -ENODEV;
1511 } 1511 }
1512 1512
1513 /* 1513 /*
1514 ** Tell I/O SAPIC driver we have a IRQ handler/region. 1514 ** Tell I/O SAPIC driver we have a IRQ handler/region.
1515 */ 1515 */
1516 tmp_obj = iosapic_register(dev->hpa + LBA_IOSAPIC_BASE); 1516 tmp_obj = iosapic_register(dev->hpa.start + LBA_IOSAPIC_BASE);
1517 1517
1518 /* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't 1518 /* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't
1519 ** have an IRT entry will get NULL back from iosapic code. 1519 ** have an IRT entry will get NULL back from iosapic code.
@@ -1635,7 +1635,7 @@ void __init lba_init(void)
1635*/ 1635*/
1636void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask) 1636void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask)
1637{ 1637{
1638 void __iomem * base_addr = ioremap(lba->hpa, 4096); 1638 void __iomem * base_addr = ioremap(lba->hpa.start, 4096);
1639 1639
1640 imask <<= 2; /* adjust for hints - 2 more bits */ 1640 imask <<= 2; /* adjust for hints - 2 more bits */
1641 1641
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index 286902298e33..95bd07b8b61b 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -18,6 +18,9 @@
18 * Changes: 18 * Changes:
19 * - Audit copy_from_user in led_proc_write. 19 * - Audit copy_from_user in led_proc_write.
20 * Daniele Bellucci <bellucda@tiscali.it> 20 * Daniele Bellucci <bellucda@tiscali.it>
21 * - Switch from using a tasklet to a work queue, so the led_LCD_driver
22 * can sleep.
23 * David Pye <dmp@davidmpye.dyndns.org>
21 */ 24 */
22 25
23#include <linux/config.h> 26#include <linux/config.h>
@@ -37,6 +40,7 @@
37#include <linux/proc_fs.h> 40#include <linux/proc_fs.h>
38#include <linux/ctype.h> 41#include <linux/ctype.h>
39#include <linux/blkdev.h> 42#include <linux/blkdev.h>
43#include <linux/workqueue.h>
40#include <linux/rcupdate.h> 44#include <linux/rcupdate.h>
41#include <asm/io.h> 45#include <asm/io.h>
42#include <asm/processor.h> 46#include <asm/processor.h>
@@ -47,25 +51,30 @@
47#include <asm/uaccess.h> 51#include <asm/uaccess.h>
48 52
49/* The control of the LEDs and LCDs on PARISC-machines have to be done 53/* The control of the LEDs and LCDs on PARISC-machines have to be done
50 completely in software. The necessary calculations are done in a tasklet 54 completely in software. The necessary calculations are done in a work queue
51 which is scheduled at every timer interrupt and since the calculations 55 task which is scheduled regularly, and since the calculations may consume a
52 may consume relatively much CPU-time some of the calculations can be 56 relatively large amount of CPU time, some of the calculations can be
53 turned off with the following variables (controlled via procfs) */ 57 turned off with the following variables (controlled via procfs) */
54 58
55static int led_type = -1; 59static int led_type = -1;
56static int led_heartbeat = 1; 60static unsigned char lastleds; /* LED state from most recent update */
57static int led_diskio = 1; 61static unsigned int led_heartbeat = 1;
58static int led_lanrxtx = 1; 62static unsigned int led_diskio = 1;
63static unsigned int led_lanrxtx = 1;
59static char lcd_text[32]; 64static char lcd_text[32];
60static char lcd_text_default[32]; 65static char lcd_text_default[32];
61 66
67
68static struct workqueue_struct *led_wq;
69static void led_work_func(void *);
70static DECLARE_WORK(led_task, led_work_func, NULL);
71
62#if 0 72#if 0
63#define DPRINTK(x) printk x 73#define DPRINTK(x) printk x
64#else 74#else
65#define DPRINTK(x) 75#define DPRINTK(x)
66#endif 76#endif
67 77
68
69struct lcd_block { 78struct lcd_block {
70 unsigned char command; /* stores the command byte */ 79 unsigned char command; /* stores the command byte */
71 unsigned char on; /* value for turning LED on */ 80 unsigned char on; /* value for turning LED on */
@@ -116,12 +125,27 @@ lcd_info __attribute__((aligned(8))) =
116#define LCD_DATA_REG lcd_info.lcd_data_reg_addr 125#define LCD_DATA_REG lcd_info.lcd_data_reg_addr
117#define LED_DATA_REG lcd_info.lcd_cmd_reg_addr /* LASI & ASP only */ 126#define LED_DATA_REG lcd_info.lcd_cmd_reg_addr /* LASI & ASP only */
118 127
128#define LED_HASLCD 1
129#define LED_NOLCD 0
130
131/* The workqueue must be created at init-time */
132static int start_task(void)
133{
134 /* Display the default text now */
135 if (led_type == LED_HASLCD) lcd_print( lcd_text_default );
136
137 /* Create the work queue and queue the LED task */
138 led_wq = create_singlethread_workqueue("led_wq");
139 queue_work(led_wq, &led_task);
140
141 return 0;
142}
143
144device_initcall(start_task);
119 145
120/* ptr to LCD/LED-specific function */ 146/* ptr to LCD/LED-specific function */
121static void (*led_func_ptr) (unsigned char); 147static void (*led_func_ptr) (unsigned char);
122 148
123#define LED_HASLCD 1
124#define LED_NOLCD 0
125#ifdef CONFIG_PROC_FS 149#ifdef CONFIG_PROC_FS
126static int led_proc_read(char *page, char **start, off_t off, int count, 150static int led_proc_read(char *page, char **start, off_t off, int count,
127 int *eof, void *data) 151 int *eof, void *data)
@@ -286,52 +310,35 @@ static void led_LASI_driver(unsigned char leds)
286/* 310/*
287 ** 311 **
288 ** led_LCD_driver() 312 ** led_LCD_driver()
289 **
290 ** The logic of the LCD driver is, that we write at every scheduled call
291 ** only to one of LCD_CMD_REG _or_ LCD_DATA_REG - registers.
292 ** That way we don't need to let this tasklet busywait for min_cmd_delay
293 ** milliseconds.
294 **
295 ** TODO: check the value of "min_cmd_delay" against the value of HZ.
296 ** 313 **
297 */ 314 */
298static void led_LCD_driver(unsigned char leds) 315static void led_LCD_driver(unsigned char leds)
299{ 316{
300 static int last_index; /* 0:heartbeat, 1:disk, 2:lan_in, 3:lan_out */ 317 static int i;
301 static int last_was_cmd;/* 0: CMD was written last, 1: DATA was last */ 318 static unsigned char mask[4] = { LED_HEARTBEAT, LED_DISK_IO,
302 struct lcd_block *block_ptr; 319 LED_LAN_RCV, LED_LAN_TX };
303 int value;
304
305 switch (last_index) {
306 case 0: block_ptr = &lcd_info.heartbeat;
307 value = leds & LED_HEARTBEAT;
308 break;
309 case 1: block_ptr = &lcd_info.disk_io;
310 value = leds & LED_DISK_IO;
311 break;
312 case 2: block_ptr = &lcd_info.lan_rcv;
313 value = leds & LED_LAN_RCV;
314 break;
315 case 3: block_ptr = &lcd_info.lan_tx;
316 value = leds & LED_LAN_TX;
317 break;
318 default: /* should never happen: */
319 return;
320 }
321
322 if (last_was_cmd) {
323 /* write the value to the LCD data port */
324 gsc_writeb( value ? block_ptr->on : block_ptr->off, LCD_DATA_REG );
325 } else {
326 /* write the command-byte to the LCD command register */
327 gsc_writeb( block_ptr->command, LCD_CMD_REG );
328 }
329 320
330 /* now update the vars for the next interrupt iteration */ 321 static struct lcd_block * blockp[4] = {
331 if (++last_was_cmd == 2) { /* switch between cmd & data */ 322 &lcd_info.heartbeat,
332 last_was_cmd = 0; 323 &lcd_info.disk_io,
333 if (++last_index == 4) 324 &lcd_info.lan_rcv,
334 last_index = 0; /* switch back to heartbeat index */ 325 &lcd_info.lan_tx
326 };
327
328 /* Convert min_cmd_delay to milliseconds */
329 unsigned int msec_cmd_delay = 1 + (lcd_info.min_cmd_delay / 1000);
330
331 for (i=0; i<4; ++i)
332 {
333 if ((leds & mask[i]) != (lastleds & mask[i]))
334 {
335 gsc_writeb( blockp[i]->command, LCD_CMD_REG );
336 msleep(msec_cmd_delay);
337
338 gsc_writeb( leds & mask[i] ? blockp[i]->on :
339 blockp[i]->off, LCD_DATA_REG );
340 msleep(msec_cmd_delay);
341 }
335 } 342 }
336} 343}
337 344
@@ -356,7 +363,7 @@ static __inline__ int led_get_net_activity(void)
356 363
357 rx_total = tx_total = 0; 364 rx_total = tx_total = 0;
358 365
359 /* we are running as tasklet, so locking dev_base 366 /* we are running as a workqueue task, so locking dev_base
360 * for reading should be OK */ 367 * for reading should be OK */
361 read_lock(&dev_base_lock); 368 read_lock(&dev_base_lock);
362 rcu_read_lock(); 369 rcu_read_lock();
@@ -405,7 +412,7 @@ static __inline__ int led_get_diskio_activity(void)
405 static unsigned long last_pgpgin, last_pgpgout; 412 static unsigned long last_pgpgin, last_pgpgout;
406 struct page_state pgstat; 413 struct page_state pgstat;
407 int changed; 414 int changed;
408 415
409 get_full_page_state(&pgstat); /* get no of sectors in & out */ 416 get_full_page_state(&pgstat); /* get no of sectors in & out */
410 417
411 /* Just use a very simple calculation here. Do not care about overflow, 418 /* Just use a very simple calculation here. Do not care about overflow,
@@ -413,86 +420,70 @@ static __inline__ int led_get_diskio_activity(void)
413 changed = (pgstat.pgpgin != last_pgpgin) || (pgstat.pgpgout != last_pgpgout); 420 changed = (pgstat.pgpgin != last_pgpgin) || (pgstat.pgpgout != last_pgpgout);
414 last_pgpgin = pgstat.pgpgin; 421 last_pgpgin = pgstat.pgpgin;
415 last_pgpgout = pgstat.pgpgout; 422 last_pgpgout = pgstat.pgpgout;
416 423
417 return (changed ? LED_DISK_IO : 0); 424 return (changed ? LED_DISK_IO : 0);
418} 425}
419 426
420 427
421 428
422/* 429/*
423 ** led_tasklet_func() 430 ** led_work_func()
424 ** 431 **
425 ** is scheduled at every timer interrupt from time.c and 432 ** manages when and which chassis LCD/LED gets updated
426 ** updates the chassis LCD/LED
427 433
428 TODO: 434 TODO:
429 - display load average (older machines like 715/64 have 4 "free" LED's for that) 435 - display load average (older machines like 715/64 have 4 "free" LED's for that)
430 - optimizations 436 - optimizations
431 */ 437 */
432 438
433#define HEARTBEAT_LEN (HZ*6/100) 439#define HEARTBEAT_LEN (HZ*10/100)
434#define HEARTBEAT_2ND_RANGE_START (HZ*22/100) 440#define HEARTBEAT_2ND_RANGE_START (HZ*28/100)
435#define HEARTBEAT_2ND_RANGE_END (HEARTBEAT_2ND_RANGE_START + HEARTBEAT_LEN) 441#define HEARTBEAT_2ND_RANGE_END (HEARTBEAT_2ND_RANGE_START + HEARTBEAT_LEN)
436 442
437#define NORMALIZED_COUNT(count) (count/(HZ/100)) 443#define LED_UPDATE_INTERVAL (1 + (HZ*19/1000))
438 444
439static void led_tasklet_func(unsigned long unused) 445static void led_work_func (void *unused)
440{ 446{
441 static unsigned char lastleds; 447 static unsigned long last_jiffies;
442 unsigned char currentleds; /* stores current value of the LEDs */
443 static unsigned long count; /* static incremented value, not wrapped */
444 static unsigned long count_HZ; /* counter in range 0..HZ */ 448 static unsigned long count_HZ; /* counter in range 0..HZ */
449 unsigned char currentleds = 0; /* stores current value of the LEDs */
445 450
446 /* exit if not initialized */ 451 /* exit if not initialized */
447 if (!led_func_ptr) 452 if (!led_func_ptr)
448 return; 453 return;
449 454
450 /* increment the local counters */ 455 /* increment the heartbeat timekeeper */
451 ++count; 456 count_HZ += jiffies - last_jiffies;
452 if (++count_HZ == HZ) 457 last_jiffies = jiffies;
458 if (count_HZ >= HZ)
453 count_HZ = 0; 459 count_HZ = 0;
454 460
455 currentleds = lastleds; 461 if (likely(led_heartbeat))
456
457 if (led_heartbeat)
458 {
459 /* flash heartbeat-LED like a real heart (2 x short then a long delay) */
460 if (count_HZ<HEARTBEAT_LEN ||
461 (count_HZ>=HEARTBEAT_2ND_RANGE_START && count_HZ<HEARTBEAT_2ND_RANGE_END))
462 currentleds |= LED_HEARTBEAT;
463 else
464 currentleds &= ~LED_HEARTBEAT;
465 }
466
467 /* look for network activity and flash LEDs respectively */
468 if (led_lanrxtx && ((NORMALIZED_COUNT(count)+(8/2)) & 7) == 0)
469 { 462 {
470 currentleds &= ~(LED_LAN_RCV | LED_LAN_TX); 463 /* flash heartbeat-LED like a real heart
471 currentleds |= led_get_net_activity(); 464 * (2 x short then a long delay)
465 */
466 if (count_HZ < HEARTBEAT_LEN ||
467 (count_HZ >= HEARTBEAT_2ND_RANGE_START &&
468 count_HZ < HEARTBEAT_2ND_RANGE_END))
469 currentleds |= LED_HEARTBEAT;
472 } 470 }
473 471
474 /* avoid to calculate diskio-stats at same irq as netio-stats */ 472 if (likely(led_lanrxtx)) currentleds |= led_get_net_activity();
475 if (led_diskio && (NORMALIZED_COUNT(count) & 7) == 0) 473 if (likely(led_diskio)) currentleds |= led_get_diskio_activity();
476 {
477 currentleds &= ~LED_DISK_IO;
478 currentleds |= led_get_diskio_activity();
479 }
480 474
481 /* blink all LEDs twice a second if we got an Oops (HPMC) */ 475 /* blink all LEDs twice a second if we got an Oops (HPMC) */
482 if (oops_in_progress) { 476 if (unlikely(oops_in_progress))
483 currentleds = (count_HZ<=(HZ/2)) ? 0 : 0xff; 477 currentleds = (count_HZ<=(HZ/2)) ? 0 : 0xff;
484 }
485
486 /* update the LCD/LEDs */
487 if (currentleds != lastleds) {
488 led_func_ptr(currentleds);
489 lastleds = currentleds;
490 }
491}
492 478
493/* main led tasklet struct (scheduled from time.c) */ 479 if (currentleds != lastleds)
494DECLARE_TASKLET_DISABLED(led_tasklet, led_tasklet_func, 0); 480 {
481 led_func_ptr(currentleds); /* Update the LCD/LEDs */
482 lastleds = currentleds;
483 }
495 484
485 queue_delayed_work(led_wq, &led_task, LED_UPDATE_INTERVAL);
486}
496 487
497/* 488/*
498 ** led_halt() 489 ** led_halt()
@@ -522,9 +513,13 @@ static int led_halt(struct notifier_block *nb, unsigned long event, void *buf)
522 default: return NOTIFY_DONE; 513 default: return NOTIFY_DONE;
523 } 514 }
524 515
525 /* completely stop the LED/LCD tasklet */ 516 /* Cancel the work item and delete the queue */
526 tasklet_disable(&led_tasklet); 517 if (led_wq) {
527 518 cancel_rearming_delayed_workqueue(led_wq, &led_task);
519 destroy_workqueue(led_wq);
520 led_wq = NULL;
521 }
522
528 if (lcd_info.model == DISPLAY_MODEL_LCD) 523 if (lcd_info.model == DISPLAY_MODEL_LCD)
529 lcd_print(txt); 524 lcd_print(txt);
530 else 525 else
@@ -559,7 +554,6 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d
559 printk(KERN_INFO "LCD display at %lx,%lx registered\n", 554 printk(KERN_INFO "LCD display at %lx,%lx registered\n",
560 LCD_CMD_REG , LCD_DATA_REG); 555 LCD_CMD_REG , LCD_DATA_REG);
561 led_func_ptr = led_LCD_driver; 556 led_func_ptr = led_LCD_driver;
562 lcd_print( lcd_text_default );
563 led_type = LED_HASLCD; 557 led_type = LED_HASLCD;
564 break; 558 break;
565 559
@@ -589,9 +583,11 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d
589 initialized++; 583 initialized++;
590 register_reboot_notifier(&led_notifier); 584 register_reboot_notifier(&led_notifier);
591 585
592 /* start the led tasklet for the first time */ 586 /* Ensure the work is queued */
593 tasklet_enable(&led_tasklet); 587 if (led_wq) {
594 588 queue_work(led_wq, &led_task);
589 }
590
595 return 0; 591 return 0;
596} 592}
597 593
@@ -626,8 +622,8 @@ void __init register_led_regions(void)
626 ** lcd_print() 622 ** lcd_print()
627 ** 623 **
628 ** Displays the given string on the LCD-Display of newer machines. 624 ** Displays the given string on the LCD-Display of newer machines.
629 ** lcd_print() disables the timer-based led tasklet during its 625 ** lcd_print() disables/enables the timer-based led work queue to
630 ** execution and enables it afterwards again. 626 ** avoid a race condition while writing the CMD/DATA register pair.
631 ** 627 **
632 */ 628 */
633int lcd_print( char *str ) 629int lcd_print( char *str )
@@ -637,12 +633,13 @@ int lcd_print( char *str )
637 if (!led_func_ptr || lcd_info.model != DISPLAY_MODEL_LCD) 633 if (!led_func_ptr || lcd_info.model != DISPLAY_MODEL_LCD)
638 return 0; 634 return 0;
639 635
640 /* temporarily disable the led tasklet */ 636 /* temporarily disable the led work task */
641 tasklet_disable(&led_tasklet); 637 if (led_wq)
638 cancel_rearming_delayed_workqueue(led_wq, &led_task);
642 639
643 /* copy display string to buffer for procfs */ 640 /* copy display string to buffer for procfs */
644 strlcpy(lcd_text, str, sizeof(lcd_text)); 641 strlcpy(lcd_text, str, sizeof(lcd_text));
645 642
646 /* Set LCD Cursor to 1st character */ 643 /* Set LCD Cursor to 1st character */
647 gsc_writeb(lcd_info.reset_cmd1, LCD_CMD_REG); 644 gsc_writeb(lcd_info.reset_cmd1, LCD_CMD_REG);
648 udelay(lcd_info.min_cmd_delay); 645 udelay(lcd_info.min_cmd_delay);
@@ -656,8 +653,10 @@ int lcd_print( char *str )
656 udelay(lcd_info.min_cmd_delay); 653 udelay(lcd_info.min_cmd_delay);
657 } 654 }
658 655
659 /* re-enable the led tasklet */ 656 /* re-queue the work */
660 tasklet_enable(&led_tasklet); 657 if (led_wq) {
658 queue_work(led_wq, &led_task);
659 }
661 660
662 return lcd_info.lcd_width; 661 return lcd_info.lcd_width;
663} 662}
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index 67c8f3b44848..273a74179720 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -536,7 +536,7 @@ pdcs_info_read(struct subsystem *entry, char *buf)
536 536
537 out += sprintf(out, "Memory tested: "); 537 out += sprintf(out, "Memory tested: ");
538 if ((result & 0x0F) < 0x0E) 538 if ((result & 0x0F) < 0x0E)
539 out += sprintf(out, "%.3f MB", 0.256*(1<<(result & 0x0F))); 539 out += sprintf(out, "%d kB", (1<<(result & 0x0F))*256);
540 else 540 else
541 out += sprintf(out, "All"); 541 out += sprintf(out, "All");
542 out += sprintf(out, "\n"); 542 out += sprintf(out, "\n");
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index bd8b3e5a5cd7..c85653f315aa 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -91,8 +91,8 @@ extern struct proc_dir_entry * proc_mckinley_root;
91#define DBG_RES(x...) 91#define DBG_RES(x...)
92#endif 92#endif
93 93
94#if defined(__LP64__) && !defined(CONFIG_PDC_NARROW) 94#if defined(CONFIG_64BIT)
95/* "low end" PA8800 machines use ZX1 chipset */ 95/* "low end" PA8800 machines use ZX1 chipset: PAT PDC and only run 64-bit */
96#define ZX1_SUPPORT 96#define ZX1_SUPPORT
97#endif 97#endif
98 98
@@ -231,7 +231,7 @@ struct ioc {
231 spinlock_t res_lock; 231 spinlock_t res_lock;
232 unsigned int res_bitshift; /* from the LEFT! */ 232 unsigned int res_bitshift; /* from the LEFT! */
233 unsigned int res_size; /* size of resource map in bytes */ 233 unsigned int res_size; /* size of resource map in bytes */
234#if SBA_HINT_SUPPORT 234#ifdef SBA_HINT_SUPPORT
235/* FIXME : DMA HINTs not used */ 235/* FIXME : DMA HINTs not used */
236 unsigned long hint_mask_pdir; /* bits used for DMA hints */ 236 unsigned long hint_mask_pdir; /* bits used for DMA hints */
237 unsigned int hint_shift_pdir; 237 unsigned int hint_shift_pdir;
@@ -294,7 +294,7 @@ static unsigned long piranha_bad_128k = 0;
294/* Looks nice and keeps the compiler happy */ 294/* Looks nice and keeps the compiler happy */
295#define SBA_DEV(d) ((struct sba_device *) (d)) 295#define SBA_DEV(d) ((struct sba_device *) (d))
296 296
297#if SBA_AGP_SUPPORT 297#ifdef SBA_AGP_SUPPORT
298static int reserve_sba_gart = 1; 298static int reserve_sba_gart = 1;
299#endif 299#endif
300 300
@@ -314,7 +314,7 @@ static int reserve_sba_gart = 1;
314#define WRITE_REG32(val, addr) __raw_writel(cpu_to_le32(val), addr) 314#define WRITE_REG32(val, addr) __raw_writel(cpu_to_le32(val), addr)
315#define WRITE_REG64(val, addr) __raw_writeq(cpu_to_le64(val), addr) 315#define WRITE_REG64(val, addr) __raw_writeq(cpu_to_le64(val), addr)
316 316
317#ifdef __LP64__ 317#ifdef CONFIG_64BIT
318#define READ_REG(addr) READ_REG64(addr) 318#define READ_REG(addr) READ_REG64(addr)
319#define WRITE_REG(value, addr) WRITE_REG64(value, addr) 319#define WRITE_REG(value, addr) WRITE_REG64(value, addr)
320#else 320#else
@@ -324,7 +324,7 @@ static int reserve_sba_gart = 1;
324 324
325#ifdef DEBUG_SBA_INIT 325#ifdef DEBUG_SBA_INIT
326 326
327/* NOTE: When __LP64__ isn't defined, READ_REG64() is two 32-bit reads */ 327/* NOTE: When CONFIG_64BIT isn't defined, READ_REG64() is two 32-bit reads */
328 328
329/** 329/**
330 * sba_dump_ranges - debugging only - print ranges assigned to this IOA 330 * sba_dump_ranges - debugging only - print ranges assigned to this IOA
@@ -364,7 +364,7 @@ static void sba_dump_tlb(void __iomem *hpa)
364#else 364#else
365#define sba_dump_ranges(x) 365#define sba_dump_ranges(x)
366#define sba_dump_tlb(x) 366#define sba_dump_tlb(x)
367#endif 367#endif /* DEBUG_SBA_INIT */
368 368
369 369
370#ifdef ASSERT_PDIR_SANITY 370#ifdef ASSERT_PDIR_SANITY
@@ -674,7 +674,7 @@ sba_free_range(struct ioc *ioc, dma_addr_t iova, size_t size)
674* 674*
675***************************************************************/ 675***************************************************************/
676 676
677#if SBA_HINT_SUPPORT 677#ifdef SBA_HINT_SUPPORT
678#define SBA_DMA_HINT(ioc, val) ((val) << (ioc)->hint_shift_pdir) 678#define SBA_DMA_HINT(ioc, val) ((val) << (ioc)->hint_shift_pdir)
679#endif 679#endif
680 680
@@ -743,9 +743,8 @@ sba_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
743 * (bit #61, big endian), we have to flush and sync every time 743 * (bit #61, big endian), we have to flush and sync every time
744 * IO-PDIR is changed in Ike/Astro. 744 * IO-PDIR is changed in Ike/Astro.
745 */ 745 */
746 if (ioc_needs_fdc) { 746 if (ioc_needs_fdc)
747 asm volatile("fdc 0(%%sr1,%0)\n\tsync" : : "r" (pdir_ptr)); 747 asm volatile("fdc %%r0(%0)" : : "r" (pdir_ptr));
748 }
749} 748}
750 749
751 750
@@ -769,42 +768,57 @@ static SBA_INLINE void
769sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt) 768sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
770{ 769{
771 u32 iovp = (u32) SBA_IOVP(ioc,iova); 770 u32 iovp = (u32) SBA_IOVP(ioc,iova);
772 771 u64 *pdir_ptr = &ioc->pdir_base[PDIR_INDEX(iovp)];
773 /* Even though this is a big-endian machine, the entries
774 ** in the iopdir are little endian. That's why we clear the byte
775 ** at +7 instead of at +0.
776 */
777 int off = PDIR_INDEX(iovp)*sizeof(u64)+7;
778 772
779#ifdef ASSERT_PDIR_SANITY 773#ifdef ASSERT_PDIR_SANITY
780 /* Assert first pdir entry is set */ 774 /* Assert first pdir entry is set.
781 if (0x80 != (((u8 *) ioc->pdir_base)[off])) { 775 **
776 ** Even though this is a big-endian machine, the entries
777 ** in the iopdir are little endian. That's why we look at
778 ** the byte at +7 instead of at +0.
779 */
780 if (0x80 != (((u8 *) pdir_ptr)[7])) {
782 sba_dump_pdir_entry(ioc,"sba_mark_invalid()", PDIR_INDEX(iovp)); 781 sba_dump_pdir_entry(ioc,"sba_mark_invalid()", PDIR_INDEX(iovp));
783 } 782 }
784#endif 783#endif
785 784
786 if (byte_cnt <= IOVP_SIZE) 785 if (byte_cnt > IOVP_SIZE)
787 { 786 {
788 iovp |= IOVP_SHIFT; /* set "size" field for PCOM */ 787#if 0
788 unsigned long entries_per_cacheline = ioc_needs_fdc ?
789 L1_CACHE_ALIGN(((unsigned long) pdir_ptr))
790 - (unsigned long) pdir_ptr;
791 : 262144;
792#endif
789 793
790 /* 794 /* set "size" field for PCOM */
791 ** clear I/O PDIR entry "valid" bit 795 iovp |= get_order(byte_cnt) + PAGE_SHIFT;
792 ** Do NOT clear the rest - save it for debugging.
793 ** We should only clear bits that have previously
794 ** been enabled.
795 */
796 ((u8 *)(ioc->pdir_base))[off] = 0;
797 } else {
798 u32 t = get_order(byte_cnt) + PAGE_SHIFT;
799 796
800 iovp |= t;
801 do { 797 do {
802 /* clear I/O Pdir entry "valid" bit first */ 798 /* clear I/O Pdir entry "valid" bit first */
803 ((u8 *)(ioc->pdir_base))[off] = 0; 799 ((u8 *) pdir_ptr)[7] = 0;
804 off += sizeof(u64); 800 if (ioc_needs_fdc) {
801 asm volatile("fdc %%r0(%0)" : : "r" (pdir_ptr));
802#if 0
803 entries_per_cacheline = L1_CACHE_SHIFT - 3;
804#endif
805 }
806 pdir_ptr++;
805 byte_cnt -= IOVP_SIZE; 807 byte_cnt -= IOVP_SIZE;
806 } while (byte_cnt > 0); 808 } while (byte_cnt > IOVP_SIZE);
807 } 809 } else
810 iovp |= IOVP_SHIFT; /* set "size" field for PCOM */
811
812 /*
813 ** clear I/O PDIR entry "valid" bit.
814 ** We have to R/M/W the cacheline regardless how much of the
815 ** pdir entry that we clobber.
816 ** The rest of the entry would be useful for debugging if we
817 ** could dump core on HPMC.
818 */
819 ((u8 *) pdir_ptr)[7] = 0;
820 if (ioc_needs_fdc)
821 asm volatile("fdc %%r0(%0)" : : "r" (pdir_ptr));
808 822
809 WRITE_REG( SBA_IOVA(ioc, iovp, 0, 0), ioc->ioc_hpa+IOC_PCOM); 823 WRITE_REG( SBA_IOVA(ioc, iovp, 0, 0), ioc->ioc_hpa+IOC_PCOM);
810} 824}
@@ -819,18 +833,29 @@ sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
819static int sba_dma_supported( struct device *dev, u64 mask) 833static int sba_dma_supported( struct device *dev, u64 mask)
820{ 834{
821 struct ioc *ioc; 835 struct ioc *ioc;
836
822 if (dev == NULL) { 837 if (dev == NULL) {
823 printk(KERN_ERR MODULE_NAME ": EISA/ISA/et al not supported\n"); 838 printk(KERN_ERR MODULE_NAME ": EISA/ISA/et al not supported\n");
824 BUG(); 839 BUG();
825 return(0); 840 return(0);
826 } 841 }
827 842
828 ioc = GET_IOC(dev); 843 /* Documentation/DMA-mapping.txt tells drivers to try 64-bit first,
844 * then fall back to 32-bit if that fails.
845 * We are just "encouraging" 32-bit DMA masks here since we can
846 * never allow IOMMU bypass unless we add special support for ZX1.
847 */
848 if (mask > ~0U)
849 return 0;
829 850
830 /* check if mask is > than the largest IO Virt Address */ 851 ioc = GET_IOC(dev);
831 852
832 return((int) (mask >= (ioc->ibase + 853 /*
833 (ioc->pdir_size / sizeof(u64) * IOVP_SIZE) ))); 854 * check if mask is >= than the current max IO Virt Address
855 * The max IO Virt address will *always* < 30 bits.
856 */
857 return((int)(mask >= (ioc->ibase - 1 +
858 (ioc->pdir_size / sizeof(u64) * IOVP_SIZE) )));
834} 859}
835 860
836 861
@@ -898,11 +923,17 @@ sba_map_single(struct device *dev, void *addr, size_t size,
898 size -= IOVP_SIZE; 923 size -= IOVP_SIZE;
899 pdir_start++; 924 pdir_start++;
900 } 925 }
901 /* form complete address */ 926
927 /* force FDC ops in io_pdir_entry() to be visible to IOMMU */
928 if (ioc_needs_fdc)
929 asm volatile("sync" : : );
930
902#ifdef ASSERT_PDIR_SANITY 931#ifdef ASSERT_PDIR_SANITY
903 sba_check_pdir(ioc,"Check after sba_map_single()"); 932 sba_check_pdir(ioc,"Check after sba_map_single()");
904#endif 933#endif
905 spin_unlock_irqrestore(&ioc->res_lock, flags); 934 spin_unlock_irqrestore(&ioc->res_lock, flags);
935
936 /* form complete address */
906 return SBA_IOVA(ioc, iovp, offset, DEFAULT_DMA_HINT_REG); 937 return SBA_IOVA(ioc, iovp, offset, DEFAULT_DMA_HINT_REG);
907} 938}
908 939
@@ -958,12 +989,19 @@ sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
958 d--; 989 d--;
959 } 990 }
960 ioc->saved_cnt = 0; 991 ioc->saved_cnt = 0;
992
961 READ_REG(ioc->ioc_hpa+IOC_PCOM); /* flush purges */ 993 READ_REG(ioc->ioc_hpa+IOC_PCOM); /* flush purges */
962 } 994 }
963#else /* DELAYED_RESOURCE_CNT == 0 */ 995#else /* DELAYED_RESOURCE_CNT == 0 */
964 sba_free_range(ioc, iova, size); 996 sba_free_range(ioc, iova, size);
997
998 /* If fdc's were issued, force fdc's to be visible now */
999 if (ioc_needs_fdc)
1000 asm volatile("sync" : : );
1001
965 READ_REG(ioc->ioc_hpa+IOC_PCOM); /* flush purges */ 1002 READ_REG(ioc->ioc_hpa+IOC_PCOM); /* flush purges */
966#endif /* DELAYED_RESOURCE_CNT == 0 */ 1003#endif /* DELAYED_RESOURCE_CNT == 0 */
1004
967 spin_unlock_irqrestore(&ioc->res_lock, flags); 1005 spin_unlock_irqrestore(&ioc->res_lock, flags);
968 1006
969 /* XXX REVISIT for 2.5 Linux - need syncdma for zero-copy support. 1007 /* XXX REVISIT for 2.5 Linux - need syncdma for zero-copy support.
@@ -1106,6 +1144,10 @@ sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
1106 */ 1144 */
1107 filled = iommu_fill_pdir(ioc, sglist, nents, 0, sba_io_pdir_entry); 1145 filled = iommu_fill_pdir(ioc, sglist, nents, 0, sba_io_pdir_entry);
1108 1146
1147 /* force FDC ops in io_pdir_entry() to be visible to IOMMU */
1148 if (ioc_needs_fdc)
1149 asm volatile("sync" : : );
1150
1109#ifdef ASSERT_PDIR_SANITY 1151#ifdef ASSERT_PDIR_SANITY
1110 if (sba_check_pdir(ioc,"Check after sba_map_sg()")) 1152 if (sba_check_pdir(ioc,"Check after sba_map_sg()"))
1111 { 1153 {
@@ -1234,8 +1276,10 @@ sba_alloc_pdir(unsigned int pdir_size)
1234 unsigned long pdir_order = get_order(pdir_size); 1276 unsigned long pdir_order = get_order(pdir_size);
1235 1277
1236 pdir_base = __get_free_pages(GFP_KERNEL, pdir_order); 1278 pdir_base = __get_free_pages(GFP_KERNEL, pdir_order);
1237 if (NULL == (void *) pdir_base) 1279 if (NULL == (void *) pdir_base) {
1238 panic("sba_ioc_init() could not allocate I/O Page Table\n"); 1280 panic("%s() could not allocate I/O Page Table\n",
1281 __FUNCTION__);
1282 }
1239 1283
1240 /* If this is not PA8700 (PCX-W2) 1284 /* If this is not PA8700 (PCX-W2)
1241 ** OR newer than ver 2.2 1285 ** OR newer than ver 2.2
@@ -1322,19 +1366,29 @@ sba_alloc_pdir(unsigned int pdir_size)
1322 return (void *) pdir_base; 1366 return (void *) pdir_base;
1323} 1367}
1324 1368
1369static struct device *next_device(struct klist_iter *i)
1370{
1371 struct klist_node * n = klist_next(i);
1372 return n ? container_of(n, struct device, knode_parent) : NULL;
1373}
1374
1325/* setup Mercury or Elroy IBASE/IMASK registers. */ 1375/* setup Mercury or Elroy IBASE/IMASK registers. */
1326static void setup_ibase_imask(struct parisc_device *sba, struct ioc *ioc, int ioc_num) 1376static void
1377setup_ibase_imask(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1327{ 1378{
1328 /* lba_set_iregs() is in drivers/parisc/lba_pci.c */ 1379 /* lba_set_iregs() is in drivers/parisc/lba_pci.c */
1329 extern void lba_set_iregs(struct parisc_device *, u32, u32); 1380 extern void lba_set_iregs(struct parisc_device *, u32, u32);
1330 struct device *dev; 1381 struct device *dev;
1382 struct klist_iter i;
1331 1383
1332 list_for_each_entry(dev, &sba->dev.children, node) { 1384 klist_iter_init(&sba->dev.klist_children, &i);
1385 while ((dev = next_device(&i))) {
1333 struct parisc_device *lba = to_parisc_device(dev); 1386 struct parisc_device *lba = to_parisc_device(dev);
1334 int rope_num = (lba->hpa >> 13) & 0xf; 1387 int rope_num = (lba->hpa.start >> 13) & 0xf;
1335 if (rope_num >> 3 == ioc_num) 1388 if (rope_num >> 3 == ioc_num)
1336 lba_set_iregs(lba, ioc->ibase, ioc->imask); 1389 lba_set_iregs(lba, ioc->ibase, ioc->imask);
1337 } 1390 }
1391 klist_iter_exit(&i);
1338} 1392}
1339 1393
1340static void 1394static void
@@ -1343,7 +1397,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1343 u32 iova_space_mask; 1397 u32 iova_space_mask;
1344 u32 iova_space_size; 1398 u32 iova_space_size;
1345 int iov_order, tcnfg; 1399 int iov_order, tcnfg;
1346#if SBA_AGP_SUPPORT 1400#ifdef SBA_AGP_SUPPORT
1347 int agp_found = 0; 1401 int agp_found = 0;
1348#endif 1402#endif
1349 /* 1403 /*
@@ -1380,7 +1434,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1380 DBG_INIT("%s() pdir %p size %x\n", 1434 DBG_INIT("%s() pdir %p size %x\n",
1381 __FUNCTION__, ioc->pdir_base, ioc->pdir_size); 1435 __FUNCTION__, ioc->pdir_base, ioc->pdir_size);
1382 1436
1383#if SBA_HINT_SUPPORT 1437#ifdef SBA_HINT_SUPPORT
1384 ioc->hint_shift_pdir = iov_order + PAGE_SHIFT; 1438 ioc->hint_shift_pdir = iov_order + PAGE_SHIFT;
1385 ioc->hint_mask_pdir = ~(0x3 << (iov_order + PAGE_SHIFT)); 1439 ioc->hint_mask_pdir = ~(0x3 << (iov_order + PAGE_SHIFT));
1386 1440
@@ -1404,7 +1458,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1404 1458
1405 WRITE_REG(ioc->imask, ioc->ioc_hpa + IOC_IMASK); 1459 WRITE_REG(ioc->imask, ioc->ioc_hpa + IOC_IMASK);
1406 1460
1407#ifdef __LP64__ 1461#ifdef CONFIG_64BIT
1408 /* 1462 /*
1409 ** Setting the upper bits makes checking for bypass addresses 1463 ** Setting the upper bits makes checking for bypass addresses
1410 ** a little faster later on. 1464 ** a little faster later on.
@@ -1437,7 +1491,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1437 */ 1491 */
1438 WRITE_REG(ioc->ibase | 31, ioc->ioc_hpa + IOC_PCOM); 1492 WRITE_REG(ioc->ibase | 31, ioc->ioc_hpa + IOC_PCOM);
1439 1493
1440#if SBA_AGP_SUPPORT 1494#ifdef SBA_AGP_SUPPORT
1441 /* 1495 /*
1442 ** If an AGP device is present, only use half of the IOV space 1496 ** If an AGP device is present, only use half of the IOV space
1443 ** for PCI DMA. Unfortunately we can't know ahead of time 1497 ** for PCI DMA. Unfortunately we can't know ahead of time
@@ -1489,11 +1543,9 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1489 if (iova_space_size < (1 << (20 - PAGE_SHIFT))) { 1543 if (iova_space_size < (1 << (20 - PAGE_SHIFT))) {
1490 iova_space_size = 1 << (20 - PAGE_SHIFT); 1544 iova_space_size = 1 << (20 - PAGE_SHIFT);
1491 } 1545 }
1492#ifdef __LP64__
1493 else if (iova_space_size > (1 << (30 - PAGE_SHIFT))) { 1546 else if (iova_space_size > (1 << (30 - PAGE_SHIFT))) {
1494 iova_space_size = 1 << (30 - PAGE_SHIFT); 1547 iova_space_size = 1 << (30 - PAGE_SHIFT);
1495 } 1548 }
1496#endif
1497 1549
1498 /* 1550 /*
1499 ** iova space must be log2() in size. 1551 ** iova space must be log2() in size.
@@ -1519,7 +1571,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1519 DBG_INIT("%s() pdir %p size %x\n", 1571 DBG_INIT("%s() pdir %p size %x\n",
1520 __FUNCTION__, ioc->pdir_base, pdir_size); 1572 __FUNCTION__, ioc->pdir_base, pdir_size);
1521 1573
1522#if SBA_HINT_SUPPORT 1574#ifdef SBA_HINT_SUPPORT
1523 /* FIXME : DMA HINTs not used */ 1575 /* FIXME : DMA HINTs not used */
1524 ioc->hint_shift_pdir = iov_order + PAGE_SHIFT; 1576 ioc->hint_shift_pdir = iov_order + PAGE_SHIFT;
1525 ioc->hint_mask_pdir = ~(0x3 << (iov_order + PAGE_SHIFT)); 1577 ioc->hint_mask_pdir = ~(0x3 << (iov_order + PAGE_SHIFT));
@@ -1590,7 +1642,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1590 1642
1591static void __iomem *ioc_remap(struct sba_device *sba_dev, int offset) 1643static void __iomem *ioc_remap(struct sba_device *sba_dev, int offset)
1592{ 1644{
1593 return ioremap(sba_dev->dev->hpa + offset, SBA_FUNC_SIZE); 1645 return ioremap(sba_dev->dev->hpa.start + offset, SBA_FUNC_SIZE);
1594} 1646}
1595 1647
1596static void sba_hw_init(struct sba_device *sba_dev) 1648static void sba_hw_init(struct sba_device *sba_dev)
@@ -1968,7 +2020,7 @@ sba_driver_callback(struct parisc_device *dev)
1968 u32 func_class; 2020 u32 func_class;
1969 int i; 2021 int i;
1970 char *version; 2022 char *version;
1971 void __iomem *sba_addr = ioremap(dev->hpa, SBA_FUNC_SIZE); 2023 void __iomem *sba_addr = ioremap(dev->hpa.start, SBA_FUNC_SIZE);
1972 2024
1973 sba_dump_ranges(sba_addr); 2025 sba_dump_ranges(sba_addr);
1974 2026
@@ -2010,7 +2062,7 @@ sba_driver_callback(struct parisc_device *dev)
2010 } 2062 }
2011 2063
2012 printk(KERN_INFO "%s found %s at 0x%lx\n", 2064 printk(KERN_INFO "%s found %s at 0x%lx\n",
2013 MODULE_NAME, version, dev->hpa); 2065 MODULE_NAME, version, dev->hpa.start);
2014 2066
2015 sba_dev = kmalloc(sizeof(struct sba_device), GFP_KERNEL); 2067 sba_dev = kmalloc(sizeof(struct sba_device), GFP_KERNEL);
2016 if (!sba_dev) { 2068 if (!sba_dev) {
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index e0efed796b92..bab3bcabcb6e 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -11,6 +11,7 @@
11 * (C) Copyright 2000 Alex deVries <alex@onefishtwo.ca> 11 * (C) Copyright 2000 Alex deVries <alex@onefishtwo.ca>
12 * (C) Copyright 2001 John Marvin <jsm fc hp com> 12 * (C) Copyright 2001 John Marvin <jsm fc hp com>
13 * (C) Copyright 2003 Grant Grundler <grundler parisc-linux org> 13 * (C) Copyright 2003 Grant Grundler <grundler parisc-linux org>
14 * (C) Copyright 2005 Kyle McMartin <kyle@parisc-linux.org>
14 * 15 *
15 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as 17 * modify it under the terms of the GNU General Public License as
@@ -405,6 +406,7 @@ static void __devinit superio_serial_init(void)
405 406
406 serial[0].iobase = sio_dev.sp1_base; 407 serial[0].iobase = sio_dev.sp1_base;
407 serial[0].irq = SP1_IRQ; 408 serial[0].irq = SP1_IRQ;
409 spin_lock_init(&serial[0].lock);
408 410
409 retval = early_serial_setup(&serial[0]); 411 retval = early_serial_setup(&serial[0]);
410 if (retval < 0) { 412 if (retval < 0) {
@@ -414,6 +416,7 @@ static void __devinit superio_serial_init(void)
414 416
415 serial[1].iobase = sio_dev.sp2_base; 417 serial[1].iobase = sio_dev.sp2_base;
416 serial[1].irq = SP2_IRQ; 418 serial[1].irq = SP2_IRQ;
419 spin_lock_init(&serial[1].lock);
417 retval = early_serial_setup(&serial[1]); 420 retval = early_serial_setup(&serial[1]);
418 421
419 if (retval < 0) 422 if (retval < 0)
diff --git a/drivers/parisc/wax.c b/drivers/parisc/wax.c
index e547d7d024d8..17dce2adf7fe 100644
--- a/drivers/parisc/wax.c
+++ b/drivers/parisc/wax.c
@@ -81,7 +81,7 @@ wax_init_chip(struct parisc_device *dev)
81 return -ENOMEM; 81 return -ENOMEM;
82 82
83 wax->name = "wax"; 83 wax->name = "wax";
84 wax->hpa = dev->hpa; 84 wax->hpa = dev->hpa.start;
85 85
86 wax->version = 0; /* gsc_readb(wax->hpa+WAX_VER); */ 86 wax->version = 0; /* gsc_readb(wax->hpa+WAX_VER); */
87 printk(KERN_INFO "%s at 0x%lx found.\n", wax->name, wax->hpa); 87 printk(KERN_INFO "%s at 0x%lx found.\n", wax->name, wax->hpa);
diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
index 02d72acd1c89..fde29a75f888 100644
--- a/drivers/parport/parport_gsc.c
+++ b/drivers/parport/parport_gsc.c
@@ -359,11 +359,12 @@ static int __devinit parport_init_chip(struct parisc_device *dev)
359 unsigned long port; 359 unsigned long port;
360 360
361 if (!dev->irq) { 361 if (!dev->irq) {
362 printk("IRQ not found for parallel device at 0x%lx\n", dev->hpa); 362 printk(KERN_WARNING "IRQ not found for parallel device at 0x%lx\n",
363 dev->hpa.start);
363 return -ENODEV; 364 return -ENODEV;
364 } 365 }
365 366
366 port = dev->hpa + PARPORT_GSC_OFFSET; 367 port = dev->hpa.start + PARPORT_GSC_OFFSET;
367 368
368 /* some older machines with ASP-chip don't support 369 /* some older machines with ASP-chip don't support
369 * the enhanced parport modes. 370 * the enhanced parport modes.
diff --git a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c
index 4cbb6187cc44..459a4daebece 100644
--- a/drivers/scsi/lasi700.c
+++ b/drivers/scsi/lasi700.c
@@ -98,7 +98,7 @@ MODULE_DEVICE_TABLE(parisc, lasi700_ids);
98static int __init 98static int __init
99lasi700_probe(struct parisc_device *dev) 99lasi700_probe(struct parisc_device *dev)
100{ 100{
101 unsigned long base = dev->hpa + LASI_SCSI_CORE_OFFSET; 101 unsigned long base = dev->hpa.start + LASI_SCSI_CORE_OFFSET;
102 struct NCR_700_Host_Parameters *hostdata; 102 struct NCR_700_Host_Parameters *hostdata;
103 struct Scsi_Host *host; 103 struct Scsi_Host *host;
104 104
@@ -125,8 +125,6 @@ lasi700_probe(struct parisc_device *dev)
125 hostdata->dmode_extra = DMODE_FC2; 125 hostdata->dmode_extra = DMODE_FC2;
126 } 126 }
127 127
128 NCR_700_set_mem_mapped(hostdata);
129
130 host = NCR_700_detect(&lasi700_template, hostdata, &dev->dev); 128 host = NCR_700_detect(&lasi700_template, hostdata, &dev->dev);
131 if (!host) 129 if (!host)
132 goto out_kfree; 130 goto out_kfree;
@@ -168,7 +166,7 @@ lasi700_driver_remove(struct parisc_device *dev)
168} 166}
169 167
170static struct parisc_driver lasi700_driver = { 168static struct parisc_driver lasi700_driver = {
171 .name = "Lasi SCSI", 169 .name = "lasi_scsi",
172 .id_table = lasi700_ids, 170 .id_table = lasi700_ids,
173 .probe = lasi700_probe, 171 .probe = lasi700_probe,
174 .remove = __devexit_p(lasi700_driver_remove), 172 .remove = __devexit_p(lasi700_driver_remove),
diff --git a/drivers/scsi/zalon.c b/drivers/scsi/zalon.c
index 5a51051e31f0..b131432c677d 100644
--- a/drivers/scsi/zalon.c
+++ b/drivers/scsi/zalon.c
@@ -88,7 +88,7 @@ zalon_probe(struct parisc_device *dev)
88 struct gsc_irq gsc_irq; 88 struct gsc_irq gsc_irq;
89 u32 zalon_vers; 89 u32 zalon_vers;
90 int error = -ENODEV; 90 int error = -ENODEV;
91 void __iomem *zalon = ioremap(dev->hpa, 4096); 91 void __iomem *zalon = ioremap(dev->hpa.start, 4096);
92 void __iomem *io_port = zalon + GSC_SCSI_ZALON_OFFSET; 92 void __iomem *io_port = zalon + GSC_SCSI_ZALON_OFFSET;
93 static int unit = 0; 93 static int unit = 0;
94 struct Scsi_Host *host; 94 struct Scsi_Host *host;
@@ -127,7 +127,7 @@ zalon_probe(struct parisc_device *dev)
127 device.chip = zalon720_chip; 127 device.chip = zalon720_chip;
128 device.host_id = 7; 128 device.host_id = 7;
129 device.dev = &dev->dev; 129 device.dev = &dev->dev;
130 device.slot.base = dev->hpa + GSC_SCSI_ZALON_OFFSET; 130 device.slot.base = dev->hpa.start + GSC_SCSI_ZALON_OFFSET;
131 device.slot.base_v = io_port; 131 device.slot.base_v = io_port;
132 device.slot.irq = dev->irq; 132 device.slot.irq = dev->irq;
133 device.differential = 2; 133 device.differential = 2;
diff --git a/drivers/serial/8250_gsc.c b/drivers/serial/8250_gsc.c
index 431aa5761a7a..8b4947933d9b 100644
--- a/drivers/serial/8250_gsc.c
+++ b/drivers/serial/8250_gsc.c
@@ -29,7 +29,6 @@
29static int __init 29static int __init
30serial_init_chip(struct parisc_device *dev) 30serial_init_chip(struct parisc_device *dev)
31{ 31{
32 static int serial_line_nr;
33 struct uart_port port; 32 struct uart_port port;
34 unsigned long address; 33 unsigned long address;
35 int err; 34 int err;
@@ -42,12 +41,13 @@ serial_init_chip(struct parisc_device *dev)
42 */ 41 */
43 if (parisc_parent(dev)->id.hw_type != HPHW_IOA) { 42 if (parisc_parent(dev)->id.hw_type != HPHW_IOA) {
44 printk(KERN_INFO "Serial: device 0x%lx not configured.\n" 43 printk(KERN_INFO "Serial: device 0x%lx not configured.\n"
45 "Enable support for Wax, Lasi, Asp or Dino.\n", dev->hpa); 44 "Enable support for Wax, Lasi, Asp or Dino.\n",
45 dev->hpa.start);
46 } 46 }
47 return -ENODEV; 47 return -ENODEV;
48 } 48 }
49 49
50 address = dev->hpa; 50 address = dev->hpa.start;
51 if (dev->id.sversion != 0x8d) { 51 if (dev->id.sversion != 0x8d) {
52 address += 0x800; 52 address += 0x800;
53 } 53 }
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c
index 189064607709..660bae5ba179 100644
--- a/drivers/serial/mux.c
+++ b/drivers/serial/mux.c
@@ -27,6 +27,7 @@
27#include <linux/delay.h> /* for udelay */ 27#include <linux/delay.h> /* for udelay */
28#include <linux/device.h> 28#include <linux/device.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/irq.h>
30#include <asm/parisc-device.h> 31#include <asm/parisc-device.h>
31 32
32#ifdef CONFIG_MAGIC_SYSRQ 33#ifdef CONFIG_MAGIC_SYSRQ
@@ -444,7 +445,7 @@ static int __init mux_probe(struct parisc_device *dev)
444 unsigned long bytecnt; 445 unsigned long bytecnt;
445 struct uart_port *port; 446 struct uart_port *port;
446 447
447 status = pdc_iodc_read(&bytecnt, dev->hpa, 0, iodc_data, 32); 448 status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32);
448 if(status != PDC_OK) { 449 if(status != PDC_OK) {
449 printk(KERN_ERR "Serial mux: Unable to read IODC.\n"); 450 printk(KERN_ERR "Serial mux: Unable to read IODC.\n");
450 return 1; 451 return 1;
@@ -469,16 +470,18 @@ static int __init mux_probe(struct parisc_device *dev)
469 for(i = 0; i < ports; ++i, ++port_cnt) { 470 for(i = 0; i < ports; ++i, ++port_cnt) {
470 port = &mux_ports[port_cnt]; 471 port = &mux_ports[port_cnt];
471 port->iobase = 0; 472 port->iobase = 0;
472 port->mapbase = dev->hpa + MUX_OFFSET + (i * MUX_LINE_OFFSET); 473 port->mapbase = dev->hpa.start + MUX_OFFSET +
474 (i * MUX_LINE_OFFSET);
473 port->membase = ioremap(port->mapbase, MUX_LINE_OFFSET); 475 port->membase = ioremap(port->mapbase, MUX_LINE_OFFSET);
474 port->iotype = SERIAL_IO_MEM; 476 port->iotype = SERIAL_IO_MEM;
475 port->type = PORT_MUX; 477 port->type = PORT_MUX;
476 port->irq = SERIAL_IRQ_NONE; 478 port->irq = NO_IRQ;
477 port->uartclk = 0; 479 port->uartclk = 0;
478 port->fifosize = MUX_FIFO_SIZE; 480 port->fifosize = MUX_FIFO_SIZE;
479 port->ops = &mux_pops; 481 port->ops = &mux_pops;
480 port->flags = UPF_BOOT_AUTOCONF; 482 port->flags = UPF_BOOT_AUTOCONF;
481 port->line = port_cnt; 483 port->line = port_cnt;
484 spin_lock_init(&port->lock);
482 status = uart_add_one_port(&mux_driver, port); 485 status = uart_add_one_port(&mux_driver, port);
483 BUG_ON(status); 486 BUG_ON(status);
484 } 487 }
@@ -497,7 +500,7 @@ static struct parisc_device_id mux_tbl[] = {
497MODULE_DEVICE_TABLE(parisc, mux_tbl); 500MODULE_DEVICE_TABLE(parisc, mux_tbl);
498 501
499static struct parisc_driver serial_mux_driver = { 502static struct parisc_driver serial_mux_driver = {
500 .name = "Serial MUX", 503 .name = "serial_mux",
501 .id_table = mux_tbl, 504 .id_table = mux_tbl,
502 .probe = mux_probe, 505 .probe = mux_probe,
503}; 506};
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index eb83a7874c71..7e731691e2a9 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -110,7 +110,7 @@ config STI_CONSOLE
110 110
111config FONTS 111config FONTS
112 bool "Select compiled-in fonts" 112 bool "Select compiled-in fonts"
113 depends on FRAMEBUFFER_CONSOLE 113 depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
114 help 114 help
115 Say Y here if you would like to use fonts other than the default 115 Say Y here if you would like to use fonts other than the default
116 your frame buffer console usually use. 116 your frame buffer console usually use.
@@ -123,7 +123,7 @@ config FONTS
123 123
124config FONT_8x8 124config FONT_8x8
125 bool "VGA 8x8 font" if FONTS 125 bool "VGA 8x8 font" if FONTS
126 depends on FRAMEBUFFER_CONSOLE 126 depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
127 default y if !SPARC32 && !SPARC64 && !FONTS 127 default y if !SPARC32 && !SPARC64 && !FONTS
128 help 128 help
129 This is the "high resolution" font for the VGA frame buffer (the one 129 This is the "high resolution" font for the VGA frame buffer (the one
@@ -137,7 +137,7 @@ config FONT_8x8
137 137
138config FONT_8x16 138config FONT_8x16
139 bool "VGA 8x16 font" if FONTS 139 bool "VGA 8x16 font" if FONTS
140 depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE=y || USB_SISUSBVGA_CON 140 depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE=y || STI_CONSOLE || USB_SISUSBVGA_CON
141 default y if !SPARC32 && !SPARC64 && !FONTS 141 default y if !SPARC32 && !SPARC64 && !FONTS
142 help 142 help
143 This is the "high resolution" font for the VGA frame buffer (the one 143 This is the "high resolution" font for the VGA frame buffer (the one
@@ -147,7 +147,7 @@ config FONT_8x16
147 147
148config FONT_6x11 148config FONT_6x11
149 bool "Mac console 6x11 font (not supported by all drivers)" if FONTS 149 bool "Mac console 6x11 font (not supported by all drivers)" if FONTS
150 depends on FRAMEBUFFER_CONSOLE 150 depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
151 default y if !SPARC32 && !SPARC64 && !FONTS && MAC 151 default y if !SPARC32 && !SPARC64 && !FONTS && MAC
152 help 152 help
153 Small console font with Macintosh-style high-half glyphs. Some Mac 153 Small console font with Macintosh-style high-half glyphs. Some Mac
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index d940f605acb6..a7bcd17112c0 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -511,12 +511,12 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
511 struct sti_cooked_font *cooked_font; 511 struct sti_cooked_font *cooked_font;
512 512
513 if (!fbfont_name || !strlen(fbfont_name)) 513 if (!fbfont_name || !strlen(fbfont_name))
514 return NULL; 514 return NULL;
515 fbfont = find_font(fbfont_name); 515 fbfont = find_font(fbfont_name);
516 if (!fbfont) 516 if (!fbfont)
517 fbfont = get_default_font(1024,768); 517 fbfont = get_default_font(1024,768);
518 if (!fbfont) 518 if (!fbfont)
519 return NULL; 519 return NULL;
520 520
521 DPRINTK((KERN_DEBUG "selected %dx%d fb-font %s\n", 521 DPRINTK((KERN_DEBUG "selected %dx%d fb-font %s\n",
522 fbfont->width, fbfont->height, fbfont->name)); 522 fbfont->width, fbfont->height, fbfont->name));
@@ -527,7 +527,7 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
527 527
528 nf = kmalloc(size, GFP_KERNEL); 528 nf = kmalloc(size, GFP_KERNEL);
529 if (!nf) 529 if (!nf)
530 return NULL; 530 return NULL;
531 memset(nf, 0, size); 531 memset(nf, 0, size);
532 532
533 nf->first_char = 0; 533 nf->first_char = 0;
@@ -546,8 +546,8 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
546 546
547 cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL); 547 cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL);
548 if (!cooked_font) { 548 if (!cooked_font) {
549 kfree(nf); 549 kfree(nf);
550 return NULL; 550 return NULL;
551 } 551 }
552 552
553 cooked_font->raw = nf; 553 cooked_font->raw = nf;
@@ -595,7 +595,7 @@ sti_select_font(struct sti_cooked_rom *rom,
595static void __init 595static void __init
596sti_dump_rom(struct sti_rom *rom) 596sti_dump_rom(struct sti_rom *rom)
597{ 597{
598 printk(KERN_INFO " id %04x-%04x, conforms to spec rev. %d.%02x\n", 598 printk(KERN_INFO " id %04x-%04x, conforms to spec rev. %d.%02x\n",
599 rom->graphics_id[0], 599 rom->graphics_id[0],
600 rom->graphics_id[1], 600 rom->graphics_id[1],
601 rom->revno[0] >> 4, 601 rom->revno[0] >> 4,
@@ -651,15 +651,16 @@ sti_search_font(struct sti_cooked_rom *rom, int height, int width)
651 struct sti_cooked_font *font; 651 struct sti_cooked_font *font;
652 int i = 0; 652 int i = 0;
653 653
654 for(font = rom->font_start; font; font = font->next_font, i++) { 654 for (font = rom->font_start; font; font = font->next_font, i++) {
655 if((font->raw->width == width) && (font->raw->height == height)) 655 if ((font->raw->width == width) &&
656 (font->raw->height == height))
656 return i; 657 return i;
657 } 658 }
658 return 0; 659 return 0;
659} 660}
660 661
661#define BMODE_RELOCATE(offset) offset = (offset) / 4; 662#define BMODE_RELOCATE(offset) offset = (offset) / 4;
662#define BMODE_LAST_ADDR_OFFS 0x50 663#define BMODE_LAST_ADDR_OFFS 0x50
663 664
664static void * __init 665static void * __init
665sti_bmode_font_raw(struct sti_cooked_font *f) 666sti_bmode_font_raw(struct sti_cooked_font *f)
@@ -700,35 +701,35 @@ sti_get_bmode_rom (unsigned long address)
700{ 701{
701 struct sti_rom *raw; 702 struct sti_rom *raw;
702 u32 size; 703 u32 size;
703 struct sti_rom_font *raw_font, *font_start; 704 struct sti_rom_font *raw_font, *font_start;
704 705
705 sti_bmode_rom_copy(address + BMODE_LAST_ADDR_OFFS, sizeof(size), &size); 706 sti_bmode_rom_copy(address + BMODE_LAST_ADDR_OFFS, sizeof(size), &size);
706 707
707 size = (size+3) / 4; 708 size = (size+3) / 4;
708 raw = kmalloc(size, GFP_KERNEL); 709 raw = kmalloc(size, GFP_KERNEL);
709 if (raw) { 710 if (raw) {
710 sti_bmode_rom_copy(address, size, raw); 711 sti_bmode_rom_copy(address, size, raw);
711 memmove (&raw->res004, &raw->type[0], 0x3c); 712 memmove (&raw->res004, &raw->type[0], 0x3c);
712 raw->type[3] = raw->res004; 713 raw->type[3] = raw->res004;
713 714
714 BMODE_RELOCATE (raw->region_list); 715 BMODE_RELOCATE (raw->region_list);
715 BMODE_RELOCATE (raw->font_start); 716 BMODE_RELOCATE (raw->font_start);
716 717
717 BMODE_RELOCATE (raw->init_graph); 718 BMODE_RELOCATE (raw->init_graph);
718 BMODE_RELOCATE (raw->state_mgmt); 719 BMODE_RELOCATE (raw->state_mgmt);
719 BMODE_RELOCATE (raw->font_unpmv); 720 BMODE_RELOCATE (raw->font_unpmv);
720 BMODE_RELOCATE (raw->block_move); 721 BMODE_RELOCATE (raw->block_move);
721 BMODE_RELOCATE (raw->inq_conf); 722 BMODE_RELOCATE (raw->inq_conf);
722 723
723 raw_font = ((void *)raw) + raw->font_start; 724 raw_font = ((void *)raw) + raw->font_start;
724 font_start = raw_font; 725 font_start = raw_font;
725 726
726 while (raw_font->next_font) { 727 while (raw_font->next_font) {
727 BMODE_RELOCATE (raw_font->next_font); 728 BMODE_RELOCATE (raw_font->next_font);
728 raw_font = ((void *)font_start) + raw_font->next_font; 729 raw_font = ((void *)font_start) + raw_font->next_font;
729 } 730 }
730 } 731 }
731 return raw; 732 return raw;
732} 733}
733 734
734struct sti_rom * __init 735struct sti_rom * __init
@@ -736,15 +737,15 @@ sti_get_wmode_rom (unsigned long address)
736{ 737{
737 struct sti_rom *raw; 738 struct sti_rom *raw;
738 unsigned long size; 739 unsigned long size;
739 740
740 /* read the ROM size directly from the struct in ROM */ 741 /* read the ROM size directly from the struct in ROM */
741 size = gsc_readl(address + offsetof(struct sti_rom,last_addr)); 742 size = gsc_readl(address + offsetof(struct sti_rom,last_addr));
742 743
743 raw = kmalloc(size, GFP_KERNEL); 744 raw = kmalloc(size, GFP_KERNEL);
744 if(raw) 745 if (raw)
745 sti_rom_copy(address, size, raw); 746 sti_rom_copy(address, size, raw);
746 747
747 return raw; 748 return raw;
748} 749}
749 750
750int __init 751int __init
@@ -757,14 +758,14 @@ sti_read_rom(int wordmode, struct sti_struct *sti, unsigned long address)
757 if (!cooked) 758 if (!cooked)
758 goto out_err; 759 goto out_err;
759 760
760 if (wordmode) 761 if (wordmode)
761 raw = sti_get_wmode_rom (address); 762 raw = sti_get_wmode_rom (address);
762 else 763 else
763 raw = sti_get_bmode_rom (address); 764 raw = sti_get_bmode_rom (address);
765
766 if (!raw)
767 goto out_err;
764 768
765 if (!raw)
766 goto out_err;
767
768 if (!sti_cook_fonts(cooked, raw)) { 769 if (!sti_cook_fonts(cooked, raw)) {
769 printk(KERN_ERR "No font found for STI at %08lx\n", address); 770 printk(KERN_ERR "No font found for STI at %08lx\n", address);
770 goto out_err; 771 goto out_err;
@@ -787,7 +788,7 @@ sti_read_rom(int wordmode, struct sti_struct *sti, unsigned long address)
787 sti->font_width = sti->font->raw->width; 788 sti->font_width = sti->font->raw->width;
788 sti->font_height = sti->font->raw->height; 789 sti->font_height = sti->font->raw->height;
789 if (!wordmode) 790 if (!wordmode)
790 sti->font->raw = sti_bmode_font_raw(sti->font); 791 sti->font->raw = sti_bmode_font_raw(sti->font);
791 792
792 sti->sti_mem_request = raw->sti_mem_req; 793 sti->sti_mem_request = raw->sti_mem_req;
793 sti->graphics_id[0] = raw->graphics_id[0]; 794 sti->graphics_id[0] = raw->graphics_id[0];
@@ -811,16 +812,16 @@ sti_try_rom_generic(unsigned long address, unsigned long hpa, struct pci_dev *pd
811 u32 sig; 812 u32 sig;
812 813
813 if (num_sti_roms >= MAX_STI_ROMS) { 814 if (num_sti_roms >= MAX_STI_ROMS) {
814 printk(KERN_WARNING "maximum number of STI ROMS reached !\n"); 815 printk(KERN_WARNING "maximum number of STI ROMS reached !\n");
815 return NULL; 816 return NULL;
816 } 817 }
817 818
818 sti = kmalloc(sizeof(*sti), GFP_KERNEL); 819 sti = kmalloc(sizeof(*sti), GFP_KERNEL);
819 if (!sti) { 820 if (!sti) {
820 printk(KERN_ERR "Not enough memory !\n"); 821 printk(KERN_ERR "Not enough memory !\n");
821 return NULL; 822 return NULL;
822 } 823 }
823 824
824 memset(sti, 0, sizeof(*sti)); 825 memset(sti, 0, sizeof(*sti));
825 spin_lock_init(&sti->lock); 826 spin_lock_init(&sti->lock);
826 827
@@ -932,28 +933,21 @@ static void __init sticore_check_for_default_sti(struct sti_struct *sti, char *p
932 */ 933 */
933static int __init sticore_pa_init(struct parisc_device *dev) 934static int __init sticore_pa_init(struct parisc_device *dev)
934{ 935{
935 unsigned long rom = 0;
936 char pa_path[21]; 936 char pa_path[21];
937 struct sti_struct *sti = NULL; 937 struct sti_struct *sti = NULL;
938 938 int hpa = dev->hpa.start;
939 if(dev->num_addrs) { 939
940 rom = dev->addr[0]; 940 if (dev->num_addrs && dev->addr[0])
941 } 941 sti = sti_try_rom_generic(dev->addr[0], hpa, NULL);
942 if (!rom) { 942 if (!sti)
943 rom = dev->hpa; 943 sti = sti_try_rom_generic(hpa, hpa, NULL);
944 DPRINTK((KERN_DEBUG "Trying STI ROM at %08lx, hpa at %08lx\n", rom, dev->hpa)); 944 if (!sti)
945 sti = sti_try_rom_generic(rom, dev->hpa, NULL); 945 sti = sti_try_rom_generic(PAGE0->proc_sti, hpa, NULL);
946 rom = PAGE0->proc_sti;
947 }
948 if (!sti) {
949 DPRINTK((KERN_DEBUG "Trying STI ROM at %08lx, hpa at %08lx\n", rom, dev->hpa));
950 sti = sti_try_rom_generic(rom, dev->hpa, NULL);
951 }
952 if (!sti) 946 if (!sti)
953 return 1; 947 return 1;
954 948
955 print_pa_hwpath(dev, pa_path); 949 print_pa_hwpath(dev, pa_path);
956 sticore_check_for_default_sti (sti, pa_path); 950 sticore_check_for_default_sti(sti, pa_path);
957 return 0; 951 return 0;
958} 952}
959 953