Martin Roth | 239b5df | 2022-07-26 22:18:26 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Yinghai Lu | 6308d58 | 2005-01-13 18:42:22 +0000 | [diff] [blame] | 3 | #ifndef PCI_ROM_H |
| 4 | #define PCI_ROM_H |
Elyes HAOUAS | 5817c56 | 2020-07-12 09:03:22 +0200 | [diff] [blame] | 5 | |
Julius Werner | 9ff8f6f | 2015-02-23 14:31:09 -0800 | [diff] [blame] | 6 | #include <endian.h> |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 7 | #include <acpi/acpi.h> |
Elyes HAOUAS | 5817c56 | 2020-07-12 09:03:22 +0200 | [diff] [blame] | 8 | #include <stdint.h> |
Li-Ta Lo | 883b879 | 2005-01-10 23:16:22 +0000 | [diff] [blame] | 9 | |
| 10 | #define PCI_ROM_HDR 0xAA55 |
Elyes Haouas | 385939f | 2022-11-18 15:05:11 +0100 | [diff] [blame^] | 11 | #define PCI_DATA_HDR ((uint32_t)(('R' << 24) | ('I' << 16) | ('C' << 8) | 'P')) |
Li-Ta Lo | 883b879 | 2005-01-10 23:16:22 +0000 | [diff] [blame] | 12 | |
| 13 | #define PCI_RAM_IMAGE_START 0xD0000 |
| 14 | #define PCI_VGA_RAM_IMAGE_START 0xC0000 |
| 15 | |
| 16 | struct rom_header { |
| 17 | uint16_t signature; |
| 18 | uint8_t size; |
| 19 | uint8_t init[3]; |
| 20 | uint8_t reserved[0x12]; |
| 21 | uint16_t data; |
| 22 | }; |
| 23 | |
| 24 | struct pci_data { |
| 25 | uint32_t signature; |
| 26 | uint16_t vendor; |
| 27 | uint16_t device; |
| 28 | uint16_t reserved_1; |
| 29 | uint16_t dlen; |
| 30 | uint8_t drevision; |
Yinghai Lu | 54ab311 | 2005-01-18 03:10:46 +0000 | [diff] [blame] | 31 | uint8_t class_lo; |
| 32 | uint16_t class_hi; |
Li-Ta Lo | 883b879 | 2005-01-10 23:16:22 +0000 | [diff] [blame] | 33 | uint16_t ilen; |
| 34 | uint16_t irevision; |
| 35 | uint8_t type; |
| 36 | uint8_t indicator; |
| 37 | uint16_t reserved_2; |
| 38 | }; |
Yinghai Lu | 6308d58 | 2005-01-13 18:42:22 +0000 | [diff] [blame] | 39 | |
Raul E Rangel | a3811fe | 2021-11-01 13:40:14 -0600 | [diff] [blame] | 40 | void vga_oprom_preload(void); |
Furquan Shaikh | 0f007d8 | 2020-04-24 06:41:18 -0700 | [diff] [blame] | 41 | struct rom_header *pci_rom_probe(const struct device *dev); |
Lee Leahy | 6a566d7 | 2017-03-07 17:45:12 -0800 | [diff] [blame] | 42 | struct rom_header *pci_rom_load(struct device *dev, |
| 43 | struct rom_header *rom_header); |
Patrick Rudolph | a5c2ac6 | 2016-03-31 20:04:23 +0200 | [diff] [blame] | 44 | |
| 45 | unsigned long |
Furquan Shaikh | 0f007d8 | 2020-04-24 06:41:18 -0700 | [diff] [blame] | 46 | pci_rom_write_acpi_tables(const struct device *device, |
Patrick Rudolph | a5c2ac6 | 2016-03-31 20:04:23 +0200 | [diff] [blame] | 47 | unsigned long current, |
| 48 | struct acpi_rsdp *rsdp); |
| 49 | |
Furquan Shaikh | 7536a39 | 2020-04-24 21:59:21 -0700 | [diff] [blame] | 50 | void pci_rom_ssdt(const struct device *device); |
Patrick Rudolph | 00c0cd2 | 2017-06-06 19:30:55 +0200 | [diff] [blame] | 51 | |
Martin Roth | dafcc7a | 2020-02-05 16:46:30 -0700 | [diff] [blame] | 52 | void map_oprom_vendev_rev(u32 *vendev, u8 *rev); |
Kyösti Mälkki | 1bdd321 | 2014-12-26 13:29:09 +0200 | [diff] [blame] | 53 | u32 map_oprom_vendev(u32 vendev); |
arch import user (historical) | 2305364 | 2005-07-06 16:49:59 +0000 | [diff] [blame] | 54 | |
Frans Hendriks | b71181a | 2019-10-04 14:06:33 +0200 | [diff] [blame] | 55 | int verified_boot_should_run_oprom(struct rom_header *rom_header); |
Yinghai Lu | 6308d58 | 2005-01-13 18:42:22 +0000 | [diff] [blame] | 56 | #endif |