in ps3-sys-manager.c [403:478]
static int ps3_sys_manager_handle_event(struct ps3_system_bus_device *dev)
{
int result;
struct {
u8 version;
u8 type;
u8 reserved_1[2];
u32 value;
u8 reserved_2[8];
} event;
BUILD_BUG_ON(sizeof(event) != 16);
result = ps3_vuart_read(dev, &event, sizeof(event));
BUG_ON(result && "need to retry here");
if (event.version != 1) {
dev_dbg(&dev->core, "%s:%d: unsupported event version (%u)\n",
__func__, __LINE__, event.version);
return -EIO;
}
switch (event.type) {
case PS3_SM_EVENT_POWER_PRESSED:
dev_dbg(&dev->core, "%s:%d: POWER_PRESSED (%s)\n",
__func__, __LINE__,
(event.value == PS3_SM_BUTTON_EVENT_SOFT ? "soft"
: "hard"));
ps3_sm_force_power_off = 1;
/*
* A memory barrier is use here to sync memory since
* ps3_sys_manager_final_restart() could be called on
* another cpu.
*/
wmb();
kill_cad_pid(SIGINT, 1); /* ctrl_alt_del */
break;
case PS3_SM_EVENT_POWER_RELEASED:
dev_dbg(&dev->core, "%s:%d: POWER_RELEASED (%u ms)\n",
__func__, __LINE__, event.value);
break;
case PS3_SM_EVENT_RESET_PRESSED:
dev_dbg(&dev->core, "%s:%d: RESET_PRESSED (%s)\n",
__func__, __LINE__,
(event.value == PS3_SM_BUTTON_EVENT_SOFT ? "soft"
: "hard"));
ps3_sm_force_power_off = 0;
/*
* A memory barrier is use here to sync memory since
* ps3_sys_manager_final_restart() could be called on
* another cpu.
*/
wmb();
kill_cad_pid(SIGINT, 1); /* ctrl_alt_del */
break;
case PS3_SM_EVENT_RESET_RELEASED:
dev_dbg(&dev->core, "%s:%d: RESET_RELEASED (%u ms)\n",
__func__, __LINE__, event.value);
break;
case PS3_SM_EVENT_THERMAL_ALERT:
dev_dbg(&dev->core, "%s:%d: THERMAL_ALERT (zone %u)\n",
__func__, __LINE__, event.value);
pr_info("PS3 Thermal Alert Zone %u\n", event.value);
break;
case PS3_SM_EVENT_THERMAL_CLEARED:
dev_dbg(&dev->core, "%s:%d: THERMAL_CLEARED (zone %u)\n",
__func__, __LINE__, event.value);
break;
default:
dev_dbg(&dev->core, "%s:%d: unknown event (%u)\n",
__func__, __LINE__, event.type);
return -EIO;
}
return 0;
}