- David Miller: sparc and net updates. Fix merge_segments.
[davej-history.git] / arch / sparc / kernel / ioport.c
blob41ef9737ea4eb57e11f186754c96176cc00389c7
1 /* $Id: ioport.c,v 1.42 2000/12/05 00:56:36 anton Exp $
2 * ioport.c: Simple io mapping allocator.
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
7 * 1996: sparc_free_io, 1999: ioremap()/iounmap() by Pete Zaitcev.
9 * 2000/01/29
10 * <rth> zait: as long as pci_alloc_consistent produces something addressable,
11 * things are ok.
12 * <zaitcev> rth: no, it is relevant, because get_free_pages returns you a
13 * pointer into the big page mapping
14 * <rth> zait: so what?
15 * <rth> zait: remap_it_my_way(virt_to_phys(get_free_page()))
16 * <zaitcev> Hmm
17 * <zaitcev> Suppose I did this remap_it_my_way(virt_to_phys(get_free_page())).
18 * So far so good.
19 * <zaitcev> Now, driver calls pci_free_consistent(with result of
20 * remap_it_my_way()).
21 * <zaitcev> How do you find the address to pass to free_pages()?
22 * <rth> zait: walk the page tables? It's only two or three level after all.
23 * <rth> zait: you have to walk them anyway to remove the mapping.
24 * <zaitcev> Hmm
25 * <zaitcev> Sounds reasonable
28 #include <linux/config.h>
29 #include <linux/sched.h>
30 #include <linux/kernel.h>
31 #include <linux/errno.h>
32 #include <linux/types.h>
33 #include <linux/ioport.h>
34 #include <linux/mm.h>
35 #include <linux/malloc.h>
36 #include <linux/pci.h> /* struct pci_dev */
37 #include <linux/proc_fs.h>
39 #include <asm/io.h>
40 #include <asm/vaddrs.h>
41 #include <asm/oplib.h>
42 #include <asm/page.h>
43 #include <asm/pgalloc.h>
44 #include <asm/pgtable.h>
46 #define mmu_inval_dma_area(p, l) /* Anton pulled it out for 2.4.0-xx */
48 struct resource *_sparc_find_resource(struct resource *r, unsigned long);
50 static void *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz);
51 static void *_sparc_alloc_io(unsigned int busno, unsigned long phys,
52 unsigned long size, char *name);
53 static void _sparc_free_io(struct resource *res);
55 /* This points to the next to use virtual memory for DVMA mappings */
56 static struct resource _sparc_dvma = {
57 "sparc_dvma", DVMA_VADDR, DVMA_END - 1
59 /* This points to the start of I/O mappings, cluable from outside. */
60 /*ext*/ struct resource sparc_iomap = {
61 "sparc_iomap", IOBASE_VADDR, IOBASE_END - 1
65 * BTFIXUP would do as well but it seems overkill for the case.
67 static void (*_sparc_mapioaddr)(unsigned long pa, unsigned long va,
68 int bus, int ro);
69 static void (*_sparc_unmapioaddr)(unsigned long va);
72 * Our mini-allocator...
73 * Boy this is gross! We need it because we must map I/O for
74 * timers and interrupt controller before the kmalloc is available.
77 #define XNMLN 15
78 #define XNRES 10 /* SS-10 uses 8 */
80 struct xresource {
81 struct resource xres; /* Must be first */
82 int xflag; /* 1 == used */
83 char xname[XNMLN+1];
86 static struct xresource xresv[XNRES];
88 static struct xresource *xres_alloc(void) {
89 struct xresource *xrp;
90 int n;
92 xrp = xresv;
93 for (n = 0; n < XNRES; n++) {
94 if (xrp->xflag == 0) {
95 xrp->xflag = 1;
96 return xrp;
98 xrp++;
100 return NULL;
103 static void xres_free(struct xresource *xrp) {
104 xrp->xflag = 0;
108 * These are typically used in PCI drivers
109 * which are trying to be cross-platform.
111 * Bus type is always zero on IIep.
113 void *ioremap(unsigned long offset, unsigned long size)
115 char name[14];
117 sprintf(name, "phys_%08x", (u32)offset);
118 return _sparc_alloc_io(0, offset, size, name);
122 * Comlimentary to ioremap().
124 void iounmap(void *virtual)
126 unsigned long vaddr = (unsigned long) virtual & PAGE_MASK;
127 struct resource *res;
129 if ((res = _sparc_find_resource(&sparc_iomap, vaddr)) == NULL) {
130 printk("free_io/iounmap: cannot free %lx\n", vaddr);
131 return;
133 _sparc_free_io(res);
135 if ((char *)res >= (char*)xresv && (char *)res < (char *)&xresv[XNRES]) {
136 xres_free((struct xresource *)res);
137 } else {
138 kfree(res);
144 unsigned long sbus_ioremap(struct resource *phyres, unsigned long offset,
145 unsigned long size, char *name)
147 return (unsigned long) _sparc_alloc_io(phyres->flags & 0xF,
148 phyres->start + offset, size, name);
153 void sbus_iounmap(unsigned long addr, unsigned long size)
155 iounmap((void *)addr);
159 * Meat of mapping
161 static void *_sparc_alloc_io(unsigned int busno, unsigned long phys,
162 unsigned long size, char *name)
164 static int printed_full = 0;
165 struct xresource *xres;
166 struct resource *res;
167 char *tack;
168 int tlen;
169 void *va; /* P3 diag */
171 if (name == NULL) name = "???";
173 if ((xres = xres_alloc()) != 0) {
174 tack = xres->xname;
175 res = &xres->xres;
176 } else {
177 if (!printed_full) {
178 printk("ioremap: done with statics, switching to malloc\n");
179 printed_full = 1;
181 tlen = strlen(name);
182 tack = kmalloc(sizeof (struct resource) + tlen + 1, GFP_KERNEL);
183 if (tack == NULL) return NULL;
184 memset(tack, 0, sizeof(struct resource));
185 res = (struct resource *) tack;
186 tack += sizeof (struct resource);
189 strncpy(tack, name, XNMLN);
190 tack[XNMLN] = 0;
191 res->name = tack;
193 va = _sparc_ioremap(res, busno, phys, size);
194 /* printk("ioremap(0x%x:%08lx[0x%lx])=%p\n", busno, phys, size, va); */ /* P3 diag */
195 return va;
200 static void *
201 _sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz)
203 unsigned long offset = ((unsigned long) pa) & (~PAGE_MASK);
204 unsigned long va;
205 unsigned int psz;
207 if (allocate_resource(&sparc_iomap, res,
208 (offset + sz + PAGE_SIZE-1) & PAGE_MASK,
209 sparc_iomap.start, sparc_iomap.end, PAGE_SIZE, NULL, NULL) != 0) {
210 /* Usually we cannot see printks in this case. */
211 prom_printf("alloc_io_res(%s): cannot occupy\n",
212 (res->name != NULL)? res->name: "???");
213 prom_halt();
216 va = res->start;
217 pa &= PAGE_MASK;
218 for (psz = res->end - res->start + 1; psz != 0; psz -= PAGE_SIZE) {
219 (*_sparc_mapioaddr)(pa, va, bus, 0);
220 va += PAGE_SIZE;
221 pa += PAGE_SIZE;
225 * XXX Playing with implementation details here.
226 * On sparc64 Ebus has resources with precise boundaries.
227 * We share drivers with sparc64. Too clever drivers use
228 * start of a resource instead of a base adress.
230 * XXX-2 This may be not valid anymore, clean when
231 * interface to sbus_ioremap() is resolved.
233 res->start += offset;
234 res->end = res->start + sz - 1; /* not strictly necessary.. */
236 return (void *) res->start;
240 * Comlimentary to _sparc_ioremap().
242 static void _sparc_free_io(struct resource *res)
244 unsigned long plen;
246 plen = res->end - res->start + 1;
247 plen = (plen + PAGE_SIZE-1) & PAGE_MASK;
248 while (plen != 0) {
249 plen -= PAGE_SIZE;
250 (*_sparc_unmapioaddr)(res->start + plen);
253 release_resource(res);
256 #ifdef CONFIG_SBUS
258 void sbus_set_sbus64(struct sbus_dev *sdev, int x) {
259 printk("sbus_set_sbus64: unsupported\n");
263 * Allocate a chunk of memory suitable for DMA.
264 * Typically devices use them for control blocks.
265 * CPU may access them without any explicit flushing.
267 * XXX Some clever people know that sdev is not used and supply NULL. Watch.
269 void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp)
271 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK;
272 unsigned long va;
273 struct resource *res;
274 int order;
276 /* XXX why are some lenghts signed, others unsigned? */
277 if (len <= 0) {
278 return NULL;
280 /* XXX So what is maxphys for us and how do drivers know it? */
281 if (len > 256*1024) { /* __get_free_pages() limit */
282 return NULL;
285 order = get_order(len_total);
286 va = __get_free_pages(GFP_KERNEL, order);
287 if (va == 0) {
289 * printk here may be flooding... Consider removal XXX.
291 printk("sbus_alloc_consistent: no %ld pages\n", len_total>>PAGE_SHIFT);
292 return NULL;
295 if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) {
296 free_pages(va, order);
297 printk("sbus_alloc_consistent: no core\n");
298 return NULL;
300 memset((char*)res, 0, sizeof(struct resource));
302 if (allocate_resource(&_sparc_dvma, res, len_total,
303 _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
304 printk("sbus_alloc_consistent: cannot occupy 0x%lx", len_total);
305 free_pages(va, order);
306 kfree(res);
307 return NULL;
310 mmu_map_dma_area(va, res->start, len_total);
312 *dma_addrp = res->start;
313 return (void *)res->start;
316 void sbus_free_consistent(struct sbus_dev *sdev, long n, void *p, u32 ba)
318 struct resource *res;
319 unsigned long pgp;
321 if ((res = _sparc_find_resource(&_sparc_dvma,
322 (unsigned long)p)) == NULL) {
323 printk("sbus_free_consistent: cannot free %p\n", p);
324 return;
327 if (((unsigned long)p & (PAGE_SIZE-1)) != 0) {
328 printk("sbus_free_consistent: unaligned va %p\n", p);
329 return;
332 n = (n + PAGE_SIZE-1) & PAGE_MASK;
333 if ((res->end-res->start)+1 != n) {
334 printk("sbus_free_consistent: region 0x%lx asked 0x%lx\n",
335 (long)((res->end-res->start)+1), n);
336 return;
339 release_resource(res);
340 kfree(res);
342 /* mmu_inval_dma_area(va, n); */ /* it's consistent, isn't it */
343 pgp = (unsigned long) phys_to_virt(mmu_translate_dvma(ba));
344 mmu_unmap_dma_area(ba, n);
346 free_pages(pgp, get_order(n));
350 * Map a chunk of memory so that devices can see it.
351 * CPU view of this memory may be inconsistent with
352 * a device view and explicit flushing is necessary.
354 u32 sbus_map_single(struct sbus_dev *sdev, void *va, long len, int direction)
356 #if 0 /* This is the version that abuses consistent space */
357 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK;
358 struct resource *res;
360 /* XXX why are some lenghts signed, others unsigned? */
361 if (len <= 0) {
362 return 0;
364 /* XXX So what is maxphys for us and how do drivers know it? */
365 if (len > 256*1024) { /* __get_free_pages() limit */
366 return 0;
369 if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) {
370 printk("sbus_map_single: no core\n");
371 return 0;
373 memset((char*)res, 0, sizeof(struct resource));
374 res->name = va; /* XXX */
376 if (allocate_resource(&_sparc_dvma, res, len_total,
377 _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE) != 0) {
378 printk("sbus_map_single: cannot occupy 0x%lx", len);
379 kfree(res);
380 return 0;
383 mmu_map_dma_area(va, res->start, len_total);
384 mmu_flush_dma_area((unsigned long)va, len_total); /* in all contexts? */
386 return res->start;
387 #endif
388 #if 1 /* "trampoline" version */
389 /* XXX why are some lenghts signed, others unsigned? */
390 if (len <= 0) {
391 return 0;
393 /* XXX So what is maxphys for us and how do drivers know it? */
394 if (len > 256*1024) { /* __get_free_pages() limit */
395 return 0;
397 return mmu_get_scsi_one(va, len, sdev->bus);
398 #endif
401 void sbus_unmap_single(struct sbus_dev *sdev, u32 ba, long n, int direction)
403 #if 0 /* This is the version that abuses consistent space */
404 struct resource *res;
405 unsigned long va;
407 if ((res = _sparc_find_resource(&_sparc_dvma, ba)) == NULL) {
408 printk("sbus_unmap_single: cannot find %08x\n", (unsigned)ba);
409 return;
412 n = (n + PAGE_SIZE-1) & PAGE_MASK;
413 if ((res->end-res->start)+1 != n) {
414 printk("sbus_unmap_single: region 0x%lx asked 0x%lx\n",
415 (long)((res->end-res->start)+1), n);
416 return;
419 va = (unsigned long) res->name; /* XXX Ouch */
420 mmu_inval_dma_area(va, n); /* in all contexts, mm's?... */
421 mmu_unmap_dma_area(ba, n); /* iounit cache flush is here */
422 release_resource(res);
423 kfree(res);
424 #endif
425 #if 1 /* "trampoline" version */
426 mmu_release_scsi_one(ba, n, sdev->bus);
427 #endif
430 int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction)
432 mmu_get_scsi_sgl(sg, n, sdev->bus);
435 * XXX sparc64 can return a partial length here. sun4c should do this
436 * but it currently panics if it can't fulfill the request - Anton
438 return n;
441 void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction)
443 mmu_release_scsi_sgl(sg, n, sdev->bus);
448 void sbus_dma_sync_single(struct sbus_dev *sdev, u32 ba, long size, int direction)
450 #if 0
451 unsigned long va;
452 struct resource *res;
454 /* We do not need the resource, just print a message if invalid. */
455 res = _sparc_find_resource(&_sparc_dvma, ba);
456 if (res == NULL)
457 panic("sbus_dma_sync_single: 0x%x\n", ba);
459 va = (unsigned long) phys_to_virt(mmu_translate_dvma(ba));
461 * XXX This bogosity will be fixed with the iommu rewrite coming soon
462 * to a kernel near you. - Anton
464 /* mmu_inval_dma_area(va, (size + PAGE_SIZE-1) & PAGE_MASK); */
465 #endif
468 void sbus_dma_sync_sg(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction)
470 printk("sbus_dma_sync_sg: not implemented yet\n");
472 #endif /* CONFIG_SBUS */
474 #ifdef CONFIG_PCI
476 /* Allocate and map kernel buffer using consistent mode DMA for a device.
477 * hwdev should be valid struct pci_dev pointer for PCI devices.
479 void *pci_alloc_consistent(struct pci_dev *pdev, size_t len, dma_addr_t *pba)
481 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK;
482 unsigned long va;
483 struct resource *res;
484 int order;
486 if (len == 0) {
487 return NULL;
489 if (len > 256*1024) { /* __get_free_pages() limit */
490 return NULL;
493 order = get_order(len_total);
494 va = __get_free_pages(GFP_KERNEL, order);
495 if (va == 0) {
496 printk("pci_alloc_consistent: no %ld pages\n", len_total>>PAGE_SHIFT);
497 return NULL;
500 if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) {
501 free_pages(va, order);
502 printk("pci_alloc_consistent: no core\n");
503 return NULL;
505 memset((char*)res, 0, sizeof(struct resource));
507 if (allocate_resource(&_sparc_dvma, res, len_total,
508 _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
509 printk("pci_alloc_consistent: cannot occupy 0x%lx", len_total);
510 free_pages(va, order);
511 kfree(res);
512 return NULL;
515 mmu_inval_dma_area(va, len_total);
517 #if 1
518 /* P3 */ printk("pci_alloc_consistent: kva %lx uncva %lx phys %lx size %x\n",
519 (long)va, (long)res->start, (long)virt_to_phys(va), len_total);
520 #endif
522 unsigned long xva, xpa;
523 xva = res->start;
524 xpa = virt_to_phys(va);
525 while (len_total != 0) {
526 len_total -= PAGE_SIZE;
527 (*_sparc_mapioaddr)(xpa, xva, 0, 0);
528 xva += PAGE_SIZE;
529 xpa += PAGE_SIZE;
533 *pba = virt_to_bus(va);
534 return (void *) res->start;
537 /* Free and unmap a consistent DMA buffer.
538 * cpu_addr is what was returned from pci_alloc_consistent,
539 * size must be the same as what as passed into pci_alloc_consistent,
540 * and likewise dma_addr must be the same as what *dma_addrp was set to.
542 * References to the memory and mappings assosciated with cpu_addr/dma_addr
543 * past this call are illegal.
545 void pci_free_consistent(struct pci_dev *pdev, size_t n, void *p, dma_addr_t ba)
547 struct resource *res;
548 unsigned long pgp;
550 if ((res = _sparc_find_resource(&_sparc_dvma,
551 (unsigned long)p)) == NULL) {
552 printk("pci_free_consistent: cannot free %p\n", p);
553 return;
556 if (((unsigned long)p & (PAGE_SIZE-1)) != 0) {
557 printk("pci_free_consistent: unaligned va %p\n", p);
558 return;
561 n = (n + PAGE_SIZE-1) & PAGE_MASK;
562 if ((res->end-res->start)+1 != n) {
563 printk("pci_free_consistent: region 0x%lx asked 0x%lx\n",
564 (long)((res->end-res->start)+1), (long)n);
565 return;
568 pgp = (unsigned long) bus_to_virt(ba);
569 mmu_inval_dma_area(pgp, n);
571 int x;
572 for (x = 0; x < n; x += PAGE_SIZE) {
573 (*_sparc_unmapioaddr)((unsigned long)p + n);
577 release_resource(res);
578 kfree(res);
580 free_pages(pgp, get_order(n));
583 /* Map a single buffer of the indicated size for DMA in streaming mode.
584 * The 32-bit bus address to use is returned.
586 * Once the device is given the dma address, the device owns this memory
587 * until either pci_unmap_single or pci_dma_sync_single is performed.
589 dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size,
590 int direction)
592 if (direction == PCI_DMA_NONE)
593 BUG();
594 /* IIep is write-through, not flushing. */
595 return virt_to_bus(ptr);
598 /* Unmap a single streaming mode DMA translation. The dma_addr and size
599 * must match what was provided for in a previous pci_map_single call. All
600 * other usages are undefined.
602 * After this call, reads by the cpu to the buffer are guarenteed to see
603 * whatever the device wrote there.
605 void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t ba, size_t size,
606 int direction)
608 if (direction == PCI_DMA_NONE)
609 BUG();
610 if (direction != PCI_DMA_TODEVICE) {
611 mmu_inval_dma_area((unsigned long)bus_to_virt(ba),
612 (size + PAGE_SIZE-1) & PAGE_MASK);
616 /* Map a set of buffers described by scatterlist in streaming
617 * mode for DMA. This is the scather-gather version of the
618 * above pci_map_single interface. Here the scatter gather list
619 * elements are each tagged with the appropriate dma address
620 * and length. They are obtained via sg_dma_{address,length}(SG).
622 * NOTE: An implementation may be able to use a smaller number of
623 * DMA address/length pairs than there are SG table elements.
624 * (for example via virtual mapping capabilities)
625 * The routine returns the number of addr/length pairs actually
626 * used, at most nents.
628 * Device ownership issues as mentioned above for pci_map_single are
629 * the same here.
631 int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents,
632 int direction)
634 int n;
636 if (direction == PCI_DMA_NONE)
637 BUG();
638 /* IIep is write-through, not flushing. */
639 for (n = 0; n < nents; n++) {
640 sg->dvma_address = virt_to_bus(sg->address);
641 sg->dvma_length = sg->length;
642 sg++;
644 return nents;
647 /* Unmap a set of streaming mode DMA translations.
648 * Again, cpu read rules concerning calls here are the same as for
649 * pci_unmap_single() above.
651 void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents,
652 int direction)
654 int n;
656 if (direction == PCI_DMA_NONE)
657 BUG();
658 if (direction != PCI_DMA_TODEVICE) {
659 for (n = 0; n < nents; n++) {
660 mmu_inval_dma_area((unsigned long)sg->address,
661 (sg->length + PAGE_SIZE-1) & PAGE_MASK);
662 sg++;
667 /* Make physical memory consistent for a single
668 * streaming mode DMA translation before or after a transfer.
670 * If you perform a pci_map_single() but wish to interrogate the
671 * buffer using the cpu, yet do not wish to teardown the PCI dma
672 * mapping, you must call this function before doing so. At the
673 * next point you give the PCI dma address back to the card, the
674 * device again owns the buffer.
676 void pci_dma_sync_single(struct pci_dev *hwdev, dma_addr_t ba, size_t size, int direction)
678 if (direction == PCI_DMA_NONE)
679 BUG();
680 if (direction != PCI_DMA_TODEVICE) {
681 mmu_inval_dma_area((unsigned long)bus_to_virt(ba),
682 (size + PAGE_SIZE-1) & PAGE_MASK);
686 /* Make physical memory consistent for a set of streaming
687 * mode DMA translations after a transfer.
689 * The same as pci_dma_sync_single but for a scatter-gather list,
690 * same rules and usage.
692 void pci_dma_sync_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction)
694 int n;
696 if (direction == PCI_DMA_NONE)
697 BUG();
698 if (direction != PCI_DMA_TODEVICE) {
699 for (n = 0; n < nents; n++) {
700 mmu_inval_dma_area((unsigned long)sg->address,
701 (sg->length + PAGE_SIZE-1) & PAGE_MASK);
702 sg++;
706 #endif CONFIG_PCI
708 #ifdef CONFIG_PROC_FS
710 static int
711 _sparc_io_get_info(char *buf, char **start, off_t fpos, int length, int *eof,
712 void *data)
714 char *p = buf, *e = buf + length;
715 struct resource *r;
716 const char *nm;
718 for (r = ((struct resource *)data)->child; r != NULL; r = r->sibling) {
719 if (p + 32 >= e) /* Better than nothing */
720 break;
721 if ((nm = r->name) == 0) nm = "???";
722 p += sprintf(p, "%08lx-%08lx: %s\n", r->start, r->end, nm);
725 return p-buf;
728 #endif CONFIG_PROC_FS
731 * This is a version of find_resource and it belongs to kernel/resource.c.
732 * Until we have agreement with Linus and Martin, it lingers here.
734 * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case.
735 * This probably warrants some sort of hashing.
737 struct resource *
738 _sparc_find_resource(struct resource *root, unsigned long hit)
740 struct resource *tmp;
742 for (tmp = root->child; tmp != 0; tmp = tmp->sibling) {
743 if (tmp->start <= hit && tmp->end >= hit)
744 return tmp;
746 return NULL;
750 * Necessary boot time initializations.
753 void ioport_init(void)
755 extern void sun4c_mapioaddr(unsigned long, unsigned long, int, int);
756 extern void srmmu_mapioaddr(unsigned long, unsigned long, int, int);
757 extern void sun4c_unmapioaddr(unsigned long);
758 extern void srmmu_unmapioaddr(unsigned long);
760 switch(sparc_cpu_model) {
761 case sun4c:
762 case sun4:
763 case sun4e:
764 _sparc_mapioaddr = sun4c_mapioaddr;
765 _sparc_unmapioaddr = sun4c_unmapioaddr;
766 break;
767 case sun4m:
768 case sun4d:
769 _sparc_mapioaddr = srmmu_mapioaddr;
770 _sparc_unmapioaddr = srmmu_unmapioaddr;
771 break;
772 default:
773 printk("ioport_init: cpu type %d is unknown.\n",
774 sparc_cpu_model);
775 halt();
780 void register_proc_sparc_ioport(void)
782 #ifdef CONFIG_PROC_FS
783 create_proc_read_entry("io_map",0,0,_sparc_io_get_info,&sparc_iomap);
784 create_proc_read_entry("dvma_map",0,0,_sparc_io_get_info,&_sparc_dvma);
785 #endif