Hello Michael,
On Thu, Oct 21, 2021, 19:55 Michael wrote:
> Hello,
>
> On Wed, 20 Oct 2021 08:26:25 +
> Riza Dindir wrote:
>
> > I am using NetBSD 9.2 (amd64). I have a laptop that has a radeon r7
> > m265 video card (vendor 0x1002, product 0x6604). The system does not
> > recognize this card. It fails with this message:
> >
> > kern error:
> [drm:(/export/netbsd/src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:725)radeon_get_bios]
> > *ERROR* Unable to locate a BIOS ROM
> > radeon0: autoconfiguration error: error: Fatal error during GPU init
> > radeon0: autoconfiguration error: unable to attach drm: 22
> >
> > I wanted to see if I can read the bios of that card and added some
> > test functions to the file mentioned above. The code is as such:
> >
> > pci_conf_capture(rdev->pdev->pd_pa.pa_pc, rdev->pdev->pd_pa.pa_tag,
> > );
> >
> > address = PCI_MAPREG_ROM_ADDR(conf.reg[12]);
> > size = PCI_MAPREG_ROM_SIZE(address);
> > DRM_INFO("rom addr: %x, rom size: %lu\n", address, size);
> >
> > result = bus_space_map(rdev->pdev->pd_pa.pa_memt,
> > PCI_MAPREG_ROM_ADDR(address),
> > size, BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE, );
> > DRM_INFO("result of bus_space_map(): %d\n", result);
> >
> > bios = (uint8_t *)bus_space_vaddr(rdev->pdev->pd_pa.pa_memt,
> > romh);
> > DRM_INFO("bios: %p\n", bios);
> > if (bios != NULL) {
> > DRM_INFO("bios[0]: %X, bios[1]: %X\n", bios[0], bios[1]);
> > } else {
> > DRM_INFO("bios was NULL\n");
> > }
> >
> > The bus_space_map function returns code 35. Maybe I am doing something
> > wrong in the code when I try to read the "expansion rom" of the pci
> > card. Anyone has an idea? How should I read the "expansion rom" of a
> > PCI card?
>
> Is there something sensible in the ROM BAR? If it's NULL the
>
The rom bar register has a value of fffe. That means the rim decoder is
not enabled i think.
bus_space_map() would fail. It also needs to be enabled in the BAR,
> which it may or may not be already. Then pray that your chip has
>
You mean the first bit (bit 0) should be 1 to enable the rom. Right?
If the address is the address i gave above and the rom decoder enable is
set to true (or 1), then the bus_space_map must succeed. Will try that.
separate decoders for ROM and regular BARs - the specs allow them to
> share one which would mean you can not access the rest of the card if
> the ROM is enabled - you're meant to turn it on, copy the ROM's
> content, turn it off and run the BIOS from RAM.
> Finally, I've seen laptops with no separate graphics BIOS at all...
>
> have fun
> Michael
>