22 #include <linux/types.h>
23 #include <linux/kernel.h>
25 #include <linux/slab.h>
29 #include <linux/string.h>
30 #include <linux/pci.h>
34 #include <asm/byteorder.h>
42 #include <linux/module.h>
52 #define MODULE_NAME "SBA"
61 #undef DEBUG_SBA_RUN_SG
62 #undef DEBUG_SBA_RESOURCE
63 #undef ASSERT_PDIR_SANITY
64 #undef DEBUG_LARGE_SG_ENTRIES
68 #define DBG_INIT(x...) printk(x)
70 #define DBG_INIT(x...)
74 #define DBG_RUN(x...) printk(x)
79 #ifdef DEBUG_SBA_RUN_SG
80 #define DBG_RUN_SG(x...) printk(x)
82 #define DBG_RUN_SG(x...)
86 #ifdef DEBUG_SBA_RESOURCE
87 #define DBG_RES(x...) printk(x)
92 #define SBA_INLINE __inline__
94 #define DEFAULT_DMA_HINT_REG 0
99 static unsigned long ioc_needs_fdc = 0;
102 static unsigned int global_ioc_cnt = 0;
105 static unsigned long piranha_bad_128k = 0;
108 #define SBA_DEV(d) ((struct sba_device *) (d))
110 #ifdef CONFIG_AGP_PARISC
111 #define SBA_AGP_SUPPORT
114 #ifdef SBA_AGP_SUPPORT
115 static int sba_reserve_agpgart = 1;
117 MODULE_PARM_DESC(sba_reserve_agpgart,
"Reserve half of IO pdir as AGPGART");
129 #define READ_REG32(addr) readl(addr)
130 #define READ_REG64(addr) readq(addr)
131 #define WRITE_REG32(val, addr) writel((val), (addr))
132 #define WRITE_REG64(val, addr) writeq((val), (addr))
135 #define READ_REG(addr) READ_REG64(addr)
136 #define WRITE_REG(value, addr) WRITE_REG64(value, addr)
138 #define READ_REG(addr) READ_REG32(addr)
139 #define WRITE_REG(value, addr) WRITE_REG32(value, addr)
142 #ifdef DEBUG_SBA_INIT
182 #define sba_dump_ranges(x)
183 #define sba_dump_tlb(x)
187 #ifdef ASSERT_PDIR_SANITY
202 unsigned long *
rptr = (
unsigned long *) &(ioc->
res_map[(pide >>3) & ~(
sizeof(
unsigned long) - 1)]);
230 sba_check_pdir(
struct ioc *
ioc,
char *
msg)
237 while (rptr < rptr_end) {
243 u32 pde = ((
u32) (((
char *)pptr)[7])) << 24;
244 if ((rval ^ pde) & 0x80000000)
250 sba_dump_pdir_entry(ioc, msg, pide);
274 sba_dump_sg(
struct ioc *ioc,
struct scatterlist *startsg,
int nents)
276 while (nents-- > 0) {
300 #define PAGES_PER_RANGE 1
306 #define SBA_IOVA(ioc,iovp,offset,hint_reg) ((ioc->ibase) | (iovp) | (offset))
307 #define SBA_IOVP(ioc,iova) ((iova) & (ioc)->iovp_mask)
310 #define SBA_IOVA(ioc,iovp,offset,hint_reg) ((iovp) | (offset))
311 #define SBA_IOVP(ioc,iova) (iova)
314 #define PDIR_INDEX(iovp) ((iovp)>>IOVP_SHIFT)
316 #define RESMAP_MASK(n) (~0UL << (BITS_PER_LONG - (n)))
317 #define RESMAP_IDX_MASK (sizeof(unsigned long) - 1)
319 static unsigned long ptr_to_pide(
struct ioc *ioc,
unsigned long *res_ptr,
320 unsigned int bitshiftcnt)
322 return (((
unsigned long)res_ptr - (
unsigned long)ioc->
res_map) << 3)
336 sba_search_bitmap(
struct ioc *ioc,
struct device *
dev,
337 unsigned long bits_wanted)
339 unsigned long *res_ptr = ioc->
res_hint;
340 unsigned long *res_end = (
unsigned long *) &(ioc->
res_map[ioc->
res_size]);
341 unsigned long pide = ~0
UL, tpide;
342 unsigned long boundary_size;
346 boundary_size =
ALIGN((
unsigned long long)dma_get_seg_boundary(dev) + 1,
349 #if defined(ZX1_SUPPORT)
358 for(; res_ptr < res_end; ++res_ptr) {
359 tpide = ptr_to_pide(ioc, res_ptr, 0);
363 if ((*res_ptr == 0) && !ret) {
389 DBG_RES(
"%s() o %ld %p", __func__, o, res_ptr);
390 while(res_ptr < res_end)
392 DBG_RES(
" %p %lx %lx\n", res_ptr, mask, *res_ptr);
394 tpide = ptr_to_pide(ioc, res_ptr, bitshiftcnt);
398 if ((((*res_ptr) & mask) == 0) && !ret) {
416 if (res_end <= res_ptr) {
435 sba_alloc_range(
struct ioc *ioc,
struct device *dev,
size_t size)
437 unsigned int pages_needed = size >>
IOVP_SHIFT;
438 #ifdef SBA_COLLECT_STATS
439 unsigned long cr_start =
mfctl(16);
443 pide = sba_search_bitmap(ioc, dev, pages_needed);
445 pide = sba_search_bitmap(ioc, dev, pages_needed);
447 panic(
"%s: I/O MMU @ %p is out of mapping resources\n",
451 #ifdef ASSERT_PDIR_SANITY
454 sba_dump_pdir_entry(ioc,
"sba_search_bitmap() botched it?", pide);
458 DBG_RES(
"%s(%x) %d -> %lx hint %x/%x\n",
459 __func__, size, pages_needed, pide,
463 #ifdef SBA_COLLECT_STATS
465 unsigned long cr_end =
mfctl(16);
466 unsigned long tmp = cr_end - cr_start;
468 cr_start = (cr_end < cr_start) ? -(tmp) : (
tmp);
470 ioc->avg_search[ioc->avg_idx++] = cr_start;
471 ioc->avg_idx &= SBA_SEARCH_SAMPLE - 1;
473 ioc->used_pages += pages_needed;
491 unsigned long iovp =
SBA_IOVP(ioc, iova);
493 unsigned int ridx = pide >> 3;
494 unsigned long *res_ptr = (
unsigned long *) &((ioc)->res_map[ridx & ~
RESMAP_IDX_MASK]);
501 DBG_RES(
"%s( ,%x,%x) %x/%lx %x %p %lx\n",
502 __func__, (
uint) iova, size,
503 bits_not_wanted, m, pide, res_ptr, *res_ptr);
505 #ifdef SBA_COLLECT_STATS
506 ioc->used_pages -= bits_not_wanted;
519 #ifdef SBA_HINT_SUPPORT
520 #define SBA_DMA_HINT(ioc, val) ((val) << (ioc)->hint_shift_pdir)
524 #define KERNEL_SPACE 0
571 register unsigned ci;
577 asm(
"lci 0(%%sr1, %1), %0" :
"=r" (ci) :
"r" (vba));
578 pa |= (ci >> 12) & 0xff;
589 asm volatile(
"fdc %%r0(%0)" : :
"r" (pdir_ptr));
610 sba_mark_invalid(
struct ioc *ioc,
dma_addr_t iova,
size_t byte_cnt)
615 #ifdef ASSERT_PDIR_SANITY
622 if (0x80 != (((
u8 *) pdir_ptr)[7])) {
623 sba_dump_pdir_entry(ioc,
"sba_mark_invalid()",
PDIR_INDEX(iovp));
630 unsigned long entries_per_cacheline = ioc_needs_fdc ?
632 - (
unsigned long) pdir_ptr;
641 ((
u8 *) pdir_ptr)[7] = 0;
643 asm volatile(
"fdc %%r0(%0)" : :
"r" (pdir_ptr));
661 ((
u8 *) pdir_ptr)[7] = 0;
663 asm volatile(
"fdc %%r0(%0)" : :
"r" (pdir_ptr));
675 static int sba_dma_supported(
struct device *dev,
u64 mask)
699 return((
int)(mask >= (ioc->
ibase - 1 +
714 sba_map_single(
struct device *dev,
void *
addr,
size_t size,
733 #ifdef ASSERT_PDIR_SANITY
734 sba_check_pdir(ioc,
"Check before sba_map_single()");
737 #ifdef SBA_COLLECT_STATS
738 ioc->msingle_calls++;
741 pide = sba_alloc_range(ioc, dev, size);
744 DBG_RUN(
"%s() 0x%p -> 0x%lx\n",
745 __func__, addr, (
long) iovp | offset);
752 DBG_RUN(
" pdir 0x%p %02x%02x%02x%02x%02x%02x%02x%02x\n",
754 (
u8) (((
u8 *) pdir_start)[7]),
755 (
u8) (((
u8 *) pdir_start)[6]),
756 (
u8) (((
u8 *) pdir_start)[5]),
757 (
u8) (((
u8 *) pdir_start)[4]),
758 (
u8) (((
u8 *) pdir_start)[3]),
759 (
u8) (((
u8 *) pdir_start)[2]),
760 (
u8) (((
u8 *) pdir_start)[1]),
761 (
u8) (((
u8 *) pdir_start)[0])
771 asm volatile(
"sync" : : );
773 #ifdef ASSERT_PDIR_SANITY
774 sba_check_pdir(ioc,
"Check after sba_map_single()");
776 spin_unlock_irqrestore(&ioc->
res_lock, flags);
797 #if DELAYED_RESOURCE_CNT > 0
798 struct sba_dma_pair *
d;
803 DBG_RUN(
"%s() iovp 0x%lx/%x\n", __func__, (
long) iova, size);
813 #ifdef SBA_COLLECT_STATS
814 ioc->usingle_calls++;
818 sba_mark_invalid(ioc, iova, size);
820 #if DELAYED_RESOURCE_CNT > 0
830 sba_free_range(ioc, d->iova, d->size);
838 sba_free_range(ioc, iova, size);
842 asm volatile(
"sync" : : );
847 spin_unlock_irqrestore(&ioc->
res_lock, flags);
868 static void *sba_alloc_consistent(
struct device *hwdev,
size_t size,
883 *dma_handle = sba_map_single(hwdev, ret, size, 0);
900 sba_free_consistent(
struct device *hwdev,
size_t size,
void *
vaddr,
903 sba_unmap_single(hwdev, dma_handle, size, 0);
913 #define PIDE_FLAG 0x80000000UL
915 #ifdef SBA_COLLECT_STATS
916 #define IOMMU_MAP_STATS
920 #ifdef DEBUG_LARGE_SG_ENTRIES
939 int coalesced, filled = 0;
942 DBG_RUN_SG(
"%s() START %d entries\n", __func__, nents);
950 sglist->
length, direction);
957 #ifdef ASSERT_PDIR_SANITY
958 if (sba_check_pdir(ioc,
"Check before sba_map_sg()"))
960 sba_dump_sg(ioc, sglist, nents);
961 panic(
"Check before sba_map_sg()");
965 #ifdef SBA_COLLECT_STATS
977 coalesced = iommu_coalesce_chunks(ioc, dev, sglist, nents, sba_alloc_range);
991 asm volatile(
"sync" : : );
993 #ifdef ASSERT_PDIR_SANITY
994 if (sba_check_pdir(ioc,
"Check after sba_map_sg()"))
996 sba_dump_sg(ioc, sglist, nents);
997 panic(
"Check after sba_map_sg()\n");
1001 spin_unlock_irqrestore(&ioc->
res_lock, flags);
1003 DBG_RUN_SG(
"%s() DONE %d mappings\n", __func__, filled);
1023 #ifdef ASSERT_PDIR_SANITY
1024 unsigned long flags;
1032 #ifdef SBA_COLLECT_STATS
1036 #ifdef ASSERT_PDIR_SANITY
1038 sba_check_pdir(ioc,
"Check before sba_unmap_sg()");
1039 spin_unlock_irqrestore(&ioc->
res_lock, flags);
1045 #ifdef SBA_COLLECT_STATS
1047 ioc->usingle_calls--;
1052 DBG_RUN_SG(
"%s() DONE (nents %d)\n", __func__, nents);
1054 #ifdef ASSERT_PDIR_SANITY
1056 sba_check_pdir(ioc,
"Check after sba_unmap_sg()");
1057 spin_unlock_irqrestore(&ioc->
res_lock, flags);
1063 .dma_supported = sba_dma_supported,
1064 .alloc_consistent = sba_alloc_consistent,
1065 .alloc_noncoherent = sba_alloc_consistent,
1066 .free_consistent = sba_free_consistent,
1067 .map_single = sba_map_single,
1068 .unmap_single = sba_unmap_single,
1069 .map_sg = sba_map_sg,
1070 .unmap_sg = sba_unmap_sg,
1071 .dma_sync_single_for_cpu =
NULL,
1072 .dma_sync_single_for_device =
NULL,
1073 .dma_sync_sg_for_cpu =
NULL,
1074 .dma_sync_sg_for_device =
NULL,
1088 sba_get_pat_resources(
struct sba_device *sba_dev)
1112 #define PIRANHA_ADDR_MASK 0x00160000UL
1113 #define PIRANHA_ADDR_VAL 0x00060000UL
1115 sba_alloc_pdir(
unsigned int pdir_size)
1117 unsigned long pdir_base;
1118 unsigned long pdir_order =
get_order(pdir_size);
1121 if (
NULL == (
void *) pdir_base) {
1122 panic(
"%s() could not allocate I/O Page Table\n",
1135 return (
void *) pdir_base;
1155 if (pdir_order <= (19-12)) {
1162 pdir_base = new_pdir;
1165 while (pdir_order < (19-12)) {
1166 new_pdir += pdir_size;
1185 pdir_base = new_pdir + 1024*1024;
1187 if (pdir_order > (20-12)) {
1194 piranha_bad_128k = 1;
1196 new_pdir += 3*1024*1024;
1203 pdir_size -= 128*1024;
1207 memset((
void *) pdir_base, 0, pdir_size);
1208 return (
void *) pdir_base;
1216 static int setup_ibase_imask_callback(
struct device *dev,
void *
data)
1222 int rope_num = (lba->
hpa.start >> 13) & 0xf;
1223 if (rope_num >> 3 == ibd->
ioc_num)
1238 setup_ibase_imask_callback);
1241 #ifdef SBA_AGP_SUPPORT
1243 sba_ioc_find_quicksilver(
struct device *dev,
void *
data)
1245 int *agp_found =
data;
1248 if (IS_QUICKSILVER(lba))
1255 sba_ioc_init_pluto(
struct parisc_device *
sba,
struct ioc *ioc,
int ioc_num)
1257 u32 iova_space_mask;
1258 u32 iova_space_size;
1259 int iov_order, tcnfg;
1260 #ifdef SBA_AGP_SUPPORT
1271 if ((ioc->
ibase < 0xfed00000UL) && ((ioc->
ibase + iova_space_size) > 0xfee00000UL)) {
1272 printk(
"WARNING: IOV space overlaps local config and interrupt message, truncating\n");
1273 iova_space_size /= 2;
1283 DBG_INIT(
"%s() hpa 0x%p IOV %dMB (%d bits)\n",
1284 __func__, ioc->
ioc_hpa, iova_space_size >> 20,
1290 panic(
"Couldn't allocate I/O Page Table\n");
1297 #ifdef SBA_HINT_SUPPORT
1298 ioc->hint_shift_pdir = iov_order +
PAGE_SHIFT;
1299 ioc->hint_mask_pdir = ~(0x3 << (iov_order +
PAGE_SHIFT));
1301 DBG_INIT(
" hint_shift_pdir %x hint_mask_pdir %lx\n",
1302 ioc->hint_shift_pdir, ioc->hint_mask_pdir);
1309 iova_space_mask = 0xffffffff;
1310 iova_space_mask <<= (iov_order +
PAGE_SHIFT);
1311 ioc->
imask = iova_space_mask;
1313 ioc->iovp_mask = ~(iova_space_mask +
PAGE_SIZE - 1);
1317 setup_ibase_imask(sba, ioc, ioc_num);
1326 ioc->
imask |= 0xFFFFFFFF00000000
UL;
1330 switch (PAGE_SHIFT) {
1331 case 12: tcnfg = 0;
break;
1332 case 13: tcnfg = 1;
break;
1333 case 14: tcnfg = 2;
break;
1334 case 16: tcnfg = 3;
break;
1336 panic(__FILE__
"Unsupported system page size %d",
1354 #ifdef SBA_AGP_SUPPORT
1366 if (agp_found && sba_reserve_agpgart) {
1368 __func__, (iova_space_size/2) >> 20);
1376 sba_ioc_init(
struct parisc_device *sba,
struct ioc *ioc,
int ioc_num)
1378 u32 iova_space_size, iova_space_mask;
1379 unsigned int pdir_size, iov_order;
1395 iova_space_size = (
u32) (totalram_pages/global_ioc_cnt);
1398 if (iova_space_size < (1 << (20 - PAGE_SHIFT))) {
1401 else if (iova_space_size > (1 << (30 - PAGE_SHIFT))) {
1410 iov_order =
get_order(iova_space_size << PAGE_SHIFT);
1413 iova_space_size = 1 << (iov_order +
PAGE_SHIFT);
1417 DBG_INIT(
"%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n",
1420 (
unsigned long) totalram_pages >> (20 - PAGE_SHIFT),
1421 iova_space_size>>20,
1422 iov_order + PAGE_SHIFT);
1424 ioc->
pdir_base = sba_alloc_pdir(pdir_size);
1429 #ifdef SBA_HINT_SUPPORT
1431 ioc->hint_shift_pdir = iov_order +
PAGE_SHIFT;
1432 ioc->hint_mask_pdir = ~(0x3 << (iov_order +
PAGE_SHIFT));
1434 DBG_INIT(
" hint_shift_pdir %x hint_mask_pdir %lx\n",
1435 ioc->hint_shift_pdir, ioc->hint_mask_pdir);
1441 iova_space_mask = 0xffffffff;
1442 iova_space_mask <<= (iov_order +
PAGE_SHIFT);
1449 ioc->
imask = iova_space_mask;
1451 ioc->iovp_mask = ~(iova_space_mask +
PAGE_SIZE - 1);
1454 DBG_INIT(
"%s() IOV base 0x%lx mask 0x%0lx\n",
1463 setup_ibase_imask(sba, ioc, ioc_num);
1503 static void sba_hw_init(
struct sba_device *sba_dev)
1535 printk(
"sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n",
PAGE0->mem_boot.hpa,
1553 if (!IS_PLUTO(sba_dev->
dev)) {
1555 DBG_INIT(
"%s() hpa 0x%lx ioc_ctl 0x%Lx ->",
1556 __func__, sba_dev->
sba_hpa, ioc_ctl);
1564 #ifdef DEBUG_SBA_INIT
1570 if (IS_ASTRO(sba_dev->
dev)) {
1575 sba_dev->
chip_resv.name =
"Astro Intr Ack";
1581 }
else if (IS_PLUTO(sba_dev->
dev)) {
1587 sba_dev->
chip_resv.name =
"Pluto Intr/PIOP/VGA";
1609 for (i = 0; i < num_ioc; i++) {
1621 if (IS_PLUTO(sba_dev->
dev)) {
1623 unsigned long cfg_val;
1640 DBG_INIT(
" ioc[%d] ROPE_CFG 0x%Lx ROPE_DBG 0x%Lx\n",
1645 DBG_INIT(
" STATUS_CONTROL 0x%Lx FLUSH_CTRL 0x%Lx\n",
1650 if (IS_PLUTO(sba_dev->
dev)) {
1651 sba_ioc_init_pluto(sba_dev->
dev, &(sba_dev->
ioc[i]), i);
1653 sba_ioc_init(sba_dev->
dev, &(sba_dev->
ioc[i]), i);
1669 for(i=0; i< sba_dev->
num_ioc; i++) {
1671 #ifdef DEBUG_DMB_TRAP
1672 extern void iterate_pages(
unsigned long ,
unsigned long ,
1673 void (*)(
pte_t * ,
unsigned long),
1675 void set_data_memory_break(
pte_t * ,
unsigned long);
1678 res_size = sba_dev->
ioc[
i].pdir_size/
sizeof(
u64);
1681 if (piranha_bad_128k) {
1682 res_size -= (128*1024)/
sizeof(
u64);
1687 __func__, res_size);
1692 #ifdef DEBUG_DMB_TRAP
1693 iterate_pages( sba_dev->
ioc[i].res_map, res_size,
1694 set_data_memory_break, 0);
1697 if (
NULL == sba_dev->
ioc[i].res_map)
1699 panic(
"%s:%s() could not allocate resource map\n",
1700 __FILE__, __func__ );
1703 memset(sba_dev->
ioc[i].res_map, 0, res_size);
1705 sba_dev->
ioc[
i].res_hint = (
unsigned long *)
1708 #ifdef ASSERT_PDIR_SANITY
1710 sba_dev->
ioc[
i].res_map[0] = 0x80;
1711 sba_dev->
ioc[
i].pdir_base[0] = 0xeeffc0addbba0080ULL;
1715 if (piranha_bad_128k) {
1718 int idx_start = (1408*1024/
sizeof(
u64)) >> 3;
1719 int idx_end = (1536*1024/
sizeof(
u64)) >> 3;
1720 long *p_start = (
long *) &(sba_dev->
ioc[i].res_map[idx_start]);
1721 long *p_end = (
long *) &(sba_dev->
ioc[i].res_map[idx_end]);
1724 while (p_start < p_end)
1729 #ifdef DEBUG_DMB_TRAP
1730 iterate_pages( sba_dev->
ioc[i].res_map, res_size,
1731 set_data_memory_break, 0);
1732 iterate_pages( sba_dev->
ioc[i].pdir_base, sba_dev->
ioc[i].pdir_size,
1733 set_data_memory_break, 0);
1736 DBG_INIT(
"%s() %d res_map %x %p\n",
1737 __func__, i, res_size, sba_dev->
ioc[i].res_map);
1743 #ifdef DEBUG_SBA_INIT
1749 if (ioc_needs_fdc) {
1757 #ifdef CONFIG_PROC_FS
1758 static int sba_proc_info(
struct seq_file *m,
void *
p)
1761 struct ioc *ioc = &sba_dev->
ioc[0];
1763 #ifdef SBA_COLLECT_STATS
1770 (sba_dev->
hw_rev & 0x7) + 1,
1771 (sba_dev->
hw_rev & 0x18) >> 3
1773 len +=
seq_printf(m,
"IO PDIR size : %d bytes (%d entries)\n",
1777 len +=
seq_printf(m,
"Resource bitmap : %d bytes (%d pages)\n",
1780 len +=
seq_printf(m,
"LMMIO_BASE/MASK/ROUTE %08x %08x %08x\n",
1787 len +=
seq_printf(m,
"DIR%d_BASE/MASK/ROUTE %08x %08x %08x\n", i,
1793 #ifdef SBA_COLLECT_STATS
1794 len +=
seq_printf(m,
"IO PDIR entries : %ld free %ld used (%d%%)\n",
1795 total_pages - ioc->used_pages, ioc->used_pages,
1796 (
int) (ioc->used_pages * 100 / total_pages));
1798 min = max = ioc->avg_search[0];
1799 for (i = 0; i < SBA_SEARCH_SAMPLE; i++) {
1800 avg += ioc->avg_search[
i];
1801 if (ioc->avg_search[i] > max) max = ioc->avg_search[
i];
1802 if (ioc->avg_search[i] <
min)
min = ioc->avg_search[
i];
1804 avg /= SBA_SEARCH_SAMPLE;
1805 len +=
seq_printf(m,
" Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n",
1808 len +=
seq_printf(m,
"pci_map_single(): %12ld calls %12ld pages (avg %d/1000)\n",
1809 ioc->msingle_calls, ioc->msingle_pages,
1810 (
int) ((ioc->msingle_pages * 1000)/ioc->msingle_calls));
1813 min = ioc->usingle_calls;
1814 max = ioc->usingle_pages - ioc->usg_pages;
1815 len +=
seq_printf(m,
"pci_unmap_single: %12ld calls %12ld pages (avg %d/1000)\n",
1816 min, max, (
int) ((max * 1000)/
min));
1818 len +=
seq_printf(m,
"pci_map_sg() : %12ld calls %12ld pages (avg %d/1000)\n",
1819 ioc->msg_calls, ioc->msg_pages,
1820 (
int) ((ioc->msg_pages * 1000)/ioc->msg_calls));
1822 len +=
seq_printf(m,
"pci_unmap_sg() : %12ld calls %12ld pages (avg %d/1000)\n",
1823 ioc->usg_calls, ioc->usg_pages,
1824 (
int) ((ioc->usg_pages * 1000)/ioc->usg_calls));
1831 sba_proc_open(
struct inode *i,
struct file *
f)
1838 .open = sba_proc_open,
1845 sba_proc_bitmap_info(
struct seq_file *m,
void *p)
1848 struct ioc *ioc = &sba_dev->
ioc[0];
1849 unsigned int *res_ptr = (
unsigned int *)ioc->
res_map;
1852 for (i = 0; i < (ioc->
res_size/
sizeof(
unsigned int)); ++
i, ++res_ptr) {
1863 sba_proc_bitmap_open(
struct inode *i,
struct file *
f)
1870 .open = sba_proc_bitmap_open,
1890 .id_table = sba_tbl,
1891 .probe = sba_driver_callback,
1906 #ifdef CONFIG_PROC_FS
1915 if (IS_ASTRO(dev)) {
1916 unsigned long fclass;
1917 static char astro_rev[]=
"Astro ?.?";
1922 astro_rev[6] =
'1' + (
char) (fclass & 0x7);
1923 astro_rev[8] =
'0' + (
char) ((fclass & 0x18) >> 3);
1924 version = astro_rev;
1926 }
else if (IS_IKE(dev)) {
1927 static char ike_rev[] =
"Ike rev ?";
1928 ike_rev[8] =
'0' + (
char) (func_class & 0xff);
1930 }
else if (IS_PLUTO(dev)) {
1931 static char pluto_rev[]=
"Pluto ?.?";
1932 pluto_rev[6] =
'0' + (
char) ((func_class & 0xf0) >> 4);
1933 pluto_rev[8] =
'0' + (
char) (func_class & 0x0f);
1934 version = pluto_rev;
1936 static char reo_rev[] =
"REO rev ?";
1937 reo_rev[8] =
'0' + (
char) (func_class & 0xff);
1941 if (!global_ioc_cnt) {
1945 if ((!IS_ASTRO(dev)) || (!IS_PLUTO(dev)))
1946 global_ioc_cnt *= 2;
1958 parisc_set_drvdata(dev, sba_dev);
1964 sba_dev->
hw_rev = func_class;
1968 sba_get_pat_resources(sba_dev);
1969 sba_hw_init(sba_dev);
1970 sba_common_init(sba_dev);
1974 #ifdef CONFIG_PROC_FS
1975 switch (dev->
id.hversion) {
1977 root = proc_mckinley_root;
1982 root = proc_runway_root;
1986 proc_create(
"sba_iommu", 0, root, &sba_proc_fops);
1987 proc_create(
"sba_iommu-bitmap", 0, root, &sba_proc_bitmap_fops);
2016 char t = sba_dev->
id.hw_type;
2017 int iocnum = (pci_hba->
hw_path >> 3);
2021 return &(sba->
ioc[iocnum]);
2037 char t = sba_dev->
id.hw_type;
2046 for (i=0; i<4; i++) {
2051 if ((base & 1) == 0)
2080 char t = sba_dev->
id.hw_type;
2089 if ((base & 1) == 0) {
2097 r->
start += rope * (size + 1);