aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parisc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-26 15:48:06 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-26 15:48:06 -0500
commitb0138a6cb7923a997d278b47c176778534d1095b (patch)
tree4fcb8822a69631baba568e4e1942847747123887 /drivers/parisc
parent6572d6d7d0f965dda19d02af804ed3ae4b3bf1fc (diff)
parent1055a8af093fea7490445bd15cd671020e542035 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6: (78 commits) [PARISC] Use symbolic last syscall in __NR_Linux_syscalls [PARISC] Add missing statfs64 and fstatfs64 syscalls Revert "[PARISC] Optimize TLB flush on SMP systems" [PARISC] Compat signal fixes for 64-bit parisc [PARISC] Reorder syscalls to match unistd.h Revert "[PATCH] make kernel/signal.c:kill_proc_info() static" [PARISC] fix sys_rt_sigqueueinfo [PARISC] fix section mismatch warnings in harmony sound driver [PARISC] do not export get_register/set_register [PARISC] add ENTRY()/ENDPROC() and simplify assembly of HP/UX emulation code [PARISC] convert to use CONFIG_64BIT instead of __LP64__ [PARISC] use CONFIG_64BIT instead of __LP64__ [PARISC] add ASM_EXCEPTIONTABLE_ENTRY() macro [PARISC] more ENTRY(), ENDPROC(), END() conversions [PARISC] fix ENTRY() and ENDPROC() for 64bit-parisc [PARISC] Fixes /proc/cpuinfo cache output on B160L [PARISC] implement standard ENTRY(), END() and ENDPROC() [PARISC] kill ENTRY_SYS_CPUS [PARISC] clean up debugging printks in smp.c [PARISC] factor syscall_restart code out of do_signal ... Fix conflict in include/linux/sched.h due to kill_proc_info() being made publicly available to PARISC again.
Diffstat (limited to 'drivers/parisc')
-rw-r--r--drivers/parisc/hppb.c14
-rw-r--r--drivers/parisc/iosapic_private.h2
-rw-r--r--drivers/parisc/lba_pci.c90
-rw-r--r--drivers/parisc/led.c14
-rw-r--r--drivers/parisc/power.c201
-rw-r--r--drivers/parisc/sba_iommu.c4
6 files changed, 154 insertions, 171 deletions
diff --git a/drivers/parisc/hppb.c b/drivers/parisc/hppb.c
index 07dc2b6d4e93..9bb4db552f3c 100644
--- a/drivers/parisc/hppb.c
+++ b/drivers/parisc/hppb.c
@@ -10,10 +10,6 @@
10** the Free Software Foundation; either version 2 of the License, or 10** the Free Software Foundation; either version 2 of the License, or
11** (at your option) any later version. 11** (at your option) any later version.
12** 12**
13** This Driver currently only supports the console (port 0) on the MUX.
14** Additional work will be needed on this driver to enable the full
15** functionality of the MUX.
16**
17*/ 13*/
18 14
19#include <linux/types.h> 15#include <linux/types.h>
@@ -67,7 +63,7 @@ static int hppb_probe(struct parisc_device *dev)
67 } 63 }
68 card = card->next; 64 card = card->next;
69 } 65 }
70 printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa.start); 66 printk(KERN_INFO "Found GeckoBoa at 0x%x\n", dev->hpa.start);
71 67
72 card->hpa = dev->hpa.start; 68 card->hpa = dev->hpa.start;
73 card->mmio_region.name = "HP-PB Bus"; 69 card->mmio_region.name = "HP-PB Bus";
@@ -78,16 +74,18 @@ static int hppb_probe(struct parisc_device *dev)
78 74
79 status = ccio_request_resource(dev, &card->mmio_region); 75 status = ccio_request_resource(dev, &card->mmio_region);
80 if(status < 0) { 76 if(status < 0) {
81 printk(KERN_ERR "%s: failed to claim HP-PB bus space (%08lx, %08lx)\n", 77 printk(KERN_ERR "%s: failed to claim HP-PB bus space (%08x, %08x)\n",
82 __FILE__, card->mmio_region.start, card->mmio_region.end); 78 __FILE__, card->mmio_region.start, card->mmio_region.end);
83 } 79 }
84 80
85 return 0; 81 return 0;
86} 82}
87 83
88
89static struct parisc_device_id hppb_tbl[] = { 84static struct parisc_device_id hppb_tbl[] = {
90 { HPHW_BCPORT, HVERSION_REV_ANY_ID, 0x500, 0xc }, 85 { HPHW_BCPORT, HVERSION_REV_ANY_ID, 0x500, 0xc }, /* E25 and K */
86 { HPHW_BCPORT, 0x0, 0x501, 0xc }, /* E35 */
87 { HPHW_BCPORT, 0x0, 0x502, 0xc }, /* E45 */
88 { HPHW_BCPORT, 0x0, 0x503, 0xc }, /* E55 */
91 { 0, } 89 { 0, }
92}; 90};
93 91
diff --git a/drivers/parisc/iosapic_private.h b/drivers/parisc/iosapic_private.h
index 41e7ec2a44aa..6e05e30a2450 100644
--- a/drivers/parisc/iosapic_private.h
+++ b/drivers/parisc/iosapic_private.h
@@ -132,7 +132,7 @@ struct iosapic_irt {
132struct vector_info { 132struct vector_info {
133 struct iosapic_info *iosapic; /* I/O SAPIC this vector is on */ 133 struct iosapic_info *iosapic; /* I/O SAPIC this vector is on */
134 struct irt_entry *irte; /* IRT entry */ 134 struct irt_entry *irte; /* IRT entry */
135 u32 *eoi_addr; /* precalculate EOI reg address */ 135 u32 __iomem *eoi_addr; /* precalculate EOI reg address */
136 u32 eoi_data; /* IA64: ? PA: swapped txn_data */ 136 u32 eoi_data; /* IA64: ? PA: swapped txn_data */
137 int txn_irq; /* virtual IRQ number for processor */ 137 int txn_irq; /* virtual IRQ number for processor */
138 ulong txn_addr; /* IA64: id_eid PA: partial HPA */ 138 ulong txn_addr; /* IA64: id_eid PA: partial HPA */
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index ba6769934c77..21c4c299b3d6 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -168,7 +168,8 @@ lba_dump_res(struct resource *r, int d)
168 168
169 printk(KERN_DEBUG "(%p)", r->parent); 169 printk(KERN_DEBUG "(%p)", r->parent);
170 for (i = d; i ; --i) printk(" "); 170 for (i = d; i ; --i) printk(" ");
171 printk(KERN_DEBUG "%p [%lx,%lx]/%lx\n", r, r->start, r->end, r->flags); 171 printk(KERN_DEBUG "%p [%lx,%lx]/%lx\n", r,
172 (long)r->start, (long)r->end, r->flags);
172 lba_dump_res(r->child, d+2); 173 lba_dump_res(r->child, d+2);
173 lba_dump_res(r->sibling, d); 174 lba_dump_res(r->sibling, d);
174} 175}
@@ -647,7 +648,7 @@ truncate_pat_collision(struct resource *root, struct resource *new)
647 printk(KERN_WARNING "LBA: Truncating lmmio_space [%lx/%lx] " 648 printk(KERN_WARNING "LBA: Truncating lmmio_space [%lx/%lx] "
648 "to [%lx,%lx]\n", 649 "to [%lx,%lx]\n",
649 start, end, 650 start, end,
650 new->start, new->end ); 651 (long)new->start, (long)new->end );
651 652
652 return 0; /* truncation successful */ 653 return 0; /* truncation successful */
653} 654}
@@ -715,8 +716,8 @@ lba_fixup_bus(struct pci_bus *bus)
715 716
716 printk("FAILED: lba_fixup_bus() request for " 717 printk("FAILED: lba_fixup_bus() request for "
717 "elmmio_space [%lx/%lx]\n", 718 "elmmio_space [%lx/%lx]\n",
718 ldev->hba.elmmio_space.start, 719 (long)ldev->hba.elmmio_space.start,
719 ldev->hba.elmmio_space.end); 720 (long)ldev->hba.elmmio_space.end);
720 721
721 /* lba_dump_res(&iomem_resource, 2); */ 722 /* lba_dump_res(&iomem_resource, 2); */
722 /* BUG(); */ 723 /* BUG(); */
@@ -738,15 +739,15 @@ lba_fixup_bus(struct pci_bus *bus)
738 &(ldev->hba.lmmio_space))) { 739 &(ldev->hba.lmmio_space))) {
739 740
740 printk(KERN_WARNING "LBA: lmmio_space [%lx/%lx] duplicate!\n", 741 printk(KERN_WARNING "LBA: lmmio_space [%lx/%lx] duplicate!\n",
741 ldev->hba.lmmio_space.start, 742 (long)ldev->hba.lmmio_space.start,
742 ldev->hba.lmmio_space.end); 743 (long)ldev->hba.lmmio_space.end);
743 } else { 744 } else {
744 err = request_resource(&iomem_resource, &(ldev->hba.lmmio_space)); 745 err = request_resource(&iomem_resource, &(ldev->hba.lmmio_space));
745 if (err < 0) { 746 if (err < 0) {
746 printk(KERN_ERR "FAILED: lba_fixup_bus() request for " 747 printk(KERN_ERR "FAILED: lba_fixup_bus() request for "
747 "lmmio_space [%lx/%lx]\n", 748 "lmmio_space [%lx/%lx]\n",
748 ldev->hba.lmmio_space.start, 749 (long)ldev->hba.lmmio_space.start,
749 ldev->hba.lmmio_space.end); 750 (long)ldev->hba.lmmio_space.end);
750 } else 751 } else
751 bus->resource[i++] = &(ldev->hba.lmmio_space); 752 bus->resource[i++] = &(ldev->hba.lmmio_space);
752 } 753 }
@@ -758,8 +759,8 @@ lba_fixup_bus(struct pci_bus *bus)
758 if (err < 0) { 759 if (err < 0) {
759 printk("FAILED: lba_fixup_bus() request for " 760 printk("FAILED: lba_fixup_bus() request for "
760 "gmmio_space [%lx/%lx]\n", 761 "gmmio_space [%lx/%lx]\n",
761 ldev->hba.gmmio_space.start, 762 (long)ldev->hba.gmmio_space.start,
762 ldev->hba.gmmio_space.end); 763 (long)ldev->hba.gmmio_space.end);
763 lba_dump_res(&iomem_resource, 2); 764 lba_dump_res(&iomem_resource, 2);
764 BUG(); 765 BUG();
765 } 766 }
@@ -980,7 +981,7 @@ LBA_PORT_IN(32, 0)
980#define LBA_PORT_OUT(size, mask) \ 981#define LBA_PORT_OUT(size, mask) \
981static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \ 982static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \
982{ \ 983{ \
983 void *where = (void *) PIOP_TO_GMMIO(LBA_DEV(l), addr); \ 984 void __iomem *where = PIOP_TO_GMMIO(LBA_DEV(l), addr); \
984 DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, l, addr, val); \ 985 DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, l, addr, val); \
985 WRITE_REG##size(val, where); \ 986 WRITE_REG##size(val, where); \
986 /* flush the I/O down to the elroy at least */ \ 987 /* flush the I/O down to the elroy at least */ \
@@ -1063,16 +1064,16 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1063 /* used to fix up pre-initialized MEM BARs */ 1064 /* used to fix up pre-initialized MEM BARs */
1064 if (!lba_dev->hba.lmmio_space.start) { 1065 if (!lba_dev->hba.lmmio_space.start) {
1065 sprintf(lba_dev->hba.lmmio_name, 1066 sprintf(lba_dev->hba.lmmio_name,
1066 "PCI%02lx LMMIO", 1067 "PCI%02x LMMIO",
1067 lba_dev->hba.bus_num.start); 1068 (int)lba_dev->hba.bus_num.start);
1068 lba_dev->hba.lmmio_space_offset = p->start - 1069 lba_dev->hba.lmmio_space_offset = p->start -
1069 io->start; 1070 io->start;
1070 r = &lba_dev->hba.lmmio_space; 1071 r = &lba_dev->hba.lmmio_space;
1071 r->name = lba_dev->hba.lmmio_name; 1072 r->name = lba_dev->hba.lmmio_name;
1072 } else if (!lba_dev->hba.elmmio_space.start) { 1073 } else if (!lba_dev->hba.elmmio_space.start) {
1073 sprintf(lba_dev->hba.elmmio_name, 1074 sprintf(lba_dev->hba.elmmio_name,
1074 "PCI%02lx ELMMIO", 1075 "PCI%02x ELMMIO",
1075 lba_dev->hba.bus_num.start); 1076 (int)lba_dev->hba.bus_num.start);
1076 r = &lba_dev->hba.elmmio_space; 1077 r = &lba_dev->hba.elmmio_space;
1077 r->name = lba_dev->hba.elmmio_name; 1078 r->name = lba_dev->hba.elmmio_name;
1078 } else { 1079 } else {
@@ -1089,8 +1090,8 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1089 1090
1090 case PAT_GMMIO: 1091 case PAT_GMMIO:
1091 /* MMIO space > 4GB phys addr; for 64-bit BAR */ 1092 /* MMIO space > 4GB phys addr; for 64-bit BAR */
1092 sprintf(lba_dev->hba.gmmio_name, "PCI%02lx GMMIO", 1093 sprintf(lba_dev->hba.gmmio_name, "PCI%02x GMMIO",
1093 lba_dev->hba.bus_num.start); 1094 (int)lba_dev->hba.bus_num.start);
1094 r = &lba_dev->hba.gmmio_space; 1095 r = &lba_dev->hba.gmmio_space;
1095 r->name = lba_dev->hba.gmmio_name; 1096 r->name = lba_dev->hba.gmmio_name;
1096 r->start = p->start; 1097 r->start = p->start;
@@ -1112,8 +1113,8 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1112 */ 1113 */
1113 lba_dev->iop_base = ioremap_nocache(p->start, 64 * 1024 * 1024); 1114 lba_dev->iop_base = ioremap_nocache(p->start, 64 * 1024 * 1024);
1114 1115
1115 sprintf(lba_dev->hba.io_name, "PCI%02lx Ports", 1116 sprintf(lba_dev->hba.io_name, "PCI%02x Ports",
1116 lba_dev->hba.bus_num.start); 1117 (int)lba_dev->hba.bus_num.start);
1117 r = &lba_dev->hba.io_space; 1118 r = &lba_dev->hba.io_space;
1118 r->name = lba_dev->hba.io_name; 1119 r->name = lba_dev->hba.io_name;
1119 r->start = HBA_PORT_BASE(lba_dev->hba.hba_num); 1120 r->start = HBA_PORT_BASE(lba_dev->hba.hba_num);
@@ -1166,8 +1167,8 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1166 ** Legacy boxes but it's nice to see in /proc/iomem. 1167 ** Legacy boxes but it's nice to see in /proc/iomem.
1167 */ 1168 */
1168 r = &(lba_dev->hba.lmmio_space); 1169 r = &(lba_dev->hba.lmmio_space);
1169 sprintf(lba_dev->hba.lmmio_name, "PCI%02lx LMMIO", 1170 sprintf(lba_dev->hba.lmmio_name, "PCI%02x LMMIO",
1170 lba_dev->hba.bus_num.start); 1171 (int)lba_dev->hba.bus_num.start);
1171 r->name = lba_dev->hba.lmmio_name; 1172 r->name = lba_dev->hba.lmmio_name;
1172 1173
1173#if 1 1174#if 1
@@ -1275,8 +1276,8 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1275 ** an existing (but unused portion of) distributed range. 1276 ** an existing (but unused portion of) distributed range.
1276 */ 1277 */
1277 r = &(lba_dev->hba.elmmio_space); 1278 r = &(lba_dev->hba.elmmio_space);
1278 sprintf(lba_dev->hba.elmmio_name, "PCI%02lx ELMMIO", 1279 sprintf(lba_dev->hba.elmmio_name, "PCI%02x ELMMIO",
1279 lba_dev->hba.bus_num.start); 1280 (int)lba_dev->hba.bus_num.start);
1280 r->name = lba_dev->hba.elmmio_name; 1281 r->name = lba_dev->hba.elmmio_name;
1281 1282
1282#if 1 1283#if 1
@@ -1297,8 +1298,8 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1297#endif 1298#endif
1298 1299
1299 r = &(lba_dev->hba.io_space); 1300 r = &(lba_dev->hba.io_space);
1300 sprintf(lba_dev->hba.io_name, "PCI%02lx Ports", 1301 sprintf(lba_dev->hba.io_name, "PCI%02x Ports",
1301 lba_dev->hba.bus_num.start); 1302 (int)lba_dev->hba.bus_num.start);
1302 r->name = lba_dev->hba.io_name; 1303 r->name = lba_dev->hba.io_name;
1303 r->flags = IORESOURCE_IO; 1304 r->flags = IORESOURCE_IO;
1304 r->start = READ_REG32(lba_dev->hba.base_addr + LBA_IOS_BASE) & ~1L; 1305 r->start = READ_REG32(lba_dev->hba.base_addr + LBA_IOS_BASE) & ~1L;
@@ -1406,13 +1407,20 @@ lba_hw_init(struct lba_device *d)
1406 return 0; 1407 return 0;
1407} 1408}
1408 1409
1409 1410/*
1411 * Unfortunately, when firmware numbers busses, it doesn't take into account
1412 * Cardbus bridges. So we have to renumber the busses to suit ourselves.
1413 * Elroy/Mercury don't actually know what bus number they're attached to;
1414 * we use bus 0 to indicate the directly attached bus and any other bus
1415 * number will be taken care of by the PCI-PCI bridge.
1416 */
1417static unsigned int lba_next_bus = 0;
1410 1418
1411/* 1419/*
1412** Determine if lba should claim this chip (return 0) or not (return 1). 1420 * Determine if lba should claim this chip (return 0) or not (return 1).
1413** If so, initialize the chip and tell other partners in crime they 1421 * If so, initialize the chip and tell other partners in crime they
1414** have work to do. 1422 * have work to do.
1415*/ 1423 */
1416static int __init 1424static int __init
1417lba_driver_probe(struct parisc_device *dev) 1425lba_driver_probe(struct parisc_device *dev)
1418{ 1426{
@@ -1440,7 +1448,7 @@ lba_driver_probe(struct parisc_device *dev)
1440 } 1448 }
1441 1449
1442 printk(KERN_INFO "Elroy version %s (0x%x) found at 0x%lx\n", 1450 printk(KERN_INFO "Elroy version %s (0x%x) found at 0x%lx\n",
1443 version, func_class & 0xf, dev->hpa.start); 1451 version, func_class & 0xf, (long)dev->hpa.start);
1444 1452
1445 if (func_class < 2) { 1453 if (func_class < 2) {
1446 printk(KERN_WARNING "Can't support LBA older than " 1454 printk(KERN_WARNING "Can't support LBA older than "
@@ -1470,17 +1478,16 @@ lba_driver_probe(struct parisc_device *dev)
1470 */ 1478 */
1471 printk(KERN_INFO "%s version TR%d.%d (0x%x) found at 0x%lx\n", 1479 printk(KERN_INFO "%s version TR%d.%d (0x%x) found at 0x%lx\n",
1472 IS_MERCURY(dev) ? "Mercury" : "Quicksilver", major, 1480 IS_MERCURY(dev) ? "Mercury" : "Quicksilver", major,
1473 minor, func_class, dev->hpa.start); 1481 minor, func_class, (long)dev->hpa.start);
1474 1482
1475 cfg_ops = &mercury_cfg_ops; 1483 cfg_ops = &mercury_cfg_ops;
1476 } else { 1484 } else {
1477 printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa.start); 1485 printk(KERN_ERR "Unknown LBA found at 0x%lx\n",
1486 (long)dev->hpa.start);
1478 return -ENODEV; 1487 return -ENODEV;
1479 } 1488 }
1480 1489
1481 /* 1490 /* Tell I/O SAPIC driver we have a IRQ handler/region. */
1482 ** Tell I/O SAPIC driver we have a IRQ handler/region.
1483 */
1484 tmp_obj = iosapic_register(dev->hpa.start + LBA_IOSAPIC_BASE); 1491 tmp_obj = iosapic_register(dev->hpa.start + LBA_IOSAPIC_BASE);
1485 1492
1486 /* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't 1493 /* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't
@@ -1529,16 +1536,17 @@ lba_driver_probe(struct parisc_device *dev)
1529 lba_legacy_resources(dev, lba_dev); 1536 lba_legacy_resources(dev, lba_dev);
1530 } 1537 }
1531 1538
1532 /* 1539 if (lba_dev->hba.bus_num.start < lba_next_bus)
1533 ** Tell PCI support another PCI bus was found. 1540 lba_dev->hba.bus_num.start = lba_next_bus;
1534 ** Walks PCI bus for us too. 1541
1535 */
1536 dev->dev.platform_data = lba_dev; 1542 dev->dev.platform_data = lba_dev;
1537 lba_bus = lba_dev->hba.hba_bus = 1543 lba_bus = lba_dev->hba.hba_bus =
1538 pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start, 1544 pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start,
1539 cfg_ops, NULL); 1545 cfg_ops, NULL);
1540 if (lba_bus) 1546 if (lba_bus) {
1547 lba_next_bus = lba_bus->subordinate + 1;
1541 pci_bus_add_devices(lba_bus); 1548 pci_bus_add_devices(lba_bus);
1549 }
1542 1550
1543 /* This is in lieu of calling pci_assign_unassigned_resources() */ 1551 /* This is in lieu of calling pci_assign_unassigned_resources() */
1544 if (is_pdc_pat()) { 1552 if (is_pdc_pat()) {
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index 9a731c101d10..d190c05d87ed 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -66,8 +66,8 @@ static char lcd_text_default[32] __read_mostly;
66 66
67 67
68static struct workqueue_struct *led_wq; 68static struct workqueue_struct *led_wq;
69static void led_work_func(void *); 69static void led_work_func(struct work_struct *);
70static DECLARE_WORK(led_task, led_work_func, NULL); 70static DECLARE_DELAYED_WORK(led_task, led_work_func);
71 71
72#if 0 72#if 0
73#define DPRINTK(x) printk x 73#define DPRINTK(x) printk x
@@ -136,7 +136,7 @@ static int start_task(void)
136 136
137 /* Create the work queue and queue the LED task */ 137 /* Create the work queue and queue the LED task */
138 led_wq = create_singlethread_workqueue("led_wq"); 138 led_wq = create_singlethread_workqueue("led_wq");
139 queue_work(led_wq, &led_task); 139 queue_delayed_work(led_wq, &led_task, 0);
140 140
141 return 0; 141 return 0;
142} 142}
@@ -441,7 +441,7 @@ static __inline__ int led_get_diskio_activity(void)
441 441
442#define LED_UPDATE_INTERVAL (1 + (HZ*19/1000)) 442#define LED_UPDATE_INTERVAL (1 + (HZ*19/1000))
443 443
444static void led_work_func (void *unused) 444static void led_work_func (struct work_struct *unused)
445{ 445{
446 static unsigned long last_jiffies; 446 static unsigned long last_jiffies;
447 static unsigned long count_HZ; /* counter in range 0..HZ */ 447 static unsigned long count_HZ; /* counter in range 0..HZ */
@@ -588,7 +588,7 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d
588 588
589 /* Ensure the work is queued */ 589 /* Ensure the work is queued */
590 if (led_wq) { 590 if (led_wq) {
591 queue_work(led_wq, &led_task); 591 queue_delayed_work(led_wq, &led_task, 0);
592 } 592 }
593 593
594 return 0; 594 return 0;
@@ -629,7 +629,7 @@ void __init register_led_regions(void)
629 ** avoid a race condition while writing the CMD/DATA register pair. 629 ** avoid a race condition while writing the CMD/DATA register pair.
630 ** 630 **
631 */ 631 */
632int lcd_print( char *str ) 632int lcd_print( const char *str )
633{ 633{
634 int i; 634 int i;
635 635
@@ -658,7 +658,7 @@ int lcd_print( char *str )
658 658
659 /* re-queue the work */ 659 /* re-queue the work */
660 if (led_wq) { 660 if (led_wq) {
661 queue_work(led_wq, &led_task); 661 queue_delayed_work(led_wq, &led_task, 0);
662 } 662 }
663 663
664 return lcd_info.lcd_width; 664 return lcd_info.lcd_width;
diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
index 97e9dc066f95..6dedbdef7106 100644
--- a/drivers/parisc/power.c
+++ b/drivers/parisc/power.c
@@ -2,7 +2,7 @@
2 * linux/drivers/parisc/power.c 2 * linux/drivers/parisc/power.c
3 * HP PARISC soft power switch support driver 3 * HP PARISC soft power switch support driver
4 * 4 *
5 * Copyright (c) 2001-2005 Helge Deller <deller@gmx.de> 5 * Copyright (c) 2001-2007 Helge Deller <deller@gmx.de>
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * 8 *
@@ -29,7 +29,6 @@
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * 30 *
31 * 31 *
32 *
33 * HINT: 32 * HINT:
34 * Support of the soft power switch button may be enabled or disabled at 33 * Support of the soft power switch button may be enabled or disabled at
35 * runtime through the "/proc/sys/kernel/power" procfs entry. 34 * runtime through the "/proc/sys/kernel/power" procfs entry.
@@ -38,34 +37,28 @@
38#include <linux/module.h> 37#include <linux/module.h>
39#include <linux/init.h> 38#include <linux/init.h>
40#include <linux/kernel.h> 39#include <linux/kernel.h>
41#include <linux/string.h>
42#include <linux/notifier.h> 40#include <linux/notifier.h>
43#include <linux/reboot.h> 41#include <linux/reboot.h>
44#include <linux/sched.h> 42#include <linux/sched.h>
45#include <linux/interrupt.h> 43#include <linux/kthread.h>
46#include <linux/workqueue.h>
47 44
48#include <asm/pdc.h> 45#include <asm/pdc.h>
49#include <asm/io.h> 46#include <asm/io.h>
50#include <asm/led.h> 47#include <asm/led.h>
51#include <asm/uaccess.h>
52 48
49#define DRIVER_NAME "powersw"
50#define KTHREAD_NAME "kpowerswd"
53 51
54#ifdef DEBUG 52/* how often should the power button be polled ? */
55# define DPRINTK(x...) printk(x) 53#define POWERSWITCH_POLL_PER_SEC 2
56#else
57# define DPRINTK(x...)
58#endif
59
60
61/* filename in /proc which can be used to enable/disable the power switch */
62#define SYSCTL_FILENAME "sys/kernel/power"
63 54
55/* how long does the power button needs to be down until we react ? */
56#define POWERSWITCH_DOWN_SEC 2
64 57
58/* assembly code to access special registers */
59/* taken from PCXL ERS page 82 */
65#define DIAG_CODE(code) (0x14000000 + ((code)<<5)) 60#define DIAG_CODE(code) (0x14000000 + ((code)<<5))
66 61
67/* this will go to processor.h or any other place... */
68/* taken from PCXL ERS page 82 */
69#define MFCPU_X(rDiagReg, t_ch, t_th, code) \ 62#define MFCPU_X(rDiagReg, t_ch, t_th, code) \
70 (DIAG_CODE(code) + ((rDiagReg)<<21) + ((t_ch)<<16) + ((t_th)<<0) ) 63 (DIAG_CODE(code) + ((rDiagReg)<<21) + ((t_ch)<<16) + ((t_th)<<0) )
71 64
@@ -76,111 +69,95 @@
76#define __getDIAG(dr) ( { \ 69#define __getDIAG(dr) ( { \
77 register unsigned long __res asm("r28");\ 70 register unsigned long __res asm("r28");\
78 __asm__ __volatile__ ( \ 71 __asm__ __volatile__ ( \
79 ".word %1\n nop\n" : "=&r" (__res) : "i" (MFCPU_T(dr,28)) \ 72 ".word %1" : "=&r" (__res) : "i" (MFCPU_T(dr,28) ) \
80 ); \ 73 ); \
81 __res; \ 74 __res; \
82} ) 75} )
83 76
84 77/* local shutdown counter */
85static void deferred_poweroff(void *dummy)
86{
87 if (kill_cad_pid(SIGINT, 1)) {
88 /* just in case killing init process failed */
89 machine_power_off();
90 }
91}
92
93/*
94 * This function gets called from interrupt context.
95 * As it's called within an interrupt, it wouldn't sync if we don't
96 * use schedule_work().
97 */
98
99static DECLARE_WORK(poweroff_work, deferred_poweroff, NULL);
100
101static void poweroff(void)
102{
103 static int powering_off __read_mostly;
104
105 if (powering_off)
106 return;
107
108 powering_off++;
109 schedule_work(&poweroff_work);
110}
111
112
113/* local time-counter for shutdown */
114static int shutdown_timer __read_mostly; 78static int shutdown_timer __read_mostly;
115 79
116/* check, give feedback and start shutdown after one second */ 80/* check, give feedback and start shutdown after one second */
117static void process_shutdown(void) 81static void process_shutdown(void)
118{ 82{
119 if (shutdown_timer == 0) 83 if (shutdown_timer == 0)
120 DPRINTK(KERN_INFO "Shutdown requested...\n"); 84 printk(KERN_ALERT KTHREAD_NAME ": Shutdown requested...\n");
121 85
122 shutdown_timer++; 86 shutdown_timer++;
123 87
124 /* wait until the button was pressed for 1 second */ 88 /* wait until the button was pressed for 1 second */
125 if (shutdown_timer == HZ) { 89 if (shutdown_timer == (POWERSWITCH_DOWN_SEC*POWERSWITCH_POLL_PER_SEC)) {
126#if defined (DEBUG) || defined(CONFIG_CHASSIS_LCD_LED) 90 static const char msg[] = "Shutting down...";
127 static char msg[] = "Shutting down..."; 91 printk(KERN_INFO KTHREAD_NAME ": %s\n", msg);
128#endif
129 DPRINTK(KERN_INFO "%s\n", msg);
130 lcd_print(msg); 92 lcd_print(msg);
131 poweroff(); 93
94 /* send kill signal */
95 if (kill_cad_pid(SIGINT, 1)) {
96 /* just in case killing init process failed */
97 if (pm_power_off)
98 pm_power_off();
99 }
132 } 100 }
133} 101}
134 102
135 103
136/* main power switch tasklet struct (scheduled from time.c) */ 104/* main power switch task struct */
137DECLARE_TASKLET_DISABLED(power_tasklet, NULL, 0); 105static struct task_struct *power_task;
106
107/* filename in /proc which can be used to enable/disable the power switch */
108#define SYSCTL_FILENAME "sys/kernel/power"
138 109
139/* soft power switch enabled/disabled */ 110/* soft power switch enabled/disabled */
140int pwrsw_enabled __read_mostly = 1; 111int pwrsw_enabled __read_mostly = 1;
141 112
142/* 113/* main kernel thread worker. It polls the button state */
143 * On gecko style machines (e.g. 712/xx and 715/xx) 114static int kpowerswd(void *param)
144 * the power switch status is stored in Bit 0 ("the highest bit")
145 * of CPU diagnose register 25.
146 *
147 */
148static void gecko_tasklet_func(unsigned long unused)
149{ 115{
150 if (unlikely(!pwrsw_enabled)) 116 __set_current_state(TASK_RUNNING);
151 return; 117
152 118 do {
153 if (__getDIAG(25) & 0x80000000) { 119 int button_not_pressed;
154 /* power switch button not pressed or released again */ 120 unsigned long soft_power_reg = (unsigned long) param;
155 /* Warning: Some machines do never reset this DIAG flag! */ 121
156 shutdown_timer = 0; 122 schedule_timeout_interruptible(pwrsw_enabled ? HZ : HZ/POWERSWITCH_POLL_PER_SEC);
157 } else { 123 __set_current_state(TASK_RUNNING);
158 process_shutdown(); 124
159 } 125 if (unlikely(!pwrsw_enabled))
160} 126 continue;
161 127
128 if (soft_power_reg) {
129 /*
130 * Non-Gecko-style machines:
131 * Check the power switch status which is read from the
132 * real I/O location at soft_power_reg.
133 * Bit 31 ("the lowest bit) is the status of the power switch.
134 * This bit is "1" if the button is NOT pressed.
135 */
136 button_not_pressed = (gsc_readl(soft_power_reg) & 0x1);
137 } else {
138 /*
139 * On gecko style machines (e.g. 712/xx and 715/xx)
140 * the power switch status is stored in Bit 0 ("the highest bit")
141 * of CPU diagnose register 25.
142 * Warning: Some machines never reset the DIAG flag, even if
143 * the button has been released again.
144 */
145 button_not_pressed = (__getDIAG(25) & 0x80000000);
146 }
147
148 if (likely(button_not_pressed)) {
149 if (unlikely(shutdown_timer && /* avoid writing if not necessary */
150 shutdown_timer < (POWERSWITCH_DOWN_SEC*POWERSWITCH_POLL_PER_SEC))) {
151 shutdown_timer = 0;
152 printk(KERN_INFO KTHREAD_NAME ": Shutdown request aborted.\n");
153 }
154 } else
155 process_shutdown();
156
157
158 } while (!kthread_should_stop());
162 159
163 160 return 0;
164/*
165 * Check the power switch status which is read from the
166 * real I/O location at soft_power_reg.
167 * Bit 31 ("the lowest bit) is the status of the power switch.
168 */
169
170static void polling_tasklet_func(unsigned long soft_power_reg)
171{
172 unsigned long current_status;
173
174 if (unlikely(!pwrsw_enabled))
175 return;
176
177 current_status = gsc_readl(soft_power_reg);
178 if (current_status & 0x1) {
179 /* power switch button not pressed */
180 shutdown_timer = 0;
181 } else {
182 process_shutdown();
183 }
184} 161}
185 162
186 163
@@ -220,7 +197,7 @@ static struct notifier_block parisc_panic_block = {
220static int __init power_init(void) 197static int __init power_init(void)
221{ 198{
222 unsigned long ret; 199 unsigned long ret;
223 unsigned long soft_power_reg = 0; 200 unsigned long soft_power_reg;
224 201
225#if 0 202#if 0
226 request_irq( IRQ_FROM_REGION(CPU_IRQ_REGION)+2, &powerfail_interrupt, 203 request_irq( IRQ_FROM_REGION(CPU_IRQ_REGION)+2, &powerfail_interrupt,
@@ -235,44 +212,44 @@ static int __init power_init(void)
235 soft_power_reg = -1UL; 212 soft_power_reg = -1UL;
236 213
237 switch (soft_power_reg) { 214 switch (soft_power_reg) {
238 case 0: printk(KERN_INFO "Gecko-style soft power switch enabled.\n"); 215 case 0: printk(KERN_INFO DRIVER_NAME ": Gecko-style soft power switch enabled.\n");
239 power_tasklet.func = gecko_tasklet_func;
240 break; 216 break;
241 217
242 case -1UL: printk(KERN_INFO "Soft power switch support not available.\n"); 218 case -1UL: printk(KERN_INFO DRIVER_NAME ": Soft power switch support not available.\n");
243 return -ENODEV; 219 return -ENODEV;
244 220
245 default: printk(KERN_INFO "Soft power switch enabled, polling @ 0x%08lx.\n", 221 default: printk(KERN_INFO DRIVER_NAME ": Soft power switch at 0x%08lx enabled.\n",
246 soft_power_reg); 222 soft_power_reg);
247 power_tasklet.data = soft_power_reg; 223 }
248 power_tasklet.func = polling_tasklet_func; 224
225 power_task = kthread_run(kpowerswd, (void*)soft_power_reg, KTHREAD_NAME);
226 if (IS_ERR(power_task)) {
227 printk(KERN_ERR DRIVER_NAME ": thread creation failed. Driver not loaded.\n");
228 pdc_soft_power_button(0);
229 return -EIO;
249 } 230 }
250 231
251 /* Register a call for panic conditions. */ 232 /* Register a call for panic conditions. */
252 atomic_notifier_chain_register(&panic_notifier_list, 233 atomic_notifier_chain_register(&panic_notifier_list,
253 &parisc_panic_block); 234 &parisc_panic_block);
254 235
255 tasklet_enable(&power_tasklet);
256
257 return 0; 236 return 0;
258} 237}
259 238
260static void __exit power_exit(void) 239static void __exit power_exit(void)
261{ 240{
262 if (!power_tasklet.func) 241 kthread_stop(power_task);
263 return;
264 242
265 tasklet_disable(&power_tasklet);
266 atomic_notifier_chain_unregister(&panic_notifier_list, 243 atomic_notifier_chain_unregister(&panic_notifier_list,
267 &parisc_panic_block); 244 &parisc_panic_block);
268 power_tasklet.func = NULL; 245
269 pdc_soft_power_button(0); 246 pdc_soft_power_button(0);
270} 247}
271 248
272module_init(power_init); 249arch_initcall(power_init);
273module_exit(power_exit); 250module_exit(power_exit);
274 251
275 252
276MODULE_AUTHOR("Helge Deller"); 253MODULE_AUTHOR("Helge Deller <deller@gmx.de>");
277MODULE_DESCRIPTION("Soft power switch driver"); 254MODULE_DESCRIPTION("Soft power switch driver");
278MODULE_LICENSE("Dual BSD/GPL"); 255MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 76a29dadd519..322957ac2ad1 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -109,7 +109,7 @@ static unsigned long piranha_bad_128k = 0;
109 109
110#ifdef SBA_AGP_SUPPORT 110#ifdef SBA_AGP_SUPPORT
111static int sba_reserve_agpgart = 1; 111static int sba_reserve_agpgart = 1;
112module_param(sba_reserve_agpgart, int, 1); 112module_param(sba_reserve_agpgart, int, 0444);
113MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART"); 113MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART");
114#endif 114#endif
115 115
@@ -846,7 +846,7 @@ static void *sba_alloc_consistent(struct device *hwdev, size_t size,
846 if (!hwdev) { 846 if (!hwdev) {
847 /* only support PCI */ 847 /* only support PCI */
848 *dma_handle = 0; 848 *dma_handle = 0;
849 return 0; 849 return NULL;
850 } 850 }
851 851
852 ret = (void *) __get_free_pages(gfp, get_order(size)); 852 ret = (void *) __get_free_pages(gfp, get_order(size));