Path: blob/master/arch/x86/include/asm/bios_ebda.h
10821 views
#ifndef _ASM_X86_BIOS_EBDA_H1#define _ASM_X86_BIOS_EBDA_H23#include <asm/io.h>45/*6* Returns physical address of EBDA. Returns 0 if there is no EBDA.7*/8static inline unsigned int get_bios_ebda(void)9{10/*11* There is a real-mode segmented pointer pointing to the12* 4K EBDA area at 0x40E.13*/14unsigned int address = *(unsigned short *)phys_to_virt(0x40E);15address <<= 4;16return address; /* 0 means none */17}1819/*20* Return the sanitized length of the EBDA in bytes, if it exists.21*/22static inline unsigned int get_bios_ebda_length(void)23{24unsigned int address;25unsigned int length;2627address = get_bios_ebda();28if (!address)29return 0;3031/* EBDA length is byte 0 of the EBDA (stored in KiB) */32length = *(unsigned char *)phys_to_virt(address);33length <<= 10;3435/* Trim the length if it extends beyond 640KiB */36length = min_t(unsigned int, (640 * 1024) - address, length);37return length;38}3940void reserve_ebda_region(void);4142#ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION43/*44* This is obviously not a great place for this, but we want to be45* able to scatter it around anywhere in the kernel.46*/47void check_for_bios_corruption(void);48void start_periodic_check_for_corruption(void);49#else50static inline void check_for_bios_corruption(void)51{52}5354static inline void start_periodic_check_for_corruption(void)55{56}57#endif5859#endif /* _ASM_X86_BIOS_EBDA_H */606162