xref: /openbmc/u-boot/include/bios_emul.h (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0 */
2176bf4ceSSimon Glass /*
3176bf4ceSSimon Glass  * Copyright (C) 1996-1999 SciTech Software, Inc.
4176bf4ceSSimon Glass  */
5176bf4ceSSimon Glass 
6176bf4ceSSimon Glass #ifndef _BIOS_EMUL_H
7176bf4ceSSimon Glass #define _BIOS_EMUL_H
8176bf4ceSSimon Glass 
9176bf4ceSSimon Glass /* Include the register header directly here */
10176bf4ceSSimon Glass #include "../drivers/bios_emulator/include/x86emu/regs.h"
116854f87cSSimon Glass #include <pci.h>
12176bf4ceSSimon Glass 
13176bf4ceSSimon Glass /****************************************************************************
14176bf4ceSSimon Glass REMARKS:
15176bf4ceSSimon Glass Data structure used to describe the details for the BIOS emulator system
16176bf4ceSSimon Glass environment as used by the X86 emulator library.
17176bf4ceSSimon Glass 
18176bf4ceSSimon Glass HEADER:
19176bf4ceSSimon Glass biosemu.h
20176bf4ceSSimon Glass 
21176bf4ceSSimon Glass MEMBERS:
22176bf4ceSSimon Glass vgaInfo         - VGA BIOS information structure
23176bf4ceSSimon Glass biosmem_base    - Base of the BIOS image
24176bf4ceSSimon Glass biosmem_limit   - Limit of the BIOS image
25176bf4ceSSimon Glass busmem_base     - Base of the VGA bus memory
26176bf4ceSSimon Glass ****************************************************************************/
27176bf4ceSSimon Glass typedef struct {
28176bf4ceSSimon Glass 	int function;
29176bf4ceSSimon Glass 	int device;
30176bf4ceSSimon Glass 	int bus;
31176bf4ceSSimon Glass 	u32 VendorID;
32176bf4ceSSimon Glass 	u32 DeviceID;
337282672dSSimon Glass #ifdef CONFIG_DM_PCI
347282672dSSimon Glass 	struct udevice *pcidev;
357282672dSSimon Glass #else
36176bf4ceSSimon Glass 	pci_dev_t pcidev;
377282672dSSimon Glass #endif
38176bf4ceSSimon Glass 	void *BIOSImage;
39176bf4ceSSimon Glass 	u32 BIOSImageLen;
40176bf4ceSSimon Glass 	u8 LowMem[1536];
41176bf4ceSSimon Glass } BE_VGAInfo;
42176bf4ceSSimon Glass 
43176bf4ceSSimon Glass struct vbe_mode_info;
44176bf4ceSSimon Glass 
457282672dSSimon Glass #ifdef CONFIG_DM_PCI
467282672dSSimon Glass int BootVideoCardBIOS(struct udevice *pcidev, BE_VGAInfo **pVGAInfo,
477282672dSSimon Glass 		      int clean_up);
487282672dSSimon Glass #else
497282672dSSimon Glass int BootVideoCardBIOS(pci_dev_t pcidev, BE_VGAInfo **pVGAInfo, int clean_up);
507282672dSSimon Glass #endif
51176bf4ceSSimon Glass 
526854f87cSSimon Glass /* Run a BIOS ROM natively (only supported on x86 machines) */
538beb0bdaSSimon Glass void bios_run_on_x86(struct udevice *dev, unsigned long addr, int vesa_mode,
546854f87cSSimon Glass 		     struct vbe_mode_info *mode_info);
556854f87cSSimon Glass 
566854f87cSSimon Glass /**
576854f87cSSimon Glass  * bios_set_interrupt_handler() - Install an interrupt handler for the BIOS
586854f87cSSimon Glass  *
596854f87cSSimon Glass  * This installs an interrupt handler that the BIOS will call when needed.
606854f87cSSimon Glass  *
616854f87cSSimon Glass  * @intnum:		Interrupt number to install a handler for
626854f87cSSimon Glass  * @int_handler_func:	Function to call to handle interrupt
636854f87cSSimon Glass  */
646854f87cSSimon Glass void bios_set_interrupt_handler(int intnum, int (*int_handler_func)(void));
656854f87cSSimon Glass 
664c59f953SSimon Glass void biosemu_set_interrupt_handler(int intnum, int (*int_func)(void));
674c59f953SSimon Glass 
687282672dSSimon Glass #ifdef CONFIG_DM_PCI
697282672dSSimon Glass int biosemu_setup(struct udevice *pcidev, BE_VGAInfo **pVGAInfo);
707282672dSSimon Glass 
717282672dSSimon Glass int biosemu_run(struct udevice *dev, uchar *bios_rom, int bios_len,
727282672dSSimon Glass 		BE_VGAInfo *vga_info, int clean_up, int vesa_mode,
737282672dSSimon Glass 		struct vbe_mode_info *mode_info);
747282672dSSimon Glass #else
754c59f953SSimon Glass int biosemu_setup(pci_dev_t pcidev, BE_VGAInfo **pVGAInfo);
764c59f953SSimon Glass 
774c59f953SSimon Glass int biosemu_run(pci_dev_t pcidev, uchar *bios_rom, int bios_len,
784c59f953SSimon Glass 		BE_VGAInfo *vga_info, int clean_up, int vesa_mode,
794c59f953SSimon Glass 		struct vbe_mode_info *mode_info);
807282672dSSimon Glass #endif
814c59f953SSimon Glass 
82176bf4ceSSimon Glass #endif
83