|
@@ -102,17 +102,19 @@ static void ibft_set_ipaddr ( struct ibft_ipaddr *ipaddr, struct in_addr in ) {
|
102
|
102
|
/**
|
103
|
103
|
* Fill in an IP address within iBFT from configuration setting
|
104
|
104
|
*
|
|
105
|
+ * @v settings Parent settings block, or NULL
|
105
|
106
|
* @v ipaddr IP address field
|
106
|
107
|
* @v setting Configuration setting
|
107
|
108
|
* @v count Maximum number of IP addresses
|
108
|
109
|
*/
|
109
|
|
-static void ibft_set_ipaddr_setting ( struct ibft_ipaddr *ipaddr,
|
|
110
|
+static void ibft_set_ipaddr_setting ( struct settings *settings,
|
|
111
|
+ struct ibft_ipaddr *ipaddr,
|
110
|
112
|
const struct setting *setting,
|
111
|
113
|
unsigned int count ) {
|
112
|
114
|
struct in_addr in[count];
|
113
|
115
|
unsigned int i;
|
114
|
116
|
|
115
|
|
- fetch_ipv4_array_setting ( NULL, setting, in, count );
|
|
117
|
+ fetch_ipv4_array_setting ( settings, setting, in, count );
|
116
|
118
|
for ( i = 0 ; i < count ; i++ ) {
|
117
|
119
|
ibft_set_ipaddr ( &ipaddr[i], in[i] );
|
118
|
120
|
}
|
|
@@ -176,12 +178,14 @@ static int ibft_set_string ( struct ibft_strings *strings,
|
176
|
178
|
/**
|
177
|
179
|
* Fill in a string field within iBFT from configuration setting
|
178
|
180
|
*
|
|
181
|
+ * @v settings Parent settings block, or NULL
|
179
|
182
|
* @v strings iBFT string block descriptor
|
180
|
183
|
* @v string String field
|
181
|
184
|
* @v setting Configuration setting
|
182
|
185
|
* @ret rc Return status code
|
183
|
186
|
*/
|
184
|
|
-static int ibft_set_string_setting ( struct ibft_strings *strings,
|
|
187
|
+static int ibft_set_string_setting ( struct settings *settings,
|
|
188
|
+ struct ibft_strings *strings,
|
185
|
189
|
struct ibft_string *string,
|
186
|
190
|
const struct setting *setting ) {
|
187
|
191
|
struct settings *origin;
|
|
@@ -189,7 +193,7 @@ static int ibft_set_string_setting ( struct ibft_strings *strings,
|
189
|
193
|
int len;
|
190
|
194
|
char *dest;
|
191
|
195
|
|
192
|
|
- len = fetch_setting ( NULL, setting, &origin, &fetched, NULL, 0 );
|
|
196
|
+ len = fetch_setting ( settings, setting, &origin, &fetched, NULL, 0 );
|
193
|
197
|
if ( len < 0 ) {
|
194
|
198
|
string->offset = 0;
|
195
|
199
|
string->len = 0;
|
|
@@ -231,6 +235,7 @@ static int ibft_fill_nic ( struct ibft_nic *nic,
|
231
|
235
|
struct ll_protocol *ll_protocol = netdev->ll_protocol;
|
232
|
236
|
struct in_addr netmask_addr = { 0 };
|
233
|
237
|
unsigned int netmask_count = 0;
|
|
238
|
+ struct settings *parent = netdev_settings ( netdev );
|
234
|
239
|
int rc;
|
235
|
240
|
|
236
|
241
|
/* Fill in common header */
|
|
@@ -241,23 +246,23 @@ static int ibft_fill_nic ( struct ibft_nic *nic,
|
241
|
246
|
IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED );
|
242
|
247
|
|
243
|
248
|
/* Extract values from configuration settings */
|
244
|
|
- ibft_set_ipaddr_setting ( &nic->ip_address, &ip_setting, 1 );
|
|
249
|
+ ibft_set_ipaddr_setting ( parent, &nic->ip_address, &ip_setting, 1 );
|
245
|
250
|
DBG ( "iBFT NIC IP = %s\n", ibft_ipaddr ( &nic->ip_address ) );
|
246
|
|
- ibft_set_ipaddr_setting ( &nic->gateway, &gateway_setting, 1 );
|
|
251
|
+ ibft_set_ipaddr_setting ( parent, &nic->gateway, &gateway_setting, 1 );
|
247
|
252
|
DBG ( "iBFT NIC gateway = %s\n", ibft_ipaddr ( &nic->gateway ) );
|
248
|
|
- ibft_set_ipaddr_setting ( &nic->dns[0], &dns_setting,
|
|
253
|
+ ibft_set_ipaddr_setting ( NULL, &nic->dns[0], &dns_setting,
|
249
|
254
|
( sizeof ( nic->dns ) /
|
250
|
255
|
sizeof ( nic->dns[0] ) ) );
|
251
|
256
|
DBG ( "iBFT NIC DNS = %s", ibft_ipaddr ( &nic->dns[0] ) );
|
252
|
257
|
DBG ( ", %s\n", ibft_ipaddr ( &nic->dns[1] ) );
|
253
|
|
- if ( ( rc = ibft_set_string_setting ( strings, &nic->hostname,
|
|
258
|
+ if ( ( rc = ibft_set_string_setting ( NULL, strings, &nic->hostname,
|
254
|
259
|
&hostname_setting ) ) != 0 )
|
255
|
260
|
return rc;
|
256
|
261
|
DBG ( "iBFT NIC hostname = %s\n",
|
257
|
262
|
ibft_string ( strings, &nic->hostname ) );
|
258
|
263
|
|
259
|
264
|
/* Derive subnet mask prefix from subnet mask */
|
260
|
|
- fetch_ipv4_setting ( NULL, &netmask_setting, &netmask_addr );
|
|
265
|
+ fetch_ipv4_setting ( parent, &netmask_setting, &netmask_addr );
|
261
|
266
|
while ( netmask_addr.s_addr ) {
|
262
|
267
|
if ( netmask_addr.s_addr & 0x1 )
|
263
|
268
|
netmask_count++;
|