2017-01-27 10:27:10 +01:00
# ifndef _ASM_E820_API_H
# define _ASM_E820_API_H
2008-05-14 08:15:40 -07:00
2017-01-27 09:58:02 +01:00
# include <asm/e820/types.h>
2016-12-05 11:49:13 -06:00
2017-01-27 13:54:38 +01:00
extern struct e820_table * e820_table ;
2017-01-28 10:07:49 +01:00
extern struct e820_table * e820_table_firmware ;
2008-05-11 00:30:15 -07:00
2008-07-21 22:19:29 +05:30
extern unsigned long pci_mem_start ;
2017-01-27 12:43:49 +01:00
2017-01-28 14:14:25 +01:00
extern int e820__mapped_any ( u64 start , u64 end , unsigned type ) ;
extern int e820__mapped_all ( u64 start , u64 end , unsigned type ) ;
x86/boot/e820: Create coherent API function names for E820 range operations
We have these three related functions:
extern void e820_add_region(u64 start, u64 size, int type);
extern u64 e820_update_range(u64 start, u64 size, unsigned old_type, unsigned new_type);
extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type, int checktype);
But it's not clear from the naming that they are 3 operations based around the
same 'memory range' concept. Rename them to better signal this, and move
the prototypes next to each other:
extern void e820__range_add (u64 start, u64 size, int type);
extern u64 e820__range_update(u64 start, u64 size, unsigned old_type, unsigned new_type);
extern u64 e820__range_remove(u64 start, u64 size, unsigned old_type, int checktype);
Note that this improved organization of the functions shows another problem that was easy
to miss before: sometimes the E820 entry type is 'int', sometimes 'unsigned int' - but this
will be fixed in a separate patch.
No change in functionality.
Cc: Alex Thorlton <athorlton@sgi.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Huang, Ying <ying.huang@intel.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul Jackson <pj@sgi.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-01-28 14:19:36 +01:00
extern void e820__range_add ( u64 start , u64 size , int type ) ;
extern u64 e820__range_update ( u64 start , u64 size , unsigned old_type , unsigned new_type ) ;
extern u64 e820__range_remove ( u64 start , u64 size , unsigned old_type , int checktype ) ;
2008-05-11 00:30:15 -07:00
extern void e820_print_map ( char * who ) ;
2017-01-28 14:09:20 +01:00
extern int e820__update_table ( struct e820_entry * biosmap , int max_nr_map , u32 * pnr_map ) ;
2017-01-28 14:03:04 +01:00
extern void e820__update_table_print ( void ) ;
2017-01-28 14:16:38 +01:00
extern void e820__setup_pci_gap ( void ) ;
2017-01-28 13:18:40 +01:00
extern void e820__memory_setup_extended ( u64 phys_addr , u32 data_len ) ;
2008-07-10 20:38:26 -07:00
extern unsigned long e820_end_of_ram_pfn ( void ) ;
extern unsigned long e820_end_of_low_ram_pfn ( void ) ;
2017-01-28 13:46:28 +01:00
extern u64 e820__memblock_alloc_reserved ( u64 sizet , u64 align ) ;
x86/boot/e820: Rename memblock_x86_fill() to e820__memblock_setup() and improve the explanations
So memblock_x86_fill() is another E820 code misnomer:
- nothing in its name tells us that it's part of the E820 subsystem ...
- The 'fill' wording is ambiguous and doesn't tell us whether it's a single
entry or some process - while the _real_ purpose of the function is hidden,
which is to do a complete setup of the (platform independent) memblock regions.
So rename it accordingly, to e820__memblock_setup().
Also translate this incomprehensible and misleading comment:
/*
* EFI may have more than 128 entries
* We are safe to enable resizing, beause memblock_x86_fill()
* is rather later for x86
*/
memblock_allow_resize();
The worst aspect of this comment isn't even the sloppy typos, but that it
casually mentions a '128' number with no explanation, which makes one lead
to the assumption that this is related to the well-known limit of a maximum
of 128 E820 entries passed via legacy bootloaders.
But no, the _real_ meaning of 128 here is that of the memblock subsystem,
which too happens to have a 128 entries limit for very early memblock
regions (which is unrelated to E820), via INIT_MEMBLOCK_REGIONS ...
So change the comment to a more comprehensible version:
/*
* The bootstrap memblock region count maximum is 128 entries
* (INIT_MEMBLOCK_REGIONS), but EFI might pass us more E820 entries
* than that - so allow memblock resizing.
*
* This is safe, because this call happens pretty late during x86 setup,
* so we know about reserved memory regions already. (This is important
* so that memblock resizing does no stomp over reserved areas.)
*/
memblock_allow_resize();
No change in functionality.
Cc: Alex Thorlton <athorlton@sgi.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Huang, Ying <ying.huang@intel.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul Jackson <pj@sgi.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-01-28 11:37:42 +01:00
extern void e820__memblock_setup ( void ) ;
2017-01-28 13:25:45 +01:00
extern void e820_reserve_setup_data ( void ) ;
2017-01-28 13:37:17 +01:00
extern void e820__finish_early_params ( void ) ;
2008-06-16 13:03:31 -07:00
extern void e820_reserve_resources ( void ) ;
2008-08-28 13:52:25 -07:00
extern void e820_reserve_resources_late ( void ) ;
2017-01-28 09:58:49 +01:00
extern void e820__memory_setup ( void ) ;
extern char * e820__memory_setup_default ( void ) ;
2016-09-17 23:39:26 +02:00
extern void e820_reallocate_tables ( void ) ;
2017-01-27 12:43:49 +01:00
extern void e820_mark_nosave_regions ( unsigned long limit_pfn ) ;
2009-11-30 21:33:51 -08:00
/*
2017-01-27 12:43:49 +01:00
* Returns true iff the specified range [ start , end ) is completely contained inside
2009-11-30 21:33:51 -08:00
* the ISA region .
*/
2017-01-27 12:43:49 +01:00
static inline bool is_ISA_range ( u64 start , u64 end )
2009-11-23 14:44:39 -08:00
{
2017-01-27 12:43:49 +01:00
return start > = ISA_START_ADDRESS & & end < = ISA_END_ADDRESS ;
2009-11-23 14:44:39 -08:00
}
2008-01-30 13:33:08 +01:00
2017-01-27 10:27:10 +01:00
# endif /* _ASM_E820_API_H */