📄 linux下8019驱动程序.txt
字号:
102 {"REALTEK", "RTL8019", {0x00, 0x00, 0xe8}}, /* no-name with Realtek chip */
103 {"LCS-8834", "LCS-8836", {0x04, 0x04, 0x37}}, /* ShinyNet (SET) */
104 {0,}
105 };
106 #endif
107
108 /* ---- No user-serviceable parts below ---- */
109
110 #define NE_BASE (dev->base_addr)
111 #define NE_CMD 0x00
112 #define NE_DATAPORT 0x10 /* NatSemi-defined port window offset. */
113 #define NE_RESET 0x1f /* Issue a read to reset, a write to clear. */
114 #define NE_IO_EXTENT 0x20
115
116 #define NE1SM_START_PG 0x20 /* First page of TX buffer */
117 #define NE1SM_STOP_PG 0x40 /* Last page +1 of RX ring */
118 #define NESM_START_PG 0x40 /* First page of TX buffer */
119 #define NESM_STOP_PG 0x80 /* Last page +1 of RX ring */
120
121 int ne_probe(struct net_device *dev);
122 static int ne_probe1(struct net_device *dev, int ioaddr);
123 static int ne_probe_isapnp(struct net_device *dev);
124
125 static int ne_open(struct net_device *dev);
126 static int ne_close(struct net_device *dev);
127
128 static void ne_reset_8390(struct net_device *dev);
129 static void ne_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
130 int ring_page);
131 static void ne_block_input(struct net_device *dev, int count,
132 struct sk_buff *skb, int ring_offset);
133 static void ne_block_output(struct net_device *dev, const int count,
134 const unsigned char *buf, const int start_page);
135
136
137 /* Probe for various non-shared-memory ethercards.
138
139 NEx000-clone boards have a Station Address PROM (SAPROM) in the packet
140 buffer memory space. NE2000 clones have 0x57,0x57 in bytes 0x0e,0x0f of
141 the SAPROM, while other supposed NE2000 clones must be detected by their
142 SA prefix.
143
144 Reading the SAPROM from a word-wide card with the 8390 set in byte-wide
145 mode results in doubled values, which can be detected and compensated for.
146
147 The probe is also responsible for initializing the card and filling
148 in the 'dev' and 'ei_status' structures.
149
150 We use the minimum memory size for some ethercard product lines, iff we can't
151 distinguish models. You can increase the packet buffer size by setting
152 PACKETBUF_MEMSIZE. Reported Cabletron packet buffer locations are:
153 E1010 starts at 0x100 and ends at 0x2000.
154 E1010-x starts at 0x100 and ends at 0x8000. ("-x" means "more memory")
155 E2010 starts at 0x100 and ends at 0x4000.
156 E2010-x starts at 0x100 and ends at 0xffff. */
157
158 int __init ne_probe(struct net_device *dev)
159 {
160 unsigned int base_addr = dev->base_addr;
161
162 SET_MODULE_OWNER(dev);
163
164 /* First check any supplied i/o locations. User knows best. <cough> */
165 if (base_addr > 0x1ff) /* Check a single specified location. */
166 return ne_probe1(dev, base_addr);
167 else if (base_addr != 0) /* Don't probe at all. */
168 return -ENXIO;
169
170 /* Then look for any installed ISAPnP clones */
171 if (isapnp_present() && (ne_probe_isapnp(dev) == 0))
172 return 0;
173
174 #ifndef MODULE
175 /* Last resort. The semi-risky ISA auto-probe. */
176 for (base_addr = 0; netcard_portlist[base_addr] != 0; base_addr++) {
177 int ioaddr = netcard_portlist[base_addr];
178 if (ne_probe1(dev, ioaddr) == 0)
179 return 0;
180 }
181 #endif
182
183 return -ENODEV;
184 }
185
186 static int __init ne_probe_isapnp(struct net_device *dev)
187 {
188 int i;
189
190 for (i = 0; isapnp_clone_list[i].vendor != 0; i++) {
191 struct pci_dev *idev = NULL;
192
193 while ((idev = isapnp_find_dev(NULL,
194 isapnp_clone_list[i].vendor,
195 isapnp_clone_list[i].function,
196 idev))) {
197 /* Avoid already found cards from previous calls */
198 if (idev->prepare(idev))
199 continue;
200 if (idev->activate(idev))
201 continue;
202 /* if no irq, search for next */
203 if (idev->irq_resource[0].start == 0)
204 continue;
205 /* found it */
206 dev->base_addr = idev->resource[0].start;
207 dev->irq = idev->irq_resource[0].start;
208 printk(KERN_INFO "ne.c: ISAPnP reports %s at i/o %#lx, irq %d.\n",
209 isapnp_clone_list[i].name,
210
211 dev->base_addr, dev->irq);
212 if (ne_probe1(dev, dev->base_addr) != 0) { /* Shouldn't happen. */
213 printk(KERN_ERR "ne.c: Probe of ISAPnP card at %#lx failed.\n", dev->base_addr);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -