Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 x86/bus_dma.c: Sprinkle KASSERTMSG.
details: https://anonhg.NetBSD.org/src/rev/ba9010efec61
branches: trunk
changeset: 374047:ba9010efec61
user: riastradh <riastradh%NetBSD.org@localhost>
date: Tue Mar 28 19:55:42 2023 +0000
description:
x86/bus_dma.c: Sprinkle KASSERTMSG.
diffstat:
sys/arch/x86/x86/bus_dma.c | 42 +++++++++++++++++++++++++++++-------------
1 files changed, 29 insertions(+), 13 deletions(-)
diffs (106 lines):
diff -r 8a42584f546c -r ba9010efec61 sys/arch/x86/x86/bus_dma.c
--- a/sys/arch/x86/x86/bus_dma.c Tue Mar 28 15:52:50 2023 +0000
+++ b/sys/arch/x86/x86/bus_dma.c Tue Mar 28 19:55:42 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.89 2022/08/20 23:48:51 riastradh Exp $ */
+/* $NetBSD: bus_dma.c,v 1.90 2023/03/28 19:55:42 riastradh Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2007, 2020 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.89 2022/08/20 23:48:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.90 2023/03/28 19:55:42 riastradh Exp $");
/*
* The following is included because _bus_dma_uiomove is derived from
@@ -207,7 +207,8 @@ static int
/* Always round the size. */
size = round_page(size);
- KASSERT(boundary >= PAGE_SIZE || boundary == 0);
+ KASSERTMSG(boundary >= PAGE_SIZE || boundary == 0,
+ "boundary=0x%"PRIxBUSSIZE, boundary);
/*
* Allocate pages from the VM system.
@@ -389,7 +390,9 @@ static int
*/
map->dm_mapsize = 0;
map->dm_nsegs = 0;
- KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+ KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+ "maxsegsz=0x%"PRIxBUSSIZE", maxmaxsegsz=0x%"PRIxBUSSIZE,
+ map->dm_maxsegsz, map->_dm_maxmaxsegsz);
if (buflen > map->_dm_size)
return EINVAL;
@@ -517,9 +520,12 @@ static int
*/
map->dm_mapsize = 0;
map->dm_nsegs = 0;
- KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+ KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+ "maxsegsz=0x%"PRIxBUSSIZE", maxmaxsegsz=0x%"PRIxBUSSIZE,
+ map->dm_maxsegsz, map->_dm_maxmaxsegsz);
- KASSERT(m0->m_flags & M_PKTHDR);
+ KASSERTMSG(m0->m_flags & M_PKTHDR, "m0=%p m_flags=0x%x", m0,
+ m0->m_flags);
if (m0->m_pkthdr.len > map->_dm_size)
return (EINVAL);
@@ -545,9 +551,15 @@ static int
break;
case M_EXT|M_EXT_PAGES:
- KASSERT(m->m_ext.ext_buf <= m->m_data);
- KASSERT(m->m_data <=
- m->m_ext.ext_buf + m->m_ext.ext_size);
+ KASSERTMSG(m->m_ext.ext_buf <= m->m_data,
+ "m=%p m_ext.ext_buf=%p m_ext.ext_size=%zu"
+ " m_data=%p",
+ m, m->m_ext.ext_buf, m->m_ext.ext_size, m->m_data);
+ KASSERTMSG((m->m_data <=
+ m->m_ext.ext_buf + m->m_ext.ext_size),
+ "m=%p m_ext.ext_buf=%p m_ext.ext_size=%zu"
+ " m_data=%p",
+ m, m->m_ext.ext_buf, m->m_ext.ext_size, m->m_data);
offset = (vaddr_t)m->m_data -
trunc_page((vaddr_t)m->m_ext.ext_buf);
@@ -655,7 +667,9 @@ static int
*/
map->dm_mapsize = 0;
map->dm_nsegs = 0;
- KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+ KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+ "maxsegsz=0x%"PRIxBUSSIZE", maxmaxsegsz=0x%"PRIxBUSSIZE,
+ map->dm_maxsegsz, map->_dm_maxmaxsegsz);
resid = uio->uio_resid;
iov = uio->uio_iov;
@@ -732,7 +746,9 @@ static int
*/
map->dm_mapsize = 0;
map->dm_nsegs = 0;
- KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+ KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
+ "maxsegsz=0x%"PRIxBUSSIZE", maxmaxsegsz=0x%"PRIxBUSSIZE,
+ map->dm_maxsegsz, map->_dm_maxmaxsegsz);
if (size0 > map->_dm_size)
return EINVAL;
@@ -811,8 +827,8 @@ static void
"bad offset 0x%"PRIxBUSADDR" >= 0x%"PRIxBUSSIZE,
offset, map->dm_mapsize);
KASSERTMSG(len <= map->dm_mapsize - offset,
- "bad length 0x%"PRIxBUSADDR" + %"PRIxBUSSIZE
- " > %"PRIxBUSSIZE,
+ "bad length 0x%"PRIxBUSADDR" + 0x%"PRIxBUSSIZE
+ " > 0x%"PRIxBUSSIZE,
offset, len, map->dm_mapsize);
}
Home |
Main Index |
Thread Index |
Old Index