Commit da96ec97 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Dave Jones

[AGP] factor device command updates

parent 695dac8a
...@@ -435,11 +435,7 @@ static void agp_x86_64_agp_enable(u32 mode) ...@@ -435,11 +435,7 @@ static void agp_x86_64_agp_enable(u32 mode)
* command registers. * command registers.
*/ */
pci_for_each_dev(device) { agp_device_command(command);
cap_ptr = pci_find_capability(device, PCI_CAP_ID_AGP);
if (cap_ptr != 0x00)
pci_write_config_dword(device, cap_ptr + 8, command);
}
} }
......
...@@ -313,6 +313,20 @@ int agp_unbind_memory(agp_memory * curr) ...@@ -313,6 +313,20 @@ int agp_unbind_memory(agp_memory * curr)
/* Generic Agp routines - Start */ /* Generic Agp routines - Start */
void agp_device_command(u32 command)
{
struct pci_dev *device;
pci_for_each_dev(device) {
u8 agp = pci_find_capability(device, PCI_CAP_ID_AGP);
if (!agp)
continue;
pci_write_config_dword(device, agp + 8, command);
}
}
void agp_generic_agp_enable(u32 mode) void agp_generic_agp_enable(u32 mode)
{ {
struct pci_dev *device = NULL; struct pci_dev *device = NULL;
...@@ -395,11 +409,7 @@ void agp_generic_agp_enable(u32 mode) ...@@ -395,11 +409,7 @@ void agp_generic_agp_enable(u32 mode)
* command registers. * command registers.
*/ */
pci_for_each_dev(device) { agp_device_command(command);
cap_ptr = pci_find_capability(device, PCI_CAP_ID_AGP);
if (cap_ptr != 0x00)
pci_write_config_dword(device, cap_ptr + 8, command);
}
} }
int agp_generic_create_gatt_table(void) int agp_generic_create_gatt_table(void)
......
...@@ -506,11 +506,7 @@ static void serverworks_agp_enable(u32 mode) ...@@ -506,11 +506,7 @@ static void serverworks_agp_enable(u32 mode)
* command registers. * command registers.
*/ */
pci_for_each_dev(device) { agp_device_command(command);
cap_ptr = pci_find_capability(device, PCI_CAP_ID_AGP);
if (cap_ptr != 0x00)
pci_write_config_dword(device, cap_ptr + 8, command);
}
} }
static int __init serverworks_setup (struct pci_dev *pdev) static int __init serverworks_setup (struct pci_dev *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment