Updated Zorro-LAN-IDE Driver to 2.15
- Multicast fixes - new Microchip OUIs added to verification table
This commit is contained in:
@@ -9,21 +9,26 @@
|
||||
*/
|
||||
#include <exec/libraries.h>
|
||||
#include <proto/exec.h>
|
||||
#include <exec/execbase.h>
|
||||
|
||||
/*#include <clib/expansion_protos.h>
|
||||
#include <pragmas/expansion_pragmas.h>*/
|
||||
#include <proto/expansion.h>
|
||||
#include <libraries/configvars.h>
|
||||
#include <hardware/intbits.h>
|
||||
|
||||
#include "device.h"
|
||||
#include "hw.h"
|
||||
|
||||
#include "enc624j6l.h"
|
||||
#include "registers.h"
|
||||
#include "mmustuff.h"
|
||||
|
||||
extern const BYTE DeviceName[];
|
||||
|
||||
#ifndef AFF_68060
|
||||
#define AFF_68060 (1<<10)
|
||||
#endif
|
||||
|
||||
#define ENC_MANUFACTURER 2588
|
||||
#define ENC_BOARD 123
|
||||
|
||||
@@ -90,11 +95,12 @@ ASM SAVEDS LONG hw_Find_Boards( ASMR(a0) DEVBASEP ASMREG(a0) )
|
||||
struct ConfigDev *cfg = (0);
|
||||
APTR boardbase;
|
||||
|
||||
if( (ExpansionBase = OpenLibrary( (BYTE*)exp_name, 37 )) )
|
||||
if( (ExpansionBase = OpenLibrary( (STRPTR)exp_name, 37 )) )
|
||||
{
|
||||
/* TODO: actually verify that we have a module here */
|
||||
/* ret = 1; */
|
||||
|
||||
enc624j6l_Z2Mode = 0;
|
||||
for( i=0 ; i < MAX_UNITS ; i++ )
|
||||
{
|
||||
cfg = FindConfigDev( cfg, ENC_MANUFACTURER, ENC_BOARD );
|
||||
@@ -103,10 +109,29 @@ ASM SAVEDS LONG hw_Find_Boards( ASMR(a0) DEVBASEP ASMREG(a0) )
|
||||
boardbase = (APTR)cfg->cd_BoardAddr;
|
||||
db->db_Units[i].duh_BASE = boardbase;
|
||||
D(("Board at %lx\n",(ULONG)cfg->cd_BoardAddr ));
|
||||
|
||||
/* on Z2 ? */
|
||||
if( boardbase <= (APTR)0x40000000 )
|
||||
{
|
||||
struct ExecBase *EB = (struct ExecBase *)SysBase;
|
||||
/* 68000-68030 ? */
|
||||
if( !(EB->AttnFlags & (AFF_68040|AFF_68060) ))
|
||||
enc624j6l_Z2Mode = 1;
|
||||
}
|
||||
#ifdef USEMMU
|
||||
if( MMUBase )
|
||||
{
|
||||
/* sometimes (A3000 with SuperKickstart), the MMU table is just wrong, fix "Invalid" bit, if necessary */
|
||||
setupMMU( boardbase, 0x10000, 0, db );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* bring board to sane state (i.e. perform soft reset) */
|
||||
/* if( boardbase < (APTR)0x40000000 ) */ /* debug only */
|
||||
enc624j6l_CheckBoard( boardbase );
|
||||
|
||||
|
||||
}
|
||||
ret = i;
|
||||
D(("%ld boards found\n",ret));
|
||||
@@ -300,12 +325,30 @@ ASM SAVEDS void hw_ConfigInit( ASMR(a0) DEVBASEP ASMREG(a0) )
|
||||
|
||||
}
|
||||
|
||||
UBYTE hex2char( STRPTR src )
|
||||
{
|
||||
UBYTE cur = 0;
|
||||
|
||||
cur = *src;
|
||||
|
||||
if( cur >= 'a' )
|
||||
cur &= ~32;
|
||||
|
||||
if( (cur < '0') || (cur>'F') )
|
||||
return 0;
|
||||
|
||||
cur = ( cur < 'A' ) ? cur-'0' : cur-'A'+10;
|
||||
|
||||
return cur;
|
||||
}
|
||||
|
||||
ASM SAVEDS void hw_ConfigUpdate( ASMR(a0) DEVBASEP ASMREG(a0),
|
||||
ASMR(a1) void*argsv ASMREG(a1))
|
||||
{
|
||||
struct HWConfig *args = (struct HWConfig *)argsv; /* see hwprivate.h */
|
||||
struct HWData *hwd = &db->db_hwdat;
|
||||
|
||||
D(("hw_ConfigUpdate\n"));
|
||||
if( args->timervalue )
|
||||
hwd->timervalue = *args->timervalue;
|
||||
if( args->fullduplex )
|
||||
@@ -314,6 +357,28 @@ ASM SAVEDS void hw_ConfigUpdate( ASMR(a0) DEVBASEP ASMREG(a0),
|
||||
hwd->flowcontrol = 1;
|
||||
if( args->multicast )
|
||||
hwd->multicast = 1;
|
||||
if( args->conf_mac ) /* user-configured MAC address */
|
||||
{
|
||||
int i=0,val;
|
||||
STRPTR src = args->conf_mac;
|
||||
|
||||
while( i < 6 )
|
||||
{
|
||||
val = hex2char( src++ ) << 4;
|
||||
val |= hex2char( src++ );
|
||||
if( (*src++ != ':') && (i<5) )
|
||||
break;
|
||||
db->db_Units[0].du_CFGAddr[i] = val;
|
||||
/* db->db_Units[0].du_HWAddr[i] = val; */
|
||||
i++;
|
||||
}
|
||||
D(("Configured MAC %s (-> %02lx%02lx%02lx%02lx%02lx%02lx\n",\
|
||||
args->conf_mac, \
|
||||
db->db_Units[0].du_CFGAddr[0], db->db_Units[0].du_CFGAddr[1],\
|
||||
db->db_Units[0].du_CFGAddr[2], db->db_Units[0].du_CFGAddr[3],\
|
||||
db->db_Units[0].du_CFGAddr[4], db->db_Units[0].du_CFGAddr[5] ));
|
||||
enc624j6l_SetMAC( db->db_Units[0].duh_BASE, db->db_Units[0].du_CFGAddr );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -408,7 +473,9 @@ ASM SAVEDS LONG hw_get_mac_status( ASMR(a0) DEVBASEP ASMREG(
|
||||
phcon1 = enc624j6l_ReadPHY( boardbase, PHCON1 );
|
||||
phstat1 = enc624j6l_ReadPHY( boardbase, PHSTAT1 ); /* read again to see whether link is established */
|
||||
if( ( phstat1 < 0 ) || ( phstat3 < 0 ) )
|
||||
{
|
||||
return HW_MAC_INVALID; /* no valid data found */
|
||||
}
|
||||
|
||||
/* a) check Link */
|
||||
ret = 0;
|
||||
@@ -548,6 +615,17 @@ ASM void INCMAC( ASMR(a0) UBYTE *curmc ASMREG(a0) )
|
||||
}
|
||||
}
|
||||
|
||||
ASM void COPYMAC( ASMR(a0) UBYTE *dest ASMREG(a0),
|
||||
ASMR(a1) UBYTE *src ASMREG(a1) )
|
||||
{
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
dest[3] = src[3];
|
||||
dest[4] = src[4];
|
||||
dest[5] = src[5];
|
||||
}
|
||||
|
||||
/* TODO: implement Multicast hashing */
|
||||
ASM SAVEDS LONG hw_change_multicast( ASMR(a0) DEVBASEP ASMREG(a0),
|
||||
ASMR(d0) ULONG unit ASMREG(d0),
|
||||
@@ -560,7 +638,7 @@ ASM SAVEDS LONG hw_change_multicast( ASMR(a0) DEVBASEP ASMREG(
|
||||
USHORT mc_hashes[4] = {0,0,0,0}; /* EHT1, EHT2, EHT3, EHT4 */
|
||||
USHORT *hash_tab;
|
||||
struct MCastEntry *mc;
|
||||
UBYTE *curmc;
|
||||
UBYTE curmc[6];
|
||||
|
||||
flags = PIO_INIT_BROAD_CAST;
|
||||
|
||||
@@ -581,7 +659,7 @@ ASM SAVEDS LONG hw_change_multicast( ASMR(a0) DEVBASEP ASMREG(
|
||||
mc->mce_Node.mln_Succ ;
|
||||
mc=(struct MCastEntry*)mc->mce_Node.mln_Succ )
|
||||
{
|
||||
curmc = mc->mce_start;
|
||||
COPYMAC( curmc, mc->mce_start );
|
||||
while( CMPleMAC( curmc, mc->mce_stop ) )
|
||||
{
|
||||
D(("CMPleMAC %ld %02lx%02lx%02lx%02lx%02lx%02lx - %02lx%02lx%02lx%02lx%02lx%02lx\n",\
|
||||
@@ -594,7 +672,7 @@ ASM SAVEDS LONG hw_change_multicast( ASMR(a0) DEVBASEP ASMREG(
|
||||
(ULONG)mc->mce_stop[4],(ULONG)mc->mce_stop[5] \
|
||||
));
|
||||
|
||||
crc = myhw_CRC32( mc->mce_start, 6 );
|
||||
crc = myhw_CRC32( curmc, 6 );
|
||||
curhash = (crc & 0x1f800000)>>23; /* 2 bit reg, 4 bit hash pos in reg */
|
||||
mc_hashes[ ((curhash >> 4)&3) ] |= 1<<(curhash&0xf);
|
||||
INCMAC( curmc );
|
||||
|
||||
Reference in New Issue
Block a user