Page MenuHomeFreeBSD

D46180.1791577100.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D46180.1791577100.diff

diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -795,6 +795,13 @@
pci_emul_alloc_bar(struct pci_devinst *pdi, int idx, enum pcibar_type type,
uint64_t size)
{
+ bool romboot;
+
+#ifdef __amd64__
+ romboot = lpc_bootrom() != NULL;
+#else
+ romboot = true;
+#endif
assert((type == PCIBAR_ROM) || (idx >= 0 && idx <= PCI_BARMAX));
assert((type != PCIBAR_ROM) || (idx == PCI_ROM_IDX));
@@ -853,6 +860,12 @@
TAILQ_INSERT_BEFORE(bar, new_bar, chain);
}
+ /*
+ * Don't enable decoding when booting from a ROM.
+ */
+ if (romboot)
+ return (0);
+
/*
* pci_passthru devices synchronize their physical and virtual command
* register on init. For that reason, the virtual cmd reg should be
@@ -884,7 +897,9 @@
{
int error;
uint64_t *baseptr, limit, addr, mask, lobits, bar;
+ bool decoding;
+ decoding = false;
switch (type) {
case PCIBAR_NONE:
baseptr = NULL;
@@ -895,6 +910,7 @@
limit = PCI_EMUL_IOLIMIT;
mask = PCIM_BAR_IO_BASE;
lobits = PCIM_BAR_IO_SPACE;
+ decoding = porten(pdi);
break;
case PCIBAR_MEM64:
/*
@@ -916,12 +932,14 @@
mask = PCIM_BAR_MEM_BASE;
lobits = PCIM_BAR_MEM_SPACE | PCIM_BAR_MEM_64;
}
+ decoding = memen(pdi);
break;
case PCIBAR_MEM32:
baseptr = &pci_emul_membase32;
limit = PCI_EMUL_MEMLIMIT32;
mask = PCIM_BAR_MEM_BASE;
lobits = PCIM_BAR_MEM_SPACE | PCIM_BAR_MEM_32;
+ decoding = memen(pdi);
break;
case PCIBAR_ROM:
/* do not claim memory for ROM. OVMF will do it for us. */
@@ -966,7 +984,7 @@
pci_set_cfgdata32(pdi, PCIR_BAR(idx + 1), bar >> 32);
}
- if (type != PCIBAR_ROM) {
+ if (decoding) {
register_bar(pdi, idx);
}

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 9, 8:18 PM (9 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30268610
Default Alt Text
D46180.1791577100.diff (1 KB)

Event Timeline