| Summary: | [panic] Kernel panic on boot on powerpc64 | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Julio Merino <julio> |
| Component: | powerpc | Assignee: | Andreas Tobler <andreast> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
Hi, the reason is from this commit r256304. We're working on it. Basically, ata_probe does not longer return 0 and ata_kauai and ata_macio fail now. This is due to the fact that these drivers do not handle properly the BUS_* return codes other than 0. For the time being you can try the below. Gruss, Andreas Index: powerpc/powermac/ata_kauai.c =================================================================== --- powerpc/powermac/ata_kauai.c (revision 256444) +++ powerpc/powermac/ata_kauai.c (working copy) @@ -199,7 +199,7 @@ u_int32_t devid; phandle_t node; const char *compatstring = NULL; - int i, found, rid; + int err, i, found, rid; found = 0; devid = pci_get_devid(dev); @@ -252,8 +252,11 @@ /* XXX: ATAPI DMA is unreliable. We should find out why. */ ch->flags |= ATA_NO_ATAPI_DMA; ata_generic_hw(dev); + err = ata_probe(dev); + if (err > 0) + return (err); - return (ata_probe(dev)); + return (0); } #if USE_DBDMA_IRQ Great, thanks a lot for the quick reply. That patch fixed the boot for me. On Mon, Oct 14, 2013 at 3:42 PM, Andreas Tobler <andreast@freebsd.org> wrote: > Hi, > > the reason is from this commit r256304. > > We're working on it. > > Basically, ata_probe does not longer return 0 and ata_kauai and > ata_macio fail now. This is due to the fact that these drivers do not > handle properly the BUS_* return codes other than 0. > > For the time being you can try the below. > > Gruss, > Andreas > > Index: powerpc/powermac/ata_kauai.c > =================================================================== > --- powerpc/powermac/ata_kauai.c (revision 256444) > +++ powerpc/powermac/ata_kauai.c (working copy) > @@ -199,7 +199,7 @@ > u_int32_t devid; > phandle_t node; > const char *compatstring = NULL; > - int i, found, rid; > + int err, i, found, rid; > > found = 0; > devid = pci_get_devid(dev); > @@ -252,8 +252,11 @@ > /* XXX: ATAPI DMA is unreliable. We should find out why. */ > ch->flags |= ATA_NO_ATAPI_DMA; > ata_generic_hw(dev); > + err = ata_probe(dev); > + if (err > 0) > + return (err); > > - return (ata_probe(dev)); > + return (0); > } > > #if USE_DBDMA_IRQ -- Julio Merino / @jmmv Author: andreast Date: Tue Oct 15 18:59:32 2013 New Revision: 256555 URL: http://svnweb.freebsd.org/changeset/base/256555 Log: Move the resource allocation from the ata_*_probe section to the ata_*_attach section. This prevents a boot crash on nearly all iMacs and PowerMacs/Books. The allocation in the probe section was working before because ata_probe was returning 0 which did not invoke a second DEVICE_PROBE. Now it returns a BUS_PROBE_DEFAULT which can invoke a second DEVICE_PROBE which results in a "failed to reserve resource" exit. PR: powerpc/182978 Discussed with: grehan@ MFC after: 1 Week Modified: head/sys/powerpc/powermac/ata_kauai.c head/sys/powerpc/powermac/ata_macio.c Modified: head/sys/powerpc/powermac/ata_kauai.c ============================================================================== --- head/sys/powerpc/powermac/ata_kauai.c Tue Oct 15 18:07:23 2013 (r256554) +++ head/sys/powerpc/powermac/ata_kauai.c Tue Oct 15 18:59:32 2013 (r256555) @@ -194,12 +194,11 @@ static const u_int udma_timing_shasta[] static int ata_kauai_probe(device_t dev) { - struct ata_channel *ch; struct ata_kauai_softc *sc; u_int32_t devid; phandle_t node; const char *compatstring = NULL; - int i, found, rid; + int i, found; found = 0; devid = pci_get_devid(dev); @@ -216,7 +215,6 @@ ata_kauai_probe(device_t dev) node = ofw_bus_get_node(dev); sc = device_get_softc(dev); bzero(sc, sizeof(struct ata_kauai_softc)); - ch = &sc->sc_ch.sc_ch; compatstring = ofw_bus_get_compat(dev); if (compatstring != NULL && strcmp(compatstring,"shasta-ata") == 0) @@ -227,32 +225,6 @@ ata_kauai_probe(device_t dev) (compatstring == NULL || strcmp(compatstring, "K2-UATA") != 0)) bus_set_resource(dev, SYS_RES_IRQ, 0, 39, 1); - rid = PCIR_BARS; - sc->sc_memr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (sc->sc_memr == NULL) { - device_printf(dev, "could not allocate memory\n"); - return (ENXIO); - } - - /* - * Set up the resource vectors - */ - for (i = ATA_DATA; i <= ATA_COMMAND; i++) { - ch->r_io[i].res = sc->sc_memr; - ch->r_io[i].offset = i*ATA_KAUAI_REGGAP + ATA_KAUAI_REGOFFSET; - } - ch->r_io[ATA_CONTROL].res = sc->sc_memr; - ch->r_io[ATA_CONTROL].offset = ATA_KAUAI_ALTOFFSET; - ata_default_registers(dev); - - ch->unit = 0; - ch->flags |= ATA_USE_16BIT; - - /* XXX: ATAPI DMA is unreliable. We should find out why. */ - ch->flags |= ATA_NO_ATAPI_DMA; - ata_generic_hw(dev); - return (ata_probe(dev)); } @@ -272,12 +244,42 @@ static int ata_kauai_attach(device_t dev) { struct ata_kauai_softc *sc = device_get_softc(dev); + struct ata_channel *ch; + int i, rid; #if USE_DBDMA_IRQ int dbdma_irq_rid = 1; struct resource *dbdma_irq; void *cookie; #endif + ch = &sc->sc_ch.sc_ch; + + rid = PCIR_BARS; + sc->sc_memr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->sc_memr == NULL) { + device_printf(dev, "could not allocate memory\n"); + return (ENXIO); + } + + /* + * Set up the resource vectors + */ + for (i = ATA_DATA; i <= ATA_COMMAND; i++) { + ch->r_io[i].res = sc->sc_memr; + ch->r_io[i].offset = i*ATA_KAUAI_REGGAP + ATA_KAUAI_REGOFFSET; + } + ch->r_io[ATA_CONTROL].res = sc->sc_memr; + ch->r_io[ATA_CONTROL].offset = ATA_KAUAI_ALTOFFSET; + ata_default_registers(dev); + + ch->unit = 0; + ch->flags |= ATA_USE_16BIT; + + /* XXX: ATAPI DMA is unreliable. We should find out why. */ + ch->flags |= ATA_NO_ATAPI_DMA; + ata_generic_hw(dev); + pci_enable_busmaster(dev); /* Init DMA engine */ Modified: head/sys/powerpc/powermac/ata_macio.c ============================================================================== --- head/sys/powerpc/powermac/ata_macio.c Tue Oct 15 18:07:23 2013 (r256554) +++ head/sys/powerpc/powermac/ata_macio.c Tue Oct 15 18:59:32 2013 (r256555) @@ -152,8 +152,6 @@ ata_macio_probe(device_t dev) const char *type = ofw_bus_get_type(dev); const char *name = ofw_bus_get_name(dev); struct ata_macio_softc *sc; - struct ata_channel *ch; - int rid, i; if (strcmp(type, "ata") != 0 && strcmp(type, "ide") != 0) @@ -161,7 +159,6 @@ ata_macio_probe(device_t dev) sc = device_get_softc(dev); bzero(sc, sizeof(struct ata_macio_softc)); - ch = &sc->sc_ch.sc_ch; if (strcmp(name,"ata-4") == 0) { device_set_desc(dev,"Apple MacIO Ultra ATA Controller"); @@ -173,7 +170,23 @@ ata_macio_probe(device_t dev) sc->max_mode = ATA_WDMA2; } + return (ata_probe(dev)); +} + +static int +ata_macio_attach(device_t dev) +{ + struct ata_macio_softc *sc = device_get_softc(dev); + uint32_t timingreg; + struct ata_channel *ch; + int rid, i; + + /* + * Allocate resources + */ + rid = 0; + ch = &sc->sc_ch.sc_ch; sc->sc_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->sc_mem == NULL) { @@ -196,15 +209,6 @@ ata_macio_probe(device_t dev) ch->flags |= ATA_USE_16BIT | ATA_NO_ATAPI_DMA; ata_generic_hw(dev); - return (ata_probe(dev)); -} - -static int -ata_macio_attach(device_t dev) -{ - struct ata_macio_softc *sc = device_get_softc(dev); - uint32_t timingreg; - #if USE_DBDMA_IRQ int dbdma_irq_rid = 1; struct resource *dbdma_irq; _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" Author: andreast Date: Mon Oct 21 19:11:15 2013 New Revision: 256857 URL: http://svnweb.freebsd.org/changeset/base/256857 Log: MFC: 256555 Move the resource allocation from the ata_*_probe section to the ata_*_attach section. This prevents a boot crash on nearly all iMacs and PowerMacs/Books. The allocation in the probe section was working before because ata_probe was returning 0 which did not invoke a second DEVICE_PROBE. Now it returns a BUS_PROBE_DEFAULT which can invoke a second DEVICE_PROBE which results in a "failed to reserve resource" exit. PR: powerpc/182978 Approved by: re(gjb) Modified: stable/10/sys/powerpc/powermac/ata_kauai.c stable/10/sys/powerpc/powermac/ata_macio.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/powerpc/powermac/ata_kauai.c ============================================================================== --- stable/10/sys/powerpc/powermac/ata_kauai.c Mon Oct 21 18:47:29 2013 (r256856) +++ stable/10/sys/powerpc/powermac/ata_kauai.c Mon Oct 21 19:11:15 2013 (r256857) @@ -194,12 +194,11 @@ static const u_int udma_timing_shasta[] static int ata_kauai_probe(device_t dev) { - struct ata_channel *ch; struct ata_kauai_softc *sc; u_int32_t devid; phandle_t node; const char *compatstring = NULL; - int i, found, rid; + int i, found; found = 0; devid = pci_get_devid(dev); @@ -216,7 +215,6 @@ ata_kauai_probe(device_t dev) node = ofw_bus_get_node(dev); sc = device_get_softc(dev); bzero(sc, sizeof(struct ata_kauai_softc)); - ch = &sc->sc_ch.sc_ch; compatstring = ofw_bus_get_compat(dev); if (compatstring != NULL && strcmp(compatstring,"shasta-ata") == 0) @@ -227,32 +225,6 @@ ata_kauai_probe(device_t dev) (compatstring == NULL || strcmp(compatstring, "K2-UATA") != 0)) bus_set_resource(dev, SYS_RES_IRQ, 0, 39, 1); - rid = PCIR_BARS; - sc->sc_memr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (sc->sc_memr == NULL) { - device_printf(dev, "could not allocate memory\n"); - return (ENXIO); - } - - /* - * Set up the resource vectors - */ - for (i = ATA_DATA; i <= ATA_COMMAND; i++) { - ch->r_io[i].res = sc->sc_memr; - ch->r_io[i].offset = i*ATA_KAUAI_REGGAP + ATA_KAUAI_REGOFFSET; - } - ch->r_io[ATA_CONTROL].res = sc->sc_memr; - ch->r_io[ATA_CONTROL].offset = ATA_KAUAI_ALTOFFSET; - ata_default_registers(dev); - - ch->unit = 0; - ch->flags |= ATA_USE_16BIT; - - /* XXX: ATAPI DMA is unreliable. We should find out why. */ - ch->flags |= ATA_NO_ATAPI_DMA; - ata_generic_hw(dev); - return (ata_probe(dev)); } @@ -272,12 +244,42 @@ static int ata_kauai_attach(device_t dev) { struct ata_kauai_softc *sc = device_get_softc(dev); + struct ata_channel *ch; + int i, rid; #if USE_DBDMA_IRQ int dbdma_irq_rid = 1; struct resource *dbdma_irq; void *cookie; #endif + ch = &sc->sc_ch.sc_ch; + + rid = PCIR_BARS; + sc->sc_memr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->sc_memr == NULL) { + device_printf(dev, "could not allocate memory\n"); + return (ENXIO); + } + + /* + * Set up the resource vectors + */ + for (i = ATA_DATA; i <= ATA_COMMAND; i++) { + ch->r_io[i].res = sc->sc_memr; + ch->r_io[i].offset = i*ATA_KAUAI_REGGAP + ATA_KAUAI_REGOFFSET; + } + ch->r_io[ATA_CONTROL].res = sc->sc_memr; + ch->r_io[ATA_CONTROL].offset = ATA_KAUAI_ALTOFFSET; + ata_default_registers(dev); + + ch->unit = 0; + ch->flags |= ATA_USE_16BIT; + + /* XXX: ATAPI DMA is unreliable. We should find out why. */ + ch->flags |= ATA_NO_ATAPI_DMA; + ata_generic_hw(dev); + pci_enable_busmaster(dev); /* Init DMA engine */ Modified: stable/10/sys/powerpc/powermac/ata_macio.c ============================================================================== --- stable/10/sys/powerpc/powermac/ata_macio.c Mon Oct 21 18:47:29 2013 (r256856) +++ stable/10/sys/powerpc/powermac/ata_macio.c Mon Oct 21 19:11:15 2013 (r256857) @@ -152,8 +152,6 @@ ata_macio_probe(device_t dev) const char *type = ofw_bus_get_type(dev); const char *name = ofw_bus_get_name(dev); struct ata_macio_softc *sc; - struct ata_channel *ch; - int rid, i; if (strcmp(type, "ata") != 0 && strcmp(type, "ide") != 0) @@ -161,7 +159,6 @@ ata_macio_probe(device_t dev) sc = device_get_softc(dev); bzero(sc, sizeof(struct ata_macio_softc)); - ch = &sc->sc_ch.sc_ch; if (strcmp(name,"ata-4") == 0) { device_set_desc(dev,"Apple MacIO Ultra ATA Controller"); @@ -173,7 +170,23 @@ ata_macio_probe(device_t dev) sc->max_mode = ATA_WDMA2; } + return (ata_probe(dev)); +} + +static int +ata_macio_attach(device_t dev) +{ + struct ata_macio_softc *sc = device_get_softc(dev); + uint32_t timingreg; + struct ata_channel *ch; + int rid, i; + + /* + * Allocate resources + */ + rid = 0; + ch = &sc->sc_ch.sc_ch; sc->sc_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->sc_mem == NULL) { @@ -196,15 +209,6 @@ ata_macio_probe(device_t dev) ch->flags |= ATA_USE_16BIT | ATA_NO_ATAPI_DMA; ata_generic_hw(dev); - return (ata_probe(dev)); -} - -static int -ata_macio_attach(device_t dev) -{ - struct ata_macio_softc *sc = device_get_softc(dev); - uint32_t timingreg; - #if USE_DBDMA_IRQ int dbdma_irq_rid = 1; struct resource *dbdma_irq; _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" Responsible Changed From-To: freebsd-ppc->andreast I'll take it. State Changed From-To: open->closed Committed. Thanks! |
After upgrading src to sources from Oct 10th, I cannot boot my powerpc64 machine any longer. The kernel panics during boot while, it seems, initializing the ATA device. Things work fine with the kernel details shown above (Oct 8th) but fail with a kernel from Oct 10th and also with a fresh kernel from today. The copy/pasted message I see is the following. Please excuse any typos as I had to get this from a very bad-quality picture I took from the screen right before the machine rebooted on its own... [...] ata0: <K2 Kauai ATA Controller> mem 0x80204000-0x80207fff irq 167 at device 13.0 on pci6 fatal kernel trap: exception = 0x400 (instruction storage interrupt) virtual address = 0xee00000000000000 srr0 = 0xee00000000000000 srr1 = 0x9000000040001032 lr = 0x87dad4 curthread = 0xd1c8e0 pid = 0, comm = swapper [thread pid 0 tid 100000] Stopped at 0xee00000000000000: fatal kernel trap: exception = 0x300 (data storage interrupt) virtual address = 0xee00000000000000 dsisr = 0x40000000 srr0 = 0x8913b8 srr1 = 0x9000000040001032 lr = 0x14c510 curthread = 0xd1c8e0 pid = 0, comm = swapper panic: sta storage interrupt trap cpuid = 0 KDB: stack backtrace: 0xc0000000000025d0: at .kdb_backtrace+0x5c ...: at .panic ...: at .trap_fatal ...: at .trap ...: at .powerpc_interrupt ...: kernel DSI read trap @ 0xee00000000000000 by .db_disasm+0x1c: srr1= 0x9000000000001032