blob: 83015a12b45bfea47356ce83144d637574f1c2c0 [file] [log] [blame]
Martin Roth239b5df2022-07-26 22:18:26 -06001/* SPDX-License-Identifier: GPL-2.0-only */
2
Yinghai Lu6308d582005-01-13 18:42:22 +00003#ifndef PCI_ROM_H
4#define PCI_ROM_H
Elyes HAOUAS5817c562020-07-12 09:03:22 +02005
Julius Werner9ff8f6f2015-02-23 14:31:09 -08006#include <endian.h>
Furquan Shaikh76cedd22020-05-02 10:24:23 -07007#include <acpi/acpi.h>
Elyes HAOUAS5817c562020-07-12 09:03:22 +02008#include <stdint.h>
Li-Ta Lo883b8792005-01-10 23:16:22 +00009
10#define PCI_ROM_HDR 0xAA55
Elyes Haouas385939f2022-11-18 15:05:11 +010011#define PCI_DATA_HDR ((uint32_t)(('R' << 24) | ('I' << 16) | ('C' << 8) | 'P'))
Li-Ta Lo883b8792005-01-10 23:16:22 +000012
13#define PCI_RAM_IMAGE_START 0xD0000
14#define PCI_VGA_RAM_IMAGE_START 0xC0000
15
16struct 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
24struct 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 Lu54ab3112005-01-18 03:10:46 +000031 uint8_t class_lo;
32 uint16_t class_hi;
Li-Ta Lo883b8792005-01-10 23:16:22 +000033 uint16_t ilen;
34 uint16_t irevision;
35 uint8_t type;
36 uint8_t indicator;
37 uint16_t reserved_2;
38};
Yinghai Lu6308d582005-01-13 18:42:22 +000039
Raul E Rangela3811fe2021-11-01 13:40:14 -060040void vga_oprom_preload(void);
Furquan Shaikh0f007d82020-04-24 06:41:18 -070041struct rom_header *pci_rom_probe(const struct device *dev);
Lee Leahy6a566d72017-03-07 17:45:12 -080042struct rom_header *pci_rom_load(struct device *dev,
43 struct rom_header *rom_header);
Patrick Rudolpha5c2ac62016-03-31 20:04:23 +020044
45unsigned long
Furquan Shaikh0f007d82020-04-24 06:41:18 -070046pci_rom_write_acpi_tables(const struct device *device,
Patrick Rudolpha5c2ac62016-03-31 20:04:23 +020047 unsigned long current,
48 struct acpi_rsdp *rsdp);
49
Furquan Shaikh7536a392020-04-24 21:59:21 -070050void pci_rom_ssdt(const struct device *device);
Patrick Rudolph00c0cd22017-06-06 19:30:55 +020051
Martin Rothdafcc7a2020-02-05 16:46:30 -070052void map_oprom_vendev_rev(u32 *vendev, u8 *rev);
Kyösti Mälkki1bdd3212014-12-26 13:29:09 +020053u32 map_oprom_vendev(u32 vendev);
arch import user (historical)23053642005-07-06 16:49:59 +000054
Frans Hendriksb71181a2019-10-04 14:06:33 +020055int verified_boot_should_run_oprom(struct rom_header *rom_header);
Yinghai Lu6308d582005-01-13 18:42:22 +000056#endif