Poll bus resets on FireWire while kdb/gdb is active.

Now, it's safe to call the fwohci interrupt(polling) routine while ddb/gdb
is active. After this change, a dcons connnection over FireWire can survive
bus resets even in kernel debugger.

This means that it is not too late to plug a FireWire cable after a panic
to investigate the problem.

Actually there is a small window(between a jump to kernel from loader and
initialization of dcons_crom) in which no one can take care of a bus reset.
Except that window, firewire console should keep working
from loader to reboot even with a panic and a bus reset.
(as far as you enable LOADER_FIREWIRE_SUPPORT)
This commit is contained in:
Hidetoshi Shimokawa 2007-06-08 00:54:44 +00:00
parent faef53711b
commit 9953c34ca6
3 changed files with 19 additions and 0 deletions

View File

@ -84,6 +84,7 @@ struct dcons_crom_softc {
bus_dma_tag_t dma_tag;
bus_dmamap_t dma_map;
bus_addr_t bus_addr;
eventhandler_tag ehand;
};
static void
@ -164,6 +165,14 @@ dmamap_cb(void *arg, bus_dma_segment_t *segments, int seg, int error)
#endif
}
static void
dcons_crom_poll(void *p, int arg)
{
struct dcons_crom_softc *sc = (struct dcons_crom_softc *) p;
sc->fd.fc->poll(sc->fd.fc, -1, -1);
}
static int
dcons_crom_attach(device_t dev)
{
@ -200,6 +209,8 @@ dcons_crom_attach(device_t dev)
bus_dmamap_load(sc->dma_tag, sc->dma_map,
(void *)dcons_conf->buf, dcons_conf->size,
dmamap_cb, sc, 0);
sc->ehand = EVENTHANDLER_REGISTER(dcons_poll, dcons_crom_poll,
(void *)sc, 0);
return (0);
#endif
}
@ -212,6 +223,9 @@ dcons_crom_detach(device_t dev)
sc = (struct dcons_crom_softc *) device_get_softc(dev);
sc->fd.post_busreset = NULL;
if (sc->ehand)
EVENTHANDLER_DEREGISTER(dcons_poll, sc->ehand);
/* XXX */
if (dcons_conf->dma_tag == sc->dma_tag)
dcons_conf->dma_tag = NULL;

View File

@ -245,6 +245,7 @@ dcons_os_checkc(struct dcons_softc *dc)
{
int c;
EVENTHANDLER_INVOKE(dcons_poll, 0);
if (dg.dma_tag != NULL)
bus_dmamap_sync(dg.dma_tag, dg.dma_map, BUS_DMASYNC_POSTREAD);

View File

@ -34,6 +34,10 @@
* $FreeBSD$
*/
typedef void (*dcons_poll_fn)(void *, int);
EVENTHANDLER_DECLARE(dcons_poll, dcons_poll_fn);
struct dcons_global {
struct consdev *cdev;
struct dcons_buf *buf;