> Date: Fri, 4 Feb 2022 19:33:08 +0000 > From: Miod Vallat <m...@online.fr> > > > After printing information via "doas pcidump -v" on device PCI > > 0:0:27:0 "Intel 82801GB HD Audio", kernel panics. Sorry, I used OCR > > software to recognize the text from the photo of the screen, maybe > > there are some errors in hex numbers. Photo is attached. > > The following diff, while not fixing the cause of the problem, ought to > prevent the kernel from panicing.
I don't think making that call silently fail is a good idea though. > Does audio (azalia0) work correctly on your system? > > Miod > > Index: amd64/pci/pci_machdep.c > =================================================================== > RCS file: /OpenBSD/src/sys/arch/amd64/pci/pci_machdep.c,v > retrieving revision 1.77 > diff -u -p -r1.77 pci_machdep.c > --- amd64/pci/pci_machdep.c 11 Mar 2021 11:16:55 -0000 1.77 > +++ amd64/pci/pci_machdep.c 4 Feb 2022 19:31:36 -0000 > @@ -213,15 +213,14 @@ pci_conf_size(pci_chipset_tag_t pc, pcit > return PCI_CONFIG_SPACE_SIZE; > } > > -void > +int > pci_mcfg_map_bus(int bus) > { > if (pci_mcfgh[bus]) > - return; > + return 0; > > - if (bus_space_map(pci_mcfgt, pci_mcfg_addr + (bus << 20), 1 << 20, > - 0, &pci_mcfgh[bus])) > - panic("pci_conf_read: cannot map mcfg space"); > + return bus_space_map(pci_mcfgt, pci_mcfg_addr + (bus << 20), 1 << 20, > + 0, &pci_mcfgh[bus]); > } > > pcireg_t > @@ -235,7 +234,8 @@ pci_conf_read(pci_chipset_tag_t pc, pcit > if (pci_mcfg_addr && reg >= PCI_CONFIG_SPACE_SIZE) { > pci_decompose_tag(pc, tag, &bus, NULL, NULL); > if (bus >= pci_mcfg_min_bus && bus <= pci_mcfg_max_bus) { > - pci_mcfg_map_bus(bus); > + if (pci_mcfg_map_bus(bus) != 0) > + return 0xffffffff; > data = bus_space_read_4(pci_mcfgt, pci_mcfgh[bus], > (tag & 0x000ff00) << 4 | reg); > return data; > @@ -261,7 +261,8 @@ pci_conf_write(pci_chipset_tag_t pc, pci > if (pci_mcfg_addr && reg >= PCI_CONFIG_SPACE_SIZE) { > pci_decompose_tag(pc, tag, &bus, NULL, NULL); > if (bus >= pci_mcfg_min_bus && bus <= pci_mcfg_max_bus) { > - pci_mcfg_map_bus(bus); > + if (pci_mcfg_map_bus(bus) != 0) > + return; > bus_space_write_4(pci_mcfgt, pci_mcfgh[bus], > (tag & 0x000ff00) << 4 | reg, data); > return; > Index: i386/pci/pci_machdep.c > =================================================================== > RCS file: /OpenBSD/src/sys/arch/i386/pci/pci_machdep.c,v > retrieving revision 1.87 > diff -u -p -r1.87 pci_machdep.c > --- i386/pci/pci_machdep.c 11 Mar 2021 11:16:57 -0000 1.87 > +++ i386/pci/pci_machdep.c 4 Feb 2022 19:31:36 -0000 > @@ -127,7 +127,7 @@ bus_addr_t pci_mcfg_addr; > int pci_mcfg_min_bus, pci_mcfg_max_bus; > bus_space_tag_t pci_mcfgt = I386_BUS_SPACE_MEM; > bus_space_handle_t pci_mcfgh[256]; > -void pci_mcfg_map_bus(int); > +int pci_mcfg_map_bus(int); > > struct mutex pci_conf_lock = MUTEX_INITIALIZER(IPL_HIGH); > > @@ -420,15 +420,14 @@ pci_conf_size(pci_chipset_tag_t pc, pcit > return PCI_CONFIG_SPACE_SIZE; > } > > -void > +int > pci_mcfg_map_bus(int bus) > { > if (pci_mcfgh[bus]) > - return; > + return 0; > > - if (bus_space_map(pci_mcfgt, pci_mcfg_addr + (bus << 20), 1 << 20, > - 0, &pci_mcfgh[bus])) > - panic("pci_conf_read: cannot map mcfg space"); > + return bus_space_map(pci_mcfgt, pci_mcfg_addr + (bus << 20), 1 << 20, > + 0, &pci_mcfgh[bus]); > } > > pcireg_t > @@ -442,7 +441,8 @@ pci_conf_read(pci_chipset_tag_t pc, pcit > if (pci_mcfg_addr && reg >= PCI_CONFIG_SPACE_SIZE) { > pci_decompose_tag(pc, tag, &bus, NULL, NULL); > if (bus >= pci_mcfg_min_bus && bus <= pci_mcfg_max_bus) { > - pci_mcfg_map_bus(bus); > + if (pci_mcfg_map_bus(bus) != 0) > + return 0xffffffff; > data = bus_space_read_4(pci_mcfgt, pci_mcfgh[bus], > (tag.mode1 & 0x000ff00) << 4 | reg); > return data; > @@ -480,7 +480,8 @@ pci_conf_write(pci_chipset_tag_t pc, pci > if (pci_mcfg_addr && reg >= PCI_CONFIG_SPACE_SIZE) { > pci_decompose_tag(pc, tag, &bus, NULL, NULL); > if (bus >= pci_mcfg_min_bus && bus <= pci_mcfg_max_bus) { > - pci_mcfg_map_bus(bus); > + if (pci_mcfg_map_bus(bus) != 0) > + return; > bus_space_write_4(pci_mcfgt, pci_mcfgh[bus], > (tag.mode1 & 0x000ff00) << 4 | reg, data); > return; > >