summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-11-30 17:24:20 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-11-30 17:24:20 +0000
commit25f9fe0c0777e9c7313f7fad6c6f8669cbc1d9eb (patch)
tree92b599aa9dbc22e0bf9c88461a4077bf33307b1f /sys/dev
parentc9e5e44025b83bf3cab322dd8844458ade3132f9 (diff)
Kill uvm_pagealloc_contig. The two drivers that still used it should have
been converted to bus_dma ages ago, but since noone haven't bothered to do that I haven't bothered to do more than to test that the kernel still builds with those changes.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/isa/aha.c31
-rw-r--r--sys/dev/tc/if_le_ioasic.c32
2 files changed, 53 insertions, 10 deletions
diff --git a/sys/dev/isa/aha.c b/sys/dev/isa/aha.c
index cec6d74a07a..7e4f74910ed 100644
--- a/sys/dev/isa/aha.c
+++ b/sys/dev/isa/aha.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aha.c,v 1.39 2001/06/27 04:45:58 art Exp $ */
+/* $OpenBSD: aha.c,v 1.40 2001/11/30 17:24:19 art Exp $ */
/* $NetBSD: aha.c,v 1.11 1996/05/12 23:51:23 mycroft Exp $ */
#undef AHADIAG
@@ -61,6 +61,9 @@
#include <sys/user.h>
#include <sys/timeout.h>
+#include <uvm/uvm.h>
+#include <uvm/uvm_extern.h>
+
#include <machine/intr.h>
#include <machine/pio.h>
@@ -1011,6 +1014,10 @@ aha_init(sc)
struct aha_devices devices;
struct aha_setup setup;
struct aha_mailbox mailbox;
+ struct pglist pglist;
+ struct vm_page *pg;
+ vaddr_t va;
+ vsize_t size;
int i;
/*
@@ -1082,12 +1089,26 @@ aha_init(sc)
* Set up initial mail box for round-robin operation.
*/
- /* XXX KLUDGE! Should use bus_dmamem_alloc when busified. */
- wmbx = (struct aha_mbx *)uvm_pagealloc_contig(sizeof(struct aha_mbx),
- 0, 0xffffff, PAGE_SIZE);
- if (wmbx == NULL)
+ /*
+ * XXX - this vm juggling is so wrong. use bus_dma instead!
+ */
+ size = round_page(sizeof(struct aha_mbx));
+ if (uvm_pglistalloc(size, 0, 0xffffff, PAGE_SIZE, 0, &pglist, 1, 0) ||
+ uvm_map(kernel_map, &va, size, NULL, UVM_UNKNOWN_OFFSET, 0,
+ UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE,
+ UVM_ADV_RANDOM, 0)))
panic("aha_init: could not allocate mailbox");
+ wmbx = (struct aha_mbx *)va;
+ for (pg = TAILQ_FIRST(&pglist); pg != NULL;pg = TAILQ_NEXT(pg, pageq)) {
+ pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pg),
+ VM_PROT_READ|VM_PROT_WRITE);
+ va += PAGE_SIZE;
+ }
+ /*
+ * XXXEND
+ */
+
for (i = 0; i < AHA_MBX_SIZE; i++) {
wmbx->mbo[i].cmd = AHA_MBO_FREE;
wmbx->mbi[i].stat = AHA_MBI_FREE;
diff --git a/sys/dev/tc/if_le_ioasic.c b/sys/dev/tc/if_le_ioasic.c
index 555e758553d..585b19a8302 100644
--- a/sys/dev/tc/if_le_ioasic.c
+++ b/sys/dev/tc/if_le_ioasic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le_ioasic.c,v 1.7 2001/11/06 19:53:20 miod Exp $ */
+/* $OpenBSD: if_le_ioasic.c,v 1.8 2001/11/30 17:24:19 art Exp $ */
/* $NetBSD: if_le_ioasic.c,v 1.2 1996/05/07 02:24:56 thorpej Exp $ */
/*
@@ -97,11 +97,33 @@ le_ioasic_attach(parent, self, aux)
void *aux;
{
struct ioasicdev_attach_args *d = aux;
- register struct le_softc *lesc = (void *)self;
- register struct am7990_softc *sc = &lesc->sc_am7990;
+ struct le_softc *lesc = (void *)self;
+ struct am7990_softc *sc = &lesc->sc_am7990;
caddr_t le_iomem;
-
- le_iomem = (caddr_t)uvm_pagealloc_contig(LE_IOASIC_MEMSIZE, 0, 0, LE_IOASIC_MEMALIGN);
+ struct pglist pglist;
+ struct vm_page *pg;
+ vaddr_t va;
+ vsize_t size;
+
+ /*
+ * XXX - this vm juggling is so wrong. use bus_dma instead!
+ */
+ size = round_page(LE_IOASIC_MEMSIZE);
+ if (uvm_pglistalloc(size, 0, 0, LE_IOASIC_MEMALIGN, 0, &pglist, 1, 0) ||
+ uvm_map(kernel_map, &va, size, NULL, UVM_UNKNOWN_OFFSET, 0,
+ UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE,
+ UVM_ADV_RANDOM, 0)))
+ panic("aha_init: could not allocate mailbox");
+
+ le_iomem = (caddr_t)va;
+ for (pg = TAILQ_FIRST(&pglist); pg != NULL;pg = TAILQ_NEXT(pg, pageq)) {
+ pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pg),
+ VM_PROT_READ|VM_PROT_WRITE);
+ va += PAGE_SIZE;
+ }
+ /*
+ * XXXEND
+ */
lesc->sc_r1 = (struct lereg1 *)
TC_DENSE_TO_SPARSE(TC_PHYS_TO_UNCACHED(d->iada_addr));