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