summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMichael Brown2017-05-16 17:58:01 +0200
committerMichael Brown2017-05-22 14:54:13 +0200
commitee9897fe641acab11ab99c5635a97fce0cb10a17 (patch)
tree4d06b2222781f4be1d12717197fc1c5147a181cb /src/core
parent[tls] Keep cipherstream window open until TLS negotiation is complete (diff)
downloadipxe-ee9897fe641acab11ab99c5635a97fce0cb10a17.tar.gz
ipxe-ee9897fe641acab11ab99c5635a97fce0cb10a17.tar.xz
ipxe-ee9897fe641acab11ab99c5635a97fce0cb10a17.zip
[settings] Extend numerical setting tags to 64 bits
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/memmap_settings.c38
-rw-r--r--src/core/settings.c4
2 files changed, 25 insertions, 17 deletions
diff --git a/src/core/memmap_settings.c b/src/core/memmap_settings.c
index 1098bd75..c620a034 100644
--- a/src/core/memmap_settings.c
+++ b/src/core/memmap_settings.c
@@ -142,28 +142,36 @@ static int memmap_settings_fetch ( struct settings *settings,
struct memory_map memmap;
struct memory_region *region;
uint64_t result = 0;
- unsigned int i;
+ unsigned int start;
unsigned int count;
+ unsigned int scale;
+ int include_start;
+ int include_length;
+ int ignore_nonexistent;
+ unsigned int i;
- DBGC ( settings, "MEMMAP start %ld count %ld %s%s%s%s scale %ld\n",
- MEMMAP_START ( setting->tag ), MEMMAP_COUNT ( setting->tag ),
- ( MEMMAP_INCLUDE_START ( setting->tag ) ? "start" : "" ),
- ( ( MEMMAP_INCLUDE_START ( setting->tag ) &&
- MEMMAP_INCLUDE_LENGTH ( setting->tag ) ) ? "+" : "" ),
- ( MEMMAP_INCLUDE_LENGTH ( setting->tag ) ? "length" : "" ),
- ( MEMMAP_IGNORE_NONEXISTENT ( setting->tag ) ? " ignore" : "" ),
- MEMMAP_SCALE ( setting->tag ) );
+ /* Parse settings tag */
+ start = MEMMAP_START ( setting->tag );
+ count = MEMMAP_COUNT ( setting->tag );
+ scale = MEMMAP_SCALE ( setting->tag );
+ include_start = MEMMAP_INCLUDE_START ( setting->tag );
+ include_length = MEMMAP_INCLUDE_LENGTH ( setting->tag );
+ ignore_nonexistent = MEMMAP_IGNORE_NONEXISTENT ( setting->tag );
+ DBGC ( settings, "MEMMAP start %d count %d %s%s%s%s scale %d\n",
+ start, count, ( include_start ? "start" : "" ),
+ ( ( include_start && include_length ) ? "+" : "" ),
+ ( include_length ? "length" : "" ),
+ ( ignore_nonexistent ? " ignore" : "" ), scale );
/* Fetch memory map */
get_memmap ( &memmap );
/* Extract results from memory map */
- count = MEMMAP_COUNT ( setting->tag );
- for ( i = MEMMAP_START ( setting->tag ) ; count-- ; i++ ) {
+ for ( i = start ; count-- ; i++ ) {
/* Check that region exists */
if ( i >= memmap.count ) {
- if ( MEMMAP_IGNORE_NONEXISTENT ( setting->tag ) ) {
+ if ( ignore_nonexistent ) {
continue;
} else {
DBGC ( settings, "MEMMAP region %d does not "
@@ -174,12 +182,12 @@ static int memmap_settings_fetch ( struct settings *settings,
/* Extract results from this region */
region = &memmap.regions[i];
- if ( MEMMAP_INCLUDE_START ( setting->tag ) ) {
+ if ( include_start ) {
result += region->start;
DBGC ( settings, "MEMMAP %d start %08llx\n",
i, region->start );
}
- if ( MEMMAP_INCLUDE_LENGTH ( setting->tag ) ) {
+ if ( include_length ) {
result += ( region->end - region->start );
DBGC ( settings, "MEMMAP %d length %08llx\n",
i, ( region->end - region->start ) );
@@ -187,7 +195,7 @@ static int memmap_settings_fetch ( struct settings *settings,
}
/* Scale result */
- result >>= MEMMAP_SCALE ( setting->tag );
+ result >>= scale;
/* Return result */
result = cpu_to_be64 ( result );
diff --git a/src/core/settings.c b/src/core/settings.c
index 87905722..3e5d416e 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -1478,9 +1478,9 @@ struct setting * find_setting ( const char *name ) {
* @v name Name
* @ret tag Tag number, or 0 if not a valid number
*/
-static unsigned long parse_setting_tag ( const char *name ) {
+static uint64_t parse_setting_tag ( const char *name ) {
char *tmp = ( ( char * ) name );
- unsigned long tag = 0;
+ uint64_t tag = 0;
while ( 1 ) {
tag = ( ( tag << 8 ) | strtoul ( tmp, &tmp, 0 ) );