|
@@ -20,8 +20,10 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
20
|
20
|
|
21
|
21
|
#include <string.h>
|
22
|
22
|
#include <errno.h>
|
|
23
|
+#include <byteswap.h>
|
23
|
24
|
#include <gpxe/dhcp.h>
|
24
|
25
|
#include <gpxe/settings.h>
|
|
26
|
+#include <gpxe/device.h>
|
25
|
27
|
#include <gpxe/netdevice.h>
|
26
|
28
|
|
27
|
29
|
/** @file
|
|
@@ -36,6 +38,11 @@ struct setting mac_setting __setting = {
|
36
|
38
|
.description = "MAC address",
|
37
|
39
|
.type = &setting_type_hex,
|
38
|
40
|
};
|
|
41
|
+struct setting busid_setting __setting = {
|
|
42
|
+ .name = "busid",
|
|
43
|
+ .description = "Bus ID",
|
|
44
|
+ .type = &setting_type_hex,
|
|
45
|
+};
|
39
|
46
|
|
40
|
47
|
/**
|
41
|
48
|
* Store value of network device setting
|
|
@@ -74,6 +81,8 @@ static int netdev_fetch ( struct settings *settings, struct setting *setting,
|
74
|
81
|
void *data, size_t len ) {
|
75
|
82
|
struct net_device *netdev = container_of ( settings, struct net_device,
|
76
|
83
|
settings.settings );
|
|
84
|
+ struct device_description *desc = &netdev->dev->desc;
|
|
85
|
+ struct dhcp_netdev_desc dhcp_desc;
|
77
|
86
|
|
78
|
87
|
if ( setting_cmp ( setting, &mac_setting ) == 0 ) {
|
79
|
88
|
if ( len > netdev->ll_protocol->ll_addr_len )
|
|
@@ -81,6 +90,15 @@ static int netdev_fetch ( struct settings *settings, struct setting *setting,
|
81
|
90
|
memcpy ( data, netdev->ll_addr, len );
|
82
|
91
|
return netdev->ll_protocol->ll_addr_len;
|
83
|
92
|
}
|
|
93
|
+ if ( setting_cmp ( setting, &busid_setting ) == 0 ) {
|
|
94
|
+ dhcp_desc.type = desc->bus_type;
|
|
95
|
+ dhcp_desc.vendor = htons ( desc->vendor );
|
|
96
|
+ dhcp_desc.device = htons ( desc->device );
|
|
97
|
+ if ( len > sizeof ( dhcp_desc ) )
|
|
98
|
+ len = sizeof ( dhcp_desc );
|
|
99
|
+ memcpy ( data, &dhcp_desc, len );
|
|
100
|
+ return sizeof ( dhcp_desc );
|
|
101
|
+ }
|
84
|
102
|
|
85
|
103
|
return generic_settings_fetch ( settings, setting, data, len );
|
86
|
104
|
}
|