14 #include <variant/sch5545_ec_tables.h>
16 #define GPIO_CHASSIS_ID0 1
17 #define GPIO_CHASSIS_ID1 17
18 #define GPIO_CHASSIS_ID2 37
19 #define GPIO_FRONT_PANEL_CHASSIS_DET_L 70
106 int_cond = int_sts & 0x71;
107 }
while (int_cond == 0);
111 if ((int_sts & 1) == 0)
128 if ((int_sts & 70) != 0)
130 }
while ((int_sts & 1) == 0);
155 uint8_t int_mask_bckup, ret = 0;
170 else if (ret != 1 && rw_bit)
172 "when writing %02x to %04x\n", *
value,
reg);
173 else if (ret != 1 && !rw_bit)
175 "when reading %04x\n",
reg);
189 ec_fw_version = (
val << 8);
191 ec_fw_version |=
val;
196 return ec_fw_version;
204 size_t ec_fw_file_size;
206 ec_fw_file =
cbfs_map(
"sch5545_ecfw.bin", &ec_fw_file_size);
208 if (!ec_fw_file || ec_fw_file_size != 0x1750) {
210 printk(
BIOS_ERR,
"The fans will keep running at maximum speed.\n");
214 ec_fw_version = ec_fw_file[3] & 0xffff;
220 if (ec_version != ec_fw_version) {
221 printk(
BIOS_INFO,
"SCH5545 EC is not functional, probably due to power "
242 printk(
BIOS_ERR,
"The fans will keep running at maximum speed\n");
286 power_unit = msr.
lo & 0xf;
290 tdp = msr.
lo & 0x7fff;
293 if ((tdp >> power_unit) < 66)
309 switch (chassis_id) {
337 for (i = 0; i < size; i++) {
338 if (ec_hwm_sequence[i].tdp == tdp_config ||
340 val = ec_hwm_sequence[i].
val;
351 if (write_only == 1) {
396 if (chassis_type != 0xff) {
398 switch (chassis_type) {
414 if (CONFIG_MAX_CPUS > 2) {
424 if (fan_speed_full) {
439 if (chassis_type == 4 || chassis_type == 5) {
466 if (chassis_type != 3)
475 if (chassis_type == 3) {
static void * cbfs_map(const char *name, size_t *size_out)
#define printk(level,...)
#define MSR_PKG_POWER_SKU
#define MSR_PKG_POWER_SKU_UNIT
int get_gpio(int community_base, int pad0_offset)
static __always_inline msr_t rdmsr(unsigned int index)
#define BIOS_INFO
BIOS_INFO - Expected events.
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
unsigned int get_uint_option(const char *name, const unsigned int fallback)
static const ec_chassis_tdp_t ec_hwm_chassis6[]
static const ec_chassis_tdp_t ec_hwm_chassis4[]
static const ec_chassis_tdp_t ec_hwm_chassis5[]
static const ec_chassis_tdp_t ec_hwm_chassis3[]
uint16_t sch5545_get_ec_fw_version(void)
void sch5545_ec_hwm_early_init(void)
static uint8_t get_chassis_type(void)
#define GPIO_FRONT_PANEL_CHASSIS_DET_L
static void ec_check_mbox_and_int_status(uint8_t int_src, uint8_t mbox_msg)
static void ec_hwm_init_late(const ec_chassis_tdp_t *ec_hwm_sequence, size_t size)
void sch5545_ec_hwm_init(void *unused)
static uint8_t get_sku_tdp_config(void)
static void prepare_for_hwm_ec_sequence(uint8_t write_only, uint8_t *value)
static uint8_t send_mbox_msg_with_int(uint8_t mbox_message)
static uint8_t ec_read_write_reg(uint8_t ldn, uint16_t reg, uint8_t *value, uint8_t rw_bit)
static uint8_t send_mbox_msg_simple(uint8_t mbox_message)
static const struct ec_val_reg ec_hwm_init_seq[]
void sch5545_update_ec_firmware(uint16_t ec_version)
void sch5545_emi_set_int_mask_low(uint8_t mask)
Sets the EC interrupt mask for LSB in the Interrupt Mask register.
uint8_t sch5545_emi_get_int_src_low(void)
Returns LSB of interrupt source register.
uint8_t sch5545_emi_get_int_mask_low(void)
Returns LSB of Interrupt mask register.
uint8_t sch5545_emi_ec_read8(uint16_t addr)
Reads any byte of 4 bytes from the 32bit dword indicated by addr.
void sch5545_emi_h2ec_mbox_write(uint8_t mbox_message)
Writes the Host to EC mailbox 8bit register with mbox_message.
void sch5545_emi_set_int_src_low(uint8_t int_src)
Writes int_src bits to clear the desired interrupt source LSB.
void sch5545_emi_ec_write32(uint16_t addr, uint32_t data)
Writes dword of data at the desired address indicated by addr.
void sch5545_emi_ec_write16(uint16_t addr, uint16_t data)
Writes any word of 2 words from the 32bit dword indicated by addr.
void sch5545_emi_ec_write32_bulk(uint16_t addr, const uint32_t *buffer, size_t len)
Writes an array of dwords at the desired address indicated by addr.
uint8_t sch5545_emi_ec2h_mbox_read(void)
Reads and returns the EC to Host mailbox 8bit register.
void sch5545_emi_init(uint8_t sio_port)
One must call this function at every stage before using any of the EMI functions.