summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bhyve/pci_emul.h
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2013-01-21 22:07:05 +0000
committerneel <neel@FreeBSD.org>2013-01-21 22:07:05 +0000
commitc6282fca6a60777e3390954cefa46346dfdc5cc0 (patch)
tree5dee8688ac5680dfb254a1d316be91e5deb33eb9 /usr.sbin/bhyve/pci_emul.h
parent5eef2355a8b167b66a1b1a4b52238fffd1b40d4b (diff)
downloadFreeBSD-src-c6282fca6a60777e3390954cefa46346dfdc5cc0.zip
FreeBSD-src-c6282fca6a60777e3390954cefa46346dfdc5cc0.tar.gz
Allocate the memory for the MSI-X table dynamically instead of allocating 32KB
statically. In most cases the number of table entries will be far less than the maximum of 2048 allowed by the PCI specification. Reuse macros from pcireg.h to interpret the MSI-X capability instead of rolling our own. Obtained from: NetApp
Diffstat (limited to 'usr.sbin/bhyve/pci_emul.h')
-rw-r--r--usr.sbin/bhyve/pci_emul.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h
index 80a4eac..f007bdf 100644
--- a/usr.sbin/bhyve/pci_emul.h
+++ b/usr.sbin/bhyve/pci_emul.h
@@ -95,8 +95,7 @@ struct msix_table_entry {
* In case the structure is modified to hold extra information, use a define
* for the size that should be emulated.
*/
-#define MSIX_TABLE_ENTRY_SIZE 16
-#define MAX_MSIX_TABLE_SIZE 2048
+#define MSIX_TABLE_ENTRY_SIZE 16
struct pci_devinst {
struct pci_devemu *pi_d;
@@ -121,7 +120,7 @@ struct pci_devinst {
size_t table_offset;
int table_count;
size_t pba_offset;
- struct msix_table_entry table[MAX_MSIX_TABLE_SIZE];
+ struct msix_table_entry *table; /* allocated at runtime */
} pi_msix;
void *pi_arg; /* devemu-private data */
@@ -143,8 +142,8 @@ struct msixcap {
uint8_t capid;
uint8_t nextptr;
uint16_t msgctrl;
- uint32_t table_offset;
- uint32_t pba_offset;
+ uint32_t table_info; /* bar index and offset within it */
+ uint32_t pba_info; /* bar index and offset within it */
} __packed;
void init_pci(struct vmctx *ctx);
OpenPOWER on IntegriCloud