aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parisc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/parisc')
-rw-r--r--drivers/parisc/asp.c6
-rw-r--r--drivers/parisc/ccio-dma.c144
-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.c166
-rw-r--r--drivers/parisc/superio.c3
-rw-r--r--drivers/parisc/wax.c2
15 files changed, 366 insertions, 271 deletions
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 0e98a9d9834c..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;
@@ -836,7 +836,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
836 * This function implements the pci_alloc_consistent function. 836 * This function implements the pci_alloc_consistent function.
837 */ 837 */
838static void * 838static void *
839ccio_alloc_consistent(struct device *dev, size_t size, dma_addr_t *dma_handle, int flag) 839ccio_alloc_consistent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag)
840{ 840{
841 void *ret; 841 void *ret;
842#if 0 842#if 0
@@ -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 82ea68b55df4..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.
@@ -986,7 +1024,7 @@ sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
986 * See Documentation/DMA-mapping.txt 1024 * See Documentation/DMA-mapping.txt
987 */ 1025 */
988static void *sba_alloc_consistent(struct device *hwdev, size_t size, 1026static void *sba_alloc_consistent(struct device *hwdev, size_t size,
989 dma_addr_t *dma_handle, int gfp) 1027 dma_addr_t *dma_handle, gfp_t gfp)
990{ 1028{
991 void *ret; 1029 void *ret;
992 1030
@@ -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);