Port-alpha archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: can't reboot after running a 5.0 kernel



> I've seen exactly this on another Alpha.  I believe this is PR #40077.
> 
> There's a workaround in the PR.  Basically you have to disable the
> code that disables PCI bus mastering on a shutdown.

I wonder if this pmf(9) hack is acceptable...
(diff is for netbsd-5 branch)


Index: pci/sio.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/sio.c,v
retrieving revision 1.43
diff -u -p -r1.43 sio.c
--- pci/sio.c   28 Apr 2008 20:23:11 -0000      1.43
+++ pci/sio.c   27 Jan 2011 16:33:08 -0000
@@ -108,6 +108,8 @@ struct sio_softc {
 int    siomatch __P((struct device *, struct cfdata *, void *));
 void   sioattach __P((struct device *, struct device *, void *));
 
+static bool sioshutdown(device_t, int);
+
 CFATTACH_DECL(sio, sizeof(struct sio_softc),
     siomatch, sioattach, NULL, NULL);
 
@@ -204,9 +206,21 @@ sioattach(parent, self, aux)
        sc->sc_is82c693 = (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_CONTAQ &&
            PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CONTAQ_82C693);
 
+       if (!pmf_device_register1(self, NULL, NULL, sioshutdown))
+               aprint_error_dev(self, "couldn't establish power handler\n");
+
        config_defer(self, sio_bridge_callback);
 }
 
+bool
+sioshutdown(device_t self, int howto)
+{
+
+       sio_intr_shutdown();
+
+       return true;
+}
+
 void
 sio_bridge_callback(self)
        struct device *self;
Index: pci/sio_pic.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/sio_pic.c,v
retrieving revision 1.36
diff -u -p -r1.36 sio_pic.c
--- pci/sio_pic.c       28 Apr 2008 20:23:11 -0000      1.36
+++ pci/sio_pic.c       27 Jan 2011 16:33:08 -0000
@@ -116,6 +116,7 @@ static struct alpha_shared_intr *sio_int
  */
 u_int8_t initial_ocw1[2];
 u_int8_t initial_elcr[2];
+bool sio_doshutdown;
 #endif
 
 void           sio_setirqstat __P((int, int, int));
@@ -123,9 +124,6 @@ void                sio_setirqstat __P((int, int, int)
 u_int8_t       (*sio_read_elcr) __P((int));
 void           (*sio_write_elcr) __P((int, u_int8_t));
 static void    specific_eoi __P((int));
-#ifdef BROKEN_PROM_CONSOLE
-void           sio_intr_shutdown __P((void *));
-#endif
 
 /******************** i82378 SIO ELCR functions ********************/
 
@@ -352,7 +350,8 @@ sio_intr_setup(pc, iot)
        initial_ocw1[1] = bus_space_read_1(sio_iot, sio_ioh_icu2, 1);
        initial_elcr[0] = (*sio_read_elcr)(0);                  /* XXX */
        initial_elcr[1] = (*sio_read_elcr)(1);                  /* XXX */
-       shutdownhook_establish(sio_intr_shutdown, 0);
+       /* shutdown hook will be established in sioattach() via pmf(9) */
+       sio_doshutdown = true;
 #endif
 
        sio_intr = alpha_shared_intr_alloc(ICU_LEN, 8);
@@ -407,20 +406,22 @@ sio_intr_setup(pc, iot)
        }
 }
 
-#ifdef BROKEN_PROM_CONSOLE
 void
-sio_intr_shutdown(arg)
-       void *arg;
+sio_intr_shutdown(void)
 {
+#ifdef BROKEN_PROM_CONSOLE
+
        /*
         * Restore the initial values, to make the PROM happy.
         */
-       bus_space_write_1(sio_iot, sio_ioh_icu1, 1, initial_ocw1[0]);
-       bus_space_write_1(sio_iot, sio_ioh_icu2, 1, initial_ocw1[1]);
-       (*sio_write_elcr)(0, initial_elcr[0]);                  /* XXX */
-       (*sio_write_elcr)(1, initial_elcr[1]);                  /* XXX */
-}
+       if (sio_doshutdown) {
+               bus_space_write_1(sio_iot, sio_ioh_icu1, 1, initial_ocw1[0]);
+               bus_space_write_1(sio_iot, sio_ioh_icu2, 1, initial_ocw1[1]);
+               (*sio_write_elcr)(0, initial_elcr[0]);          /* XXX */
+               (*sio_write_elcr)(1, initial_elcr[1]);          /* XXX */
+       }
 #endif
+}
 
 const char *
 sio_intr_string(v, irq)
Index: pci/siovar.h
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/pci/siovar.h,v
retrieving revision 1.10
diff -u -p -r1.10 siovar.h
--- pci/siovar.h        5 Jun 2000 21:47:29 -0000       1.10
+++ pci/siovar.h        27 Jan 2011 16:33:08 -0000
@@ -36,3 +36,5 @@ void  *sio_intr_establish __P((void *, in
            void *));
 void   sio_intr_disestablish __P((void *, void *));
 int    sio_intr_alloc __P((void *, int, int, int *));
+
+void   sio_intr_shutdown(void);


---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index