summaryrefslogtreecommitdiff
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
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.
-rw-r--r--sys/dev/isa/aha.c31
-rw-r--r--sys/dev/tc/if_le_ioasic.c32
-rw-r--r--sys/uvm/uvm_extern.h4
-rw-r--r--sys/uvm/uvm_page.c45
4 files changed, 55 insertions, 57 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));
diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h
index e2101e71378..b0bfa189072 100644
--- a/sys/uvm/uvm_extern.h
+++ b/sys/uvm/uvm_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_extern.h,v 1.36 2001/11/28 19:28:14 art Exp $ */
+/* $OpenBSD: uvm_extern.h,v 1.37 2001/11/30 17:24:19 art Exp $ */
/* $NetBSD: uvm_extern.h,v 1.65 2001/06/02 18:09:26 chs Exp $ */
/*
@@ -572,8 +572,6 @@ struct vm_page *uvm_pagealloc_strat __P((struct uvm_object *,
#define uvm_pagealloc(obj, off, anon, flags) \
uvm_pagealloc_strat((obj), (off), (anon), (flags), \
UVM_PGA_STRAT_NORMAL, 0)
-vaddr_t uvm_pagealloc_contig __P((vaddr_t, vaddr_t,
- vaddr_t, vaddr_t));
void uvm_pagerealloc __P((struct vm_page *,
struct uvm_object *, voff_t));
/* Actually, uvm_page_physload takes PF#s which need their own type */
diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c
index 7d5c9b1a537..cba06a965b2 100644
--- a/sys/uvm/uvm_page.c
+++ b/sys/uvm/uvm_page.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_page.c,v 1.35 2001/11/28 19:28:15 art Exp $ */
+/* $OpenBSD: uvm_page.c,v 1.36 2001/11/30 17:24:19 art Exp $ */
/* $NetBSD: uvm_page.c,v 1.65 2001/06/27 23:57:16 thorpej Exp $ */
/*
@@ -1203,49 +1203,6 @@ uvm_pagealloc_strat(obj, off, anon, flags, strat, free_list)
return (NULL);
}
-/*
- * uvm_pagealloc_contig: allocate contiguous memory.
- *
- * XXX - fix comment.
- */
-
-vaddr_t
-uvm_pagealloc_contig(size, low, high, alignment)
- vaddr_t size;
- vaddr_t low, high;
- vaddr_t alignment;
-{
- struct pglist pglist;
- struct vm_page *pg;
- vaddr_t addr, temp_addr;
-
- size = round_page(size);
-
- TAILQ_INIT(&pglist);
- if (uvm_pglistalloc(size, low, high, alignment, 0,
- &pglist, 1, FALSE))
- return 0;
- addr = vm_map_min(kernel_map);
- if (uvm_map(kernel_map, &addr, size, NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE,
- UVM_ADV_RANDOM, 0))) {
- uvm_pglistfree(&pglist);
- return 0;
- }
- temp_addr = addr;
- for (pg = TAILQ_FIRST(&pglist); pg != NULL;
- pg = TAILQ_NEXT(pg, pageq)) {
- pg->uobject = uvm.kernel_object;
- pg->offset = temp_addr - vm_map_min(kernel_map);
- uvm_pageinsert(pg);
- uvm_pagewire(pg);
- pmap_kenter_pa(temp_addr, VM_PAGE_TO_PHYS(pg),
- VM_PROT_READ|VM_PROT_WRITE);
- temp_addr += PAGE_SIZE;
- }
- return addr;
-}
-
/*
* uvm_pagerealloc: reallocate a page from one object to another
*