scsi_ctron_ether.h revision 1.7 1 1.7 reinoud /* $NetBSD: scsi_ctron_ether.h,v 1.7 2005/01/31 23:06:41 reinoud Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*
4 1.1 thorpej * SCSI interface description
5 1.1 thorpej */
6 1.1 thorpej
7 1.1 thorpej
8 1.1 thorpej /*
9 1.1 thorpej * SCSI command format
10 1.1 thorpej */
11 1.1 thorpej
12 1.1 thorpej #define CTRON_ETHERCMD2(OP, SUB) {OP, SUB}
13 1.1 thorpej #define CTRON_ETHER_SEND CTRON_ETHERCMD2(0xc, 0x1)
14 1.2 thorpej #define CTRON_ETHER_RECV 0xe1
15 1.1 thorpej #define CTRON_ETHER_GET_ADDR CTRON_ETHERCMD2(0xc, 0x4)
16 1.1 thorpej #define CTRON_ETHER_ADD_PROTO CTRON_ETHERCMD2(0xd, 0x1)
17 1.1 thorpej #define CTRON_ETHER_REM_PROTO CTRON_ETHERCMD2(0xd, 0x2)
18 1.1 thorpej #define CTRON_ETHER_SET_MODE CTRON_ETHERCMD2(0xd, 0x3)
19 1.1 thorpej #define CTRON_ETHER_SET_MULTI CTRON_ETHERCMD2(0xd, 0x4)
20 1.1 thorpej #define CTRON_ETHER_REMOVE_MULTI CTRON_ETHERCMD2(0xd, 0x5)
21 1.1 thorpej #define CTRON_ETHER_GET_STATS CTRON_ETHERCMD2(0xd, 0x6)
22 1.1 thorpej #define CTRON_ETHER_SET_MEDIA CTRON_ETHERCMD2(0xd, 0x07)
23 1.1 thorpej #define CTRON_ETHER_GET_MEDIA CTRON_ETHERCMD2(0xd, 0x08)
24 1.1 thorpej #define CTRON_ETHER_SET_ADDR CTRON_ETHERCMD2(0xd, 0xA)
25 1.1 thorpej #define CTRON_ETHER_LOAD_IMAGE CTRON_ETHERCMD2(0xd, 0x09)
26 1.1 thorpej #define IS_RECV(generic) ((generic)->opcode == 0xe1)
27 1.1 thorpej #define IS_SEND(generic) ((generic)->opcode == 0xc && (generic)->bytes[0] == 0x1)
28 1.1 thorpej
29 1.1 thorpej struct scsi_ctron_ether_recv {
30 1.7 reinoud uint8_t opcode; /* This really *is* all */
31 1.1 thorpej };
32 1.1 thorpej
33 1.1 thorpej struct scsi_ctron_ether_generic {
34 1.7 reinoud uint8_t opcode[2];
35 1.7 reinoud uint8_t byte3;
36 1.7 reinoud uint8_t length[2];
37 1.7 reinoud uint8_t byte6;
38 1.1 thorpej };
39 1.1 thorpej
40 1.1 thorpej struct scsi_ctron_ether_set_mode {
41 1.7 reinoud uint8_t opcode[2];
42 1.7 reinoud uint8_t mode;
43 1.7 reinoud uint8_t length[2];
44 1.7 reinoud uint8_t byte6;
45 1.1 thorpej };
46 1.1 thorpej
47 1.1 thorpej
48 1.1 thorpej struct ctron_stats {
49 1.7 reinoud uint32_t frames_xmit;
50 1.7 reinoud uint32_t bytes_xmit;
51 1.7 reinoud uint32_t ucast_xmit; /* never incremented? */
52 1.7 reinoud uint32_t mcast_xmit; /* gets ucasts and mcasts?? */
53 1.7 reinoud uint32_t bcast_xmit;
54 1.7 reinoud uint32_t defer_xmit;
55 1.7 reinoud uint32_t sgl_coll;
56 1.7 reinoud uint32_t multi_coll;
57 1.7 reinoud uint32_t tot_xmit_err;
58 1.7 reinoud uint32_t late_coll;
59 1.7 reinoud uint32_t excess_coll;
60 1.7 reinoud uint32_t int_err_xmit;
61 1.7 reinoud uint32_t carr_err;
62 1.7 reinoud uint32_t media_abort;
63 1.7 reinoud uint32_t frames_rec;
64 1.7 reinoud uint32_t bytes_rec;
65 1.7 reinoud uint32_t ucast_rec; /* never incremented? */
66 1.7 reinoud uint32_t mcast_rec; /* gets ucasts and mcasts?? */
67 1.7 reinoud uint32_t bcast_rec;
68 1.7 reinoud uint32_t tot_rec_err;
69 1.7 reinoud uint32_t too_long;
70 1.7 reinoud uint32_t too_short;
71 1.7 reinoud uint32_t align_err;
72 1.7 reinoud uint32_t crc_err;
73 1.7 reinoud uint32_t len_err;
74 1.7 reinoud uint32_t int_err_rec;
75 1.7 reinoud uint32_t sqe_err;
76 1.1 thorpej };
77 1.1 thorpej
78 1.1 thorpej struct scsi_ctron_ether_inquiry_data {
79 1.1 thorpej /* standard; */
80 1.7 reinoud uint8_t device; /* 3 (T_CPU) */
81 1.7 reinoud uint8_t dev_qual2; /* 0 (fixed) */
82 1.7 reinoud uint8_t version; /* 0 */
83 1.7 reinoud uint8_t response_format; /* 0 */
84 1.7 reinoud uint8_t additional_len; /* 75!! */
85 1.7 reinoud uint8_t unused[2]; /* 0, 0 */
86 1.7 reinoud uint8_t flags; /* 0x18 (sync+linked!?) */
87 1.3 matthias char vendor[8]; /* ie; "Cabletrn" or "CABLETRN" */
88 1.3 matthias char product[16]; /* ie; "EA412/...." */
89 1.3 matthias char revision[4]; /* ie; "0100" or "1.00" */
90 1.3 matthias char extra[8]; /* ie; "00.00.19" or "01.00.00" */
91 1.1 thorpej /* non-standard; */
92 1.7 reinoud uint8_t hwaddr[6]; /* PROM ethernet addr */
93 1.7 reinoud uint8_t swaddr[6]; /* curr ethernet addr */
94 1.3 matthias char date[22]; /* firmware date string (asciz) */
95 1.7 reinoud uint8_t mtype; /* media type?? */
96 1.7 reinoud uint8_t hwport; /* value of h/w read port?? */
97 1.1 thorpej };
98 1.1 thorpej
99 1.1 thorpej enum scsi_ctron_ether_media {
100 1.3 matthias CMEDIA_PRIMARY=0, /* twisted pair */
101 1.3 matthias CMEDIA_SECONDARY=1, /* coax */
102 1.3 matthias CMEDIA_AUTOSENSE=2 /* set_media command only */
103 1.1 thorpej };
104