1 /* $Id: ioport.c,v 1.45 2001/10/30 04:54:21 davem 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.
10 * <rth> zait: as long as pci_alloc_consistent produces something addressable,
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()))
17 * <zaitcev> Suppose I did this remap_it_my_way(virt_to_phys(get_free_page())).
19 * <zaitcev> Now, driver calls pci_free_consistent(with result of
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.
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>
35 #include <linux/slab.h>
36 #include <linux/pci.h> /* struct pci_dev */
37 #include <linux/proc_fs.h>
40 #include <asm/vaddrs.h>
41 #include <asm/oplib.h>
45 #include <asm/pgalloc.h>
48 #define mmu_inval_dma_area(p, l) /* Anton pulled it out for 2.4.0-xx */
50 struct resource *_sparc_find_resource(struct resource *r, unsigned long);
52 static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz);
53 static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
54 unsigned long size, char *name);
55 static void _sparc_free_io(struct resource *res);
57 /* This points to the next to use virtual memory for DVMA mappings */
58 static struct resource _sparc_dvma = {
59 .name = "sparc_dvma", .start = DVMA_VADDR, .end = DVMA_END - 1
61 /* This points to the start of I/O mappings, cluable from outside. */
62 /*ext*/ struct resource sparc_iomap = {
63 .name = "sparc_iomap", .start = IOBASE_VADDR, .end = IOBASE_END - 1
67 * Our mini-allocator...
68 * Boy this is gross! We need it because we must map I/O for
69 * timers and interrupt controller before the kmalloc is available.
73 #define XNRES 10 /* SS-10 uses 8 */
76 struct resource xres; /* Must be first */
77 int xflag; /* 1 == used */
81 static struct xresource xresv[XNRES];
83 static struct xresource *xres_alloc(void) {
84 struct xresource *xrp;
88 for (n = 0; n < XNRES; n++) {
89 if (xrp->xflag == 0) {
98 static void xres_free(struct xresource *xrp) {
103 * These are typically used in PCI drivers
104 * which are trying to be cross-platform.
106 * Bus type is always zero on IIep.
108 void __iomem *ioremap(unsigned long offset, unsigned long size)
112 sprintf(name, "phys_%08x", (u32)offset);
113 return _sparc_alloc_io(0, offset, size, name);
117 * Comlimentary to ioremap().
119 void iounmap(volatile void __iomem *virtual)
121 unsigned long vaddr = (unsigned long) virtual & PAGE_MASK;
122 struct resource *res;
124 if ((res = _sparc_find_resource(&sparc_iomap, vaddr)) == NULL) {
125 printk("free_io/iounmap: cannot free %lx\n", vaddr);
130 if ((char *)res >= (char*)xresv && (char *)res < (char *)&xresv[XNRES]) {
131 xres_free((struct xresource *)res);
139 void __iomem *sbus_ioremap(struct resource *phyres, unsigned long offset,
140 unsigned long size, char *name)
142 return _sparc_alloc_io(phyres->flags & 0xF,
143 phyres->start + offset, size, name);
148 void sbus_iounmap(volatile void __iomem *addr, unsigned long size)
156 static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
157 unsigned long size, char *name)
159 static int printed_full;
160 struct xresource *xres;
161 struct resource *res;
164 void __iomem *va; /* P3 diag */
166 if (name == NULL) name = "???";
168 if ((xres = xres_alloc()) != 0) {
173 printk("ioremap: done with statics, switching to malloc\n");
177 tack = kmalloc(sizeof (struct resource) + tlen + 1, GFP_KERNEL);
178 if (tack == NULL) return NULL;
179 memset(tack, 0, sizeof(struct resource));
180 res = (struct resource *) tack;
181 tack += sizeof (struct resource);
184 strlcpy(tack, name, XNMLN+1);
187 va = _sparc_ioremap(res, busno, phys, size);
188 /* printk("ioremap(0x%x:%08lx[0x%lx])=%p\n", busno, phys, size, va); */ /* P3 diag */
194 static void __iomem *
195 _sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz)
197 unsigned long offset = ((unsigned long) pa) & (~PAGE_MASK);
199 if (allocate_resource(&sparc_iomap, res,
200 (offset + sz + PAGE_SIZE-1) & PAGE_MASK,
201 sparc_iomap.start, sparc_iomap.end, PAGE_SIZE, NULL, NULL) != 0) {
202 /* Usually we cannot see printks in this case. */
203 prom_printf("alloc_io_res(%s): cannot occupy\n",
204 (res->name != NULL)? res->name: "???");
209 sparc_mapiorange(bus, pa, res->start, res->end - res->start + 1);
211 return (void __iomem *) (res->start + offset);
215 * Comlimentary to _sparc_ioremap().
217 static void _sparc_free_io(struct resource *res)
221 plen = res->end - res->start + 1;
222 BUG_ON((plen & (PAGE_SIZE-1)) != 0);
223 sparc_unmapiorange(res->start, plen);
224 release_resource(res);
229 void sbus_set_sbus64(struct sbus_dev *sdev, int x)
231 printk("sbus_set_sbus64: unsupported\n");
234 extern unsigned int sun4d_build_irq(struct sbus_dev *sdev, int irq);
235 void __init sbus_fill_device_irq(struct sbus_dev *sdev)
237 struct linux_prom_irqs irqs[PROMINTR_MAX];
240 len = prom_getproperty(sdev->prom_node, "intr",
241 (char *)irqs, sizeof(irqs));
243 sdev->num_irqs = len / 8;
244 if (sdev->num_irqs == 0) {
246 } else if (sparc_cpu_model == sun4d) {
247 for (len = 0; len < sdev->num_irqs; len++)
249 sun4d_build_irq(sdev, irqs[len].pri);
251 for (len = 0; len < sdev->num_irqs; len++)
252 sdev->irqs[len] = irqs[len].pri;
255 int interrupts[PROMINTR_MAX];
257 /* No "intr" node found-- check for "interrupts" node.
258 * This node contains SBus interrupt levels, not IPLs
259 * as in "intr", and no vector values. We convert
260 * SBus interrupt levels to PILs (platform specific).
262 len = prom_getproperty(sdev->prom_node, "interrupts",
263 (char *)interrupts, sizeof(interrupts));
268 sdev->num_irqs = len / sizeof(int);
269 for (len = 0; len < sdev->num_irqs; len++) {
271 sbint_to_irq(sdev, interrupts[len]);
278 * Allocate a chunk of memory suitable for DMA.
279 * Typically devices use them for control blocks.
280 * CPU may access them without any explicit flushing.
282 * XXX Some clever people know that sdev is not used and supply NULL. Watch.
284 void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp)
286 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK;
288 struct resource *res;
291 /* XXX why are some lenghts signed, others unsigned? */
295 /* XXX So what is maxphys for us and how do drivers know it? */
296 if (len > 256*1024) { /* __get_free_pages() limit */
300 order = get_order(len_total);
301 if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0)
304 if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
306 memset((char*)res, 0, sizeof(struct resource));
308 if (allocate_resource(&_sparc_dvma, res, len_total,
309 _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
310 printk("sbus_alloc_consistent: cannot occupy 0x%lx", len_total);
313 mmu_inval_dma_area(va, len_total);
314 // XXX The mmu_map_dma_area does this for us below, see comments.
315 // sparc_mapiorange(0, virt_to_phys(va), res->start, len_total);
317 * XXX That's where sdev would be used. Currently we load
318 * all iommu tables with the same translations.
320 if (mmu_map_dma_area(dma_addrp, va, res->start, len_total) != 0)
323 /* Set the resource name, if known. */
325 res->name = sdev->prom_name;
328 return (void *)res->start;
331 release_resource(res);
333 free_pages(va, order);
340 void sbus_free_consistent(struct sbus_dev *sdev, long n, void *p, u32 ba)
342 struct resource *res;
345 if ((res = _sparc_find_resource(&_sparc_dvma,
346 (unsigned long)p)) == NULL) {
347 printk("sbus_free_consistent: cannot free %p\n", p);
351 if (((unsigned long)p & (PAGE_SIZE-1)) != 0) {
352 printk("sbus_free_consistent: unaligned va %p\n", p);
356 n = (n + PAGE_SIZE-1) & PAGE_MASK;
357 if ((res->end-res->start)+1 != n) {
358 printk("sbus_free_consistent: region 0x%lx asked 0x%lx\n",
359 (long)((res->end-res->start)+1), n);
363 release_resource(res);
366 /* mmu_inval_dma_area(va, n); */ /* it's consistent, isn't it */
367 pgv = mmu_translate_dvma(ba);
368 mmu_unmap_dma_area(ba, n);
370 __free_pages(pgv, get_order(n));
374 * Map a chunk of memory so that devices can see it.
375 * CPU view of this memory may be inconsistent with
376 * a device view and explicit flushing is necessary.
378 dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *va, size_t len, int direction)
380 /* XXX why are some lenghts signed, others unsigned? */
384 /* XXX So what is maxphys for us and how do drivers know it? */
385 if (len > 256*1024) { /* __get_free_pages() limit */
388 return mmu_get_scsi_one(va, len, sdev->bus);
391 void sbus_unmap_single(struct sbus_dev *sdev, dma_addr_t ba, size_t n, int direction)
393 mmu_release_scsi_one(ba, n, sdev->bus);
396 int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction)
398 mmu_get_scsi_sgl(sg, n, sdev->bus);
401 * XXX sparc64 can return a partial length here. sun4c should do this
402 * but it currently panics if it can't fulfill the request - Anton
407 void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction)
409 mmu_release_scsi_sgl(sg, n, sdev->bus);
414 void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, dma_addr_t ba, size_t size, int direction)
418 struct resource *res;
420 /* We do not need the resource, just print a message if invalid. */
421 res = _sparc_find_resource(&_sparc_dvma, ba);
423 panic("sbus_dma_sync_single: 0x%x\n", ba);
425 va = page_address(mmu_translate_dvma(ba)); /* XXX higmem */
427 * XXX This bogosity will be fixed with the iommu rewrite coming soon
428 * to a kernel near you. - Anton
430 /* mmu_inval_dma_area(va, (size + PAGE_SIZE-1) & PAGE_MASK); */
434 void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, dma_addr_t ba, size_t size, int direction)
438 struct resource *res;
440 /* We do not need the resource, just print a message if invalid. */
441 res = _sparc_find_resource(&_sparc_dvma, ba);
443 panic("sbus_dma_sync_single: 0x%x\n", ba);
445 va = page_address(mmu_translate_dvma(ba)); /* XXX higmem */
447 * XXX This bogosity will be fixed with the iommu rewrite coming soon
448 * to a kernel near you. - Anton
450 /* mmu_inval_dma_area(va, (size + PAGE_SIZE-1) & PAGE_MASK); */
454 void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction)
456 printk("sbus_dma_sync_sg_for_cpu: not implemented yet\n");
459 void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev, struct scatterlist *sg, int n, int direction)
461 printk("sbus_dma_sync_sg_for_device: not implemented yet\n");
464 /* Support code for sbus_init(). */
466 * XXX This functions appears to be a distorted version of
467 * prom_sbus_ranges_init(), with all sun4d stuff cut away.
468 * Ask DaveM what is going on here, how is sun4d supposed to work... XXX
470 /* added back sun4d patch from Thomas Bogendoerfer - should be OK (crn) */
471 void __init sbus_arch_bus_ranges_init(struct device_node *pn, struct sbus_bus *sbus)
473 int parent_node = pn->node;
475 if (sparc_cpu_model == sun4d) {
476 struct linux_prom_ranges iounit_ranges[PROMREG_MAX];
477 int num_iounit_ranges, len;
479 len = prom_getproperty(parent_node, "ranges",
480 (char *) iounit_ranges,
481 sizeof (iounit_ranges));
484 (len / sizeof(struct linux_prom_ranges));
485 prom_adjust_ranges(sbus->sbus_ranges,
486 sbus->num_sbus_ranges,
487 iounit_ranges, num_iounit_ranges);
492 void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp)
494 struct device_node *parent = dp->parent;
496 if (sparc_cpu_model != sun4d &&
498 !strcmp(parent->name, "iommu")) {
499 extern void iommu_init(int iommu_node, struct sbus_bus *sbus);
501 iommu_init(parent->node, sbus);
504 if (sparc_cpu_model == sun4d) {
505 extern void iounit_init(int sbi_node, int iounit_node,
506 struct sbus_bus *sbus);
508 iounit_init(dp->node, parent->node, sbus);
512 void __init sbus_setup_arch_props(struct sbus_bus *sbus, struct device_node *dp)
514 if (sparc_cpu_model == sun4d) {
515 struct device_node *parent = dp->parent;
517 sbus->devid = of_getintprop_default(parent, "device-id", 0);
518 sbus->board = of_getintprop_default(parent, "board#", 0);
522 int __init sbus_arch_preinit(void)
524 extern void register_proc_sparc_ioport(void);
526 register_proc_sparc_ioport();
530 extern void sun4_dvma_init(void);
539 void __init sbus_arch_postinit(void)
541 if (sparc_cpu_model == sun4d) {
542 extern void sun4d_init_sbi_irq(void);
543 sun4d_init_sbi_irq();
546 #endif /* CONFIG_SBUS */
550 /* Allocate and map kernel buffer using consistent mode DMA for a device.
551 * hwdev should be valid struct pci_dev pointer for PCI devices.
553 void *pci_alloc_consistent(struct pci_dev *pdev, size_t len, dma_addr_t *pba)
555 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK;
557 struct resource *res;
563 if (len > 256*1024) { /* __get_free_pages() limit */
567 order = get_order(len_total);
568 va = __get_free_pages(GFP_KERNEL, order);
570 printk("pci_alloc_consistent: no %ld pages\n", len_total>>PAGE_SHIFT);
574 if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) {
575 free_pages(va, order);
576 printk("pci_alloc_consistent: no core\n");
579 memset((char*)res, 0, sizeof(struct resource));
581 if (allocate_resource(&_sparc_dvma, res, len_total,
582 _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
583 printk("pci_alloc_consistent: cannot occupy 0x%lx", len_total);
584 free_pages(va, order);
588 mmu_inval_dma_area(va, len_total);
590 /* P3 */ printk("pci_alloc_consistent: kva %lx uncva %lx phys %lx size %lx\n",
591 (long)va, (long)res->start, (long)virt_to_phys(va), len_total);
593 sparc_mapiorange(0, virt_to_phys(va), res->start, len_total);
595 *pba = virt_to_phys(va); /* equals virt_to_bus (R.I.P.) for us. */
596 return (void *) res->start;
599 /* Free and unmap a consistent DMA buffer.
600 * cpu_addr is what was returned from pci_alloc_consistent,
601 * size must be the same as what as passed into pci_alloc_consistent,
602 * and likewise dma_addr must be the same as what *dma_addrp was set to.
604 * References to the memory and mappings assosciated with cpu_addr/dma_addr
605 * past this call are illegal.
607 void pci_free_consistent(struct pci_dev *pdev, size_t n, void *p, dma_addr_t ba)
609 struct resource *res;
612 if ((res = _sparc_find_resource(&_sparc_dvma,
613 (unsigned long)p)) == NULL) {
614 printk("pci_free_consistent: cannot free %p\n", p);
618 if (((unsigned long)p & (PAGE_SIZE-1)) != 0) {
619 printk("pci_free_consistent: unaligned va %p\n", p);
623 n = (n + PAGE_SIZE-1) & PAGE_MASK;
624 if ((res->end-res->start)+1 != n) {
625 printk("pci_free_consistent: region 0x%lx asked 0x%lx\n",
626 (long)((res->end-res->start)+1), (long)n);
630 pgp = (unsigned long) phys_to_virt(ba); /* bus_to_virt actually */
631 mmu_inval_dma_area(pgp, n);
632 sparc_unmapiorange((unsigned long)p, n);
634 release_resource(res);
637 free_pages(pgp, get_order(n));
640 /* Map a single buffer of the indicated size for DMA in streaming mode.
641 * The 32-bit bus address to use is returned.
643 * Once the device is given the dma address, the device owns this memory
644 * until either pci_unmap_single or pci_dma_sync_single_* is performed.
646 dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size,
649 BUG_ON(direction == PCI_DMA_NONE);
650 /* IIep is write-through, not flushing. */
651 return virt_to_phys(ptr);
654 /* Unmap a single streaming mode DMA translation. The dma_addr and size
655 * must match what was provided for in a previous pci_map_single call. All
656 * other usages are undefined.
658 * After this call, reads by the cpu to the buffer are guaranteed to see
659 * whatever the device wrote there.
661 void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t ba, size_t size,
664 BUG_ON(direction == PCI_DMA_NONE);
665 if (direction != PCI_DMA_TODEVICE) {
666 mmu_inval_dma_area((unsigned long)phys_to_virt(ba),
667 (size + PAGE_SIZE-1) & PAGE_MASK);
672 * Same as pci_map_single, but with pages.
674 dma_addr_t pci_map_page(struct pci_dev *hwdev, struct page *page,
675 unsigned long offset, size_t size, int direction)
677 BUG_ON(direction == PCI_DMA_NONE);
678 /* IIep is write-through, not flushing. */
679 return page_to_phys(page) + offset;
682 void pci_unmap_page(struct pci_dev *hwdev,
683 dma_addr_t dma_address, size_t size, int direction)
685 BUG_ON(direction == PCI_DMA_NONE);
686 /* mmu_inval_dma_area XXX */
689 /* Map a set of buffers described by scatterlist in streaming
690 * mode for DMA. This is the scather-gather version of the
691 * above pci_map_single interface. Here the scatter gather list
692 * elements are each tagged with the appropriate dma address
693 * and length. They are obtained via sg_dma_{address,length}(SG).
695 * NOTE: An implementation may be able to use a smaller number of
696 * DMA address/length pairs than there are SG table elements.
697 * (for example via virtual mapping capabilities)
698 * The routine returns the number of addr/length pairs actually
699 * used, at most nents.
701 * Device ownership issues as mentioned above for pci_map_single are
704 int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents,
709 BUG_ON(direction == PCI_DMA_NONE);
710 /* IIep is write-through, not flushing. */
711 for (n = 0; n < nents; n++) {
712 BUG_ON(page_address(sg->page) == NULL);
713 sg->dvma_address = virt_to_phys(page_address(sg->page));
714 sg->dvma_length = sg->length;
720 /* Unmap a set of streaming mode DMA translations.
721 * Again, cpu read rules concerning calls here are the same as for
722 * pci_unmap_single() above.
724 void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents,
729 BUG_ON(direction == PCI_DMA_NONE);
730 if (direction != PCI_DMA_TODEVICE) {
731 for (n = 0; n < nents; n++) {
732 BUG_ON(page_address(sg->page) == NULL);
734 (unsigned long) page_address(sg->page),
735 (sg->length + PAGE_SIZE-1) & PAGE_MASK);
741 /* Make physical memory consistent for a single
742 * streaming mode DMA translation before or after a transfer.
744 * If you perform a pci_map_single() but wish to interrogate the
745 * buffer using the cpu, yet do not wish to teardown the PCI dma
746 * mapping, you must call this function before doing so. At the
747 * next point you give the PCI dma address back to the card, you
748 * must first perform a pci_dma_sync_for_device, and then the
749 * device again owns the buffer.
751 void pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t ba, size_t size, int direction)
753 BUG_ON(direction == PCI_DMA_NONE);
754 if (direction != PCI_DMA_TODEVICE) {
755 mmu_inval_dma_area((unsigned long)phys_to_virt(ba),
756 (size + PAGE_SIZE-1) & PAGE_MASK);
760 void pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t ba, size_t size, int direction)
762 BUG_ON(direction == PCI_DMA_NONE);
763 if (direction != PCI_DMA_TODEVICE) {
764 mmu_inval_dma_area((unsigned long)phys_to_virt(ba),
765 (size + PAGE_SIZE-1) & PAGE_MASK);
769 /* Make physical memory consistent for a set of streaming
770 * mode DMA translations after a transfer.
772 * The same as pci_dma_sync_single_* but for a scatter-gather list,
773 * same rules and usage.
775 void pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction)
779 BUG_ON(direction == PCI_DMA_NONE);
780 if (direction != PCI_DMA_TODEVICE) {
781 for (n = 0; n < nents; n++) {
782 BUG_ON(page_address(sg->page) == NULL);
784 (unsigned long) page_address(sg->page),
785 (sg->length + PAGE_SIZE-1) & PAGE_MASK);
791 void pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction)
795 BUG_ON(direction == PCI_DMA_NONE);
796 if (direction != PCI_DMA_TODEVICE) {
797 for (n = 0; n < nents; n++) {
798 BUG_ON(page_address(sg->page) == NULL);
800 (unsigned long) page_address(sg->page),
801 (sg->length + PAGE_SIZE-1) & PAGE_MASK);
806 #endif /* CONFIG_PCI */
808 #ifdef CONFIG_PROC_FS
811 _sparc_io_get_info(char *buf, char **start, off_t fpos, int length, int *eof,
814 char *p = buf, *e = buf + length;
818 for (r = ((struct resource *)data)->child; r != NULL; r = r->sibling) {
819 if (p + 32 >= e) /* Better than nothing */
821 if ((nm = r->name) == 0) nm = "???";
822 p += sprintf(p, "%08lx-%08lx: %s\n", r->start, r->end, nm);
828 #endif /* CONFIG_PROC_FS */
831 * This is a version of find_resource and it belongs to kernel/resource.c.
832 * Until we have agreement with Linus and Martin, it lingers here.
834 * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case.
835 * This probably warrants some sort of hashing.
838 _sparc_find_resource(struct resource *root, unsigned long hit)
840 struct resource *tmp;
842 for (tmp = root->child; tmp != 0; tmp = tmp->sibling) {
843 if (tmp->start <= hit && tmp->end >= hit)
849 void register_proc_sparc_ioport(void)
851 #ifdef CONFIG_PROC_FS
852 create_proc_read_entry("io_map",0,NULL,_sparc_io_get_info,&sparc_iomap);
853 create_proc_read_entry("dvma_map",0,NULL,_sparc_io_get_info,&_sparc_dvma);