diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-03-19 20:21:02 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-03-19 20:21:02 +0000 |
commit | af0fc501d44ecd4e68e853fab209a892df084ccc (patch) | |
tree | b525990b72048447d8eeaeb52a090508fc230fa0 /sys/arch | |
parent | 96d8b4851a9e891ba3f6656dd7fca32032e9b629 (diff) |
Add prom_itlb_load() and prom_dtlb_load().
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc64/include/sparc64.h | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/ofw_machdep.c | 70 |
2 files changed, 72 insertions, 2 deletions
diff --git a/sys/arch/sparc64/include/sparc64.h b/sys/arch/sparc64/include/sparc64.h index 701110e9677..021de61cfee 100644 --- a/sys/arch/sparc64/include/sparc64.h +++ b/sys/arch/sparc64/include/sparc64.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sparc64.h,v 1.8 2008/03/08 15:42:26 kettenis Exp $ */ +/* $OpenBSD: sparc64.h,v 1.9 2008/03/19 20:21:01 kettenis Exp $ */ /* $NetBSD: sparc64.h,v 1.3 2000/10/20 05:47:03 mrg Exp $ */ /* @@ -50,6 +50,8 @@ paddr_t prom_alloc_phys(int len, int align); paddr_t prom_claim_phys(paddr_t phys, int len); int prom_free_phys(paddr_t paddr, int len); paddr_t prom_get_msgbuf(int len, int align); +int prom_itlb_load(int index, u_int64_t data, vaddr_t vaddr); +int prom_dtlb_load(int index, u_int64_t data, vaddr_t vaddr); void prom_start_cpu(int cpu, void *func, long arg); void prom_start_cpu_by_cpuid(int cpu, void *func, long arg); diff --git a/sys/arch/sparc64/sparc64/ofw_machdep.c b/sys/arch/sparc64/sparc64/ofw_machdep.c index 4e3f0e1b62d..60482f2fdb9 100644 --- a/sys/arch/sparc64/sparc64/ofw_machdep.c +++ b/sys/arch/sparc64/sparc64/ofw_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofw_machdep.c,v 1.24 2008/03/08 15:42:26 kettenis Exp $ */ +/* $OpenBSD: ofw_machdep.c,v 1.25 2008/03/19 20:21:01 kettenis Exp $ */ /* $NetBSD: ofw_machdep.c,v 1.16 2001/07/20 00:07:14 eeh Exp $ */ /* @@ -563,6 +563,74 @@ prom_get_msgbuf(len, align) return addr; /* Kluge till we go 64-bit */ } +int +prom_itlb_load(int index, u_int64_t data, vaddr_t vaddr) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t method; + cell_t ihandle; + cell_t vaddr; + cell_t data; + cell_t index; + cell_t status; + } args; + + if (mmuh == -1 && ((mmuh = get_mmu_handle()) == -1)) { + prom_printf("prom_itlb_load: cannot get mmuh\r\n"); + return 0; + } + args.name = ADR2CELL("call-method"); + args.nargs = 5; + args.nreturns = 1; + args.method = ADR2CELL("SUNW,itlb-load"); + args.ihandle = HDL2CELL(mmuh); + args.vaddr = ADR2CELL(vaddr); + args.data = data; + args.index = index; + if(openfirmware(&args) == -1) + return -1; + if (args.status) + return -1; + return 0; +} + +int +prom_dtlb_load(int index, u_int64_t data, vaddr_t vaddr) +{ + static struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t method; + cell_t ihandle; + cell_t vaddr; + cell_t data; + cell_t index; + cell_t status; + } args; + + if (mmuh == -1 && ((mmuh = get_mmu_handle()) == -1)) { + prom_printf("prom_itlb_load: cannot get mmuh\r\n"); + return 0; + } + args.name = ADR2CELL("call-method"); + args.nargs = 5; + args.nreturns = 1; + args.method = ADR2CELL("SUNW,dtlb-load"); + args.ihandle = HDL2CELL(mmuh); + args.vaddr = ADR2CELL(vaddr); + args.data = data; + args.index = index; + if(openfirmware(&args) == -1) + return -1; + if (args.status) + return -1; + return 0; +} + #ifdef MULTIPROCESSOR /* * Start secondary cpu, arrange 'func' as the entry. |