Damien Zammit, le lun. 14 févr. 2022 06:57:40 +0000, a ecrit: > --- > i386/i386at/biosmem.c | 40 +++++++++++++++++++++++++++++++++------- > 1 file changed, 33 insertions(+), 7 deletions(-) > > diff --git a/i386/i386at/biosmem.c b/i386/i386at/biosmem.c > index 4f0914ca..354d0529 100644 > --- a/i386/i386at/biosmem.c > +++ b/i386/i386at/biosmem.c > @@ -73,14 +73,22 @@ static unsigned int biosmem_nr_boot_data __bootdata; > #define BIOSMEM_MAX_MAP_SIZE 128 > > /* > - * Memory range types. > + * Memory range types (as bitmask) > */ > -#define BIOSMEM_TYPE_AVAILABLE 1 > -#define BIOSMEM_TYPE_RESERVED 2 > -#define BIOSMEM_TYPE_ACPI 3 > -#define BIOSMEM_TYPE_NVS 4 > -#define BIOSMEM_TYPE_UNUSABLE 5 > -#define BIOSMEM_TYPE_DISABLED 6 > +#define BIOSMEM_TYPE_AVAILABLE (1u << 0) > +#define BIOSMEM_TYPE_RESERVED (1u << 1) > +#define BIOSMEM_TYPE_ACPI (1u << 2) > +#define BIOSMEM_TYPE_NVS (1u << 3) > +#define BIOSMEM_TYPE_UNUSABLE (1u << 4) > +#define BIOSMEM_TYPE_DISABLED (1u << 5)
Err, reading this again: that can't be right :) The entry type is not something you can choose the representation if, it's the e820 interface that decides it :) > +static void __boot > +biosmem_map_adjust_alignment(struct biosmem_map_entry *e) > +{ > + uint64_t end = e->base_addr + e->length; > + > + if (e->type & BIOSMEM_MASK_NARROW) { > + e->base_addr = vm_page_round (e->base_addr); > + e->length = vm_page_trunc (end) - e->base_addr; > + } else { > + e->base_addr = vm_page_trunc (e->base_addr); > + e->length = vm_page_round (end) - e->base_addr; > + } > +} Thinking again about it, I don't think we want to extend areas: think about the situation: biosmem: 000000000000000000:00000000000009fc00, available biosmem: 00000000000009fc00:0000000000000a0000, reserved biosmem: 0000000000000a0000:0000000000000a0100, reserved biosmem: 0000000000000a0100:0000000000000f0000, reserved you end up with two zones that span a0000:a1000. I'd say for now just narrow RAM/NVS/PMEM and not touch the rest. That won't be a problem for memmap anyway, we'll just be ignoring some small pieces of available memory. Samuel