driver update

- fixed gcc cross compilation linker woes by using aout instead of hunk for asm files
 - temporarily reverted to full ENC chip resets on initialization
This commit is contained in:
HenrykRichter
2019-06-06 15:30:08 +02:00
parent 906d8a902f
commit 9861a3f073
14 changed files with 139 additions and 21 deletions
+13 -3
View File
@@ -21,7 +21,7 @@
# debug = 1 will include string debugging for terminal/sushi/sashimi # debug = 1 will include string debugging for terminal/sushi/sashimi
debug = 0 debug = 0
# compiler_vcc = 1 will trigger VBCC, else GCC # compiler_vcc = 1 will trigger VBCC, else GCC
compiler_vcc = 0 compiler_vcc = 1
############################################################################### ###############################################################################
# prefix for system includes (ASM) # prefix for system includes (ASM)
@@ -45,6 +45,8 @@ LINKEXE = vlink -bamigahunk -x -s -mrel -Cvbcc -Bstatic
#LINK = $(CCX) -nostdlib #LINK = $(CCX) -nostdlib
CFLAGS = -Os -+ -sc -c99 -cpu=$(CPU) CFLAGS = -Os -+ -sc -c99 -cpu=$(CPU)
CFLAGS2 = -Os -+ -sc -c99 -cpu=$(CPU2) CFLAGS2 = -Os -+ -sc -c99 -cpu=$(CPU2)
VASMFORMAT = -m$(CPU) -Fhunk -nowarn=2064 -quiet -I$(SYSINC)
VASMFORMAT2 = -m$(CPU2) -Fhunk -nowarn=2064 -quiet -I$(SYSINC)
else else
@@ -54,12 +56,12 @@ LINK = $(CCX) -nostartfiles -s
LINKEXE = $(CCX) -s -noixemul LINKEXE = $(CCX) -s -noixemul
CFLAGS = -O3 -s -m$(CPU) -Wall -noixemul -mregparm=4 -fomit-frame-pointer -msoft-float -noixemul CFLAGS = -O3 -s -m$(CPU) -Wall -noixemul -mregparm=4 -fomit-frame-pointer -msoft-float -noixemul
CFLAGS2 = -O3 -s -m$(CPU2) -Wall -noixemul -mregparm=4 -fomit-frame-pointer -msoft-float -noixemul CFLAGS2 = -O3 -s -m$(CPU2) -Wall -noixemul -mregparm=4 -fomit-frame-pointer -msoft-float -noixemul
VASMFORMAT = -m$(CPU) -Faout -nowarn=2064 -quiet -I$(SYSINC)
VASMFORMAT2 = -m$(CPU2) -Faout -nowarn=2064 -quiet -I$(SYSINC)
endif endif
VASM = vasmm68k_mot VASM = vasmm68k_mot
VASMFORMAT = -m$(CPU) -Fhunk -nowarn=2064 -quiet -I$(SYSINC)
VASMFORMAT2 = -m$(CPU2) -Fhunk -nowarn=2064 -quiet -I$(SYSINC)
# unused here # unused here
#HOST = $(shell uname) #HOST = $(shell uname)
@@ -91,7 +93,11 @@ DEFINES += -DNEWSTYLE
#DEFINES2 += -DDEVICEVERSION=$(DEVICEVERSION) -DDEVICEREVISION=$(DEVICEREVISION) #DEFINES2 += -DDEVICEVERSION=$(DEVICEVERSION) -DDEVICEREVISION=$(DEVICEREVISION)
#DEFINES2 += -DDEVICEDATE=$(DEVICEDATE) #DEFINES2 += -DDEVICEDATE=$(DEVICEDATE)
#DEFINES2 += -DDEVICEEXTRA=$(DEVICEEXTRA) #DEFINES2 += -DDEVICEEXTRA=$(DEVICEEXTRA)
ifeq ($(SAME_DEVNAME),1)
DEFINES2 += -DDEVICENAME="$(DEVICEID)"
else
DEFINES2 += -DDEVICENAME="$(DEVICEID2)" DEFINES2 += -DDEVICENAME="$(DEVICEID2)"
endif
DEFINES2 += -DHAVE_VERSION_H=1 DEFINES2 += -DHAVE_VERSION_H=1
DEFINES2 += -DNEWSTYLE DEFINES2 += -DNEWSTYLE
#ASMDEFS2 += -DDEVICEVERSION=$(DEVICEVERSION) -DDEVICEREVISION=$(DEVICEREVISION) #ASMDEFS2 += -DDEVICEVERSION=$(DEVICEVERSION) -DDEVICEREVISION=$(DEVICEREVISION)
@@ -110,7 +116,11 @@ DEFINES += -DNEWSTYLE
#DEFINES2 += -D"DEVICEVERSION=$(DEVICEVERSION)" -D"DEVICEREVISION=$(DEVICEREVISION)" #DEFINES2 += -D"DEVICEVERSION=$(DEVICEVERSION)" -D"DEVICEREVISION=$(DEVICEREVISION)"
#DEFINES2 += -D"DEVICEDATE=$(DEVICEDATE)" -D"DEVICENAME="$(DEVICEID2)"" #DEFINES2 += -D"DEVICEDATE=$(DEVICEDATE)" -D"DEVICENAME="$(DEVICEID2)""
#DEFINES2 += -D"DEVICEEXTRA=$(DEVICEEXTRA)" #DEFINES2 += -D"DEVICEEXTRA=$(DEVICEEXTRA)"
ifeq ($(SAME_DEVNAME),1)
DEFINES2 += -D"DEVICENAME="$(DEVICEID)""
else
DEFINES2 += -D"DEVICENAME="$(DEVICEID2)"" DEFINES2 += -D"DEVICENAME="$(DEVICEID2)""
endif
DEFINES2 += -DHAVE_VERSION_H=1 DEFINES2 += -DHAVE_VERSION_H=1
DEFINES2 += -DNEWSTYLE DEFINES2 += -DNEWSTYLE
#ASMDEFS2 += -DDEVICEVERSION=$(DEVICEVERSION) -DDEVICEREVISION=$(DEVICEREVISION) #ASMDEFS2 += -DDEVICEVERSION=$(DEVICEVERSION) -DDEVICEREVISION=$(DEVICEREVISION)
+2
View File
@@ -40,6 +40,8 @@ DEFINES2 = # -DPROTO_V2EXPNET
ASMDEFS2 = # -DPROTO_V2EXPNET ASMDEFS2 = # -DPROTO_V2EXPNET
CPU2 = 68000 CPU2 = 68000
SAME_DEVNAME=1
############################################################################### ###############################################################################
# import generic ruleset # import generic ruleset
# #
-1
View File
@@ -1,4 +1,3 @@
;APS00000000000000000000000000000000000000000000000000000000000000000000000000000000
; ifd DEBUG ; ifd DEBUG
; XDEF _AbsExecBase ; XDEF _AbsExecBase
; XDEF _LVORawDoFmt ; XDEF _LVORawDoFmt
+9
View File
@@ -62,6 +62,7 @@ const UWORD dev_supportedcmds[] = {
0 0
}; };
const struct NSDeviceQueryResult NSDQueryAnswer = { const struct NSDeviceQueryResult NSDQueryAnswer = {
0, 0,
16, /* up to SupportedCommands (inclusive) */ 16, /* up to SupportedCommands (inclusive) */
@@ -75,6 +76,14 @@ const struct NSDeviceQueryResult NSDQueryAnswer = {
#include "hw.h" #include "hw.h"
#include "macros.h" #include "macros.h"
const ULONG blub[6] = {
0xDEADCAFE,
sizeof(struct Sana2DeviceStats),
sizeof(struct ServerData),
sizeof(struct DevUnit),
sizeof(struct devbase)
};
/* enable heavy debug (D2=beginIO) */ /* enable heavy debug (D2=beginIO) */
#define D2(x) #define D2(x)
#define D4(x) #define D4(x)
+1 -1
View File
@@ -213,7 +213,7 @@ struct MCastEntry
/* PROTOS */ /* PROTOS */
ASM LONG LibNull( void ); //ASM LONG LibNull( void );
ASM SAVEDS struct Device *DevInit(ASMR(d0) DEVBASEP ASMREG(d0), ASM SAVEDS struct Device *DevInit(ASMR(d0) DEVBASEP ASMREG(d0),
ASMR(a0) BPTR seglist ASMREG(a0), ASMR(a0) BPTR seglist ASMREG(a0),
+35 -7
View File
@@ -22,19 +22,45 @@
#include "device.h" #include "device.h"
/* Enable this if you want pure C for the device. (disable compilation of romtag.asm in that case) /* Enable this if you want pure C for the device. (disable compilation of romtag.asm in that case)
I personally prefer the small ASM blob to steer away from linking challenges. I personally prefer a small ASM blob to steer away from linking challenges.
*/ */
#if 1 #if 1
ASM LONG LibNull( void )
{
return 0;
}
extern const char DeviceName[]; extern const char DeviceName[];
extern const char DeviceVersionString[]; extern const char DeviceVersionString[];
extern const APTR DeviceInitTab[]; extern const APTR DeviceInitTab[];
/* force moveq #0,d0;rts in front of the ROMTAG */
#if 1
struct myrt0 {
ULONG ret0;
struct Resident rt;
};
/* There is a trick here:
LibNull() is actually a function returning 0
*/
const struct myrt0 LibNull =
{
0x70004E75,
{
RTC_MATCHWORD,
( struct Resident* ) ((char *)&LibNull+sizeof(ULONG)),
( struct Resident* ) ((char *)&LibNull+sizeof(ULONG)+sizeof(struct Resident)),
RTF_AUTOINIT,
DEVICEVERSION,
NT_DEVICE,
0,
(char*)DeviceName,
(char*)DeviceVersionString+6,
(APTR)DeviceInitTab
}
};
#else
/* hope that the compiler will put LibNull first */
ASM LONG LibNull( void )
{
return 0;
}
static const struct Resident _00RomTag = { static const struct Resident _00RomTag = {
RTC_MATCHWORD, RTC_MATCHWORD,
( struct Resident* ) &_00RomTag, ( struct Resident* ) &_00RomTag,
@@ -49,5 +75,7 @@ static const struct Resident _00RomTag = {
}; };
#endif #endif
#endif
+1
View File
@@ -32,6 +32,7 @@ static const char _DeviceVersionString[] = "$VER: " xstr(DEVICENAME) " " xstr(DE
const char *DeviceVersionString = (const char *)_DeviceVersionString; const char *DeviceVersionString = (const char *)_DeviceVersionString;
const char DeviceName[] = xstr(DEVICENAME); const char DeviceName[] = xstr(DEVICENAME);
ASM LONG LibNull( void );
const APTR DeviceFunctions[] = { const APTR DeviceFunctions[] = {
(APTR) DevOpen, (APTR) DevOpen,
+60 -3
View File
@@ -22,6 +22,7 @@
; enable debugging code block (comment/uncomment, see below) ; enable debugging code block (comment/uncomment, see below)
DEBUG EQU 0 DEBUG EQU 0
GLOBALINT_BOARD EQU 1 ;if 1, then toggle board interrupt, else ENC624 INTIE GLOBALINT_BOARD EQU 1 ;if 1, then toggle board interrupt, else ENC624 INTIE
OPT_AVOID_DEFAULT_RESETS EQU 0 ;if 1, then check valid Microchip MAC OUI and don't reset the whole chip if the MAC address is ok
incdir src:baxnet/trunk/source/ incdir src:baxnet/trunk/source/
;Temp:Amiga/src/Zorro-LAN-IDE.git/Driver/enc624j6net/ ;Temp:Amiga/src/Zorro-LAN-IDE.git/Driver/enc624j6net/
@@ -375,6 +376,7 @@ txtestlen EQU *-txtestframe
; Please note that this call will overwrite Board registers and ; Please note that this call will overwrite Board registers and
; buffer memory. Call before initialization. ; buffer memory. Call before initialization.
_enc624j6l_CheckBoard: ;check whether board is operating correctly _enc624j6l_CheckBoard: ;check whether board is operating correctly
a
movem.l d1-d2/a0-a1,-(sp) movem.l d1-d2/a0-a1,-(sp)
move.l a0,d0 move.l a0,d0
@@ -395,17 +397,72 @@ _enc624j6l_CheckBoard: ;check whether board is operating correctly
SETREG EUDAST,a0,d0 ;clear ENC's bus (does not change anything in its regs) SETREG EUDAST,a0,d0 ;clear ENC's bus (does not change anything in its regs)
READREG EUDAST,a0,d0 ; READREG EUDAST,a0,d0 ;
cmp.w d0,d1 ;do we get the register back ? cmp.w d0,d1 ;do we get the register back ?
bne.s .err ;no -> complain bne .err ;no -> complain
; ------------- second initial check: can we read/write all bits? -----
move.w #$5555,d1
move.w d1,(a0) ;write into memory
moveq #0,d0
SETREG EUDAST,a0,d0 ;clear ENC's bus (does not change anything in its regs)
move.w (a0),d0
cmp.w d0,d1 ;do we get the data back ?
bne .err ;no -> complain
not.w d1 ;move.w #$AAAA,d1 ;d1 was $5555
move.w d1,(a0) ;write into memory
moveq #0,d0
SETREG EUDAST,a0,d0 ;clear ENC's bus (does not change anything in its regs)
move.w (a0),d0
cmp.w d0,d1 ;do we get the register back ?
bne .err ;no -> complain
; ---------------- disable board interrupt (for now) ------------------
moveq #0,d0 ;magic trick: the board enables Interrupts moveq #0,d0 ;magic trick: the board enables Interrupts
lea $4000(a0),a0 lea $4000(a0),a0
move.w d0,($4000,a0) ;0=disable interrupt move.w d0,($4000,a0) ;0=disable interrupt
lea -$4000(a0),a0 lea -$4000(a0),a0
; ------------------------- reset device ------------------------------
move #EIR_CRYPTEN|EIR_MODEXIF|EIR_HASHIF|EIR_AESIF|EIR_LINKIF|EIR_PRDYIF|EIR_PKTIF|EIR_DMAIF|EIR_TXIF|EIR_TXABTIF|EIR_RXABTIF|EIR_PCFULIF,d0 move #EIR_CRYPTEN|EIR_MODEXIF|EIR_HASHIF|EIR_AESIF|EIR_LINKIF|EIR_PRDYIF|EIR_PKTIF|EIR_DMAIF|EIR_TXIF|EIR_TXABTIF|EIR_RXABTIF|EIR_PCFULIF,d0
CLRREG EIR,a0,d0 CLRREG EIR,a0,d0
; ------------------------- reset device ------------------------------
ifne OPT_AVOID_DEFAULT_RESETS
READREG ESTAT,a0,d0
and #(ESTAT_CLKRDY|ESTAT_RSTDONE|ESTAT_PHYRDY),d0
cmp #(ESTAT_CLKRDY|ESTAT_RSTDONE|ESTAT_PHYRDY),d0
bne.s .dorst
; chip seems alive
; check whether the OUI part of the MAC address is valid,
; by comparing with OUIs registered to Microchip
lea MAADR1L+2(a0),a1 ;after first pair of bytes
move.w -(a1),d0
rol.w #8,d0
swap d0
move.w -(a1),d0
lsl.w #8,d0 ;OUI<<8
lea .valid_microchip_ouis(pc),a1
.ouiloop:
tst.l (a1)
beq.s .dorst
cmp.l (a1)+,d0
beq.s .norst
bra.s .ouiloop
; 32 bit per entry, 0-terminated
.valid_microchip_ouis:
dc.b $00,$04,$A3,0
dc.b $00,$1E,$C0,0
dc.b $04,$91,$62,0
dc.b $54,$10,$EC,0
dc.b $80,$1F,$12,0
dc.b $D8,$80,$39,0
dc.b 0,0,0,0
.dorst:
endc OPT_AVOID_DEFAULT_RESETS
; ifne _OPT_LONGRESET ; ifne _OPT_LONGRESET
; moveq #ECON2_ETHRST,d0 ; moveq #ECON2_ETHRST,d0
; swap d0 ; swap d0
@@ -433,7 +490,7 @@ _enc624j6l_CheckBoard: ;check whether board is operating correctly
READREG EUDAST,A0,d0 READREG EUDAST,A0,d0
tst.w d0 ;should have gone to 0 after reset tst.w d0 ;should have gone to 0 after reset
bne.s .err ;(see above, we've written $1234) bne.s .err ;(see above, we've written $1234)
.norst
ifne 0 ifne 0
;---------- short RAM check - write phase ---------------------------- ;---------- short RAM check - write phase ----------------------------
+2 -1
View File
@@ -11,6 +11,7 @@
#define _INC_HWPRIVATE_H #define _INC_HWPRIVATE_H
#include "compiler.h" #include "compiler.h"
#include <libraries/configvars.h>
/* sdnet/v2expnet specific: polling timer */ /* sdnet/v2expnet specific: polling timer */
#include "intervaltimer.h" #include "intervaltimer.h"
@@ -22,7 +23,7 @@
struct HWData { struct HWData {
struct Interrupt hwd_Interrupt; /* keep the interrupt at top of HWData !! */ struct Interrupt hwd_Interrupt; /* keep the interrupt at top of HWData !! */
struct SignalSemaphore hwd_Sem; /* list locking (global per unit) */ struct SignalSemaphore hwd_Sem; /* list locking (global per unit) */
APTR hwd_act_boards[MAX_UNITS+1+3+1]; /* poll all active boards by ptr in interrupt, MAGIC_WORD INIT, NULL terminated, followed by SigTask,Sigbit,ExecBase */ APTR hwd_act_boards[MAX_UNITS+1+3]; /* poll all active boards by ptr in interrupt, NULL terminated, followed by SigTask,Sigbit,ExecBase */
ULONG hwd_SigMask; /* signal mask to wait for in server main instance */ ULONG hwd_SigMask; /* signal mask to wait for in server main instance */
+1 -1
View File
@@ -51,7 +51,7 @@ struct devbase;
#define HW_MACB_SPEEDS_END 18 /* this is the next free bit */ #define HW_MACB_SPEEDS_END 18 /* this is the next free bit */
#define HW_MAC_SPEEDSMASK ((1<<HW_MACB_SPEEDS_END)-4) #define HW_MAC_SPEEDSMASK ((1<<HW_MACB_SPEEDS_END)-4)
#define HW_MAC_NEXTSPEED(_a_) ( (_a_)+2 ) #define HW_MAC_NEXTSPEED(_a_) ( (_a_)+2 )
#define HW_MAGIC_WORD 0xB00BDEED
+1 -1
View File
@@ -39,5 +39,5 @@ HW_MACB_SPEED5000 EQU 10
HW_MACB_SPEED10000 EQU 12 ; Am I optimistic ? HW_MACB_SPEED10000 EQU 12 ; Am I optimistic ?
HW_MACB_SPEEDS_END EQU 14 ; this is the next free bit HW_MACB_SPEEDS_END EQU 14 ; this is the next free bit
HW_MAC_SPEEDSMASK EQU ((1<<HW_MACB_SPEEDS_END)-4) HW_MAC_SPEEDSMASK EQU ((1<<HW_MACB_SPEEDS_END)-4)
HW_MAGIC_WORD EQU $B00BDEED
endc ;_INC_HW_I endc ;_INC_HW_I
+9
View File
@@ -4,6 +4,8 @@
;include exec/exec_lib.i ;include exec/exec_lib.i
endc endc
include exec/execbase.i include exec/execbase.i
include device.i
ifnd _LVORawDoFmt ifnd _LVORawDoFmt
_LVORawDoFmt equ -$20a _LVORawDoFmt equ -$20a
@@ -49,4 +51,11 @@ _KPrintFa0a1:
rts rts
;DEBUG
dc.l $deadbeef
dc.l sds_SIZEOF
dc.l sv_SIZEOF
dc.l du_SIZEOF
dc.l db_SIZEOF
+3 -1
View File
@@ -620,6 +620,8 @@ static LONG server_queryext( DEVBASEP, ULONG unit, struct IOSana2Req *ioreq )
} }
s2qep->Actual = lastidx; s2qep->Actual = lastidx;
} }
#else
#warning "Building server.c without S2_DevQueryExtGetMII"
#endif #endif
#ifdef S2_DevQueryExtSetMII #ifdef S2_DevQueryExtSetMII
tval = GetTagData( S2_DevQueryExtSetMII, 0, tlist ); tval = GetTagData( S2_DevQueryExtSetMII, 0, tlist );
@@ -846,8 +848,8 @@ static LONG server_writequeue( DEVBASEP, ULONG unit )
type = GetSucc( type ); type = GetSucc( type );
} }
} }
db->db_Units[unit].du_DevStats.PacketsSent++; db->db_Units[unit].du_DevStats.PacketsSent++;
ioreq->ios2_Req.io_Error = S2ERR_NO_ERROR; ioreq->ios2_Req.io_Error = S2ERR_NO_ERROR;
ioreq->ios2_WireError = S2WERR_GENERIC_ERROR; ioreq->ios2_WireError = S2WERR_GENERIC_ERROR;
REMOVE( (struct Node*)ioreq ); REMOVE( (struct Node*)ioreq );
+2 -2
View File
@@ -9,9 +9,9 @@
#define _INC_VERSION_H #define _INC_VERSION_H
#define DEVICEVERSION 2 #define DEVICEVERSION 2
#define DEVICEREVISION 3 #define DEVICEREVISION 4
#define DEVICEEXTRA #define DEVICEEXTRA
/* #define DEVICEEXTRA Beta */ /* #define DEVICEEXTRA Beta */
#define DEVICEDATE 04.04.2019 #define DEVICEDATE 27.05.2019
#endif #endif