summaryrefslogtreecommitdiff
path: root/src/mga_bios.c
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2007-08-22 10:43:39 -0700
committerIan Romanick <idr@us.ibm.com>2007-08-22 10:43:39 -0700
commit55d219394ad6af8e25ff604bcbb49d5a551bd348 (patch)
tree0a6c6e83a297e049d7a55abbeaaad61c61d9b53b /src/mga_bios.c
parentf4ef39d53d5a67942707507814fef4ad466dc909 (diff)
Merge PCI-rework support and "classic" PCI interface support into one tree
First pass at merging both trees. So far, this has only been tested on the PCI-rework build on a PCI G450.
Diffstat (limited to 'src/mga_bios.c')
-rw-r--r--src/mga_bios.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/mga_bios.c b/src/mga_bios.c
index 34dcf7a..46a8c46 100644
--- a/src/mga_bios.c
+++ b/src/mga_bios.c
@@ -406,9 +406,12 @@ static void mga_parse_bios_ver_5( struct mga_bios_values * bios,
Bool mga_read_and_process_bios( ScrnInfoPtr pScrn )
{
- CARD8 bios_data[0x10000];
+ CARD8 bios_data[0x20000];
unsigned offset;
MGAPtr pMga = MGAPTR(pScrn);
+#ifndef PCIACCESS
+ Bool pciBIOS = TRUE;
+#endif
int rlen;
static const unsigned expected_length[] = { 0, 64, 64, 64, 128, 128 };
unsigned version;
@@ -443,7 +446,28 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn )
* might be controlled by the PCI config space.
*/
+#ifdef PCIACCESS
err = pci_device_read_rom(pMga->PciInfo, bios_data);
+#else
+ if (pMga->BiosFrom == X_DEFAULT) {
+ pciBIOS = FALSE;
+ }
+ else if (pMga->BiosFrom == X_CONFIG && pMga->BiosAddress < 0x100000) {
+ pciBIOS = TRUE;
+ }
+
+ if (pciBIOS) {
+ rlen = xf86ReadPciBIOS(0, pMga->PciTag, pMga->framebuffer_bar,
+ bios_data, sizeof(bios_data));
+ }
+ else {
+ rlen = xf86ReadDomainMemory(pMga->PciTag, pMga->BiosAddress,
+ sizeof(bios_data), bios_data);
+ }
+
+ err = rlen < (bios_data[2] << 9);
+#endif
+
if (err) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Could not retrieve video BIOS!\n");