src/acpi/acpigen.c: Reformat code
Change-Id: I58851c8a26cad61975f8ba2910eedef3029aab6f Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/62131 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Lance Zhao
This commit is contained in:
parent
0ac5ed4490
commit
1f5e1b4f3c
|
@ -406,8 +406,7 @@ void acpigen_write_processor(u8 cpuindex, u32 pblock_addr, u8 pblock_len)
|
||||||
acpigen_emit_byte(pblock_len);
|
acpigen_emit_byte(pblock_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void acpigen_write_processor_package(const char *const name,
|
void acpigen_write_processor_package(const char *const name, const unsigned int first_core,
|
||||||
const unsigned int first_core,
|
|
||||||
const unsigned int core_count)
|
const unsigned int core_count)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -430,8 +429,7 @@ void acpigen_write_processor_cnot(const unsigned int number_of_cores)
|
||||||
acpigen_write_method("\\_SB.CNOT", 1);
|
acpigen_write_method("\\_SB.CNOT", 1);
|
||||||
for (core_id = 0; core_id < number_of_cores; core_id++) {
|
for (core_id = 0; core_id < number_of_cores; core_id++) {
|
||||||
char buffer[DEVICE_PATH_MAX];
|
char buffer[DEVICE_PATH_MAX];
|
||||||
snprintf(buffer, sizeof(buffer), CONFIG_ACPI_CPU_STRING,
|
snprintf(buffer, sizeof(buffer), CONFIG_ACPI_CPU_STRING, core_id);
|
||||||
core_id);
|
|
||||||
acpigen_emit_byte(NOTIFY_OP);
|
acpigen_emit_byte(NOTIFY_OP);
|
||||||
acpigen_emit_namestring(buffer);
|
acpigen_emit_namestring(buffer);
|
||||||
acpigen_emit_byte(ARG0_OP);
|
acpigen_emit_byte(ARG0_OP);
|
||||||
|
@ -514,22 +512,19 @@ static void acpigen_write_field_length(uint32_t len)
|
||||||
acpigen_emit_byte(emit[j]);
|
acpigen_emit_byte(emit[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void acpigen_write_field_offset(uint32_t offset,
|
static void acpigen_write_field_offset(uint32_t offset, uint32_t current_bit_pos)
|
||||||
uint32_t current_bit_pos)
|
|
||||||
{
|
{
|
||||||
uint32_t diff_bits;
|
uint32_t diff_bits;
|
||||||
|
|
||||||
if (offset < current_bit_pos) {
|
if (offset < current_bit_pos) {
|
||||||
printk(BIOS_WARNING, "%s: Cannot move offset backward",
|
printk(BIOS_WARNING, "%s: Cannot move offset backward", __func__);
|
||||||
__func__);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
diff_bits = offset - current_bit_pos;
|
diff_bits = offset - current_bit_pos;
|
||||||
/* Upper limit */
|
/* Upper limit */
|
||||||
if (diff_bits > 0xFFFFFFF) {
|
if (diff_bits > 0xFFFFFFF) {
|
||||||
printk(BIOS_WARNING, "%s: Offset very large to encode",
|
printk(BIOS_WARNING, "%s: Offset very large to encode", __func__);
|
||||||
__func__);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,8 +596,7 @@ void acpigen_write_field(const char *name, const struct fieldlist *l, size_t cou
|
||||||
current_bit_pos = l[i].bits;
|
current_bit_pos = l[i].bits;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk(BIOS_ERR, "%s: Invalid field type 0x%X\n"
|
printk(BIOS_ERR, "%s: Invalid field type 0x%X\n", __func__, l[i].type);
|
||||||
, __func__, l[i].type);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -630,8 +624,8 @@ void acpigen_write_field(const char *name, const struct fieldlist *l, size_t cou
|
||||||
* PMCS, 2
|
* PMCS, 2
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
void acpigen_write_indexfield(const char *idx, const char *data,
|
void acpigen_write_indexfield(const char *idx, const char *data, struct fieldlist *l,
|
||||||
struct fieldlist *l, size_t count, uint8_t flags)
|
size_t count, uint8_t flags)
|
||||||
{
|
{
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
uint32_t current_bit_pos = 0;
|
uint32_t current_bit_pos = 0;
|
||||||
|
@ -658,8 +652,7 @@ void acpigen_write_indexfield(const char *idx, const char *data,
|
||||||
current_bit_pos = l[i].bits;
|
current_bit_pos = l[i].bits;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk(BIOS_ERR, "%s: Invalid field type 0x%X\n"
|
printk(BIOS_ERR, "%s: Invalid field type 0x%X\n", __func__, l[i].type);
|
||||||
, __func__, l[i].type);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -945,8 +938,8 @@ void acpigen_write_PRW(u32 wake, u32 level)
|
||||||
acpigen_pop_len();
|
acpigen_pop_len();
|
||||||
}
|
}
|
||||||
|
|
||||||
void acpigen_write_PSS_package(u32 coreFreq, u32 power, u32 transLat,
|
void acpigen_write_PSS_package(u32 coreFreq, u32 power, u32 transLat, u32 busmLat, u32 control,
|
||||||
u32 busmLat, u32 control, u32 status)
|
u32 status)
|
||||||
{
|
{
|
||||||
acpigen_write_package(6);
|
acpigen_write_package(6);
|
||||||
acpigen_write_dword(coreFreq);
|
acpigen_write_dword(coreFreq);
|
||||||
|
@ -957,8 +950,8 @@ void acpigen_write_PSS_package(u32 coreFreq, u32 power, u32 transLat,
|
||||||
acpigen_write_dword(status);
|
acpigen_write_dword(status);
|
||||||
acpigen_pop_len();
|
acpigen_pop_len();
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "PSS: %uMHz power %u control 0x%x status 0x%x\n",
|
printk(BIOS_DEBUG, "PSS: %uMHz power %u control 0x%x status 0x%x\n", coreFreq, power,
|
||||||
coreFreq, power, control, status);
|
control, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void acpigen_write_pss_object(const struct acpi_sw_pstate *pstate_values, size_t nentries)
|
void acpigen_write_pss_object(const struct acpi_sw_pstate *pstate_values, size_t nentries)
|
||||||
|
@ -1193,14 +1186,12 @@ void acpigen_write_resourcetemplate_footer(void)
|
||||||
acpigen_pop_len();
|
acpigen_pop_len();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void acpigen_add_mainboard_rsvd_mem32(void *gp, struct device *dev,
|
static void acpigen_add_mainboard_rsvd_mem32(void *gp, struct device *dev, struct resource *res)
|
||||||
struct resource *res)
|
|
||||||
{
|
{
|
||||||
acpigen_write_mem32fixed(0, res->base, res->size);
|
acpigen_write_mem32fixed(0, res->base, res->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void acpigen_add_mainboard_rsvd_io(void *gp, struct device *dev,
|
static void acpigen_add_mainboard_rsvd_io(void *gp, struct device *dev, struct resource *res)
|
||||||
struct resource *res)
|
|
||||||
{
|
{
|
||||||
resource_t base = res->base;
|
resource_t base = res->base;
|
||||||
resource_t size = res->size;
|
resource_t size = res->size;
|
||||||
|
@ -1635,8 +1626,7 @@ void acpigen_write_pld(const struct acpi_pld *pld)
|
||||||
acpigen_pop_len();
|
acpigen_pop_len();
|
||||||
}
|
}
|
||||||
|
|
||||||
void acpigen_write_dsm(const char *uuid, void (**callbacks)(void *),
|
void acpigen_write_dsm(const char *uuid, void (**callbacks)(void *), size_t count, void *arg)
|
||||||
size_t count, void *arg)
|
|
||||||
{
|
{
|
||||||
struct dsm_uuid id = DSM_UUID(uuid, callbacks, count, arg);
|
struct dsm_uuid id = DSM_UUID(uuid, callbacks, count, arg);
|
||||||
acpigen_write_dsm_uuid_arr(&id, 1);
|
acpigen_write_dsm_uuid_arr(&id, 1);
|
||||||
|
@ -1783,8 +1773,7 @@ void acpigen_write_CPPC_package(const struct cppc_config *config)
|
||||||
max = CPPC_MAX_FIELDS_VER_3;
|
max = CPPC_MAX_FIELDS_VER_3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk(BIOS_ERR, "CPPC version %u is not implemented\n",
|
printk(BIOS_ERR, "CPPC version %u is not implemented\n", config->version);
|
||||||
config->version);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
acpigen_write_name(CPPC_PACKAGE_NAME);
|
acpigen_write_name(CPPC_PACKAGE_NAME);
|
||||||
|
@ -1885,8 +1874,7 @@ void acpigen_write_rom(void *bios, const size_t length)
|
||||||
acpigen_write_method_serialized("_ROM", 2);
|
acpigen_write_method_serialized("_ROM", 2);
|
||||||
|
|
||||||
/* OperationRegion("ROMS", SYSTEMMEMORY, current, length) */
|
/* OperationRegion("ROMS", SYSTEMMEMORY, current, length) */
|
||||||
struct opregion opreg = OPREGION("ROMS", SYSTEMMEMORY,
|
struct opregion opreg = OPREGION("ROMS", SYSTEMMEMORY, (uintptr_t)bios, length);
|
||||||
(uintptr_t)bios, length);
|
|
||||||
acpigen_write_opregion(&opreg);
|
acpigen_write_opregion(&opreg);
|
||||||
|
|
||||||
struct fieldlist l[] = {
|
struct fieldlist l[] = {
|
||||||
|
@ -1899,8 +1887,7 @@ void acpigen_write_rom(void *bios, const size_t length)
|
||||||
* Offset (0),
|
* Offset (0),
|
||||||
* RBF0, 0x80000
|
* RBF0, 0x80000
|
||||||
* } */
|
* } */
|
||||||
acpigen_write_field(opreg.name, l, 2, FIELD_ANYACC |
|
acpigen_write_field(opreg.name, l, 2, FIELD_ANYACC | FIELD_NOLOCK | FIELD_PRESERVE);
|
||||||
FIELD_NOLOCK | FIELD_PRESERVE);
|
|
||||||
|
|
||||||
/* Store (Arg0, Local0) */
|
/* Store (Arg0, Local0) */
|
||||||
acpigen_write_store();
|
acpigen_write_store();
|
||||||
|
@ -2058,8 +2045,8 @@ void acpigen_get_tx_gpio(const struct acpi_gpio *gpio)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* refer to ACPI 6.4.3.5.3 Word Address Space Descriptor section for details */
|
/* refer to ACPI 6.4.3.5.3 Word Address Space Descriptor section for details */
|
||||||
void acpigen_resource_word(u16 res_type, u16 gen_flags, u16 type_flags, u16 gran,
|
void acpigen_resource_word(u16 res_type, u16 gen_flags, u16 type_flags, u16 gran, u16 range_min,
|
||||||
u16 range_min, u16 range_max, u16 translation, u16 length)
|
u16 range_max, u16 translation, u16 length)
|
||||||
{
|
{
|
||||||
acpigen_emit_byte(0x88);
|
acpigen_emit_byte(0x88);
|
||||||
/* Byte 1+2: length (0x000d) */
|
/* Byte 1+2: length (0x000d) */
|
||||||
|
@ -2081,8 +2068,8 @@ void acpigen_resource_word(u16 res_type, u16 gen_flags, u16 type_flags, u16 gran
|
||||||
}
|
}
|
||||||
|
|
||||||
/* refer to ACPI 6.4.3.5.2 DWord Address Space Descriptor section for details */
|
/* refer to ACPI 6.4.3.5.2 DWord Address Space Descriptor section for details */
|
||||||
void acpigen_resource_dword(u16 res_type, u16 gen_flags, u16 type_flags,
|
void acpigen_resource_dword(u16 res_type, u16 gen_flags, u16 type_flags, u32 gran,
|
||||||
u32 gran, u32 range_min, u32 range_max, u32 translation, u32 length)
|
u32 range_min, u32 range_max, u32 translation, u32 length)
|
||||||
{
|
{
|
||||||
acpigen_emit_byte(0x87);
|
acpigen_emit_byte(0x87);
|
||||||
/* Byte 1+2: length (0023) */
|
/* Byte 1+2: length (0023) */
|
||||||
|
@ -2110,8 +2097,8 @@ static void acpigen_emit_qword(u64 data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* refer to ACPI 6.4.3.5.1 QWord Address Space Descriptor section for details */
|
/* refer to ACPI 6.4.3.5.1 QWord Address Space Descriptor section for details */
|
||||||
void acpigen_resource_qword(u16 res_type, u16 gen_flags, u16 type_flags,
|
void acpigen_resource_qword(u16 res_type, u16 gen_flags, u16 type_flags, u64 gran,
|
||||||
u64 gran, u64 range_min, u64 range_max, u64 translation, u64 length)
|
u64 range_min, u64 range_max, u64 translation, u64 length)
|
||||||
{
|
{
|
||||||
acpigen_emit_byte(0x8a);
|
acpigen_emit_byte(0x8a);
|
||||||
/* Byte 1+2: length (0x002b) */
|
/* Byte 1+2: length (0x002b) */
|
||||||
|
|
Loading…
Reference in New Issue