Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Release 1.0
[palacios.git] / geekos / include / geekos / rtl8139.h
1 /*
2  * This file is part of the Palacios Virtual Machine Monitor developed
3  * by the V3VEE Project with funding from the United States National 
4  * Science Foundation and the Department of Energy.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2008, Matt Wojcik
11  * Copyright (c) 2008, Peter Kamm
12  * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org> 
13  * All rights reserved.
14  *
15  * Author: Matt Wojcik
16  * Author: Peter Kamm
17  *
18  * This is free software.  You are permitted to use,
19  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20  */
21
22 #ifndef GEEKOS_RTL8139_H
23 #define GEEKOS_RTL8139_H
24
25 #include <geekos/malloc.h>
26  
27 #define RTL8139_IRQ      11
28
29 #define RTL8139_BASE_ADDR       0xc100          /* Starting address of the card (a guess right now)*/
30
31 #define RTL8139_IDR0    RTL8139_BASE_ADDR               /* ID Registers */
32 #define RTL8139_IDR1    (RTL8139_BASE_ADDR + 0x01)
33 #define RTL8139_IDR2    (RTL8139_BASE_ADDR + 0x02)
34 #define RTL8139_IDR3    (RTL8139_BASE_ADDR + 0x03)
35 #define RTL8139_IDR4    (RTL8139_BASE_ADDR + 0x04)
36 #define RTL8139_IDR5    (RTL8139_BASE_ADDR + 0x05)
37
38 #define RTL8139_MAR0    (RTL8139_BASE_ADDR + 0x08)      /* Mulicast Registers*/
39 #define RTL8139_MAR1    (RTL8139_BASE_ADDR + 0x09)
40 #define RTL8139_MAR2    (RTL8139_BASE_ADDR + 0x0a)
41 #define RTL8139_MAR3    (RTL8139_BASE_ADDR + 0x0b)
42 #define RTL8139_MAR4    (RTL8139_BASE_ADDR + 0x0c)
43 #define RTL8139_MAR5    (RTL8139_BASE_ADDR + 0x0d)
44 #define RTL8139_MAR6    (RTL8139_BASE_ADDR + 0x0e)
45 #define RTL8139_MAR7    (RTL8139_BASE_ADDR + 0x0f)
46
47 #define RTL8139_TSD0    (RTL8139_BASE_ADDR + 0x10)      /* Tx Status of Descriptors */
48 #define RTL8139_TSD1    (RTL8139_BASE_ADDR + 0x14)
49 #define RTL8139_TSD2    (RTL8139_BASE_ADDR + 0x18)
50 #define RTL8139_TSD3    (RTL8139_BASE_ADDR + 0x1c)
51
52 #define RTL8139_TSAD0   (RTL8139_BASE_ADDR + 0x20)      /* Tx Start Address of Descriptors */
53 #define RTL8139_TSAD1   (RTL8139_BASE_ADDR + 0x24)
54 #define RTL8139_TSAD2   (RTL8139_BASE_ADDR + 0x28)
55 #define RTL8139_TSAD3   (RTL8139_BASE_ADDR + 0x2c)
56
57 #define RTL8139_RBSTART (RTL8139_BASE_ADDR + 0x30)      /* Rx Buffer Start Address */
58 #define RTL8139_ERBCR   (RTL8139_BASE_ADDR + 0x34)      /* Early Rx Byte Count Register */
59 #define RTL8139_ERSR    (RTL8139_BASE_ADDR + 0x36)      /* Early Rx Status Register */
60 #define RTL8139_CR      (RTL8139_BASE_ADDR + 0x37)      /* Command Register */
61 #define RTL8139_CAPR    (RTL8139_BASE_ADDR + 0x38)      /* Current Address of Pkt Read */
62 #define RTL8139_CBR     (RTL8139_BASE_ADDR + 0x3a)      /* Current Buffer Address */
63 #define RTL8139_IMR     (RTL8139_BASE_ADDR + 0x3c)      /* Intrpt Mask Reg */
64 #define RTL8139_ISR     (RTL8139_BASE_ADDR + 0x3e)      /* Intrpt Status Reg */
65 #define RTL8139_TCR     (RTL8139_BASE_ADDR + 0x40)      /* Tx Config Reg */
66 #define RTL8139_RCR     (RTL8139_BASE_ADDR + 0x44)      /* Rx Config Reg */
67 #define RTL8139_TCTR    (RTL8139_BASE_ADDR + 0x48)      /* Timer Count Reg */
68 #define RTL8139_MPC     (RTL8139_BASE_ADDR + 0x4c)      /* Missed Pkt Counter */
69 #define RTL8139_9346CR  (RTL8139_BASE_ADDR + 0x50)      /* 9346 Command Reg */
70 #define RTL8139_CONFIG0 (RTL8139_BASE_ADDR + 0x51)      /* Config Reg */
71 #define RTL8139_CONFIG1 (RTL8139_BASE_ADDR + 0x52)
72 #define RTL8139_TimerInt        (RTL8139_BASE_ADDR + 0x54)      /* Timer Intrpt Reg */
73 #define RTL8139_MSR     (RTL8139_BASE_ADDR + 0x58)      /* Media Status Reg */
74 #define RTL8139_CONFIG3 (RTL8139_BASE_ADDR + 0x59)      
75 #define RTL8139_CONFIG4 (RTL8139_BASE_ADDR + 0x5a)
76 #define RTL8139_MULINT  (RTL8139_BASE_ADDR + 0x5c)      /* Multiple Intrpt Select */
77 #define RTL8139_RERID   (RTL8139_BASE_ADDR + 0x5e)      
78 #define RTL8139_TSAD    (RTL8139_BASE_ADDR + 0x60)      /* Tx Status of All Descriptors */
79 #define RTL8139_BMCR    (RTL8139_BASE_ADDR + 0x62)      /* Basic Mode Control Register */
80 #define RTL8139_BMSR    (RTL8139_BASE_ADDR + 0x64)      /* Basic Mode Status Register */
81 #define RTL8139_ANAR    (RTL8139_BASE_ADDR + 0x66)      /* Auto-Negotiation Advertisement Register */
82 #define RTL8139_ANLPAR  (RTL8139_BASE_ADDR + 0x68)      /* Auto-Negotiation Link Partner Register */
83 #define RTL8139_ANER    (RTL8139_BASE_ADDR + 0x6a)      /* Auto-Negotiation Expansion Register */
84 #define RTL8139_DIS     (RTL8139_BASE_ADDR + 0x6c)      /* Disconnect Counter */
85 #define RTL8139_FCSC    (RTL8139_BASE_ADDR + 0x6e)      /* False Carrier Sense Counter */
86 #define RTL8139_NWAYTR  (RTL8139_BASE_ADDR + 0x70)      /* N-way Test Register */
87 #define RTL8139_REC     (RTL8139_BASE_ADDR + 0x72)      /* RX ER Counter */
88 #define RTL8139_CSCR    (RTL8139_BASE_ADDR + 0x74)      /* CS Config Register */
89 #define RTL8139_PHY1_PARM       (RTL8139_BASE_ADDR + 0x78)      /* PHY parameter */
90 #define RTL8139_TW_PARM (RTL8139_BASE_ADDR + 0x7c)      /* Twister parameter */
91 #define RTL8139_PHY2_PARM       (RTL8139_BASE_ADDR + 0x80)
92
93 #define RTL8139_CRC0    (RTL8139_BASE_ADDR + 0x84)      /* Power Management CRC Reg for wakeup frame */
94 #define RTL8139_CRC1    (RTL8139_BASE_ADDR + 0x85)
95 #define RTL8139_CRC2    (RTL8139_BASE_ADDR + 0x86)
96 #define RTL8139_CRC3    (RTL8139_BASE_ADDR + 0x87)
97 #define RTL8139_CRC4    (RTL8139_BASE_ADDR + 0x88)
98 #define RTL8139_CRC5    (RTL8139_BASE_ADDR + 0x89)
99 #define RTL8139_CRC6    (RTL8139_BASE_ADDR + 0x8a)
100 #define RTL8139_CRC7    (RTL8139_BASE_ADDR + 0x8b)
101
102 #define RTL8139_Wakeup0 (RTL8139_BASE_ADDR + 0x8c)      /* Power Management wakeup frame */
103 #define RTL8139_Wakeup1 (RTL8139_BASE_ADDR + 0x94)
104 #define RTL8139_Wakeup2 (RTL8139_BASE_ADDR + 0x9c)
105 #define RTL8139_Wakeup3 (RTL8139_BASE_ADDR + 0xa4)
106 #define RTL8139_Wakeup4 (RTL8139_BASE_ADDR + 0xac)
107 #define RTL8139_Wakeup5 (RTL8139_BASE_ADDR + 0xb4)
108 #define RTL8139_Wakeup6 (RTL8139_BASE_ADDR + 0xbc)
109 #define RTL8139_Wakeup7 (RTL8139_BASE_ADDR + 0xc4)
110
111 #define RTL8139_LSBCRO0 (RTL8139_BASE_ADDR + 0xcc)      /* LSB of the mask byte of wakeup frame */
112 #define RTL8139_LSBCRO1 (RTL8139_BASE_ADDR + 0xcd)
113 #define RTL8139_LSBCRO2 (RTL8139_BASE_ADDR + 0xce)
114 #define RTL8139_LSBCRO3 (RTL8139_BASE_ADDR + 0xcf)
115 #define RTL8139_LSBCRO4 (RTL8139_BASE_ADDR + 0xd0)
116 #define RTL8139_LSBCRO5 (RTL8139_BASE_ADDR + 0xd1)
117 #define RTL8139_LSBCRO6 (RTL8139_BASE_ADDR + 0xd2)
118 #define RTL8139_LSBCRO7 (RTL8139_BASE_ADDR + 0xd3)
119
120 #define RTL8139_Config5 (RTL8139_BASE_ADDR + 0xd8)
121
122 /* Interrupts */
123 #define PKT_RX          0x0001
124 #define RX_ERR          0x0002
125 #define TX_OK           0x0004
126 #define TX_ERR          0x0008
127 #define RX_BUFF_OF      0x0010
128 #define RX_UNDERRUN     0x0020
129 #define RX_FIFO_OF      0x0040
130 #define CABLE_LEN_CHNG  0x2000
131 #define TIME_OUT        0x4000
132 #define SERR            0x8000
133
134
135 void Init_8139();
136 int rtl8139_Send(uchar_t *packet, uint_t size);
137 int rtl8139_Receive();
138 void rtl8139_Clear_IRQ(uint_t interrupts);
139
140 #endif
141
142
143
144
145
146
147
148
149
150