diff options
-rw-r--r-- | sys/arch/hppa/dev/power.c | 36 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/mainbus.c | 14 |
2 files changed, 37 insertions, 13 deletions
diff --git a/sys/arch/hppa/dev/power.c b/sys/arch/hppa/dev/power.c index 40426eed8e1..6175fb7dce2 100644 --- a/sys/arch/hppa/dev/power.c +++ b/sys/arch/hppa/dev/power.c @@ -1,4 +1,4 @@ -/* $OpenBSD: power.c,v 1.2 2003/08/20 22:51:07 mickey Exp $ */ +/* $OpenBSD: power.c,v 1.3 2003/08/20 23:33:36 mickey Exp $ */ /* * Copyright (c) 2003 Michael Shalayeff @@ -41,12 +41,14 @@ struct power_softc { struct device sc_dev; + void *sc_ih; struct proc *sc_thread; void (*sc_kicker)(void *); int sc_dr_cnt; paddr_t sc_pwr_reg; + volatile int sc_interrupted; }; int powermatch(struct device *, void *, void *); @@ -64,8 +66,7 @@ void power_thread_create(void *v); void power_thread_dr(void *v); void power_thread_reg(void *v); void power_cold_hook_reg(int); - -struct pdc_power_info pdc_power_info PDC_ALIGNMENT; +int power_intr(void *); int powermatch(struct device *parent, void *cfdata, void *aux) @@ -83,7 +84,7 @@ void powerattach(struct device *parent, struct device *self, void *aux) { struct power_softc *sc = (struct power_softc *)self; - int error; + struct confargs *ca = aux; switch (cpu_hvers) { case HPPA_BOARD_HP712_60: @@ -95,24 +96,36 @@ powerattach(struct device *parent, struct device *self, void *aux) break; default: - if ((error = pdc_call((iodcio_t)pdc, 0, PDC_SOFT_POWER, - PDC_SOFT_POWER_INFO, &pdc_power_info, 0))) - printf(": no power control, disabled\n"); - else { + if (ca->ca_hpa) { extern void (*cold_hook)(int); - sc->sc_pwr_reg = pdc_power_info.addr; - printf(" offset %x\n", sc->sc_pwr_reg - 0xf0000000); + sc->sc_pwr_reg = ca->ca_hpa; cold_hook = power_cold_hook_reg; sc->sc_kicker = power_thread_reg; - } + printf("\n"); + } else + printf(": not available\n"); break; } + if (ca->ca_irq >= 0) + sc->sc_ih = cpu_intr_establish(IPL_CLOCK, ca->ca_irq, + power_intr, sc, sc->sc_dev.dv_xname); + if (sc->sc_kicker) kthread_create_deferred(power_thread_create, sc); } +int +power_intr(void *v) +{ + struct power_softc *sc = v; + + sc->sc_interrupted = 1; + + return (1); +} + void power_thread_create(void *v) { @@ -167,6 +180,7 @@ power_thread_reg(void *v) void power_cold_hook_reg(int on) { + extern struct pdc_power_info pdc_power_info; /* machdep.c */ int error; if ((error = pdc_call((iodcio_t)pdc, 0, PDC_SOFT_POWER, diff --git a/sys/arch/hppa/hppa/mainbus.c b/sys/arch/hppa/hppa/mainbus.c index 43f6dca1567..3d3b95bbae6 100644 --- a/sys/arch/hppa/hppa/mainbus.c +++ b/sys/arch/hppa/hppa/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.50 2003/08/20 21:44:03 mickey Exp $ */ +/* $OpenBSD: mainbus.c,v 1.51 2003/08/20 23:33:36 mickey Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -66,6 +66,9 @@ struct cfdriver mainbus_cd = { NULL, "mainbus", DV_DULL }; +struct pdc_hpa pdc_hpa PDC_ALIGNMENT; +struct pdc_power_info pdc_power_info PDC_ALIGNMENT; + /* from machdep.c */ extern struct extent *hppa_ex; extern struct pdc_btlb pdc_btlb; @@ -981,7 +984,6 @@ mbattach(parent, self, aux) void *aux; { struct mainbus_softc *sc = (struct mainbus_softc *)self; - struct pdc_hpa pdc_hpa PDC_ALIGNMENT; struct confargs nca; bus_space_handle_t ioh; @@ -1013,7 +1015,15 @@ mbattach(parent, self, aux) #if NPOWER > 0 /* get some power */ + bzero (&nca, sizeof(nca)); nca.ca_name = "power"; + nca.ca_irq = -1; + if (!pdc_call((iodcio_t)pdc, 0, PDC_SOFT_POWER, + PDC_SOFT_POWER_INFO, &pdc_power_info, 0)) { + nca.ca_iot = &hppa_bustag; + nca.ca_hpa = pdc_power_info.addr; + nca.ca_hpamask = HPPA_IOSPACE; + } config_found(self, &nca, mbprint); #endif |