ec/acpi: Return error codes on timeout
The `send` and `recv` API functions currently print error messages if a timeout occurs while polling the EC, but they perform the I/O transaction regardless. This can put the EC in a bad state or otherwise invoke undefined hardware behavior. Most callers ignore the return value currently, but for callers which do not, we should make sure our behavior is correct. Signed-off-by: Abel Briggs <abelbriggs1@hotmail.com> Change-Id: Ifb87dd1ac869807fd08463bd8fef36d0389b325e Reviewed-on: https://review.coreboot.org/c/coreboot/+/64350 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
ccfbfdf0bb
commit
cb3c368385
|
@ -47,7 +47,7 @@ int send_ec_command_timeout(u8 command, int timeout_us)
|
|||
if (!ec_ready_send(timeout_us)) {
|
||||
printk(BIOS_DEBUG, "Timeout while sending command 0x%02x to EC!\n",
|
||||
command);
|
||||
// return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
outb(command, ec_cmd_reg);
|
||||
|
@ -65,7 +65,7 @@ int send_ec_data_timeout(u8 data, int timeout_us)
|
|||
if (!ec_ready_send(timeout_us)) {
|
||||
printk(BIOS_DEBUG, "Timeout while sending data 0x%02x to EC!\n",
|
||||
data);
|
||||
// return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
outb(data, ec_data_reg);
|
||||
|
@ -73,18 +73,18 @@ int send_ec_data_timeout(u8 data, int timeout_us)
|
|||
return 0;
|
||||
}
|
||||
|
||||
u8 recv_ec_data(void)
|
||||
int recv_ec_data(void)
|
||||
{
|
||||
return recv_ec_data_timeout(EC_RECV_TIMEOUT_US);
|
||||
}
|
||||
|
||||
u8 recv_ec_data_timeout(int timeout_us)
|
||||
int recv_ec_data_timeout(int timeout_us)
|
||||
{
|
||||
u8 data;
|
||||
|
||||
if (!ec_ready_recv(timeout_us)) {
|
||||
printk(BIOS_DEBUG, "Timeout while receiving data from EC!\n");
|
||||
// return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
data = inb(ec_data_reg);
|
||||
|
|
|
@ -29,8 +29,8 @@ int send_ec_command(u8 command);
|
|||
int send_ec_command_timeout(u8 command, int timeout);
|
||||
int send_ec_data(u8 data);
|
||||
int send_ec_data_timeout(u8 data, int timeout);
|
||||
u8 recv_ec_data(void);
|
||||
u8 recv_ec_data_timeout(int timeout);
|
||||
int recv_ec_data(void);
|
||||
int recv_ec_data_timeout(int timeout);
|
||||
void ec_clear_out_queue(void);
|
||||
u8 ec_status(void);
|
||||
u8 ec_query(void);
|
||||
|
|
Loading…
Reference in New Issue