Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/bhyverun.c
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | |||||
#include "pci_emul.h" | #include "pci_emul.h" | ||||
#include "pci_irq.h" | #include "pci_irq.h" | ||||
#include "pci_lpc.h" | #include "pci_lpc.h" | ||||
#include "qemu_fwcfg.h" | #include "qemu_fwcfg.h" | ||||
#include "smbiostbl.h" | #include "smbiostbl.h" | ||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||
#include "snapshot.h" | #include "snapshot.h" | ||||
#endif | #endif | ||||
#include "tpm_device.h" | |||||
#include "xmsr.h" | #include "xmsr.h" | ||||
#include "spinup_ap.h" | #include "spinup_ap.h" | ||||
#include "rtc.h" | #include "rtc.h" | ||||
#include "vmgenc.h" | #include "vmgenc.h" | ||||
#define MB (1024UL * 1024) | #define MB (1024UL * 1024) | ||||
#define GB (1024UL * MB) | #define GB (1024UL * MB) | ||||
▲ Show 20 Lines • Show All 1,088 Lines • ▼ Show 20 Lines | set_defaults(void) | ||||
set_config_bool("acpi_tables", false); | set_config_bool("acpi_tables", false); | ||||
set_config_value("memory.size", "256M"); | set_config_value("memory.size", "256M"); | ||||
set_config_bool("x86.strictmsr", true); | set_config_bool("x86.strictmsr", true); | ||||
set_config_value("lpc.fwcfg", "bhyve"); | set_config_value("lpc.fwcfg", "bhyve"); | ||||
} | } | ||||
int | int | ||||
main(int argc, char *argv[]) | main(int argc, char *argv[]) | ||||
markj: The opening brace should be on its own line. | |||||
{ | { | ||||
int c, error; | int c, error; | ||||
int max_vcpus, memflags; | int max_vcpus, memflags; | ||||
struct vcpu *bsp; | struct vcpu *bsp; | ||||
struct vmctx *ctx; | struct vmctx *ctx; | ||||
struct qemu_fwcfg_item *e820_fwcfg_item; | struct qemu_fwcfg_item *e820_fwcfg_item; | ||||
size_t memsize; | size_t memsize; | ||||
const char *optstr, *value, *vmname; | const char *optstr, *value, *vmname; | ||||
▲ Show 20 Lines • Show All 246 Lines • ▼ Show 20 Lines | #endif | ||||
if (e820_init(ctx) != 0) { | if (e820_init(ctx) != 0) { | ||||
fprintf(stderr, "Unable to setup E820"); | fprintf(stderr, "Unable to setup E820"); | ||||
exit(4); | exit(4); | ||||
} | } | ||||
/* | /* | ||||
* Exit if a device emulation finds an error in its initialization | * Exit if a device emulation finds an error in its initialization | ||||
*/ | */ | ||||
if (init_pci(ctx) != 0) { | if (init_pci(ctx) != 0) { | ||||
Not Done Inline ActionsIMHO there is not much use in adding this function. The perror() call below does not tell you whether init_pci() or init_tpm() failed. I would just inline it. If there is a particular reason init_pci() needs to be called first (I don't see one?), it should be documented in a comment. markj: IMHO there is not much use in adding this function. The perror() call below does not tell you… | |||||
perror("device emulation initialization error"); | perror("device emulation initialization error"); | ||||
exit(4); | |||||
} | |||||
if (init_tpm(ctx) != 0) { | |||||
fprintf(stderr, "Failed to init TPM device"); | |||||
exit(4); | exit(4); | ||||
} | } | ||||
/* | /* | ||||
* Initialize after PCI, to allow a bootrom file to reserve the high | * Initialize after PCI, to allow a bootrom file to reserve the high | ||||
* region. | * region. | ||||
*/ | */ | ||||
if (get_config_bool("acpi_tables")) | if (get_config_bool("acpi_tables")) | ||||
▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines |
The opening brace should be on its own line.