diff options
author | dfr <dfr@FreeBSD.org> | 1999-07-28 07:57:48 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1999-07-28 07:57:48 +0000 |
commit | 37dec27558a97e62dc2669724f0b5a5c01f68004 (patch) | |
tree | 5672adb8a1af1c7d22f04417b999392ec13d2791 /sys/pci | |
parent | ebe74fdfd56f23f10570dee683db44117f20e4f8 (diff) | |
download | FreeBSD-src-37dec27558a97e62dc2669724f0b5a5c01f68004.zip FreeBSD-src-37dec27558a97e62dc2669724f0b5a5c01f68004.tar.gz |
Add support for SYS_RES_DENSE and SYS_RES_BWX resource types. These are
equivalent to SYS_RES_MEMORY for x86 but for alpha, the rman_get_virtual()
address of the resource is initialised to point into either dense-mapped
or bwx-mapped space respectively, allowing direct memory pointers to be
used to device memory.
Reviewed by: Andrew Gallatin <gallatin@cs.duke.edu>
Diffstat (limited to 'sys/pci')
-rw-r--r-- | sys/pci/pci.c | 14 | ||||
-rw-r--r-- | sys/pci/pci_compat.c | 50 |
2 files changed, 34 insertions, 30 deletions
diff --git a/sys/pci/pci.c b/sys/pci/pci.c index c2091f3..c6184da 100644 --- a/sys/pci/pci.c +++ b/sys/pci/pci.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pci.c,v 1.111 1999/07/27 04:28:14 mdodd Exp $ + * $Id: pci.c,v 1.112 1999/07/27 05:08:36 mdodd Exp $ * */ @@ -1333,6 +1333,10 @@ pci_alloc_resource(device_t dev, device_t child, int type, int *rid, case SYS_RES_DRQ: /* passthru for child isa */ break; +#ifdef __alpha__ + case SYS_RES_DENSE: + case SYS_RES_BWX: +#endif case SYS_RES_MEMORY: if (isdefault) { map = pci_mapno(cfg, *rid); @@ -1389,6 +1393,10 @@ pci_release_resource(device_t dev, device_t child, int type, int rid, case SYS_RES_DRQ: /* passthru for child isa */ break; +#ifdef __alpha__ + case SYS_RES_DENSE: + case SYS_RES_BWX: +#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: /* @@ -1416,6 +1424,10 @@ pci_release_resource(device_t dev, device_t child, int type, int rid, case SYS_RES_DRQ: /* passthru for child isa */ break; +#ifdef __alpha__ + case SYS_RES_DENSE: + case SYS_RES_BWX: +#endif case SYS_RES_MEMORY: case SYS_RES_IOPORT: if (map != -1) diff --git a/sys/pci/pci_compat.c b/sys/pci/pci_compat.c index 48ba902..db4d56a 100644 --- a/sys/pci/pci_compat.c +++ b/sys/pci/pci_compat.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pci_compat.c,v 1.29 1999/05/31 22:13:36 roger Exp $ + * $Id: pci_compat.c,v 1.30 1999/07/03 20:17:08 peter Exp $ * */ @@ -108,20 +108,16 @@ pci_map_mem(pcici_t cfg, u_long reg, vm_offset_t* va, vm_offset_t* pa) int pci_map_dense(pcici_t cfg, u_long reg, vm_offset_t* va, vm_offset_t* pa) { - if (pci_map_mem(cfg, reg, va, pa)){ -#ifdef __alpha__ - vm_offset_t dense; - - dense = pci_cvt_to_dense(*pa); - if (dense) { - *pa = dense; - *va = ALPHA_PHYS_TO_K0SEG(*pa); - return (1); - } -#endif -#ifdef __i386__ - return(1); -#endif + int rid; + struct resource *res; + + rid = reg; + res = bus_alloc_resource(cfg->dev, SYS_RES_DENSE, &rid, + 0, ~0, 1, RF_ACTIVE); + if (res) { + *pa = rman_get_start(res); + *va = (vm_offset_t) rman_get_virtual(res); + return (1); } return (0); } @@ -129,20 +125,16 @@ pci_map_dense(pcici_t cfg, u_long reg, vm_offset_t* va, vm_offset_t* pa) int pci_map_bwx(pcici_t cfg, u_long reg, vm_offset_t* va, vm_offset_t* pa) { - if (pci_map_mem(cfg, reg, va, pa)){ -#ifdef __alpha__ - vm_offset_t bwx; - - bwx = pci_cvt_to_bwx(*pa); - if (bwx) { - *pa = bwx; - *va = ALPHA_PHYS_TO_K0SEG(*pa); - return (1); - } -#endif -#ifdef __i386__ - return(1); -#endif + int rid; + struct resource *res; + + rid = reg; + res = bus_alloc_resource(cfg->dev, SYS_RES_BWX, &rid, + 0, ~0, 1, RF_ACTIVE); + if (res) { + *pa = rman_get_start(res); + *va = (vm_offset_t) rman_get_virtual(res); + return (1); } return (0); } |