diff options
author | gallatin <gallatin@FreeBSD.org> | 1999-08-11 22:31:01 +0000 |
---|---|---|
committer | gallatin <gallatin@FreeBSD.org> | 1999-08-11 22:31:01 +0000 |
commit | b6bf32258fd2cdf67a89f0be86c4574aab265e20 (patch) | |
tree | 6a637ba9caae7c5e7ca9fd771f58e7d90933af72 /sys/alpha/pci/apecs.c | |
parent | 5d1b5dae7c84b119c7316be0fa593bd75cdfce53 (diff) | |
download | FreeBSD-src-b6bf32258fd2cdf67a89f0be86c4574aab265e20.zip FreeBSD-src-b6bf32258fd2cdf67a89f0be86c4574aab265e20.tar.gz |
Enable S/G IO. Based on Doug's changes to cia.c
Diffstat (limited to 'sys/alpha/pci/apecs.c')
-rw-r--r-- | sys/alpha/pci/apecs.c | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/sys/alpha/pci/apecs.c b/sys/alpha/pci/apecs.c index c6b0ac4..9d95446 100644 --- a/sys/alpha/pci/apecs.c +++ b/sys/alpha/pci/apecs.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: apecs.c,v 1.7 1999/05/08 21:58:40 dfr Exp $ + * $Id: apecs.c,v 1.8 1999/05/20 15:33:18 gallatin Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -59,6 +59,7 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/module.h> +#include <sys/malloc.h> #include <sys/bus.h> #include <machine/bus.h> #include <sys/rman.h> @@ -73,6 +74,11 @@ #include <machine/cpuconf.h> #include <machine/swiz.h> #include <machine/rpb.h> +#include <machine/sgmap.h> + +#include <vm/vm.h> +#include <vm/vm_prot.h> +#include <vm/vm_page.h> #define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) @@ -478,6 +484,63 @@ static driver_t apecs_driver = { sizeof(struct apecs_softc), }; +#define APECS_SGMAP_BASE (8*1024*1024) +#define APECS_SGMAP_SIZE (8*1024*1024) + +static void +apecs_sgmap_invalidate(void) +{ + alpha_mb(); + REGVAL(EPIC_TBIA) = 0; + alpha_mb(); +} + +static void +apecs_sgmap_map(void *arg, vm_offset_t ba, vm_offset_t pa) +{ + u_int64_t *sgtable = arg; + int index = alpha_btop(ba - APECS_SGMAP_BASE); + + if (pa) { + if (pa > (1L<<32)) + panic("apecs_sgmap_map: can't map address 0x%lx", pa); + sgtable[index] = ((pa >> 13) << 1) | 1; + } else { + sgtable[index] = 0; + } + alpha_mb(); + apecs_sgmap_invalidate(); +} + +static void +apecs_init_sgmap(void) +{ + void *sgtable; + + /* + * First setup Window 0 to map 8Mb to 16Mb with an + * sgmap. Allocate the map aligned to a 32 boundary. + */ + REGVAL(EPIC_PCI_BASE_1) = APECS_SGMAP_BASE | + EPIC_PCI_BASE_SGEN | EPIC_PCI_BASE_WENB; + alpha_mb(); + + REGVAL(EPIC_PCI_MASK_1) = EPIC_PCI_MASK_8M; + alpha_mb(); + + sgtable = contigmalloc(8192, M_DEVBUF, M_NOWAIT, + 0, (1L<<34), + 32*1024, (1L<<34)); + if (!sgtable) + panic("apecs_init_sgmap: can't allocate page table"); + REGVAL(EPIC_TBASE_1) = + (pmap_kextract((vm_offset_t) sgtable) >> EPIC_TBASE_SHIFT); + + chipset.sgmap = sgmap_map_create(APECS_SGMAP_BASE, + APECS_SGMAP_BASE + APECS_SGMAP_SIZE, + apecs_sgmap_map, sgtable); +} + void apecs_init() { @@ -509,6 +572,7 @@ apecs_probe(device_t dev) pci_init_resources(); isa_init_intr(); + apecs_init_sgmap(); device_add_child(dev, "pcib", 0, 0); |