Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump implement bus_dmamem_free()
details: https://anonhg.NetBSD.org/src/rev/97def6153313
branches: trunk
changeset: 338670:97def6153313
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Jun 03 13:55:42 2015 +0000
description:
implement bus_dmamem_free()
from Robert Millan <rmh%freebsd.org@localhost> via rumpkernel-users
diffstat:
sys/rump/dev/lib/libpci/pci_user.h | 3 +++
sys/rump/dev/lib/libpci/rumpdev_bus_dma.c | 13 ++++++++++++-
sys/rump/include/sys/bus.h | 3 ++-
3 files changed, 17 insertions(+), 2 deletions(-)
diffs (85 lines):
diff -r fae7fa8d8ab2 -r 97def6153313 sys/rump/dev/lib/libpci/pci_user.h
--- a/sys/rump/dev/lib/libpci/pci_user.h Wed Jun 03 13:43:23 2015 +0000
+++ b/sys/rump/dev/lib/libpci/pci_user.h Wed Jun 03 13:55:42 2015 +0000
@@ -9,6 +9,9 @@
/* XXX: needs work: support boundary-restricted allocations */
int rumpcomp_pci_dmalloc(size_t, size_t, unsigned long *, unsigned long *);
+#ifdef rumpcomp_pci_free
+void rumpcomp_pci_free(unsigned long, size_t);
+#endif
struct rumpcomp_pci_dmaseg {
unsigned long ds_pa;
diff -r fae7fa8d8ab2 -r 97def6153313 sys/rump/dev/lib/libpci/rumpdev_bus_dma.c
--- a/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c Wed Jun 03 13:43:23 2015 +0000
+++ b/sys/rump/dev/lib/libpci/rumpdev_bus_dma.c Wed Jun 03 13:55:42 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpdev_bus_dma.c,v 1.3 2014/04/14 21:43:00 pooka Exp $ */
+/* $NetBSD: rumpdev_bus_dma.c,v 1.4 2015/06/03 13:55:42 pooka Exp $ */
/*-
* Copyright (c) 2013 Antti Kantee
@@ -446,8 +446,14 @@
void
bus_dmamem_free(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs)
{
+#ifdef rumpcomp_pci_free
+ vaddr_t vacookie = segs[0]._ds_vacookie;
+ bus_size_t sizecookie = segs[0]._ds_sizecookie;
+ rumpcomp_pci_free(vacookie, sizecookie);
+#else
panic("bus_dmamem_free not implemented");
+#endif
}
/*
@@ -509,11 +515,14 @@
{
paddr_t curaddr, lastaddr, pa;
vaddr_t vacookie;
+ size_t sizecookie;
int curseg, error;
/* Always round the size. */
size = round_page(size);
+ sizecookie = size;
+
/*
* Allocate pages from the VM system.
*/
@@ -536,6 +545,7 @@
lastaddr = segs[curseg].ds_addr = pa;
segs[curseg].ds_len = PAGE_SIZE;
segs[curseg]._ds_vacookie = vacookie;
+ segs[curseg]._ds_sizecookie = sizecookie;
size -= PAGE_SIZE;
pa += PAGE_SIZE;
vacookie += PAGE_SIZE;
@@ -553,6 +563,7 @@
segs[curseg].ds_addr = curaddr;
segs[curseg].ds_len = PAGE_SIZE;
segs[curseg]._ds_vacookie = vacookie;
+ segs[curseg]._ds_sizecookie = sizecookie;
}
lastaddr = curaddr;
}
diff -r fae7fa8d8ab2 -r 97def6153313 sys/rump/include/sys/bus.h
--- a/sys/rump/include/sys/bus.h Wed Jun 03 13:43:23 2015 +0000
+++ b/sys/rump/include/sys/bus.h Wed Jun 03 13:55:42 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus.h,v 1.5 2014/04/14 21:31:00 pooka Exp $ */
+/* $NetBSD: bus.h,v 1.6 2015/06/03 13:55:42 pooka Exp $ */
/*
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@@ -48,6 +48,7 @@
bus_addr_t ds_addr;
bus_size_t ds_len;
vaddr_t _ds_vacookie;
+ bus_size_t _ds_sizecookie;
} bus_dma_segment_t;
typedef struct {
Home |
Main Index |
Thread Index |
Old Index