Commit 46baaa69 authored by Dave Jones's avatar Dave Jones

[AGPGART] Add symbolic constants for AGP mode setting.

bye bye icky hardcoded values.
parent c21c1ae1
...@@ -412,4 +412,11 @@ u32 agp_collect_device_status(u32 mode, u32 command); ...@@ -412,4 +412,11 @@ u32 agp_collect_device_status(u32 mode, u32 command);
void agp_device_command(u32 command, int agp_v3); void agp_device_command(u32 command, int agp_v3);
int agp_3_0_node_enable(u32 mode, u32 minor); int agp_3_0_node_enable(u32 mode, u32 minor);
#define AGPSTAT_RQ_DEPTH (0xff000000)
#define AGPSTAT_SBA (1<<9)
#define AGPSTAT_FW (1<<4)
#define AGPSTAT2_4X (1<<2)
#define AGPSTAT2_2X (1<<1)
#define AGPSTAT2_1X (1)
#endif /* _AGP_BACKEND_PRIV_H */ #endif /* _AGP_BACKEND_PRIV_H */
...@@ -328,47 +328,39 @@ u32 agp_collect_device_status(u32 mode, u32 command) ...@@ -328,47 +328,39 @@ u32 agp_collect_device_status(u32 mode, u32 command)
pci_read_config_dword(device, agp + PCI_AGP_STATUS, &scratch); pci_read_config_dword(device, agp + PCI_AGP_STATUS, &scratch);
/* adjust RQ depth */ /* adjust RQ depth */
command = ((command & ~0xff000000) | command = ((command & ~AGPSTAT_RQ_DEPTH) |
min_t(u32, (mode & 0xff000000), min_t(u32, (mode & AGPSTAT_RQ_DEPTH),
min_t(u32, (command & 0xff000000), min_t(u32, (command & AGPSTAT_RQ_DEPTH),
(scratch & 0xff000000)))); (scratch & AGPSTAT_RQ_DEPTH))));
/* disable SBA if it's not supported */ /* disable SBA if it's not supported */
if (!((command & 0x00000200) && if (!((command & AGPSTAT_SBA) && (scratch & AGPSTAT_SBA) && (mode & AGPSTAT_SBA)))
(scratch & 0x00000200) && command &= ~AGPSTAT_SBA;
(mode & 0x00000200)))
command &= ~0x00000200;
/* disable FW if it's not supported */ /* disable FW if it's not supported */
if (!((command & 0x00000010) && if (!((command & AGPSTAT_FW) && (scratch & AGPSTAT_FW) && (mode & AGPSTAT_FW)))
(scratch & 0x00000010) && command &= ~AGPSTAT_FW;
(mode & 0x00000010)))
command &= ~0x00000010; /* Set speed */
if (!((command & AGPSTAT2_4X) && (scratch & AGPSTAT2_4X) && (mode & AGPSTAT2_4X)))
if (!((command & 4) && command &= ~AGPSTAT2_4X;
(scratch & 4) &&
(mode & 4))) if (!((command & AGPSTAT2_2X) && (scratch & AGPSTAT2_2X) && (mode & AGPSTAT2_2X)))
command &= ~0x00000004; command &= ~AGPSTAT2_2X;
if (!((command & 2) && if (!((command & AGPSTAT2_1X) && (scratch & AGPSTAT2_1X) && (mode & AGPSTAT2_1X)))
(scratch & 2) && command &= ~AGPSTAT2_1X;
(mode & 2)))
command &= ~0x00000002;
if (!((command & 1) &&
(scratch & 1) &&
(mode & 1)))
command &= ~0x00000001;
} }
if (command & 4) /* Now we know what mode it should be, clear out the unwanted bits. */
command &= ~3; /* 4X */ if (command & AGPSTAT2_4X)
command &= ~(AGPSTAT2_1X | AGPSTAT2_2X); /* 4X */
if (command & 2) if (command & AGPSTAT2_2X)
command &= ~5; /* 2X (8X for AGP3.0) */ command &= ~(AGPSTAT2_1X | AGPSTAT2_4X); /* 2X */
if (command & 1) if (command & AGPSTAT2_1X)
command &= ~6; /* 1X (4X for AGP3.0) */ command &= ~(AGPSTAT2_2X | AGPSTAT2_4X); /* 1Xf */
return command; return command;
} }
......
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