1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 3 #ifndef PCI_ROM_H 4 #define PCI_ROM_H 5 6 #include <endian.h> 7 #include <acpi/acpi.h> 8 #include <cbfs.h> 9 #include <stdint.h> 10 11 #define PCI_ROM_HDR 0xAA55 12 #define PCI_DATA_HDR ((uint32_t)(('R' << 24) | ('I' << 16) | ('C' << 8) | 'P')) 13 14 #define PCI_RAM_IMAGE_START 0xD0000 15 #define PCI_VGA_RAM_IMAGE_START 0xC0000 16 17 struct rom_header { 18 uint16_t signature; 19 uint8_t size; 20 uint8_t init[3]; 21 uint8_t reserved[0x12]; 22 uint16_t data; 23 }; 24 25 struct pci_data { 26 uint32_t signature; 27 uint16_t vendor; 28 uint16_t device; 29 uint16_t reserved_1; 30 uint16_t dlen; 31 uint8_t drevision; 32 uint8_t class_lo; 33 uint16_t class_hi; 34 uint16_t ilen; 35 uint16_t irevision; 36 uint8_t type; 37 uint8_t indicator; 38 uint16_t reserved_2; 39 }; 40 41 void vga_oprom_preload(void); 42 struct rom_header *pci_rom_probe(const struct device *dev); 43 struct rom_header *pci_rom_load(struct device *dev, 44 struct rom_header *rom_header); 45 pci_rom_free(struct rom_header * rom_header)46static inline void pci_rom_free(struct rom_header *rom_header) 47 { 48 cbfs_unmap(rom_header); 49 } 50 51 unsigned long 52 pci_rom_write_acpi_tables(const struct device *device, 53 unsigned long current, 54 struct acpi_rsdp *rsdp); 55 56 void pci_rom_ssdt(const struct device *device); 57 58 u32 map_oprom_vendev(u32 vendev); 59 60 int verified_boot_should_run_oprom(struct rom_header *rom_header); 61 #endif 62