diff options
author | mdodd <mdodd@FreeBSD.org> | 2000-10-18 00:09:26 +0000 |
---|---|---|
committer | mdodd <mdodd@FreeBSD.org> | 2000-10-18 00:09:26 +0000 |
commit | 24266e7d45309efd1c81c7333b14496258e6b81b (patch) | |
tree | d18a2adbe56101a453d116149ba7e431e628dc4a /sys | |
parent | 81e1a4e6535529c973204e2f279d1f16fea83879 (diff) | |
download | FreeBSD-src-24266e7d45309efd1c81c7333b14496258e6b81b.zip FreeBSD-src-24266e7d45309efd1c81c7333b14496258e6b81b.tar.gz |
Use appropriate resource management accessors instead of directly
referencing structure members.
Use rman_get_size() instead of end - start + 1.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/legacy.c | 15 | ||||
-rw-r--r-- | sys/amd64/amd64/nexus.c | 15 | ||||
-rw-r--r-- | sys/dev/agp/agp.c | 3 | ||||
-rw-r--r-- | sys/dev/pcic/i82365.c | 4 | ||||
-rw-r--r-- | sys/dev/pcic/i82365_isa.c | 2 | ||||
-rw-r--r-- | sys/dev/pdq/if_fea.c | 2 | ||||
-rw-r--r-- | sys/i386/i386/legacy.c | 15 | ||||
-rw-r--r-- | sys/i386/i386/nexus.c | 15 | ||||
-rw-r--r-- | sys/pci/agp.c | 3 |
9 files changed, 38 insertions, 36 deletions
diff --git a/sys/amd64/amd64/legacy.c b/sys/amd64/amd64/legacy.c index 5271cbc..af50538 100644 --- a/sys/amd64/amd64/legacy.c +++ b/sys/amd64/amd64/legacy.c @@ -472,18 +472,18 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid, if (rman_get_bustag(r) == I386_BUS_SPACE_MEM) { caddr_t vaddr = 0; - if (r->r_end < 1024 * 1024) { + if (rman_get_end(r) < 1024 * 1024) { /* * The first 1Mb is mapped at KERNBASE. */ - vaddr = (caddr_t)(uintptr_t)(KERNBASE + r->r_start); + vaddr = (caddr_t)(uintptr_t)(KERNBASE + rman_get_start(r)); } else { u_int32_t paddr; u_int32_t psize; u_int32_t poffs; - paddr = r->r_start; - psize = r->r_end - r->r_start; + paddr = rman_get_start(r); + psize = rman_get_size(r); poffs = paddr - trunc_page(paddr); vaddr = (caddr_t) pmap_mapdev(paddr-poffs, psize+poffs) + poffs; @@ -511,10 +511,11 @@ nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, /* * If this is a memory resource, unmap it. */ - if ((rman_get_bustag(r) == I386_BUS_SPACE_MEM) && (r->r_end >= 1024 * 1024)) { + if ((rman_get_bustag(r) == I386_BUS_SPACE_MEM) && + (rman_get_end(r) >= 1024 * 1024)) { u_int32_t psize; - psize = r->r_end - r->r_start; + psize = rman_get_size(r); pmap_unmapdev((vm_offset_t)rman_get_virtual(r), psize); } @@ -525,7 +526,7 @@ static int nexus_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { - if (r->r_flags & RF_ACTIVE) { + if (rman_get_flags(r) & RF_ACTIVE) { int error = bus_deactivate_resource(child, type, rid, r); if (error) return error; diff --git a/sys/amd64/amd64/nexus.c b/sys/amd64/amd64/nexus.c index 5271cbc..af50538 100644 --- a/sys/amd64/amd64/nexus.c +++ b/sys/amd64/amd64/nexus.c @@ -472,18 +472,18 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid, if (rman_get_bustag(r) == I386_BUS_SPACE_MEM) { caddr_t vaddr = 0; - if (r->r_end < 1024 * 1024) { + if (rman_get_end(r) < 1024 * 1024) { /* * The first 1Mb is mapped at KERNBASE. */ - vaddr = (caddr_t)(uintptr_t)(KERNBASE + r->r_start); + vaddr = (caddr_t)(uintptr_t)(KERNBASE + rman_get_start(r)); } else { u_int32_t paddr; u_int32_t psize; u_int32_t poffs; - paddr = r->r_start; - psize = r->r_end - r->r_start; + paddr = rman_get_start(r); + psize = rman_get_size(r); poffs = paddr - trunc_page(paddr); vaddr = (caddr_t) pmap_mapdev(paddr-poffs, psize+poffs) + poffs; @@ -511,10 +511,11 @@ nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, /* * If this is a memory resource, unmap it. */ - if ((rman_get_bustag(r) == I386_BUS_SPACE_MEM) && (r->r_end >= 1024 * 1024)) { + if ((rman_get_bustag(r) == I386_BUS_SPACE_MEM) && + (rman_get_end(r) >= 1024 * 1024)) { u_int32_t psize; - psize = r->r_end - r->r_start; + psize = rman_get_size(r); pmap_unmapdev((vm_offset_t)rman_get_virtual(r), psize); } @@ -525,7 +526,7 @@ static int nexus_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { - if (r->r_flags & RF_ACTIVE) { + if (rman_get_flags(r) & RF_ACTIVE) { int error = bus_deactivate_resource(child, type, rid, r); if (error) return error; diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index 5bf48a1..2ba8727 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -746,8 +746,7 @@ agp_get_info(device_t dev, struct agp_info *info) info->ai_mode = pci_read_config(dev, agp_find_caps(dev) + AGP_STATUS, 4); info->ai_aperture_base = rman_get_start(sc->as_aperture); - info->ai_aperture_size = (rman_get_end(sc->as_aperture) - - rman_get_start(sc->as_aperture)) + 1; + info->ai_aperture_size = rmang_get_size(sc->as_aperture); info->ai_memory_allowed = sc->as_maxmem; info->ai_memory_used = sc->as_allocated; } diff --git a/sys/dev/pcic/i82365.c b/sys/dev/pcic/i82365.c index 1abdd7b..59df77a 100644 --- a/sys/dev/pcic/i82365.c +++ b/sys/dev/pcic/i82365.c @@ -1307,7 +1307,7 @@ pcic_activate_resource(device_t dev, device_t child, int type, int rid, bus_addr_t off; struct pcic_handle *h = pcic_get_handle(dev, child); - sz = rman_get_end(r) - rman_get_start(r) + 1; + sz = rman_get_size(r); switch (type) { case SYS_RES_IOPORT: win = rid; @@ -1416,7 +1416,7 @@ pcic_alloc_resource(device_t dev, device_t child, int type, int *rid, count, flags); if (r == NULL) return r; - sz = rman_get_end(r) - rman_get_start(r) + 1; + sz = rman_get_size(r); switch (type) { case SYS_RES_IOPORT: err = pcic_chip_io_alloc(h, rman_get_start(r), sz, 0, diff --git a/sys/dev/pcic/i82365_isa.c b/sys/dev/pcic/i82365_isa.c index 800b848..e71b87f 100644 --- a/sys/dev/pcic/i82365_isa.c +++ b/sys/dev/pcic/i82365_isa.c @@ -134,7 +134,7 @@ pcic_isa_bus_width_probe (device_t dev) struct resource *r; base = rman_get_start(sc->port_res); - length = rman_get_end(sc->port_res) - rman_get_end(sc->port_res) + 1; + length = rman_get_size(sc->port_res); iot = sc->iot; ioh = sc->ioh; diff --git a/sys/dev/pdq/if_fea.c b/sys/dev/pdq/if_fea.c index dc90631..229fd38 100644 --- a/sys/dev/pdq/if_fea.c +++ b/sys/dev/pdq/if_fea.c @@ -204,7 +204,7 @@ pdq_eisa_attach (dev) } m_addr = rman_get_start(mspace); - m_size = (rman_get_end(mspace) - rman_get_start(mspace)) + 1; + m_size = rman_get_size(mspace); sc->sc_iobase = (pdq_bus_ioport_t) rman_get_start(io); sc->sc_membase = (pdq_bus_memaddr_t) pmap_mapdev(m_addr, m_size); diff --git a/sys/i386/i386/legacy.c b/sys/i386/i386/legacy.c index 5271cbc..af50538 100644 --- a/sys/i386/i386/legacy.c +++ b/sys/i386/i386/legacy.c @@ -472,18 +472,18 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid, if (rman_get_bustag(r) == I386_BUS_SPACE_MEM) { caddr_t vaddr = 0; - if (r->r_end < 1024 * 1024) { + if (rman_get_end(r) < 1024 * 1024) { /* * The first 1Mb is mapped at KERNBASE. */ - vaddr = (caddr_t)(uintptr_t)(KERNBASE + r->r_start); + vaddr = (caddr_t)(uintptr_t)(KERNBASE + rman_get_start(r)); } else { u_int32_t paddr; u_int32_t psize; u_int32_t poffs; - paddr = r->r_start; - psize = r->r_end - r->r_start; + paddr = rman_get_start(r); + psize = rman_get_size(r); poffs = paddr - trunc_page(paddr); vaddr = (caddr_t) pmap_mapdev(paddr-poffs, psize+poffs) + poffs; @@ -511,10 +511,11 @@ nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, /* * If this is a memory resource, unmap it. */ - if ((rman_get_bustag(r) == I386_BUS_SPACE_MEM) && (r->r_end >= 1024 * 1024)) { + if ((rman_get_bustag(r) == I386_BUS_SPACE_MEM) && + (rman_get_end(r) >= 1024 * 1024)) { u_int32_t psize; - psize = r->r_end - r->r_start; + psize = rman_get_size(r); pmap_unmapdev((vm_offset_t)rman_get_virtual(r), psize); } @@ -525,7 +526,7 @@ static int nexus_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { - if (r->r_flags & RF_ACTIVE) { + if (rman_get_flags(r) & RF_ACTIVE) { int error = bus_deactivate_resource(child, type, rid, r); if (error) return error; diff --git a/sys/i386/i386/nexus.c b/sys/i386/i386/nexus.c index 5271cbc..af50538 100644 --- a/sys/i386/i386/nexus.c +++ b/sys/i386/i386/nexus.c @@ -472,18 +472,18 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid, if (rman_get_bustag(r) == I386_BUS_SPACE_MEM) { caddr_t vaddr = 0; - if (r->r_end < 1024 * 1024) { + if (rman_get_end(r) < 1024 * 1024) { /* * The first 1Mb is mapped at KERNBASE. */ - vaddr = (caddr_t)(uintptr_t)(KERNBASE + r->r_start); + vaddr = (caddr_t)(uintptr_t)(KERNBASE + rman_get_start(r)); } else { u_int32_t paddr; u_int32_t psize; u_int32_t poffs; - paddr = r->r_start; - psize = r->r_end - r->r_start; + paddr = rman_get_start(r); + psize = rman_get_size(r); poffs = paddr - trunc_page(paddr); vaddr = (caddr_t) pmap_mapdev(paddr-poffs, psize+poffs) + poffs; @@ -511,10 +511,11 @@ nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, /* * If this is a memory resource, unmap it. */ - if ((rman_get_bustag(r) == I386_BUS_SPACE_MEM) && (r->r_end >= 1024 * 1024)) { + if ((rman_get_bustag(r) == I386_BUS_SPACE_MEM) && + (rman_get_end(r) >= 1024 * 1024)) { u_int32_t psize; - psize = r->r_end - r->r_start; + psize = rman_get_size(r); pmap_unmapdev((vm_offset_t)rman_get_virtual(r), psize); } @@ -525,7 +526,7 @@ static int nexus_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { - if (r->r_flags & RF_ACTIVE) { + if (rman_get_flags(r) & RF_ACTIVE) { int error = bus_deactivate_resource(child, type, rid, r); if (error) return error; diff --git a/sys/pci/agp.c b/sys/pci/agp.c index 5bf48a1..2ba8727 100644 --- a/sys/pci/agp.c +++ b/sys/pci/agp.c @@ -746,8 +746,7 @@ agp_get_info(device_t dev, struct agp_info *info) info->ai_mode = pci_read_config(dev, agp_find_caps(dev) + AGP_STATUS, 4); info->ai_aperture_base = rman_get_start(sc->as_aperture); - info->ai_aperture_size = (rman_get_end(sc->as_aperture) - - rman_get_start(sc->as_aperture)) + 1; + info->ai_aperture_size = rmang_get_size(sc->as_aperture); info->ai_memory_allowed = sc->as_maxmem; info->ai_memory_used = sc->as_allocated; } |