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, 14 insertions, 11 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 22c9b27fdd8d..56098b3e17c0 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3284,31 +3284,34 @@ static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode,
3284 * @dev: the PCI device 3284 * @dev: the PCI device
3285 * @decode: true = enable decoding, false = disable decoding 3285 * @decode: true = enable decoding, false = disable decoding
3286 * @command_bits: PCI_COMMAND_IO and/or PCI_COMMAND_MEMORY 3286 * @command_bits: PCI_COMMAND_IO and/or PCI_COMMAND_MEMORY
3287 * @change_bridge: traverse ancestors and change bridges 3287 * @change_bridge_flags: traverse ancestors and change bridges
3288 * CHANGE_BRIDGE_ONLY / CHANGE_BRIDGE
3288 */ 3289 */
3289int pci_set_vga_state(struct pci_dev *dev, bool decode, 3290int pci_set_vga_state(struct pci_dev *dev, bool decode,
3290 unsigned int command_bits, bool change_bridge) 3291 unsigned int command_bits, u32 flags)
3291{ 3292{
3292 struct pci_bus *bus; 3293 struct pci_bus *bus;
3293 struct pci_dev *bridge; 3294 struct pci_dev *bridge;
3294 u16 cmd; 3295 u16 cmd;
3295 int rc; 3296 int rc;
3296 3297
3297 WARN_ON(command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)); 3298 WARN_ON((flags & PCI_VGA_STATE_CHANGE_DECODES) & (command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)));
3298 3299
3299 /* ARCH specific VGA enables */ 3300 /* ARCH specific VGA enables */
3300 rc = pci_set_vga_state_arch(dev, decode, command_bits, change_bridge); 3301 rc = pci_set_vga_state_arch(dev, decode, command_bits, flags);
3301 if (rc) 3302 if (rc)
3302 return rc; 3303 return rc;
3303 3304
3304 pci_read_config_word(dev, PCI_COMMAND, &cmd); 3305 if (flags & PCI_VGA_STATE_CHANGE_DECODES) {
3305 if (decode == true) 3306 pci_read_config_word(dev, PCI_COMMAND, &cmd);
3306 cmd |= command_bits; 3307 if (decode == true)
3307 else 3308 cmd |= command_bits;
3308 cmd &= ~command_bits; 3309 else
3309 pci_write_config_word(dev, PCI_COMMAND, cmd); 3310 cmd &= ~command_bits;
3311 pci_write_config_word(dev, PCI_COMMAND, cmd);
3312 }
3310 3313
3311 if (change_bridge == false) 3314 if (!(flags & PCI_VGA_STATE_CHANGE_BRIDGE))
3312 return 0; 3315 return 0;
3313 3316
3314 bus = dev->bus; 3317 bus = dev->bus;