diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2008-01-23 21:32:51 -0800 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2008-01-24 15:02:41 -0800 |
commit | 62ff129257161db99dc4056cf16aa196ccfbc921 (patch) | |
tree | 508b158d9308624b913ee66f275d9da7b6e9ac96 /src/g80_output.c | |
parent | 28f34db87cefdc6b327a98db43da5b4fefe3bdd8 (diff) |
Fix more load detection false positives.
Diffstat (limited to 'src/g80_output.c')
-rw-r--r-- | src/g80_output.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/g80_output.c b/src/g80_output.c index 1ec6a89..53c0954 100644 --- a/src/g80_output.c +++ b/src/g80_output.c @@ -32,6 +32,41 @@ #include "g80_display.h" #include "g80_output.h" +static CARD32 G80FindLoadVal(const unsigned char *table1) +{ + const unsigned char *p = table1; + int count; + const CARD32 def = 340; + + for(p = table1; *(CARD16*)p != 0xb8ff && p < table1 + 64000; p += 2); + if(p == table1 + 64000) + return def; + p += 2; + if(*(CARD32*)p != 0x544942) + return def; + p += 4; + if(*(CARD16*)p != 0x100) + return def; + p += 2; + if(*p != 12) + return def; + p++; + if(*p != 6) + return def; + p++; + count = *p; + p += 2; + for(; *p != 'A' && count >= 0; count--, p += 6); + if(count == -1) + return def; + p += 4; + p = table1 + *(CARD16*)p; + p = table1 + *(CARD16*)p; + if(p[0] != 0x10 || p[1] != 4 || p[2] != 4 || p[3] != 2) + return def; + return *(CARD32*)(p + 4) & 0x3ff; +} + static Bool G80ReadPortMapping(int scrnIndex, G80Ptr pNv) { unsigned char *table2; @@ -110,6 +145,9 @@ static Bool G80ReadPortMapping(int scrnIndex, G80Ptr pNv) xf86DrvMsg(scrnIndex, X_PROBED, " Bus %i -> SOR%i\n", i, pNv->i2cMap[i].sor); } + pNv->loadVal = G80FindLoadVal(pNv->table1); + xf86DrvMsg(scrnIndex, X_PROBED, "Load detection: %d\n", pNv->loadVal); + return TRUE; fail: |