/* ************************************************************************** * * Network driver interface for netboot bootrom * * Module: ndis.i86 * Purpose: Definitions for NDIS interface * Entries: None * ************************************************************************** * * Copyright (C) 1998-2007 Gero Kuhlmann <gero@gkminix.han.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: ndis.i86,v 1.5 2007/01/06 18:30:49 gkminix Exp $ * */ #ifndef NETDRVR_NDIS2_NDIS_I86 #define NETDRVR_NDIS2_NDIS_I86 /* ************************************************************************** * * NDIS version number this interface conforms to: */ #define NDIS_MAJOR_VER 2 /* major version number */ #define NDIS_MINOR_VER 0 /* minor version number */ /* ************************************************************************** * * NDIS module IDs: */ #define MODID_MAC 1 /* MAC module ID (only one MAC) */ #define MODID_PROT 2 /* protocol module ID */ /* ************************************************************************** * * Size of one generic NDIS hardware address: */ #define NDIS_HWADDR_SIZE 16 /* ************************************************************************** * * NDIS general request opcodes: */ #define NDIS_INIT_DIAG 1 /* initiate diagnostics */ #define NDIS_READ_ERR_LOG 2 /* read error log */ #define NDIS_SET_STA_ADDR 3 /* set station address */ #define NDIS_OPEN_ADAPTER 4 /* open adapter */ #define NDIS_CLOSE_ADAPTER 5 /* close adapter */ #define NDIS_RESET_MAC 6 /* reset adapter */ #define NDIS_SET_PKT_FLT 7 /* set packet filter */ #define NDIS_ADD_MULT_ADDR 8 /* add multicast address */ #define NDIS_DEL_MULT_ADDR 9 /* delete multicast address */ #define NDIS_UPDATE_STATS 10 /* update statistics */ #define NDIS_CLEAR_STATS 11 /* clear statistics */ #define NDIS_REQUEST_INT 12 /* request asynchronous notification */ #define NDIS_SET_FUNC_ADDR 13 /* set functional address */ #define NDIS_LOOKAHEAD 14 /* set size of lookahead buffer */ /* ************************************************************************** * * NDIS status indication opcodes: */ #define NDIS_RING_STATUS 1 /* return a change in ring status */ #define NDIS_ADAPTER_CHECK 2 /* return hardware status */ #define NDIS_START_RESET 3 /* imply that adapter has started reset */ #define NDIS_END_RESET 4 /* imply that adapter has finished reset */ #define NDIS_INTERRUPT 5 /* imply that an interrupt has occurred */ /* ************************************************************************** * * NDIS system request opcodes: */ #define NDIS_INITIATE_BIND 1 /* instruct module to bind */ #define NDIS_BIND 2 /* bind to a module */ #define NDIS_PREBIND 3 /* restart pre-bind initialization */ #define NDIS_INITIATE_UNBIND 4 /* instruct module to unbind */ #define NDIS_UNBIND 5 /* unbind from module */ /* ************************************************************************** * * NDIS error codes: */ #define NDISERR_SUCCESS 0x0000 /* success */ #define NDISERR_RELEASE 0x0001 /* wait for release */ #define NDISERR_QUEUED 0x0002 /* request queued */ #define NDISERR_RECOG 0x0003 /* frame not recognized */ #define NDISERR_REJECT 0x0004 /* frame rejected */ #define NDISERR_FORWARD 0x0005 /* frame should be forwarded */ #define NDISERR_RESOURCE 0x0006 /* out of resources */ #define NDISERR_PARAM 0x0007 /* invalid parameter */ #define NDISERR_FUNCTION 0x0008 /* invalid function */ #define NDISERR_SUPPORTED 0x0009 /* not supported */ #define NDISERR_HARDWARE 0x000A /* hardware error */ #define NDISERR_TRANSMIT 0x000B /* transmit error */ #define NDISERR_DEST 0x000C /* unrecognized destination */ #define NDISERR_BUFFER 0x000D /* buffer too small */ #define NDISERR_STARTED 0x0020 /* already started */ #define NDISERR_INCOMPLETE 0x0021 /* binding incomplete */ #define NDISERR_DRVINIT 0x0022 /* driver not initialized */ #define NDISERR_NOTFOUND 0x0023 /* hardware not found */ #define NDISERR_HWFAIL 0x0024 /* hardware failure */ #define NDISERR_CONFIG 0x0025 /* configuration failure */ #define NDISERR_INT 0x0026 /* interrupt conflict */ #define NDISERR_INCOMPATIBLE 0x0027 /* MAC incompatible */ #define NDISERR_INITFAIL 0x0028 /* initialization failed */ #define NDISERR_NOBIND 0x0029 /* no binding */ #define NDISERR_DISCONNECT 0x002A /* network might be disconnected */ #define NDISERR_OSVERSION 0x002B /* incompatible OS version */ #define NDISERR_REGISTERED 0x002C /* already registered */ #define NDISERR_PATH 0x002D /* path not found */ #define NDISERR_MEMORY 0x002E /* insufficient memory */ #define NDISERR_INFO 0x002F /* info not found */ #define NDISERR_GENERAL 0x00FF /* general failure */ /* ************************************************************************** * * Layout of Common Characteristics Table (CCT): */ .struct 0 cct_length: .struct .+2 /* length of CCT structure */ cct_ndis_major: .struct .+1 /* major NDIS version number */ cct_ndis_minor: .struct .+1 /* minor NDIS version number */ .struct .+2 /* reserved */ cct_mod_major: .struct .+1 /* major module version number */ cct_mod_minor: .struct .+1 /* minor module version number */ cct_function_flags: .struct .+4 /* module function flags */ cct_mod_name: .struct .+16 /* name of module (ASCIZ) */ cct_upper_level: .struct .+1 /* protocol level at upper boundary */ cct_upper_type: .struct .+1 /* interface type at upper boundary */ cct_lower_level: .struct .+1 /* protocol level at lower boundary */ cct_lower_type: .struct .+1 /* interface type at lower boundary */ cct_module_id: .struct .+2 /* module ID */ cct_module_ds: .struct .+2 /* module data segment */ cct_sysreq: .struct .+4 /* far ptr to system request entry */ cct_ssc: .struct .+4 /* far ptr to service specific char. */ cct_sss: .struct .+4 /* far ptr to service specific status */ cct_udt: .struct .+4 /* far ptr to upper dispatch table */ cct_ldt: .struct .+4 /* far ptr to lower dispatch table */ #define CCT_SIZE 0x0040 /* size of standard CCT structure */ /* * Module function flags: */ #define MODFUNC_UPPER_BIND 0x0001 /* upper boundary binding supported */ #define MODFUNC_LOWER_BIND 0x0002 /* lower boundary binding supported */ #define MODFUNC_DYN_BIND 0x0004 /* dynamic binding supported */ /* * Protocol ID at upper/lower boundary level: */ #define PROT_PHYS 0x00 /* physical layer */ #define PROT_MAC 0x01 /* Media Access Control (network drv) */ #define PROT_DATA_LINK 0x02 /* Data link protocol */ #define PROT_NETWORK 0x03 /* Network protocol */ #define PROT_TRANSPORT 0x04 /* Transport protocol */ #define PROT_SESSION 0x05 /* Session protocol */ #define PROT_UNDEF 0xFF /* undefined */ /* * Type ID of interface at upper/lower boundary level: */ #define TYPE_MAC 0x01 /* MAC interface */ #define TYPE_NCB 0x01 /* NCB interface for session protocol */ #define TYPE_PRIVATE 0x00 /* private interface for any protocol */ /* ************************************************************************** * * Service Specific Characteristics (SSC) structure for MAC interface: */ .struct 0 macssc_length: .struct .+2 /* length of MACSSC structure */ macssc_type_name: .struct .+16 /* type of MAC (ASCIZ) */ macssc_addr_len: .struct .+2 /* length of station address */ macssc_perm_addr: .struct .+16 /* permanent station address */ macssc_cur_addr: .struct .+16 /* current station address */ macssc_func_addr: .struct .+4 /* current functional address */ macssc_mcast_addr: .struct .+4 /* far ptr to multicast addr list */ macssc_link_speed: .struct .+4 /* link speed (bits/sec) */ macssc_sf_1: .struct .+2 /* first service flags word */ macssc_sf_2: .struct .+2 /* second service flags word */ macssc_frame_size: .struct .+2 /* maximum frame size */ macssc_tx_buf: .struct .+4 /* total transmit buffer capacity */ macssc_tx_alloc: .struct .+2 /* transmit buffer alloc block size */ macssc_rx_buf: .struct .+4 /* total reception buffer capacity */ macssc_rx_alloc: .struct .+2 /* reception buffer alloc block size */ macssc_ieee_vend: .struct .+3 /* IEEE vendor code */ macssc_vend_code: .struct .+1 /* vendor adapter code */ macssc_vend_desc: .struct .+4 /* far ptr to vendor description */ macssc_irq_level: .struct .+2 /* IRQ level */ macssc_tx_depth: .struct .+2 /* transmit queue depth */ macssc_max_data: .struct .+2 /* max number of data blocks */ #define MACSSC_SIZE 0x0060 /* size of standard MACSSC structure */ /* * MAC service flags: */ #define MAC_SF1_BROADCAST 0x0001 /* broadcast supported */ #define MAC_SF1_MULTICAST 0x0002 /* multicast supported */ #define MAC_SF1_FUNC_ADDR 0x0004 /* functional/group addressing supported */ #define MAC_SF1_PROMISCUOUS 0x0008 /* promiscuous mode supported */ #define MAC_SF1_STAT_ADDR 0x0010 /* software settable station address */ #define MAC_SF1_STAT_CUR 0x0020 /* statistics are always current */ #define MAC_SF1_INIT_DIAG 0x0040 /* InitiateDiagnostics call supported */ #define MAC_SF1_LOOPBACK 0x0080 /* loopback supported */ #define MAC_SF1_RECEIVE 0x0100 /* MAC does primarily ReceiveChain */ #define MAC_SF1_IBM_SOURCE 0x0200 /* IBM source routing supported */ #define MAC_SF1_RESET_MAC 0x0400 /* ResetMac call supported */ #define MAC_SF1_OPEN_CLOSE 0x0800 /* Open/Close calls supported */ #define MAC_SF1_INTERRUPT 0x1000 /* interrupt request supported */ #define MAC_SF1_SOURCE_BRIDGE 0x2000 /* source routing bridge supported */ #define MAC_SF1_GDT_VIRT 0x4000 /* GDT virtual addresses supported */ #define MAC_SF1_MULTIPLE 0x8000 /* multiple TransferDatas supported */ #define MAC_SF2_FRAME_SIZE 0x0001 /* FrameSize = 0 supported in lookahead */ /* ************************************************************************** * * Multicast address list: */ .struct 0 mcast_max_addr: .struct .+2 /* max. number of mcast addresses */ mcast_cur_addr: .struct .+2 /* current number of mcast addresses */ mcast_list: /* first multicast address (16 bytes) */ #define MCAST_ADDR_SIZE NDIS_HWADDR_SIZE /* size of each mcast addr */ /* ************************************************************************** * * Service Specific Status (SSS) structure for MAC interface: */ .struct 0 macsss_length: .struct .+2 /* length of status table */ macsss_update_time: .struct .+4 /* date/time of last status update */ macsss_status: .struct .+4 /* MAC status */ macsss_filter: .struct .+2 /* current packet filter */ macsss_media_stat: .struct .+4 /* far ptr to media specific stat. */ macsss_clear_time: .struct .+4 /* date/time of last statist. clear */ macsss_rx_frames: .struct .+4 /* total number of frames received */ macsss_rx_crc_frames: .struct .+4 /* number of frames with CRC errors */ macsss_rx_bytes: .struct .+4 /* total number of bytes received */ macsss_rx_discarded: .struct .+4 /* number of discarded frames */ macsss_rx_f_mcast: .struct .+4 /* received multicast frames */ macsss_rx_f_bcast: .struct .+4 /* received broadcast frames */ macsss_rx_error: .struct .+4 /* frames received with errors */ macsss_rx_maxsize: .struct .+4 /* frames exceeding maximum size */ macsss_rx_minsize: .struct .+4 /* frames smaller than minimum size */ macsss_rx_b_mcast: .struct .+4 /* received multicast bytes */ macsss_rx_b_bcast: .struct .+4 /* received broadcast bytes */ macsss_rx_hardware: .struct .+4 /* frames discarded by hardware */ macsss_tx_frames: .struct .+4 /* total number of frames transmitted */ macsss_tx_bytes: .struct .+4 /* total number of bytes transmitted */ macsss_tx_f_mcast: .struct .+4 /* transmitted multicast frames */ macsss_tx_f_bcast: .struct .+4 /* transmitted broadcast frames */ macsss_tx_b_mcast: .struct .+4 /* transmitted multicast bytes */ macsss_tx_b_bcast: .struct .+4 /* transmitted broadcast bytes */ macsss_tx_timeout: .struct .+4 /* frames with timeout errors */ macsss_tx_hardware: .struct .+4 /* frames discarded by hardware */ #define MACSSS_SIZE 0x0064 /* size of standard MACSSS structure */ /* * MAC status flags: */ #define MAC_STATUS_OPCODE 0x0007 /* status opcode bit mask */ #define MAC_STATUS_BOUND 0x0008 /* MAC is bound */ #define MAC_STATUS_OPEN 0x0010 /* MAC is open */ #define MAC_STATUS_PROGRESS 0x0020 /* status update is in progress */ #define MAC_OPCODE_INSTALL 0x00 /* hardware not installed */ #define MAC_OPCODE_STARTUP 0x01 /* MAC failed startup diagnostics */ #define MAC_OPCODE_CONFIG 0x02 /* MAC failed due to configuration error */ #define MAC_OPCODE_HARDWARE 0x03 /* hardware error */ #define MAC_OPCODE_SOFT 0x04 /* soft faults */ #define MAC_OPCODE_OK 0x07 /* hardware fully operational */ /* * MAC packet filter flags: */ #define MAC_FILTER_DIRECT 0x0001 /* directed and multicast */ #define MAC_FILTER_BROADCAST 0x0002 /* broadcast */ #define MAC_FILTER_PROMISCUOUS 0x0004 /* promiscuous */ #define MAC_FILTER_SOURCE 0x0008 /* all source routing */ /* ************************************************************************** * * Upper Dispatch Table (UDT) for MAC interface: */ .struct 0 macudt_cct: .struct .+4 /* far ptr to CCT */ macudt_request: .struct .+4 /* far ptr to request entry point */ macudt_tx_chain: .struct .+4 /* far ptr to TransmitChain */ macudt_tx_data: .struct .+4 /* far ptr to TransmitData */ macudt_rx_release: .struct .+4 /* far ptr to ReceiveRelease */ macudt_ind_on: .struct .+4 /* far ptr to IndicationOn */ macudt_ind_off: .struct .+4 /* far ptr to IndicationOff */ /* ************************************************************************** * * Lower Dispatch Table (LDT) for network protocol interface: */ .struct 0 protldt_cct: .struct .+4 /* far ptr to CCT */ protldt_flags: .struct .+4 /* interface flags */ protldt_req_confirm: .struct .+4 /* far ptr to RequestConfirm */ protldt_tx_confirm: .struct .+4 /* far ptr to TransmitConfirm */ protldt_rx_lah: .struct .+4 /* far ptr to ReceiveLookAhead */ protldt_ind_complete: .struct .+4 /* far ptr to IndicationComplete */ protldt_rx_chain: .struct .+4 /* far ptr to ReceiveChain */ protldt_status: .struct .+4 /* far ptr to status ind. handler */ /* * Interface flags: */ #define PROT_IF_NON_LLC 0x0001 /* handles non-LLC frames */ #define PROT_IF_LSAP_LLC 0x0002 /* handles specific-LSAP LLC frames */ #define PROT_IF_NON_LSAP_LLC 0x0004 /* handles non-specific-LSAP LLC frames */ /* ************************************************************************** * * Transmit buffer descriptors: */ .struct 0 txbuf_immed_len: .struct .+2 /* length of immediate data (max 64) */ txbuf_immed_ptr: .struct .+4 /* far ptr to immediate data buffer */ txbuf_data_count: .struct .+2 /* number of remaining data blocks */ txbuf_data_bufs: /* * Layout of each data buffer: */ .struct 0 txbuf_ptr_type: .struct .+2 /* type of data pointer */ txbuf_data_len: .struct .+2 /* data length in buffer */ txbuf_data_ptr: .struct .+4 /* far ptr to data buffer */ #define TXBUF_SIZE 0x0008 /* size of data buffer structure */ #define TXBUF_MINSIZE 0x0010 /* minimum size of transmit buffer */ /* * Data pointer types: */ #define TXBUF_PTR_PHYSICAL 0x00 /* pointer is a physical far pointer */ #define TXBUF_PTR_GDT 0x01 /* pointer uses a GDT entry */ /* ************************************************************************** * * Receive data buffer descriptors: */ .struct 0 rdbuf_data_count: .struct .+2 /* number of remaining data blocks */ rdbuf_data_bufs: /* first byte of data buffers */ /* * Layout of each data buffer: */ .struct 0 rdbuf_ptr_type: .struct .+2 /* type of data pointer */ rdbuf_data_len: .struct .+2 /* data length in buffer */ rdbuf_data_ptr: .struct .+4 /* far ptr to data buffer */ #define RDBUF_SIZE 0x0008 /* size of data buffer structure */ #define RDBUF_MINSIZE 0x000A /* minimum size of receive buffer */ /* * Data pointer types: */ #define RDBUF_PTR_PHYSICAL 0x00 /* pointer is a physical far pointer */ #define RDBUF_PTR_GDT 0x01 /* pointer uses a GDT entry */ /* ************************************************************************** * * Receive chain buffer descriptors: */ .struct 0 rxbuf_data_count: .struct .+2 /* number of received data buffers */ rxbuf_data_bufs: /* first byte of data buffers */ /* * Layout of each buffer: */ .struct 0 rxbuf_data_len: .struct .+2 /* data length in buffer */ rxbuf_data_ptr: .struct .+4 /* far ptr to data buffer */ #define RXBUF_SIZE 0x0006 /* size of data buffer structure */ #define RXBUF_MINSIZE 0x0008 /* minimum size of rxbuf descriptor */ /* ************************************************************************** * * Definition of request block for protocol manager: */ .struct 0 pmreq_opcode: .struct .+2 /* opcode */ pmreq_status: .struct .+2 /* return status */ pmreq_ptr1: .struct .+4 /* first far pointer */ pmreq_ptr2: .struct .+4 /* second far pointer */ pmreq_word1: .struct .+2 /* first return word */ #define PMREQ_SIZE 0x000E /* size of PM request block */ #define PMREQ_GPMI 1 /* opcode: GetProtocolManagerInfo */ #define PMREQ_RM 2 /* opcode: RegisterModule */ #define PMREQ_BAS 3 /* opcode: BindAndStart */ #define PMREQ_GPML 4 /* opcode: GetProtocolManagerLinkage */ #define PMREQ_GPIP 5 /* opcode: GetProtocolIniPath */ #define PMREQ_RPMI 6 /* opcode: RegisterProtocolManagerInfo */ #define PMREQ_IAR 7 /* opcode: InitAndRegister */ #define PMREQ_UAS 8 /* opcode: UnbindAndStop */ #define PMREQ_BS 9 /* opcode: BindStatus */ #define PMREQ_RS 10 /* opcode: RegisterStatus */ #define PMREQ_MINFN 1 /* minimum opcode number */ #define PMREQ_MAXFN 10 /* maximum opcode number */ #endif