void pm1_ibf_interrupt(void) { int is_cmd; uint8_t value, result; if (pm_get_status(LPC_ACPI_CMD) & EC_LPC_STATUS_FROM_HOST) { /* Set the busy bit */ pm_set_status(LPC_ACPI_CMD, EC_LPC_STATUS_PROCESSING, 1); /* data from command port or data port */ is_cmd = pm_get_status(LPC_ACPI_CMD) & EC_LPC_STATUS_LAST_CMD; /* Get command or data */ value = pm_get_data_in(LPC_ACPI_CMD); /* Handle whatever this was. */ if (acpi_ap_to_ec(is_cmd, value, &result)) pm_put_data_out(LPC_ACPI_CMD, result); /* Clear the busy bit */ pm_set_status(LPC_ACPI_CMD, EC_LPC_STATUS_PROCESSING, 0); /* * ACPI 5.0-12.6.1: Generate SCI for Input Buffer Empty * Output Buffer Full condition on the kernel channel. */ lpc_generate_sci(); } task_clear_pending_irq(IT83XX_IRQ_PMC_IN); }
void acpi_0_interrupt(void) { uint8_t value, result, is_cmd; is_cmd = MEC1322_ACPI_EC_STATUS(0) & EC_LPC_STATUS_LAST_CMD; /* Set the bust bi */ MEC1322_ACPI_EC_STATUS(0) |= EC_LPC_STATUS_PROCESSING; /* Read command/data; this clears the FRMH bit. */ value = MEC1322_ACPI_EC_OS2EC(0, 0); /* Handle whatever this was. */ if (acpi_ap_to_ec(is_cmd, value, &result)) MEC1322_ACPI_EC_EC2OS(0, 0) = result; /* Clear the busy bit */ MEC1322_ACPI_EC_STATUS(0) &= ~EC_LPC_STATUS_PROCESSING; /* * ACPI 5.0-12.6.1: Generate SCI for Input Buffer Empty / Output Buffer * Full condition on the kernel channel. */ lpc_generate_sci(); }
/** * Handle write to ACPI I/O port * * @param is_cmd Is write command (is_cmd=1) or data (is_cmd=0) */ static void handle_acpi_write(int is_cmd) { uint8_t value, result; /* Read command/data; this clears the FRMH status bit. */ value = NPCX_HIPMDI(PMC_ACPI); /* Handle whatever this was. */ if (acpi_ap_to_ec(is_cmd, value, &result)) NPCX_HIPMDO(PMC_ACPI) = result; /* * ACPI 5.0-12.6.1: Generate SCI for Input Buffer Empty / Output Buffer * Full condition on the kernel channel. */ lpc_generate_sci(); }
static void update_host_event_status(void) { int need_sci = 0; int need_smi = 0; if (!init_done) return; /* Disable PMC1 interrupt while updating status register */ task_disable_irq(IT83XX_IRQ_PMC_IN); if (host_events & event_mask[LPC_HOST_EVENT_SMI]) { /* Only generate SMI for first event */ if (!(pm_get_status(LPC_ACPI_CMD) & EC_LPC_STATUS_SMI_PENDING)) need_smi = 1; pm_set_status(LPC_ACPI_CMD, EC_LPC_STATUS_SMI_PENDING, 1); } else { pm_set_status(LPC_ACPI_CMD, EC_LPC_STATUS_SMI_PENDING, 0); } if (host_events & event_mask[LPC_HOST_EVENT_SCI]) { /* Generate SCI for every event */ need_sci = 1; pm_set_status(LPC_ACPI_CMD, EC_LPC_STATUS_SCI_PENDING, 1); } else { pm_set_status(LPC_ACPI_CMD, EC_LPC_STATUS_SCI_PENDING, 0); } /* Copy host events to mapped memory */ *(uint32_t *)host_get_memmap(EC_MEMMAP_HOST_EVENTS) = host_events; task_enable_irq(IT83XX_IRQ_PMC_IN); /* Process the wake events. */ lpc_update_wake(host_events & event_mask[LPC_HOST_EVENT_WAKE]); /* Send pulse on SMI signal if needed */ if (need_smi) lpc_generate_smi(); /* ACPI 5.0-12.6.1: Generate SCI for SCI_EVT=1. */ if (need_sci) lpc_generate_sci(); }
/** * Update the host event status. * * Sends a pulse if masked event status becomes non-zero: * - SMI pulse via EC_SMI_L GPIO * - SCI pulse via LPC0SCI */ static void update_host_event_status(void) { int need_sci = 0; int need_smi = 0; if (!init_done) return; /* Disable LPC interrupt while updating status register */ task_disable_irq(LM4_IRQ_LPC); if (host_events & event_mask[LPC_HOST_EVENT_SMI]) { /* Only generate SMI for first event */ if (!(LM4_LPC_ST(LPC_CH_ACPI) & LM4_LPC_ST_SMI)) need_smi = 1; LM4_LPC_ST(LPC_CH_ACPI) |= LM4_LPC_ST_SMI; } else LM4_LPC_ST(LPC_CH_ACPI) &= ~LM4_LPC_ST_SMI; if (host_events & event_mask[LPC_HOST_EVENT_SCI]) { /* Generate SCI for every event */ need_sci = 1; LM4_LPC_ST(LPC_CH_ACPI) |= LM4_LPC_ST_SCI; } else LM4_LPC_ST(LPC_CH_ACPI) &= ~LM4_LPC_ST_SCI; /* Copy host events to mapped memory */ *(uint32_t *)host_get_memmap(EC_MEMMAP_HOST_EVENTS) = host_events; task_enable_irq(LM4_IRQ_LPC); /* Process the wake events. */ lpc_update_wake(host_events & event_mask[LPC_HOST_EVENT_WAKE]); /* Send pulse on SMI signal if needed */ if (need_smi) lpc_generate_smi(); /* ACPI 5.0-12.6.1: Generate SCI for SCI_EVT=1. */ if (need_sci) lpc_generate_sci(); }
/** * Update the host event status. * * Sends a pulse if masked event status becomes non-zero: * - SMI pulse via EC_SMI_L GPIO * - SCI pulse via LPC0SCI */ static void update_host_event_status(void) { int need_sci = 0; int need_smi = 0; if (!init_done) return; /* Disable LPC interrupt while updating status register */ lpc_task_disable_irq(); if (host_events & event_mask[LPC_HOST_EVENT_SMI]) { /* Only generate SMI for first event */ if (!(NPCX_HIPMIE(PMC_ACPI) & NPCX_HIPMIE_SMIE)) need_smi = 1; SET_BIT(NPCX_HIPMIE(PMC_ACPI), NPCX_HIPMIE_SMIE); } else CLEAR_BIT(NPCX_HIPMIE(PMC_ACPI), NPCX_HIPMIE_SMIE); if (host_events & event_mask[LPC_HOST_EVENT_SCI]) { /* Generate SCI for every event */ need_sci = 1; SET_BIT(NPCX_HIPMIE(PMC_ACPI), NPCX_HIPMIE_SCIE); } else CLEAR_BIT(NPCX_HIPMIE(PMC_ACPI), NPCX_HIPMIE_SCIE); /* Copy host events to mapped memory */ *(uint32_t *)host_get_memmap(EC_MEMMAP_HOST_EVENTS) = host_events; lpc_task_enable_irq(); /* Process the wake events. */ lpc_update_wake(host_events & event_mask[LPC_HOST_EVENT_WAKE]); /* Send pulse on SMI signal if needed */ if (need_smi) lpc_generate_smi(); /* ACPI 5.0-12.6.1: Generate SCI for SCI_EVT=1. */ if (need_sci) lpc_generate_sci(); }
/** * Handle write to ACPI I/O port * * @param is_cmd Is write command (is_cmd=1) or data (is_cmd=0) */ static void handle_acpi_write(int is_cmd) { uint8_t value, result; /* Set processing flag before reading command byte */ SET_BIT(NPCX_HIPMST(PMC_ACPI), NPCX_HIPMST_F0); /* Read command/data; this clears the FRMH status bit. */ value = NPCX_HIPMDI(PMC_ACPI); /* Handle whatever this was. */ if (acpi_ap_to_ec(is_cmd, value, &result)) NPCX_HIPMDO(PMC_ACPI) = result; /* Clear processing flag */ CLEAR_BIT(NPCX_HIPMST(PMC_ACPI), NPCX_HIPMST_F0); /* * ACPI 5.0-12.6.1: Generate SCI for Input Buffer Empty / Output Buffer * Full condition on the kernel channel. */ lpc_generate_sci(); }
/** * Handle write to ACPI I/O port * * @param is_cmd Is write command (is_cmd=1) or data (is_cmd=0) */ static void handle_acpi_write(int is_cmd) { uint8_t value, result; /* Set the busy bit */ LM4_LPC_ST(LPC_CH_ACPI) |= LM4_LPC_ST_BUSY; /* Read command/data; this clears the FRMH status bit. */ value = LPC_POOL_ACPI[0]; /* Handle whatever this was. */ if (acpi_ap_to_ec(is_cmd, value, &result)) LPC_POOL_ACPI[1] = result; /* Clear the busy bit */ LM4_LPC_ST(LPC_CH_ACPI) &= ~LM4_LPC_ST_BUSY; /* * ACPI 5.0-12.6.1: Generate SCI for Input Buffer Empty / Output Buffer * Full condition on the kernel channel. */ lpc_generate_sci(); }