xref: /linux/arch/x86/include/asm/bios_ebda.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21965aae3SH. Peter Anvin #ifndef _ASM_X86_BIOS_EBDA_H
31965aae3SH. Peter Anvin #define _ASM_X86_BIOS_EBDA_H
4bb898558SAl Viro 
5bb898558SAl Viro #include <asm/io.h>
6bb898558SAl Viro 
7bb898558SAl Viro /*
8f548ccd4SMike Waychison  * Returns physical address of EBDA.  Returns 0 if there is no EBDA.
9bb898558SAl Viro  */
get_bios_ebda(void)10bb898558SAl Viro static inline unsigned int get_bios_ebda(void)
11bb898558SAl Viro {
12f548ccd4SMike Waychison 	/*
13f548ccd4SMike Waychison 	 * There is a real-mode segmented pointer pointing to the
14f548ccd4SMike Waychison 	 * 4K EBDA area at 0x40E.
15f548ccd4SMike Waychison 	 */
16bb898558SAl Viro 	unsigned int address = *(unsigned short *)phys_to_virt(0x40E);
17bb898558SAl Viro 	address <<= 4;
18bb898558SAl Viro 	return address;	/* 0 means none */
19bb898558SAl Viro }
20bb898558SAl Viro 
21edce2121SIngo Molnar void reserve_bios_regions(void);
22bb898558SAl Viro 
23bb898558SAl Viro #ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
24bb898558SAl Viro /*
25bb898558SAl Viro  * This is obviously not a great place for this, but we want to be
26bb898558SAl Viro  * able to scatter it around anywhere in the kernel.
27bb898558SAl Viro  */
28bb898558SAl Viro void check_for_bios_corruption(void);
29bb898558SAl Viro void start_periodic_check_for_corruption(void);
30bb898558SAl Viro #else
check_for_bios_corruption(void)31bb898558SAl Viro static inline void check_for_bios_corruption(void)
32bb898558SAl Viro {
33bb898558SAl Viro }
34bb898558SAl Viro 
start_periodic_check_for_corruption(void)35bb898558SAl Viro static inline void start_periodic_check_for_corruption(void)
36bb898558SAl Viro {
37bb898558SAl Viro }
38bb898558SAl Viro #endif
39bb898558SAl Viro 
401965aae3SH. Peter Anvin #endif /* _ASM_X86_BIOS_EBDA_H */
41