tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Trying to access the Expansion ROM of a video card



Hello,

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,
      &conf);

  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, &romh);
  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?

Best Regards,
Riza Dindir


Home | Main Index | Thread Index | Old Index