blob: 2f1665d17ac90608964bf4e41ae547c4fb32275c [file] [log] [blame]
Simon Glassf87bbff2014-11-14 20:56:33 -07001/*
2 * From coreboot file of same name
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#ifndef _PCI_ROM_H
8#define _PCI_ROM_H
9
10#define PCI_ROM_HDR 0xaa55
Simon Glassf87bbff2014-11-14 20:56:33 -070011
12struct pci_rom_header {
13 uint16_t signature;
14 uint8_t size;
15 uint8_t init[3];
16 uint8_t reserved[0x12];
17 uint16_t data;
18};
19
20struct pci_rom_data {
21 uint32_t signature;
22 uint16_t vendor;
23 uint16_t device;
24 uint16_t reserved_1;
25 uint16_t dlen;
26 uint8_t drevision;
27 uint8_t class_lo;
28 uint16_t class_hi;
29 uint16_t ilen;
30 uint16_t irevision;
31 uint8_t type;
32 uint8_t indicator;
33 uint16_t reserved_2;
34};
35
Simon Glass684818d2015-01-27 22:13:34 -070036/*
37 * Determines which execution method is used and whether we allow falling back
38 * to the other if the requested method is not available.
39 */
40enum pci_rom_emul {
41 PCI_ROM_EMULATE = 0 << 0,
42 PCI_ROM_USE_NATIVE = 1 << 0,
43 PCI_ROM_ALLOW_FALLBACK = 1 << 1,
44};
45
Simon Glassf87bbff2014-11-14 20:56:33 -070046 /**
47 * pci_run_vga_bios() - Run the VGA BIOS in an x86 PC
48 *
49 * @dev: Video device containing the BIOS
50 * @int15_handler: Function to call to handle int 0x15
Simon Glass684818d2015-01-27 22:13:34 -070051 * @exec_method: flags from enum pci_rom_emul
Simon Glassf87bbff2014-11-14 20:56:33 -070052 */
Simon Glass684818d2015-01-27 22:13:34 -070053int pci_run_vga_bios(pci_dev_t dev, int (*int15_handler)(void),
54 int exec_method);
Simon Glassf87bbff2014-11-14 20:56:33 -070055
56/**
57 * board_map_oprom_vendev() - map several PCI IDs to the one the ROM expects
58 *
59 * Some VGA option roms are used for several chipsets but they only have one
60 * PCI ID in their header. If we encounter such an option rom, we need to do
61 * the mapping ourselves.
62 *
63 * @vendev: Vendor and device for the video device
64 * @return standard vendor and device expected by the ROM
65 */
66uint32_t board_map_oprom_vendev(uint32_t vendev);
67
68#endif