Changeset View
Changeset View
Standalone View
Standalone View
stand/efi/libefi/eficom.c
Show First 20 Lines • Show All 326 Lines • ▼ Show 20 Lines | if (comc_parse_intval(env, &val) == CMD_OK) | ||||
comc_port->newbaudrate = val; | comc_port->newbaudrate = val; | ||||
if (env != NULL) | if (env != NULL) | ||||
unsetenv("efi_com_speed"); | unsetenv("efi_com_speed"); | ||||
snprintf(value, sizeof (value), "%ju", (uintmax_t)comc_port->baudrate); | snprintf(value, sizeof (value), "%ju", (uintmax_t)comc_port->baudrate); | ||||
env_setenv("efi_com_speed", EV_VOLATILE, value, | env_setenv("efi_com_speed", EV_VOLATILE, value, | ||||
comc_speed_set, env_nounset); | comc_speed_set, env_nounset); | ||||
eficom.c_flags = 0; | |||||
if (comc_setup()) { | if (comc_setup()) { | ||||
sc->c_flags = C_PRESENTIN | C_PRESENTOUT; | sc->c_flags = C_PRESENTIN | C_PRESENTOUT; | ||||
} else { | |||||
sc->c_flags &= ~(C_PRESENTIN | C_PRESENTOUT); | |||||
free(comc_port); | |||||
comc_port = NULL; | |||||
} | } | ||||
} | } | ||||
#if defined(__aarch64__) && __FreeBSD_version < 1500000 | #if defined(__aarch64__) && __FreeBSD_version < 1500000 | ||||
static void | static void | ||||
comc_probe_compat(struct console *sc) | comc_probe_compat(struct console *sc) | ||||
{ | { | ||||
comc_probe(sc); | comc_probe(sc); | ||||
if (sc->c_flags & (C_PRESENTIN | C_PRESENTOUT)) { | if (sc->c_flags & (C_PRESENTIN | C_PRESENTOUT)) { | ||||
printf("comconsole: comconsole device name is deprecated, switch to eficom\n"); | printf("comconsole: comconsole device name is deprecated, switch to eficom\n"); | ||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
/* | |||||
* Called when the console is selected in cons_change. If we didn't detect the | |||||
* device, comc_port will be NULL, and comc_setup will fail. It may be called | |||||
* even when the device isn't present as a 'fallback' console or when listed | |||||
* specifically in console env, so we have to reset the c_flags in those case to | |||||
* say it's not present. | |||||
*/ | |||||
static int | static int | ||||
comc_init(int arg __unused) | comc_init(int arg __unused) | ||||
{ | { | ||||
if (comc_setup()) | if (comc_setup()) | ||||
return (CMD_OK); | return (CMD_OK); | ||||
eficom.c_flags = 0; | eficom.c_flags &= ~(C_ACTIVEIN | C_ACTIVEOUT); | ||||
return (CMD_ERROR); | return (CMD_ERROR); | ||||
} | } | ||||
static void | static void | ||||
comc_putchar(int c) | comc_putchar(int c) | ||||
{ | { | ||||
int wait; | int wait; | ||||
EFI_STATUS status; | EFI_STATUS status; | ||||
▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | |||||
* framefork will try alternate consoles. | * framefork will try alternate consoles. | ||||
*/ | */ | ||||
static bool | static bool | ||||
comc_setup(void) | comc_setup(void) | ||||
{ | { | ||||
EFI_STATUS status; | EFI_STATUS status; | ||||
char *ev; | char *ev; | ||||
/* port is not usable */ | /* | ||||
if (comc_port->sio == NULL) | * If the device isn't active, or there's no port present. | ||||
*/ | |||||
if ((eficom.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) == 0 || comc_port == NULL) | |||||
return (false); | return (false); | ||||
if (comc_port->sio->Reset != NULL) { | if (comc_port->sio->Reset != NULL) { | ||||
status = comc_port->sio->Reset(comc_port->sio); | status = comc_port->sio->Reset(comc_port->sio); | ||||
if (EFI_ERROR(status)) | if (EFI_ERROR(status)) | ||||
return (false); | return (false); | ||||
} | } | ||||
Show All 35 Lines |