-/* $OpenBSD: vmmvar.h,v 1.107 2024/09/26 13:18:25 dv Exp $ */
+/* $OpenBSD: vmmvar.h,v 1.108 2024/10/02 17:05:56 dv Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
#define VMM_HV_SIGNATURE "OpenBSDVMM58"
-#define VMM_PCI_MMIO_BAR_BASE 0xF0000000ULL
-#define VMM_PCI_MMIO_BAR_END 0xFFDFFFFFULL /* 2 MiB below 4 GiB */
-
/* VMX: Basic Exit Reasons */
#define VMX_EXIT_NMI 0
#define VMX_EXIT_EXTINT 1
-/* $OpenBSD: pci.c,v 1.34 2024/09/26 01:45:13 jsg Exp $ */
+/* $OpenBSD: pci.c,v 1.35 2024/10/02 17:05:56 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
/* Compute BAR address and add */
bar_reg_idx = (PCI_MAPREG_START + (bar_ct * 4)) / 4;
if (type == PCI_MAPREG_TYPE_MEM) {
- if (pci.pci_next_mmio_bar >= VMM_PCI_MMIO_BAR_END)
+ if (pci.pci_next_mmio_bar >= PCI_MMIO_BAR_END)
return (1);
pci.pci_devices[id].pd_cfg_space[bar_reg_idx] =
uint8_t id;
memset(&pci, 0, sizeof(pci));
- pci.pci_next_mmio_bar = VMM_PCI_MMIO_BAR_BASE;
+ pci.pci_next_mmio_bar = PCI_MMIO_BAR_BASE;
#ifdef __amd64__
pci.pci_next_io_bar = VM_PCI_IO_BAR_BASE;
-/* $OpenBSD: pci.h,v 1.11 2024/07/10 09:27:33 dv Exp $ */
+/* $OpenBSD: pci.h,v 1.12 2024/10/02 17:05:56 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
#define PCI_BAR_TYPE_IO 0x0
#define PCI_BAR_TYPE_MMIO 0x1
+#define PCI_MMIO_BAR_BASE 0xF0000000ULL
+#define PCI_MMIO_BAR_END 0xFFDFFFFFULL /* 2 MiB below 4 GiB */
+
#define PCI_MAX_PIC_IRQS 10
typedef int (*pci_cs_fn_t)(int dir, uint8_t reg, uint32_t *data);
-/* $OpenBSD: x86_vm.c,v 1.4 2024/09/26 01:45:13 jsg Exp $ */
+/* $OpenBSD: x86_vm.c,v 1.5 2024/10/02 17:05:56 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
*
/* If we have less than 2MB remaining, still create a 2nd BIOS area. */
if (mem_bytes <= MB(2)) {
- vcp->vcp_memranges[2].vmr_gpa = VMM_PCI_MMIO_BAR_END;
+ vcp->vcp_memranges[2].vmr_gpa = PCI_MMIO_BAR_END;
vcp->vcp_memranges[2].vmr_size = MB(2);
vcp->vcp_memranges[2].vmr_type = VM_MEM_RESERVED;
vcp->vcp_nmemranges = 3;
* boundary while making sure we do not place physical memory into
* MMIO ranges.
*/
- if (mem_bytes > VMM_PCI_MMIO_BAR_BASE - MB(1)) {
- above_1m = VMM_PCI_MMIO_BAR_BASE - MB(1);
+ if (mem_bytes > PCI_MMIO_BAR_BASE - MB(1)) {
+ above_1m = PCI_MMIO_BAR_BASE - MB(1);
above_4g = mem_bytes - above_1m;
} else {
above_1m = mem_bytes;
vcp->vcp_memranges[2].vmr_type = VM_MEM_RAM;
/* Fourth region: PCI MMIO range */
- vcp->vcp_memranges[3].vmr_gpa = VMM_PCI_MMIO_BAR_BASE;
- vcp->vcp_memranges[3].vmr_size = VMM_PCI_MMIO_BAR_END -
- VMM_PCI_MMIO_BAR_BASE + 1;
+ vcp->vcp_memranges[3].vmr_gpa = PCI_MMIO_BAR_BASE;
+ vcp->vcp_memranges[3].vmr_size = PCI_MMIO_BAR_END -
+ PCI_MMIO_BAR_BASE + 1;
vcp->vcp_memranges[3].vmr_type = VM_MEM_MMIO;
/* Fifth region: 2nd copy of BIOS above MMIO ending at 4GB */
- vcp->vcp_memranges[4].vmr_gpa = VMM_PCI_MMIO_BAR_END + 1;
+ vcp->vcp_memranges[4].vmr_gpa = PCI_MMIO_BAR_END + 1;
vcp->vcp_memranges[4].vmr_size = MB(2);
vcp->vcp_memranges[4].vmr_type = VM_MEM_RESERVED;