?? il.asm
字號:
;Licensed by Intel for distribution without complete source.
;History:1740,1
;Thu Apr 05 13:33:33 2001 Handle unprogrammed EEPROM.
;Wed Jan 03 22:51:55 2001 Add DEVIDE_ID4 to support the Pro/100 VA -A. Wik
;Wed Dec 27 17:09:22 2000 Attempt to continue even though we seem to have no phy devices.
;Wed Dec 27 16:24:24 2000 Move messages from messages.inc into il.asm
;Mon Aug 23 14:28:56 1999 newer devices have bigger eeproms
;Mon Aug 23 13:16:28 1999 Add support for multiple device ids.
;Thu Jul 22 16:30:35 1999 default to half duplex, and fix some missing (but unused) symbols.
;Wed Jan 21 09:15:26 1998 Need to turn on bus_master in PCI command register.
;Wed Dec 10 16:15:46 1997 we were printing the self test FAILED msg twice.
; Jan 15 1997 Change incorporated into main distribution by Russell Nelson.
; Dec 18 1996 Fujitsu Computers, by M. Viima. EEPROM access changed so that the driver works properly in a 166 Pentium, too.
include options.inc
include chip.inc
include defs.asm
if CHIP EQ INTEL_82596
include 82596.inc
else
include 82557.inc
endif
include pci.inc
cgroup group code, _text, init
code segment para public 'code'
assume cs:cgroup, ds:cgroup
even
extrn sys_features : byte
extrn is_186 : byte ;=0 if 808[68], =1 if 80[123]86.
extrn is_pci : byte ;=0 if PCI, =1 if PCI
extrn decout : near
extrn int_no : byte
extrn int_num : word
extrn mem_map_io : word
extrn base_addr : word
extrn send_pkt : near
extrn set_ether : near
extrn do_config : near
extrn config_mii_mode : byte
extrn config_cdt : byte
extrn config_duplex : byte
extrn reset_chip : near
extrn wait_27ms : near
NOWARN
extrn wait : near
WARN
extrn do_timeout : near
extrn set_timeout : near
extrn timeout : word
extrn timeout_counter : word
extrn timeout_value : word
extrn multicast_fix : word
extrn issue_cmd : near
extrn wait_scb_non_active : near
extrn tx_buff_no : word
extrn buff_ptrs : word
extrn cmd_buff1 : byte
extrn cmd_buff2 : byte
extrn start_rfd : byte
extrn start_rbd : byte
extrn start_rx_buff : byte
extrn first_rfd : word
extrn last_rfd : word
extrn first_rbd : word
extrn last_rbd : word
extrn enable_board_int : near
extrn disable_board_int : near
if CHIP EQ INTEL_82596
extrn scb_buff : word
endif
;any code after this will not be kept after initialization. Buffers
;used by the program, if any, are allocated from the memory between
;end_resident and end_free_mem.
public end_resident,end_free_mem
end_resident label byte
end_free_mem label byte
extrn get_hex: near
include getea.asm
include lookstr.asm
include toupper.asm
extrn wordout: near
if LANGUAGE eq US_ENGLISH
public usage_msg, copyright_msg
bad_key_msg db "Unknown keyword on the command line.", CR,LF
usage_msg label byte
db "usage: ",short_name
db " [options] <packet_int_no> <slot_no> {connector} {speed} {duplex}",CR,LF
db "connector=[AUTO|UTP|BNC|AUI] speed=[SLOW|FAST] duplex=[HALF|FULL]",CR,LF,'$'
copyright_msg label byte
db "Packet driver for ",long_name,", vers "
db '0'+(majver / 10),'0'+(majver mod 10),".1",'0'+(vers mod 10),CR,LF
db "Supports: PCI.",CR,LF
db "Portions written by Morien W. Roberts; "
need_pci_msg db "A PCI BIOS is required for this driver.",CR,LF,'$'
irq_problem_msg db "Problem reading IRQ from PCI configuration.",CR,LF,'$'
self_test_msg db "Performing self test of chip....",'$'
self_test_ok_msg db " PASSED.",CR,LF,'$'
self_test_no_msg db " FAILED.",CR,LF,'$'
virtual_services db "Using virtual memory services of memory manager."
db CR,LF,'$'
no_virtual_services db "Not using any memory manager services.",CR,LF,'$'
problem_in_phys_add db "Problem with virtual memory services.",CR,LF,'$'
if CHIP EQ INTEL_82596
iscp_init_problem db "Problem with ISCP command.",CR,LF,'$'
else
load_base_msg db "Config failure - loading base registers.",CR,LF,'$'
fix_root_msg db "Multicast setup workaround used for ",'$'
fix_10bits db "10 Mbits",CR,LF,'$'
fix_100bits db "100 Mbits",CR,LF,'$'
fix_both db "both 10 Mbits and 100 Mbits",CR,LF,'$'
support_10_msg db "This board only supports 10 Mbits", CR,LF,'$'
support_100_msg db "This board supports 100 Mbits", CR,LF,'$'
phy_dev_code_0 db "No PHY device installed",CR,LF,'$'
phy_dev_code_1 db "Intel 82553 (PHY 100) A or B step",CR,LF,'$'
phy_dev_code_2 db "Intel 82553 (PHY 100) C step",CR,LF,'$'
phy_dev_code_3 db "Intel 82503 10Mps",CR,LF,'$'
phy_dev_code_4 db "National DP83840 100BASE-TX, C step",CR,LF,'$'
phy_dev_code_5 db "Seeq 80C240 - 100BASE-T4",CR,LF,'$'
phy_dev_code_6 db "Seeq 80C24 - 10Mps",CR,LF,'$'
phy_dev_code_7 db "Intel 82555",CR,LF,'$'
phy_dev_code_8 db "Unknown-8",CR,LF,'$'
phy_dev_code_9 db "Unknown-9",CR,LF,'$'
phy_dev_code_10 db "National DP83840 100BASE-TX,",CR,LF,'$'
phy_dev_code_11 db "Unknown-11",CR,LF,'$'
phy_dev_code_X db "Unknown",CR,LF,'$'
phys_1_msg db "PHY device 1 - ",'$'
phys_2_msg db "PHY device 2 - ",'$'
no_support_p_layer db "PHY device not supported in this driver",CR,LF,'$'
no_support_2_phy db "This driver does not support 2 PHY devices",CR,LF,'$'
tx_full_msg db "Negotiated speed 100Mbs (100Base-TX) full duplex",CR,LF,'$'
t4_half_msg db "Negotiated speed 100Mbs (100Base-T4) half duplex",CR,LF,'$'
tx_half_msg db "Negotiated speed 100Mbs (100Base-TX) half duplex",CR,LF,'$'
t_full_msg db "Negotiated speed 10Mbs (10Base-T) full duplex",CR,LF,'$'
t_half_msg db "Negotiated speed 10Mbs (10Base-T) half duplex",CR,LF,'$'
def_10_half_msg db "Using 10Mbs link at half duplex",CR,LF,'$'
def_10_full_msg db "Using 10Mbs link at full duplex",CR,LF,'$'
def_100_half_msg db "Using 100Mbs link at half duplex",CR,LF,'$'
def_100_full_msg db "Using 100Mbs link at full duplex",CR,LF,'$'
frcd_10_half_msg db "FORCED 10Mbs link at half duplex",CR,LF,'$'
frcd_10_full_msg db "FORCED 10Mbs link at full duplex",CR,LF,'$'
frcd_100_half_msg db "FORCED 100Mbs link at half duplex",CR,LF,'$'
frcd_100_full_msg db "FORCED 100Mbs link at full duplex",CR,LF,'$'
wait_neg_msg db "Waiting for negotiation to complete ",'$'
no_lp_msg db "Link partner does not support negotiation",CR,LF,'$'
negotiation_problem db CR,LF,"* * * * * * * "
db "WARNING - NWAY negotiation failed to complete "
db "* * * * * * *",CR,LF,'$'
no_neg_bits_msg db "ERROR - Link partner negotiatied no capabilities",CR,LF,'$'
no_common_capability db "No common link capability",CR,LF,'$'
auto_detect_nr_msg db "AUTO DETECT OF MEDIA "
db "NOT YET AVAILABLE FOR THIS CARD",CR,LF,'$'
endif
config_msg db "Config failure - config operation failed.",CR,LF,'$'
ether_add_msg db "Config failure - setting ethernet address.",CR,LF,'$'
int_no_name db "Interrupt number ",'$'
base_addr_name db "I/O port ",'$'
separator1_msg db ", $"
separator3_msg db " & $"
specified_failed db "An ",long_name
db " was not found at specified address.",CR,LF,'$'
scan_failed db "Scan of I/O space did not find ",long_name,CR,LF,'$'
reading_eeprom_chksum db "Reading EEPROM and calculating checksum...",'$'
eeprom_chksum_bad db CR,LF,"EEPROM Failed checksum validation; ",CR,LF,'$'
using_auto_msg db "Auto detecting media",CR,LF,'$'
using_10B_T_msg db "Using twisted pair cable",CR,LF,'$'
using_AUI_msg db "Using AUI interface",CR,LF,'$'
using_10B_2_msg db "Using coax cable",CR,LF,'$'
no_dev_rec db "No PHY_DEV_REC",CR,LF,'$'
public ether_add_msg1, ether_add_msg2
ether_add_msg1 db "Config failure - ethernet 1.",CR,LF,'$'
ether_add_msg2 db "Config failure - ethernet 2.",CR,LF,'$'
endif
last_timeout dw ?
copy_timeout dw ?
copy_timeout_counter dw ?
copy_timeout_value dw ?
get_speed_from_phy dw ?
cnvrt_to_phys_add dw ? ; Address of subroutine to convert to physical add
even
virtual_mem_struct:
dd 0 ;- 0 Region Size
dd 0 ;- 4 Region Offset
dw 0 ;- 8 Region Segment
dw 0 ;- A Buffer ID
dw 0 ;- C Low Physical Address
dw 0 ;- E High Physical Address
slot_no dw 16,0 ; slot # specified on the command line
device_id_list dw 1229h, 1209h, 1029h, 2449h, 2459h, 245dh
; ICH3
dw 1031h, 1032h, 1033h, 1034h, 1035h, 1036h, 1037h, 1038h
; ICH4
dw 1039h, 103Ah, 103Bh, 103Ch, 103Dh, 103Eh
; ICH5
dw 1050h, 1051h, 1052h, 1053h, 1054h, 1055h, 1056h, 1057h
dw 0
pci_bus_dev_no dw ? ; Storage for PCI bus / device number
vendorid dw ? ; Storage for vendor id of the used pci device
deviceid dw ? ; Storage for device id of the used pci device
connector db ?
temp_connector dw AUTO_CONNECTOR
user_speed dw 0
user_duplex dw 0
speed dw FAST_100
duplex dw HALF_DUPLEX
forced_speed_duplex db 0
media_strings label byte
db "AUTO",0
dw AUTO_CONNECTOR
db "UTP",0
dw TPE_CONNECTOR
db "BNC",0
dw BNC_CONNECTOR
db "AUI",0
dw AUI_CONNECTOR
db 0
speed_strings label byte
db "SLOW",0
dw SPEED_SLOW
db "FAST",0
dw SPEED_FAST
db "HALF",0
dw DUPLEX_HALF
db "FULL",0
dw DUPLEX_FULL
db 0
ALIGN 16
self_test_buff dd 0, -1 ; Results of the self-test test placed here
ALIGN 16
temp_buffer db 80 dup (0) ; TX buffer for media detect
if CHIP EQ INTEL_82596
ALIGN 16
scp_buff db size SCP_STRUC dup (0)
ALIGN 16
iscp_buff db size ISCP_STRUC dup (0)
else
got_mii_phy db NOT MII_PHY
checksum dw 0
address_bitmask dw 0
EEPROM_MAX equ 100h
eeprom_buff dw EEPROM_MAX DUP (0)
phy_layer_chip dw offset cgroup:phy_dev_code_0
dw offset cgroup:phy_dev_code_1
dw offset cgroup:phy_dev_code_2
dw offset cgroup:phy_dev_code_3
dw offset cgroup:phy_dev_code_4
dw offset cgroup:phy_dev_code_5
dw offset cgroup:phy_dev_code_6
dw offset cgroup:phy_dev_code_7
dw offset cgroup:phy_dev_code_8
dw offset cgroup:phy_dev_code_9
dw offset cgroup:phy_dev_code_10
dw offset cgroup:phy_dev_code_11
unknown_plc dw offset cgroup:phy_dev_code_X
supported_plc dw SUPPORTED ; Table of support PHY devices
dw SUPPORTED
dw NOT_SUPPORTED
dw NOT_SUPPORTED
dw SUPPORTED
dw NOT_SUPPORTED
dw SUPPORTED
dw SUPPORTED
dw SUPPORTED
dw SUPPORTED
dw SUPPORTED
dw SUPPORTED
dw NOT_SUPPORTED
setup_routines dw offset cgroup:no_setup_routine
dw offset cgroup:no_setup_routine
dw offset cgroup:no_setup_routine
dw offset cgroup:no_setup_routine
dw offset cgroup:setup_83840_routine
dw offset cgroup:no_setup_routine
dw offset cgroup:no_setup_routine
dw offset cgroup:setup_82555_routine
dw offset cgroup:no_setup_routine
dw offset cgroup:no_setup_routine
dw offset cgroup:setup_83840_routine
dw offset cgroup:no_setup_routine
dw offset cgroup:no_setup_routine
speed_duplex_msg dw offset cgroup:def_10_half_msg
dw offset cgroup:def_10_full_msg
dw offset cgroup:def_100_half_msg
dw offset cgroup:def_100_full_msg
dw offset cgroup:frcd_10_half_msg
dw offset cgroup:frcd_10_full_msg
dw offset cgroup:frcd_100_half_msg
dw offset cgroup:frcd_100_full_msg
endif
extrn set_recv_isr: near
;enter with si -> argument string, di -> wword to store.
;if there is no number, don't change the number.
extrn get_number: near
;enter with dx -> argument string, di -> wword to print.
extrn print_number: near
;-> the Ethernet address of the card.
extrn rom_address: byte
;print the character in al.
extrn chrout: near
;print a crlf
extrn crlf: near
; Enter with si -> argument string.
; Skip spaces and tabs. Exit with si -> first non-blank char.
extrn skip_blanks: near
public parse_args
parse_args:
; Exit with nc if all went well, cy otherwise.
mov di, offset cgroup:slot_no
call get_number
parse_args_again:
call skip_blanks
cmp al, CR ; Does an Ethernet address follow?
je parse_args_done ; No.
;upcase the string
push si
parse_args_0:
mov al,[si]
call to_upper
mov [si],al
inc si
cmp al, CR
jne parse_args_0
pop si
;is it a media string?
mov di, offset cgroup:media_strings
call lookup_string
jc parse_args_1
mov temp_connector, bx
jmp parse_args_again
;is it a line speed string?
parse_args_1:
mov di, offset cgroup:speed_strings
call lookup_string
jc parse_args_2
cmp bx, SPEED_SLOW
jne not_speed_slow
mov user_speed, SLOW_10
jmp parse_args_again
not_speed_slow:
cmp bx, SPEED_FAST
jne not_speed_fast
mov user_speed, FAST_100
jmp parse_args_again
not_speed_fast:
cmp bx, DUPLEX_HALF
jne not_duplex_half
mov user_duplex, HALF_DUPLEX
jmp parse_args_again
not_duplex_half:
cmp bx, DUPLEX_FULL
jne parse_args_again
mov user_duplex, FULL_DUPLEX
jmp parse_args_again
parse_args_2:
mov dx, offset cgroup:bad_key_msg
mov ah,9
int 21h
int 20h
parse_args_done:
clc
ret
public print_parameters
print_parameters:
;echo our command-line parameters
mov di, offset cgroup:int_no
mov dx, offset cgroup:int_no_name
call print_number
mov di, offset cgroup:base_addr
mov dx, offset cgroup:base_addr_name
call print_number
ret
public etopen
etopen:
; Initialize the driver.
; Fill in rom_address with the assigned address of the board.
assume ds:code
cmp is_pci, 1
je have_pci_bus
mov dx, offset cgroup:need_pci_msg ; A PCI bus is required
stc
ret
have_pci_bus:
.386 ; Must have >= 386
call check_virtual_mem_services
call etopen_chip
jc short exit_etopen
mov al, int_no ; Get board's interrupt vector
add al, 8
cmp al, 8+8 ; Is it a slave 8259 interrupt?
jb short set_int_num ; No.
add al, 70h - 8 - 8 ; Map it to the real interrupt.
set_int_num:
xor ah, ah ; Clear high byte
mov int_num, ax ; Set parameter_list int num.
call setup_receive ; Setup receive buffers & start reception
call set_recv_isr
call enable_board_int
clc
exit_etopen:
ret
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -