From 32ee1e59d6a2ada0dcd168cc0c8b08cb473a74c0 Mon Sep 17 00:00:00 2001 From: skrll Date: Tue, 3 Apr 2012 12:07:26 +0000 Subject: [PATCH] Kill cpu_gethpa by using the HPA stored in the cpu_info structure. --- sys/arch/hp700/dev/apic.c | 5 +++-- sys/arch/hp700/dev/dino.c | 7 ++++--- sys/arch/hp700/dev/lasi.c | 7 ++++--- sys/arch/hp700/dev/siop_sgc.c | 7 ++++--- sys/arch/hp700/dev/wax.c | 7 ++++--- sys/arch/hp700/hp700/mainbus.c | 21 ++------------------- sys/arch/hppa/include/cpufunc.h | 3 +-- 7 files changed, 22 insertions(+), 35 deletions(-) diff --git a/sys/arch/hp700/dev/apic.c b/sys/arch/hp700/dev/apic.c index 1b1043bbc22b..4dec227b13ef 100644 --- a/sys/arch/hp700/dev/apic.c +++ b/sys/arch/hp700/dev/apic.c @@ -1,4 +1,4 @@ -/* $NetBSD: apic.c,v 1.12 2011/04/04 20:37:50 dyoung Exp $ */ +/* $NetBSD: apic.c,v 1.13 2012/04/03 12:07:26 skrll Exp $ */ /* $OpenBSD: apic.c,v 1.7 2007/10/06 23:50:54 krw Exp $ */ @@ -161,7 +161,8 @@ apic_intr_establish(void *v, pci_intr_handle_t ih, { struct elroy_softc *sc = v; volatile struct elroy_regs *r = sc->sc_regs; - hppa_hpa_t hpa = cpu_gethpa(0); + struct cpu_info *ci = &cpus[0]; + hppa_hpa_t hpa = ci->ci_hpa; struct evcnt *cnt; struct apic_iv *aiv, *biv; void *iv; diff --git a/sys/arch/hp700/dev/dino.c b/sys/arch/hp700/dev/dino.c index 1512134185d5..37a6e54839da 100644 --- a/sys/arch/hp700/dev/dino.c +++ b/sys/arch/hp700/dev/dino.c @@ -1,4 +1,4 @@ -/* $NetBSD: dino.c,v 1.33 2012/01/27 18:52:55 para Exp $ */ +/* $NetBSD: dino.c,v 1.34 2012/04/03 12:07:26 skrll Exp $ */ /* $OpenBSD: dino.c,v 1.5 2004/02/13 20:39:31 mickey Exp $ */ @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.33 2012/01/27 18:52:55 para Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.34 2012/04/03 12:07:26 skrll Exp $"); /* #include "cardbus.h" */ @@ -1608,6 +1608,7 @@ dinoattach(device_t parent, device_t self, void *aux) struct confargs *ca = (struct confargs *)aux, nca; struct pcibus_attach_args pba; volatile struct dino_regs *r; + struct cpu_info *ci = &cpus[0]; const char *p = NULL; u_int data; int s, ver; @@ -1655,7 +1656,7 @@ dinoattach(device_t parent, device_t self, void *aux) r->imr = ~0; data = r->irr0; r->imr = 0; - r->iar0 = cpu_gethpa(0) | (31 - ca->ca_irq); + r->iar0 = ci->ci_hpa | (31 - ca->ca_irq); splx(s); /* Establish the interrupt register. */ hp700_interrupt_register_establish(&sc->sc_ir); diff --git a/sys/arch/hp700/dev/lasi.c b/sys/arch/hp700/dev/lasi.c index 2840c5057bf0..8419aa79c248 100644 --- a/sys/arch/hp700/dev/lasi.c +++ b/sys/arch/hp700/dev/lasi.c @@ -1,4 +1,4 @@ -/* $NetBSD: lasi.c,v 1.21 2011/07/01 18:33:09 dyoung Exp $ */ +/* $NetBSD: lasi.c,v 1.22 2012/04/03 12:07:26 skrll Exp $ */ /* $OpenBSD: lasi.c,v 1.4 2001/06/09 03:57:19 mickey Exp $ */ @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lasi.c,v 1.21 2011/07/01 18:33:09 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lasi.c,v 1.22 2012/04/03 12:07:26 skrll Exp $"); #undef LASIDEBUG @@ -151,6 +151,7 @@ lasiattach(device_t parent, device_t self, void *aux) struct confargs *ca = aux; struct lasi_softc *sc = device_private(self); struct gsc_attach_args ga; + struct cpu_info *ci = &cpus[0]; bus_space_handle_t ioh; int s, in; @@ -182,7 +183,7 @@ lasiattach(device_t parent, device_t self, void *aux) /* interrupts guts */ s = splhigh(); - sc->sc_trs->lasi_iar = cpu_gethpa(0) | (31 - ca->ca_irq); + sc->sc_trs->lasi_iar = ci->ci_hpa | (31 - ca->ca_irq); sc->sc_trs->lasi_icr = 0; sc->sc_trs->lasi_imr = ~0U; in = sc->sc_trs->lasi_irr; diff --git a/sys/arch/hp700/dev/siop_sgc.c b/sys/arch/hp700/dev/siop_sgc.c index 98d3a1c746b0..95c334fd1669 100644 --- a/sys/arch/hp700/dev/siop_sgc.c +++ b/sys/arch/hp700/dev/siop_sgc.c @@ -1,4 +1,4 @@ -/* $NetBSD: siop_sgc.c,v 1.8 2011/07/01 18:33:09 dyoung Exp $ */ +/* $NetBSD: siop_sgc.c,v 1.9 2012/04/03 12:07:26 skrll Exp $ */ /* $OpenBSD: siop_sgc.c,v 1.1 2007/08/05 19:09:52 kettenis Exp $ */ @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: siop_sgc.c,v 1.8 2011/07/01 18:33:09 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: siop_sgc.c,v 1.9 2012/04/03 12:07:26 skrll Exp $"); #include #include @@ -88,6 +88,7 @@ siop_sgc_attach(device_t parent, device_t self, void *aux) struct siop_sgc_softc *sgc = device_private(self); struct siop_softc *sc = &sgc->sc_siop; struct confargs *ca = aux; + struct cpu_info *ci = &cpus[0]; volatile struct iomod *regs; sc->sc_c.sc_dev = self; @@ -126,7 +127,7 @@ siop_sgc_attach(device_t parent, device_t self, void *aux) siop_sgc_reset(&sc->sc_c); - regs->io_eim = cpu_gethpa(0) | (31 - ca->ca_irq); + regs->io_eim = ci->ci_hpa | (31 - ca->ca_irq); regs->io_ii_rw |= IO_II_INTEN; aprint_normal(": NCR53C720 rev %d\n", bus_space_read_1(sc->sc_c.sc_rt, diff --git a/sys/arch/hp700/dev/wax.c b/sys/arch/hp700/dev/wax.c index b911b99bf46d..87893ea82dba 100644 --- a/sys/arch/hp700/dev/wax.c +++ b/sys/arch/hp700/dev/wax.c @@ -1,4 +1,4 @@ -/* $NetBSD: wax.c,v 1.17 2011/02/01 18:33:24 skrll Exp $ */ +/* $NetBSD: wax.c,v 1.18 2012/04/03 12:07:26 skrll Exp $ */ /* $OpenBSD: wax.c,v 1.1 1998/11/23 03:04:10 mickey Exp $ */ @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wax.c,v 1.17 2011/02/01 18:33:24 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wax.c,v 1.18 2012/04/03 12:07:26 skrll Exp $"); #include #include @@ -115,6 +115,7 @@ waxattach(device_t parent, device_t self, void *aux) struct confargs *ca = aux; struct wax_softc *sc = device_private(self); struct gsc_attach_args ga; + struct cpu_info *ci = &cpus[0]; bus_space_handle_t ioh; int s, in; @@ -140,7 +141,7 @@ waxattach(device_t parent, device_t self, void *aux) /* interrupts guts */ s = splhigh(); - sc->sc_regs->wax_iar = cpu_gethpa(0) | (31 - ca->ca_irq); + sc->sc_regs->wax_iar = ci->ci_hpa | (31 - ca->ca_irq); sc->sc_regs->wax_icr = 0; sc->sc_regs->wax_imr = ~0U; in = sc->sc_regs->wax_irr; diff --git a/sys/arch/hp700/hp700/mainbus.c b/sys/arch/hp700/hp700/mainbus.c index be88a79e4886..f819eb5bc338 100644 --- a/sys/arch/hp700/hp700/mainbus.c +++ b/sys/arch/hp700/hp700/mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.81 2012/02/23 21:38:53 skrll Exp $ */ +/* $NetBSD: mainbus.c,v 1.82 2012/04/03 12:07:26 skrll Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.81 2012/02/23 21:38:53 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.82 2012/04/03 12:07:26 skrll Exp $"); #include "locators.h" #include "power.h" @@ -101,8 +101,6 @@ int mbusdebug = 1; struct mainbus_softc { device_t sc_dv; - - hppa_hpa_t sc_hpa; }; int mbmatch(device_t, cfdata_t, void *); @@ -1387,8 +1385,6 @@ mbattach(device_t parent, device_t self, void *aux) ((struct iomod *)(hppa_mcpuhpa & HPPA_FLEX_MASK))[FPA_IOMOD].io_flex = (void *)((hppa_mcpuhpa & HPPA_FLEX_MASK) | DMA_ENABLE); - sc->sc_hpa = hppa_mcpuhpa; - aprint_normal(" [flex %lx]\n", hppa_mcpuhpa & HPPA_FLEX_MASK); /* PDC first */ @@ -1457,19 +1453,6 @@ mbattach(device_t parent, device_t self, void *aux) hppa_modules_done(); } -/* - * retrive CPU #N HPA value - */ -hppa_hpa_t -cpu_gethpa(int n) -{ - struct mainbus_softc *sc; - - sc = device_lookup_private(&mainbus_cd, 0); - - return sc->sc_hpa; -} - int mbprint(void *aux, const char *pnp) { diff --git a/sys/arch/hppa/include/cpufunc.h b/sys/arch/hppa/include/cpufunc.h index a594c723053c..bf1d315a9a52 100644 --- a/sys/arch/hppa/include/cpufunc.h +++ b/sys/arch/hppa/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.h,v 1.15 2012/02/04 16:33:27 skrll Exp $ */ +/* $NetBSD: cpufunc.h,v 1.16 2012/04/03 12:07:26 skrll Exp $ */ /* $OpenBSD: cpufunc.h,v 1.17 2000/05/15 17:22:40 mickey Exp $ */ @@ -180,7 +180,6 @@ void fdcache(pa_space_t, vaddr_t, vsize_t); void pdcache(pa_space_t, vaddr_t, vsize_t); void fcacheall(void); void ptlball(void); -hppa_hpa_t cpu_gethpa(int); #define PCXL2_ACCEL_IO_START 0xf4000000 #define PCXL2_ACCEL_IO_END (0xfc000000 - 1)