[3650] in linux-scsi channel archive
DC390 (tmscsim) driver 1.13
daemon@ATHENA.MIT.EDU (Kurt Garloff)
Wed Apr 8 03:57:50 1998
Date: Wed, 8 Apr 1998 09:49:23 +0200
From: Kurt Garloff <garloff@kg1.ping.de>
To: Andreas Haumer <andreas@xss.co.at>,
Attila Bilgic <bilgic@hft.e-technik.uni-dortmund.de>,
Bert Hutzler <hutzler@Fh-Worms.DE>,
Philip Blundell <Philip.Blundell@pobox.com>,
Christian Wupper <root@christian.wupper.de>,
Christian Dietsch <root@christian.wupper.de>,
Dieter Schlueter <Dieter.Schlueter@bild.dd.shuttle.de>,
=?ISO-8859-1?Q?Engstr=F6m=2C_Fredrik?= <chimay@myself.com>,
"Kurt jun. Huwig" <kurt@huwig.de>,
Jacek Czerwinski <klik@rubikon.net.pl>,
Linux kernel list <linux-kernel@vger.rutgers.edu>,
Linux SCSI list <linux-scsi@vger.rutgers.edu>,
Linus Torvalds <torvalds@transmeta.com>,
Philip Giang <philip@tekram.com.tw>,
"Leonard N. Zubkoff" <lnz@dandelion.com>,
Georges Giralt <georges.giralt@ansf.alcatel.fr>,
Alan Cox <alan@cymru.net>
Cc: Martin Mares <mj@atrey.karlin.mff.cuni.cz>
Mail-Followup-To: Andreas Haumer <andreas@xss.co.at>,
Attila Bilgic <bilgic@hft.e-technik.uni-dortmund.de>,
Bert Hutzler <hutzler@Fh-Worms.DE>,
Philip Blundell <Philip.Blundell@pobox.com>,
Christian Wupper <root@christian.wupper.de>,
Christian Dietsch <root@christian.wupper.de>,
Dieter Schlueter <Dieter.Schlueter@bild.dd.shuttle.de>,
=?ISO-8859-1?Q?Engstr=F6m=2C_Fredrik?= <chimay@myself.com>,
"Kurt jun. Huwig" <kurt@huwig.de>,
Jacek Czerwinski <klik@rubikon.net.pl>,
Linux kernel list <linux-kernel@vger.rutgers.edu>,
Linux SCSI list <linux-scsi@vger.rutgers.edu>,
Linus Torvalds <torvalds@transmeta.com>,
Philip Giang <philip@tekram.com.tw>,
"Leonard N. Zubkoff" <lnz@dandelion.com>,
Georges Giralt <georges.giralt@ansf.alcatel.fr>,
Alan Cox <alan@cymru.net>,
Martin Mares <mj@atrey.karlin.mff.cuni.cz>
--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii
Hi,
I'm proud to announce the tmscsim (DC390) driver rev. 1.13.
After MJ has cleaned up the PCI detection and probing mechs for kernel
2.1.93, I have to merge my changes into the kernel source tree...
Basically, there are 3 changes:
1.) Increased the max number of devices from 10 -> 16
[There's a tradefoff between max devs and needed space. This should be
changed to dynamically allocate mem int the future.]
2.) Added a few __initfunc declarations.
3.) Tried to implement general AM53C974 support. If no EEprom is found,
the driver tries to use default values.
[These should be made adjustable in the future. Just look if it works, first.]
Those of you who have tested my 1.13a and 1.13b prereleases, please revert
the patches. Apply the 2192-2193 diff (MJs changes) and then my 112-113 patch.
If you got a clean 2.1.93 source tree, just apply this patch.
I append two patches:
1. The recent 112-113 patch described above
2. MJ's patch (included in the 2192->2193 kernel patch)
If somebody needs my old 113a and 113b patches in order to revert them,
please contact me.
--
Kurt Garloff, Dortmund
<K.Garloff@ping.de>
PGP key on http://student.physik.uni-dortmund.de/homepages/garloff
--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii
Content-Description: dc390-112-113.diff
Content-Disposition: attachment; filename="dc390-112-113.diff"
--- linux/drivers/scsi/tmscsim.c.112 Tue Apr 7 20:10:38 1998
+++ linux/drivers/scsi/tmscsim.c Wed Apr 8 09:18:41 1998
@@ -27,6 +27,8 @@
* 1.11 02/05/97 KG/CLH Fixeds problem with partitions greater *
* than 1GB *
* 1.12 15/02/98 MJ Rewritten PCI probing *
+ * 1.13 08/04/98 KG Support for non DC390, __initfunc decls,*
+ * changed max devs from 10 to 16 *
***********************************************************************/
@@ -1196,8 +1198,8 @@
}
-void
-DC390_EnDisableCE( UCHAR mode, struct pci_dev *pdev, PUCHAR regval )
+__initfunc(void
+DC390_EnDisableCE( UCHAR mode, struct pci_dev *pdev, PUCHAR regval ))
{
UCHAR bval;
@@ -1213,9 +1215,34 @@
udelay(160);
}
+#ifdef CONFIG_SCSI_DC390T_GENSUPP
+__initfunc(void
+DC390_EEpromDefaults (USHORT index))
+{
+ PUSHORT ptr;
+ USHORT id;
+ ptr = (PUSHORT) eepromBuf[index];
+
+ /* Adapter Settings */
+ ptr[EE_ADAPT_SCSI_ID] = 7; /* Adapter ID */
+ ptr[EE_MODE2] = MORE2_DRV | GREATER_1G | RST_SCSI_BUS
+ | ACTIVE_NEGATION /* | NO_SEEK | LUN_CHECK */; /* Some features enabled */
+ ptr[EE_DELAY] = 0; /* ?? */
+ ptr[EE_TAG_CMD_NUM] = 4; /* Support 16 tagged cmnds */
+
+ /* Device Settings */
+ for (id = 0; id < MAX_SCSI_ID; id++)
+ {
+ ptr[id<<2] = PARITY_CHK_ | SEND_START_ | EN_DISCONNECT_
+ /*| SYNC_NEGO_ | TAG_QUEUING_ */; /* MODE1: Some features enabled */
+ ptr[(id<<2) + 1] = 0; /* Speed: 10 MHz */
+ };
+}
+#endif /* CONFIG_SCSI_DC390T_GENSUPP */
+
-void
-DC390_EEpromOutDI( struct pci_dev *pdev, PUCHAR regval, USHORT Carry )
+__initfunc(void
+DC390_EEpromOutDI( struct pci_dev *pdev, PUCHAR regval, USHORT Carry ))
{
UCHAR bval;
@@ -1236,8 +1263,8 @@
}
-UCHAR
-DC390_EEpromInDO( struct pci_dev *pdev )
+__initfunc(UCHAR
+DC390_EEpromInDO( struct pci_dev *pdev ))
{
UCHAR bval;
@@ -1253,8 +1280,8 @@
}
-USHORT
-EEpromGetData1( struct pci_dev *pdev )
+__initfunc(USHORT
+EEpromGetData1( struct pci_dev *pdev ))
{
UCHAR i;
UCHAR carryFlag;
@@ -1271,8 +1298,8 @@
}
-void
-DC390_Prepare( struct pci_dev *pdev, PUCHAR regval, UCHAR EEpromCmd )
+__initfunc(void
+DC390_Prepare( struct pci_dev *pdev, PUCHAR regval, UCHAR EEpromCmd ))
{
UCHAR i,j;
USHORT carryFlag;
@@ -1288,8 +1315,8 @@
}
-void
-DC390_ReadEEprom( struct pci_dev *pdev, int index )
+__initfunc(void
+DC390_ReadEEprom( struct pci_dev *pdev, int index ))
{
UCHAR regval,cmd;
PUSHORT ptr;
@@ -1309,8 +1336,8 @@
}
-USHORT
-DC390_CheckEEpromCheckSum( struct pci_dev *pdev, int index )
+__initfunc(USHORT
+DC390_CheckEEpromCheckSum( struct pci_dev *pdev, int index ))
{
USHORT wval, rc, *ptr;
UCHAR i;
@@ -1344,66 +1371,71 @@
{
PSH psh;
PACB pACB;
-
- if( !DC390_CheckEEpromCheckSum( pdev, index ) )
+
+ USHORT EEprom;
+ EEprom = DC390_CheckEEpromCheckSum (pdev, index);
+
+ if (EEprom)
+ {
+ printk("DC390_init: EEPROM reading error!\n");
+#ifndef CONFIG_SCSI_DC390T_GENSUPP
+ return( -1 );
+#else
+ printk("DC390_init: Trying default EEPROM settings!\n");
+ DC390_EEpromDefaults (index);
+#endif
+ };
+
+ psh = scsi_register( psht, sizeof(DC390_ACB) );
+ if( !psh ) return( -1 );
+ if( !pSH_start )
{
- psh = scsi_register( psht, sizeof(DC390_ACB) );
- if( !psh )
- return( -1 );
- if( !pSH_start )
- {
- pSH_start = psh;
- pSH_current = psh;
- }
- else
- {
- pSH_current->next = psh;
- pSH_current = psh;
- }
-
+ pSH_start = psh;
+ pSH_current = psh;
+ }
+ else
+ {
+ pSH_current->next = psh;
+ pSH_current = psh;
+ }
+
#ifdef DC390_DEBUG0
- printk("DC390: pSH = %8x,", (UINT) psh);
- printk("DC390: Index %02i,", index);
+ printk("DC390: pSH = %8x,", (UINT) psh);
+ printk("DC390: Index %02i,", index);
#endif
-
- DC390_initACB( psh, io_port, Irq, index );
- if( !DC390_initAdapter( psh, io_port, Irq, index ) )
- {
- pACB = (PACB) psh->hostdata;
- if( !pACB_start )
- {
- pACB_start = pACB;
- pACB_current = pACB;
- pACB->pNextACB = (PACB) -1;
- }
- else
- {
- pACB_current->pNextACB = pACB;
- pACB_current = pACB;
- pACB->pNextACB = (PACB) -1;
- }
-
+
+ DC390_initACB( psh, io_port, Irq, index );
+ if( !DC390_initAdapter( psh, io_port, Irq, index ) )
+ {
+ pACB = (PACB) psh->hostdata;
+ if( !pACB_start )
+ {
+ pACB_start = pACB;
+ pACB_current = pACB;
+ pACB->pNextACB = (PACB) -1;
+ }
+ else
+ {
+ pACB_current->pNextACB = pACB;
+ pACB_current = pACB;
+ pACB->pNextACB = (PACB) -1;
+ }
+
#ifdef DC390_DEBUG0
- printk("DC390: pACB = %8x, pDCB_array = %8x, pSRB_array = %8x\n",
- (UINT) pACB, (UINT) pACB->DCB_array, (UINT) pACB->SRB_array);
- printk("DC390: ACB size= %4x, DCB size= %4x, SRB size= %4x\n",
- sizeof(DC390_ACB), sizeof(DC390_DCB), sizeof(DC390_SRB) );
+ printk("DC390: pACB = %8x, pDCB_array = %8x, pSRB_array = %8x\n",
+ (UINT) pACB, (UINT) pACB->DCB_array, (UINT) pACB->SRB_array);
+ printk("DC390: ACB size= %4x, DCB size= %4x, SRB size= %4x\n",
+ sizeof(DC390_ACB), sizeof(DC390_DCB), sizeof(DC390_SRB) );
#endif
- }
- else
- {
- pSH_start = NULL;
- scsi_unregister( psh );
- return( -1 );
- }
- return( 0 );
}
else
{
- printk("DC390_init: EEPROM reading error!\n");
- return( -1 );
+ pSH_start = NULL;
+ scsi_unregister( psh );
+ return( -1 );
}
+ return( 0 );
}
@@ -1521,7 +1553,7 @@
return(tmscsim_set_info(buffer, length, shpnt));
SPRINTF("Tekram DC390(T) PCI SCSI Host Adadpter, ");
- SPRINTF("Driver Version 1.12, 1998/02/25\n");
+ SPRINTF("Driver Version 1.13, 1998/04/08\n");
save_flags(flags);
cli();
--- linux/drivers/scsi/dc390.h.112 Wed Feb 25 22:20:06 1998
+++ linux/drivers/scsi/dc390.h Wed Apr 8 09:01:04 1998
@@ -36,7 +36,7 @@
#define DC390_T { \
proc_dir: &proc_scsi_tmscsim, \
proc_info: tmscsim_proc_info, \
- name: "Tekram DC390(T) V1.12 Feb-25-1998",\
+ name: "Tekram DC390(T) V1.13 Apr-08-1998",\
detect: DC390_detect, \
release: DC390_release, \
queuecommand: DC390_queue_command, \
--- linux/drivers/scsi/tmscsim.h.112 Tue Apr 7 20:10:51 1998
+++ linux/drivers/scsi/tmscsim.h Wed Apr 8 08:57:57 1998
@@ -55,7 +55,7 @@
#define MAX_ADAPTER_NUM 4
-#define MAX_DEVICES 10
+#define MAX_DEVICES 16
#define MAX_SG_LIST_BUF 16
#define MAX_CMD_QUEUE 20
#define MAX_CMD_PER_LUN 8
--- linux/drivers/scsi/Config.in.orig Sun Feb 22 09:42:55 1998
+++ linux/drivers/scsi/Config.in Thu Feb 26 01:05:14 1998
@@ -107,6 +107,9 @@
dep_tristate 'Seagate ST-02 and Future Domain TMC-8xx SCSI support' CONFIG_SCSI_SEAGATE $CONFIG_SCSI
if [ "$CONFIG_PCI" = "y" -a "$CONFIG_SCSI_AM53C974" != "y" ]; then
dep_tristate 'Tekram DC-390(T) (AMD PCscsi) SCSI support' CONFIG_SCSI_DC390T $CONFIG_SCSI
+ if [ "$CONFIG_SCSI_DC390T" != "n"]; then
+ bool ' support for general AM53C974 adapters' CONFIG_SCSI_DC390T_GENSUPP
+ fi
fi
dep_tristate 'Trantor T128/T128F/T228 SCSI support' CONFIG_SCSI_T128 $CONFIG_SCSI
dep_tristate 'UltraStor 14F/34F support' CONFIG_SCSI_U14_34F $CONFIG_SCSI
--- linux/Documentation/Configure.help.orig Mon Feb 2 23:51:31 1998
+++ linux/Documentation/Configure.help Thu Feb 26 01:45:09 1998
@@ -2979,6 +2979,15 @@
inserted in and removed from the running kernel whenever you want),
say M here and read Documentation/modules.txt. The module will be
called tmscsim.o.
+
+Support other AM53C974 based SCSI adapters
+CONFIG_SCSI_DC390T_GENSUPP
+ Normally the DC390(T) SCSI driver relies on the DC390 EEProm to get
+ initial values for its settings, such as speed, termination, etc.
+ If it can't find this EEProm, it won't initialize.
+ With this option, if no EEProm is found, default settings are used
+ and the driver tries to operate non-Tekram but AM53C974 based
+ adapters.
AM53/79C974 PCI SCSI support
CONFIG_SCSI_AM53C974
--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii
Content-Description: dc390-2192-2193.diff
Content-Disposition: attachment; filename="dc390-2192-2193.diff"
--- v2.1.92/linux/drivers/scsi/tmscsim.c Tue Mar 10 10:03:33 1998
+++ linux/drivers/scsi/tmscsim.c Thu Apr 2 09:12:25 1998
@@ -26,7 +26,7 @@
* pending interrupt in DC390_detect() *
* 1.11 02/05/97 KG/CLH Fixeds problem with partitions greater *
* than 1GB *
- * 1.12 25/02/98 KG Cleaned up ifdefs for 2.1 kernel *
+ * 1.12 15/02/98 MJ Rewritten PCI probing *
***********************************************************************/
@@ -47,7 +47,6 @@
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
-#include <linux/bios32.h>
#include <linux/pci.h>
#include <linux/proc_fs.h>
#include <linux/string.h>
@@ -118,8 +117,6 @@
static USHORT adapterCnt = 0;
static USHORT InitialTime = 0;
static USHORT CurrSyncOffset = 0;
-static ULONG mech1addr;
-static UCHAR mech2bus, mech2Agent, mech2CfgSPenR;
static PVOID DC390_phase0[]={
DC390_DataOut_0,
@@ -1200,147 +1197,7 @@
void
-DC390_EnableCfg( USHORT mechnum, UCHAR regval )
-{
- ULONG wlval;
-
- if(mechnum == 2)
- {
- outb(mech2bus, PCI_CFG2_FORWARD_REG);
- outb(mech2CfgSPenR, PCI_CFG2_ENABLE_REG);
- }
- else
- {
- regval &= 0xFC;
- wlval = mech1addr;
- wlval |= (((ULONG)regval) & 0xff);
- outl(wlval, PCI_CFG1_ADDRESS_REG);
- }
-}
-
-
-void
-DC390_DisableCfg( USHORT mechnum )
-{
-
- if(mechnum == 2)
- outb(0, PCI_CFG2_ENABLE_REG);
- else
- outl(0, PCI_CFG1_ADDRESS_REG);
-}
-
-
-UCHAR
-DC390_inByte( USHORT mechnum, UCHAR regval )
-{
- UCHAR bval;
- ULONG wval;
- ULONG flags;
-
- save_flags(flags);
- cli();
- DC390_EnableCfg( mechnum, regval );
- if(mechnum == 2)
- {
- wval = mech2Agent;
- wval <<= 8;
- wval |= ((USHORT) regval) & 0xff;
- bval = inb(wval);
- }
- else
- {
- regval &= 3;
- bval = inb(PCI_CFG1_DATA_REG | regval);
- }
- DC390_DisableCfg(mechnum);
- restore_flags(flags);
- return(bval);
-}
-
-
-USHORT
-DC390_inWord( USHORT mechnum, UCHAR regval )
-{
- USHORT wval;
- ULONG flags;
-
- save_flags(flags);
- cli();
- DC390_EnableCfg(mechnum,regval);
- if(mechnum == 2)
- {
- wval = mech2Agent;
- wval <<= 8;
- wval |= regval;
- wval = inw(wval);
- }
- else
- {
- regval &= 3;
- wval = inw(PCI_CFG1_DATA_REG | regval);
- }
- DC390_DisableCfg(mechnum);
- restore_flags(flags);
- return(wval);
-}
-
-
-ULONG
-DC390_inDword(USHORT mechnum, UCHAR regval )
-{
- ULONG wlval;
- ULONG flags;
- USHORT wval;
-
- save_flags(flags);
- cli();
- DC390_EnableCfg(mechnum,regval);
- if(mechnum == 2)
- {
- wval = mech2Agent;
- wval <<= 8;
- wval |= regval;
- wlval = inl(wval);
- }
- else
- {
- wlval = inl(PCI_CFG1_DATA_REG);
- }
- DC390_DisableCfg(mechnum);
- restore_flags(flags);
- return(wlval);
-}
-
-
-void
-DC390_OutB(USHORT mechnum, UCHAR regval, UCHAR bval )
-{
-
- USHORT wval;
- ULONG flags;
-
- save_flags(flags);
- cli();
- DC390_EnableCfg(mechnum,regval);
- if(mechnum == 2)
- {
- wval = mech2Agent;
- wval <<= 8;
- wval |= regval;
- outb(bval, wval);
- }
- else
- {
- regval &= 3;
- outb(bval, PCI_CFG1_DATA_REG | regval);
- }
- DC390_DisableCfg(mechnum);
- restore_flags(flags);
-}
-
-
-void
-DC390_EnDisableCE( UCHAR mode, USHORT mechnum, PUCHAR regval )
+DC390_EnDisableCE( UCHAR mode, struct pci_dev *pdev, PUCHAR regval )
{
UCHAR bval;
@@ -1350,15 +1207,15 @@
*regval = 0xc0;
else
*regval = 0x80;
- DC390_OutB(mechnum,*regval,bval);
+ pci_write_config_byte(pdev, *regval, bval);
if(mode == DISABLE_CE)
- DC390_OutB(mechnum,*regval,bval);
+ pci_write_config_byte(pdev, *regval, bval);
udelay(160);
}
void
-DC390_EEpromOutDI( USHORT mechnum, PUCHAR regval, USHORT Carry )
+DC390_EEpromOutDI( struct pci_dev *pdev, PUCHAR regval, USHORT Carry )
{
UCHAR bval;
@@ -1367,32 +1224,28 @@
{
bval = 0x40;
*regval = 0x80;
- DC390_OutB(mechnum,*regval,bval);
+ pci_write_config_byte(pdev, *regval, bval);
}
udelay(160);
bval |= 0x80;
- DC390_OutB(mechnum,*regval,bval);
+ pci_write_config_byte(pdev, *regval, bval);
udelay(160);
bval = 0;
- DC390_OutB(mechnum,*regval,bval);
+ pci_write_config_byte(pdev, *regval, bval);
udelay(160);
}
UCHAR
-DC390_EEpromInDO( USHORT mechnum )
+DC390_EEpromInDO( struct pci_dev *pdev )
{
- UCHAR bval,regval;
+ UCHAR bval;
- regval = 0x80;
- bval = 0x80;
- DC390_OutB(mechnum,regval,bval);
+ pci_write_config_byte(pdev, 0x80, 0x80);
udelay(160);
- bval = 0x40;
- DC390_OutB(mechnum,regval,bval);
+ pci_write_config_byte(pdev, 0x80, 0x40);
udelay(160);
- regval = 0x0;
- bval = DC390_inByte(mechnum,regval);
+ pci_read_config_byte(pdev, 0x00, &bval);
if(bval == 0x22)
return(1);
else
@@ -1401,7 +1254,7 @@
USHORT
-EEpromGetData1( USHORT mechnum )
+EEpromGetData1( struct pci_dev *pdev )
{
UCHAR i;
UCHAR carryFlag;
@@ -1411,7 +1264,7 @@
for(i=0; i<16; i++)
{
wval <<= 1;
- carryFlag = DC390_EEpromInDO(mechnum);
+ carryFlag = DC390_EEpromInDO(pdev);
wval |= carryFlag;
}
return(wval);
@@ -1419,7 +1272,7 @@
void
-DC390_Prepare( USHORT mechnum, PUCHAR regval, UCHAR EEpromCmd )
+DC390_Prepare( struct pci_dev *pdev, PUCHAR regval, UCHAR EEpromCmd )
{
UCHAR i,j;
USHORT carryFlag;
@@ -1428,7 +1281,7 @@
j = 0x80;
for(i=0; i<9; i++)
{
- DC390_EEpromOutDI(mechnum,regval,carryFlag);
+ DC390_EEpromOutDI(pdev,regval,carryFlag);
carryFlag = (EEpromCmd & j) ? 1 : 0;
j >>= 1;
}
@@ -1436,7 +1289,7 @@
void
-DC390_ReadEEprom( USHORT mechnum, USHORT index )
+DC390_ReadEEprom( struct pci_dev *pdev, int index )
{
UCHAR regval,cmd;
PUSHORT ptr;
@@ -1446,23 +1299,23 @@
cmd = EEPROM_READ;
for(i=0; i<0x40; i++)
{
- DC390_EnDisableCE(ENABLE_CE, mechnum, ®val);
- DC390_Prepare(mechnum, ®val, cmd);
- *ptr = EEpromGetData1(mechnum);
+ DC390_EnDisableCE(ENABLE_CE, pdev, ®val);
+ DC390_Prepare(pdev, ®val, cmd);
+ *ptr = EEpromGetData1(pdev);
ptr++;
cmd++;
- DC390_EnDisableCE(DISABLE_CE,mechnum,®val);
+ DC390_EnDisableCE(DISABLE_CE, pdev, ®val);
}
}
USHORT
-DC390_CheckEEpromCheckSum( USHORT MechNum, USHORT index )
+DC390_CheckEEpromCheckSum( struct pci_dev *pdev, int index )
{
USHORT wval, rc, *ptr;
UCHAR i;
- DC390_ReadEEprom( MechNum, index );
+ DC390_ReadEEprom( pdev, index );
wval = 0;
ptr = (PUSHORT) &eepromBuf[index][0];
for(i=0; i<128 ;i+=2, ptr++)
@@ -1475,30 +1328,6 @@
}
-USHORT
-DC390_ToMech( USHORT Mechnum, USHORT BusDevFunNum )
-{
- USHORT devnum;
-
- devnum = BusDevFunNum;
-
- if(Mechnum == 2)
- {
- if(devnum & 0x80)
- return(-1);
- mech2bus = (UCHAR)((devnum & 0xff00) >> 8); /* Bus num */
- mech2Agent = ((UCHAR)(devnum & 0xff)) >> 3; /* Dev num */
- mech2Agent |= 0xc0;
- mech2CfgSPenR = ((UCHAR)(devnum & 0xff)) & 0x07; /* Fun num */
- mech2CfgSPenR = (mech2CfgSPenR << 1) | 0x20;
- }
- else /* use mech #1 method */
- {
- mech1addr = 0x80000000 | ((ULONG)devnum << 8);
- }
- return(0);
-}
-
/***********************************************************************
* Function : static int DC390_init (struct Scsi_Host *host)
*
@@ -1511,12 +1340,12 @@
***********************************************************************/
__initfunc(static int
-DC390_init (PSHT psht, ULONG io_port, UCHAR Irq, USHORT index, USHORT MechNum))
+DC390_init (PSHT psht, ULONG io_port, UCHAR Irq, struct pci_dev *pdev, int index))
{
PSH psh;
PACB pACB;
- if( !DC390_CheckEEpromCheckSum( MechNum, index) )
+ if( !DC390_CheckEEpromCheckSum( pdev, index ) )
{
psh = scsi_register( psht, sizeof(DC390_ACB) );
if( !psh )
@@ -1594,20 +1423,10 @@
__initfunc(int
DC390_detect(Scsi_Host_Template *psht))
{
-#ifdef FOR_PCI_OK
- UCHAR pci_bus, pci_device_fn;
- int error = 0;
- USHORT chipType = 0;
- USHORT i;
-#endif
-
- UCHAR irq;
- UCHAR istatus;
+ struct pci_dev *pdev = NULL;
+ UINT irq;
UINT io_port;
USHORT adaptCnt = 0; /* Number of boards detected */
- USHORT pci_index = 0; /* Device index to PCI BIOS calls */
- USHORT MechNum, BusDevFunNum;
- ULONG wlval;
psht->proc_dir = &proc_scsi_tmscsim;
@@ -1615,81 +1434,17 @@
pSHT_start = psht;
pACB_start = NULL;
- MechNum = 1;
- for( ; (MechNum < 3) && (!adaptCnt); MechNum++)
- {
- BusDevFunNum = 0;
- for (; adaptCnt < MAX_ADAPTER_NUM ;)
+ if ( pci_present() )
+ while ((pdev = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD53C974, pdev)))
{
- if( !DC390_ToMech( MechNum, BusDevFunNum) )
- {
- wlval = DC390_inDword( MechNum, PCI_VENDOR_ID);
- if(wlval == ( (PCI_DEVICE_ID_AMD53C974 << 16)+
- PCI_VENDOR_ID_AMD) )
- {
- io_port =DC390_inDword(MechNum,PCI_BASE_ADDRESS_0) & 0xFFFE;
- irq = DC390_inByte( MechNum, PCI_INTERRUPT_LINE);
+ io_port = pdev->base_address[0] & PCI_BASE_ADDRESS_IO_MASK;
+ irq = pdev->irq;
#ifdef DC390_DEBUG0
- printk("DC390: IO_PORT=%4x,IRQ=%x,\n",(UINT) io_port, irq);
+ printk("DC390: IO_PORT=%4x,IRQ=%x,\n",(UINT) io_port, irq);
#endif
- if( !DC390_init(psht, io_port, irq, pci_index, MechNum) )
- {
- adaptCnt++;
- pci_index++;
- istatus = inb( (USHORT)io_port+INT_Status ); /* Reset Pending INT */
-#ifdef DC390_DEBUG0
- printk("DC390: Mech=%2x,\n",(UCHAR) MechNum);
-#endif
- }
- }
- }
- if( BusDevFunNum != 0xfff8 )
- BusDevFunNum += 8; /* next device # */
- else
- break;
+ if( !DC390_init(psht, io_port, irq, pdev, adaptCnt))
+ adaptCnt++;
}
- }
-
-#ifdef FOR_PCI_OK
- if ( pcibios_present() )
- {
- for (i = 0; i < MAX_ADAPTER_NUM; ++i)
- {
- if( !pcibios_find_device( PCI_VENDOR_ID_AMD,
- PCI_DEVICE_ID_AMD53C974,
- pci_index, &pci_bus, &pci_device_fn) )
- {
- chipType = PCI_DEVICE_ID_AMD53C974;
- pci_index++;
- }
-
- if( chipType )
- {
-
- error = pcibios_read_config_dword(pci_bus, pci_device_fn,
- PCI_BASE_ADDRESS_0, &io_port);
- error |= pcibios_read_config_byte(pci_bus, pci_device_fn,
- PCI_INTERRUPT_LINE, &irq);
- if( error )
- {
- printk("DC390_detect: reading configuration registers error!\n");
- InitialTime = 0;
- return( 0 );
- }
-
- (USHORT) io_port = (USHORT) io_port & 0xFFFE;
-#ifdef DC390_DEBUG0
- printk("DC390: IO_PORT=%4x,IRQ=%x,\n",(UINT) io_port, irq);
-#endif
- if( !DC390_init(psht, io_port, irq, i) )
- adaptCnt++;
- chipType = 0;
- }
- else
- break;
- }
- }
-#endif
InitialTime = 0;
adapterCnt = adaptCnt;
--- v2.1.92/linux/drivers/scsi/tmscsim.h Tue Mar 10 10:03:33 1998
+++ linux/drivers/scsi/tmscsim.h Thu Apr 2 09:12:25 1998
@@ -660,21 +660,4 @@
outl((value), DC390_ioport + (address)))
-/* Configuration method #1 */
-#define PCI_CFG1_ADDRESS_REG 0xcf8
-#define PCI_CFG1_DATA_REG 0xcfc
-#define PCI_CFG1_ENABLE 0x80000000
-#define PCI_CFG1_TUPPLE(bus, device, function, register) \
- (PCI_CFG1_ENABLE | (((bus) << 16) & 0xff0000) | \
- (((device) << 11) & 0xf800) | (((function) << 8) & 0x700)| \
- (((register) << 2) & 0xfc))
-
-/* Configuration method #2 */
-#define PCI_CFG2_ENABLE_REG 0xcf8
-#define PCI_CFG2_FORWARD_REG 0xcfa
-#define PCI_CFG2_ENABLE 0x0f0
-#define PCI_CFG2_TUPPLE(function) \
- (PCI_CFG2_ENABLE | (((function) << 1) & 0xe))
-
-
#endif /* _TMSCSIM_H */
--MGYHOYXEY6WxJCY8--
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu