~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/kernel/ebda.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/x86/kernel/ebda.c (Version linux-6.12-rc7) and /arch/mips/kernel/ebda.c (Version linux-5.9.16)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 #include <linux/kernel.h>                         
  3 #include <linux/init.h>                           
  4 #include <linux/memblock.h>                       
  5                                                   
  6 #include <asm/setup.h>                            
  7 #include <asm/bios_ebda.h>                        
  8                                                   
  9 /*                                                
 10  * This function reserves all conventional PC     
 11  * firmware memory areas (some of which are da    
 12  * are code), that must not be used by the ker    
 13  * RAM.                                           
 14  *                                                
 15  * The BIOS places the EBDA/XBDA at the top of    
 16  * memory, and usually decreases the reported     
 17  * conventional memory (int 0x12) too.            
 18  *                                                
 19  * This means that as a first approximation on    
 20  * guess the reserved BIOS area by looking at     
 21  * value and assume that everything above that    
 22  * reserved.                                      
 23  *                                                
 24  * But life in firmware country is not that si    
 25  *                                                
 26  * - This code also contains a quirk for Dell     
 27  *   to reserve the EBDA area in the 'RAM size    
 28  *                                                
 29  * - The same quirk also avoids a problem with    
 30  *   chipset: reserve a page before VGA to pre    
 31  *   into it (errata #56). (Usually the page i    
 32  *   unless you have no PS/2 mouse plugged in.    
 33  *                                                
 34  * - Plus paravirt systems don't have a reliab    
 35  *   'BIOS RAM size' pointer we can rely on, s    
 36  *   them too.                                    
 37  *                                                
 38  * Due to those various problems this function    
 39  * very conservative and tries to err on the s    
 40  * too much, to not risk reserving too little.    
 41  *                                                
 42  * Losing a small amount of memory in the bott    
 43  * rarely a problem, as long as we have enough    
 44  * the SMP bootup trampoline which *must* be i    
 45  *                                                
 46  * Using memory that is in use by the BIOS or     
 47  * the BIOS didn't shut down *is* a big proble    
 48  * obviously.                                     
 49  */                                               
 50                                                   
 51 #define BIOS_RAM_SIZE_KB_PTR    0x413             
 52                                                   
 53 #define BIOS_START_MIN          0x20000U          
 54 #define BIOS_START_MAX          0x9f000U          
 55                                                   
 56 void __init reserve_bios_regions(void)            
 57 {                                                 
 58         unsigned int bios_start, ebda_start;      
 59                                                   
 60         /*                                        
 61          * NOTE: In a paravirtual environment     
 62          * area is absent. We'll just have to     
 63          * paravirt case can handle memory set    
 64          * without our help.                      
 65          */                                       
 66         if (!x86_platform.legacy.reserve_bios_    
 67                 return;                           
 68                                                   
 69         /*                                        
 70          * BIOS RAM size is encoded in kilobyt    
 71          * to bytes to get a first guess at wh    
 72          * firmware area starts:                  
 73          */                                       
 74         bios_start = *(unsigned short *)__va(B    
 75         bios_start <<= 10;                        
 76                                                   
 77         /*                                        
 78          * If bios_start is less than 128K, as    
 79          * and bump it up to 640K.  Similarly,    
 80          * don't trust it.                        
 81          */                                       
 82         if (bios_start < BIOS_START_MIN || bio    
 83                 bios_start = BIOS_START_MAX;      
 84                                                   
 85         /* Get the start address of the EBDA p    
 86         ebda_start = get_bios_ebda();             
 87                                                   
 88         /*                                        
 89          * If the EBDA start address is sane a    
 90          * then also reserve everything from t    
 91          * the BIOS region.                       
 92          */                                       
 93         if (ebda_start >= BIOS_START_MIN && eb    
 94                 bios_start = ebda_start;          
 95                                                   
 96         /* Reserve all memory between bios_sta    
 97         memblock_reserve(bios_start, 0x100000     
 98 }                                                 
 99                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php