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