nvidia.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* NVIDIA GPU support.
  2. *
  3. * The VBE mode set (vesa_stage.S) is all the *display* setup NVIDIA cards
  4. * need; the legacy VGA CRTC registers at 0x3D4/0x3D5 must not be touched
  5. * (see nvidia.c). This file identifies the card and maps its register
  6. * aperture (BAR0) so the chip can be named and the nv50-family (ION/MCP79)
  7. * display engine can be driven through it.
  8. */
  9. #ifndef NVIDIA_H
  10. #define NVIDIA_H
  11. /* Identify the NVIDIA adapter at bus/dev and map its register aperture.
  12. * device_id = high 16 bits of PCI config 0x00 (e.g. 0x087D for ION). */
  13. void nvidia_init(unsigned int bus, unsigned int dev, unsigned int device_id);
  14. /* 1 when the register aperture was mapped and NV_PMC_BOOT_0 looks valid. */
  15. int nvidia_available(void);
  16. /* Human-readable device name ("C79 [ION]", "GM206 [GeForce GTX 960]", ...). */
  17. const char *nvidia_chip_name(void);
  18. /* NV_PMC_BOOT_0 chipset id (0 when MMIO could not be validated). */
  19. unsigned int nvidia_chipset(void);
  20. /* BAR0 register aperture / BAR1 VRAM window / BAR3 VBE window bases
  21. * (0 = absent) and their probed sizes. */
  22. unsigned int nvidia_bar0(void);
  23. /* Kernel mapping of BAR0 (the register aperture), 0 when absent. */
  24. unsigned int nvidia_regs(void);
  25. unsigned int nvidia_bar1(void);
  26. unsigned int nvidia_bar1_size(void);
  27. unsigned int nvidia_bar3(void);
  28. unsigned int nvidia_bar3_size(void);
  29. /* Stolen-VRAM geometry (MCP77/79/89): physical base and size in bytes
  30. * (0 when not applicable). VRAM addresses used by the display engine are
  31. * relative to this base. */
  32. unsigned int nvidia_vram_base(void);
  33. unsigned int nvidia_vram_size(void);
  34. /* The VBE LFB is a window into the stolen VRAM, which is ordinary DRAM and
  35. * therefore much faster to write than the PCIe aperture. Locates the
  36. * framebuffer in the stolen VRAM by writing a marker through the LFB and
  37. * scanning the (now cacheably mapped) VRAM at page granularity. Returns the
  38. * kernel (ioremap) address of the framebuffer in the stolen VRAM, or 0 when
  39. * not applicable. */
  40. unsigned int nvidia_lfb_in_vram(void);
  41. #endif