1 /*#include "kernel.h"*/
2 #include <net/gen/ether.h>
3 #include <net/gen/eth_io.h>
4
5 /* PCI STUFF */
6 #define PCI_BASE_ADDRESS_0 0x10
7 #define PCI_BASE_ADDRESS_1 0x14
8 #define PCI_BASE_ADDRESS_2 0x18
9 #define PCI_BASE_ADDRESS_3 0x1c
10 #define PCI_BASE_ADDRESS_4 0x20
11 #define PCI_BASE_ADDRESS_5 0x24
12
13 #define PCI_BASE_ADDRESS_IO_MASK (~0x03)
14 #define PCI_BASE_ADDRESS_SPACE_IO 0x01
15 #define PCI_INTERRUPT_LINE 0x3c
16 #define PCI_INTERRUPT_PIN 0x3d
17
18 #define PCI_COMMAND_MASTER 0x4
19
20 #define PCI_VENDOR_ID_AMD 0x1022
21 #define PCI_DEVICE_ID_AMD_LANCE 0x2000
22
23
24 /* supported max number of ether cards */
25 #define EC_PORT_NR_MAX 2
26
27 /* macros for 'mode' */
28 #define EC_DISABLED 0x0
29 #define EC_SINK 0x1
30 #define EC_ENABLED 0x2
31
32 /* macros for 'flags' */
33 #define ECF_EMPTY 0x000
34 #define ECF_PACK_SEND 0x001
35 #define ECF_PACK_RECV 0x002
36 #define ECF_SEND_AVAIL 0x004
37 #define ECF_READING 0x010
38 #define ECF_PROMISC 0x040
39 #define ECF_MULTI 0x080
40 #define ECF_BROAD 0x100
41 #define ECF_ENABLED 0x200
42 #define ECF_STOPPED 0x400
43
44 /* === macros for ether cards (our generalized version) === */
45 #define EC_ISR_RINT 0x0001
46 #define EC_ISR_WINT 0x0002
47 #define EC_ISR_RERR 0x0010
48 #define EC_ISR_WERR 0x0020
49 #define EC_ISR_ERR 0x0040
50 #define EC_ISR_RST 0x0100
51
52 /* IOVEC */
53 #define IOVEC_NR 16
54 typedef struct iovec_dat
55 {
56 iovec_t iod_iovec[IOVEC_NR];
57 int iod_iovec_s;
58 int iod_proc_nr;
59 vir_bytes iod_iovec_addr;
60 } iovec_dat_t;
61
62 #define ETH0_SELECTOR 0x61
63 #define ETH1_SELECTOR 0x69
64
65 /* ====== ethernet card info. ====== */
66 typedef struct ether_card
67 {
68 /* ####### MINIX style ####### */
69 char port_name[sizeof("eth_card#n")];
70 int flags;
71 int mode;
72 int transfer_mode;
73 eth_stat_t eth_stat;
74 iovec_dat_t read_iovec;
75 iovec_dat_t write_iovec;
76 iovec_dat_t tmp_iovec;
77 vir_bytes write_s;
78 vir_bytes read_s;
79 int client;
80 message sendmsg;
81
82 /* ######## device info. ####### */
83 port_t ec_port;
84 phys_bytes ec_linmem;
85 int ec_irq;
86 int ec_int_pending;
87 int ec_hook;
88
89 int ec_ramsize;
90 /* PCI */
91 u8_t ec_pcibus;
92 u8_t ec_pcidev;
93 u8_t ec_pcifunc;
94
95 /* Addrassing */
96 u16_t ec_memseg;
97 vir_bytes ec_memoff;
98
99 ether_addr_t mac_address;
100 } ether_card_t;
101
102 #define DEI_DEFAULT 0x8000
103
Cache object: 72b0687d7310af1b1829f4974cbd62fc
|