Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_fbuf.c
Show First 20 Lines • Show All 235 Lines • ▼ Show 20 Lines | if (!enabled && sc->fbaddr != 0) { | ||||
if (vm_mmap_memseg(ctx, address, VM_FRAMEBUFFER, 0, FB_SIZE, prot) != 0) | if (vm_mmap_memseg(ctx, address, VM_FRAMEBUFFER, 0, FB_SIZE, prot) != 0) | ||||
EPRINTLN("pci_fbuf: mmap_memseg failed"); | EPRINTLN("pci_fbuf: mmap_memseg failed"); | ||||
sc->fbaddr = address; | sc->fbaddr = address; | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
pci_fbuf_parse_config(struct pci_fbuf_softc *sc, nvlist_t *nvl) | pci_fbuf_parse_config(struct pci_fbuf_softc *sc, config_node_t *node) | ||||
{ | { | ||||
const char *value; | const char *value; | ||||
char *cp; | char *cp; | ||||
sc->rfb_wait = get_config_bool_node_default(nvl, "wait", false); | sc->rfb_wait = get_config_bool_node_default(node, "wait", false); | ||||
/* Prefer "rfb" to "tcp". */ | /* Prefer "rfb" to "tcp". */ | ||||
value = get_config_value_node(nvl, "rfb"); | value = get_config_value_node(node, "rfb"); | ||||
if (value == NULL) | if (value == NULL) | ||||
value = get_config_value_node(nvl, "tcp"); | value = get_config_value_node(node, "tcp"); | ||||
if (value != NULL) { | if (value != NULL) { | ||||
/* | /* | ||||
* IPv4 -- host-ip:port | * IPv4 -- host-ip:port | ||||
* IPv6 -- [host-ip%zone]:port | * IPv6 -- [host-ip%zone]:port | ||||
* XXX for now port is mandatory for IPv4. | * XXX for now port is mandatory for IPv4. | ||||
*/ | */ | ||||
if (value[0] == '[') { | if (value[0] == '[') { | ||||
cp = strchr(value + 1, ']'); | cp = strchr(value + 1, ']'); | ||||
Show All 31 Lines | if (value[0] == '[') { | ||||
value); | value); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
sc->rfb_port = atoi(cp); | sc->rfb_port = atoi(cp); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
value = get_config_value_node(nvl, "vga"); | value = get_config_value_node(node, "vga"); | ||||
if (value != NULL) { | if (value != NULL) { | ||||
if (strcmp(value, "off") == 0) { | if (strcmp(value, "off") == 0) { | ||||
sc->vga_enabled = 0; | sc->vga_enabled = 0; | ||||
} else if (strcmp(value, "io") == 0) { | } else if (strcmp(value, "io") == 0) { | ||||
sc->vga_enabled = 1; | sc->vga_enabled = 1; | ||||
sc->vga_full = 0; | sc->vga_full = 0; | ||||
} else if (strcmp(value, "on") == 0) { | } else if (strcmp(value, "on") == 0) { | ||||
sc->vga_enabled = 1; | sc->vga_enabled = 1; | ||||
sc->vga_full = 1; | sc->vga_full = 1; | ||||
} else { | } else { | ||||
EPRINTLN("fbuf: Invalid vga setting: \"%s\"", value); | EPRINTLN("fbuf: Invalid vga setting: \"%s\"", value); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
} | } | ||||
value = get_config_value_node(nvl, "w"); | value = get_config_value_node(node, "w"); | ||||
if (value != NULL) { | if (value != NULL) { | ||||
sc->memregs.width = atoi(value); | sc->memregs.width = atoi(value); | ||||
if (sc->memregs.width > COLS_MAX) { | if (sc->memregs.width > COLS_MAX) { | ||||
EPRINTLN("fbuf: width %d too large", sc->memregs.width); | EPRINTLN("fbuf: width %d too large", sc->memregs.width); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
if (sc->memregs.width == 0) | if (sc->memregs.width == 0) | ||||
sc->memregs.width = 1920; | sc->memregs.width = 1920; | ||||
} | } | ||||
value = get_config_value_node(nvl, "h"); | value = get_config_value_node(node, "h"); | ||||
if (value != NULL) { | if (value != NULL) { | ||||
sc->memregs.height = atoi(value); | sc->memregs.height = atoi(value); | ||||
if (sc->memregs.height > ROWS_MAX) { | if (sc->memregs.height > ROWS_MAX) { | ||||
EPRINTLN("fbuf: height %d too large", | EPRINTLN("fbuf: height %d too large", | ||||
sc->memregs.height); | sc->memregs.height); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
if (sc->memregs.height == 0) | if (sc->memregs.height == 0) | ||||
sc->memregs.height = 1080; | sc->memregs.height = 1080; | ||||
} | } | ||||
value = get_config_value_node(nvl, "password"); | value = get_config_value_node(node, "password"); | ||||
if (value != NULL) | if (value != NULL) | ||||
sc->rfb_password = strdup(value); | sc->rfb_password = strdup(value); | ||||
return (0); | return (0); | ||||
} | } | ||||
extern void vga_render(struct bhyvegc *gc, void *arg); | extern void vga_render(struct bhyvegc *gc, void *arg); | ||||
Show All 18 Lines | if (sc->gc_width != sc->memregs.width || | ||||
sc->gc_width = sc->memregs.width; | sc->gc_width = sc->memregs.width; | ||||
sc->gc_height = sc->memregs.height; | sc->gc_height = sc->memregs.height; | ||||
} | } | ||||
return; | return; | ||||
} | } | ||||
static int | static int | ||||
pci_fbuf_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) | pci_fbuf_init(struct vmctx *ctx, struct pci_devinst *pi, config_node_t *node) | ||||
{ | { | ||||
int error, prot; | int error, prot; | ||||
struct pci_fbuf_softc *sc; | struct pci_fbuf_softc *sc; | ||||
if (fbuf_sc != NULL) { | if (fbuf_sc != NULL) { | ||||
EPRINTLN("Only one frame buffer device is allowed."); | EPRINTLN("Only one frame buffer device is allowed."); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
Show All 23 Lines | pci_fbuf_init(struct vmctx *ctx, struct pci_devinst *pi, config_node_t *node) | ||||
sc->memregs.height = ROWS_DEFAULT; | sc->memregs.height = ROWS_DEFAULT; | ||||
sc->memregs.depth = 32; | sc->memregs.depth = 32; | ||||
sc->vga_enabled = 1; | sc->vga_enabled = 1; | ||||
sc->vga_full = 0; | sc->vga_full = 0; | ||||
sc->fsc_pi = pi; | sc->fsc_pi = pi; | ||||
error = pci_fbuf_parse_config(sc, nvl); | error = pci_fbuf_parse_config(sc, node); | ||||
if (error != 0) | if (error != 0) | ||||
goto done; | goto done; | ||||
/* XXX until VGA rendering is enabled */ | /* XXX until VGA rendering is enabled */ | ||||
if (sc->vga_full != 0) { | if (sc->vga_full != 0) { | ||||
EPRINTLN("pci_fbuf: VGA rendering not enabled"); | EPRINTLN("pci_fbuf: VGA rendering not enabled"); | ||||
goto done; | goto done; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |