aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 2b9ac9e594af..5b548aee9cbc 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2754,6 +2754,23 @@ int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type)
2754 return 0; 2754 return 0;
2755} 2755}
2756 2756
2757/* Some architectures require additional programming to enable VGA */
2758static arch_set_vga_state_t arch_set_vga_state;
2759
2760void __init pci_register_set_vga_state(arch_set_vga_state_t func)
2761{
2762 arch_set_vga_state = func; /* NULL disables */
2763}
2764
2765static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode,
2766 unsigned int command_bits, bool change_bridge)
2767{
2768 if (arch_set_vga_state)
2769 return arch_set_vga_state(dev, decode, command_bits,
2770 change_bridge);
2771 return 0;
2772}
2773
2757/** 2774/**
2758 * pci_set_vga_state - set VGA decode state on device and parents if requested 2775 * pci_set_vga_state - set VGA decode state on device and parents if requested
2759 * @dev: the PCI device 2776 * @dev: the PCI device
@@ -2767,9 +2784,15 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
2767 struct pci_bus *bus; 2784 struct pci_bus *bus;
2768 struct pci_dev *bridge; 2785 struct pci_dev *bridge;
2769 u16 cmd; 2786 u16 cmd;
2787 int rc;
2770 2788
2771 WARN_ON(command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)); 2789 WARN_ON(command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY));
2772 2790
2791 /* ARCH specific VGA enables */
2792 rc = pci_set_vga_state_arch(dev, decode, command_bits, change_bridge);
2793 if (rc)
2794 return rc;
2795
2773 pci_read_config_word(dev, PCI_COMMAND, &cmd); 2796 pci_read_config_word(dev, PCI_COMMAND, &cmd);
2774 if (decode == true) 2797 if (decode == true)
2775 cmd |= command_bits; 2798 cmd |= command_bits;
@@ -2984,6 +3007,7 @@ EXPORT_SYMBOL(pcim_pin_device);
2984EXPORT_SYMBOL(pci_disable_device); 3007EXPORT_SYMBOL(pci_disable_device);
2985EXPORT_SYMBOL(pci_find_capability); 3008EXPORT_SYMBOL(pci_find_capability);
2986EXPORT_SYMBOL(pci_bus_find_capability); 3009EXPORT_SYMBOL(pci_bus_find_capability);
3010EXPORT_SYMBOL(pci_register_set_vga_state);
2987EXPORT_SYMBOL(pci_release_regions); 3011EXPORT_SYMBOL(pci_release_regions);
2988EXPORT_SYMBOL(pci_request_regions); 3012EXPORT_SYMBOL(pci_request_regions);
2989EXPORT_SYMBOL(pci_request_regions_exclusive); 3013EXPORT_SYMBOL(pci_request_regions_exclusive);
@@ -3015,4 +3039,3 @@ EXPORT_SYMBOL(pci_target_state);
3015EXPORT_SYMBOL(pci_prepare_to_sleep); 3039EXPORT_SYMBOL(pci_prepare_to_sleep);
3016EXPORT_SYMBOL(pci_back_from_sleep); 3040EXPORT_SYMBOL(pci_back_from_sleep);
3017EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state); 3041EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state);
3018