18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_BIOS_EBDA_H
38c2ecf20Sopenharmony_ci#define _ASM_X86_BIOS_EBDA_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <asm/io.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/*
88c2ecf20Sopenharmony_ci * Returns physical address of EBDA.  Returns 0 if there is no EBDA.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_cistatic inline unsigned int get_bios_ebda(void)
118c2ecf20Sopenharmony_ci{
128c2ecf20Sopenharmony_ci	/*
138c2ecf20Sopenharmony_ci	 * There is a real-mode segmented pointer pointing to the
148c2ecf20Sopenharmony_ci	 * 4K EBDA area at 0x40E.
158c2ecf20Sopenharmony_ci	 */
168c2ecf20Sopenharmony_ci	unsigned int address = *(unsigned short *)phys_to_virt(0x40E);
178c2ecf20Sopenharmony_ci	address <<= 4;
188c2ecf20Sopenharmony_ci	return address;	/* 0 means none */
198c2ecf20Sopenharmony_ci}
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_civoid reserve_bios_regions(void);
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
248c2ecf20Sopenharmony_ci/*
258c2ecf20Sopenharmony_ci * This is obviously not a great place for this, but we want to be
268c2ecf20Sopenharmony_ci * able to scatter it around anywhere in the kernel.
278c2ecf20Sopenharmony_ci */
288c2ecf20Sopenharmony_civoid check_for_bios_corruption(void);
298c2ecf20Sopenharmony_civoid start_periodic_check_for_corruption(void);
308c2ecf20Sopenharmony_ci#else
318c2ecf20Sopenharmony_cistatic inline void check_for_bios_corruption(void)
328c2ecf20Sopenharmony_ci{
338c2ecf20Sopenharmony_ci}
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_cistatic inline void start_periodic_check_for_corruption(void)
368c2ecf20Sopenharmony_ci{
378c2ecf20Sopenharmony_ci}
388c2ecf20Sopenharmony_ci#endif
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#endif /* _ASM_X86_BIOS_EBDA_H */
41