summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/vga_pci.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r284012:hselasky2015-06-171-0/+7
| | | | | | | | Disable VGA PCI interrupts until a chipset driver is loaded for VGA PCI devices. Else unhandled display adapter interrupts might freeze the CPU or consume a lot of CPU. PR: 156596
* MFC 261517,261520:jhb2014-02-181-3/+0
| | | | | Convert the license on files where I am the sole copyright holder to 2 clause BSD licenses.
* MFC r259679:dumbbell2013-12-221-17/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vga_pci: Improve boot display detection The previous code was checking the "VGA Enable" bit on the video card's parent PCI-to-PCI bridge only. This didn't work for the case where the video card is attached to the root PCI bus (ie. the card has no parent PCI-to-PCI bridge). Now, the new code: 1. checks the "VGA Enable" bit on the parent bridge only if it's a PCI-to-PCI bridge; 2. always checks the "I/O" and "Memory address space decoding" bits on the video card itself. However, vendor-specific bits are not used. This fixes the use of many integrated Radeon cards: without this patch, we fail to detect them as the boot display and, when radeonkms looks for the Video BIOS, it skips the shadow copy made by the System BIOS. It then fails to fully initialize the card, because the shadow copy is the only way to read the Video BIOS in these situations. A workaround was to force the boot display selection using the "hw.pci.default_vgapci_unit" tunable. A previous version of this patch added a new function doing the checks. Now, the vga_pci_is_boot_display() function is used to perform the checks (only until the boot display is found) and return if the given device is the boot display or not. Furthermore, vga_pci_attach() logs "Boot video device" if the card being attached it the Chosen One: vgapci0: <VGA-compatible display> [...] vgapci0: Boot video device Reviewed by: kib@, jhb@ (both a previous version) Tested by: lunatic_ (#freebsd-xorg, integrated Radeon card, xmj (#freebsd-xorg, i915+NVIDIA cards)
* vgapci: Use vga_pci_alloc_resource() to map PCI Expansion ROMdumbbell2013-09-141-22/+17
| | | | | | | | This is cleaner and fixes Video BIOS mapping when the given device isn't the boot display. Submitted by: jhb@ Approved by: re (kib)
* vga_pci: Remove left-over debugging printf()'sdumbbell2013-08-251-4/+0
|
* vga_pci: Add API to map the Video BIOSdumbbell2013-08-251-0/+98
| | | | | | | | | | | | | | Here are two new functions to map and unmap the Video BIOS: void * vga_pci_map_bios(device_t dev, size_t *size); void vga_pci_unmap_bios(device_t dev, void *bios); The BIOS is either taken from the shadow copy made by the System BIOS at boot time if the given device was used for the default display (i386, amd64 and ia64 only), or from the PCI expansion ROM. Additionally, one can determine if a given device was the default display at boot time using the following new function: void vga_pci_unmap_bios(device_t dev, void *bios);
* Usnure that PCI bus BIS_GET_DMA_TAG() method sees the actual PCIkib2013-04-141-0/+8
| | | | | | | | | | | device which makes the request for dma tag, instead of some descendant of the PCI device, by creating a pass-through trampoline for vga_pci and ata_pci buses. Sponsored by: The FreeBSD Foundation Suggested by: jhb Discussed with: jhb, mav MFC after: 1 week
* Proxy allocation requests for the PCI ROM BAR from child devices similarjhb2013-04-091-25/+35
| | | | | | | to how the VGA bus driver currently proxies allocation requests for other PCI BARs. MFC after: 1 week
* Add 'drmn' device as another drm child, to allow drm2 drivers to livekib2012-05-231-0/+1
| | | | | | | in parallel with drm1. Sponsored by: The FreeBSD Foundation MFC after: 1 month
* Expand the set of APIs available for locating PCI capabilities:jhb2012-03-031-0/+18
| | | | | | | | | - pci_find_extcap() is repurposed to be used for fetching PCI-express extended capabilities (PCIZ_* constants in <dev/pci/pcireg.h>). - pci_find_htcap() can be used to locate a specific HyperTransport capability (PCIM_HTCAP_* constants in <dev/pci/pcireg.h>). - Cache the starting location of the PCI-express capability for PCI-express devices in PCI device ivars.
* Don't whine about child drivers calling pci_enable_busmaster(). That isjhb2010-12-201-4/+0
| | | | | | perfectly normal. MFC after: 1 week
* Small whitespace fixes.jhb2010-03-111-2/+1
|
* - Partially revert hackish r198964 and r199002.jkim2009-11-121-13/+0
| | | | | | | - Add a proxy driver vgapm to help vgapci to save/load VGA state. - Move device_set_desc() to the right place while we are here. Reviewed by: jhb
* Remove duplicate suspend/resume code from vga_pci.c and let vga(4) registerjkim2009-11-061-76/+11
| | | | | | itself to an associated PCI device if it exists. It is little bit hackish but it should fix build without frame buffer driver since r198964. Fix some style(9) nits in vga_isa.c while we are here.
* Save/restore VGA state from vga_pci.c instead of relying on vga_isa.c.jkim2009-11-051-2/+80
| | | | | It was not working because we were saving its state after the device was powered down. Simplify vesa_load_state() as the culprit is fixed now.
* Rewrite x86bios and update its dependent drivers.jkim2009-10-191-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Do not map entire real mode memory (1MB). Instead, we map IVT/BDA and ROM area separately. Most notably, ROM area is mapped as device memory (uncacheable) as it should be. User memory is dynamically allocated and free'ed with contigmalloc(9) and contigfree(9). Remove now redundant and potentially dangerous x86bios_alloc.c. If this emulator ever grows to support non-PC hardware, we may implement it with rman(9) later. - Move all host-specific initializations from x86emu_util.c to x86bios.c and remove now unnecessary x86emu_util.c. Currently, non-PC hardware is not supported. We may use bus_space(9) later when the KPI is fixed. - Replace all bzero() calls for emulated registers with more obviously named x86bios_init_regs(). This function also initializes DS and SS properly. - Add x86bios_get_intr(). This function checks if the interrupt vector is available for the platform. It is not necessary for PC-compatible hardware but it may be needed later. ;-) - Do not try turning off monitor if DPMS does not support the state. - Allocate stable memory for VESA OEM strings instead of just holding pointers to them. They may or may not be accessible always. Fix a memory leak of video mode table while I am here. - Add (experimental) BIOS POST call for vesa(4). This function calls VGA BIOS POST code from the current VGA option ROM. Some video controllers cannot save and restore the state properly even if it is claimed to be supported. Usually the symptom is blank display after resuming from suspend state. If the video mode does not match the previous mode after restoring, we try BIOS POST and force the known good initial state. Some magic was taken from NetBSD (and it was taken from vbetool, I believe.) - Add a loader tunable for vgapci(4) to give a hint to dpms(4) and vesa(4) to identify who owns the VESA BIOS. This is very useful for multi-display adapter setup. By default, the POST video controller is automatically probed and the tunable "hw.pci.default_vgapci_unit" is set to corresponding vgapci unit number. You may override it from loader but it is very unlikely to be necessary. Unfortunately only AGP/PCI/PCI-E controllers can be matched because ISA controller does not have necessary device IDs. - Fix a long standing bug in state save/restore function. The state buffer pointer should be ES:BX, not ES:DI according to VBE 3.0. If it ever worked, that's because BX was always zero. :-) - Clean up register initializations more clearer per VBE 3.0. - Fix a lot of style issues with vesa(4).
* The recent PCI resource allocation fixes exposed a bug where the samejhb2009-03-041-1/+60
| | | | | | | | BAR could be allocated twice by different children of a vgapci0 device. To fix this, change the vgapci0 device to track references on its associated resources so that they are only allocated once from the parent PCI bus and released when no children are using them. Previously this leaked a small amount of KVA on at least some architectures.
* pci_setup_intr() will only enable MSI/MSI-X for direct children. Add methodsrnoland2008-09-191-2/+18
| | | | | | | to vga_pci.c to request on behalf of it's children. This causes vgapci to show up as the interrupt owner in vmstat -i, rather than the child device. Approved by: jhb(mentor)
* Allow child devices of vgapci(4) to query VPD strings and use MSI/MSI-Xjhb2008-09-161-1/+99
| | | | | | | interrupts. For the MSI/MSI-X case, we only allow 1 child device to use MSI or MSI-X at a time. Tested by: rnoland
* Don't add an agp child in vgapci's attach routine if the PCIY_AGPjhb2006-02-011-7/+0
| | | | | | | capability is present as not all devices supported by the agp_i810 driver (such as i915) have the AGP capability. Instead, add an identify routine to the agp_i810 driver that uses the PCI ID to determine if it should create an agp child device.
* Return BUS_PROBE_GENERIC rather than 0 in the probe routine.jhb2005-12-221-1/+1
| | | | Requested by: marius
* Add a vgapci(4) stub device driver for VGA PCI devices. This device servesjhb2005-12-201-0/+262
| | | | | | | as a bus so that other drivers such as drm(4), acpi_video(4), and agp(4) can attach to it thus allowing multiple drivers for the same device. It also removes the need for the drmsub hack for the i8[13]0/i915 drm and agp drivers.
* Remove vga_pci generic driver.nsouch2001-01-051-75/+0
| | | | Approved by: Mike Smith <msmith@freebsd.org>
* Next phase in the PCI subsystem cleanup.msmith2000-12-081-0/+75
- Move PCI core code to dev/pci. - Split bridge code out into separate modules. - Remove the descriptive strings from the bridge drivers. If you want to know what a device is, use pciconf. Add support for broadly identifying devices based on class/subclass, and for parsing a preloaded device identification database so that if you want to waste the memory, you can identify *anything* we know about. - Remove machine-dependant code from the core PCI code. APIC interrupt mapping is performed by shadowing the intline register in machine- dependant code. - Bring interrupt routing support to the Alpha (although many platforms don't yet support routing or mapping interrupts entirely correctly). This resulted in spamming <sys/bus.h> into more places than it really should have gone. - Put sys/dev on the kernel/modules include path. This avoids having to change *all* the pci*.h includes.
OpenPOWER on IntegriCloud