mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
Convert the waitok field of uvm_pglistalloc to "flags", more will be added soon.
For the possibility of sleeping, the first two flags are UVM_PLA_WAITOK and UVM_PLA_NOWAIT. It is an error not to show intention, so assert that one of the two is provided. Switch over every caller in the tree to using the appropriate flag. ok art@, ariane@
This commit is contained in:
parent
38435312a2
commit
26340d65a4
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cpu.c,v 1.22 2008/06/26 05:42:08 ray Exp $ */
|
||||
/* $OpenBSD: cpu.c,v 1.23 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: cpu.c,v 1.44 2000/05/23 05:12:53 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
@ -335,7 +335,7 @@ recognized:
|
||||
*/
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(USPACE, avail_start, avail_end, 0, 0,
|
||||
&mlist, 1, 1);
|
||||
&mlist, 1, UVM_PLA_WAITOK);
|
||||
if (error != 0) {
|
||||
if (ma->ma_slot == hwrpb->rpb_primary_cpu_id) {
|
||||
panic("cpu_attach: unable to allocate idle stack for"
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bus_dma.c,v 1.24 2009/03/07 15:34:32 miod Exp $ */
|
||||
/* $OpenBSD: bus_dma.c,v 1.25 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.40 2000/07/17 04:47:56 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
@ -483,7 +483,7 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
|
||||
paddr_t curaddr, lastaddr;
|
||||
struct vm_page *m;
|
||||
struct pglist mlist;
|
||||
int curseg, error;
|
||||
int curseg, error, plaflag;
|
||||
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
@ -491,9 +491,11 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
|
||||
/*
|
||||
* Allocate pages from the VM system.
|
||||
*/
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(size, low, high, alignment, boundary,
|
||||
&mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
&mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bus_dma.c,v 1.21 2009/04/09 03:08:36 dlg Exp $ */
|
||||
/* $OpenBSD: bus_dma.c,v 1.22 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
@ -633,18 +633,19 @@ _bus_dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
paddr_t curaddr, lastaddr;
|
||||
struct vm_page *m;
|
||||
struct pglist mlist;
|
||||
int curseg, error;
|
||||
int curseg, error, plaflag;
|
||||
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
|
||||
/*
|
||||
* Allocate pages from the VM system.
|
||||
*/
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(size, low, high, alignment, boundary,
|
||||
&mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
&mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bus_dma.c,v 1.13 2009/03/07 15:34:34 miod Exp $ */
|
||||
/* $OpenBSD: bus_dma.c,v 1.14 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.38 2003/10/30 08:44:13 scw Exp $ */
|
||||
|
||||
/*-
|
||||
@ -961,7 +961,7 @@ _bus_dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
paddr_t curaddr, lastaddr;
|
||||
struct vm_page *m;
|
||||
struct pglist mlist;
|
||||
int curseg, error;
|
||||
int curseg, error, plaflag;
|
||||
|
||||
#ifdef DEBUG_DMA
|
||||
printf("alloc_range: t=%p size=%lx align=%lx boundary=%lx segs=%p nsegs=%x rsegs=%p flags=%x lo=%lx hi=%lx\n",
|
||||
@ -971,12 +971,14 @@ _bus_dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
/*
|
||||
* Allocate pages from the VM system.
|
||||
*/
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(size, low, high, alignment, boundary,
|
||||
&mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
&mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: pmap.c,v 1.20 2009/03/23 13:25:11 art Exp $ */
|
||||
/* $OpenBSD: pmap.c,v 1.21 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */
|
||||
|
||||
/*
|
||||
@ -4140,7 +4140,7 @@ pmap_postinit(void)
|
||||
TAILQ_INIT(&plist);
|
||||
|
||||
error = uvm_pglistalloc(L1_TABLE_SIZE, physical_start,
|
||||
physical_end, L1_TABLE_SIZE, 0, &plist, 1, M_WAITOK);
|
||||
physical_end, L1_TABLE_SIZE, 0, &plist, 1, UVM_PLA_WAITOK);
|
||||
if (error)
|
||||
panic("Cannot allocate L1 physical pages");
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: if_le_syscon.c,v 1.6 2009/03/29 21:53:52 sthen Exp $ */
|
||||
/* $OpenBSD: if_le_syscon.c,v 1.7 2009/04/14 16:01:04 oga Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
@ -149,7 +149,7 @@ le_syscon_attach(parent, self, aux)
|
||||
for (;;) {
|
||||
TAILQ_INIT(&pglist);
|
||||
rc = uvm_pglistalloc(ptoa(etherpages), 0, 1 << 24,
|
||||
0, 0, &pglist, 1, 0);
|
||||
0, 0, &pglist, 1, UVM_PLA_NOWAIT);
|
||||
if (rc == 0)
|
||||
break;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: astro.c,v 1.8 2007/10/06 23:50:54 krw Exp $ */
|
||||
/* $OpenBSD: astro.c,v 1.9 2009/04/14 16:01:04 oga Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Mark Kettenis
|
||||
@ -271,7 +271,8 @@ astro_attach(struct device *parent, struct device *self, void *aux)
|
||||
|
||||
size = (1 << (iova_bits - PAGE_SHIFT)) * sizeof(u_int64_t);
|
||||
TAILQ_INIT(&mlist);
|
||||
if (uvm_pglistalloc(size, 0, -1, PAGE_SIZE, 0, &mlist, 1, 0) != 0)
|
||||
if (uvm_pglistalloc(size, 0, -1, PAGE_SIZE, 0, &mlist,
|
||||
1, UVM_PLA_NOWAIT) != 0)
|
||||
panic("astrottach: no memory");
|
||||
|
||||
va = uvm_km_valloc(kernel_map, size);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: mainbus.c,v 1.72 2009/03/08 19:26:39 martin Exp $ */
|
||||
/* $OpenBSD: mainbus.c,v 1.73 2009/04/14 16:01:04 oga Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998-2004 Michael Shalayeff
|
||||
@ -937,12 +937,15 @@ mbus_dmamem_alloc(void *v, bus_size_t size, bus_size_t alignment,
|
||||
{
|
||||
struct pglist pglist;
|
||||
struct vm_page *pg;
|
||||
int plaflag;
|
||||
|
||||
size = round_page(size);
|
||||
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&pglist);
|
||||
if (uvm_pglistalloc(size, 0, -1, alignment, boundary,
|
||||
&pglist, 1, flags & BUS_DMA_NOWAIT))
|
||||
&pglist, 1, plaflag))
|
||||
return (ENOMEM);
|
||||
|
||||
pg = TAILQ_FIRST(&pglist);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: astro.c,v 1.1 2008/04/20 17:17:32 kettenis Exp $ */
|
||||
/* $OpenBSD: astro.c,v 1.2 2009/04/14 16:01:04 oga Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Mark Kettenis
|
||||
@ -272,7 +272,8 @@ astro_attach(struct device *parent, struct device *self, void *aux)
|
||||
|
||||
size = (1 << (iova_bits - PAGE_SHIFT)) * sizeof(u_int64_t);
|
||||
TAILQ_INIT(&mlist);
|
||||
if (uvm_pglistalloc(size, 0, -1, PAGE_SIZE, 0, &mlist, 1, 0) != 0)
|
||||
if (uvm_pglistalloc(size, 0, -1, PAGE_SIZE, 0, &mlist,
|
||||
1, UVM_PLA_NOWAIT) != 0)
|
||||
panic("astrottach: no memory");
|
||||
|
||||
va = uvm_km_valloc(kernel_map, size);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: mainbus.c,v 1.8 2009/03/08 19:26:39 martin Exp $ */
|
||||
/* $OpenBSD: mainbus.c,v 1.9 2009/04/14 16:01:04 oga Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 Michael Shalayeff
|
||||
@ -492,12 +492,15 @@ mbus_dmamem_alloc(void *v, bus_size_t size, bus_size_t alignment,
|
||||
{
|
||||
struct pglist pglist;
|
||||
struct vm_page *pg;
|
||||
int plaflag;
|
||||
|
||||
size = round_page(size);
|
||||
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&pglist);
|
||||
if (uvm_pglistalloc(size, (paddr_t)0, (paddr_t)-1, alignment, boundary,
|
||||
&pglist, 1, flags & BUS_DMA_NOWAIT))
|
||||
&pglist, 1, plaflag))
|
||||
return (ENOMEM);
|
||||
|
||||
pg = TAILQ_FIRST(&pglist);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: pmap.c,v 1.6 2008/04/27 17:48:10 martin Exp $ */
|
||||
/* $OpenBSD: pmap.c,v 1.7 2009/04/14 16:01:04 oga Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 Michael Shalayeff
|
||||
@ -622,7 +622,7 @@ pmap_create()
|
||||
|
||||
TAILQ_INIT(&pmap->pm_pglist);
|
||||
if (uvm_pglistalloc(2 * PAGE_SIZE, 0, VM_MIN_KERNEL_ADDRESS,
|
||||
PAGE_SIZE, 2 * PAGE_SIZE, &pmap->pm_pglist, 1, 1))
|
||||
PAGE_SIZE, 2 * PAGE_SIZE, &pmap->pm_pglist, 1, UVM_PLA_WAITOK))
|
||||
panic("pmap_create: no pages");
|
||||
|
||||
pg = TAILQ_FIRST(&pmap->pm_pglist);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bus_dma.c,v 1.11 2009/04/09 03:08:36 dlg Exp $ */
|
||||
/* $OpenBSD: bus_dma.c,v 1.12 2009/04/14 16:01:04 oga Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@ -588,7 +588,7 @@ _bus_dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
paddr_t curaddr, lastaddr;
|
||||
struct vm_page *m;
|
||||
struct pglist mlist;
|
||||
int curseg, error;
|
||||
int curseg, error, plaflag;
|
||||
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
@ -598,11 +598,13 @@ _bus_dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
* Allocate pages from the VM system.
|
||||
* For non-ISA mappings first try higher memory segments.
|
||||
*/
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
if (high <= ISA_DMA_BOUNCE_THRESHOLD || (error = uvm_pglistalloc(size,
|
||||
round_page(ISA_DMA_BOUNCE_THRESHOLD), high, alignment, boundary,
|
||||
&mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0)))
|
||||
&mlist, nsegs, plaflag)))
|
||||
error = uvm_pglistalloc(size, low, high, alignment, boundary,
|
||||
&mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
&mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bus_dma.c,v 1.6 2009/03/15 09:35:50 miod Exp $ */
|
||||
/* $OpenBSD: bus_dma.c,v 1.7 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
|
||||
|
||||
/*
|
||||
@ -535,19 +535,21 @@ _bus_dmamem_alloc(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
struct pglist mlist;
|
||||
paddr_t curaddr, lastaddr;
|
||||
struct vm_page *m;
|
||||
int curseg, error;
|
||||
int curseg, error, plaflag;
|
||||
|
||||
DPRINTF(("bus_dmamem_alloc: t = %p, size = %ld, alignment = %ld, boundary = %ld, segs = %p, nsegs = %d, rsegs = %p, flags = %x\n", t, size, alignment, boundary, segs, nsegs, rsegs, flags));
|
||||
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
/*
|
||||
* Allocate the pages from the VM system.
|
||||
*/
|
||||
error = uvm_pglistalloc(size, 0, -1,
|
||||
alignment, boundary, &mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(size, 0, -1, alignment, boundary,
|
||||
&mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: if_mc_obio.c,v 1.7 2009/03/29 21:53:52 sthen Exp $ */
|
||||
/* $OpenBSD: if_mc_obio.c,v 1.8 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: if_mc_obio.c,v 1.13 2004/03/26 12:15:46 wiz Exp $ */
|
||||
|
||||
/*-
|
||||
@ -139,7 +139,7 @@ mc_obio_attach(parent, self, aux)
|
||||
/* allocate memory for transmit buffer and mark it non-cacheable */
|
||||
TAILQ_INIT(&txlist);
|
||||
if (uvm_pglistalloc(PAGE_SIZE, 0, -PAGE_SIZE, PAGE_SIZE, 0,
|
||||
&txlist, 1, 0) != 0) {
|
||||
&txlist, 1, UVM_PLA_NOWAIT) != 0) {
|
||||
printf(": could not allocate transmit buffer memory\n");
|
||||
goto out1;
|
||||
}
|
||||
@ -159,7 +159,7 @@ mc_obio_attach(parent, self, aux)
|
||||
*/
|
||||
TAILQ_INIT(&rxlist);
|
||||
if (uvm_pglistalloc(MC_NPAGES * PAGE_SIZE, 0, -PAGE_SIZE, PAGE_SIZE, 0,
|
||||
&rxlist, 1, 0) != 0) {
|
||||
&rxlist, 1, UVM_PLA_NOWAIT) != 0) {
|
||||
printf(": could not allocate receive buffer memory\n");
|
||||
goto out3;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: if_sn.c,v 1.52 2009/03/29 21:53:52 sthen Exp $ */
|
||||
/* $OpenBSD: if_sn.c,v 1.53 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: if_sn.c,v 1.13 1997/04/25 03:40:10 briggs Exp $ */
|
||||
|
||||
/*
|
||||
@ -114,7 +114,7 @@ snsetup(struct sn_softc *sc, u_int8_t *lladdr)
|
||||
*/
|
||||
TAILQ_INIT(&pglist);
|
||||
error = uvm_pglistalloc(SN_NPAGES * PAGE_SIZE, 0, -PAGE_SIZE,
|
||||
PAGE_SIZE, 0, &pglist, 1, 0);
|
||||
PAGE_SIZE, 0, &pglist, 1, UVM_PLA_NOWAIT);
|
||||
if (error != 0) {
|
||||
printf(": could not allocate descriptor memory\n");
|
||||
return (error);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cpu.c,v 1.60 2008/11/21 17:35:52 deraadt Exp $ */
|
||||
/* $OpenBSD: cpu.c,v 1.61 2009/04/14 16:01:04 oga Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Per Fogelstrom
|
||||
@ -583,7 +583,8 @@ cpu_spinup(struct device *self, struct cpu_info *ci)
|
||||
size += 8192; /* SPILLSTK(1k) + DDBSTK(7k) */
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(size, 0x0, 0x10000000, 0, 0, &mlist, 1, 1);
|
||||
error = uvm_pglistalloc(size, 0x0, 0x10000000, 0, 0,
|
||||
&mlist, 1, UVM_PLA_WAITOK);
|
||||
if (error) {
|
||||
printf(": unable to allocate idle stack\n");
|
||||
return -1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: dma.c,v 1.29 2009/03/07 15:34:34 miod Exp $ */
|
||||
/* $OpenBSD: dma.c,v 1.30 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
@ -552,7 +552,7 @@ _dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
vaddr_t curaddr, lastaddr;
|
||||
struct vm_page *m;
|
||||
struct pglist mlist;
|
||||
int curseg, error;
|
||||
int curseg, error, plaflag;
|
||||
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
@ -560,9 +560,11 @@ _dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
/*
|
||||
* Allocate pages from the VM system.
|
||||
*/
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(size, low, high,
|
||||
alignment, boundary, &mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
alignment, boundary, &mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bus_dma.c,v 1.2 2009/02/18 20:48:55 miod Exp $ */
|
||||
/* $OpenBSD: bus_dma.c,v 1.3 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */
|
||||
|
||||
/*-
|
||||
@ -630,7 +630,7 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
|
||||
paddr_t curaddr, lastaddr;
|
||||
struct vm_page *m;
|
||||
struct pglist mlist;
|
||||
int curseg, error;
|
||||
int curseg, error, plaflag;
|
||||
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
@ -638,9 +638,11 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
|
||||
/*
|
||||
* Allocate pages from the VM system.
|
||||
*/
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(size, low, high, alignment, boundary,
|
||||
&mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
&mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bus_dma.c,v 1.10 2009/03/07 15:34:34 miod Exp $ */
|
||||
/* $OpenBSD: bus_dma.c,v 1.11 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */
|
||||
|
||||
/*-
|
||||
@ -633,7 +633,7 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
|
||||
paddr_t curaddr, lastaddr;
|
||||
struct vm_page *m;
|
||||
struct pglist mlist;
|
||||
int curseg, error;
|
||||
int curseg, error, plaflag;
|
||||
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
@ -641,9 +641,11 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
|
||||
/*
|
||||
* Allocate pages from the VM system.
|
||||
*/
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(size, low, high, alignment, boundary,
|
||||
&mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
&mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bus_dma.c,v 1.22 2009/03/07 15:34:34 miod Exp $ */
|
||||
/* $OpenBSD: bus_dma.c,v 1.23 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */
|
||||
|
||||
/*-
|
||||
@ -602,7 +602,7 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
|
||||
paddr_t curaddr, lastaddr;
|
||||
struct vm_page *m;
|
||||
struct pglist mlist;
|
||||
int curseg, error;
|
||||
int curseg, error, plaflag;
|
||||
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
@ -610,9 +610,11 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
|
||||
/*
|
||||
* Allocate pages from the VM system.
|
||||
*/
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(size, low, high, alignment, boundary,
|
||||
&mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
&mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bus_dma.c,v 1.7 2009/03/07 15:34:34 miod Exp $ */
|
||||
/* $OpenBSD: bus_dma.c,v 1.8 2009/04/14 16:01:04 oga Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
|
||||
@ -609,7 +609,7 @@ _dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
|
||||
vaddr_t curaddr, lastaddr;
|
||||
vm_page_t m;
|
||||
struct pglist mlist;
|
||||
int curseg, error;
|
||||
int curseg, error, plaflag;
|
||||
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
@ -617,9 +617,11 @@ _dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
|
||||
/*
|
||||
* Allocate pages from the VM system.
|
||||
*/
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(size, low, high,
|
||||
alignment, boundary, &mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
error = uvm_pglistalloc(size, low, high, alignment, boundary,
|
||||
&mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: dma.c,v 1.3 2009/03/07 15:34:34 miod Exp $ */
|
||||
/* $OpenBSD: dma.c,v 1.4 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
@ -552,7 +552,7 @@ _dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
vaddr_t curaddr, lastaddr;
|
||||
struct vm_page *m;
|
||||
struct pglist mlist;
|
||||
int curseg, error;
|
||||
int curseg, error, plaflag;
|
||||
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
@ -560,9 +560,11 @@ _dmamem_alloc_range(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
|
||||
/*
|
||||
* Allocate pages from the VM system.
|
||||
*/
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(size, low, high,
|
||||
alignment, boundary, &mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
alignment, boundary, &mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: iommu.c,v 1.20 2007/05/29 09:53:59 sobrado Exp $ */
|
||||
/* $OpenBSD: iommu.c,v 1.21 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: iommu.c,v 1.13 1997/07/29 09:42:04 fair Exp $ */
|
||||
|
||||
/*
|
||||
@ -184,7 +184,7 @@ iommu_attach(parent, self, aux)
|
||||
TAILQ_INIT(&mlist);
|
||||
#define DVMA_PTESIZE ((0 - DVMA4M_BASE) / 1024)
|
||||
if (uvm_pglistalloc(DVMA_PTESIZE, 0, 0xffffffff, DVMA_PTESIZE,
|
||||
0, &mlist, 1, 0) ||
|
||||
0, &mlist, 1, UVM_PLA_NOWAIT) ||
|
||||
(va = uvm_km_valloc(kernel_map, DVMA_PTESIZE)) == 0)
|
||||
panic("iommu_attach: can't allocate memory for pagetables");
|
||||
#undef DVMA_PTESIZE
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: iommu.c,v 1.56 2009/04/05 21:57:41 oga Exp $ */
|
||||
/* $OpenBSD: iommu.c,v 1.57 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */
|
||||
|
||||
/*
|
||||
@ -166,7 +166,7 @@ iommu_init(char *name, struct iommu_state *is, int tsbsize, u_int32_t iovabase)
|
||||
size = PAGE_SIZE << is->is_tsbsize;
|
||||
TAILQ_INIT(&mlist);
|
||||
if (uvm_pglistalloc((psize_t)size, (paddr_t)0, (paddr_t)-1,
|
||||
(paddr_t)PAGE_SIZE, (paddr_t)0, &mlist, 1, 0) != 0)
|
||||
(paddr_t)PAGE_SIZE, (paddr_t)0, &mlist, 1, UVM_PLA_NOWAIT) != 0)
|
||||
panic("iommu_init: no memory");
|
||||
|
||||
va = uvm_km_valloc(kernel_map, size);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: machdep.c,v 1.116 2009/03/07 15:34:34 miod Exp $ */
|
||||
/* $OpenBSD: machdep.c,v 1.117 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */
|
||||
|
||||
/*-
|
||||
@ -1423,7 +1423,7 @@ _bus_dmamem_alloc(t, t0, size, alignment, boundary, segs, nsegs, rsegs, flags)
|
||||
int flags;
|
||||
{
|
||||
struct pglist *mlist;
|
||||
int error;
|
||||
int error, plaflag;
|
||||
|
||||
/* Always round the size. */
|
||||
size = round_page(size);
|
||||
@ -1445,9 +1445,11 @@ _bus_dmamem_alloc(t, t0, size, alignment, boundary, segs, nsegs, rsegs, flags)
|
||||
/*
|
||||
* Allocate pages from the VM system.
|
||||
*/
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(mlist);
|
||||
error = uvm_pglistalloc(size, (paddr_t)0, (paddr_t)-1,
|
||||
alignment, boundary, mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
alignment, boundary, mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bus_dma.c,v 1.21 2009/03/07 15:34:34 miod Exp $ */
|
||||
/* $OpenBSD: bus_dma.c,v 1.22 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.5 1999/11/13 00:32:20 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
@ -682,7 +682,7 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
|
||||
paddr_t curaddr, lastaddr;
|
||||
struct vm_page *m;
|
||||
struct pglist mlist;
|
||||
int curseg, error;
|
||||
int curseg, error, plaflag;
|
||||
|
||||
#ifdef DEBUG_DMA
|
||||
printf("alloc_range: t=%p size=%lx align=%lx boundary=%lx segs=%p nsegs=%x rsegs=%p flags=%x lo=%lx hi=%lx\n",
|
||||
@ -695,9 +695,11 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
|
||||
/*
|
||||
* Allocate pages from the VM system.
|
||||
*/
|
||||
plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
|
||||
|
||||
TAILQ_INIT(&mlist);
|
||||
error = uvm_pglistalloc(size, low, high, alignment, boundary,
|
||||
&mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
|
||||
&mlist, nsegs, plaflag);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: aha.c,v 1.62 2009/02/16 21:19:07 miod Exp $ */
|
||||
/* $OpenBSD: aha.c,v 1.63 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: aha.c,v 1.11 1996/05/12 23:51:23 mycroft Exp $ */
|
||||
|
||||
#undef AHADIAG
|
||||
@ -1122,10 +1122,10 @@ aha_init(sc)
|
||||
*/
|
||||
size = round_page(sizeof(struct aha_mbx));
|
||||
TAILQ_INIT(&pglist);
|
||||
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)))
|
||||
if (uvm_pglistalloc(size, 0, 0xffffff, PAGE_SIZE, 0, &pglist, 1,
|
||||
UVM_PLA_NOWAIT) || 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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: uvm_extern.h,v 1.74 2009/03/05 19:52:24 kettenis Exp $ */
|
||||
/* $OpenBSD: uvm_extern.h,v 1.75 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
|
||||
|
||||
/*
|
||||
@ -220,6 +220,12 @@ typedef int vm_prot_t;
|
||||
#define UVM_PGA_USERESERVE 0x0001 /* ok to use reserve pages */
|
||||
#define UVM_PGA_ZERO 0x0002 /* returned page must be zeroed */
|
||||
|
||||
/*
|
||||
* flags for uvm_pglistalloc()
|
||||
*/
|
||||
#define UVM_PLA_WAITOK 0x0001 /* may sleep */
|
||||
#define UVM_PLA_NOWAIT 0x0002 /* can't sleep (need one of the two) */
|
||||
|
||||
/*
|
||||
* lockflags that control the locking behavior of various functions.
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: uvm_pglist.c,v 1.25 2009/03/20 15:19:04 oga Exp $ */
|
||||
/* $OpenBSD: uvm_pglist.c,v 1.26 2009/04/14 16:01:04 oga Exp $ */
|
||||
/* $NetBSD: uvm_pglist.c,v 1.13 2001/02/18 21:19:08 chs Exp $ */
|
||||
|
||||
/*-
|
||||
@ -184,7 +184,7 @@ out:
|
||||
|
||||
int
|
||||
uvm_pglistalloc(psize_t size, paddr_t low, paddr_t high, paddr_t alignment,
|
||||
paddr_t boundary, struct pglist *rlist, int nsegs, int waitok)
|
||||
paddr_t boundary, struct pglist *rlist, int nsegs, int flags)
|
||||
{
|
||||
int psi;
|
||||
struct vm_page *pgs;
|
||||
@ -201,6 +201,11 @@ uvm_pglistalloc(psize_t size, paddr_t low, paddr_t high, paddr_t alignment,
|
||||
|
||||
KASSERT((alignment & (alignment - 1)) == 0);
|
||||
KASSERT((boundary & (boundary - 1)) == 0);
|
||||
/*
|
||||
* This argument is always ignored for now, but ensure drivers always
|
||||
* show intention.
|
||||
*/
|
||||
KASSERT(!(flags & UVM_PLA_WAITOK) ^ !(flags & UVM_PLA_NOWAIT));
|
||||
|
||||
/*
|
||||
* Our allocations are always page granularity, so our alignment
|
||||
|
Loading…
Reference in New Issue
Block a user