From 706011a1662a3b548dddb13bbcc11ce6eab4d0ab Mon Sep 17 00:00:00 2001 From: miod Date: Mon, 11 Aug 2014 18:56:49 +0000 Subject: [PATCH] Do not use CKSEG0 to quickly map physical addresses, but XKPHYS, for we are not limited to 512MB physmem. --- sys/arch/octeon/dev/cn30xxpow.c | 10 +++++----- sys/arch/octeon/dev/if_cnmac.c | 22 +++++++++++----------- sys/arch/octeon/octeon/machdep.c | 15 +++++++-------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/sys/arch/octeon/dev/cn30xxpow.c b/sys/arch/octeon/dev/cn30xxpow.c index bfcf08e84ff..a6f040a3360 100644 --- a/sys/arch/octeon/dev/cn30xxpow.c +++ b/sys/arch/octeon/dev/cn30xxpow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxpow.c,v 1.6 2014/08/11 18:29:56 miod Exp $ */ +/* $OpenBSD: cn30xxpow.c,v 1.7 2014/08/11 18:56:49 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -140,8 +140,8 @@ cn30xxpow_work_response_async(uint64_t scraddr) return (result & POW_IOBDMA_GET_WORK_RESULT_NO_WORK) ? NULL : - (uint64_t *)PHYS_TO_CKSEG0( - result & POW_IOBDMA_GET_WORK_RESULT_ADDR); + (uint64_t *)PHYS_TO_XKPHYS( + result & POW_IOBDMA_GET_WORK_RESULT_ADDR, CCA_CACHED); } /* ---- status by coreid */ @@ -863,10 +863,10 @@ cn30xxpow_test_dump_wqe(paddr_t ptr) printf("wqe\n"); - word0 = *(uint64_t *)PHYS_TO_CKSEG0(ptr); + word0 = *(uint64_t *)PHYS_TO_XKPHYS(ptr, CCA_CACHED); printf("\t%-24s: %16llx\n", "word0", word0); - word1 = *(uint64_t *)PHYS_TO_CKSEG0(ptr + 8); + word1 = *(uint64_t *)PHYS_TO_XKPHYS(ptr + 8, CCA_CACHED); printf("\t%-24s: %16llx\n", "word1", word1); } #endif diff --git a/sys/arch/octeon/dev/if_cnmac.c b/sys/arch/octeon/dev/if_cnmac.c index fb8b8a6722f..103db39e2dc 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.17 2014/08/11 18:29:56 miod Exp $ */ +/* $OpenBSD: if_cnmac.c,v 1.18 2014/08/11 18:56:49 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -599,7 +599,7 @@ octeon_eth_send_queue_flush(struct octeon_eth_softc *sc) octeon_eth_send_queue_del(sc, &m, &gbuf); - cn30xxfpa_buf_put_paddr(octeon_eth_fb_sg, CKSEG0_TO_PHYS(gbuf)); + cn30xxfpa_buf_put_paddr(octeon_eth_fb_sg, XKPHYS_TO_PHYS(gbuf)); m_freem(m); } @@ -707,13 +707,13 @@ octeon_eth_buf_free_work(struct octeon_eth_softc *sc, uint64_t *work, paddr_t addr; paddr_t start_buffer; - addr = CKSEG0_TO_PHYS(work[3] & PIP_WQE_WORD3_ADDR); + addr = XKPHYS_TO_PHYS(work[3] & PIP_WQE_WORD3_ADDR); start_buffer = addr & ~(2048 - 1); cn30xxfpa_buf_put_paddr(octeon_eth_fb_pkt, start_buffer); } - cn30xxfpa_buf_put_paddr(octeon_eth_fb_wqe, CKSEG0_TO_PHYS(work)); + cn30xxfpa_buf_put_paddr(octeon_eth_fb_wqe, XKPHYS_TO_PHYS(work)); return 0; } @@ -724,7 +724,7 @@ octeon_eth_buf_ext_free_m(caddr_t buf, u_int size, void *arg) uint64_t *work = (void *)arg; int s = splnet(); - cn30xxfpa_buf_put_paddr(octeon_eth_fb_wqe, CKSEG0_TO_PHYS(work)); + cn30xxfpa_buf_put_paddr(octeon_eth_fb_wqe, XKPHYS_TO_PHYS(work)); splx(s); } @@ -736,8 +736,8 @@ octeon_eth_buf_ext_free_ext(caddr_t buf, u_int size, uint64_t *work = (void *)arg; int s = splnet(); - cn30xxfpa_buf_put_paddr(octeon_eth_fb_wqe, CKSEG0_TO_PHYS(work)); - cn30xxfpa_buf_put_paddr(octeon_eth_fb_pkt, CKSEG0_TO_PHYS(buf)); + cn30xxfpa_buf_put_paddr(octeon_eth_fb_wqe, XKPHYS_TO_PHYS(work)); + cn30xxfpa_buf_put_paddr(octeon_eth_fb_pkt, XKPHYS_TO_PHYS(buf)); splx(s); } @@ -939,7 +939,7 @@ octeon_eth_send_makecmd(struct octeon_eth_softc *sc, struct mbuf *m, (segs == 1) ? m->m_pkthdr.len : segs, (segs == 1) ? KVTOPHYS(m->m_data) : - CKSEG0_TO_PHYS(gbuf)); + XKPHYS_TO_PHYS(gbuf)); *rpko_cmd_w0 = pko_cmd_w0; *rpko_cmd_w1 = pko_cmd_w1; @@ -955,7 +955,7 @@ octeon_eth_send_cmd(struct octeon_eth_softc *sc, uint64_t pko_cmd_w0, uint64_t *cmdptr; int result = 0; - cmdptr = (uint64_t *)PHYS_TO_CKSEG0(sc->sc_cmdptr.cmdptr); + cmdptr = (uint64_t *)PHYS_TO_XKPHYS(sc->sc_cmdptr.cmdptr, CCA_CACHED); cmdptr += sc->sc_cmdptr.cmdptr_idx; OCTEON_ETH_KASSERT(cmdptr != NULL); @@ -1028,8 +1028,8 @@ octeon_eth_send(struct octeon_eth_softc *sc, struct mbuf *m) result = 1; goto done; } - gbuf = (uint64_t *)(uintptr_t)PHYS_TO_CKSEG0(gaddr); + gbuf = (uint64_t *)(uintptr_t)PHYS_TO_XKPHYS(gaddr, CCA_CACHED); error = octeon_eth_send_buf(sc, m, gbuf); if (error != 0) { @@ -1299,7 +1299,7 @@ octeon_eth_recv_mbuf(struct octeon_eth_softc *sc, uint64_t *work, vaddr_t addr; vaddr_t start_buffer; - addr = PHYS_TO_CKSEG0(word3 & PIP_WQE_WORD3_ADDR); + addr = PHYS_TO_XKPHYS(word3 & PIP_WQE_WORD3_ADDR, CCA_CACHED); start_buffer = addr & ~(2048 - 1); ext_free = octeon_eth_buf_ext_free_ext; diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c index 311f6ed59c8..f9e689b0ab9 100644 --- a/sys/arch/octeon/octeon/machdep.c +++ b/sys/arch/octeon/octeon/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.60 2014/07/21 17:25:47 uebayasi Exp $ */ +/* $OpenBSD: machdep.c,v 1.61 2014/08/11 18:56:49 miod Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -258,8 +258,8 @@ mips_init(__register_t a0, __register_t a1, __register_t a2 __unused, extern void xtlb_miss; boot_desc = (struct boot_desc *)a3; - boot_info = - (struct boot_info *)PHYS_TO_CKSEG0(boot_desc->boot_info_addr); + boot_info = (struct boot_info *) + PHYS_TO_XKPHYS(boot_desc->boot_info_addr, CCA_CACHED); #ifdef MULTIPROCESSOR /* @@ -613,15 +613,14 @@ process_bootargs(void) * explicitly pass the rootdevice. */ for (i = 1; i < octeon_boot_desc->argc; i++ ) { - const char *arg = - (const char*)PHYS_TO_CKSEG0(octeon_boot_desc->argv[i]); + const char *arg = (const char*) + PHYS_TO_XKPHYS(octeon_boot_desc->argv[i], CCA_CACHED); - if (arg == NULL) + if (octeon_boot_desc->argv[i] == 0) continue; #ifdef DEBUG - printf("boot_desc->argv[%d] = %s\n", - i, (const char *)PHYS_TO_CKSEG0(octeon_boot_desc->argv[i])); + printf("boot_desc->argv[%d] = %s\n", i, arg); #endif /* -- 2.20.1