aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandr Bezzubikov <zuban32s@gmail.com>2017-08-18 02:33:20 +0300
committerKevin O'Connor <kevin@koconnor.net>2017-09-14 15:49:45 -0400
commit4c1f7272b41df5ceec0f41c6c14ca4c68a8638ee (patch)
tree710443dae427d98b36842db91b6d79ddc46f4155
parent7de1f65c0cf1e11ee3fa580d59eb7acdd0c42ad9 (diff)
downloadseabios-4c1f7272b41df5ceec0f41c6c14ca4c68a8638ee.zip
seabios-4c1f7272b41df5ceec0f41c6c14ca4c68a8638ee.tar.gz
seabios-4c1f7272b41df5ceec0f41c6c14ca4c68a8638ee.tar.bz2
pci: add QEMU-specific PCI capability structure
On PCI init PCI bridge devices may need some extra info about bus number to reserve, IO, memory and prefetchable memory limits. QEMU can provide this with special vendor-specific PCI capability. This capability is intended to be used only for Red Hat PCI bridges, i.e. QEMU cooperation. Signed-off-by: Aleksandr Bezzubikov <zuban32s@gmail.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
-rw-r--r--src/fw/dev-pci.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/fw/dev-pci.h b/src/fw/dev-pci.h
new file mode 100644
index 0000000..30bb25a
--- /dev/null
+++ b/src/fw/dev-pci.h
@@ -0,0 +1,52 @@
+#ifndef _PCI_CAP_H
+#define _PCI_CAP_H
+
+#include "types.h"
+
+/*
+ *
+ * QEMU-specific vendor(Red Hat)-specific capability.
+ * It's intended to provide some hints for firmware to init PCI devices.
+ *
+ * Its structure is shown below:
+ *
+ * Header:
+ *
+ * u8 id; Standard PCI Capability Header field
+ * u8 next; Standard PCI Capability Header field
+ * u8 len; Standard PCI Capability Header field
+ * u8 type; Red Hat vendor-specific capability type
+ * Data:
+ *
+ * u32 bus_res; minimum bus number to reserve;
+ * this is necessary for PCI Express Root Ports
+ * to support PCI bridges hotplug
+ * u64 io; IO space to reserve
+ * u32 mem; non-prefetchable memory to reserve
+ *
+ * At most of the following two fields may be set to a value
+ * different from 0xFF...F:
+ * u32 prefetchable_mem_32; prefetchable memory to reserve (32-bit MMIO)
+ * u64 prefetchable_mem_64; prefetchable memory to reserve (64-bit MMIO)
+ *
+ * If any field value in Data section is 0xFF...F,
+ * it means that such kind of reservation is not needed and must be ignored.
+ *
+*/
+
+/* Offset of vendor-specific capability type field */
+#define PCI_CAP_REDHAT_TYPE_OFFSET 3
+
+/* List of valid Red Hat vendor-specific capability types */
+#define REDHAT_CAP_RESOURCE_RESERVE 1
+
+
+/* Offsets of RESOURCE_RESERVE capability fields */
+#define RES_RESERVE_BUS_RES 4
+#define RES_RESERVE_IO 8
+#define RES_RESERVE_MEM 16
+#define RES_RESERVE_PREF_MEM_32 20
+#define RES_RESERVE_PREF_MEM_64 24
+#define RES_RESERVE_CAP_SIZE 32
+
+#endif /* _PCI_CAP_H */