From: Kirill A. Korinsky Subject: sys/qcpas: clearify errors when driver can't load firmware To: OpenBSD tech Date: Sat, 11 Jan 2025 16:24:39 +0100 tech@, When I debug my DTB for I had discovered that some error logging should be improved. qcpas expects that DTB contains two files which should be loaded as firmware, but in case of failure on the second one, it logs the first file name which may misslead. Additionally, expose return code of qcscm_pas_init_image. For example it allows to see 0xffcfffbb which means that means invalid signature. Ok? Index: sys/dev/fdt/qcpas.c =================================================================== RCS file: /home/cvs/src/sys/dev/fdt/qcpas.c,v diff -u -p -u -p -r1.8 qcpas.c --- sys/dev/fdt/qcpas.c 8 Nov 2024 21:13:34 -0000 1.8 +++ sys/dev/fdt/qcpas.c 11 Jan 2025 14:12:52 -0000 @@ -243,7 +243,8 @@ qcpas_mountroot(struct device *self) &dtb_fw, &dtb_fwlen); if (error) { printf("%s: failed to load %s: %d\n", - sc->sc_dev.dv_xname, fwname, error); + sc->sc_dev.dv_xname, + fwname + strlen(fwname) + 1, error); return; } } @@ -403,7 +404,7 @@ qcpas_mdt_init(struct qcpas_softc *sc, i Elf32_Ehdr *ehdr; Elf32_Phdr *phdr; paddr_t minpa = -1, maxpa = 0; - int i, hashseg = 0, relocate = 0; + int i, hashseg = 0, relocate = 0, rc; int error; ssize_t off; int idx; @@ -460,9 +461,10 @@ qcpas_mdt_init(struct qcpas_softc *sc, i membar_producer(); - if (qcscm_pas_init_image(pas_id, - QCPAS_DMA_DVA(sc->sc_metadata[idx])) != 0) { - printf("%s: init image failed\n", sc->sc_dev.dv_xname); + + rc = qcscm_pas_init_image(pas_id, QCPAS_DMA_DVA(sc->sc_metadata[idx])); + if (rc != 0) { + printf("%s: init image failed: 0x%x\n", sc->sc_dev.dv_xname, rc); qcpas_dmamem_free(sc, sc->sc_metadata[idx]); return EINVAL; } -- wbr, Kirill