|
@@ -24,10 +24,10 @@
|
24
|
24
|
|
25
|
25
|
#include <stdint.h>
|
26
|
26
|
#include <string.h>
|
|
27
|
+#include <byteswap.h>
|
27
|
28
|
#include <gpxe/netdevice.h>
|
28
|
29
|
#include <gpxe/device.h>
|
29
|
30
|
#include <gpxe/pci.h>
|
30
|
|
-#include <gpxe/isapnp.h>
|
31
|
31
|
#include <gpxe/if_ether.h>
|
32
|
32
|
#include <gpxe/shutdown.h>
|
33
|
33
|
#include "pxe.h"
|
|
@@ -200,30 +200,30 @@ pxenv_undi_set_mcast_address ( struct s_PXENV_UNDI_SET_MCAST_ADDRESS
|
200
|
200
|
|
201
|
201
|
/* PXENV_UNDI_SET_STATION_ADDRESS
|
202
|
202
|
*
|
203
|
|
- * Status: working (deliberately incomplete)
|
|
203
|
+ * Status: working
|
204
|
204
|
*/
|
205
|
205
|
PXENV_EXIT_t
|
206
|
206
|
pxenv_undi_set_station_address ( struct s_PXENV_UNDI_SET_STATION_ADDRESS
|
207
|
207
|
*undi_set_station_address ) {
|
|
208
|
+
|
208
|
209
|
DBG ( "PXENV_UNDI_SET_STATION_ADDRESS" );
|
209
|
210
|
|
210
|
|
-#if 0
|
211
|
|
- /* We don't offer a facility to set the MAC address; this
|
212
|
|
- * would require adding extra code to all the Etherboot
|
213
|
|
- * drivers, for very little benefit. If we're setting it to
|
214
|
|
- * the current value anyway then return success, otherwise
|
215
|
|
- * return UNSUPPORTED.
|
|
211
|
+ /* If adapter is open, the change will have no effect; return
|
|
212
|
+ * an error
|
216
|
213
|
*/
|
217
|
|
- if ( memcmp ( nic.node_addr,
|
218
|
|
- &undi_set_station_address->StationAddress,
|
219
|
|
- ETH_ALEN ) == 0 ) {
|
220
|
|
- undi_set_station_address->Status = PXENV_STATUS_SUCCESS;
|
221
|
|
- return PXENV_EXIT_SUCCESS;
|
|
214
|
+ if ( pxe_netdev->state & NETDEV_OPEN ) {
|
|
215
|
+ undi_set_station_address->Status =
|
|
216
|
+ PXENV_STATUS_UNDI_INVALID_STATE;
|
|
217
|
+ return PXENV_EXIT_FAILURE;
|
222
|
218
|
}
|
223
|
|
-#endif
|
224
|
219
|
|
225
|
|
- undi_set_station_address->Status = PXENV_STATUS_UNSUPPORTED;
|
226
|
|
- return PXENV_EXIT_FAILURE;
|
|
220
|
+ /* Update MAC address */
|
|
221
|
+ memcpy ( pxe_netdev->ll_addr,
|
|
222
|
+ &undi_set_station_address->StationAddress,
|
|
223
|
+ pxe_netdev->ll_protocol->ll_addr_len );
|
|
224
|
+
|
|
225
|
+ undi_set_station_address = PXENV_STATUS_SUCCESS;
|
|
226
|
+ return PXENV_EXIT_SUCCESS;
|
227
|
227
|
}
|
228
|
228
|
|
229
|
229
|
/* PXENV_UNDI_SET_PACKET_FILTER
|
|
@@ -248,33 +248,11 @@ PXENV_EXIT_t pxenv_undi_get_information ( struct s_PXENV_UNDI_GET_INFORMATION
|
248
|
248
|
*undi_get_information ) {
|
249
|
249
|
struct device *dev = pxe_netdev->dev;
|
250
|
250
|
struct ll_protocol *ll_protocol = pxe_netdev->ll_protocol;
|
251
|
|
- unsigned int ioaddr;
|
252
|
|
- unsigned int irqno;
|
253
|
251
|
|
254
|
252
|
DBG ( "PXENV_UNDI_GET_INFORMATION" );
|
255
|
253
|
|
256
|
|
- switch ( dev->desc.bus_type ) {
|
257
|
|
- case BUS_TYPE_PCI: {
|
258
|
|
- struct pci_device *pci =
|
259
|
|
- container_of ( dev, struct pci_device, dev );
|
260
|
|
-
|
261
|
|
- ioaddr = pci->ioaddr;
|
262
|
|
- irqno = pci->irq;
|
263
|
|
- break; }
|
264
|
|
- case BUS_TYPE_ISAPNP: {
|
265
|
|
- struct isapnp_device *isapnp =
|
266
|
|
- container_of ( dev, struct isapnp_device, dev );
|
267
|
|
-
|
268
|
|
- ioaddr = isapnp->ioaddr;
|
269
|
|
- irqno = isapnp->irqno;
|
270
|
|
- break; }
|
271
|
|
- default:
|
272
|
|
- undi_get_information->Status = PXENV_STATUS_FAILURE;
|
273
|
|
- return PXENV_EXIT_FAILURE;
|
274
|
|
- }
|
275
|
|
-
|
276
|
|
- undi_get_information->BaseIo = ioaddr;
|
277
|
|
- undi_get_information->IntNumber = irqno;
|
|
254
|
+ undi_get_information->BaseIo = dev->desc.ioaddr;
|
|
255
|
+ undi_get_information->IntNumber = dev->desc.irq;
|
278
|
256
|
/* Cheat: assume all cards can cope with this */
|
279
|
257
|
undi_get_information->MaxTranUnit = ETH_MAX_MTU;
|
280
|
258
|
undi_get_information->HwType = ntohs ( ll_protocol->ll_proto );
|
|
@@ -384,17 +362,15 @@ PXENV_EXIT_t pxenv_undi_get_nic_type ( struct s_PXENV_UNDI_GET_NIC_TYPE
|
384
|
362
|
|
385
|
363
|
switch ( dev->desc.bus_type ) {
|
386
|
364
|
case BUS_TYPE_PCI: {
|
387
|
|
- struct pci_device *pci =
|
388
|
|
- container_of ( dev, struct pci_device, dev );
|
389
|
365
|
struct pci_nic_info *info = &undi_get_nic_type->info.pci;
|
390
|
366
|
|
391
|
367
|
undi_get_nic_type->NicType = PCI_NIC;
|
392
|
|
- info->Vendor_ID = pci->vendor;
|
393
|
|
- info->Dev_ID = pci->device;
|
394
|
|
- info->Base_Class = PCI_BASE_CLASS ( pci->class );
|
395
|
|
- info->Sub_Class = PCI_SUB_CLASS ( pci->class );
|
396
|
|
- info->Prog_Intf = PCI_PROG_INTF ( pci->class );
|
397
|
|
- info->BusDevFunc = PCI_BUSDEVFN ( pci->bus, pci->devfn );
|
|
368
|
+ info->Vendor_ID = dev->desc.vendor;
|
|
369
|
+ info->Dev_ID = dev->desc.device;
|
|
370
|
+ info->Base_Class = PCI_BASE_CLASS ( dev->desc.class );
|
|
371
|
+ info->Sub_Class = PCI_SUB_CLASS ( dev->desc.class );
|
|
372
|
+ info->Prog_Intf = PCI_PROG_INTF ( dev->desc.class );
|
|
373
|
+ info->BusDevFunc = dev->desc.location;
|
398
|
374
|
/* Cheat: remaining fields are probably unnecessary,
|
399
|
375
|
* and would require adding extra code to pci.c.
|
400
|
376
|
*/
|
|
@@ -402,14 +378,12 @@ PXENV_EXIT_t pxenv_undi_get_nic_type ( struct s_PXENV_UNDI_GET_NIC_TYPE
|
402
|
378
|
undi_get_nic_type->info.pci.SubDevice_ID = 0xffff;
|
403
|
379
|
break; }
|
404
|
380
|
case BUS_TYPE_ISAPNP: {
|
405
|
|
- struct isapnp_device *isapnp =
|
406
|
|
- container_of ( dev, struct isapnp_device, dev );
|
407
|
381
|
struct pnp_nic_info *info = &undi_get_nic_type->info.pnp;
|
408
|
382
|
|
409
|
383
|
undi_get_nic_type->NicType = PnP_NIC;
|
410
|
|
- info->EISA_Dev_ID = ( ( isapnp->vendor_id << 16 ) |
|
411
|
|
- isapnp->prod_id );
|
412
|
|
- info->CardSelNum = isapnp->csn;
|
|
384
|
+ info->EISA_Dev_ID = ( ( dev->desc.vendor << 16 ) |
|
|
385
|
+ dev->desc.device );
|
|
386
|
+ info->CardSelNum = dev->desc.location;
|
413
|
387
|
/* Cheat: remaining fields are probably unnecessary,
|
414
|
388
|
* and would require adding extra code to isapnp.c.
|
415
|
389
|
*/
|