Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hp700 Rework the hp700 interrupt code to
details: https://anonhg.NetBSD.org/src/rev/55cda740b4fd
branches: trunk
changeset: 779374:55cda740b4fd
user: skrll <skrll%NetBSD.org@localhost>
date: Wed May 23 16:11:37 2012 +0000
description:
Rework the hp700 interrupt code to
- note chip restictions on interrupt in the kernel config
- allocate interrupts at attach time
- track per CPU interrupts
- remove a funciton written in assembly
diffstat:
sys/arch/hp700/conf/GENERIC | 21 +-
sys/arch/hp700/dev/apic.c | 10 +-
sys/arch/hp700/dev/asp.c | 28 +-
sys/arch/hp700/dev/cpu.c | 51 +++--
sys/arch/hp700/dev/dino.c | 14 +-
sys/arch/hp700/dev/lasi.c | 18 +-
sys/arch/hp700/dev/mongoose.c | 17 +-
sys/arch/hp700/dev/power.c | 3 +-
sys/arch/hp700/dev/siop_sgc.c | 17 +-
sys/arch/hp700/dev/wax.c | 12 +-
sys/arch/hp700/gsc/gscbus.c | 7 +-
sys/arch/hp700/gsc/gscbusvar.h | 4 +-
sys/arch/hp700/hp700/autoconf.c | 12 +-
sys/arch/hp700/hp700/genassym.cf | 7 +-
sys/arch/hp700/hp700/intr.c | 320 ++++++++++++++++++--------------------
sys/arch/hp700/hp700/intr.h | 96 -----------
sys/arch/hp700/hp700/locore.S | 112 +-------------
sys/arch/hp700/hp700/machdep.c | 7 +-
sys/arch/hp700/hp700/mainbus.c | 8 +-
sys/arch/hp700/include/cpu.h | 25 ++-
sys/arch/hp700/include/intr.h | 109 ++++++++++++-
21 files changed, 403 insertions(+), 495 deletions(-)
diffs (truncated from 1807 to 300 lines):
diff -r bcfb8b49f2cb -r 55cda740b4fd sys/arch/hp700/conf/GENERIC
--- a/sys/arch/hp700/conf/GENERIC Wed May 23 16:08:32 2012 +0000
+++ b/sys/arch/hp700/conf/GENERIC Wed May 23 16:11:37 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.113 2012/04/06 12:21:58 skrll Exp $
+# $NetBSD: GENERIC,v 1.114 2012/05/23 16:11:37 skrll Exp $
#
# GENERIC machine description file
#
@@ -23,7 +23,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
-#ident "GENERIC-$Revision: 1.113 $"
+#ident "GENERIC-$Revision: 1.114 $"
maxusers 32 # estimated number of users
@@ -229,10 +229,13 @@
lcd0 at mainbus0 # LCD
# Basic Bus Support
-lasi* at mainbus0 # LASI host adapter ( LSI PN??? )
-asp* at mainbus0 # this one comes w/ Viper and leds
+lasi0 at mainbus0 irq 28 # LASI host adapter
+lasi0 at phantomas0 irq 28 # LASI on [AB]*
+lasi0 at uturn? irq 28 # LASI on [CJ]*
+lasi1 at mainbus0 irq 27 # 712 GIO card
+asp* at mainbus0 irq 28 # this one comes w/ Viper and LEDs
wax* at mainbus0 # Wax GSC to GSC Bus Adapter
-mongoose* at mainbus0 irq 17 # EISA Bus Adapter ( i82350 or TI??? )
+mongoose* at mainbus0 # EISA Bus Adapter ( i82350 or TI??? )
#vmeb* at mainbus0 irq ? # VME bus adapter
phantomas* at mainbus0 # Phantom PseudoBC GSC+ Port
@@ -341,10 +344,10 @@
# GSC SCSI controllers
oosiop* at gsc? # NCR 53c700
osiop* at gsc? flags 0x00000 # NCR 53c710
-siop* at gsc? irq 3 # NCR 53c720 (Fast/Wide)
-siop* at mainbus0 irq 3 # NCR 53c720 (Fast/Wide)
-siop* at phantomas? irq 3 # NCR 53c720 (Fast/Wide)
-siop* at uturn? irq 3 # NCR 53c720 (Fast/Wide)
+siop* at gsc? # NCR 53c720 (Fast/Wide)
+siop* at mainbus0 # NCR 53c720 (Fast/Wide)
+siop* at phantomas? # NCR 53c720 (Fast/Wide)
+siop* at uturn? # NCR 53c720 (Fast/Wide)
# PCI SCSI controllers
adv* at pci? dev ? function ? # AdvanSys 1200[A,B], 9xx[U,UA] SCSI
diff -r bcfb8b49f2cb -r 55cda740b4fd sys/arch/hp700/dev/apic.c
--- a/sys/arch/hp700/dev/apic.c Wed May 23 16:08:32 2012 +0000
+++ b/sys/arch/hp700/dev/apic.c Wed May 23 16:11:37 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apic.c,v 1.15 2012/05/21 20:58:39 skrll Exp $ */
+/* $NetBSD: apic.c,v 1.16 2012/05/23 16:11:37 skrll Exp $ */
/* $OpenBSD: apic.c,v 1.14 2011/05/01 21:59:39 kettenis Exp $ */
@@ -28,8 +28,6 @@
#include <machine/pdc.h>
#include <machine/intr.h>
-#include <hp700/hp700/intr.h>
-
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
@@ -127,6 +125,7 @@
apic_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
{
struct elroy_softc *sc = pa->pa_pc->_cookie;
+ struct cpu_info *ci = &cpus[0];
pci_chipset_tag_t pc = pa->pa_pc;
pcitag_t tag = pa->pa_tag;
pcireg_t reg;
@@ -139,7 +138,8 @@
#endif
line = PCI_INTERRUPT_LINE(reg);
if (sc->sc_irq[line] == 0)
- sc->sc_irq[line] = hp700_intr_allocate_bit(&ir_cpu);
+ sc->sc_irq[line] = hp700_intr_allocate_bit(&ci->ci_ir, -1);
+ KASSERT(sc->sc_irq[line] != -1);
*ihp = (line << APIC_INT_LINE_SHIFT) | sc->sc_irq[line];
return APIC_INT_IRQ(*ihp) == 0;
@@ -194,7 +194,7 @@
biv = apic_intr_list[irq];
if (biv == NULL) {
- iv = hp700_intr_establish(pri, apic_intr, aiv, &ir_cpu, irq);
+ iv = hp700_intr_establish(pri, apic_intr, aiv, &ci->ci_ir, irq);
if (iv == NULL) {
free(aiv, M_DEVBUF);
free(cnt, M_DEVBUF);
diff -r bcfb8b49f2cb -r 55cda740b4fd sys/arch/hp700/dev/asp.c
--- a/sys/arch/hp700/dev/asp.c Wed May 23 16:08:32 2012 +0000
+++ b/sys/arch/hp700/dev/asp.c Wed May 23 16:11:37 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: asp.c,v 1.20 2012/05/23 10:37:01 skrll Exp $ */
+/* $NetBSD: asp.c,v 1.21 2012/05/23 16:11:37 skrll Exp $ */
/* $OpenBSD: asp.c,v 1.5 2000/02/09 05:04:22 mickey Exp $ */
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: asp.c,v 1.20 2012/05/23 10:37:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: asp.c,v 1.21 2012/05/23 16:11:37 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -172,10 +172,6 @@
ca->ca_type.iodc_sv_model != HPPA_BHA_ASP)
return 0;
- /* Make sure we have an IRQ. */
- if (ca->ca_irq == HP700CF_IRQ_UNDEF)
- ca->ca_irq = hp700_intr_allocate_bit(&ir_cpu);
-
/*
* Forcibly mask the HPA down to the start of the ASP
* chip address space.
@@ -191,12 +187,19 @@
struct confargs *ca = aux;
struct asp_softc *sc = device_private(self);
struct gsc_attach_args ga;
+ struct cpu_info *ci = &cpus[0];
bus_space_handle_t ioh;
uint32_t irr;
int s;
sc->sc_dev = self;
+ ca->ca_irq = hp700_intr_allocate_bit(&ci->ci_ir, ca->ca_irq);
+ if (ca->ca_irq == HP700CF_IRQ_UNDEF) {
+ aprint_error_dev(self, ": can't allocate interrupt");
+ return;
+ }
+
/*
* Map the ASP interrupt registers.
*/
@@ -244,18 +247,19 @@
sc->sc_trs->asp_imr = ~0;
irr = sc->sc_trs->asp_irr;
sc->sc_trs->asp_imr = 0;
+
+ /* Establish the interrupt register. */
+ hp700_interrupt_register_establish(ci, &sc->sc_ir);
+ sc->sc_ir.ir_name = device_xname(self);
+ sc->sc_ir.ir_mask = &sc->sc_trs->asp_imr;
+ sc->sc_ir.ir_req = &sc->sc_trs->asp_irr;
+
splx(s);
aprint_normal(": %s rev %d, lan %d scsi %d\n",
asp_spus[sc->sc_trs->asp_spu].name, sc->sc_hw->asp_version,
sc->sc_trs->asp_lan, sc->sc_trs->asp_scsi);
- /* Establish the interrupt register. */
- hp700_interrupt_register_establish(&sc->sc_ir);
- sc->sc_ir.ir_name = device_xname(self);
- sc->sc_ir.ir_mask = &sc->sc_trs->asp_imr;
- sc->sc_ir.ir_req = &sc->sc_trs->asp_irr;
-
/* Attach the GSC bus. */
ga.ga_ca = *ca; /* clone from us */
if (strcmp(parent->dv_xname, "mainbus0") == 0) {
diff -r bcfb8b49f2cb -r 55cda740b4fd sys/arch/hp700/dev/cpu.c
--- a/sys/arch/hp700/dev/cpu.c Wed May 23 16:08:32 2012 +0000
+++ b/sys/arch/hp700/dev/cpu.c Wed May 23 16:11:37 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.26 2012/05/23 09:49:56 skrll Exp $ */
+/* $NetBSD: cpu.c,v 1.27 2012/05/23 16:11:37 skrll Exp $ */
/* $OpenBSD: cpu.c,v 1.29 2009/02/08 18:33:28 miod Exp $ */
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.26 2012/05/23 09:49:56 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.27 2012/05/23 16:11:37 skrll Exp $");
#include "opt_multiprocessor.h"
@@ -47,7 +47,6 @@
#include <machine/autoconf.h>
#include <hppa/hppa/cpuvar.h>
-#include <hp700/hp700/intr.h>
#include <hp700/hp700/machdep.h>
#include <hp700/dev/cpudevs.h>
@@ -92,8 +91,9 @@
struct cpu_softc *sc = device_private(self);
struct confargs *ca = aux;
+ static const char lvls[4][4] = { "0", "1", "1.5", "2" };
+ struct hp700_interrupt_register *ir;
struct cpu_info *ci;
- static const char lvls[4][4] = { "0", "1", "1.5", "2" };
u_int mhz = 100 * cpu_ticksnum / cpu_ticksdenom;
int cpuno = device_unit(self);
@@ -115,6 +115,12 @@
aprint_normal(" (%s)", hppa_cpu_info->hci_chip_nickname);
aprint_normal(" rev %d", cpu_revision);
+ /* sanity against luser amongst config editors */
+ if (ca->ca_irq != 31) {
+ aprint_error_dev(self, "bad irq number %d\n", ca->ca_irq);
+ return;
+ }
+
/* Print the CPU type, spec, level, category, and speed. */
aprint_normal("\n%s: %s, PA-RISC %s", self->dv_xname,
hppa_cpu_info->hci_chip_type,
@@ -156,17 +162,25 @@
hppa_mod_info(HPPA_TYPE_FPU, (fpu_version >> 16) & 0x1f),
(fpu_version >> 11) & 0x1f);
- /* sanity against luser amongst config editors */
- if (ca->ca_irq != 31) {
- aprint_error_dev(self, "bad irq number %d\n", ca->ca_irq);
- return;
- }
-
+ hp700_intr_initialise(ci);
+
+ ir = &ci->ci_ir;
+ hp700_interrupt_register_establish(ci, ir);
+ ir->ir_iscpu = true;
+ ir->ir_ci = ci;
+ ir->ir_name = device_xname(self);
+
sc->sc_ihclk = hp700_intr_establish(IPL_CLOCK, clock_intr,
- NULL /*clockframe*/, &ir_cpu, 31);
+ NULL /*clockframe*/, &ci->ci_ir, 31);
+
+ /*
+ * Reserve some bits for chips that don't like to be moved
+ * around, e.g. lasi and asp.
+ */
+ ir->ir_rbits = ((1 << 28) | (1 << 27));
+ ir->ir_bits &= ~ir->ir_rbits;
#ifdef MULTIPROCESSOR
-
/* Allocate stack for spin up and FPU emulation. */
TAILQ_INIT(&mlist);
error = uvm_pglistalloc(PAGE_SIZE, 0, -1L, PAGE_SIZE, 0, &mlist, 1, 0);
@@ -191,21 +205,10 @@
}
}
hppa_ncpu++;
-
#endif
-
- /*
- * Set the allocatable bits in the CPU interrupt registers.
- * These should only be used by major chipsets, like ASP and
- * LASI, and the bits used appear to be important - the
- * ASP doesn't seem to like to use interrupt bits above 28
- * or below 27.
- */
- ir_cpu.ir_bits =
- (1 << 28) | (1 << 27) | (1 << 26);
+ KASSERT(ci->ci_cpl == -1);
}
-
#ifdef MULTIPROCESSOR
void
cpu_boot_secondary_processors(void)
diff -r bcfb8b49f2cb -r 55cda740b4fd sys/arch/hp700/dev/dino.c
--- a/sys/arch/hp700/dev/dino.c Wed May 23 16:08:32 2012 +0000
+++ b/sys/arch/hp700/dev/dino.c Wed May 23 16:11:37 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dino.c,v 1.35 2012/05/23 10:31:59 skrll Exp $ */
+/* $NetBSD: dino.c,v 1.36 2012/05/23 16:11:37 skrll Exp $ */
/* $OpenBSD: dino.c,v 1.5 2004/02/13 20:39:31 mickey Exp $ */
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.35 2012/05/23 10:31:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.36 2012/05/23 16:11:37 skrll Exp $");
/* #include "cardbus.h" */
@@ -43,7 +43,6 @@
#include <machine/iomod.h>
#include <machine/autoconf.h>
#include <machine/intr.h>
-#include <hp700/hp700/intr.h>
Home |
Main Index |
Thread Index |
Old Index