diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2006-02-20 05:13:31 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-02-20 05:13:31 -0500 |
commit | ff607748590fba14aecedb0d50edc4ada98d4302 (patch) | |
tree | 986e0a3abe922713069a8e8bc913043fed89a39a /drivers/parisc | |
parent | db024d5398cd332023896caf70530564b15ec88e (diff) | |
parent | 6aff8f1f07a7fff48121d1ad4a550f3af24ccc81 (diff) |
Merge branch 'upstream'
Diffstat (limited to 'drivers/parisc')
-rw-r--r-- | drivers/parisc/ccio-dma.c | 160 | ||||
-rw-r--r-- | drivers/parisc/sba_iommu.c | 125 |
2 files changed, 152 insertions, 133 deletions
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index f46e8438e0d2..93f8a8fa8890 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c | |||
@@ -40,6 +40,8 @@ | |||
40 | #include <linux/string.h> | 40 | #include <linux/string.h> |
41 | #include <linux/pci.h> | 41 | #include <linux/pci.h> |
42 | #include <linux/reboot.h> | 42 | #include <linux/reboot.h> |
43 | #include <linux/proc_fs.h> | ||
44 | #include <linux/seq_file.h> | ||
43 | 45 | ||
44 | #include <asm/byteorder.h> | 46 | #include <asm/byteorder.h> |
45 | #include <asm/cache.h> /* for L1_CACHE_BYTES */ | 47 | #include <asm/cache.h> /* for L1_CACHE_BYTES */ |
@@ -1019,62 +1021,33 @@ static struct hppa_dma_ops ccio_ops = { | |||
1019 | }; | 1021 | }; |
1020 | 1022 | ||
1021 | #ifdef CONFIG_PROC_FS | 1023 | #ifdef CONFIG_PROC_FS |
1022 | static int proc_append(char *src, int len, char **dst, off_t *offset, int *max) | 1024 | static int ccio_proc_info(struct seq_file *m, void *p) |
1023 | { | ||
1024 | if (len < *offset) { | ||
1025 | *offset -= len; | ||
1026 | return 0; | ||
1027 | } | ||
1028 | if (*offset > 0) { | ||
1029 | src += *offset; | ||
1030 | len -= *offset; | ||
1031 | *offset = 0; | ||
1032 | } | ||
1033 | if (len > *max) { | ||
1034 | len = *max; | ||
1035 | } | ||
1036 | memcpy(*dst, src, len); | ||
1037 | *dst += len; | ||
1038 | *max -= len; | ||
1039 | return (*max == 0); | ||
1040 | } | ||
1041 | |||
1042 | static int ccio_proc_info(char *buf, char **start, off_t offset, int count, | ||
1043 | int *eof, void *data) | ||
1044 | { | 1025 | { |
1045 | int max = count; | 1026 | int len = 0; |
1046 | char tmp[80]; /* width of an ANSI-standard terminal */ | ||
1047 | struct ioc *ioc = ioc_list; | 1027 | struct ioc *ioc = ioc_list; |
1048 | 1028 | ||
1049 | while (ioc != NULL) { | 1029 | while (ioc != NULL) { |
1050 | unsigned int total_pages = ioc->res_size << 3; | 1030 | unsigned int total_pages = ioc->res_size << 3; |
1051 | unsigned long avg = 0, min, max; | 1031 | unsigned long avg = 0, min, max; |
1052 | int j, len; | 1032 | int j; |
1053 | 1033 | ||
1054 | len = sprintf(tmp, "%s\n", ioc->name); | 1034 | len += seq_printf(m, "%s\n", ioc->name); |
1055 | if (proc_append(tmp, len, &buf, &offset, &count)) | ||
1056 | break; | ||
1057 | 1035 | ||
1058 | len = sprintf(tmp, "Cujo 2.0 bug : %s\n", | 1036 | len += seq_printf(m, "Cujo 2.0 bug : %s\n", |
1059 | (ioc->cujo20_bug ? "yes" : "no")); | 1037 | (ioc->cujo20_bug ? "yes" : "no")); |
1060 | if (proc_append(tmp, len, &buf, &offset, &count)) | ||
1061 | break; | ||
1062 | 1038 | ||
1063 | len = sprintf(tmp, "IO PDIR size : %d bytes (%d entries)\n", | 1039 | len += seq_printf(m, "IO PDIR size : %d bytes (%d entries)\n", |
1064 | total_pages * 8, total_pages); | 1040 | total_pages * 8, total_pages); |
1065 | if (proc_append(tmp, len, &buf, &offset, &count)) | 1041 | |
1066 | break; | ||
1067 | #ifdef CCIO_MAP_STATS | 1042 | #ifdef CCIO_MAP_STATS |
1068 | len = sprintf(tmp, "IO PDIR entries : %ld free %ld used (%d%%)\n", | 1043 | len += seq_printf(m, "IO PDIR entries : %ld free %ld used (%d%%)\n", |
1069 | total_pages - ioc->used_pages, ioc->used_pages, | 1044 | total_pages - ioc->used_pages, ioc->used_pages, |
1070 | (int)(ioc->used_pages * 100 / total_pages)); | 1045 | (int)(ioc->used_pages * 100 / total_pages)); |
1071 | if (proc_append(tmp, len, &buf, &offset, &count)) | ||
1072 | break; | ||
1073 | #endif | 1046 | #endif |
1074 | len = sprintf(tmp, "Resource bitmap : %d bytes (%d pages)\n", | 1047 | |
1075 | ioc->res_size, total_pages); | 1048 | len += seq_printf(m, "Resource bitmap : %d bytes (%d pages)\n", |
1076 | if (proc_append(tmp, len, &buf, &offset, &count)) | 1049 | ioc->res_size, total_pages); |
1077 | break; | 1050 | |
1078 | #ifdef CCIO_SEARCH_TIME | 1051 | #ifdef CCIO_SEARCH_TIME |
1079 | min = max = ioc->avg_search[0]; | 1052 | min = max = ioc->avg_search[0]; |
1080 | for(j = 0; j < CCIO_SEARCH_SAMPLE; ++j) { | 1053 | for(j = 0; j < CCIO_SEARCH_SAMPLE; ++j) { |
@@ -1085,70 +1058,83 @@ static int ccio_proc_info(char *buf, char **start, off_t offset, int count, | |||
1085 | min = ioc->avg_search[j]; | 1058 | min = ioc->avg_search[j]; |
1086 | } | 1059 | } |
1087 | avg /= CCIO_SEARCH_SAMPLE; | 1060 | avg /= CCIO_SEARCH_SAMPLE; |
1088 | len = sprintf(tmp, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n", | 1061 | len += seq_printf(m, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n", |
1089 | min, avg, max); | 1062 | min, avg, max); |
1090 | if (proc_append(tmp, len, &buf, &offset, &count)) | ||
1091 | break; | ||
1092 | #endif | 1063 | #endif |
1093 | #ifdef CCIO_MAP_STATS | 1064 | #ifdef CCIO_MAP_STATS |
1094 | len = sprintf(tmp, "pci_map_single(): %8ld calls %8ld pages (avg %d/1000)\n", | 1065 | len += seq_printf(m, "pci_map_single(): %8ld calls %8ld pages (avg %d/1000)\n", |
1095 | ioc->msingle_calls, ioc->msingle_pages, | 1066 | ioc->msingle_calls, ioc->msingle_pages, |
1096 | (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls)); | 1067 | (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls)); |
1097 | if (proc_append(tmp, len, &buf, &offset, &count)) | ||
1098 | break; | ||
1099 | |||
1100 | 1068 | ||
1101 | /* KLUGE - unmap_sg calls unmap_single for each mapped page */ | 1069 | /* KLUGE - unmap_sg calls unmap_single for each mapped page */ |
1102 | min = ioc->usingle_calls - ioc->usg_calls; | 1070 | min = ioc->usingle_calls - ioc->usg_calls; |
1103 | max = ioc->usingle_pages - ioc->usg_pages; | 1071 | max = ioc->usingle_pages - ioc->usg_pages; |
1104 | len = sprintf(tmp, "pci_unmap_single: %8ld calls %8ld pages (avg %d/1000)\n", | 1072 | len += seq_printf(m, "pci_unmap_single: %8ld calls %8ld pages (avg %d/1000)\n", |
1105 | min, max, (int)((max * 1000)/min)); | 1073 | min, max, (int)((max * 1000)/min)); |
1106 | if (proc_append(tmp, len, &buf, &offset, &count)) | ||
1107 | break; | ||
1108 | 1074 | ||
1109 | len = sprintf(tmp, "pci_map_sg() : %8ld calls %8ld pages (avg %d/1000)\n", | 1075 | len += seq_printf(m, "pci_map_sg() : %8ld calls %8ld pages (avg %d/1000)\n", |
1110 | ioc->msg_calls, ioc->msg_pages, | 1076 | ioc->msg_calls, ioc->msg_pages, |
1111 | (int)((ioc->msg_pages * 1000)/ioc->msg_calls)); | 1077 | (int)((ioc->msg_pages * 1000)/ioc->msg_calls)); |
1112 | if (proc_append(tmp, len, &buf, &offset, &count)) | 1078 | |
1113 | break; | 1079 | len += seq_printf(m, "pci_unmap_sg() : %8ld calls %8ld pages (avg %d/1000)\n\n\n", |
1114 | len = sprintf(tmp, "pci_unmap_sg() : %8ld calls %8ld pages (avg %d/1000)\n\n\n", | 1080 | ioc->usg_calls, ioc->usg_pages, |
1115 | ioc->usg_calls, ioc->usg_pages, | 1081 | (int)((ioc->usg_pages * 1000)/ioc->usg_calls)); |
1116 | (int)((ioc->usg_pages * 1000)/ioc->usg_calls)); | ||
1117 | if (proc_append(tmp, len, &buf, &offset, &count)) | ||
1118 | break; | ||
1119 | #endif /* CCIO_MAP_STATS */ | 1082 | #endif /* CCIO_MAP_STATS */ |
1083 | |||
1120 | ioc = ioc->next; | 1084 | ioc = ioc->next; |
1121 | } | 1085 | } |
1122 | 1086 | ||
1123 | if (count == 0) { | 1087 | return 0; |
1124 | *eof = 1; | 1088 | } |
1125 | } | 1089 | |
1126 | return (max - count); | 1090 | static int ccio_proc_info_open(struct inode *inode, struct file *file) |
1091 | { | ||
1092 | return single_open(file, &ccio_proc_info, NULL); | ||
1127 | } | 1093 | } |
1128 | 1094 | ||
1129 | static int ccio_resource_map(char *buf, char **start, off_t offset, int len, | 1095 | static struct file_operations ccio_proc_info_fops = { |
1130 | int *eof, void *data) | 1096 | .owner = THIS_MODULE, |
1097 | .open = ccio_proc_info_open, | ||
1098 | .read = seq_read, | ||
1099 | .llseek = seq_lseek, | ||
1100 | .release = single_release, | ||
1101 | }; | ||
1102 | |||
1103 | static int ccio_proc_bitmap_info(struct seq_file *m, void *p) | ||
1131 | { | 1104 | { |
1105 | int len = 0; | ||
1132 | struct ioc *ioc = ioc_list; | 1106 | struct ioc *ioc = ioc_list; |
1133 | 1107 | ||
1134 | buf[0] = '\0'; | ||
1135 | while (ioc != NULL) { | 1108 | while (ioc != NULL) { |
1136 | u32 *res_ptr = (u32 *)ioc->res_map; | 1109 | u32 *res_ptr = (u32 *)ioc->res_map; |
1137 | int j; | 1110 | int j; |
1138 | 1111 | ||
1139 | for (j = 0; j < (ioc->res_size / sizeof(u32)); j++) { | 1112 | for (j = 0; j < (ioc->res_size / sizeof(u32)); j++) { |
1140 | if ((j & 7) == 0) | 1113 | if ((j & 7) == 0) |
1141 | strcat(buf,"\n "); | 1114 | len += seq_puts(m, "\n "); |
1142 | sprintf(buf, "%s %08x", buf, *res_ptr); | 1115 | len += seq_printf(m, "%08x", *res_ptr); |
1143 | res_ptr++; | 1116 | res_ptr++; |
1144 | } | 1117 | } |
1145 | strcat(buf, "\n\n"); | 1118 | len += seq_puts(m, "\n\n"); |
1146 | ioc = ioc->next; | 1119 | ioc = ioc->next; |
1147 | break; /* XXX - remove me */ | 1120 | break; /* XXX - remove me */ |
1148 | } | 1121 | } |
1149 | 1122 | ||
1150 | return strlen(buf); | 1123 | return 0; |
1151 | } | 1124 | } |
1125 | |||
1126 | static int ccio_proc_bitmap_open(struct inode *inode, struct file *file) | ||
1127 | { | ||
1128 | return single_open(file, &ccio_proc_bitmap_info, NULL); | ||
1129 | } | ||
1130 | |||
1131 | static struct file_operations ccio_proc_bitmap_fops = { | ||
1132 | .owner = THIS_MODULE, | ||
1133 | .open = ccio_proc_bitmap_open, | ||
1134 | .read = seq_read, | ||
1135 | .llseek = seq_lseek, | ||
1136 | .release = single_release, | ||
1137 | }; | ||
1152 | #endif | 1138 | #endif |
1153 | 1139 | ||
1154 | /** | 1140 | /** |
@@ -1556,6 +1542,7 @@ static int ccio_probe(struct parisc_device *dev) | |||
1556 | { | 1542 | { |
1557 | int i; | 1543 | int i; |
1558 | struct ioc *ioc, **ioc_p = &ioc_list; | 1544 | struct ioc *ioc, **ioc_p = &ioc_list; |
1545 | struct proc_dir_entry *info_entry, *bitmap_entry; | ||
1559 | 1546 | ||
1560 | ioc = kzalloc(sizeof(struct ioc), GFP_KERNEL); | 1547 | ioc = kzalloc(sizeof(struct ioc), GFP_KERNEL); |
1561 | if (ioc == NULL) { | 1548 | if (ioc == NULL) { |
@@ -1583,13 +1570,14 @@ static int ccio_probe(struct parisc_device *dev) | |||
1583 | BUG_ON(dev->dev.platform_data == NULL); | 1570 | BUG_ON(dev->dev.platform_data == NULL); |
1584 | HBA_DATA(dev->dev.platform_data)->iommu = ioc; | 1571 | HBA_DATA(dev->dev.platform_data)->iommu = ioc; |
1585 | 1572 | ||
1586 | |||
1587 | if (ioc_count == 0) { | 1573 | if (ioc_count == 0) { |
1588 | /* FIXME: Create separate entries for each ioc */ | 1574 | info_entry = create_proc_entry(MODULE_NAME, 0, proc_runway_root); |
1589 | create_proc_read_entry(MODULE_NAME, S_IRWXU, proc_runway_root, | 1575 | if (info_entry) |
1590 | ccio_proc_info, NULL); | 1576 | info_entry->proc_fops = &ccio_proc_info_fops; |
1591 | create_proc_read_entry(MODULE_NAME"-bitmap", S_IRWXU, | 1577 | |
1592 | proc_runway_root, ccio_resource_map, NULL); | 1578 | bitmap_entry = create_proc_entry(MODULE_NAME"-bitmap", 0, proc_runway_root); |
1579 | if (bitmap_entry) | ||
1580 | bitmap_entry->proc_fops = &ccio_proc_bitmap_fops; | ||
1593 | } | 1581 | } |
1594 | 1582 | ||
1595 | ioc_count++; | 1583 | ioc_count++; |
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index 52f265e97729..5d47c5965c51 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include <asm/hardware.h> /* for register_parisc_driver() stuff */ | 37 | #include <asm/hardware.h> /* for register_parisc_driver() stuff */ |
38 | 38 | ||
39 | #include <linux/proc_fs.h> | 39 | #include <linux/proc_fs.h> |
40 | #include <linux/seq_file.h> | ||
41 | |||
40 | #include <asm/runway.h> /* for proc_runway_root */ | 42 | #include <asm/runway.h> /* for proc_runway_root */ |
41 | #include <asm/pdc.h> /* for PDC_MODEL_* */ | 43 | #include <asm/pdc.h> /* for PDC_MODEL_* */ |
42 | #include <asm/pdcpat.h> /* for is_pdc_pat() */ | 44 | #include <asm/pdcpat.h> /* for is_pdc_pat() */ |
@@ -1892,46 +1894,43 @@ sba_common_init(struct sba_device *sba_dev) | |||
1892 | } | 1894 | } |
1893 | 1895 | ||
1894 | #ifdef CONFIG_PROC_FS | 1896 | #ifdef CONFIG_PROC_FS |
1895 | static int sba_proc_info(char *buf, char **start, off_t offset, int len) | 1897 | static int sba_proc_info(struct seq_file *m, void *p) |
1896 | { | 1898 | { |
1897 | struct sba_device *sba_dev = sba_list; | 1899 | struct sba_device *sba_dev = sba_list; |
1898 | struct ioc *ioc = &sba_dev->ioc[0]; /* FIXME: Multi-IOC support! */ | 1900 | struct ioc *ioc = &sba_dev->ioc[0]; /* FIXME: Multi-IOC support! */ |
1899 | int total_pages = (int) (ioc->res_size << 3); /* 8 bits per byte */ | 1901 | int total_pages = (int) (ioc->res_size << 3); /* 8 bits per byte */ |
1900 | unsigned long i; | ||
1901 | #ifdef SBA_COLLECT_STATS | 1902 | #ifdef SBA_COLLECT_STATS |
1902 | unsigned long avg = 0, min, max; | 1903 | unsigned long avg = 0, min, max; |
1903 | #endif | 1904 | #endif |
1905 | int i, len = 0; | ||
1904 | 1906 | ||
1905 | sprintf(buf, "%s rev %d.%d\n", | 1907 | len += seq_printf(m, "%s rev %d.%d\n", |
1906 | sba_dev->name, | 1908 | sba_dev->name, |
1907 | (sba_dev->hw_rev & 0x7) + 1, | 1909 | (sba_dev->hw_rev & 0x7) + 1, |
1908 | (sba_dev->hw_rev & 0x18) >> 3 | 1910 | (sba_dev->hw_rev & 0x18) >> 3 |
1909 | ); | 1911 | ); |
1910 | sprintf(buf, "%sIO PDIR size : %d bytes (%d entries)\n", | 1912 | len += seq_printf(m, "IO PDIR size : %d bytes (%d entries)\n", |
1911 | buf, | ||
1912 | (int) ((ioc->res_size << 3) * sizeof(u64)), /* 8 bits/byte */ | 1913 | (int) ((ioc->res_size << 3) * sizeof(u64)), /* 8 bits/byte */ |
1913 | total_pages); | 1914 | total_pages); |
1914 | 1915 | ||
1915 | sprintf(buf, "%sResource bitmap : %d bytes (%d pages)\n", | 1916 | len += seq_printf(m, "Resource bitmap : %d bytes (%d pages)\n", |
1916 | buf, ioc->res_size, ioc->res_size << 3); /* 8 bits per byte */ | 1917 | ioc->res_size, ioc->res_size << 3); /* 8 bits per byte */ |
1917 | 1918 | ||
1918 | sprintf(buf, "%sLMMIO_BASE/MASK/ROUTE %08x %08x %08x\n", | 1919 | len += seq_printf(m, "LMMIO_BASE/MASK/ROUTE %08x %08x %08x\n", |
1919 | buf, | ||
1920 | READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_BASE), | 1920 | READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_BASE), |
1921 | READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_MASK), | 1921 | READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_MASK), |
1922 | READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_ROUTE) | 1922 | READ_REG32(sba_dev->sba_hpa + LMMIO_DIST_ROUTE) |
1923 | ); | 1923 | ); |
1924 | 1924 | ||
1925 | for (i=0; i<4; i++) | 1925 | for (i=0; i<4; i++) |
1926 | sprintf(buf, "%sDIR%ld_BASE/MASK/ROUTE %08x %08x %08x\n", | 1926 | len += seq_printf(m, "DIR%d_BASE/MASK/ROUTE %08x %08x %08x\n", i, |
1927 | buf, i, | ||
1928 | READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_BASE + i*0x18), | 1927 | READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_BASE + i*0x18), |
1929 | READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_MASK + i*0x18), | 1928 | READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_MASK + i*0x18), |
1930 | READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_ROUTE + i*0x18) | 1929 | READ_REG32(sba_dev->sba_hpa + LMMIO_DIRECT0_ROUTE + i*0x18) |
1931 | ); | 1930 | ); |
1932 | 1931 | ||
1933 | #ifdef SBA_COLLECT_STATS | 1932 | #ifdef SBA_COLLECT_STATS |
1934 | sprintf(buf, "%sIO PDIR entries : %ld free %ld used (%d%%)\n", buf, | 1933 | len += seq_printf(m, "IO PDIR entries : %ld free %ld used (%d%%)\n", |
1935 | total_pages - ioc->used_pages, ioc->used_pages, | 1934 | total_pages - ioc->used_pages, ioc->used_pages, |
1936 | (int) (ioc->used_pages * 100 / total_pages)); | 1935 | (int) (ioc->used_pages * 100 / total_pages)); |
1937 | 1936 | ||
@@ -1942,53 +1941,76 @@ static int sba_proc_info(char *buf, char **start, off_t offset, int len) | |||
1942 | if (ioc->avg_search[i] < min) min = ioc->avg_search[i]; | 1941 | if (ioc->avg_search[i] < min) min = ioc->avg_search[i]; |
1943 | } | 1942 | } |
1944 | avg /= SBA_SEARCH_SAMPLE; | 1943 | avg /= SBA_SEARCH_SAMPLE; |
1945 | sprintf(buf, "%s Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n", | 1944 | len += seq_printf(m, " Bitmap search : %ld/%ld/%ld (min/avg/max CPU Cycles)\n", |
1946 | buf, min, avg, max); | 1945 | min, avg, max); |
1947 | 1946 | ||
1948 | sprintf(buf, "%spci_map_single(): %12ld calls %12ld pages (avg %d/1000)\n", | 1947 | len += seq_printf(m, "pci_map_single(): %12ld calls %12ld pages (avg %d/1000)\n", |
1949 | buf, ioc->msingle_calls, ioc->msingle_pages, | 1948 | ioc->msingle_calls, ioc->msingle_pages, |
1950 | (int) ((ioc->msingle_pages * 1000)/ioc->msingle_calls)); | 1949 | (int) ((ioc->msingle_pages * 1000)/ioc->msingle_calls)); |
1951 | 1950 | ||
1952 | /* KLUGE - unmap_sg calls unmap_single for each mapped page */ | 1951 | /* KLUGE - unmap_sg calls unmap_single for each mapped page */ |
1953 | min = ioc->usingle_calls; | 1952 | min = ioc->usingle_calls; |
1954 | max = ioc->usingle_pages - ioc->usg_pages; | 1953 | max = ioc->usingle_pages - ioc->usg_pages; |
1955 | sprintf(buf, "%spci_unmap_single: %12ld calls %12ld pages (avg %d/1000)\n", | 1954 | len += seq_printf(m, "pci_unmap_single: %12ld calls %12ld pages (avg %d/1000)\n", |
1956 | buf, min, max, | 1955 | min, max, (int) ((max * 1000)/min)); |
1957 | (int) ((max * 1000)/min)); | ||
1958 | 1956 | ||
1959 | sprintf(buf, "%spci_map_sg() : %12ld calls %12ld pages (avg %d/1000)\n", | 1957 | len += seq_printf(m, "pci_map_sg() : %12ld calls %12ld pages (avg %d/1000)\n", |
1960 | buf, ioc->msg_calls, ioc->msg_pages, | 1958 | ioc->msg_calls, ioc->msg_pages, |
1961 | (int) ((ioc->msg_pages * 1000)/ioc->msg_calls)); | 1959 | (int) ((ioc->msg_pages * 1000)/ioc->msg_calls)); |
1962 | 1960 | ||
1963 | sprintf(buf, "%spci_unmap_sg() : %12ld calls %12ld pages (avg %d/1000)\n", | 1961 | len += seq_printf(m, "pci_unmap_sg() : %12ld calls %12ld pages (avg %d/1000)\n", |
1964 | buf, ioc->usg_calls, ioc->usg_pages, | 1962 | ioc->usg_calls, ioc->usg_pages, |
1965 | (int) ((ioc->usg_pages * 1000)/ioc->usg_calls)); | 1963 | (int) ((ioc->usg_pages * 1000)/ioc->usg_calls)); |
1966 | #endif | 1964 | #endif |
1967 | 1965 | ||
1968 | return strlen(buf); | 1966 | return 0; |
1969 | } | 1967 | } |
1970 | 1968 | ||
1971 | #if 0 | ||
1972 | /* XXX too much output - exceeds 4k limit and needs to be re-written */ | ||
1973 | static int | 1969 | static int |
1974 | sba_resource_map(char *buf, char **start, off_t offset, int len) | 1970 | sba_proc_open(struct inode *i, struct file *f) |
1971 | { | ||
1972 | return single_open(f, &sba_proc_info, NULL); | ||
1973 | } | ||
1974 | |||
1975 | static struct file_operations sba_proc_fops = { | ||
1976 | .owner = THIS_MODULE, | ||
1977 | .open = sba_proc_open, | ||
1978 | .read = seq_read, | ||
1979 | .llseek = seq_lseek, | ||
1980 | .release = single_release, | ||
1981 | }; | ||
1982 | |||
1983 | static int | ||
1984 | sba_proc_bitmap_info(struct seq_file *m, void *p) | ||
1975 | { | 1985 | { |
1976 | struct sba_device *sba_dev = sba_list; | 1986 | struct sba_device *sba_dev = sba_list; |
1977 | struct ioc *ioc = &sba_dev->ioc[0]; /* FIXME: Mutli-IOC suppoer! */ | 1987 | struct ioc *ioc = &sba_dev->ioc[0]; /* FIXME: Multi-IOC support! */ |
1978 | unsigned int *res_ptr = (unsigned int *)ioc->res_map; | 1988 | unsigned int *res_ptr = (unsigned int *)ioc->res_map; |
1979 | int i; | 1989 | int i, len = 0; |
1980 | 1990 | ||
1981 | buf[0] = '\0'; | 1991 | for (i = 0; i < (ioc->res_size/sizeof(unsigned int)); ++i, ++res_ptr) { |
1982 | for(i = 0; i < (ioc->res_size / sizeof(unsigned int)); ++i, ++res_ptr) { | ||
1983 | if ((i & 7) == 0) | 1992 | if ((i & 7) == 0) |
1984 | strcat(buf,"\n "); | 1993 | len += seq_printf(m, "\n "); |
1985 | sprintf(buf, "%s %08x", buf, *res_ptr); | 1994 | len += seq_printf(m, " %08x", *res_ptr); |
1986 | } | 1995 | } |
1987 | strcat(buf, "\n"); | 1996 | len += seq_printf(m, "\n"); |
1988 | 1997 | ||
1989 | return strlen(buf); | 1998 | return 0; |
1990 | } | 1999 | } |
1991 | #endif /* 0 */ | 2000 | |
2001 | static int | ||
2002 | sba_proc_bitmap_open(struct inode *i, struct file *f) | ||
2003 | { | ||
2004 | return single_open(f, &sba_proc_bitmap_info, NULL); | ||
2005 | } | ||
2006 | |||
2007 | static struct file_operations sba_proc_bitmap_fops = { | ||
2008 | .owner = THIS_MODULE, | ||
2009 | .open = sba_proc_bitmap_open, | ||
2010 | .read = seq_read, | ||
2011 | .llseek = seq_lseek, | ||
2012 | .release = single_release, | ||
2013 | }; | ||
1992 | #endif /* CONFIG_PROC_FS */ | 2014 | #endif /* CONFIG_PROC_FS */ |
1993 | 2015 | ||
1994 | static struct parisc_device_id sba_tbl[] = { | 2016 | static struct parisc_device_id sba_tbl[] = { |
@@ -2021,6 +2043,7 @@ sba_driver_callback(struct parisc_device *dev) | |||
2021 | int i; | 2043 | int i; |
2022 | char *version; | 2044 | char *version; |
2023 | void __iomem *sba_addr = ioremap(dev->hpa.start, SBA_FUNC_SIZE); | 2045 | void __iomem *sba_addr = ioremap(dev->hpa.start, SBA_FUNC_SIZE); |
2046 | struct proc_dir_entry *info_entry, *bitmap_entry, *root; | ||
2024 | 2047 | ||
2025 | sba_dump_ranges(sba_addr); | 2048 | sba_dump_ranges(sba_addr); |
2026 | 2049 | ||
@@ -2088,19 +2111,27 @@ sba_driver_callback(struct parisc_device *dev) | |||
2088 | hppa_dma_ops = &sba_ops; | 2111 | hppa_dma_ops = &sba_ops; |
2089 | 2112 | ||
2090 | #ifdef CONFIG_PROC_FS | 2113 | #ifdef CONFIG_PROC_FS |
2091 | if (IS_ASTRO(&dev->id)) { | 2114 | switch (dev->id.hversion) { |
2092 | create_proc_info_entry("Astro", 0, proc_runway_root, sba_proc_info); | 2115 | case PLUTO_MCKINLEY_PORT: |
2093 | } else if (IS_IKE(&dev->id)) { | 2116 | root = proc_mckinley_root; |
2094 | create_proc_info_entry("Ike", 0, proc_runway_root, sba_proc_info); | 2117 | break; |
2095 | } else if (IS_PLUTO(&dev->id)) { | 2118 | case ASTRO_RUNWAY_PORT: |
2096 | create_proc_info_entry("Pluto", 0, proc_mckinley_root, sba_proc_info); | 2119 | case IKE_MERCED_PORT: |
2097 | } else { | 2120 | default: |
2098 | create_proc_info_entry("Reo", 0, proc_runway_root, sba_proc_info); | 2121 | root = proc_runway_root; |
2122 | break; | ||
2099 | } | 2123 | } |
2100 | #if 0 | 2124 | |
2101 | create_proc_info_entry("bitmap", 0, proc_runway_root, sba_resource_map); | 2125 | info_entry = create_proc_entry("sba_iommu", 0, root); |
2102 | #endif | 2126 | bitmap_entry = create_proc_entry("sba_iommu-bitmap", 0, root); |
2127 | |||
2128 | if (info_entry) | ||
2129 | info_entry->proc_fops = &sba_proc_fops; | ||
2130 | |||
2131 | if (bitmap_entry) | ||
2132 | bitmap_entry->proc_fops = &sba_proc_bitmap_fops; | ||
2103 | #endif | 2133 | #endif |
2134 | |||
2104 | parisc_vmerge_boundary = IOVP_SIZE; | 2135 | parisc_vmerge_boundary = IOVP_SIZE; |
2105 | parisc_vmerge_max_size = IOVP_SIZE * BITS_PER_LONG; | 2136 | parisc_vmerge_max_size = IOVP_SIZE * BITS_PER_LONG; |
2106 | parisc_has_iommu(); | 2137 | parisc_has_iommu(); |