#include "../drivers.h"#include <stdlib.h>#include <stdio.h>#include <string.h>#include <stddef.h>#include <minix/com.h>#include <minix/keymap.h>#include <minix/syslib.h>#include <minix/type.h>#include <minix/sysutil.h>#include <timers.h>#include <ibm/portio.h>#include <net/hton.h>#include <net/gen/ether.h>#include <net/gen/eth_io.h>#include <ibm/pci.h>#include <sys/types.h>#include <fcntl.h>#include <assert.h>#include <unistd.h>#include <sys/ioc_memory.h>#include "../../kernel/const.h"#include "../../kernel/config.h"#include "../../kernel/type.h"#include "rtl8139.h"Include dependency graph for rtl8139.c:

Go to the source code of this file.
Data Structures | |
| struct | pcitab |
| struct | re |
Defines | |
| #define | tmra_ut timer_t |
| #define | tmra_inittimer(tp) tmr_inittimer(tp) |
| #define | Proc_number(p) proc_number(p) |
| #define | debug 0 |
| #define | printW() ((void)0) |
| #define | vm_1phys2bus(p) (p) |
| #define | VERBOSE 1 |
| #define | RX_BUFSIZE RL_RCR_RBLEN_64K_SIZE |
| #define | RX_BUFBITS RL_RCR_RBLEN_64K |
| #define | N_TX_BUF RL_N_TX |
| #define | RE_PORT_NR 1 |
| #define | IOVEC_NR 16 |
| #define | RL_ENVVAR "RTLETH" |
| #define | REM_DISABLED 0x0 |
| #define | REM_ENABLED 0x1 |
| #define | REF_PACK_SENT 0x001 |
| #define | REF_PACK_RECV 0x002 |
| #define | REF_SEND_AVAIL 0x004 |
| #define | REF_READING 0x010 |
| #define | REF_EMPTY 0x000 |
| #define | REF_PROMISC 0x040 |
| #define | REF_MULTI 0x080 |
| #define | REF_BROAD 0x100 |
| #define | REF_ENABLED 0x200 |
| #define | rl_inb(port, offset) (my_inb((port) + (offset))) |
| #define | rl_inw(port, offset) (my_inw((port) + (offset))) |
| #define | rl_inl(port, offset) (my_inl((port) + (offset))) |
| #define | rl_outb(port, offset, value) (my_outb((port) + (offset), (value))) |
| #define | rl_outw(port, offset, value) (my_outw((port) + (offset), (value))) |
| #define | rl_outl(port, offset, value) (my_outl((port) + (offset), (value))) |
| #define | BUF_ALIGNMENT (64*1024) |
Typedefs | |
| typedef re | re_t |
Functions | |
| FORWARD | _PROTOTYPE (unsigned my_inb,(U16_t port)) |
| static unsigned | my_inb (U16_t port) |
| static unsigned | my_inw (U16_t port) |
| static unsigned | my_inl (U16_t port) |
| FORWARD | _PROTOTYPE (void my_outb,(U16_t port, U8_t value)) |
| FORWARD | _PROTOTYPE (void my_outl,(U16_t port, U32_t value)) |
| static void | my_outb (U16_t port, U8_t value) |
| static void | my_outw (U16_t port, U16_t value) |
| static void | my_outl (U16_t port, U32_t value) |
| _PROTOTYPE (static void sig_handler,(void)) | |
| _PROTOTYPE (static void rl_init,(message *mp)) | |
| _PROTOTYPE (static int rl_probe,(re_t *rep)) | |
| _PROTOTYPE (static void rl_conf_hw,(re_t *rep)) | |
| _PROTOTYPE (static void rl_readv,(message *mp, int from_int, int vectored)) | |
| _PROTOTYPE (static void mii_print_techab,(U16_t techab)) | |
| _PROTOTYPE (static void mii_print_stat_speed,(U16_t stat, U16_t extstat)) | |
| _PROTOTYPE (static void reply,(re_t *rep, int err, int may_block)) | |
| _PROTOTYPE (static void mess_reply,(message *req, message *reply)) | |
| _PROTOTYPE (static void put_userdata,(int user_proc, vir_bytes user_addr, vir_bytes count, void *loc_addr)) | |
| _PROTOTYPE (static int do_hard_int,(void)) | |
| _PROTOTYPE (static void rtl8139_dump,(message *m)) | |
| _PROTOTYPE (static void rl_watchdog_f,(timer_t *tp)) | |
| int | main (int argc, char *argv[]) |
| PRIVATE void | sig_handler () |
| static void | check_int_events (void) |
| static void | rtl8139_stop () |
| static void | rtl8139_dump (message *m) |
| static void | rl_init (message *mp) |
| static void | rl_pci_conf () |
| static int | rl_probe (re_t *rep) |
| static void | rl_conf_hw (re_t *rep) |
| static void | rl_init_buf (re_t *rep) |
| static void | rl_init_hw (re_t *rep) |
| static void | rl_reset_hw (re_t *rep) |
| static void | rl_confaddr (re_t *rep) |
| static void | rl_rec_mode (re_t *rep) |
| static void | rl_readv (message *mp, int from_int, int vectored) |
| static void | rl_writev (message *mp, int from_int, int vectored) |
| static void | rl_check_ints (re_t *rep) |
| static void | rl_report_link (re_t *rep) |
| static void | mii_print_techab (u16_t techab) |
| static void | mii_print_stat_speed (u16_t stat, u16_t extstat) |
| static void | rl_clear_rx (re_t *rep) |
| static void | rl_do_reset (re_t *rep) |
| static void | rl_getstat (message *mp) |
| static void | rl_getname (message *mp) |
| static void | reply (re_t *rep, int err, int may_block) |
| static void | mess_reply (message *req, message *reply_mess) |
| static void | put_userdata (int user_proc, vir_bytes user_addr, vir_bytes count, void *loc_addr) |
| static int | do_hard_int (void) |
| static int | rl_handler (re_t *rep) |
| static void | rl_watchdog_f (timer_t *tp) |
Variables | |
| static re_t | re_table [RE_PORT_NR] |
| static u16_t | eth_ign_proto |
| static tmra_ut | rl_watchdog |
| PRIVATE message | m |
| PRIVATE int | int_event_check |
| static char * | progname |
| int | errno |
|
|
Referenced by rl_init_buf(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 91 of file rtl8139.c. Referenced by check_int_events(), main(), rl_init(), rl_pci_conf(), rtl8139_dump(), and rtl8139_stop(). |
|
|
Definition at line 171 of file rtl8139.c. Referenced by rl_init(), and rl_rec_mode(). |
|
|
Definition at line 168 of file rtl8139.c. Referenced by rl_conf_hw(), and rl_init_hw(). |
|
|
Definition at line 172 of file rtl8139.c. Referenced by check_int_events(), rl_getstat(), rl_init(), rl_init_hw(), rl_readv(), and rl_writev(). |
|
|
Definition at line 170 of file rtl8139.c. Referenced by rl_init(), and rl_rec_mode(). |
|
|
Definition at line 165 of file rtl8139.c. Referenced by reply(), rl_check_ints(), and rl_readv(). |
|
|
Definition at line 164 of file rtl8139.c. Referenced by reply(), rl_check_ints(), and rl_writev(). |
|
|
Definition at line 169 of file rtl8139.c. Referenced by rl_init(), and rl_rec_mode(). |
|
|
Definition at line 167 of file rtl8139.c. Referenced by rl_check_ints(), rl_handler(), and rl_readv(). |
|
|
Definition at line 166 of file rtl8139.c. Referenced by rl_do_reset(), rl_handler(), rl_watchdog_f(), and rl_writev(). |
|
|
Definition at line 161 of file rtl8139.c. Referenced by rl_conf_hw(), rl_init(), and rtl8139_dump(). |
|
|
Definition at line 162 of file rtl8139.c. Referenced by check_int_events(), rl_conf_hw(), rl_getstat(), rl_init(), rl_readv(), rl_watchdog_f(), rl_writev(), rtl8139_dump(), and rtl8139_stop(). |
|
|
Definition at line 97 of file rtl8139.c. Referenced by rl_confaddr(), and rl_pci_conf(). |
|
|
Definition at line 203 of file rtl8139.c. Referenced by rl_check_ints(), rl_clear_rx(), rl_handler(), rl_readv(), rl_report_link(), and rl_reset_hw(). |
|
|
Definition at line 205 of file rtl8139.c. Referenced by rl_clear_rx(), rl_handler(), rl_init_hw(), rl_rec_mode(), rl_reset_hw(), rl_writev(), and rtl8139_dump(). |
|
|
Definition at line 204 of file rtl8139.c. Referenced by rl_clear_rx(), rl_handler(), rl_readv(), rl_report_link(), and rtl8139_dump(). |
|
|
Definition at line 225 of file rtl8139.c. Referenced by rl_clear_rx(), rl_handler(), rl_reset_hw(), and rtl8139_stop(). |
|
|
Definition at line 227 of file rtl8139.c. Referenced by rl_clear_rx(), rl_handler(), rl_rec_mode(), rl_reset_hw(), and rl_writev(). |
|
|
Definition at line 226 of file rtl8139.c. Referenced by rl_handler(), and rl_readv(). |
|
|
Definition at line 88 of file rtl8139.c. Referenced by rl_clear_rx(). |
|
|
Definition at line 87 of file rtl8139.c. Referenced by rl_init_buf(), and rl_readv(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
|
Definition at line 377 of file rtl8139.c. References assert, i, if(), re::re_flags, re::re_got_int, re::re_mode, RE_PORT_NR, re_table, REF_ENABLED, and REM_ENABLED. Referenced by main(). |
|
|
Definition at line 2107 of file rtl8139.c. References i, OK, printf, re_table, rl_handler(), s, and sys_irqenable. Referenced by main(). |
|
||||||||||||
|
Definition at line 278 of file rtl8139.c. References _pm_findproc, ANY, bit_set, check_int_events(), DEV_PING, DL_GETNAME, DL_GETSTAT, DL_INIT, DL_READ, DL_READV, DL_STOP, DL_WRITE, DL_WRITEV, do_hard_int(), do_stop(), do_vread(), env_parse(), env_setargs(), eth_ign_proto, FALSE, fkey_map, FKEY_PRESSED, HARD_INT, htons, i, notify, NULL, OK, panic, printf, PROC_EVENT, r, RE_PORT_NR, re_table, receive, rl_getname(), rl_getstat(), rl_init(), rl_init_buf(), rl_readv(), rl_watchdog_f(), rl_writev(), rtl8139_dump(), sig_handler(), strrchr(), SYN_ALARM, and TRUE. |
|
||||||||||||
|
|
|
||||||||||||
|
Definition at line 1736 of file rtl8139.c. References MII_ESTAT_1000TFD, MII_ESTAT_1000THD, MII_ESTAT_1000XFD, MII_ESTAT_1000XHD, MII_STATUS_100T2FD, MII_STATUS_100T2HD, MII_STATUS_100T4, MII_STATUS_100XFD, MII_STATUS_100XHD, MII_STATUS_10FD, MII_STATUS_10HD, MII_STATUS_EXT_STAT, and printf. |
|
|
Definition at line 1663 of file rtl8139.c. References MII_ANA_100T4, MII_ANA_100TXFD, MII_ANA_100TXHD, MII_ANA_10TFD, MII_ANA_10THD, MII_ANA_PAUSE_ASYM, MII_ANA_PAUSE_SYM, MII_ANA_SEL_802_3, MII_ANA_SEL_M, MII_ANA_TAF_M, MII_ANA_TAF_RES, MII_ANA_TAF_S, and printf. |
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||||||||||
|
Definition at line 2000 of file rtl8139.c. References OK, printf, SELF, and sys_datacopy. |
|
||||||||||||||||
|
Definition at line 1942 of file rtl8139.c. References DL_PACK_RECV, DL_PACK_SEND, DL_TASK_REPLY, ELOCKED, getuptime(), now, OK, panic, printf, printW, r, re_table, REF_PACK_RECV, REF_PACK_SENT, reply, send, and status. |
|
|
Definition at line 1452 of file rtl8139.c. References Abort(), assert, Buffer, c, counter, d, DL_READ, DL_READV, DL_WRITE, DL_WRITEV, e, Error, FALSE, False, Length, NCC, OK, R, REC, REF_PACK_RECV, REF_PACK_SENT, REF_READING, reply, reserved(), rl_clear_rx(), RL_CR, RL_CR_BUFE, rl_do_reset(), rl_inb, rl_readv(), rl_report_link(), rl_writev(), SIZE, System, Time, TimeOut, TRUE, and W. |
|
|
Definition at line 1838 of file rtl8139.c. References FALSE, getuptime(), HZ, i, NO_NUM, OK, panic, printf, RL_CAPR, RL_CBR, RL_CR, RL_CR_RE, rl_inb, rl_inl, rl_inw, rl_outb, rl_outl, RL_RBSTART, RL_RCR, rl_rec_mode(), RX_BUFBITS, and t1. Referenced by rl_check_ints(). |
|
|
Definition at line 689 of file rtl8139.c. References REF_EMPTY, REM_DISABLED, REM_ENABLED, and RL_TSD_ERTXTH_8. Referenced by rl_init(). |
|
|
Definition at line 933 of file rtl8139.c. References env_parse(), EP_SET, i, re_table, and RL_ENVVAR. Referenced by rl_init_hw(). |
|
|
Definition at line 1880 of file rtl8139.c. References FALSE, REF_SEND_AVAIL, rl_rec_mode(), rl_reset_hw(), and TRUE. Referenced by rl_check_ints(). |
|
|
Definition at line 1925 of file rtl8139.c. References DL_NAME_REPLY, OK, panic, progname, r, send, and strncpy(). Referenced by main(). |
|
|
Definition at line 1898 of file rtl8139.c. References assert, FALSE, OK, panic, put_userdata(), re::re_client, re::re_flags, re::re_mode, re::re_stat, re_table, REF_ENABLED, REM_ENABLED, and reply. Referenced by main(). |
|
|
Definition at line 2125 of file rtl8139.c. References FALSE, getuptime(), HZ, i, int_event_check, N_TX_BUF, NO_NUM, OK, panic, printf, REF_READING, REF_SEND_AVAIL, RL_CR, RL_CR_TE, RL_IMR_FOVW, RL_IMR_PUN, RL_IMR_RXOVW, rl_inb, rl_inl, rl_inw, RL_ISR, RL_ISR_RER, RL_ISR_ROK, RL_ISR_TER, RL_ISR_TOK, RL_MSR, rl_outb, rl_outl, rl_outw, RL_TCR, RL_TCR_CLRABT, RL_TCR_IFG_STD, RL_TSAD, RL_TSAD_TABT0, RL_TSAD_TABT1, RL_TSAD_TABT2, RL_TSAD_TABT3, RL_TSD0, RL_TSD_TABT, t1, and TRUE. Referenced by do_hard_int(). |
|
|
Definition at line 471 of file rtl8139.c. References assert, DL_BROAD_REQ, DL_INIT_REPLY, DL_MULTI_REQ, DL_PROMISC_REQ, ENXIO, HZ, message::m_type, mess_reply(), re::re_address, re::re_client, re::re_flags, re::re_mode, RE_PORT_NR, re_table, REF_BROAD, REF_ENABLED, REF_MULTI, REF_PROMISC, REM_DISABLED, REM_ENABLED, rl_conf_hw(), rl_init_hw(), rl_pci_conf(), rl_rec_mode(), rl_report_link(), rl_watchdog, sys_setalarm(), and tmra_inittimer. Referenced by main(). |
|
|
Definition at line 722 of file rtl8139.c. References BUF_ALIGNMENT, chunk, D, ETH_MAX_PACK_SIZE_TAGGED, i, malloc(), N_TX_BUF, off, OK, panic, RX_BUFSIZE, s, SELF, and sys_umap(). Referenced by main(). |
|
|
Definition at line 773 of file rtl8139.c. References debug, i, OK, printf, REF_EMPTY, REF_ENABLED, rl_confaddr(), rl_inl, rl_reset_hw(), RL_TCR, RL_TCR_HWVER_AM, RL_TCR_HWVER_BM, s, sys_irqenable, and sys_irqsetpolicy. Referenced by rl_init(). |
|
|
Definition at line 544 of file rtl8139.c. References env_get_param(), env_panic(), env_prefix(), FALSE, i, if(), re::re_name, RE_PORT_NR, re::re_seen, re_table, RL_ENVVAR, strcpy(), and val. Referenced by rl_init(). |
|
|
Definition at line 593 of file rtl8139.c. References FALSE, i, NO_NUM, panic, pci_find_dev(), pci_first_dev(), pci_ids(), printf, r, and TRUE. |
|
||||||||||||||||
|
Definition at line 1005 of file rtl8139.c. References assert, count, D, ETH_CRC_SIZE, ETH_MAX_PACK_SIZE, ETH_MAX_PACK_SIZE_TAGGED, eth_stat::ets_packetR, FALSE, i, iovec_t::iov_addr, iovec_t::iov_size, IOVEC_NR, j, n, NO_NUM, NONE, NULL, OK, p, panic, PHYS_SEG, printf, re::re_base_port, re::re_clear_rx, re::re_client, re::re_flags, re::re_iovec, re::re_mode, re::re_read_s, re::re_rx_buf, re::re_stat, re_table, re::re_tx, REF_ENABLED, REF_PACK_RECV, REF_READING, REM_ENABLED, reply, re::ret_buf, RL_CAPR, RL_CAPR_DATA_OFF, RL_CBR, RL_CR, RL_CR_BUFE, rl_inb, rl_inw, rl_outw, RL_RXS_LEN_S, RL_RXS_ROK, RX_BUFSIZE, s, SELF, size, suspend(), sys_abscopy, sys_physcopy(), sys_umap(), sys_vircopy(), and re::v_re_rx_buf. Referenced by main(), and rl_check_ints(). |
|
|
Definition at line 982 of file rtl8139.c. References REF_BROAD, REF_MULTI, REF_PROMISC, rl_inl, rl_outl, RL_RCR, RL_RCR_AAP, RL_RCR_AB, RL_RCR_AM, and RL_RCR_APM. Referenced by rl_clear_rx(), rl_do_reset(), and rl_init(). |
|
|
Definition at line 1544 of file rtl8139.c. References debug, FALSE, MII_ANE_LPANA, MII_ANE_PDF, MII_CTRL_ANE, MII_CTRL_DM, MII_CTRL_ISO, MII_CTRL_LB, MII_CTRL_PD, MII_CTRL_SP_10, MII_CTRL_SP_100, MII_CTRL_SP_1000, MII_CTRL_SP_LSB, MII_CTRL_SP_MSB, MII_CTRL_SP_RES, mii_print_stat_speed(), mii_print_techab(), MII_STATUS_ANA, MII_STATUS_ANC, MII_STATUS_EC, MII_STATUS_JD, MII_STATUS_LS, MII_STATUS_RF, printf, RL_ANAR, RL_ANER, RL_ANLPAR, RL_BMCR, RL_BMSR, rl_inb, rl_inw, RL_MSR, RL_MSR_LINKB, and RL_MSR_SPEED_10. Referenced by rl_check_ints(), and rl_init(). |
|
|
Definition at line 821 of file rtl8139.c. References assert, FALSE, getuptime(), HZ, i, MII_CTRL_RST, N_TX_BUF, NO_NUM, NULL, OK, panic, printf, R, RL_BMCR, RL_CR, RL_CR_RST, rl_inb, rl_inl, rl_outb, rl_outl, RL_RBSTART, RL_REVID, RL_TCR, RL_TCR_HWVER_AM, RL_TCR_HWVER_BM, RL_TCR_HWVER_RTL8100, RL_TCR_HWVER_RTL8100B, RL_TCR_HWVER_RTL8101, RL_TCR_HWVER_RTL8139, RL_TCR_HWVER_RTL8139A, RL_TCR_HWVER_RTL8139AG, RL_TCR_HWVER_RTL8139B, RL_TCR_HWVER_RTL8139CP, RL_TSAD0, RL_TSD0, RL_TSD_OWN, t, t1, vm_1phys2bus, and W. Referenced by rl_do_reset(), and rl_init_hw(). |
|
|
Definition at line 2400 of file rtl8139.c. References HZ, i, if(), re::re_flags, re::re_mode, re_table, re::re_tx_alive, REF_SEND_AVAIL, REM_ENABLED, sys_setalarm(), and TRUE. Referenced by main(). |
|
||||||||||||||||
|
Definition at line 1272 of file rtl8139.c. References assert, count, D, ETH_MAX_PACK_SIZE_TAGGED, ETH_MIN_PACK_SIZE, FALSE, i, iovec_t::iov_addr, iovec_t::iov_size, IOVEC_NR, j, n, N_TX_BUF, NO_NUM, NONE, OK, p, panic, PHYS_SEG, printf, re::re_base_port, re::re_client, re::re_ertxth, re::re_flags, re::re_iovec, re::re_mode, re::re_send_int, re_table, re::re_tx, re::re_tx_alive, re::re_tx_head, re::re_tx_mess, re::re_tx_tail, REF_ENABLED, REF_PACK_SENT, REF_SEND_AVAIL, REM_ENABLED, reply, re::ret_buf, re::ret_busy, rl_inl, RL_N_TX, rl_outl, RL_TSD0, s, SELF, size, suspend(), sys_abscopy, sys_physcopy(), sys_umap(), sys_vircopy(), TRUE, and re::v_ret_buf. Referenced by main(), and rl_check_ints(). |
|
|
|
Definition at line 396 of file rtl8139.c. References i, re::re_base_port, re::re_mode, RE_PORT_NR, re_table, REM_ENABLED, RL_CR, and rl_outb. Referenced by sig_handler(). |
|
|
Definition at line 360 of file rtl8139.c. References getsigset, rtl8139_stop(), sigismember, and SIGTERM. |
|
|
|
|
|
|
|
|
Definition at line 270 of file rtl8139.c. Referenced by rl_handler(). |
|
|
|
|
|
|
|
|
Definition at line 174 of file rtl8139.c. Referenced by check_int_events(), do_hard_int(), main(), reply(), rl_confaddr(), rl_getstat(), rl_init(), rl_pci_conf(), rl_readv(), rl_watchdog_f(), rl_writev(), rtl8139_dump(), and rtl8139_stop(). |
|
|
Definition at line 177 of file rtl8139.c. Referenced by rl_init(). |
1.4.6