diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2018-01-07 05:30:04 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2018-01-07 05:30:04 +0000 |
commit | fa9280a4b986343dc321ba1ca89d86d5b07390f0 (patch) | |
tree | 54e8feebbc28e7c732c33fca962ffec7d1d4978d /sys | |
parent | 3bd2d67a8db5b095708dbc1de44ca0c977d5d41e (diff) |
Assume that direct-mapped addresses come from the xkphys segment.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/octeon/dev/if_cnmac.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/sys/arch/octeon/dev/if_cnmac.c b/sys/arch/octeon/dev/if_cnmac.c index a7f358b95fd..a80d98f8fcc 100644 --- a/sys/arch/octeon/dev/if_cnmac.c +++ b/sys/arch/octeon/dev/if_cnmac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cnmac.c,v 1.74 2018/01/07 05:19:41 visa Exp $ */ +/* $OpenBSD: if_cnmac.c,v 1.75 2018/01/07 05:30:03 visa Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -724,19 +724,12 @@ cnmac_send_makecmd_w1(int size, paddr_t addr) } #define KVTOPHYS(addr) cnmac_kvtophys((vaddr_t)(addr)) -paddr_t cnmac_kvtophys(vaddr_t); -paddr_t +static inline paddr_t cnmac_kvtophys(vaddr_t kva) { - if (IS_XKPHYS(kva)) - return XKPHYS_TO_PHYS(kva); - else if (kva >= CKSEG0_BASE && kva < CKSEG0_BASE + CKSEG_SIZE) - return CKSEG0_TO_PHYS(kva); - else if (kva >= CKSEG1_BASE && kva < CKSEG1_BASE + CKSEG_SIZE) - return CKSEG1_TO_PHYS(kva); - - panic("%s: non-direct mapped address %p", __func__, (void *)kva); + KASSERT(IS_XKPHYS(kva)); + return XKPHYS_TO_PHYS(kva); } int |