From ec3a598be7d6ee93b00ef0937760afde58e6b438 Mon Sep 17 00:00:00 2001 From: Roger Hardiman Date: Tue, 25 May 1999 12:43:40 +0000 Subject: [PATCH] Add support for the Bt878/Bt879's Intel 430 FX and SIS/VIA/ OPTi chipset PCI bus workarounds. These make the Bt878/879 chips stabler on certain older and non-intel motherboards. Use options BKTR_430_FX_MODE or options BKTR_SIS_VIA_MODE to enable these modes. Also rename 849 to 849A --- sys/dev/bktr/bktr_core.c | 71 +++++++++++++++++++++++++++++++--------- sys/pci/brooktree848.c | 71 +++++++++++++++++++++++++++++++--------- 2 files changed, 110 insertions(+), 32 deletions(-) diff --git a/sys/dev/bktr/bktr_core.c b/sys/dev/bktr/bktr_core.c index ea3598b6baa1..67b2eb2e1f88 100644 --- a/sys/dev/bktr/bktr_core.c +++ b/sys/dev/bktr/bktr_core.c @@ -1,5 +1,5 @@ -/* $Id: brooktree848.c,v 1.79 1999/05/22 04:34:59 bde Exp $ */ -/* BT848 Driver for Brooktree's Bt848, Bt849, Bt878 and Bt 879 based cards. +/* $Id: brooktree848.c,v 1.80 1999/05/23 21:40:51 roger Exp $ */ +/* BT848 Driver for Brooktree's Bt848, Bt848A, Bt849A, Bt878, Bt879 based cards. The Brooktree BT848 Driver driver is based upon Mark Tinguely and Jim Lowe's driver for the Matrox Meteor PCI card . The Philips SAA 7116 and SAA 7196 are very different chipsets than @@ -401,6 +401,30 @@ They are unrelated to Revision Control numbering of FreeBSD or any other system. same time. To capture VBI data, /dev/vbi must be opened before starting video capture. +1.68 25 May 1999 Roger Hardiman + Due to differences in PCI bus implementations from various + motherboard chipset manufactuers, the Bt878/Bt879 has 3 + PCI bus compatibility modes. These are + NORMAL PCI 2.1 for proper PCI 2.1 compatible chipsets. + INTEL 430 FX for the Intel 430 FX chipset. + SIS VIA CHIPSET for certain SiS and VIA chipsets. + OPTI chipset motherboards also benefit from SIS/VIA mode + as confirmed by Ben Laurie + Older Intel and non-Intel chipsets may also benefit from + SIS/VIA mode. + + NORMAL PCI mode is enabled by default. + For INTEL 430 FX mode, add this to your kenel config: + options "BKTR_430_FX_MODE" + For SIS VIA (and OPTI) mode, add this to your kernel config: + options "BKTR_SIS_VIA_MODE" + + Using quotes in these options is not needed in FreeBSD 4.x. + + Note. Newer VIA chipsets should be fully PCI 2.1 compatible + and should work fine in the Default mode. + + Also rename 849 to 849A, the correct name for the chip. */ #define DDB(x) x @@ -1409,10 +1433,10 @@ bktr_probe( pcici_t tag, pcidi_t type ) switch (type) { case BROOKTREE_848_PCI_ID: - if (rev == 0x12) return("BrookTree 848a"); + if (rev == 0x12) return("BrookTree 848A"); else return("BrookTree 848"); case BROOKTREE_849_PCI_ID: - return("BrookTree 849"); + return("BrookTree 849A"); case BROOKTREE_878_PCI_ID: return("BrookTree 878"); case BROOKTREE_879_PCI_ID: @@ -1453,8 +1477,23 @@ bktr_attach( ATTACH_ARGS ) bktr->tag = tag; pci_map_mem( tag, PCI_MAP_REG_START, (vm_offset_t *) &bktr->base, &bktr->phys_base ); + + /* Update the Device Control Register on Bt878 and Bt879 cards */ fun = pci_conf_read(tag, 0x40); - pci_conf_write(tag, 0x40, fun | 1); + fun = fun | 1; /* Enable writes to the sub-system vendor ID */ + +#if defined( BKTR_430_FX_MODE ) + if (bootverbose) printf("Using 430 FX chipset compatibilty mode\n"); + fun = fun | 2; /* Enable Intel 430 FX compatibility mode */ +#endif + +#if defined( BKTR_SIS_VIA_MODE ) + if (bootverbose) printf("Using SiS/VIA chipset compatibilty mode\n"); + fun = fun | 4; /* Enable SiS/VIA compatibility mode (usefull for + OPTi chipset motherboards too */ +#endif + pci_conf_write(tag, 0x40, fun); + /* XXX call bt848_i2c dependent attach() routine */ #if (NSMBUS > 0) @@ -1568,7 +1607,7 @@ bktr_attach( ATTACH_ARGS ) else bktr->id = BROOKTREE_848; break; case BROOKTREE_849_PCI_ID: - bktr->id = BROOKTREE_849; + bktr->id = BROOKTREE_849A; break; case BROOKTREE_878_PCI_ID: bktr->id = BROOKTREE_878; @@ -3378,7 +3417,7 @@ common_ioctl( bktr_ptr_t bktr, bt848_ptr_t bt848, int cmd, caddr_t arg ) switch (cmd) { case METEORSINPUT: /* set input device */ - /* Bt848 has 3 MUX Inputs. Bt848a/849/878/879 has 4 MUX Inputs*/ + /*Bt848 has 3 MUX Inputs. Bt848A/849A/878/879 has 4 MUX Inputs*/ /* On the original bt848 boards, */ /* Tuner is MUX0, RCA is MUX1, S-Video is MUX2 */ /* On the Hauppauge bt878 boards, */ @@ -3444,7 +3483,7 @@ common_ioctl( bktr_ptr_t bktr, bt848_ptr_t bt848, int cmd, caddr_t arg ) case METEOR_INPUT_DEV3: if ((bktr->id == BROOKTREE_848A) || - (bktr->id == BROOKTREE_849) || + (bktr->id == BROOKTREE_849A) || (bktr->id == BROOKTREE_878) || (bktr->id == BROOKTREE_879) ) { bktr->flags = (bktr->flags & ~METEOR_DEV_MASK) @@ -4952,7 +4991,7 @@ i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 ) if (bktr->id == BROOKTREE_848 || bktr->id == BROOKTREE_848A || - bktr->id == BROOKTREE_849) + bktr->id == BROOKTREE_849A) cmd = I2C_COMMAND; else cmd = I2C_COMMAND_878; @@ -4979,7 +5018,7 @@ i2cRead( bktr_ptr_t bktr, int addr ) if (bktr->id == BROOKTREE_848 || bktr->id == BROOKTREE_848A || - bktr->id == BROOKTREE_849) + bktr->id == BROOKTREE_849A) cmd = I2C_COMMAND; else cmd = I2C_COMMAND_878; @@ -5106,7 +5145,7 @@ i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 ) /* build the command datum */ if (bktr->id == BROOKTREE_848 || bktr->id == BROOKTREE_848A || - bktr->id == BROOKTREE_849) { + bktr->id == BROOKTREE_849A) { data = ((addr & 0xff) << 24) | ((byte1 & 0xff) << 16) | I2C_COMMAND; } else { data = ((addr & 0xff) << 24) | ((byte1 & 0xff) << 16) | I2C_COMMAND_878; @@ -5153,7 +5192,7 @@ i2cRead( bktr_ptr_t bktr, int addr ) if (bktr->id == BROOKTREE_848 || bktr->id == BROOKTREE_848A || - bktr->id == BROOKTREE_849) { + bktr->id == BROOKTREE_849A) { bt848->i2c_data_ctl = ((addr & 0xff) << 24) | I2C_COMMAND; } else { bt848->i2c_data_ctl = ((addr & 0xff) << 24) | I2C_COMMAND_878; @@ -5572,7 +5611,7 @@ static int locate_eeprom_address( bktr_ptr_t bktr) { * The current probe code works as follows * 1) Check if it is a BT878. If so, read the sub-system vendor id. * Select the required tuner and other onboard features. - * 2) If it is a BT848, 848A or 849, continue on: + * 2) If it is a BT848, 848A or 849A, continue on: * 3) Some cards have no I2C devices. Check if the i2c bus is empty * and if so, our detection job is nearly over. * 4) Check I2C address 0xa0. If present this will be a Hauppauge card @@ -5708,7 +5747,7 @@ probeCard( bktr_ptr_t bktr, int verbose ) } } /* end of bt878/bt879 card detection code */ - /* If we get to this point, we must have a Bt848/848a/849 card */ + /* If we get to this point, we must have a Bt848/848A/849A card */ /* or a Bt878 with an unknown subsystem vendor id */ /* Try and determine the make of card by clever i2c probing */ @@ -5722,10 +5761,10 @@ probeCard( bktr_ptr_t bktr, int verbose ) /* Look for Hauppauge, STB and Osprey cards by the presence */ /* of an EEPROM */ /* Note: Bt878 based cards also use EEPROMs so we can only do this */ - /* test on BT848/848a and 849 based cards. */ + /* test on BT848/848A and 849A based cards. */ if ((bktr->id==BROOKTREE_848) || (bktr->id==BROOKTREE_848A) || - (bktr->id==BROOKTREE_849)) { + (bktr->id==BROOKTREE_849A)) { /* At i2c address 0xa0, look for Hauppauge and Osprey cards */ if ( (status = i2cRead( bktr, PFC8582_RADDR )) != ABSENT ) { diff --git a/sys/pci/brooktree848.c b/sys/pci/brooktree848.c index ea3598b6baa1..67b2eb2e1f88 100644 --- a/sys/pci/brooktree848.c +++ b/sys/pci/brooktree848.c @@ -1,5 +1,5 @@ -/* $Id: brooktree848.c,v 1.79 1999/05/22 04:34:59 bde Exp $ */ -/* BT848 Driver for Brooktree's Bt848, Bt849, Bt878 and Bt 879 based cards. +/* $Id: brooktree848.c,v 1.80 1999/05/23 21:40:51 roger Exp $ */ +/* BT848 Driver for Brooktree's Bt848, Bt848A, Bt849A, Bt878, Bt879 based cards. The Brooktree BT848 Driver driver is based upon Mark Tinguely and Jim Lowe's driver for the Matrox Meteor PCI card . The Philips SAA 7116 and SAA 7196 are very different chipsets than @@ -401,6 +401,30 @@ They are unrelated to Revision Control numbering of FreeBSD or any other system. same time. To capture VBI data, /dev/vbi must be opened before starting video capture. +1.68 25 May 1999 Roger Hardiman + Due to differences in PCI bus implementations from various + motherboard chipset manufactuers, the Bt878/Bt879 has 3 + PCI bus compatibility modes. These are + NORMAL PCI 2.1 for proper PCI 2.1 compatible chipsets. + INTEL 430 FX for the Intel 430 FX chipset. + SIS VIA CHIPSET for certain SiS and VIA chipsets. + OPTI chipset motherboards also benefit from SIS/VIA mode + as confirmed by Ben Laurie + Older Intel and non-Intel chipsets may also benefit from + SIS/VIA mode. + + NORMAL PCI mode is enabled by default. + For INTEL 430 FX mode, add this to your kenel config: + options "BKTR_430_FX_MODE" + For SIS VIA (and OPTI) mode, add this to your kernel config: + options "BKTR_SIS_VIA_MODE" + + Using quotes in these options is not needed in FreeBSD 4.x. + + Note. Newer VIA chipsets should be fully PCI 2.1 compatible + and should work fine in the Default mode. + + Also rename 849 to 849A, the correct name for the chip. */ #define DDB(x) x @@ -1409,10 +1433,10 @@ bktr_probe( pcici_t tag, pcidi_t type ) switch (type) { case BROOKTREE_848_PCI_ID: - if (rev == 0x12) return("BrookTree 848a"); + if (rev == 0x12) return("BrookTree 848A"); else return("BrookTree 848"); case BROOKTREE_849_PCI_ID: - return("BrookTree 849"); + return("BrookTree 849A"); case BROOKTREE_878_PCI_ID: return("BrookTree 878"); case BROOKTREE_879_PCI_ID: @@ -1453,8 +1477,23 @@ bktr_attach( ATTACH_ARGS ) bktr->tag = tag; pci_map_mem( tag, PCI_MAP_REG_START, (vm_offset_t *) &bktr->base, &bktr->phys_base ); + + /* Update the Device Control Register on Bt878 and Bt879 cards */ fun = pci_conf_read(tag, 0x40); - pci_conf_write(tag, 0x40, fun | 1); + fun = fun | 1; /* Enable writes to the sub-system vendor ID */ + +#if defined( BKTR_430_FX_MODE ) + if (bootverbose) printf("Using 430 FX chipset compatibilty mode\n"); + fun = fun | 2; /* Enable Intel 430 FX compatibility mode */ +#endif + +#if defined( BKTR_SIS_VIA_MODE ) + if (bootverbose) printf("Using SiS/VIA chipset compatibilty mode\n"); + fun = fun | 4; /* Enable SiS/VIA compatibility mode (usefull for + OPTi chipset motherboards too */ +#endif + pci_conf_write(tag, 0x40, fun); + /* XXX call bt848_i2c dependent attach() routine */ #if (NSMBUS > 0) @@ -1568,7 +1607,7 @@ bktr_attach( ATTACH_ARGS ) else bktr->id = BROOKTREE_848; break; case BROOKTREE_849_PCI_ID: - bktr->id = BROOKTREE_849; + bktr->id = BROOKTREE_849A; break; case BROOKTREE_878_PCI_ID: bktr->id = BROOKTREE_878; @@ -3378,7 +3417,7 @@ common_ioctl( bktr_ptr_t bktr, bt848_ptr_t bt848, int cmd, caddr_t arg ) switch (cmd) { case METEORSINPUT: /* set input device */ - /* Bt848 has 3 MUX Inputs. Bt848a/849/878/879 has 4 MUX Inputs*/ + /*Bt848 has 3 MUX Inputs. Bt848A/849A/878/879 has 4 MUX Inputs*/ /* On the original bt848 boards, */ /* Tuner is MUX0, RCA is MUX1, S-Video is MUX2 */ /* On the Hauppauge bt878 boards, */ @@ -3444,7 +3483,7 @@ common_ioctl( bktr_ptr_t bktr, bt848_ptr_t bt848, int cmd, caddr_t arg ) case METEOR_INPUT_DEV3: if ((bktr->id == BROOKTREE_848A) || - (bktr->id == BROOKTREE_849) || + (bktr->id == BROOKTREE_849A) || (bktr->id == BROOKTREE_878) || (bktr->id == BROOKTREE_879) ) { bktr->flags = (bktr->flags & ~METEOR_DEV_MASK) @@ -4952,7 +4991,7 @@ i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 ) if (bktr->id == BROOKTREE_848 || bktr->id == BROOKTREE_848A || - bktr->id == BROOKTREE_849) + bktr->id == BROOKTREE_849A) cmd = I2C_COMMAND; else cmd = I2C_COMMAND_878; @@ -4979,7 +5018,7 @@ i2cRead( bktr_ptr_t bktr, int addr ) if (bktr->id == BROOKTREE_848 || bktr->id == BROOKTREE_848A || - bktr->id == BROOKTREE_849) + bktr->id == BROOKTREE_849A) cmd = I2C_COMMAND; else cmd = I2C_COMMAND_878; @@ -5106,7 +5145,7 @@ i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 ) /* build the command datum */ if (bktr->id == BROOKTREE_848 || bktr->id == BROOKTREE_848A || - bktr->id == BROOKTREE_849) { + bktr->id == BROOKTREE_849A) { data = ((addr & 0xff) << 24) | ((byte1 & 0xff) << 16) | I2C_COMMAND; } else { data = ((addr & 0xff) << 24) | ((byte1 & 0xff) << 16) | I2C_COMMAND_878; @@ -5153,7 +5192,7 @@ i2cRead( bktr_ptr_t bktr, int addr ) if (bktr->id == BROOKTREE_848 || bktr->id == BROOKTREE_848A || - bktr->id == BROOKTREE_849) { + bktr->id == BROOKTREE_849A) { bt848->i2c_data_ctl = ((addr & 0xff) << 24) | I2C_COMMAND; } else { bt848->i2c_data_ctl = ((addr & 0xff) << 24) | I2C_COMMAND_878; @@ -5572,7 +5611,7 @@ static int locate_eeprom_address( bktr_ptr_t bktr) { * The current probe code works as follows * 1) Check if it is a BT878. If so, read the sub-system vendor id. * Select the required tuner and other onboard features. - * 2) If it is a BT848, 848A or 849, continue on: + * 2) If it is a BT848, 848A or 849A, continue on: * 3) Some cards have no I2C devices. Check if the i2c bus is empty * and if so, our detection job is nearly over. * 4) Check I2C address 0xa0. If present this will be a Hauppauge card @@ -5708,7 +5747,7 @@ probeCard( bktr_ptr_t bktr, int verbose ) } } /* end of bt878/bt879 card detection code */ - /* If we get to this point, we must have a Bt848/848a/849 card */ + /* If we get to this point, we must have a Bt848/848A/849A card */ /* or a Bt878 with an unknown subsystem vendor id */ /* Try and determine the make of card by clever i2c probing */ @@ -5722,10 +5761,10 @@ probeCard( bktr_ptr_t bktr, int verbose ) /* Look for Hauppauge, STB and Osprey cards by the presence */ /* of an EEPROM */ /* Note: Bt878 based cards also use EEPROMs so we can only do this */ - /* test on BT848/848a and 849 based cards. */ + /* test on BT848/848A and 849A based cards. */ if ((bktr->id==BROOKTREE_848) || (bktr->id==BROOKTREE_848A) || - (bktr->id==BROOKTREE_849)) { + (bktr->id==BROOKTREE_849A)) { /* At i2c address 0xa0, look for Hauppauge and Osprey cards */ if ( (status = i2cRead( bktr, PFC8582_RADDR )) != ABSENT ) {