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>
This commit is contained in:
parent
62562698d8
commit
aa595accc9
@ -1,4 +1,4 @@
|
|||||||
/* $Id$ */
|
/* $Id: resource.h,v 1.1 1998/11/17 10:40:33 dfr Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright 1998 Massachusetts Institute of Technology
|
* Copyright 1998 Massachusetts Institute of Technology
|
||||||
*
|
*
|
||||||
@ -36,9 +36,11 @@
|
|||||||
* with support for legacy ISA devices and drivers.
|
* with support for legacy ISA devices and drivers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SYS_RES_IRQ 1
|
#define SYS_RES_IRQ 1 /* interrupt lines */
|
||||||
#define SYS_RES_DRQ 2
|
#define SYS_RES_DRQ 2 /* isa dma lines */
|
||||||
#define SYS_RES_MEMORY 3
|
#define SYS_RES_MEMORY 3 /* i/o memory */
|
||||||
#define SYS_RES_IOPORT 4
|
#define SYS_RES_IOPORT 4 /* i/o ports */
|
||||||
|
#define SYS_RES_DENSE 5 /* i/o memory in dense space */
|
||||||
|
#define SYS_RES_BWX 6 /* i/i memory in bwx space */
|
||||||
|
|
||||||
#endif /* !_MACHINE_RESOURCE_H_ */
|
#endif /* !_MACHINE_RESOURCE_H_ */
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: pcibus.c,v 1.15 1999/07/01 20:23:01 peter Exp $
|
* $Id: pcibus.c,v 1.16 1999/07/01 22:48:30 peter Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ vm_offset_t
|
|||||||
pci_cvt_to_dense(vm_offset_t sparse)
|
pci_cvt_to_dense(vm_offset_t sparse)
|
||||||
{
|
{
|
||||||
if(chipset.cvt_to_dense)
|
if(chipset.cvt_to_dense)
|
||||||
return chipset.cvt_to_dense(sparse);
|
return ALPHA_PHYS_TO_K0SEG(chipset.cvt_to_dense(sparse));
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ vm_offset_t
|
|||||||
pci_cvt_to_bwx(vm_offset_t sparse)
|
pci_cvt_to_bwx(vm_offset_t sparse)
|
||||||
{
|
{
|
||||||
if(chipset.cvt_to_bwx)
|
if(chipset.cvt_to_bwx)
|
||||||
return chipset.cvt_to_bwx(sparse);
|
return ALPHA_PHYS_TO_K0SEG(chipset.cvt_to_bwx(sparse));
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -207,6 +207,8 @@ pci_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
|||||||
rm = &port_rman;
|
rm = &port_rman;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SYS_RES_DENSE:
|
||||||
|
case SYS_RES_BWX:
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
rm = &mem_rman;
|
rm = &mem_rman;
|
||||||
break;
|
break;
|
||||||
@ -219,13 +221,29 @@ pci_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
|||||||
if (rv == 0)
|
if (rv == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (type == SYS_RES_MEMORY) {
|
switch (type) {
|
||||||
|
case SYS_RES_MEMORY:
|
||||||
rman_set_bustag(rv, ALPHA_BUS_SPACE_MEM);
|
rman_set_bustag(rv, ALPHA_BUS_SPACE_MEM);
|
||||||
rman_set_bushandle(rv, rv->r_start);
|
rman_set_bushandle(rv, rv->r_start);
|
||||||
rman_set_virtual(rv, (void *) rv->r_start); /* XXX */
|
rman_set_virtual(rv, (void *) rv->r_start); /* maybe NULL? */
|
||||||
} else if (type == SYS_RES_IOPORT) {
|
break;
|
||||||
|
|
||||||
|
case SYS_RES_DENSE:
|
||||||
|
rman_set_bustag(rv, ALPHA_BUS_SPACE_MEM);
|
||||||
|
rman_set_bushandle(rv, rv->r_start);
|
||||||
|
rman_set_virtual(rv, pci_cvt_to_dense(rv->r_start));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SYS_RES_BWX:
|
||||||
|
rman_set_bustag(rv, ALPHA_BUS_SPACE_MEM);
|
||||||
|
rman_set_bushandle(rv, rv->r_start);
|
||||||
|
rman_set_virtual(rv, pci_cvt_to_bwx(rv->r_start));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SYS_RES_IOPORT:
|
||||||
rman_set_bustag(rv, ALPHA_BUS_SPACE_IO);
|
rman_set_bustag(rv, ALPHA_BUS_SPACE_IO);
|
||||||
rman_set_bushandle(rv, rv->r_start);
|
rman_set_bushandle(rv, rv->r_start);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -35,9 +35,11 @@
|
|||||||
* with support for legacy ISA devices and drivers.
|
* with support for legacy ISA devices and drivers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SYS_RES_IRQ 1
|
#define SYS_RES_IRQ 1 /* interrupt lines */
|
||||||
#define SYS_RES_DRQ 2
|
#define SYS_RES_DRQ 2 /* isa dma lines */
|
||||||
#define SYS_RES_MEMORY 3
|
#define SYS_RES_MEMORY 3 /* i/o memory */
|
||||||
#define SYS_RES_IOPORT 4
|
#define SYS_RES_IOPORT 4 /* i/o ports */
|
||||||
|
#define SYS_RES_DENSE SYS_RES_MEMORY
|
||||||
|
#define SYS_RES_BWX SYS_RES_MEMORY
|
||||||
|
|
||||||
#endif /* !_MACHINE_RESOURCE_H_ */
|
#endif /* !_MACHINE_RESOURCE_H_ */
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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 */
|
case SYS_RES_DRQ: /* passthru for child isa */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef __alpha__
|
||||||
|
case SYS_RES_DENSE:
|
||||||
|
case SYS_RES_BWX:
|
||||||
|
#endif
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
if (isdefault) {
|
if (isdefault) {
|
||||||
map = pci_mapno(cfg, *rid);
|
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 */
|
case SYS_RES_DRQ: /* passthru for child isa */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef __alpha__
|
||||||
|
case SYS_RES_DENSE:
|
||||||
|
case SYS_RES_BWX:
|
||||||
|
#endif
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
case SYS_RES_IOPORT:
|
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 */
|
case SYS_RES_DRQ: /* passthru for child isa */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef __alpha__
|
||||||
|
case SYS_RES_DENSE:
|
||||||
|
case SYS_RES_BWX:
|
||||||
|
#endif
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
if (map != -1)
|
if (map != -1)
|
||||||
|
@ -35,9 +35,11 @@
|
|||||||
* with support for legacy ISA devices and drivers.
|
* with support for legacy ISA devices and drivers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SYS_RES_IRQ 1
|
#define SYS_RES_IRQ 1 /* interrupt lines */
|
||||||
#define SYS_RES_DRQ 2
|
#define SYS_RES_DRQ 2 /* isa dma lines */
|
||||||
#define SYS_RES_MEMORY 3
|
#define SYS_RES_MEMORY 3 /* i/o memory */
|
||||||
#define SYS_RES_IOPORT 4
|
#define SYS_RES_IOPORT 4 /* i/o ports */
|
||||||
|
#define SYS_RES_DENSE SYS_RES_MEMORY
|
||||||
|
#define SYS_RES_BWX SYS_RES_MEMORY
|
||||||
|
|
||||||
#endif /* !_MACHINE_RESOURCE_H_ */
|
#endif /* !_MACHINE_RESOURCE_H_ */
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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 */
|
case SYS_RES_DRQ: /* passthru for child isa */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef __alpha__
|
||||||
|
case SYS_RES_DENSE:
|
||||||
|
case SYS_RES_BWX:
|
||||||
|
#endif
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
if (isdefault) {
|
if (isdefault) {
|
||||||
map = pci_mapno(cfg, *rid);
|
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 */
|
case SYS_RES_DRQ: /* passthru for child isa */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef __alpha__
|
||||||
|
case SYS_RES_DENSE:
|
||||||
|
case SYS_RES_BWX:
|
||||||
|
#endif
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
case SYS_RES_IOPORT:
|
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 */
|
case SYS_RES_DRQ: /* passthru for child isa */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef __alpha__
|
||||||
|
case SYS_RES_DENSE:
|
||||||
|
case SYS_RES_BWX:
|
||||||
|
#endif
|
||||||
case SYS_RES_MEMORY:
|
case SYS_RES_MEMORY:
|
||||||
case SYS_RES_IOPORT:
|
case SYS_RES_IOPORT:
|
||||||
if (map != -1)
|
if (map != -1)
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* 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
|
int
|
||||||
pci_map_dense(pcici_t cfg, u_long reg, vm_offset_t* va, vm_offset_t* pa)
|
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)){
|
int rid;
|
||||||
#ifdef __alpha__
|
struct resource *res;
|
||||||
vm_offset_t dense;
|
|
||||||
|
|
||||||
dense = pci_cvt_to_dense(*pa);
|
rid = reg;
|
||||||
if (dense) {
|
res = bus_alloc_resource(cfg->dev, SYS_RES_DENSE, &rid,
|
||||||
*pa = dense;
|
0, ~0, 1, RF_ACTIVE);
|
||||||
*va = ALPHA_PHYS_TO_K0SEG(*pa);
|
if (res) {
|
||||||
return (1);
|
*pa = rman_get_start(res);
|
||||||
}
|
*va = (vm_offset_t) rman_get_virtual(res);
|
||||||
#endif
|
return (1);
|
||||||
#ifdef __i386__
|
|
||||||
return(1);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -129,20 +125,16 @@ pci_map_dense(pcici_t cfg, u_long reg, vm_offset_t* va, vm_offset_t* pa)
|
|||||||
int
|
int
|
||||||
pci_map_bwx(pcici_t cfg, u_long reg, vm_offset_t* va, vm_offset_t* pa)
|
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)){
|
int rid;
|
||||||
#ifdef __alpha__
|
struct resource *res;
|
||||||
vm_offset_t bwx;
|
|
||||||
|
|
||||||
bwx = pci_cvt_to_bwx(*pa);
|
rid = reg;
|
||||||
if (bwx) {
|
res = bus_alloc_resource(cfg->dev, SYS_RES_BWX, &rid,
|
||||||
*pa = bwx;
|
0, ~0, 1, RF_ACTIVE);
|
||||||
*va = ALPHA_PHYS_TO_K0SEG(*pa);
|
if (res) {
|
||||||
return (1);
|
*pa = rman_get_start(res);
|
||||||
}
|
*va = (vm_offset_t) rman_get_virtual(res);
|
||||||
#endif
|
return (1);
|
||||||
#ifdef __i386__
|
|
||||||
return(1);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,11 @@
|
|||||||
* with support for legacy ISA devices and drivers.
|
* with support for legacy ISA devices and drivers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SYS_RES_IRQ 1
|
#define SYS_RES_IRQ 1 /* interrupt lines */
|
||||||
#define SYS_RES_DRQ 2
|
#define SYS_RES_DRQ 2 /* isa dma lines */
|
||||||
#define SYS_RES_MEMORY 3
|
#define SYS_RES_MEMORY 3 /* i/o memory */
|
||||||
#define SYS_RES_IOPORT 4
|
#define SYS_RES_IOPORT 4 /* i/o ports */
|
||||||
|
#define SYS_RES_DENSE SYS_RES_MEMORY
|
||||||
|
#define SYS_RES_BWX SYS_RES_MEMORY
|
||||||
|
|
||||||
#endif /* !_MACHINE_RESOURCE_H_ */
|
#endif /* !_MACHINE_RESOURCE_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user