blob: 75712636884eb37acc5b635d49ce3b69613c4ac3 [file] [log] [blame]
Simon Glassc30ea602014-11-14 20:56:28 -07001/*
2 * Copyright (C) 1996-1999 SciTech Software, Inc.
3 *
4 * SPDX-License-Identifier: GPL-2.0
5 */
6
7#ifndef _BIOS_EMUL_H
8#define _BIOS_EMUL_H
9
10/* Include the register header directly here */
11#include "../drivers/bios_emulator/include/x86emu/regs.h"
Simon Glassf87bbff2014-11-14 20:56:33 -070012#include <pci.h>
Simon Glassc30ea602014-11-14 20:56:28 -070013
14/****************************************************************************
15REMARKS:
16Data structure used to describe the details for the BIOS emulator system
17environment as used by the X86 emulator library.
18
19HEADER:
20biosemu.h
21
22MEMBERS:
23vgaInfo - VGA BIOS information structure
24biosmem_base - Base of the BIOS image
25biosmem_limit - Limit of the BIOS image
26busmem_base - Base of the VGA bus memory
27****************************************************************************/
28typedef struct {
29 int function;
30 int device;
31 int bus;
32 u32 VendorID;
33 u32 DeviceID;
Simon Glassd3e0c8f2016-01-17 16:11:09 -070034#ifdef CONFIG_DM_PCI
35 struct udevice *pcidev;
36#else
Simon Glassc30ea602014-11-14 20:56:28 -070037 pci_dev_t pcidev;
Simon Glassd3e0c8f2016-01-17 16:11:09 -070038#endif
Simon Glassc30ea602014-11-14 20:56:28 -070039 void *BIOSImage;
40 u32 BIOSImageLen;
41 u8 LowMem[1536];
42} BE_VGAInfo;
43
44struct vbe_mode_info;
45
Simon Glassd3e0c8f2016-01-17 16:11:09 -070046#ifdef CONFIG_DM_PCI
47int BootVideoCardBIOS(struct udevice *pcidev, BE_VGAInfo **pVGAInfo,
48 int clean_up);
49#else
50int BootVideoCardBIOS(pci_dev_t pcidev, BE_VGAInfo **pVGAInfo, int clean_up);
51#endif
Simon Glassc30ea602014-11-14 20:56:28 -070052
Simon Glassf87bbff2014-11-14 20:56:33 -070053/* Run a BIOS ROM natively (only supported on x86 machines) */
Simon Glassa0630862015-11-29 13:17:58 -070054void bios_run_on_x86(struct udevice *dev, unsigned long addr, int vesa_mode,
Simon Glassf87bbff2014-11-14 20:56:33 -070055 struct vbe_mode_info *mode_info);
56
57/**
58 * bios_set_interrupt_handler() - Install an interrupt handler for the BIOS
59 *
60 * This installs an interrupt handler that the BIOS will call when needed.
61 *
62 * @intnum: Interrupt number to install a handler for
63 * @int_handler_func: Function to call to handle interrupt
64 */
65void bios_set_interrupt_handler(int intnum, int (*int_handler_func)(void));
66
Simon Glassacda1cc2014-11-14 20:56:40 -070067void biosemu_set_interrupt_handler(int intnum, int (*int_func)(void));
68
Simon Glassd3e0c8f2016-01-17 16:11:09 -070069#ifdef CONFIG_DM_PCI
70int biosemu_setup(struct udevice *pcidev, BE_VGAInfo **pVGAInfo);
71
72int biosemu_run(struct udevice *dev, uchar *bios_rom, int bios_len,
73 BE_VGAInfo *vga_info, int clean_up, int vesa_mode,
74 struct vbe_mode_info *mode_info);
75#else
Simon Glassacda1cc2014-11-14 20:56:40 -070076int biosemu_setup(pci_dev_t pcidev, BE_VGAInfo **pVGAInfo);
77
78int biosemu_run(pci_dev_t pcidev, uchar *bios_rom, int bios_len,
79 BE_VGAInfo *vga_info, int clean_up, int vesa_mode,
80 struct vbe_mode_info *mode_info);
Simon Glassd3e0c8f2016-01-17 16:11:09 -070081#endif
Simon Glassacda1cc2014-11-14 20:56:40 -070082
Simon Glassc30ea602014-11-14 20:56:28 -070083#endif