diff options
author | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2021-01-03 02:29:29 +0000 |
---|---|---|
committer | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2021-01-03 02:29:29 +0000 |
commit | d18111c3e880b1d823831f69af4bdad636601111 (patch) | |
tree | fc086aadefa1f0b51055995fcc3fbd53b70ae424 /sys/arch | |
parent | 101c7092917767d1cd4cfead3c71b8c845d2342b (diff) |
Allocate address space for reposting vga devices using km_alloc(9) rather
than uvm_km_valloc(9).
ok kettenis@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/pci/vga_post.c | 16 | ||||
-rw-r--r-- | sys/arch/i386/pci/vga_post.c | 16 |
2 files changed, 18 insertions, 14 deletions
diff --git a/sys/arch/amd64/pci/vga_post.c b/sys/arch/amd64/pci/vga_post.c index 32876649ddd..4eb98323cd1 100644 --- a/sys/arch/amd64/pci/vga_post.c +++ b/sys/arch/amd64/pci/vga_post.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vga_post.c,v 1.10 2015/08/28 00:03:53 deraadt Exp $ */ +/* $OpenBSD: vga_post.c,v 1.11 2021/01/03 02:29:28 jmatthew Exp $ */ /* $NetBSD: vga_post.c,v 1.12 2009/03/15 21:32:36 cegger Exp $ */ /*- @@ -125,13 +125,15 @@ vga_post_init(int bus, int device, int function) vaddr_t sys_image, sys_bios_data; int err; - sys_bios_data = uvm_km_valloc(kernel_map, PAGE_SIZE); + sys_bios_data = (vaddr_t)km_alloc(PAGE_SIZE, &kv_any, &kp_none, + &kd_nowait); if (sys_bios_data == 0) return NULL; - sys_image = uvm_km_valloc(kernel_map, 1024 * 1024); + sys_image = (vaddr_t)km_alloc(1024 * 1024, &kv_any, &kp_none, + &kd_nowait); if (sys_image == 0) { - uvm_km_free(kernel_map, sys_bios_data, PAGE_SIZE); + km_free((void *)sys_bios_data, PAGE_SIZE, &kv_any, &kp_none); return NULL; } sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); @@ -140,7 +142,7 @@ vga_post_init(int bus, int device, int function) err = uvm_pglistalloc(BASE_MEMORY, 0, (paddr_t)-1, 0, 0, &sc->ram_backing, BASE_MEMORY/PAGE_SIZE, UVM_PLA_WAITOK); if (err) { - uvm_km_free(kernel_map, sc->sys_image, 1024 * 1024); + km_free((void *)sc->sys_image, 1024 * 1024, &kv_any, &kp_none); free(sc, M_DEVBUF, sizeof(*sc)); return NULL; } @@ -152,7 +154,7 @@ vga_post_init(int bus, int device, int function) pmap_update(pmap_kernel()); memcpy((void *)sc->bios_data, (void *)sys_bios_data, PAGE_SIZE); pmap_kremove(sys_bios_data, PAGE_SIZE); - uvm_km_free(kernel_map, sys_bios_data, PAGE_SIZE); + km_free((void *)sys_bios_data, PAGE_SIZE, &kv_any, &kp_none); iter = 0; TAILQ_FOREACH(pg, &sc->ram_backing, pageq) { @@ -209,7 +211,7 @@ vga_post_free(struct vga_post *sc) { uvm_pglistfree(&sc->ram_backing); pmap_kremove(sc->sys_image, 1024 * 1024); - uvm_km_free(kernel_map, sc->sys_image, 1024 * 1024); + km_free((void *)sc->sys_image, 1024 * 1024, &kv_any, &kp_none) pmap_update(pmap_kernel()); free(sc, M_DEVBUF, sizeof(*sc)); } diff --git a/sys/arch/i386/pci/vga_post.c b/sys/arch/i386/pci/vga_post.c index c85ee05dcdb..d9b38a43d7d 100644 --- a/sys/arch/i386/pci/vga_post.c +++ b/sys/arch/i386/pci/vga_post.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vga_post.c,v 1.9 2015/09/01 06:01:24 deraadt Exp $ */ +/* $OpenBSD: vga_post.c,v 1.10 2021/01/03 02:29:28 jmatthew Exp $ */ /* $NetBSD: vga_post.c,v 1.12 2009/03/15 21:32:36 cegger Exp $ */ /*- @@ -126,13 +126,15 @@ vga_post_init(int bus, int device, int function) vaddr_t sys_image, sys_bios_data; int err; - sys_bios_data = uvm_km_valloc(kernel_map, PAGE_SIZE); + sys_bios_data = (vaddr_t)km_alloc(PAGE_SIZE, &kv_any, &kp_none, + &kd_nowait); if (sys_bios_data == 0) return NULL; - sys_image = uvm_km_valloc(kernel_map, 1024 * 1024); + sys_image = (vaddr_t)km_alloc(1024 * 1024, &kv_any, &kp_none, + &kd_nowait); if (sys_image == 0) { - uvm_km_free(kernel_map, sys_bios_data, PAGE_SIZE); + km_free((void *)sys_bios_data, PAGE_SIZE, &kv_any, &kp_none); return NULL; } sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); @@ -141,7 +143,7 @@ vga_post_init(int bus, int device, int function) err = uvm_pglistalloc(BASE_MEMORY, 0, (paddr_t)-1, 0, 0, &sc->ram_backing, BASE_MEMORY/PAGE_SIZE, UVM_PLA_WAITOK); if (err) { - uvm_km_free(kernel_map, sc->sys_image, 1024 * 1024); + km_free((void *)sc->sys_image, 1024 * 1024, &kv_any, &kp_none); free(sc, M_DEVBUF, sizeof *sc); return NULL; } @@ -153,7 +155,7 @@ vga_post_init(int bus, int device, int function) pmap_update(pmap_kernel()); memcpy((void *)sc->bios_data, (void *)sys_bios_data, PAGE_SIZE); pmap_kremove(sys_bios_data, PAGE_SIZE); - uvm_km_free(kernel_map, sys_bios_data, PAGE_SIZE); + km_free((void *)sys_bios_data, PAGE_SIZE, &kv_any, &kp_none); iter = 0; TAILQ_FOREACH(pg, &sc->ram_backing, pageq) { @@ -211,7 +213,7 @@ vga_post_free(struct vga_post *sc) uvm_pglistfree(&sc->ram_backing); pmap_kremove(sc->sys_image, 1024 * 1024); - uvm_km_free(kernel_map, sc->sys_image, 1024 * 1024); + km_free((void *)sc->sys_image, 1024 * 1024, &kv_any, &kp_none); pmap_update(pmap_kernel()); free(sc, M_DEVBUF, sizeof *sc); } |