static void host_command_init(void) { /* Initialize memory map ID area */ host_get_memmap(EC_MEMMAP_ID)[0] = 'E'; host_get_memmap(EC_MEMMAP_ID)[1] = 'C'; *host_get_memmap(EC_MEMMAP_ID_VERSION) = 1; *host_get_memmap(EC_MEMMAP_EVENTS_VERSION) = 1; host_set_single_event(EC_HOST_EVENT_INTERFACE_READY); CPRINTS("hostcmd init 0x%x", host_get_events()); }
static int command_host_event(int argc, char **argv) { /* Handle sub-commands */ if (argc == 3) { char *e; int i = strtoi(argv[2], &e, 0); if (*e) return EC_ERROR_PARAM2; if (!strcasecmp(argv[1], "set")) host_set_events(i); else if (!strcasecmp(argv[1], "clear")) host_clear_events(i); else if (!strcasecmp(argv[1], "clearb")) host_clear_events_b(i); #ifdef CONFIG_LPC else if (!strcasecmp(argv[1], "smi")) lpc_set_host_event_mask(LPC_HOST_EVENT_SMI, i); else if (!strcasecmp(argv[1], "sci")) lpc_set_host_event_mask(LPC_HOST_EVENT_SCI, i); else if (!strcasecmp(argv[1], "wake")) lpc_set_host_event_mask(LPC_HOST_EVENT_WAKE, i); #endif else return EC_ERROR_PARAM1; } /* Print current SMI/SCI status */ ccprintf("Events: 0x%08x\n", host_get_events()); ccprintf("Events-B: 0x%08x\n", events_copy_b); #ifdef CONFIG_LPC ccprintf("SMI mask: 0x%08x\n", lpc_get_host_event_mask(LPC_HOST_EVENT_SMI)); ccprintf("SCI mask: 0x%08x\n", lpc_get_host_event_mask(LPC_HOST_EVENT_SCI)); ccprintf("Wake mask: 0x%08x\n", lpc_get_host_event_mask(LPC_HOST_EVENT_WAKE)); #endif return EC_SUCCESS; }
/* Host Event helpers */ static int ev_is_set(int event) { return host_get_events() & EC_HOST_EVENT_MASK(event); }