Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_passthru.c
Show First 20 Lines • Show All 576 Lines • ▼ Show 20 Lines | if (bartype != PCIBAR_IO) { | ||||
} | } | ||||
} | } | ||||
/* Cache information about the "real" BAR */ | /* Cache information about the "real" BAR */ | ||||
sc->psc_bar[i].type = bartype; | sc->psc_bar[i].type = bartype; | ||||
sc->psc_bar[i].size = size; | sc->psc_bar[i].size = size; | ||||
sc->psc_bar[i].addr = base; | sc->psc_bar[i].addr = base; | ||||
/* Use same lobits as physical bar */ | |||||
uint8_t lobits = read_config(&sc->psc_sel, PCIR_BAR(i), 0x01); | |||||
if (bartype == PCIBAR_MEM32 || bartype == PCIBAR_MEM64) { | |||||
lobits &= ~PCIM_BAR_MEM_BASE; | |||||
} else { | |||||
lobits &= ~PCIM_BAR_IO_BASE; | |||||
} | |||||
sc->psc_bar[i].lobits = lobits; | |||||
pi->pi_bar[i].lobits = lobits; | |||||
/* Allocate the BAR in the guest I/O or MMIO space */ | /* Allocate the BAR in the guest I/O or MMIO space */ | ||||
error = pci_emul_alloc_bar(pi, i, bartype, size); | error = pci_emul_alloc_bar(pi, i, bartype, size); | ||||
if (error) | if (error) | ||||
return (-1); | return (-1); | ||||
/* The MSI-X table needs special handling */ | /* The MSI-X table needs special handling */ | ||||
if (i == pci_msix_table_bar(pi)) { | if (i == pci_msix_table_bar(pi)) { | ||||
error = init_msix_table(ctx, sc, base); | error = init_msix_table(ctx, sc, base); | ||||
▲ Show 20 Lines • Show All 373 Lines • Show Last 20 Lines |