summaryrefslogtreecommitdiff
path: root/src/g80_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/g80_output.c')
-rw-r--r--src/g80_output.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/g80_output.c b/src/g80_output.c
index 75bf7ba..b2d8b07 100644
--- a/src/g80_output.c
+++ b/src/g80_output.c
@@ -127,6 +127,11 @@ static Bool G80ReadPortMapping(int scrnIndex, G80Ptr pNv)
"VGA%d: invalid port type %d\n", or, portType);
break;
}
+ if(port >= G80_NUM_I2C_PORTS) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "VGA%d: unrecognized port %d\n", or, port);
+ break;
+ }
if(pNv->i2cMap[port].dac != -1) {
xf86DrvMsg(scrnIndex, X_WARNING,
"DDC routing table corrupt! DAC %i -> %i for "
@@ -152,6 +157,11 @@ static Bool G80ReadPortMapping(int scrnIndex, G80Ptr pNv)
"DVI%d: invalid port type %d\n", or, portType);
break;
}
+ if(port >= G80_NUM_I2C_PORTS) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "DVI%d: unrecognized port %d\n", or, port);
+ break;
+ }
if(pNv->i2cMap[port].sor != -1)
xf86DrvMsg(scrnIndex, X_WARNING,
"DDC routing table corrupt! SOR %i -> %i for "
@@ -181,6 +191,11 @@ static Bool G80ReadPortMapping(int scrnIndex, G80Ptr pNv)
"LVDS: invalid port type %d\n", portType);
break;
}
+ if(port >= G80_NUM_I2C_PORTS) {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "LVDS: unrecognized port %d\n", port);
+ break;
+ }
pNv->lvds.i2cPort = port;
break;
@@ -217,9 +232,11 @@ fail:
static CARD32 i2cAddr(const int port)
{
- const CARD32 base = (port > 3) ? 0x0000E1D4 : 0x0000E138;
- const CARD32 offset = (port > 3) ? 0x20 : 0x18;
- return base + port * offset;
+ const CARD32 addrs[G80_NUM_I2C_PORTS] = {
+ 0xE138, 0xE150, 0xE168, 0xE180, 0xE254, 0xE274, 0xE764, 0xE780, 0xE79C,
+ 0xE7B8
+ };
+ return addrs[port];
}
static void G80_I2CPutBits(I2CBusPtr b, int clock, int data)