mail.coreboot.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
List overview
Download
coreboot-gerrit
November 2014
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
coreboot-gerrit@coreboot.org
1 participants
1441 discussions
Start a n
N
ew thread
Patch set updated for coreboot: e88006b sch: Move to implicit length patching
by Vladimir Serbinenko
05 Nov '14
05 Nov '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/7330
-gerrit commit e88006be23a8ad4e3ec6b427274771f2b59e273f Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Tue Nov 4 21:21:42 2014 +0100 sch: Move to implicit length patching Change-Id: I057e7d30fa3c661e83db09e27278ce9f0bec69d4 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/southbridge/intel/sch/lpc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/southbridge/intel/sch/lpc.c b/src/southbridge/intel/sch/lpc.c index 7d209b1..dcf9e33 100644 --- a/src/southbridge/intel/sch/lpc.c +++ b/src/southbridge/intel/sch/lpc.c @@ -193,16 +193,15 @@ static void southbridge_inject_dsdt(void) global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs)); if (gnvs) { - int scopelen; memset(gnvs, 0, sizeof(*gnvs)); acpi_create_gnvs(gnvs); /* And tell SMI about it */ smm_setup_structures(gnvs, NULL, NULL); /* Add it to SSDT. */ - scopelen = acpigen_write_scope("\\"); - scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_patch_len(scopelen - 1); + acpigen_write_scope("\\"); + acpigen_write_name_dword("NVSA", (u32) gnvs); + acpigen_pop_len(); } }
1
0
0
0
Patch set updated for coreboot: 6b30ed3 ibexpeak, bd82x6x: Move to implicit length patching
by Vladimir Serbinenko
05 Nov '14
05 Nov '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/7326
-gerrit commit 6b30ed3581601bc2bf8a299ff7e75e47753c8869 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Tue Nov 4 21:09:23 2014 +0100 ibexpeak, bd82x6x: Move to implicit length patching Change-Id: I43eef7f97398d7c4c3f8d9790920fa4402019dd7 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/cpu/intel/fsp_model_206ax/acpi.c | 112 ++++++++++++++------------------ src/cpu/intel/model_2065x/acpi.c | 100 +++++++++++++--------------- src/cpu/intel/model_206ax/acpi.c | 102 +++++++++++++---------------- src/cpu/intel/speedstep/acpi.c | 32 ++++----- src/southbridge/intel/bd82x6x/lpc.c | 8 +-- src/southbridge/intel/fsp_bd82x6x/lpc.c | 8 +-- src/southbridge/intel/ibexpeak/lpc.c | 8 +-- 7 files changed, 161 insertions(+), 209 deletions(-) diff --git a/src/cpu/intel/fsp_model_206ax/acpi.c b/src/cpu/intel/fsp_model_206ax/acpi.c index 28aeb43..57af836 100644 --- a/src/cpu/intel/fsp_model_206ax/acpi.c +++ b/src/cpu/intel/fsp_model_206ax/acpi.c @@ -48,10 +48,10 @@ static int get_cores_per_package(void) return cores; } -static int generate_cstate_entries(acpi_cstate_t *cstates, +static void generate_cstate_entries(acpi_cstate_t *cstates, int c1, int c2, int c3) { - int length, cstate_count = 0; + int cstate_count = 0; /* Count number of active C-states */ if (c1 > 0) @@ -61,74 +61,70 @@ static int generate_cstate_entries(acpi_cstate_t *cstates, if (c3 > 0) ++cstate_count; if (!cstate_count) - return 0; + return; - length = acpigen_write_package(cstate_count + 1); - length += acpigen_write_byte(cstate_count); + acpigen_write_package(cstate_count + 1); + acpigen_write_byte(cstate_count); /* Add an entry if the level is enabled */ if (c1 > 0) { cstates[c1].ctype = 1; - length += acpigen_write_CST_package_entry(&cstates[c1]); + acpigen_write_CST_package_entry(&cstates[c1]); } if (c2 > 0) { cstates[c2].ctype = 2; - length += acpigen_write_CST_package_entry(&cstates[c2]); + acpigen_write_CST_package_entry(&cstates[c2]); } if (c3 > 0) { cstates[c3].ctype = 3; - length += acpigen_write_CST_package_entry(&cstates[c3]); + acpigen_write_CST_package_entry(&cstates[c3]); } - acpigen_patch_len(length - 1); - return length; + acpigen_pop_len(); } -static int generate_C_state_entries(void) +static void generate_C_state_entries(void) { struct cpu_info *info; struct cpu_driver *cpu; - int len, lenif; struct device *lapic; struct cpu_intel_fsp_model_206ax_config *conf = NULL; /* Find the SpeedStep CPU in the device tree using magic APIC ID */ lapic = dev_find_lapic(SPEEDSTEP_APIC_MAGIC); if (!lapic) - return 0; + return; conf = lapic->chip_info; if (!conf) - return 0; + return; /* Find CPU map of supported C-states */ info = cpu_info(); if (!info) - return 0; + return; cpu = find_cpu_driver(info->cpu); if (!cpu || !cpu->cstates) - return 0; + return; - len = acpigen_emit_byte(0x14); /* MethodOp */ - len += acpigen_write_len_f(); /* PkgLength */ - len += acpigen_emit_namestring("_CST"); - len += acpigen_emit_byte(0x00); /* No Arguments */ + acpigen_emit_byte(0x14); /* MethodOp */ + acpigen_write_len_f(); /* PkgLength */ + acpigen_emit_namestring("_CST"); + acpigen_emit_byte(0x00); /* No Arguments */ /* If running on AC power */ - len += acpigen_emit_byte(0xa0); /* IfOp */ - lenif = acpigen_write_len_f(); /* PkgLength */ - lenif += acpigen_emit_namestring("PWRS"); - lenif += acpigen_emit_byte(0xa4); /* ReturnOp */ - lenif += generate_cstate_entries(cpu->cstates, conf->c1_acpower, + acpigen_emit_byte(0xa0); /* IfOp */ + acpigen_write_len_f(); /* PkgLength */ + acpigen_emit_namestring("PWRS"); + acpigen_emit_byte(0xa4); /* ReturnOp */ + generate_cstate_entries(cpu->cstates, conf->c1_acpower, conf->c2_acpower, conf->c3_acpower); - acpigen_patch_len(lenif - 1); - len += lenif; + acpigen_pop_len(); /* Else on battery power */ - len += acpigen_emit_byte(0xa4); /* ReturnOp */ - len += generate_cstate_entries(cpu->cstates, conf->c1_battery, + acpigen_emit_byte(0xa4); /* ReturnOp */ + generate_cstate_entries(cpu->cstates, conf->c1_battery, conf->c2_battery, conf->c3_battery); - acpigen_patch_len(len - 1); - return len; + acpigen_pop_len(); } static acpi_tstate_t tss_table_fine[] = { @@ -160,31 +156,27 @@ static acpi_tstate_t tss_table_coarse[] = { { 13, 125, 0, 0x19, 0 }, }; -static int generate_T_state_entries(int core, int cores_per_package) +static void generate_T_state_entries(int core, int cores_per_package) { - int len; - /* Indicate SW_ALL coordination for T-states */ - len = acpigen_write_TSD_package(core, cores_per_package, SW_ALL); + acpigen_write_TSD_package(core, cores_per_package, SW_ALL); /* Indicate FFixedHW so OS will use MSR */ - len += acpigen_write_empty_PTC(); + acpigen_write_empty_PTC(); /* Set a T-state limit that can be modified in NVS */ - len += acpigen_write_TPC("\\TLVL"); + acpigen_write_TPC("\\TLVL"); /* * CPUID.(EAX=6):EAX[5] indicates support * for extended throttle levels. */ if (cpuid_eax(6) & (1 << 5)) - len += acpigen_write_TSS_package( + acpigen_write_TSS_package( ARRAY_SIZE(tss_table_fine), tss_table_fine); else - len += acpigen_write_TSS_package( + acpigen_write_TSS_package( ARRAY_SIZE(tss_table_coarse), tss_table_coarse); - - return len; } static int calculate_power(int tdp, int p1_ratio, int ratio) @@ -208,9 +200,8 @@ static int calculate_power(int tdp, int p1_ratio, int ratio) return (int)power; } -static int generate_P_state_entries(int core, int cores_per_package) +static void generate_P_state_entries(int core, int cores_per_package) { - int len, len_pss; int ratio_min, ratio_max, ratio_turbo, ratio_step; int coord_type, power_max, power_unit, num_entries; int ratio, power, clock, clock_max; @@ -245,16 +236,16 @@ static int generate_P_state_entries(int core, int cores_per_package) power_max = ((msr.lo & 0x7fff) / power_unit) * 1000; /* Write _PCT indicating use of FFixedHW */ - len = acpigen_write_empty_PCT(); + acpigen_write_empty_PCT(); /* Write _PPC with no limit on supported P-state */ - len += acpigen_write_PPC_NVS(); + acpigen_write_PPC_NVS(); /* Write PSD indicating configured coordination type */ - len += acpigen_write_PSD_package(core, cores_per_package, coord_type); + acpigen_write_PSD_package(core, cores_per_package, coord_type); /* Add P-state entries in _PSS table */ - len += acpigen_write_name("_PSS"); + acpigen_write_name("_PSS"); /* Determine ratio points */ ratio_step = PSS_RATIO_STEP; @@ -267,13 +258,13 @@ static int generate_P_state_entries(int core, int cores_per_package) /* P[T] is Turbo state if enabled */ if (get_turbo_state() == TURBO_ENABLED) { /* _PSS package count including Turbo */ - len_pss = acpigen_write_package(num_entries + 2); + acpigen_write_package(num_entries + 2); msr = rdmsr(MSR_TURBO_RATIO_LIMIT); ratio_turbo = msr.lo & 0xff; /* Add entry for Turbo ratio */ - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock_max + 1, /*MHz*/ power_max, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -282,11 +273,11 @@ static int generate_P_state_entries(int core, int cores_per_package) ratio_turbo << 8); /*status*/ } else { /* _PSS package count without Turbo */ - len_pss = acpigen_write_package(num_entries + 1); + acpigen_write_package(num_entries + 1); } /* First regular entry is max non-turbo ratio */ - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock_max, /*MHz*/ power_max, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -302,7 +293,7 @@ static int generate_P_state_entries(int core, int cores_per_package) power = calculate_power(power_max, ratio_max, ratio); clock = ratio * SANDYBRIDGE_BCLK; - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock, /*MHz*/ power, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -312,15 +303,11 @@ static int generate_P_state_entries(int core, int cores_per_package) } /* Fix package length */ - len_pss--; - acpigen_patch_len(len_pss); - - return len + len_pss; + acpigen_pop_len(); } void generate_cpu_entries(void) { - int len_pr; int coreID, cpuID, pcontrol_blk = PMB0_BASE, plen = 6; int totalcores = dev_count_cpu(); int cores_per_package = get_cores_per_package(); @@ -337,23 +324,22 @@ void generate_cpu_entries(void) } /* Generate processor \_PR.CPUx */ - len_pr = acpigen_write_processor( + acpigen_write_processor( (cpuID-1)*cores_per_package+coreID-1, pcontrol_blk, plen); /* Generate P-state tables */ - len_pr += generate_P_state_entries( + generate_P_state_entries( cpuID-1, cores_per_package); /* Generate C-state tables */ - len_pr += generate_C_state_entries(); + generate_C_state_entries(); /* Generate T-state tables */ - len_pr += generate_T_state_entries( + generate_T_state_entries( cpuID-1, cores_per_package); - len_pr--; - acpigen_patch_len(len_pr); + acpigen_pop_len(); } } } diff --git a/src/cpu/intel/model_2065x/acpi.c b/src/cpu/intel/model_2065x/acpi.c index 870020f..bfe801d 100644 --- a/src/cpu/intel/model_2065x/acpi.c +++ b/src/cpu/intel/model_2065x/acpi.c @@ -48,10 +48,10 @@ static int get_cores_per_package(void) return cores; } -static int generate_cstate_entries(acpi_cstate_t *cstates, +static void generate_cstate_entries(acpi_cstate_t *cstates, int c1, int c2, int c3) { - int length, cstate_count = 0; + int cstate_count = 0; /* Count number of active C-states */ if (c1 > 0) @@ -61,74 +61,70 @@ static int generate_cstate_entries(acpi_cstate_t *cstates, if (c3 > 0) ++cstate_count; if (!cstate_count) - return 0; + return; - length = acpigen_write_package(cstate_count + 1); - length += acpigen_write_byte(cstate_count); + acpigen_write_package(cstate_count + 1); + acpigen_write_byte(cstate_count); /* Add an entry if the level is enabled */ if (c1 > 0) { cstates[c1].ctype = 1; - length += acpigen_write_CST_package_entry(&cstates[c1]); + acpigen_write_CST_package_entry(&cstates[c1]); } if (c2 > 0) { cstates[c2].ctype = 2; - length += acpigen_write_CST_package_entry(&cstates[c2]); + acpigen_write_CST_package_entry(&cstates[c2]); } if (c3 > 0) { cstates[c3].ctype = 3; - length += acpigen_write_CST_package_entry(&cstates[c3]); + acpigen_write_CST_package_entry(&cstates[c3]); } - acpigen_patch_len(length - 1); - return length; + acpigen_pop_len(); } -static int generate_C_state_entries(void) +static void generate_C_state_entries(void) { struct cpu_info *info; struct cpu_driver *cpu; - int len, lenif; struct device *lapic; struct cpu_intel_model_2065x_config *conf = NULL; /* Find the SpeedStep CPU in the device tree using magic APIC ID */ lapic = dev_find_lapic(SPEEDSTEP_APIC_MAGIC); if (!lapic) - return 0; + return; conf = lapic->chip_info; if (!conf) - return 0; + return; /* Find CPU map of supported C-states */ info = cpu_info(); if (!info) - return 0; + return; cpu = find_cpu_driver(info->cpu); if (!cpu || !cpu->cstates) - return 0; + return; - len = acpigen_emit_byte(0x14); /* MethodOp */ - len += acpigen_write_len_f(); /* PkgLength */ - len += acpigen_emit_namestring("_CST"); - len += acpigen_emit_byte(0x00); /* No Arguments */ + acpigen_emit_byte(0x14); /* MethodOp */ + acpigen_write_len_f(); /* PkgLength */ + acpigen_emit_namestring("_CST"); + acpigen_emit_byte(0x00); /* No Arguments */ /* If running on AC power */ - len += acpigen_emit_byte(0xa0); /* IfOp */ - lenif = acpigen_write_len_f(); /* PkgLength */ - lenif += acpigen_emit_namestring("PWRS"); - lenif += acpigen_emit_byte(0xa4); /* ReturnOp */ - lenif += generate_cstate_entries(cpu->cstates, conf->c1_acpower, - conf->c2_acpower, conf->c3_acpower); - acpigen_patch_len(lenif - 1); - len += lenif; + acpigen_emit_byte(0xa0); /* IfOp */ + acpigen_write_len_f(); /* PkgLength */ + acpigen_emit_namestring("PWRS"); + acpigen_emit_byte(0xa4); /* ReturnOp */ + generate_cstate_entries(cpu->cstates, conf->c1_acpower, + conf->c2_acpower, conf->c3_acpower); + acpigen_pop_len(); /* Else on battery power */ - len += acpigen_emit_byte(0xa4); /* ReturnOp */ - len += generate_cstate_entries(cpu->cstates, conf->c1_battery, - conf->c2_battery, conf->c3_battery); - acpigen_patch_len(len - 1); - return len; + acpigen_emit_byte(0xa4); /* ReturnOp */ + generate_cstate_entries(cpu->cstates, conf->c1_battery, + conf->c2_battery, conf->c3_battery); + acpigen_pop_len(); } static acpi_tstate_t tss_table_fine[] = { @@ -208,9 +204,8 @@ static int calculate_power(int tdp, int p1_ratio, int ratio) return (int)power; } -static int generate_P_state_entries(int core, int cores_per_package) +static void generate_P_state_entries(int core, int cores_per_package) { - int len, len_pss; int ratio_min, ratio_max, ratio_turbo, ratio_step; int coord_type, power_max, num_entries; int ratio, power, clock, clock_max; @@ -242,16 +237,16 @@ static int generate_P_state_entries(int core, int cores_per_package) power_max = 25000; /* Write _PCT indicating use of FFixedHW */ - len = acpigen_write_empty_PCT(); + acpigen_write_empty_PCT(); /* Write _PPC with no limit on supported P-state */ - len += acpigen_write_PPC_NVS(); + acpigen_write_PPC_NVS(); /* Write PSD indicating configured coordination type */ - len += acpigen_write_PSD_package(core, cores_per_package, coord_type); + acpigen_write_PSD_package(core, cores_per_package, coord_type); /* Add P-state entries in _PSS table */ - len += acpigen_write_name("_PSS"); + acpigen_write_name("_PSS"); /* Determine ratio points */ ratio_step = PSS_RATIO_STEP; @@ -264,13 +259,13 @@ static int generate_P_state_entries(int core, int cores_per_package) /* P[T] is Turbo state if enabled */ if (get_turbo_state() == TURBO_ENABLED) { /* _PSS package count including Turbo */ - len_pss = acpigen_write_package(num_entries + 2); + acpigen_write_package(num_entries + 2); msr = rdmsr(MSR_TURBO_RATIO_LIMIT); ratio_turbo = msr.lo & 0xff; /* Add entry for Turbo ratio */ - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock_max + 1, /*MHz*/ power_max, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -279,11 +274,11 @@ static int generate_P_state_entries(int core, int cores_per_package) ratio_turbo); /*status*/ } else { /* _PSS package count without Turbo */ - len_pss = acpigen_write_package(num_entries + 1); + acpigen_write_package(num_entries + 1); } /* First regular entry is max non-turbo ratio */ - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock_max, /*MHz*/ power_max, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -299,7 +294,7 @@ static int generate_P_state_entries(int core, int cores_per_package) power = calculate_power(power_max, ratio_max, ratio); clock = ratio * NEHALEM_BCLK + ratio / 3; - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock, /*MHz*/ power, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -309,15 +304,11 @@ static int generate_P_state_entries(int core, int cores_per_package) } /* Fix package length */ - len_pss--; - acpigen_patch_len(len_pss); - - return len + len_pss; + acpigen_pop_len(); } void generate_cpu_entries(void) { - int len_pr; int coreID, cpuID, pcontrol_blk = PMB0_BASE, plen = 6; int totalcores = dev_count_cpu(); int cores_per_package = get_cores_per_package(); @@ -334,23 +325,22 @@ void generate_cpu_entries(void) } /* Generate processor \_PR.CPUx */ - len_pr = acpigen_write_processor( + acpigen_write_processor( (cpuID-1)*cores_per_package+coreID-1, pcontrol_blk, plen); /* Generate P-state tables */ - len_pr += generate_P_state_entries( + generate_P_state_entries( cpuID-1, cores_per_package); /* Generate C-state tables */ - len_pr += generate_C_state_entries(); + generate_C_state_entries(); /* Generate T-state tables */ - len_pr += generate_T_state_entries( + generate_T_state_entries( cpuID-1, cores_per_package); - len_pr--; - acpigen_patch_len(len_pr); + acpigen_pop_len(); } } } diff --git a/src/cpu/intel/model_206ax/acpi.c b/src/cpu/intel/model_206ax/acpi.c index 21f9c3e..a801ec0 100644 --- a/src/cpu/intel/model_206ax/acpi.c +++ b/src/cpu/intel/model_206ax/acpi.c @@ -48,10 +48,10 @@ static int get_cores_per_package(void) return cores; } -static int generate_cstate_entries(acpi_cstate_t *cstates, - int c1, int c2, int c3) +static void generate_cstate_entries(acpi_cstate_t *cstates, + int c1, int c2, int c3) { - int length, cstate_count = 0; + int cstate_count = 0; /* Count number of active C-states */ if (c1 > 0) @@ -61,74 +61,70 @@ static int generate_cstate_entries(acpi_cstate_t *cstates, if (c3 > 0) ++cstate_count; if (!cstate_count) - return 0; + return; - length = acpigen_write_package(cstate_count + 1); - length += acpigen_write_byte(cstate_count); + acpigen_write_package(cstate_count + 1); + acpigen_write_byte(cstate_count); /* Add an entry if the level is enabled */ if (c1 > 0) { cstates[c1].ctype = 1; - length += acpigen_write_CST_package_entry(&cstates[c1]); + acpigen_write_CST_package_entry(&cstates[c1]); } if (c2 > 0) { cstates[c2].ctype = 2; - length += acpigen_write_CST_package_entry(&cstates[c2]); + acpigen_write_CST_package_entry(&cstates[c2]); } if (c3 > 0) { cstates[c3].ctype = 3; - length += acpigen_write_CST_package_entry(&cstates[c3]); + acpigen_write_CST_package_entry(&cstates[c3]); } - acpigen_patch_len(length - 1); - return length; + acpigen_pop_len(); } -static int generate_C_state_entries(void) +static void generate_C_state_entries(void) { struct cpu_info *info; struct cpu_driver *cpu; - int len, lenif; struct device *lapic; struct cpu_intel_model_206ax_config *conf = NULL; /* Find the SpeedStep CPU in the device tree using magic APIC ID */ lapic = dev_find_lapic(SPEEDSTEP_APIC_MAGIC); if (!lapic) - return 0; + return; conf = lapic->chip_info; if (!conf) - return 0; + return; /* Find CPU map of supported C-states */ info = cpu_info(); if (!info) - return 0; + return; cpu = find_cpu_driver(info->cpu); if (!cpu || !cpu->cstates) - return 0; + return; - len = acpigen_emit_byte(0x14); /* MethodOp */ - len += acpigen_write_len_f(); /* PkgLength */ - len += acpigen_emit_namestring("_CST"); - len += acpigen_emit_byte(0x00); /* No Arguments */ + acpigen_emit_byte(0x14); /* MethodOp */ + acpigen_write_len_f(); /* PkgLength */ + acpigen_emit_namestring("_CST"); + acpigen_emit_byte(0x00); /* No Arguments */ /* If running on AC power */ - len += acpigen_emit_byte(0xa0); /* IfOp */ - lenif = acpigen_write_len_f(); /* PkgLength */ - lenif += acpigen_emit_namestring("PWRS"); - lenif += acpigen_emit_byte(0xa4); /* ReturnOp */ - lenif += generate_cstate_entries(cpu->cstates, conf->c1_acpower, - conf->c2_acpower, conf->c3_acpower); - acpigen_patch_len(lenif - 1); - len += lenif; + acpigen_emit_byte(0xa0); /* IfOp */ + acpigen_write_len_f(); /* PkgLength */ + acpigen_emit_namestring("PWRS"); + acpigen_emit_byte(0xa4); /* ReturnOp */ + generate_cstate_entries(cpu->cstates, conf->c1_acpower, + conf->c2_acpower, conf->c3_acpower); + acpigen_pop_len(); /* Else on battery power */ - len += acpigen_emit_byte(0xa4); /* ReturnOp */ - len += generate_cstate_entries(cpu->cstates, conf->c1_battery, - conf->c2_battery, conf->c3_battery); - acpigen_patch_len(len - 1); - return len; + acpigen_emit_byte(0xa4); /* ReturnOp */ + generate_cstate_entries(cpu->cstates, conf->c1_battery, + conf->c2_battery, conf->c3_battery); + acpigen_pop_len(); } static acpi_tstate_t tss_table_fine[] = { @@ -208,9 +204,8 @@ static int calculate_power(int tdp, int p1_ratio, int ratio) return (int)power; } -static int generate_P_state_entries(int core, int cores_per_package) +static void generate_P_state_entries(int core, int cores_per_package) { - int len, len_pss; int ratio_min, ratio_max, ratio_turbo, ratio_step; int coord_type, power_max, power_unit, num_entries; int ratio, power, clock, clock_max; @@ -245,16 +240,16 @@ static int generate_P_state_entries(int core, int cores_per_package) power_max = ((msr.lo & 0x7fff) / power_unit) * 1000; /* Write _PCT indicating use of FFixedHW */ - len = acpigen_write_empty_PCT(); + acpigen_write_empty_PCT(); /* Write _PPC with no limit on supported P-state */ - len += acpigen_write_PPC_NVS(); + acpigen_write_PPC_NVS(); /* Write PSD indicating configured coordination type */ - len += acpigen_write_PSD_package(core, cores_per_package, coord_type); + acpigen_write_PSD_package(core, cores_per_package, coord_type); /* Add P-state entries in _PSS table */ - len += acpigen_write_name("_PSS"); + acpigen_write_name("_PSS"); /* Determine ratio points */ ratio_step = PSS_RATIO_STEP; @@ -267,13 +262,13 @@ static int generate_P_state_entries(int core, int cores_per_package) /* P[T] is Turbo state if enabled */ if (get_turbo_state() == TURBO_ENABLED) { /* _PSS package count including Turbo */ - len_pss = acpigen_write_package(num_entries + 2); + acpigen_write_package(num_entries + 2); msr = rdmsr(MSR_TURBO_RATIO_LIMIT); ratio_turbo = msr.lo & 0xff; /* Add entry for Turbo ratio */ - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock_max + 1, /*MHz*/ power_max, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -282,11 +277,11 @@ static int generate_P_state_entries(int core, int cores_per_package) ratio_turbo << 8); /*status*/ } else { /* _PSS package count without Turbo */ - len_pss = acpigen_write_package(num_entries + 1); + acpigen_write_package(num_entries + 1); } /* First regular entry is max non-turbo ratio */ - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock_max, /*MHz*/ power_max, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -302,7 +297,7 @@ static int generate_P_state_entries(int core, int cores_per_package) power = calculate_power(power_max, ratio_max, ratio); clock = ratio * SANDYBRIDGE_BCLK; - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock, /*MHz*/ power, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -312,15 +307,11 @@ static int generate_P_state_entries(int core, int cores_per_package) } /* Fix package length */ - len_pss--; - acpigen_patch_len(len_pss); - - return len + len_pss; + acpigen_pop_len(); } void generate_cpu_entries(void) { - int len_pr; int coreID, cpuID, pcontrol_blk = PMB0_BASE, plen = 6; int totalcores = dev_count_cpu(); int cores_per_package = get_cores_per_package(); @@ -337,23 +328,22 @@ void generate_cpu_entries(void) } /* Generate processor \_PR.CPUx */ - len_pr = acpigen_write_processor( + acpigen_write_processor( (cpuID-1)*cores_per_package+coreID-1, pcontrol_blk, plen); /* Generate P-state tables */ - len_pr += generate_P_state_entries( + generate_P_state_entries( cpuID-1, cores_per_package); /* Generate C-state tables */ - len_pr += generate_C_state_entries(); + generate_C_state_entries(); /* Generate T-state tables */ - len_pr += generate_T_state_entries( + generate_T_state_entries( cpuID-1, cores_per_package); - len_pr--; - acpigen_patch_len(len_pr); + acpigen_pop_len(); } } } diff --git a/src/cpu/intel/speedstep/acpi.c b/src/cpu/intel/speedstep/acpi.c index 98d1ee7..8a2bff1 100644 --- a/src/cpu/intel/speedstep/acpi.c +++ b/src/cpu/intel/speedstep/acpi.c @@ -82,18 +82,17 @@ static int get_fsb(void) return 600; } -static int gen_pstate_entries(const sst_table_t *const pstates, +static void gen_pstate_entries(const sst_table_t *const pstates, const int cpuID, const int cores_per_package, const uint8_t coordination) { int i; - int len, len_ps; int frequency; - len = acpigen_write_empty_PCT(); - len += acpigen_write_PSD_package( + acpigen_write_empty_PCT(); + acpigen_write_PSD_package( cpuID, cores_per_package, coordination); - len += acpigen_write_name("_PSS"); + acpigen_write_name("_PSS"); const int fsb3 = get_fsb(); const int min_ratio2 = SPEEDSTEP_DOUBLE_RATIO( @@ -107,7 +106,7 @@ static int gen_pstate_entries(const sst_table_t *const pstates, printk(BIOS_DEBUG, "adding %x P-States between " "busratio %x and %x, ""incl. P0\n", pstates->num_states, min_ratio2 / 2, max_ratio2 / 2); - len_ps = acpigen_write_package(pstates->num_states); + acpigen_write_package(pstates->num_states); for (i = 0; i < pstates->num_states; ++i) { const sst_state_t *const pstate = &pstates->states[i]; /* Report frequency of turbo mode as that of HFM + 1. */ @@ -119,19 +118,14 @@ static int gen_pstate_entries(const sst_table_t *const pstates, frequency = (SPEEDSTEP_DOUBLE_RATIO(*pstate)*fsb3)/12; else frequency = (SPEEDSTEP_DOUBLE_RATIO(*pstate)*fsb3)/6; - len_ps += acpigen_write_PSS_package( + acpigen_write_PSS_package( frequency, pstate->power, 0, 0, SPEEDSTEP_ENCODE_STATE(*pstate), SPEEDSTEP_ENCODE_STATE(*pstate)); } - len_ps--; - acpigen_patch_len(len_ps); + acpigen_pop_len(); - len += acpigen_write_PPC(0); - - len += len_ps; - - return len; + acpigen_write_PPC(0); } /** @@ -139,7 +133,6 @@ static int gen_pstate_entries(const sst_table_t *const pstates, */ void generate_cpu_entries(void) { - int len_pr; int coreID, cpuID, pcontrol_blk = PMB0_BASE, plen = 6; int totalcores = determine_total_number_of_cores(); int cores_per_package = (cpuid_ebx(1)>>16) & 0xff; @@ -171,21 +164,20 @@ void generate_cpu_entries(void) } /* Generate processor \_PR.CPUx. */ - len_pr = acpigen_write_processor( + acpigen_write_processor( cpuID * cores_per_package + coreID - 1, pcontrol_blk, plen); /* Generate p-state entries. */ - len_pr += gen_pstate_entries(&pstates, cpuID, + gen_pstate_entries(&pstates, cpuID, cores_per_package, coordination); /* Generate c-state entries. */ if (num_cstates > 0) - len_pr += acpigen_write_CST_package( + acpigen_write_CST_package( cstates, num_cstates); - len_pr--; - acpigen_patch_len(len_pr); + acpigen_pop_len(); } } } diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c index 0e3a4f6..1e16eb2 100644 --- a/src/southbridge/intel/bd82x6x/lpc.c +++ b/src/southbridge/intel/bd82x6x/lpc.c @@ -680,8 +680,6 @@ static void southbridge_inject_dsdt(void) opregion = igd_make_opregion(); if (gnvs) { - int scopelen; - memset(gnvs, 0, sizeof (*gnvs)); acpi_create_gnvs(gnvs); @@ -700,9 +698,9 @@ static void southbridge_inject_dsdt(void) smm_setup_structures(gnvs, NULL, NULL); /* Add it to DSDT. */ - scopelen = acpigen_write_scope("\\"); - scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_patch_len(scopelen - 1); + acpigen_write_scope("\\"); + acpigen_write_name_dword("NVSA", (u32) gnvs); + acpigen_pop_len(); } } diff --git a/src/southbridge/intel/fsp_bd82x6x/lpc.c b/src/southbridge/intel/fsp_bd82x6x/lpc.c index e5d63b6..d149824 100644 --- a/src/southbridge/intel/fsp_bd82x6x/lpc.c +++ b/src/southbridge/intel/fsp_bd82x6x/lpc.c @@ -639,8 +639,6 @@ static void southbridge_inject_dsdt(void) opregion = igd_make_opregion(); if (gnvs) { - int scopelen; - memset(gnvs, 0, sizeof (*gnvs)); acpi_create_gnvs(gnvs); @@ -650,9 +648,9 @@ static void southbridge_inject_dsdt(void) smm_setup_structures(gnvs, NULL, NULL); /* Add it to DSDT. */ - scopelen = acpigen_write_scope("\\"); - scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_patch_len(scopelen - 1); + acpigen_write_scope("\\"); + acpigen_write_name_dword("NVSA", (u32) gnvs); + acpigen_pop_len(); } } diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c index a833a3d..b08cb89 100644 --- a/src/southbridge/intel/ibexpeak/lpc.c +++ b/src/southbridge/intel/ibexpeak/lpc.c @@ -674,8 +674,6 @@ static void southbridge_inject_dsdt(void) opregion = igd_make_opregion(); if (gnvs) { - int scopelen; - memset(gnvs, 0, sizeof (*gnvs)); acpi_create_gnvs(gnvs); @@ -685,9 +683,9 @@ static void southbridge_inject_dsdt(void) smm_setup_structures(gnvs, NULL, NULL); /* Add it to SSDT. */ - scopelen = acpigen_write_scope("\\"); - scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_patch_len(scopelen - 1); + acpigen_write_scope("\\"); + acpigen_write_name_dword("NVSA", (u32) gnvs); + acpigen_pop_len(); } }
1
0
0
0
Patch set updated for coreboot: 88e7568 haswell: Move to implicit length patching
by Vladimir Serbinenko
05 Nov '14
05 Nov '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/7327
-gerrit commit 88e7568bbe958bb0dae982b873c4fce579459c73 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Tue Nov 4 21:10:59 2014 +0100 haswell: Move to implicit length patching Change-Id: I662ba2a08f9a176a84b8318c8004aa5db7239567 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/cpu/intel/haswell/acpi.c | 112 +++++++++++++++------------------- src/southbridge/intel/lynxpoint/lpc.c | 8 +-- 2 files changed, 52 insertions(+), 68 deletions(-) diff --git a/src/cpu/intel/haswell/acpi.c b/src/cpu/intel/haswell/acpi.c index 544436f..6323d27 100644 --- a/src/cpu/intel/haswell/acpi.c +++ b/src/cpu/intel/haswell/acpi.c @@ -50,10 +50,10 @@ static int get_cores_per_package(void) return cores; } -static int generate_cstate_entries(acpi_cstate_t *cstates, +static void generate_cstate_entries(acpi_cstate_t *cstates, int c1, int c2, int c3) { - int length, cstate_count = 0; + int cstate_count = 0; /* Count number of active C-states */ if (c1 > 0) @@ -63,74 +63,70 @@ static int generate_cstate_entries(acpi_cstate_t *cstates, if (c3 > 0) ++cstate_count; if (!cstate_count) - return 0; + return; - length = acpigen_write_package(cstate_count + 1); - length += acpigen_write_byte(cstate_count); + acpigen_write_package(cstate_count + 1); + acpigen_write_byte(cstate_count); /* Add an entry if the level is enabled */ if (c1 > 0) { cstates[c1].ctype = 1; - length += acpigen_write_CST_package_entry(&cstates[c1]); + acpigen_write_CST_package_entry(&cstates[c1]); } if (c2 > 0) { cstates[c2].ctype = 2; - length += acpigen_write_CST_package_entry(&cstates[c2]); + acpigen_write_CST_package_entry(&cstates[c2]); } if (c3 > 0) { cstates[c3].ctype = 3; - length += acpigen_write_CST_package_entry(&cstates[c3]); + acpigen_write_CST_package_entry(&cstates[c3]); } - acpigen_patch_len(length - 1); - return length; + acpigen_pop_len(); } -static int generate_C_state_entries(void) +static void generate_C_state_entries(void) { struct cpu_info *info; struct cpu_driver *cpu; - int len, lenif; struct device *lapic; struct cpu_intel_haswell_config *conf = NULL; /* Find the SpeedStep CPU in the device tree using magic APIC ID */ lapic = dev_find_lapic(SPEEDSTEP_APIC_MAGIC); if (!lapic) - return 0; + return; conf = lapic->chip_info; if (!conf) - return 0; + return; /* Find CPU map of supported C-states */ info = cpu_info(); if (!info) - return 0; + return; cpu = find_cpu_driver(info->cpu); if (!cpu || !cpu->cstates) - return 0; + return; - len = acpigen_emit_byte(0x14); /* MethodOp */ - len += acpigen_write_len_f(); /* PkgLength */ - len += acpigen_emit_namestring("_CST"); - len += acpigen_emit_byte(0x00); /* No Arguments */ + acpigen_emit_byte(0x14); /* MethodOp */ + acpigen_write_len_f(); /* PkgLength */ + acpigen_emit_namestring("_CST"); + acpigen_emit_byte(0x00); /* No Arguments */ /* If running on AC power */ - len += acpigen_emit_byte(0xa0); /* IfOp */ - lenif = acpigen_write_len_f(); /* PkgLength */ - lenif += acpigen_emit_namestring("PWRS"); - lenif += acpigen_emit_byte(0xa4); /* ReturnOp */ - lenif += generate_cstate_entries(cpu->cstates, conf->c1_acpower, + acpigen_emit_byte(0xa0); /* IfOp */ + acpigen_write_len_f(); /* PkgLength */ + acpigen_emit_namestring("PWRS"); + acpigen_emit_byte(0xa4); /* ReturnOp */ + generate_cstate_entries(cpu->cstates, conf->c1_acpower, conf->c2_acpower, conf->c3_acpower); - acpigen_patch_len(lenif - 1); - len += lenif; + acpigen_pop_len(); /* Else on battery power */ - len += acpigen_emit_byte(0xa4); /* ReturnOp */ - len += generate_cstate_entries(cpu->cstates, conf->c1_battery, + acpigen_emit_byte(0xa4); /* ReturnOp */ + generate_cstate_entries(cpu->cstates, conf->c1_battery, conf->c2_battery, conf->c3_battery); - acpigen_patch_len(len - 1); - return len; + acpigen_pop_len(); } static acpi_tstate_t tss_table_fine[] = { @@ -162,31 +158,27 @@ static acpi_tstate_t tss_table_coarse[] = { { 13, 125, 0, 0x19, 0 }, }; -static int generate_T_state_entries(int core, int cores_per_package) +static void generate_T_state_entries(int core, int cores_per_package) { - int len; - /* Indicate SW_ALL coordination for T-states */ - len = acpigen_write_TSD_package(core, cores_per_package, SW_ALL); + acpigen_write_TSD_package(core, cores_per_package, SW_ALL); /* Indicate FFixedHW so OS will use MSR */ - len += acpigen_write_empty_PTC(); + acpigen_write_empty_PTC(); /* Set a T-state limit that can be modified in NVS */ - len += acpigen_write_TPC("\\TLVL"); + acpigen_write_TPC("\\TLVL"); /* * CPUID.(EAX=6):EAX[5] indicates support * for extended throttle levels. */ if (cpuid_eax(6) & (1 << 5)) - len += acpigen_write_TSS_package( + acpigen_write_TSS_package( ARRAY_SIZE(tss_table_fine), tss_table_fine); else - len += acpigen_write_TSS_package( + acpigen_write_TSS_package( ARRAY_SIZE(tss_table_coarse), tss_table_coarse); - - return len; } static int calculate_power(int tdp, int p1_ratio, int ratio) @@ -210,9 +202,8 @@ static int calculate_power(int tdp, int p1_ratio, int ratio) return (int)power; } -static int generate_P_state_entries(int core, int cores_per_package) +static void generate_P_state_entries(int core, int cores_per_package) { - int len, len_pss; int ratio_min, ratio_max, ratio_turbo, ratio_step; int coord_type, power_max, power_unit, num_entries; int ratio, power, clock, clock_max; @@ -247,16 +238,16 @@ static int generate_P_state_entries(int core, int cores_per_package) power_max = ((msr.lo & 0x7fff) / power_unit) * 1000; /* Write _PCT indicating use of FFixedHW */ - len = acpigen_write_empty_PCT(); + acpigen_write_empty_PCT(); /* Write _PPC with no limit on supported P-state */ - len += acpigen_write_PPC_NVS(); + acpigen_write_PPC_NVS(); /* Write PSD indicating configured coordination type */ - len += acpigen_write_PSD_package(core, 1, coord_type); + acpigen_write_PSD_package(core, 1, coord_type); /* Add P-state entries in _PSS table */ - len += acpigen_write_name("_PSS"); + acpigen_write_name("_PSS"); /* Determine ratio points */ ratio_step = PSS_RATIO_STEP; @@ -269,13 +260,13 @@ static int generate_P_state_entries(int core, int cores_per_package) /* P[T] is Turbo state if enabled */ if (get_turbo_state() == TURBO_ENABLED) { /* _PSS package count including Turbo */ - len_pss = acpigen_write_package(num_entries + 2); + acpigen_write_package(num_entries + 2); msr = rdmsr(MSR_TURBO_RATIO_LIMIT); ratio_turbo = msr.lo & 0xff; /* Add entry for Turbo ratio */ - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock_max + 1, /*MHz*/ power_max, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -284,11 +275,11 @@ static int generate_P_state_entries(int core, int cores_per_package) ratio_turbo << 8); /*status*/ } else { /* _PSS package count without Turbo */ - len_pss = acpigen_write_package(num_entries + 1); + acpigen_write_package(num_entries + 1); } /* First regular entry is max non-turbo ratio */ - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock_max, /*MHz*/ power_max, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -304,7 +295,7 @@ static int generate_P_state_entries(int core, int cores_per_package) power = calculate_power(power_max, ratio_max, ratio); clock = ratio * HASWELL_BCLK; - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock, /*MHz*/ power, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -314,15 +305,11 @@ static int generate_P_state_entries(int core, int cores_per_package) } /* Fix package length */ - len_pss--; - acpigen_patch_len(len_pss); - - return len + len_pss; + acpigen_pop_len(); } void generate_cpu_entries(void) { - int len_pr; int coreID, cpuID, pcontrol_blk = get_pmbase(), plen = 6; int totalcores = dev_count_cpu(); int cores_per_package = get_cores_per_package(); @@ -339,23 +326,22 @@ void generate_cpu_entries(void) } /* Generate processor \_PR.CPUx */ - len_pr = acpigen_write_processor( + acpigen_write_processor( (cpuID-1)*cores_per_package+coreID-1, pcontrol_blk, plen); /* Generate P-state tables */ - len_pr += generate_P_state_entries( + generate_P_state_entries( coreID-1, cores_per_package); /* Generate C-state tables */ - len_pr += generate_C_state_entries(); + generate_C_state_entries(); /* Generate T-state tables */ - len_pr += generate_T_state_entries( + generate_T_state_entries( cpuID-1, cores_per_package); - len_pr--; - acpigen_patch_len(len_pr); + acpigen_pop_len(); } } } diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c index a202424..563cb0a 100644 --- a/src/southbridge/intel/lynxpoint/lpc.c +++ b/src/southbridge/intel/lynxpoint/lpc.c @@ -755,8 +755,6 @@ static void southbridge_inject_dsdt(void) } if (gnvs) { - int scopelen; - acpi_create_gnvs(gnvs); gnvs->apic = 1; @@ -775,9 +773,9 @@ static void southbridge_inject_dsdt(void) smm_setup_structures(gnvs, NULL, NULL); /* Add it to DSDT. */ - scopelen = acpigen_write_scope("\\"); - scopelen += acpigen_write_name_dword("NVSA", (u32) gnvs); - acpigen_patch_len(scopelen - 1); + acpigen_write_scope("\\"); + acpigen_write_name_dword("NVSA", (u32) gnvs); + acpigen_pop_len(); } }
1
0
0
0
Patch set updated for coreboot: ccffd26 fsp_rangeley: Switch to per-device ACPI
by Vladimir Serbinenko
05 Nov '14
05 Nov '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/7046
-gerrit commit ccffd262aa26222933db85009993b96b4adcf44a Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sat Oct 11 11:25:41 2014 +0200 fsp_rangeley: Switch to per-device ACPI Change-Id: Ic8b2204a6d08d63ac7f05836bf1424f1ca6ee50e Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/cpu/intel/fsp_model_406dx/acpi.c | 79 ++++----- src/mainboard/intel/mohonpeak/acpi_tables.c | 177 +-------------------- src/northbridge/intel/fsp_rangeley/Kconfig | 1 + src/northbridge/intel/fsp_rangeley/acpi.c | 14 ++ src/northbridge/intel/fsp_rangeley/northbridge.c | 13 ++ src/northbridge/intel/fsp_rangeley/northbridge.h | 1 + .../intel/fsp_rangeley/acpi/globalnvs.asl | 3 +- src/southbridge/intel/fsp_rangeley/lpc.c | 27 ++++ src/southbridge/intel/fsp_rangeley/nvs.h | 1 + 9 files changed, 93 insertions(+), 223 deletions(-) diff --git a/src/cpu/intel/fsp_model_406dx/acpi.c b/src/cpu/intel/fsp_model_406dx/acpi.c index 24f63cd..774bcb2 100644 --- a/src/cpu/intel/fsp_model_406dx/acpi.c +++ b/src/cpu/intel/fsp_model_406dx/acpi.c @@ -50,11 +50,10 @@ static int get_cores_per_package(void) return cores; } -static int generate_C_state_entries(void) +static void generate_C_state_entries(void) { struct cpu_info *info; struct cpu_driver *cpu; - int len, lenif; struct device *lapic; struct cpu_intel_model_406dx_config *conf = NULL; @@ -74,23 +73,21 @@ static int generate_C_state_entries(void) if (!cpu || !cpu->cstates) return 0; - len = acpigen_emit_byte(0x14); /* MethodOp */ - len += acpigen_write_len_f(); /* PkgLength */ - len += acpigen_emit_namestring("_CST"); - len += acpigen_emit_byte(0x00); /* No Arguments */ + acpigen_emit_byte(0x14); /* MethodOp */ + acpigen_write_len_f(); /* PkgLength */ + acpigen_emit_namestring("_CST"); + acpigen_emit_byte(0x00); /* No Arguments */ /* If running on AC power */ - len += acpigen_emit_byte(0xa0); /* IfOp */ - lenif = acpigen_write_len_f(); /* PkgLength */ - lenif += acpigen_emit_namestring("PWRS"); - lenif += acpigen_emit_byte(0xa4); /* ReturnOp */ - acpigen_patch_len(lenif - 1); - len += lenif; + acpigen_emit_byte(0xa0); /* IfOp */ + acpigen_write_len_f(); /* PkgLength */ + acpigen_emit_namestring("PWRS"); + acpigen_emit_byte(0xa4); /* ReturnOp */ + acpigen_pop_len(); /* Else on battery power */ - len += acpigen_emit_byte(0xa4); /* ReturnOp */ - acpigen_patch_len(len - 1); - return len; + acpigen_emit_byte(0xa4); /* ReturnOp */ + acpigen_pop_len(); } static acpi_tstate_t tss_table_fine[] = { @@ -122,31 +119,27 @@ static acpi_tstate_t tss_table_coarse[] = { { 13, 125, 0, 0x19, 0 }, }; -static int generate_T_state_entries(int core, int cores_per_package) +static void generate_T_state_entries(int core, int cores_per_package) { - int len; - /* Indicate SW_ALL coordination for T-states */ - len = acpigen_write_TSD_package(core, cores_per_package, SW_ALL); + acpigen_write_TSD_package(core, cores_per_package, SW_ALL); /* Indicate FFixedHW so OS will use MSR */ - len += acpigen_write_empty_PTC(); + acpigen_write_empty_PTC(); /* Set a T-state limit that can be modified in NVS */ - len += acpigen_write_TPC("\\TLVL"); + acpigen_write_TPC("\\TLVL"); /* * CPUID.(EAX=6):EAX[5] indicates support * for extended throttle levels. */ if (cpuid_eax(6) & (1 << 5)) - len += acpigen_write_TSS_package( + acpigen_write_TSS_package( ARRAY_SIZE(tss_table_fine), tss_table_fine); else - len += acpigen_write_TSS_package( + acpigen_write_TSS_package( ARRAY_SIZE(tss_table_coarse), tss_table_coarse); - - return len; } static int calculate_power(int tdp, int p1_ratio, int ratio) @@ -172,7 +165,6 @@ static int calculate_power(int tdp, int p1_ratio, int ratio) static int generate_P_state_entries(int core, int cores_per_package) { - int len, len_pss; int ratio_min, ratio_max, ratio_turbo, ratio_step; int coord_type, power_max, num_entries; int ratio, power, clock, clock_max; @@ -202,16 +194,16 @@ static int generate_P_state_entries(int core, int cores_per_package) /* Write _PCT indicating use of FFixedHW */ - len = acpigen_write_empty_PCT(); + acpigen_write_empty_PCT(); /* Write _PPC with no limit on supported P-state */ - len += acpigen_write_PPC_NVS(); + acpigen_write_PPC_NVS(); /* Write PSD indicating configured coordination type */ - len += acpigen_write_PSD_package(core, cores_per_package, coord_type); + acpigen_write_PSD_package(core, cores_per_package, coord_type); /* Add P-state entries in _PSS table */ - len += acpigen_write_name("_PSS"); + acpigen_write_name("_PSS"); /* Determine ratio points */ ratio_step = PSS_RATIO_STEP; @@ -224,13 +216,13 @@ static int generate_P_state_entries(int core, int cores_per_package) /* P[T] is Turbo state if enabled */ if (get_turbo_state() == TURBO_ENABLED) { /* _PSS package count including Turbo */ - len_pss = acpigen_write_package(num_entries + 2); + acpigen_write_package(num_entries + 2); msr = rdmsr(MSR_TURBO_RATIO_LIMIT); ratio_turbo = msr.lo & 0xff; /* Add entry for Turbo ratio */ - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock_max + 1, /*MHz*/ power_max, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -239,11 +231,11 @@ static int generate_P_state_entries(int core, int cores_per_package) ratio_turbo << 8); /*status*/ } else { /* _PSS package count without Turbo */ - len_pss = acpigen_write_package(num_entries + 1); + acpigen_write_package(num_entries + 1); } /* First regular entry is max non-turbo ratio */ - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock_max, /*MHz*/ power_max, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -259,7 +251,7 @@ static int generate_P_state_entries(int core, int cores_per_package) power = calculate_power(power_max, ratio_max, ratio); clock = ratio * RANGELEY_BCLK; - len_pss += acpigen_write_PSS_package( + acpigen_write_PSS_package( clock, /*MHz*/ power, /*mW*/ PSS_LATENCY_TRANSITION, /*lat1*/ @@ -269,15 +261,11 @@ static int generate_P_state_entries(int core, int cores_per_package) } /* Fix package length */ - len_pss--; - acpigen_patch_len(len_pss); - - return len + len_pss; + acpigen_pop_len(); } void generate_cpu_entries(void) { - int len_pr; int coreID, cpuID, pcontrol_blk = PMB0_BASE, plen = 6; int totalcores = dev_count_cpu(); int cores_per_package = get_cores_per_package(); @@ -294,23 +282,22 @@ void generate_cpu_entries(void) } /* Generate processor \_PR.CPUx */ - len_pr = acpigen_write_processor( + acpigen_write_processor( (cpuID-1)*cores_per_package+coreID-1, pcontrol_blk, plen); /* Generate P-state tables */ - len_pr += generate_P_state_entries( + generate_P_state_entries( cpuID-1, cores_per_package); /* Generate C-state tables */ - len_pr += generate_C_state_entries(); + generate_C_state_entries(); /* Generate T-state tables */ - len_pr += generate_T_state_entries( + generate_T_state_entries( cpuID-1, cores_per_package); - len_pr--; - acpigen_patch_len(len_pr); + acpigen_pop_len(); } } } diff --git a/src/mainboard/intel/mohonpeak/acpi_tables.c b/src/mainboard/intel/mohonpeak/acpi_tables.c index 0349075..b49da65 100644 --- a/src/mainboard/intel/mohonpeak/acpi_tables.c +++ b/src/mainboard/intel/mohonpeak/acpi_tables.c @@ -33,14 +33,9 @@ #include <southbridge/intel/fsp_rangeley/nvs.h> #include <northbridge/intel/fsp_rangeley/northbridge.h> -extern const unsigned char AmlCode[]; -#if CONFIG_HAVE_ACPI_SLIC -unsigned long acpi_create_slic(unsigned long current); -#endif - static global_nvs_t *gnvs_; -static void acpi_create_gnvs(global_nvs_t *gnvs) +void acpi_create_gnvs(global_nvs_t *gnvs) { gnvs_ = gnvs; memset((void *)gnvs, 0, sizeof(*gnvs)); @@ -89,173 +84,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_ssdt_generator(unsigned long current, - const char *oem_table_id) -{ - u32 lens, bmbound; - char pscope[] = "\\_SB.PCI0"; - - bmbound = sideband_read(B_UNIT, BMBOUND); - lens = acpigen_write_scope(pscope); - lens += acpigen_write_name_dword("BMBD", bmbound); - generate_cpu_entries(); - acpigen_patch_len(lens - 1); - return (unsigned long) (acpigen_get_current()); -} - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} - -void smm_setup_structures(void *gnvs, void *tcg, void *smi1); - -#define ALIGN_CURRENT current = (ALIGN(current, 16)) -unsigned long write_acpi_tables(unsigned long start) -{ - unsigned long current; - int i; - acpi_rsdp_t *rsdp; - acpi_rsdt_t *rsdt; - acpi_xsdt_t *xsdt; - acpi_hpet_t *hpet; - acpi_madt_t *madt; - acpi_mcfg_t *mcfg; - acpi_fadt_t *fadt; - acpi_facs_t *facs; -#if CONFIG_HAVE_ACPI_SLIC - acpi_header_t *slic; -#endif - acpi_header_t *ssdt; - acpi_header_t *dsdt; - - current = start; - - /* Align ACPI tables to 16byte */ - ALIGN_CURRENT; - - printk(BIOS_INFO, "ACPI: Writing ACPI tables at %lx.\n", start); - - /* We need at least an RSDP and an RSDT Table */ - rsdp = (acpi_rsdp_t *) current; - current += sizeof(acpi_rsdp_t); - ALIGN_CURRENT; - rsdt = (acpi_rsdt_t *) current; - current += sizeof(acpi_rsdt_t); - ALIGN_CURRENT; - xsdt = (acpi_xsdt_t *) current; - current += sizeof(acpi_xsdt_t); - ALIGN_CURRENT; - - /* clear all table memory */ - memset((void *) start, 0, current - start); - - acpi_write_rsdp(rsdp, rsdt, xsdt); - acpi_write_rsdt(rsdt); - acpi_write_xsdt(xsdt); - - printk(BIOS_DEBUG, "ACPI: * FACS\n"); - facs = (acpi_facs_t *) current; - current += sizeof(acpi_facs_t); - ALIGN_CURRENT; - acpi_create_facs(facs); - - printk(BIOS_DEBUG, "ACPI: * DSDT\n"); - dsdt = (acpi_header_t *) current; - memcpy(dsdt, &AmlCode, sizeof(acpi_header_t)); - current += dsdt->length; - memcpy(dsdt, &AmlCode, dsdt->length); - - ALIGN_CURRENT; - - printk(BIOS_DEBUG, "ACPI: * FADT\n"); - fadt = (acpi_fadt_t *) current; - current += sizeof(acpi_fadt_t); - ALIGN_CURRENT; - - acpi_create_fadt(fadt, facs, dsdt); - acpi_add_table(rsdp, fadt); - - /* - * We explicitly add these tables later on: - */ - printk(BIOS_DEBUG, "ACPI: * HPET\n"); - - hpet = (acpi_hpet_t *) current; - current += sizeof(acpi_hpet_t); - ALIGN_CURRENT; - acpi_create_hpet(hpet); - acpi_add_table(rsdp, hpet); - - /* If we want to use HPET Timers Linux wants an MADT */ - printk(BIOS_DEBUG, "ACPI: * MADT\n"); - - madt = (acpi_madt_t *) current; - acpi_create_madt(madt); - current += madt->header.length; - ALIGN_CURRENT; - acpi_add_table(rsdp, madt); - - printk(BIOS_DEBUG, "ACPI: * MCFG\n"); - mcfg = (acpi_mcfg_t *) current; - acpi_create_mcfg(mcfg); - current += mcfg->header.length; - ALIGN_CURRENT; - acpi_add_table(rsdp, mcfg); - - /* Pack GNVS into the ACPI table area */ - for (i=0; i < dsdt->length; i++) { - if (*(u32*)(((u32)dsdt) + i) == 0xC0DEBABE) { - printk(BIOS_DEBUG, "ACPI: Patching up global NVS in " - "DSDT at offset 0x%04x -> 0x%08lx\n", i, current); - *(u32*)(((u32)dsdt) + i) = current; // 0x92 bytes - acpi_save_gnvs(current); - break; - } - } - - /* And fill it */ - acpi_create_gnvs((global_nvs_t *)current); - - /* And tell SMI about it */ -#if CONFIG_HAVE_SMI_HANDLER - smm_setup_structures((void *)current, NULL, NULL); -#endif - - current += sizeof(global_nvs_t); - ALIGN_CURRENT; - - /* We patched up the DSDT, so we need to recalculate the checksum */ - dsdt->checksum = 0; - dsdt->checksum = acpi_checksum((void *)dsdt, dsdt->length); - - printk(BIOS_DEBUG, "ACPI: * DSDT @ %p Length %x\n", dsdt, - dsdt->length); - -#if CONFIG_HAVE_ACPI_SLIC - printk(BIOS_DEBUG, "ACPI: * SLIC\n"); - slic = (acpi_header_t *)current; - current += acpi_create_slic(current); - ALIGN_CURRENT; - acpi_add_table(rsdp, slic); -#endif - - printk(BIOS_DEBUG, "ACPI: * SSDT\n"); - ssdt = (acpi_header_t *)current; - acpi_create_ssdt_generator(ssdt, ACPI_TABLE_CREATOR); - current += ssdt->length; - acpi_add_table(rsdp, ssdt); - ALIGN_CURRENT; - - printk(BIOS_DEBUG, "current = %lx\n", current); - printk(BIOS_INFO, "ACPI: done.\n"); - return current; -} diff --git a/src/northbridge/intel/fsp_rangeley/Kconfig b/src/northbridge/intel/fsp_rangeley/Kconfig index c1353ca..2d2eda7 100644 --- a/src/northbridge/intel/fsp_rangeley/Kconfig +++ b/src/northbridge/intel/fsp_rangeley/Kconfig @@ -21,6 +21,7 @@ config NORTHBRIDGE_INTEL_FSP_RANGELEY bool select CPU_INTEL_FSP_MODEL_406DX + select PER_DEVICE_ACPI_TABLES if NORTHBRIDGE_INTEL_FSP_RANGELEY diff --git a/src/northbridge/intel/fsp_rangeley/acpi.c b/src/northbridge/intel/fsp_rangeley/acpi.c index 895f5b4..b2ddc88 100644 --- a/src/northbridge/intel/fsp_rangeley/acpi.c +++ b/src/northbridge/intel/fsp_rangeley/acpi.c @@ -30,6 +30,8 @@ #include <device/pci.h> #include <device/pci_ids.h> #include <build.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> #include "northbridge.h" unsigned long acpi_fill_mcfg(unsigned long current) @@ -64,3 +66,15 @@ unsigned long acpi_fill_mcfg(unsigned long current) return current; } + +void northbridge_acpi_fill_ssdt_generator(void) +{ + u32 bmbound; + char pscope[] = "\\_SB.PCI0"; + + bmbound = sideband_read(B_UNIT, BMBOUND); + acpigen_write_scope(pscope); + acpigen_write_name_dword("BMBD", bmbound); + acpigen_pop_len(); + generate_cpu_entries(); +} diff --git a/src/northbridge/intel/fsp_rangeley/northbridge.c b/src/northbridge/intel/fsp_rangeley/northbridge.c index 07ce21f..be3a3ac 100644 --- a/src/northbridge/intel/fsp_rangeley/northbridge.c +++ b/src/northbridge/intel/fsp_rangeley/northbridge.c @@ -212,6 +212,18 @@ static void northbridge_enable(device_t dev) { } +unsigned long acpi_fill_slit(unsigned long current) +{ + // Not implemented + return current; +} + +unsigned long acpi_fill_srat(unsigned long current) +{ + /* No NUMA, no SRAT */ + return current; +} + static struct pci_operations intel_pci_ops = { .set_subsystem = intel_set_subsystem, }; @@ -231,6 +243,7 @@ static struct device_operations mc_ops = { .set_resources = mc_set_resources, .enable_resources = pci_dev_enable_resources, .init = northbridge_init, + .acpi_fill_ssdt_generator = northbridge_acpi_fill_ssdt_generator, .enable = northbridge_enable, .scan_bus = 0, .ops_pci = &intel_pci_ops, diff --git a/src/northbridge/intel/fsp_rangeley/northbridge.h b/src/northbridge/intel/fsp_rangeley/northbridge.h index 855a056..abce07a 100644 --- a/src/northbridge/intel/fsp_rangeley/northbridge.h +++ b/src/northbridge/intel/fsp_rangeley/northbridge.h @@ -72,6 +72,7 @@ void dump_pci_devices(void); void dump_spd_registers(void); void dump_mem(unsigned start, unsigned end); void report_platform_info(void); +void northbridge_acpi_fill_ssdt_generator(void); #endif /* #ifndef __ASSEMBLER__ */ #endif /* #ifndef __ACPI__ */ diff --git a/src/southbridge/intel/fsp_rangeley/acpi/globalnvs.asl b/src/southbridge/intel/fsp_rangeley/acpi/globalnvs.asl index 21209db..c5c1a9a 100644 --- a/src/southbridge/intel/fsp_rangeley/acpi/globalnvs.asl +++ b/src/southbridge/intel/fsp_rangeley/acpi/globalnvs.asl @@ -32,7 +32,8 @@ Name(\DSEN, 1) // Display Output Switching Enable */ -OperationRegion (GNVS, SystemMemory, 0xC0DEBABE, 0xf00) +External(NVSA) +OperationRegion (GNVS, SystemMemory, NVSA, 0xf00) Field (GNVS, ByteAcc, NoLock, Preserve) { /* Miscellaneous */ diff --git a/src/southbridge/intel/fsp_rangeley/lpc.c b/src/southbridge/intel/fsp_rangeley/lpc.c index 8576b61..9644067 100644 --- a/src/southbridge/intel/fsp_rangeley/lpc.c +++ b/src/southbridge/intel/fsp_rangeley/lpc.c @@ -31,8 +31,13 @@ #include <arch/acpi.h> #include <cpu/cpu.h> #include <elog.h> +#include <string.h> +#include <cbmem.h> +#include <arch/acpi.h> +#include <arch/acpigen.h> #include "soc.h" #include "irq.h" +#include "nvs.h" #define NMI_OFF 0 @@ -426,6 +431,26 @@ static void set_subsystem(device_t dev, unsigned vendor, unsigned device) } } +static void southbridge_inject_dsdt(void) +{ + global_nvs_t *gnvs = cbmem_add (CBMEM_ID_ACPI_GNVS, sizeof (*gnvs)); + + if (gnvs) { + memset(gnvs, 0, sizeof(*gnvs)); + acpi_create_gnvs(gnvs); + acpi_save_gnvs((unsigned long)gnvs); +#if CONFIG_HAVE_SMI_HANDLER + /* And tell SMI about it */ + smm_setup_structures(gnvs, NULL, NULL); +#endif + + /* Add it to DSDT. */ + acpigen_write_scope("\\"); + acpigen_write_name_dword("NVSA", (u32) gnvs); + acpigen_pop_len(); + } +} + static struct pci_operations pci_ops = { .set_subsystem = set_subsystem, }; @@ -435,6 +460,8 @@ static struct device_operations device_ops = { .set_resources = pci_dev_set_resources, .enable_resources = soc_lpc_enable_resources, .init = lpc_init, + .write_acpi_tables = acpi_write_hpet, + .acpi_inject_dsdt_generator = southbridge_inject_dsdt, .enable = soc_lpc_enable, .scan_bus = scan_static_bus, .ops_pci = &pci_ops, diff --git a/src/southbridge/intel/fsp_rangeley/nvs.h b/src/southbridge/intel/fsp_rangeley/nvs.h index dce23e0..6578bbf 100644 --- a/src/southbridge/intel/fsp_rangeley/nvs.h +++ b/src/southbridge/intel/fsp_rangeley/nvs.h @@ -149,6 +149,7 @@ typedef struct { } __attribute__((packed)) global_nvs_t; +void acpi_create_gnvs(global_nvs_t *gnvs); #ifdef __SMM__ /* Used in SMM to find the ACPI GNVS address */ global_nvs_t *smm_get_gnvs(void);
1
0
0
0
Patch set updated for coreboot: 4e5826a acpi: make fill_slit and fill_srat into arguments.
by Vladimir Serbinenko
05 Nov '14
05 Nov '14
Vladimir Serbinenko (phcoder(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/7052
-gerrit commit 4e5826a10b233dfcb5dd0879fd82a594a43ecde7 Author: Vladimir Serbinenko <phcoder(a)gmail.com> Date: Sat Oct 11 23:45:40 2014 +0200 acpi: make fill_slit and fill_srat into arguments. SLIT and SRAT are created this way only on amdk8 and amdfam10. This saves the need of having a lot of dummies. Change-Id: I76d042702209cd6d11ee78ac22cf9fe9d30d0ca5 Signed-off-by: Vladimir Serbinenko <phcoder(a)gmail.com> --- src/arch/x86/boot/acpi.c | 6 ++-- src/arch/x86/include/arch/acpi.h | 8 ++--- src/mainboard/aopen/dxplplusu/acpi_tables.c | 12 -------- src/mainboard/apple/macbook21/acpi_tables.c | 12 -------- src/mainboard/emulation/qemu-i440fx/acpi_tables.c | 12 -------- src/mainboard/emulation/qemu-q35/acpi_tables.c | 12 -------- src/mainboard/getac/p470/acpi_tables.c | 12 -------- src/mainboard/google/bolt/acpi_tables.c | 12 -------- src/mainboard/google/butterfly/acpi_tables.c | 12 -------- src/mainboard/google/falco/acpi_tables.c | 12 -------- src/mainboard/google/link/acpi_tables.c | 12 -------- src/mainboard/google/panther/acpi_tables.c | 12 -------- src/mainboard/google/parrot/acpi_tables.c | 12 -------- src/mainboard/google/peppy/acpi_tables.c | 12 -------- src/mainboard/google/samus/acpi_tables.c | 12 -------- src/mainboard/google/slippy/acpi_tables.c | 12 -------- src/mainboard/google/stout/acpi_tables.c | 12 -------- src/mainboard/ibase/mb899/acpi_tables.c | 13 --------- src/mainboard/intel/baskingridge/acpi_tables.c | 12 -------- src/mainboard/intel/cougar_canyon2/acpi_tables.c | 12 -------- src/mainboard/intel/d945gclf/acpi_tables.c | 12 -------- src/mainboard/intel/eagleheights/acpi_tables.c | 13 --------- src/mainboard/intel/emeraldlake2/acpi_tables.c | 12 -------- src/mainboard/intel/wtm2/acpi_tables.c | 12 -------- src/mainboard/intel/xe7501devkit/acpi_tables.c | 12 -------- src/mainboard/iwave/iWRainbowG6/acpi_tables.c | 12 -------- src/mainboard/kontron/986lcd-m/acpi_tables.c | 12 -------- src/mainboard/kontron/ktqm77/acpi_tables.c | 12 -------- src/mainboard/lenovo/t520/acpi_tables.c | 12 -------- src/mainboard/lenovo/t530/acpi_tables.c | 12 -------- src/mainboard/lenovo/t60/acpi_tables.c | 12 -------- src/mainboard/lenovo/x200/acpi_tables.c | 12 -------- src/mainboard/lenovo/x201/acpi_tables.c | 12 -------- src/mainboard/lenovo/x220/acpi_tables.c | 12 -------- src/mainboard/lenovo/x230/acpi_tables.c | 12 -------- src/mainboard/lenovo/x60/acpi_tables.c | 12 -------- src/mainboard/packardbell/ms2290/acpi_tables.c | 12 -------- src/mainboard/roda/rk886ex/acpi_tables.c | 12 -------- src/mainboard/roda/rk9/acpi_tables.c | 12 -------- src/mainboard/samsung/lumpy/acpi_tables.c | 12 -------- src/mainboard/samsung/stumpy/acpi_tables.c | 12 -------- src/mainboard/via/epia-m/acpi_tables.c | 12 -------- src/mainboard/via/epia-m700/acpi_tables.c | 12 -------- src/mainboard/via/epia-n/acpi_tables.c | 12 -------- src/mainboard/via/vt8454c/acpi_tables.c | 12 -------- src/northbridge/amd/agesa/00730F01/northbridge.c | 12 -------- src/northbridge/amd/agesa/family12/northbridge.c | 12 -------- src/northbridge/amd/agesa/family14/northbridge.c | 13 --------- src/northbridge/amd/agesa/family15/northbridge.c | 12 -------- src/northbridge/amd/agesa/family15tn/northbridge.c | 12 -------- src/northbridge/amd/agesa/family16kb/northbridge.c | 12 -------- src/northbridge/amd/amdfam10/acpi.c | 8 ++--- src/northbridge/amd/amdk8/acpi.c | 34 ++++++++++++++++++++-- src/northbridge/amd/amdk8/acpi.h | 1 + src/northbridge/amd/amdk8/northbridge.c | 31 -------------------- src/northbridge/intel/fsp_rangeley/northbridge.c | 12 -------- src/soc/intel/baytrail/northcluster.c | 12 -------- src/soc/intel/fsp_baytrail/northcluster.c | 12 -------- src/southbridge/intel/i82371eb/acpi_tables.c | 12 -------- 59 files changed, 45 insertions(+), 682 deletions(-) diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c index cea7679..0853ef5 100644 --- a/src/arch/x86/boot/acpi.c +++ b/src/arch/x86/boot/acpi.c @@ -324,7 +324,8 @@ int acpi_create_srat_mem(acpi_srat_mem_t *mem, u8 node, u32 basek, u32 sizek, } /*
http://www.microsoft.com/whdc/system/sysinternals/sratdwn.mspx
*/ -void acpi_create_srat(acpi_srat_t *srat) +void acpi_create_srat(acpi_srat_t *srat, + unsigned long (*acpi_fill_srat)(unsigned long current)) { acpi_header_t *header = &(srat->header); unsigned long current = (unsigned long)srat + sizeof(acpi_srat_t); @@ -415,7 +416,8 @@ unsigned long acpi_create_dmar_drhd_ds_pci(unsigned long current, u8 segment, } /*
http://h21007.www2.hp.com/portal/download/files/unprot/Itanium/slit.pdf
*/ -void acpi_create_slit(acpi_slit_t *slit) +void acpi_create_slit(acpi_slit_t *slit, + unsigned long (*acpi_fill_slit)(unsigned long current)) { acpi_header_t *header = &(slit->header); unsigned long current = (unsigned long)slit + sizeof(acpi_slit_t); diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h index 005ed7c..7fbaf7f 100644 --- a/src/arch/x86/include/arch/acpi.h +++ b/src/arch/x86/include/arch/acpi.h @@ -488,8 +488,6 @@ unsigned long fw_cfg_acpi_tables(unsigned long start); unsigned long write_acpi_tables(unsigned long addr); unsigned long acpi_fill_madt(unsigned long current); unsigned long acpi_fill_mcfg(unsigned long current); -unsigned long acpi_fill_srat(unsigned long current); -unsigned long acpi_fill_slit(unsigned long current); #if !IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) unsigned long acpi_fill_ssdt_generator(unsigned long current, const char *oem_table_id); @@ -527,9 +525,11 @@ int acpi_create_srat_mem(acpi_srat_mem_t *mem, u8 node, u32 basek,u32 sizek, int acpi_create_mcfg_mmconfig(acpi_mcfg_mmconfig_t *mmconfig, u32 base, u16 seg_nr, u8 start, u8 end); unsigned long acpi_create_srat_lapics(unsigned long current); -void acpi_create_srat(acpi_srat_t *srat); +void acpi_create_srat(acpi_srat_t *srat, + unsigned long (*acpi_fill_srat)(unsigned long current)); -void acpi_create_slit(acpi_slit_t *slit); +void acpi_create_slit(acpi_slit_t *slit, + unsigned long (*acpi_fill_slit)(unsigned long current)); void acpi_create_hpet(acpi_hpet_t *hpet); unsigned long acpi_write_hpet(unsigned long start, acpi_rsdp_t *rsdp); diff --git a/src/mainboard/aopen/dxplplusu/acpi_tables.c b/src/mainboard/aopen/dxplplusu/acpi_tables.c index 405c420..0d114b7 100644 --- a/src/mainboard/aopen/dxplplusu/acpi_tables.c +++ b/src/mainboard/aopen/dxplplusu/acpi_tables.c @@ -30,18 +30,6 @@ #include <assert.h> #include "bus.h" -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - // Not implemented - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { unsigned int irq_start = 0; diff --git a/src/mainboard/apple/macbook21/acpi_tables.c b/src/mainboard/apple/macbook21/acpi_tables.c index ada7d08..2a675c0 100644 --- a/src/mainboard/apple/macbook21/acpi_tables.c +++ b/src/mainboard/apple/macbook21/acpi_tables.c @@ -77,15 +77,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/emulation/qemu-i440fx/acpi_tables.c b/src/mainboard/emulation/qemu-i440fx/acpi_tables.c index da1a78d..11afc3a 100644 --- a/src/mainboard/emulation/qemu-i440fx/acpi_tables.c +++ b/src/mainboard/emulation/qemu-i440fx/acpi_tables.c @@ -49,15 +49,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/emulation/qemu-q35/acpi_tables.c b/src/mainboard/emulation/qemu-q35/acpi_tables.c index 2d00a0d..7201bf1 100644 --- a/src/mainboard/emulation/qemu-q35/acpi_tables.c +++ b/src/mainboard/emulation/qemu-q35/acpi_tables.c @@ -198,12 +198,6 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - unsigned long acpi_fill_mcfg(unsigned long current) { device_t dev; @@ -221,9 +215,3 @@ unsigned long acpi_fill_mcfg(unsigned long current) reg & 0xf0000000, 0x0, 0x0, 255); return current; } - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/getac/p470/acpi_tables.c b/src/mainboard/getac/p470/acpi_tables.c index 1e22eae..fd10746 100644 --- a/src/mainboard/getac/p470/acpi_tables.c +++ b/src/mainboard/getac/p470/acpi_tables.c @@ -122,18 +122,6 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} - #define ALIGN_CURRENT current = (ALIGN(current, 16)) unsigned long mainboard_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp) { diff --git a/src/mainboard/google/bolt/acpi_tables.c b/src/mainboard/google/bolt/acpi_tables.c index 3b851c4..1dea444 100644 --- a/src/mainboard/google/bolt/acpi_tables.c +++ b/src/mainboard/google/bolt/acpi_tables.c @@ -99,15 +99,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/google/butterfly/acpi_tables.c b/src/mainboard/google/butterfly/acpi_tables.c index dcaf384..8f0da6a 100644 --- a/src/mainboard/google/butterfly/acpi_tables.c +++ b/src/mainboard/google/butterfly/acpi_tables.c @@ -92,15 +92,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/google/falco/acpi_tables.c b/src/mainboard/google/falco/acpi_tables.c index 5849087..343f15e 100644 --- a/src/mainboard/google/falco/acpi_tables.c +++ b/src/mainboard/google/falco/acpi_tables.c @@ -93,15 +93,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/google/link/acpi_tables.c b/src/mainboard/google/link/acpi_tables.c index 14baad2..7d17d6f 100644 --- a/src/mainboard/google/link/acpi_tables.c +++ b/src/mainboard/google/link/acpi_tables.c @@ -100,15 +100,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/google/panther/acpi_tables.c b/src/mainboard/google/panther/acpi_tables.c index 9340c5a..a018f38 100644 --- a/src/mainboard/google/panther/acpi_tables.c +++ b/src/mainboard/google/panther/acpi_tables.c @@ -110,15 +110,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/google/parrot/acpi_tables.c b/src/mainboard/google/parrot/acpi_tables.c index e4e1797..9671943 100644 --- a/src/mainboard/google/parrot/acpi_tables.c +++ b/src/mainboard/google/parrot/acpi_tables.c @@ -91,15 +91,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/google/peppy/acpi_tables.c b/src/mainboard/google/peppy/acpi_tables.c index 265fe65..12dd698 100644 --- a/src/mainboard/google/peppy/acpi_tables.c +++ b/src/mainboard/google/peppy/acpi_tables.c @@ -102,15 +102,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/google/samus/acpi_tables.c b/src/mainboard/google/samus/acpi_tables.c index 1978494..ccfce2a 100644 --- a/src/mainboard/google/samus/acpi_tables.c +++ b/src/mainboard/google/samus/acpi_tables.c @@ -97,15 +97,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/google/slippy/acpi_tables.c b/src/mainboard/google/slippy/acpi_tables.c index 3b851c4..1dea444 100644 --- a/src/mainboard/google/slippy/acpi_tables.c +++ b/src/mainboard/google/slippy/acpi_tables.c @@ -99,15 +99,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/google/stout/acpi_tables.c b/src/mainboard/google/stout/acpi_tables.c index 504ae64..0dfdeff 100644 --- a/src/mainboard/google/stout/acpi_tables.c +++ b/src/mainboard/google/stout/acpi_tables.c @@ -97,15 +97,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/ibase/mb899/acpi_tables.c b/src/mainboard/ibase/mb899/acpi_tables.c index d7012d1..fdbbec4 100644 --- a/src/mainboard/ibase/mb899/acpi_tables.c +++ b/src/mainboard/ibase/mb899/acpi_tables.c @@ -66,16 +66,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} - diff --git a/src/mainboard/intel/baskingridge/acpi_tables.c b/src/mainboard/intel/baskingridge/acpi_tables.c index d5a5f03..ec54a20 100644 --- a/src/mainboard/intel/baskingridge/acpi_tables.c +++ b/src/mainboard/intel/baskingridge/acpi_tables.c @@ -112,15 +112,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/intel/cougar_canyon2/acpi_tables.c b/src/mainboard/intel/cougar_canyon2/acpi_tables.c index dca35b5..3ba0e96 100644 --- a/src/mainboard/intel/cougar_canyon2/acpi_tables.c +++ b/src/mainboard/intel/cougar_canyon2/acpi_tables.c @@ -91,15 +91,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/intel/d945gclf/acpi_tables.c b/src/mainboard/intel/d945gclf/acpi_tables.c index a27ea57..12822c1 100644 --- a/src/mainboard/intel/d945gclf/acpi_tables.c +++ b/src/mainboard/intel/d945gclf/acpi_tables.c @@ -55,15 +55,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/intel/eagleheights/acpi_tables.c b/src/mainboard/intel/eagleheights/acpi_tables.c index 06ef183..4d5575d 100644 --- a/src/mainboard/intel/eagleheights/acpi_tables.c +++ b/src/mainboard/intel/eagleheights/acpi_tables.c @@ -67,16 +67,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} - diff --git a/src/mainboard/intel/emeraldlake2/acpi_tables.c b/src/mainboard/intel/emeraldlake2/acpi_tables.c index 3d95586..9015085 100644 --- a/src/mainboard/intel/emeraldlake2/acpi_tables.c +++ b/src/mainboard/intel/emeraldlake2/acpi_tables.c @@ -109,15 +109,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/intel/wtm2/acpi_tables.c b/src/mainboard/intel/wtm2/acpi_tables.c index 20814ab..a9cc99a 100644 --- a/src/mainboard/intel/wtm2/acpi_tables.c +++ b/src/mainboard/intel/wtm2/acpi_tables.c @@ -109,15 +109,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/intel/xe7501devkit/acpi_tables.c b/src/mainboard/intel/xe7501devkit/acpi_tables.c index fb7da1f..1d6dc78 100644 --- a/src/mainboard/intel/xe7501devkit/acpi_tables.c +++ b/src/mainboard/intel/xe7501devkit/acpi_tables.c @@ -15,18 +15,6 @@ #include "bus.h" #include "ioapic.h" -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - // Not implemented - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { unsigned int irq_start = 0; diff --git a/src/mainboard/iwave/iWRainbowG6/acpi_tables.c b/src/mainboard/iwave/iWRainbowG6/acpi_tables.c index 4dcda79..1577dca 100644 --- a/src/mainboard/iwave/iWRainbowG6/acpi_tables.c +++ b/src/mainboard/iwave/iWRainbowG6/acpi_tables.c @@ -69,15 +69,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - /* Not implemented. */ - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/kontron/986lcd-m/acpi_tables.c b/src/mainboard/kontron/986lcd-m/acpi_tables.c index 0560f8a..fdbbec4 100644 --- a/src/mainboard/kontron/986lcd-m/acpi_tables.c +++ b/src/mainboard/kontron/986lcd-m/acpi_tables.c @@ -66,15 +66,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/kontron/ktqm77/acpi_tables.c b/src/mainboard/kontron/ktqm77/acpi_tables.c index 0d90403..b88e04f 100644 --- a/src/mainboard/kontron/ktqm77/acpi_tables.c +++ b/src/mainboard/kontron/ktqm77/acpi_tables.c @@ -80,15 +80,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/lenovo/t520/acpi_tables.c b/src/mainboard/lenovo/t520/acpi_tables.c index 26a459d..27860f0 100644 --- a/src/mainboard/lenovo/t520/acpi_tables.c +++ b/src/mainboard/lenovo/t520/acpi_tables.c @@ -82,15 +82,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/lenovo/t530/acpi_tables.c b/src/mainboard/lenovo/t530/acpi_tables.c index 26a459d..27860f0 100644 --- a/src/mainboard/lenovo/t530/acpi_tables.c +++ b/src/mainboard/lenovo/t530/acpi_tables.c @@ -82,15 +82,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/lenovo/t60/acpi_tables.c b/src/mainboard/lenovo/t60/acpi_tables.c index ada7d08..2a675c0 100644 --- a/src/mainboard/lenovo/t60/acpi_tables.c +++ b/src/mainboard/lenovo/t60/acpi_tables.c @@ -77,15 +77,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/lenovo/x200/acpi_tables.c b/src/mainboard/lenovo/x200/acpi_tables.c index 77491dc..a09259b 100644 --- a/src/mainboard/lenovo/x200/acpi_tables.c +++ b/src/mainboard/lenovo/x200/acpi_tables.c @@ -77,15 +77,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/lenovo/x201/acpi_tables.c b/src/mainboard/lenovo/x201/acpi_tables.c index b8979f4..31accee 100644 --- a/src/mainboard/lenovo/x201/acpi_tables.c +++ b/src/mainboard/lenovo/x201/acpi_tables.c @@ -83,15 +83,3 @@ unsigned long acpi_fill_madt(unsigned long current) MP_IRQ_TRIGGER_EDGE, 0x01); return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - /* Not implemented */ - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/lenovo/x220/acpi_tables.c b/src/mainboard/lenovo/x220/acpi_tables.c index 26a459d..27860f0 100644 --- a/src/mainboard/lenovo/x220/acpi_tables.c +++ b/src/mainboard/lenovo/x220/acpi_tables.c @@ -82,15 +82,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/lenovo/x230/acpi_tables.c b/src/mainboard/lenovo/x230/acpi_tables.c index 26a459d..27860f0 100644 --- a/src/mainboard/lenovo/x230/acpi_tables.c +++ b/src/mainboard/lenovo/x230/acpi_tables.c @@ -82,15 +82,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/lenovo/x60/acpi_tables.c b/src/mainboard/lenovo/x60/acpi_tables.c index ada7d08..2a675c0 100644 --- a/src/mainboard/lenovo/x60/acpi_tables.c +++ b/src/mainboard/lenovo/x60/acpi_tables.c @@ -77,15 +77,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/packardbell/ms2290/acpi_tables.c b/src/mainboard/packardbell/ms2290/acpi_tables.c index b8979f4..31accee 100644 --- a/src/mainboard/packardbell/ms2290/acpi_tables.c +++ b/src/mainboard/packardbell/ms2290/acpi_tables.c @@ -83,15 +83,3 @@ unsigned long acpi_fill_madt(unsigned long current) MP_IRQ_TRIGGER_EDGE, 0x01); return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - /* Not implemented */ - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/roda/rk886ex/acpi_tables.c b/src/mainboard/roda/rk886ex/acpi_tables.c index ada7d08..2a675c0 100644 --- a/src/mainboard/roda/rk886ex/acpi_tables.c +++ b/src/mainboard/roda/rk886ex/acpi_tables.c @@ -77,15 +77,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/roda/rk9/acpi_tables.c b/src/mainboard/roda/rk9/acpi_tables.c index 77491dc..a09259b 100644 --- a/src/mainboard/roda/rk9/acpi_tables.c +++ b/src/mainboard/roda/rk9/acpi_tables.c @@ -77,15 +77,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/samsung/lumpy/acpi_tables.c b/src/mainboard/samsung/lumpy/acpi_tables.c index 24a0efd..e787158 100644 --- a/src/mainboard/samsung/lumpy/acpi_tables.c +++ b/src/mainboard/samsung/lumpy/acpi_tables.c @@ -110,15 +110,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/samsung/stumpy/acpi_tables.c b/src/mainboard/samsung/stumpy/acpi_tables.c index 2d24822..8125630 100644 --- a/src/mainboard/samsung/stumpy/acpi_tables.c +++ b/src/mainboard/samsung/stumpy/acpi_tables.c @@ -110,15 +110,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/via/epia-m/acpi_tables.c b/src/mainboard/via/epia-m/acpi_tables.c index d02bac2..5804ddb 100644 --- a/src/mainboard/via/epia-m/acpi_tables.c +++ b/src/mainboard/via/epia-m/acpi_tables.c @@ -17,20 +17,8 @@ unsigned long acpi_fill_mcfg(unsigned long current) return current; } -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - unsigned long acpi_fill_madt(unsigned long current) { /* Nothing to do */ return current; } - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/via/epia-m700/acpi_tables.c b/src/mainboard/via/epia-m700/acpi_tables.c index c841f2c..06a91c7 100644 --- a/src/mainboard/via/epia-m700/acpi_tables.c +++ b/src/mainboard/via/epia-m700/acpi_tables.c @@ -101,15 +101,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - /* Not implemented. */ - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT. */ - return current; -} diff --git a/src/mainboard/via/epia-n/acpi_tables.c b/src/mainboard/via/epia-n/acpi_tables.c index a48a438..5a5c642 100644 --- a/src/mainboard/via/epia-n/acpi_tables.c +++ b/src/mainboard/via/epia-n/acpi_tables.c @@ -58,12 +58,6 @@ unsigned long acpi_fill_mcfg(unsigned long current) return current; } -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - unsigned long acpi_create_madt_lapic_nmis(unsigned long current, u16 flags, u8 lint) { @@ -109,9 +103,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/mainboard/via/vt8454c/acpi_tables.c b/src/mainboard/via/vt8454c/acpi_tables.c index 1830c1d..c8f81a1 100644 --- a/src/mainboard/via/vt8454c/acpi_tables.c +++ b/src/mainboard/via/vt8454c/acpi_tables.c @@ -44,15 +44,3 @@ unsigned long acpi_fill_madt(unsigned long current) return current; } - -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} diff --git a/src/northbridge/amd/agesa/00730F01/northbridge.c b/src/northbridge/amd/agesa/00730F01/northbridge.c index b95dab7..3a04b95 100644 --- a/src/northbridge/amd/agesa/00730F01/northbridge.c +++ b/src/northbridge/amd/agesa/00730F01/northbridge.c @@ -494,18 +494,6 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest) return (unsigned long)current; } -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static void northbridge_fill_ssdt_generator(void) { msr_t msr; diff --git a/src/northbridge/amd/agesa/family12/northbridge.c b/src/northbridge/amd/agesa/family12/northbridge.c index 13d096f..314b2bc 100644 --- a/src/northbridge/amd/agesa/family12/northbridge.c +++ b/src/northbridge/amd/agesa/family12/northbridge.c @@ -840,18 +840,6 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest) return (unsigned long)current; } -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static void northbridge_fill_ssdt_generator(void) { msr_t msr; diff --git a/src/northbridge/amd/agesa/family14/northbridge.c b/src/northbridge/amd/agesa/family14/northbridge.c index 63b663a..71c6dd0 100644 --- a/src/northbridge/amd/agesa/family14/northbridge.c +++ b/src/northbridge/amd/agesa/family14/northbridge.c @@ -931,19 +931,6 @@ static unsigned long agesa_write_acpi_tables(unsigned long current, return current; } - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static struct device_operations northbridge_operations = { .read_resources = nb_read_resources, .set_resources = nb_set_resources, diff --git a/src/northbridge/amd/agesa/family15/northbridge.c b/src/northbridge/amd/agesa/family15/northbridge.c index 98ae44d..5e4672c 100644 --- a/src/northbridge/amd/agesa/family15/northbridge.c +++ b/src/northbridge/amd/agesa/family15/northbridge.c @@ -520,18 +520,6 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest) return (unsigned long)current; } -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static void northbridge_fill_ssdt_generator(void) { msr_t msr; diff --git a/src/northbridge/amd/agesa/family15tn/northbridge.c b/src/northbridge/amd/agesa/family15tn/northbridge.c index 4583e2e..57b4657 100644 --- a/src/northbridge/amd/agesa/family15tn/northbridge.c +++ b/src/northbridge/amd/agesa/family15tn/northbridge.c @@ -487,18 +487,6 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest) return (unsigned long)current; } -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static void northbridge_fill_ssdt_generator(void) { msr_t msr; diff --git a/src/northbridge/amd/agesa/family16kb/northbridge.c b/src/northbridge/amd/agesa/family16kb/northbridge.c index 3f2238e..91477c8 100644 --- a/src/northbridge/amd/agesa/family16kb/northbridge.c +++ b/src/northbridge/amd/agesa/family16kb/northbridge.c @@ -493,18 +493,6 @@ unsigned long acpi_fill_hest(acpi_hest_t *hest) return (unsigned long)current; } -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_slit(unsigned long current) -{ - return current; -} - -/* Implemented with AGESA-specific code. Dummy to keep linker happy. */ -unsigned long acpi_fill_srat(unsigned long current) -{ - return current; -} - static void northbridge_fill_ssdt_generator(void) { msr_t msr; diff --git a/src/northbridge/amd/amdfam10/acpi.c b/src/northbridge/amd/amdfam10/acpi.c index 463fb7c..de7d7b5 100644 --- a/src/northbridge/amd/amdfam10/acpi.c +++ b/src/northbridge/amd/amdfam10/acpi.c @@ -108,7 +108,7 @@ static void set_srat_mem(void *gp, struct device *dev, struct resource *res) state->current += acpi_create_srat_mem((acpi_srat_mem_t *)state->current, (res->index & 0xf), basek, sizek, 1); } -unsigned long acpi_fill_srat(unsigned long current) +static unsigned long acpi_fill_srat(unsigned long current) { struct acpi_srat_mem_state srat_mem_state; @@ -129,7 +129,7 @@ unsigned long acpi_fill_srat(unsigned long current) return current; } -unsigned long acpi_fill_slit(unsigned long current) +static unsigned long acpi_fill_slit(unsigned long current) { /* need to find out the node num at first */ /* fill the first 8 byte with that num */ @@ -315,7 +315,7 @@ unsigned long northbridge_write_acpi_tables(unsigned long current, current = ALIGN(current, 8); printk(BIOS_DEBUG, "ACPI: * SRAT at %lx\n", current); srat = (acpi_srat_t *) current; - acpi_create_srat(srat); + acpi_create_srat(srat, acpi_fill_srat); current += srat->header.length; acpi_add_table(rsdp, srat); @@ -323,7 +323,7 @@ unsigned long northbridge_write_acpi_tables(unsigned long current, current = ALIGN(current, 8); printk(BIOS_DEBUG, "ACPI: * SLIT at %lx\n", current); slit = (acpi_slit_t *) current; - acpi_create_slit(slit); + acpi_create_slit(slit, acpi_fill_slit); current += slit->header.length; acpi_add_table(rsdp, slit); diff --git a/src/northbridge/amd/amdk8/acpi.c b/src/northbridge/amd/amdk8/acpi.c index 2706c64..96e618f 100644 --- a/src/northbridge/amd/amdk8/acpi.c +++ b/src/northbridge/amd/amdk8/acpi.c @@ -114,7 +114,7 @@ static void set_srat_mem(void *gp, struct device *dev, struct resource *res) state->current += acpi_create_srat_mem((acpi_srat_mem_t *)state->current, (res->index & 0xf), basek, sizek, 1); } -unsigned long acpi_fill_srat(unsigned long current) +static unsigned long acpi_fill_srat(unsigned long current) { struct acpi_srat_mem_state srat_mem_state; @@ -135,7 +135,7 @@ unsigned long acpi_fill_srat(unsigned long current) return current; } -unsigned long acpi_fill_slit(unsigned long current) +static unsigned long acpi_fill_slit(unsigned long current) { /* need to find out the node num at first */ /* fill the first 8 byte with that num */ @@ -204,6 +204,36 @@ unsigned long acpi_fill_slit(unsigned long current) return current; } +unsigned long northbridge_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp) +{ + unsigned long current; + acpi_srat_t *srat; + acpi_slit_t *slit; + + current = start; + + /* Fills sysconf structure needed for SRAT and SLIT. */ + get_bus_conf(); + + current = ALIGN(current, 16); + srat = (acpi_srat_t *) current; + printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat); + acpi_create_srat(srat, acpi_fill_srat); + current += srat->header.length; + acpi_add_table(rsdp, srat); + + /* SLIT */ + current = ALIGN(current, 16); + slit = (acpi_slit_t *) current; + printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit); + acpi_create_slit(slit, acpi_fill_slit); + current+=slit->header.length; + acpi_add_table(rsdp,slit); + + return current; +} + + static int k8acpi_write_HT(void) { int len, lenp, i; diff --git a/src/northbridge/amd/amdk8/acpi.h b/src/northbridge/amd/amdk8/acpi.h index 6d7c4d9..4d71507 100644 --- a/src/northbridge/amd/amdk8/acpi.h +++ b/src/northbridge/amd/amdk8/acpi.h @@ -22,5 +22,6 @@ #include <arch/acpigen.h> void k8acpi_write_vars(void); +unsigned long northbridge_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp); #endif diff --git a/src/northbridge/amd/amdk8/northbridge.c b/src/northbridge/amd/amdk8/northbridge.c index 081ec6d..fa8b2d6 100644 --- a/src/northbridge/amd/amdk8/northbridge.c +++ b/src/northbridge/amd/amdk8/northbridge.c @@ -584,37 +584,6 @@ static void mcf0_control_init(struct device *dev) #endif } -#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) -static unsigned long northbridge_write_acpi_tables(unsigned long start, acpi_rsdp_t *rsdp) -{ - unsigned long current; - acpi_srat_t *srat; - acpi_slit_t *slit; - - current = start; - - /* Fills sysconf structure needed for SRAT and SLIT. */ - get_bus_conf(); - - current = ALIGN(current, 16); - srat = (acpi_srat_t *) current; - printk(BIOS_DEBUG, "ACPI: * SRAT @ %p\n", srat); - acpi_create_srat(srat); - current += srat->header.length; - acpi_add_table(rsdp, srat); - - /* SLIT */ - current = ALIGN(current, 16); - slit = (acpi_slit_t *) current; - printk(BIOS_DEBUG, "ACPI: * SLIT @ %p\n", slit); - acpi_create_slit(slit); - current+=slit->header.length; - acpi_add_table(rsdp,slit); - - return current; -} -#endif - static struct device_operations northbridge_operations = { .read_resources = amdk8_read_resources, .set_resources = amdk8_set_resources, diff --git a/src/northbridge/intel/fsp_rangeley/northbridge.c b/src/northbridge/intel/fsp_rangeley/northbridge.c index be3a3ac..0df40a8 100644 --- a/src/northbridge/intel/fsp_rangeley/northbridge.c +++ b/src/northbridge/intel/fsp_rangeley/northbridge.c @@ -212,18 +212,6 @@ static void northbridge_enable(device_t dev) { } -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} - static struct pci_operations intel_pci_ops = { .set_subsystem = intel_set_subsystem, }; diff --git a/src/soc/intel/baytrail/northcluster.c b/src/soc/intel/baytrail/northcluster.c index 2807a2d..152962d 100644 --- a/src/soc/intel/baytrail/northcluster.c +++ b/src/soc/intel/baytrail/northcluster.c @@ -132,18 +132,6 @@ static void nc_read_resources(device_t dev) chromeos_reserve_ram_oops(dev, index++); } -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} - static struct device_operations nc_ops = { .read_resources = nc_read_resources, .acpi_fill_ssdt_generator = generate_cpu_entries, diff --git a/src/soc/intel/fsp_baytrail/northcluster.c b/src/soc/intel/fsp_baytrail/northcluster.c index a440b9a..2ceda42 100644 --- a/src/soc/intel/fsp_baytrail/northcluster.c +++ b/src/soc/intel/fsp_baytrail/northcluster.c @@ -204,18 +204,6 @@ static void nc_enable(device_t dev) print_fsp_info(); } -unsigned long acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long acpi_fill_srat(unsigned long current) -{ - /* No NUMA, no SRAT */ - return current; -} - static struct device_operations nc_ops = { .read_resources = nc_read_resources, .acpi_fill_ssdt_generator = generate_cpu_entries, diff --git a/src/southbridge/intel/i82371eb/acpi_tables.c b/src/southbridge/intel/i82371eb/acpi_tables.c index 32d149e..8f3d5b5 100644 --- a/src/southbridge/intel/i82371eb/acpi_tables.c +++ b/src/southbridge/intel/i82371eb/acpi_tables.c @@ -61,18 +61,6 @@ void generate_cpu_entries(void) acpigen_pop_len(); } -unsigned long __attribute__((weak)) acpi_fill_slit(unsigned long current) -{ - // Not implemented - return current; -} - -unsigned long __attribute__((weak)) acpi_fill_srat(unsigned long current) -{ - // Not implemented - return current; -} - unsigned long __attribute__((weak)) acpi_fill_madt(unsigned long current) { /* mainboard has no ioapic */
1
0
0
0
Patch set updated for coreboot: 7dde21b arm/ti/am335x: use new arm bootblock infrastructure
by Alexander Couzens
05 Nov '14
05 Nov '14
Alexander Couzens (lynxis(a)fe80.eu) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/7189
-gerrit commit 7dde21b159e854bdd27de633c1665efe7654e394 Author: Alexander Couzens <lynxis(a)fe80.eu> Date: Fri Oct 24 23:52:56 2014 +0200 arm/ti/am335x: use new arm bootblock infrastructure commit 8b685398 (ARM: Overhaul the ARM Makefile.) changes config flags for cpu and mainboard bootblock initialization. Tested on beaglebone black. Change-Id: I70cbe3abad8443c5dc71c8ba76a35973a5284477 Signed-off-by: Alexander Couzens <lynxis(a)fe80.eu> --- src/cpu/ti/am335x/Kconfig | 9 +-------- src/cpu/ti/am335x/Makefile.inc | 3 ++- src/cpu/ti/am335x/bootblock.c | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/cpu/ti/am335x/Kconfig b/src/cpu/ti/am335x/Kconfig index 1de871f..fae527d 100644 --- a/src/cpu/ti/am335x/Kconfig +++ b/src/cpu/ti/am335x/Kconfig @@ -5,19 +5,12 @@ config CPU_TI_AM335X select HAVE_MONOTONIC_TIMER select HAVE_UART_SPECIAL select BOOTBLOCK_CONSOLE + select CPU_HAS_BOOTBLOCK_INIT bool default n if CPU_TI_AM335X -config BOOTBLOCK_CPU_INIT - string - default "cpu/ti/am335x/bootblock.c" - help - CPU/SoC-specific bootblock code. This is useful if the - bootblock must load microcode or copy data from ROM before - searching for the bootblock. - config BOOTBLOCK_BASE hex default 0x402f0400 diff --git a/src/cpu/ti/am335x/Makefile.inc b/src/cpu/ti/am335x/Makefile.inc index 032b1f4..24d2594 100644 --- a/src/cpu/ti/am335x/Makefile.inc +++ b/src/cpu/ti/am335x/Makefile.inc @@ -1,5 +1,6 @@ -bootblock-y += dmtimer.c +bootblock-y += bootblock.c bootblock-y += bootblock_media.c +bootblock-y += dmtimer.c bootblock-y += pinmux.c romstage-y += nand.c diff --git a/src/cpu/ti/am335x/bootblock.c b/src/cpu/ti/am335x/bootblock.c index e9434a1..04c9304 100644 --- a/src/cpu/ti/am335x/bootblock.c +++ b/src/cpu/ti/am335x/bootblock.c @@ -20,8 +20,8 @@ #include <types.h> #include <arch/cache.h> +#include <bootblock_common.h> -void bootblock_cpu_init(void); void bootblock_cpu_init(void) { uint32_t sctlr;
1
0
0
0
Patch set updated for coreboot: 2881069 device: Clarify correct typing of 'struct device *'
by Edward O'Callaghan
05 Nov '14
05 Nov '14
Edward O'Callaghan (eocallaghan(a)alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/7138
-gerrit commit 28810690ac6ca01ff40ac16d9d306b6588cd7cbd Author: Edward O'Callaghan <eocallaghan(a)alterapraxis.com> Date: Sat Nov 1 13:55:04 2014 +1100 device: Clarify correct typing of 'struct device *' Disambiguate 'device_t' into 'struct device *', 'pci_devfn_t' and 'pnp_devfn_t' component types where appropriate. Change-Id: Ic4239efe0462d86694bf4ac0ec898f589b6adf1c Signed-off-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com> --- src/device/agp_device.c | 6 +-- src/device/cardbus_device.c | 8 ++-- src/device/cpu_device.c | 8 ++-- src/device/device.c | 14 +++---- src/device/device_romstage.c | 2 +- src/device/device_util.c | 35 ++++++++-------- src/device/hypertransport.c | 20 +++++---- src/device/oprom/yabel/biosemu.c | 2 +- src/device/oprom/yabel/compat/functions.c | 2 +- src/device/oprom/yabel/device.c | 2 +- src/device/oprom/yabel/io.c | 2 +- src/device/pci_device.c | 22 +++++----- src/device/pci_ops.c | 2 +- src/device/pci_rom.c | 2 +- src/device/pciexp_device.c | 22 +++++----- src/device/pcix_device.c | 6 +-- src/device/pnp_device.c | 40 +++++++++--------- src/device/root_device.c | 14 +++---- src/device/smbus_ops.c | 26 ++++++------ src/include/cpu/amd/model_fxx_rev.h | 7 ++-- src/include/device/agp.h | 2 +- src/include/device/cardbus.h | 4 +- src/include/device/device.h | 69 +++++++++++++++---------------- src/include/device/pci.h | 30 +++++++------- src/include/device/pciexp.h | 2 +- src/include/device/pcix.h | 2 +- src/include/device/pnp.h | 38 ++++++++--------- src/include/device/smbus.h | 54 ++++++++++++------------ 28 files changed, 224 insertions(+), 219 deletions(-) diff --git a/src/device/agp_device.c b/src/device/agp_device.c index 550297a..fc23fe6 100644 --- a/src/device/agp_device.c +++ b/src/device/agp_device.c @@ -24,7 +24,7 @@ #include <device/pci_ids.h> #include <device/agp.h> -static void agp_tune_dev(device_t dev) +static void agp_tune_dev(struct device *dev) { unsigned int cap; @@ -38,7 +38,7 @@ static void agp_tune_dev(device_t dev) unsigned int agp_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max) { - device_t child; + struct device *child; max = pci_scan_bus(bus, min_devfn, max_devfn, max); @@ -53,7 +53,7 @@ unsigned int agp_scan_bus(struct bus *bus, unsigned int min_devfn, return max; } -unsigned int agp_scan_bridge(device_t dev, unsigned int max) +unsigned int agp_scan_bridge(struct device *dev, unsigned int max) { return do_pci_scan_bridge(dev, max, agp_scan_bus); } diff --git a/src/device/cardbus_device.c b/src/device/cardbus_device.c index f25f96c..e32ece3 100644 --- a/src/device/cardbus_device.c +++ b/src/device/cardbus_device.c @@ -38,7 +38,7 @@ #define CARDBUS_IO_SIZE 4096 #define CARDBUS_MEM_SIZE (32 * 1024 * 1024) -static void cardbus_record_bridge_resource(device_t dev, resource_t moving, +static void cardbus_record_bridge_resource(struct device *dev, resource_t moving, resource_t min_size, unsigned int index, unsigned long type) { struct resource *resource; @@ -70,7 +70,7 @@ static void cardbus_record_bridge_resource(device_t dev, resource_t moving, resource->size = min_size; } -static void cardbus_size_bridge_resource(device_t dev, unsigned int index) +static void cardbus_size_bridge_resource(struct device *dev, unsigned int index) { struct resource *resource; resource_t min_size; @@ -87,7 +87,7 @@ static void cardbus_size_bridge_resource(device_t dev, unsigned int index) } } -void cardbus_read_resources(device_t dev) +void cardbus_read_resources(struct device *dev) { resource_t moving_base, moving_limit, moving; unsigned long type; @@ -153,7 +153,7 @@ void cardbus_read_resources(device_t dev) compact_resources(dev); } -void cardbus_enable_resources(device_t dev) +void cardbus_enable_resources(struct device *dev) { u16 ctrl; diff --git a/src/device/cpu_device.c b/src/device/cpu_device.c index e76b539..7152d02 100644 --- a/src/device/cpu_device.c +++ b/src/device/cpu_device.c @@ -25,7 +25,7 @@ void remap_bsp_lapic(struct bus *cpu_bus) { struct device_path cpu_path; - device_t cpu; + struct device *cpu; u32 bsp_lapic_id = lapicid(); if (bsp_lapic_id) { @@ -37,10 +37,10 @@ void remap_bsp_lapic(struct bus *cpu_bus) } } -device_t add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled) +struct device *add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled) { struct device_path cpu_path; - device_t cpu; + struct device *cpu; /* Build the cpu device path */ cpu_path.type = DEVICE_PATH_APIC; @@ -61,7 +61,7 @@ device_t add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled) return cpu; } -void set_cpu_topology(device_t cpu, unsigned node, unsigned package, unsigned core, unsigned thread) +void set_cpu_topology(struct device *cpu, unsigned node, unsigned package, unsigned core, unsigned thread) { cpu->path.apic.node_id = node; cpu->path.apic.package_id = package; diff --git a/src/device/device.c b/src/device/device.c index e068cee..04fc725 100644 --- a/src/device/device.c +++ b/src/device/device.c @@ -114,9 +114,9 @@ uint64_t uma_memory_size = 0; * * @see device_path */ -static device_t __alloc_dev(struct bus *parent, struct device_path *path) +static struct device *__alloc_dev(struct bus *parent, struct device_path *path) { - device_t dev, child; + struct device *dev, *child; /* Find the last child of our parent. */ for (child = parent->children; child && child->sibling; /* */ ) @@ -148,9 +148,9 @@ static device_t __alloc_dev(struct bus *parent, struct device_path *path) return dev; } -device_t alloc_dev(struct bus *parent, struct device_path *path) +struct device *alloc_dev(struct bus *parent, struct device_path *path) { - device_t dev; + struct device *dev; spin_lock(&dev_lock); dev = __alloc_dev(parent, path); spin_unlock(&dev_lock); @@ -164,9 +164,9 @@ device_t alloc_dev(struct bus *parent, struct device_path *path) * @param path The relative path from the bus to the appropriate device. * @return Pointer to a device structure for the device on bus at path. */ -device_t alloc_find_dev(struct bus *parent, struct device_path *path) +struct device *alloc_find_dev(struct bus *parent, struct device_path *path) { - device_t child; + struct device *child; spin_lock(&dev_lock); child = find_dev_path(parent, path); if (!child) @@ -750,7 +750,7 @@ static void avoid_fixed_resources(struct device *dev) } } -device_t vga_pri = 0; +struct device *vga_pri = NULL; static void set_vga_bridge_bits(void) { /* diff --git a/src/device/device_romstage.c b/src/device/device_romstage.c index 987fdad..0c81d60 100644 --- a/src/device/device_romstage.c +++ b/src/device/device_romstage.c @@ -28,7 +28,7 @@ #include <device/resource.h> /** Linked list of ALL devices */ -ROMSTAGE_CONST struct device * ROMSTAGE_CONST all_devices = &dev_root; +ROMSTAGE_CONST struct device *ROMSTAGE_CONST all_devices = &dev_root; /** * Given a PCI bus and a devfn number, find the device structure. diff --git a/src/device/device_util.c b/src/device/device_util.c index d5466cb..2bdaff3 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -37,9 +37,9 @@ * @return Pointer to a device structure for the device on bus at path * or 0/NULL if no device is found. */ -device_t find_dev_path(struct bus *parent, struct device_path *path) +struct device *find_dev_path(struct bus *parent, struct device_path *path) { - device_t child; + struct device *child; for (child = parent->children; child; child = child->sibling) { if (path_eq(path, &child->path)) break; @@ -120,9 +120,10 @@ struct device *dev_find_slot_pnp(u16 port, u16 device) * @param apic_id The Local APIC ID number. * @return Pointer to the device structure (if found), 0 otherwise. */ -device_t dev_find_lapic(unsigned apic_id) +struct device *dev_find_lapic(unsigned apic_id) { - device_t dev, result = NULL; + struct device *dev = NULL; + struct device *result = NULL; for (dev = all_devices; dev; dev = dev->next) { if (dev->path.type == DEVICE_PATH_APIC && @@ -185,7 +186,7 @@ struct device *dev_find_class(unsigned int class, struct device *from) * @param dev The device path to encode. * @return Device path encoded into lower 3 bytes of dword. */ -u32 dev_path_encode(device_t dev) +u32 dev_path_encode(struct device *dev) { u32 ret; @@ -238,7 +239,7 @@ u32 dev_path_encode(device_t dev) * Warning: This function uses a static buffer. Don't call it more than once * from the same print statement! */ -const char *dev_path(device_t dev) +const char *dev_path(struct device *dev) { static char buffer[DEVICE_PATH_MAX]; @@ -308,7 +309,7 @@ const char *dev_path(device_t dev) return buffer; } -const char *dev_name(device_t dev) +const char *dev_name(struct device *dev) { if (dev->name) return dev->name; @@ -405,7 +406,7 @@ static int allocate_more_resources(void) * @param prev TODO * @return TODO. */ -static void free_resource(device_t dev, struct resource *res, +static void free_resource(struct device *dev, struct resource *res, struct resource *prev) { if (prev) @@ -424,7 +425,7 @@ static void free_resource(device_t dev, struct resource *res, * * @param dev The device to find the resource on. */ -void compact_resources(device_t dev) +void compact_resources(struct device *dev) { struct resource *res, *next, *prev = NULL; @@ -445,7 +446,7 @@ void compact_resources(device_t dev) * @param index The index of the resource on the device. * @return The resource, if it already exists. */ -struct resource *probe_resource(device_t dev, unsigned index) +struct resource *probe_resource(struct device *dev, unsigned index) { struct resource *res; @@ -468,7 +469,7 @@ struct resource *probe_resource(device_t dev, unsigned index) * @param index The index of the resource on the device. * @return TODO. */ -struct resource *new_resource(device_t dev, unsigned index) +struct resource *new_resource(struct device *dev, unsigned index) { struct resource *resource, *tail; @@ -515,7 +516,7 @@ struct resource *new_resource(device_t dev, unsigned index) * @param index The index of the resource on the device. * return TODO. */ -struct resource *find_resource(device_t dev, unsigned index) +struct resource *find_resource(struct device *dev, unsigned index) { struct resource *resource; @@ -629,7 +630,7 @@ const char *resource_type(struct resource *resource) * @param resource The resource that was just stored. * @param comment TODO */ -void report_resource_stored(device_t dev, struct resource *resource, +void report_resource_stored(struct device *dev, struct resource *resource, const char *comment) { char buf[10]; @@ -721,7 +722,7 @@ void search_global_resources(unsigned long type_mask, unsigned long type, } } -void dev_set_enabled(device_t dev, int enable) +void dev_set_enabled(struct device *dev, int enable) { if (dev->enabled == enable) return; @@ -736,7 +737,7 @@ void dev_set_enabled(device_t dev, int enable) void disable_children(struct bus *bus) { - device_t child; + struct device *child; for (child = bus->children; child; child = child->sibling) { struct bus *link; @@ -890,7 +891,7 @@ void show_all_devs_resources(int debug_level, const char* msg) } } -void fixed_mem_resource(device_t dev, unsigned long index, +void fixed_mem_resource(struct device *dev, unsigned long index, unsigned long basek, unsigned long sizek, unsigned long type) { struct resource *resource; @@ -939,7 +940,7 @@ u32 find_pci_tolm(struct bus *bus) /* Count of enabled CPUs */ int dev_count_cpu(void) { - device_t cpu; + struct device *cpu; int count = 0; for (cpu = all_devices; cpu; cpu = cpu->next) { diff --git a/src/device/hypertransport.c b/src/device/hypertransport.c index d9ab486..030ddea 100644 --- a/src/device/hypertransport.c +++ b/src/device/hypertransport.c @@ -41,9 +41,10 @@ #include <cpu/amd/model_fxx_rev.h> #endif -static device_t ht_scan_get_devs(device_t *old_devices) +static struct device *ht_scan_get_devs(struct device * *old_devices) { - device_t first, last; + struct device *first; + struct device *last; first = *old_devices; last = first; @@ -60,7 +61,7 @@ static device_t ht_scan_get_devs(device_t *old_devices) } if (first) { - device_t child; + struct device *child; /* Unlink the chain from the list of old devices. */ *old_devices = last->sibling; @@ -81,7 +82,7 @@ static device_t ht_scan_get_devs(device_t *old_devices) } #if OPT_HT_LINK == 1 -static unsigned ht_read_freq_cap(device_t dev, unsigned pos) +static unsigned ht_read_freq_cap(struct device *dev, unsigned pos) { /* Handle bugs in valid hypertransport frequency reporting. */ unsigned freq_cap; @@ -126,7 +127,7 @@ struct ht_link { unsigned char ctrl_off, config_off, freq_off, freq_cap_off; }; -static int ht_setup_link(struct ht_link *prev, device_t dev, unsigned pos) +static int ht_setup_link(struct ht_link *prev, struct device *dev, unsigned pos) { #if OPT_HT_LINK == 1 static const u8 link_width_to_pow2[] = { 3, 4, 0, 5, 1, 2, 0, 0 }; @@ -420,7 +421,10 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned min_devfn, * optimize link. */ unsigned int next_unitid, last_unitid, min_unitid, max_unitid; - device_t old_devices, dev, func, last_func = 0; + struct device *old_devices; + struct device *dev; + struct device *func; + struct device *last_func = NULL; struct ht_link prev; int ht_dev_num = 0; @@ -433,7 +437,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned min_devfn, */ unsigned int real_last_unitid = 0, end_used = 0; u8 real_last_pos = 0; - device_t real_last_dev = NULL; + struct device *real_last_dev = NULL; #endif /* Restore the hypertransport chain to it's uninitialized state. */ @@ -627,7 +631,7 @@ end_of_chain: * a problem in devicetree.cb. */ if (old_devices) { - device_t left; + struct device *left; for (left = old_devices; left; left = left->sibling) printk(BIOS_DEBUG, "%s\n", dev_path(left)); diff --git a/src/device/oprom/yabel/biosemu.c b/src/device/oprom/yabel/biosemu.c index d27a5f1..86197a8 100644 --- a/src/device/oprom/yabel/biosemu.c +++ b/src/device/oprom/yabel/biosemu.c @@ -62,7 +62,7 @@ mainboard_interrupt_handlers(int interrupt, yabel_handleIntFunc func) * will look for an ExpansionROM BAR and use the code from there. */ u32 -biosemu(u8 *biosmem, u32 biosmem_size, struct device * dev, unsigned long rom_addr) +biosemu(u8 *biosmem, u32 biosmem_size, struct device *dev, unsigned long rom_addr) { u8 *rom_image; int i = 0; diff --git a/src/device/oprom/yabel/compat/functions.c b/src/device/oprom/yabel/compat/functions.c index 27d0413..a132946 100644 --- a/src/device/oprom/yabel/compat/functions.c +++ b/src/device/oprom/yabel/compat/functions.c @@ -35,7 +35,7 @@ u8* vmem = NULL; extern u8 *biosmem; -void run_bios(struct device * dev, unsigned long addr) +void run_bios(struct device *dev, unsigned long addr) { biosmem = vmem; diff --git a/src/device/oprom/yabel/device.c b/src/device/oprom/yabel/device.c index 2f41847..37e6020 100644 --- a/src/device/oprom/yabel/device.c +++ b/src/device/oprom/yabel/device.c @@ -407,7 +407,7 @@ biosemu_dev_check_exprom(unsigned long rom_base_addr) } u8 -biosemu_dev_init(struct device * device) +biosemu_dev_init(struct device *device) { u8 rval = 0; //init bios_device struct diff --git a/src/device/oprom/yabel/io.c b/src/device/oprom/yabel/io.c index 08189a9..2d38ad7 100644 --- a/src/device/oprom/yabel/io.c +++ b/src/device/oprom/yabel/io.c @@ -390,7 +390,7 @@ u32 pci_cfg_read(X86EMU_pioAddr addr, u8 size) { u32 rval = 0xFFFFFFFF; - struct device * dev; + struct device *dev; if ((addr >= 0xCFC) && ((addr + size) <= 0xD00)) { // PCI Configuration Mechanism 1 step 1 // write to 0xCF8, sets bus, device, function and Config Space offset diff --git a/src/device/pci_device.c b/src/device/pci_device.c index 8351e9c..e82cb5c 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -157,7 +157,7 @@ unsigned pci_find_next_capability(struct device *dev, unsigned cap, * @param cap PCI_CAP_LIST_ID of the PCI capability we're looking for. * @return The next matching capability. */ -unsigned pci_find_capability(device_t dev, unsigned cap) +unsigned pci_find_capability(struct device *dev, unsigned cap) { return pci_find_next_capability(dev, cap, 0); } @@ -761,7 +761,7 @@ struct device_operations default_pci_ops_bus = { * @param dev Pointer to the device structure of the bridge. * @return Appropriate bridge operations. */ -static struct device_operations *get_pci_bridge_ops(device_t dev) +static struct device_operations *get_pci_bridge_ops(struct device *dev) { #if CONFIG_PCIX_PLUGIN_SUPPORT unsigned int pcixpos; @@ -959,7 +959,7 @@ static struct device *pci_scan_get_dev(struct device **list, unsigned int devfn) * @param devfn A device/function number to look at. * @return The device structure for the device (if found), NULL otherwise. */ -device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn) +struct device *pci_probe_dev(struct device * dev, struct bus *bus, unsigned devfn) { u32 id, class; u8 hdr_type; @@ -1066,7 +1066,7 @@ device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn) * @param sdev Simple device model identifier, created with PCI_DEV(). * @return Non-zero if bus:dev.fn of device matches. */ -unsigned int pci_match_simple_dev(device_t dev, pci_devfn_t sdev) +unsigned int pci_match_simple_dev(struct device *dev, pci_devfn_t sdev) { return dev->bus->secondary == PCI_DEV2SEGBUS(sdev) && dev->path.pci.devfn == PCI_DEV2DEVFN(sdev); @@ -1146,7 +1146,7 @@ unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, * There's probably a problem in devicetree.cb. */ if (old_devices) { - device_t left; + struct device *left; printk(BIOS_WARNING, "PCI: Left over static devices:\n"); for (left = old_devices; left; left = left->sibling) printk(BIOS_WARNING, "%s\n", dev_path(left)); @@ -1280,7 +1280,7 @@ unsigned int pci_scan_bridge(struct device *dev, unsigned int max) * @param max The highest bus number assigned up to now. * @return The maximum bus number found, after scanning all subordinate busses. */ -unsigned int pci_domain_scan_bus(device_t dev, unsigned int max) +unsigned int pci_domain_scan_bus(struct device *dev, unsigned int max) { max = pci_scan_bus(dev->link_list, PCI_DEVFN(0, 0), 0xff, max); return max; @@ -1326,10 +1326,10 @@ const char *pin_to_str(int pin) * @return The interrupt pin number (1 - 4) that 'dev' will * trigger when generating an interrupt */ -static int swizzle_irq_pins(device_t dev, device_t *parent_bridge) +static int swizzle_irq_pins(struct device *dev, struct device * *parent_bridge) { - device_t parent; /* Our current device's parent device */ - device_t child; /* The child device of the parent */ + struct device *parent; /* Our current device's parent device */ + struct device *child; /* The child device of the parent */ uint8_t parent_bus = 0; /* Parent Bus number */ uint16_t parent_devfn = 0; /* Parent Device and Function number */ uint16_t child_devfn = 0; /* Child Device and Function number */ @@ -1394,7 +1394,7 @@ static int swizzle_irq_pins(device_t dev, device_t *parent_bridge) * Errors: -1 is returned if the device is not enabled * -2 is returned if a parent bridge could not be found. */ -int get_pci_irq_pins(device_t dev, device_t *parent_bdg) +int get_pci_irq_pins(struct device *dev, struct device * *parent_bdg) { uint8_t bus = 0; /* The bus this device is on */ uint16_t devfn = 0; /* This device's device and function numbers */ @@ -1456,7 +1456,7 @@ void pci_assign_irqs(unsigned bus, unsigned slot, const unsigned char pIntAtoD[4]) { unsigned int funct; - device_t pdev; + struct device *pdev; u8 line, irq; /* Each slot may contain up to eight functions. */ diff --git a/src/device/pci_ops.c b/src/device/pci_ops.c index 6ddb493..73b4242 100644 --- a/src/device/pci_ops.c +++ b/src/device/pci_ops.c @@ -25,7 +25,7 @@ #include <device/pci_ids.h> #include <device/pci_ops.h> -const struct pci_bus_operations *pci_bus_default_ops(device_t dev) +const struct pci_bus_operations *pci_bus_default_ops(struct device *dev) { #if CONFIG_MMCONF_SUPPORT_DEFAULT return &pci_ops_mmconf; diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index 1bdccf0..b7fdde6 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -155,7 +155,7 @@ struct rom_header *pci_rom_load(struct device *dev, */ if (PCI_CLASS_DISPLAY_VGA == (dev->class >> 8)) { #if !CONFIG_MULTIPLE_VGA_ADAPTERS - extern device_t vga_pri; /* Primary VGA device (device.c). */ + extern struct device *vga_pri; /* Primary VGA device (device.c). */ if (dev != vga_pri) return NULL; /* Only one VGA supported. */ #endif if ((void *)PCI_VGA_RAM_IMAGE_START != rom_header) { diff --git a/src/device/pciexp_device.c b/src/device/pciexp_device.c index 87aea67..a38da40 100644 --- a/src/device/pciexp_device.c +++ b/src/device/pciexp_device.c @@ -30,7 +30,7 @@ * Re-train a PCIe link */ #define PCIE_TRAIN_RETRY 10000 -static int pciexp_retrain_link(device_t dev, unsigned cap) +static int pciexp_retrain_link(struct device *dev, unsigned cap) { unsigned try = PCIE_TRAIN_RETRY; u16 lnk; @@ -57,8 +57,8 @@ static int pciexp_retrain_link(device_t dev, unsigned cap) * and enable Common Clock Configuration if possible. If CCC is * enabled the link must be retrained. */ -static void pciexp_enable_common_clock(device_t root, unsigned root_cap, - device_t endp, unsigned endp_cap) +static void pciexp_enable_common_clock(struct device *root, unsigned root_cap, + struct device *endp, unsigned endp_cap) { u16 root_scc, endp_scc, lnkctl; @@ -96,8 +96,8 @@ static void pciexp_enable_common_clock(device_t root, unsigned root_cap, * by checking both root port and endpoint and returning * the highest latency value. */ -static int pciexp_aspm_latency(device_t root, unsigned root_cap, - device_t endp, unsigned endp_cap, +static int pciexp_aspm_latency(struct device *root, unsigned root_cap, + struct device *endp, unsigned endp_cap, enum aspm_type type) { int root_lat = 0, endp_lat = 0; @@ -139,8 +139,8 @@ static int pciexp_aspm_latency(device_t root, unsigned root_cap, * 2 = L1 Enabled * 3 = L0s and L1 Enabled */ -static enum aspm_type pciexp_enable_aspm(device_t root, unsigned root_cap, - device_t endp, unsigned endp_cap) +static enum aspm_type pciexp_enable_aspm(struct device *root, unsigned root_cap, + struct device *endp, unsigned endp_cap) { const char *aspm_type_str[] = { "None", "L0s", "L1", "L0s and L1" }; enum aspm_type apmc = PCIE_ASPM_NONE; @@ -182,9 +182,9 @@ static enum aspm_type pciexp_enable_aspm(device_t root, unsigned root_cap, } #endif /* CONFIG_PCIEXP_ASPM */ -static void pciexp_tune_dev(device_t dev) +static void pciexp_tune_dev(struct device *dev) { - device_t root = dev->bus->dev; + struct device *root = dev->bus->dev; unsigned int root_cap, cap; cap = pci_find_capability(dev, PCI_CAP_ID_PCIE); @@ -216,7 +216,7 @@ static void pciexp_tune_dev(device_t dev) unsigned int pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max) { - device_t child; + struct device *child; max = pci_scan_bus(bus, min_devfn, max_devfn, max); @@ -230,7 +230,7 @@ unsigned int pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, return max; } -unsigned int pciexp_scan_bridge(device_t dev, unsigned int max) +unsigned int pciexp_scan_bridge(struct device *dev, unsigned int max) { return do_pci_scan_bridge(dev, max, pciexp_scan_bus); } diff --git a/src/device/pcix_device.c b/src/device/pcix_device.c index a20c3bf..59355b5 100644 --- a/src/device/pcix_device.c +++ b/src/device/pcix_device.c @@ -24,7 +24,7 @@ #include <device/pci_ids.h> #include <device/pcix.h> -static void pcix_tune_dev(device_t dev) +static void pcix_tune_dev(struct device *dev) { u32 status; u16 orig_cmd, cmd; @@ -65,7 +65,7 @@ static void pcix_tune_dev(device_t dev) static void pcix_tune_bus(struct bus *bus) { - device_t child; + struct device *child; for (child = bus->children; child; child = child->sibling) pcix_tune_dev(child); @@ -112,7 +112,7 @@ const char *pcix_speed(u16 sstatus) return result; } -unsigned int pcix_scan_bridge(device_t dev, unsigned int max) +unsigned int pcix_scan_bridge(struct device *dev, unsigned int max) { unsigned int pos; u16 sstatus; diff --git a/src/device/pnp_device.c b/src/device/pnp_device.c index e4aa4d3..d49b7a9 100644 --- a/src/device/pnp_device.c +++ b/src/device/pnp_device.c @@ -32,13 +32,13 @@ /* PNP config mode wrappers */ -void pnp_enter_conf_mode(device_t dev) +void pnp_enter_conf_mode(struct device *dev) { if (dev->ops->ops_pnp_mode) dev->ops->ops_pnp_mode->enter_conf_mode(dev); } -void pnp_exit_conf_mode(device_t dev) +void pnp_exit_conf_mode(struct device *dev) { if (dev->ops->ops_pnp_mode) dev->ops->ops_pnp_mode->exit_conf_mode(dev); @@ -46,24 +46,24 @@ void pnp_exit_conf_mode(device_t dev) /* PNP fundamental operations */ -void pnp_write_config(device_t dev, u8 reg, u8 value) +void pnp_write_config(struct device *dev, u8 reg, u8 value) { outb(reg, dev->path.pnp.port); outb(value, dev->path.pnp.port + 1); } -u8 pnp_read_config(device_t dev, u8 reg) +u8 pnp_read_config(struct device *dev, u8 reg) { outb(reg, dev->path.pnp.port); return inb(dev->path.pnp.port + 1); } -void pnp_set_logical_device(device_t dev) +void pnp_set_logical_device(struct device *dev) { pnp_write_config(dev, 0x07, dev->path.pnp.device & 0xff); } -void pnp_set_enable(device_t dev, int enable) +void pnp_set_enable(struct device *dev, int enable) { u8 tmp, bitpos; @@ -80,7 +80,7 @@ void pnp_set_enable(device_t dev, int enable) pnp_write_config(dev, 0x30, tmp); } -int pnp_read_enable(device_t dev) +int pnp_read_enable(struct device *dev) { u8 tmp, bitpos; @@ -92,20 +92,20 @@ int pnp_read_enable(device_t dev) return !!(tmp & (1 << bitpos)); } -void pnp_set_iobase(device_t dev, u8 index, u16 iobase) +void pnp_set_iobase(struct device *dev, u8 index, u16 iobase) { /* Index == 0x60 or 0x62. */ pnp_write_config(dev, index + 0, (iobase >> 8) & 0xff); pnp_write_config(dev, index + 1, iobase & 0xff); } -void pnp_set_irq(device_t dev, u8 index, u8 irq) +void pnp_set_irq(struct device *dev, u8 index, u8 irq) { /* Index == 0x70 or 0x72. */ pnp_write_config(dev, index, irq); } -void pnp_set_drq(device_t dev, u8 index, u8 drq) +void pnp_set_drq(struct device *dev, u8 index, u8 drq) { /* Index == 0x74. */ pnp_write_config(dev, index, drq & 0xff); @@ -113,12 +113,12 @@ void pnp_set_drq(device_t dev, u8 index, u8 drq) /* PNP device operations */ -void pnp_read_resources(device_t dev) +void pnp_read_resources(struct device *dev) { return; } -static void pnp_set_resource(device_t dev, struct resource *resource) +static void pnp_set_resource(struct device *dev, struct resource *resource) { if (!(resource->flags & IORESOURCE_ASSIGNED)) { printk(BIOS_ERR, "ERROR: %s %02lx %s size: 0x%010llx " @@ -144,7 +144,7 @@ static void pnp_set_resource(device_t dev, struct resource *resource) report_resource_stored(dev, resource, ""); } -void pnp_set_resources(device_t dev) +void pnp_set_resources(struct device *dev) { struct resource *res; @@ -160,7 +160,7 @@ void pnp_set_resources(device_t dev) pnp_exit_conf_mode(dev); } -void pnp_enable_resources(device_t dev) +void pnp_enable_resources(struct device *dev) { pnp_enter_conf_mode(dev); pnp_set_logical_device(dev); @@ -168,7 +168,7 @@ void pnp_enable_resources(device_t dev) pnp_exit_conf_mode(dev); } -void pnp_enable(device_t dev) +void pnp_enable(struct device *dev) { if (!dev->enabled) { pnp_enter_conf_mode(dev); @@ -178,7 +178,7 @@ void pnp_enable(device_t dev) } } -void pnp_alt_enable(device_t dev) +void pnp_alt_enable(struct device *dev) { pnp_enter_conf_mode(dev); pnp_set_logical_device(dev); @@ -195,7 +195,7 @@ struct device_operations pnp_ops = { /* PNP chip operations */ -static void pnp_get_ioresource(device_t dev, u8 index, struct io_info *info) +static void pnp_get_ioresource(struct device *dev, u8 index, struct io_info *info) { struct resource *resource; unsigned moving, gran, step; @@ -246,7 +246,7 @@ static void pnp_get_ioresource(device_t dev, u8 index, struct io_info *info) resource->size = 1 << gran; } -static void get_resources(device_t dev, struct pnp_info *info) +static void get_resources(struct device *dev, struct pnp_info *info) { struct resource *resource; @@ -312,11 +312,11 @@ static void get_resources(device_t dev, struct pnp_info *info) } } -void pnp_enable_devices(device_t base_dev, struct device_operations *ops, +void pnp_enable_devices(struct device *base_dev, struct device_operations *ops, unsigned int functions, struct pnp_info *info) { struct device_path path; - device_t dev; + struct device *dev; int i; path.type = DEVICE_PATH_PNP; diff --git a/src/device/root_device.c b/src/device/root_device.c index 49fa711..fb32151 100644 --- a/src/device/root_device.c +++ b/src/device/root_device.c @@ -35,7 +35,7 @@ const char mainboard_name[] = CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_ * * @param root Pointer to the device structure for the system root device. */ -static void root_dev_read_resources(device_t root) +static void root_dev_read_resources(struct device *root) { printk(BIOS_ERR, "%s should never be called.\n", __func__); } @@ -48,7 +48,7 @@ static void root_dev_read_resources(device_t root) * * @param root Pointer to the device structure for the system root device. */ -static void root_dev_set_resources(device_t root) +static void root_dev_set_resources(struct device *root) { printk(BIOS_ERR, "%s should never be called.\n", __func__); } @@ -76,9 +76,9 @@ static void root_dev_set_resources(device_t root) * @return The largest bus number used. */ static int smbus_max = 0; -unsigned int scan_static_bus(device_t bus, unsigned int max) +unsigned int scan_static_bus(struct device *bus, unsigned int max) { - device_t child; + struct device *child; struct bus *link; printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus)); @@ -121,7 +121,7 @@ unsigned int scan_static_bus(device_t bus, unsigned int max) return max; } -static void root_dev_enable_resources(device_t dev) +static void root_dev_enable_resources(struct device *dev) { } @@ -134,12 +134,12 @@ static void root_dev_enable_resources(device_t dev) * @param max The current bus number scanned so far, usually 0x00. * @return The largest bus number used. */ -static unsigned int root_dev_scan_bus(device_t root, unsigned int max) +static unsigned int root_dev_scan_bus(struct device *root, unsigned int max) { return scan_static_bus(root, max); } -static void root_dev_init(device_t root) +static void root_dev_init(struct device *root) { } diff --git a/src/device/smbus_ops.c b/src/device/smbus_ops.c index 41b31ed..547d144 100644 --- a/src/device/smbus_ops.c +++ b/src/device/smbus_ops.c @@ -25,7 +25,7 @@ #include <device/path.h> #include <device/smbus.h> -struct bus *get_pbus_smbus(device_t dev) +struct bus *get_pbus_smbus(struct device *dev) { struct bus *pbus = dev->bus; @@ -51,7 +51,7 @@ struct bus *get_pbus_smbus(device_t dev) * * @param dev TODO. */ -int smbus_set_link(device_t dev) +int smbus_set_link(struct device *dev) { struct bus *pbus_a[4]; // 4 level mux only. Enough? struct bus *pbus = dev->bus; @@ -87,70 +87,70 @@ int smbus_set_link(device_t dev) } -int smbus_quick_read(device_t dev) +int smbus_quick_read(struct device *dev) { CHECK_PRESENCE(quick_read); return ops_smbus_bus(get_pbus_smbus(dev))->quick_read(dev); } -int smbus_quick_write(device_t dev) +int smbus_quick_write(struct device *dev) { CHECK_PRESENCE(quick_write); return ops_smbus_bus(get_pbus_smbus(dev))->quick_write(dev); } -int smbus_recv_byte(device_t dev) +int smbus_recv_byte(struct device *dev) { CHECK_PRESENCE(recv_byte); return ops_smbus_bus(get_pbus_smbus(dev))->recv_byte(dev); } -int smbus_send_byte(device_t dev, u8 byte) +int smbus_send_byte(struct device *dev, u8 byte) { CHECK_PRESENCE(send_byte); return ops_smbus_bus(get_pbus_smbus(dev))->send_byte(dev, byte); } -int smbus_read_byte(device_t dev, u8 addr) +int smbus_read_byte(struct device *dev, u8 addr) { CHECK_PRESENCE(read_byte); return ops_smbus_bus(get_pbus_smbus(dev))->read_byte(dev, addr); } -int smbus_write_byte(device_t dev, u8 addr, u8 val) +int smbus_write_byte(struct device *dev, u8 addr, u8 val) { CHECK_PRESENCE(write_byte); return ops_smbus_bus(get_pbus_smbus(dev))->write_byte(dev, addr, val); } -int smbus_read_word(device_t dev, u8 addr) +int smbus_read_word(struct device *dev, u8 addr) { CHECK_PRESENCE(read_word); return ops_smbus_bus(get_pbus_smbus(dev))->read_word(dev, addr); } -int smbus_write_word(device_t dev, u8 addr, u16 val) +int smbus_write_word(struct device *dev, u8 addr, u16 val) { CHECK_PRESENCE(write_word); return ops_smbus_bus(get_pbus_smbus(dev))->write_word(dev, addr, val); } -int smbus_process_call(device_t dev, u8 cmd, u16 data) +int smbus_process_call(struct device *dev, u8 cmd, u16 data) { CHECK_PRESENCE(process_call); return ops_smbus_bus(get_pbus_smbus(dev))->process_call(dev, cmd, data); } -int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer) +int smbus_block_read(struct device *dev, u8 cmd, u8 bytes, u8 *buffer) { CHECK_PRESENCE(block_read); @@ -158,7 +158,7 @@ int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer) bytes, buffer); } -int smbus_block_write(device_t dev, u8 cmd, u8 bytes, const u8 *buffer) +int smbus_block_write(struct device *dev, u8 cmd, u8 bytes, const u8 *buffer) { CHECK_PRESENCE(block_write); diff --git a/src/include/cpu/amd/model_fxx_rev.h b/src/include/cpu/amd/model_fxx_rev.h index 1e85596..c3ef4e9 100644 --- a/src/include/cpu/amd/model_fxx_rev.h +++ b/src/include/cpu/amd/model_fxx_rev.h @@ -1,4 +1,5 @@ #include <arch/cpu.h> +#include <arch/io.h> int init_processor_name(void); @@ -59,7 +60,7 @@ static int is_e0_later_in_bsp(int nodeid) return !is_cpu_pre_e0(); } // d0 will be treated as e0 with this methods, but the d0 nb_cfg_54 always 0 - device_t dev; + pci_devfn_t dev; dev = PCI_DEV(0, 0x18+nodeid,2); val_old = pci_read_config32(dev, 0x80); val = val_old; @@ -101,7 +102,7 @@ static inline int is_cpu_pre_f2(void) static inline int is_cpu_f0_in_bsp(int nodeid) { uint32_t dword; - device_t dev; + pci_devfn_t dev; dev = PCI_DEV(0, 0x18+nodeid, 3); dword = pci_read_config32(dev, 0xfc); return (dword & 0xfff00) == 0x40f00; @@ -109,7 +110,7 @@ static inline int is_cpu_f0_in_bsp(int nodeid) static inline int is_cpu_pre_f2_in_bsp(int nodeid) { uint32_t dword; - device_t dev; + pci_devfn_t dev; dev = PCI_DEV(0, 0x18+nodeid, 3); dword = pci_read_config32(dev, 0xfc); return (dword & 0xfff0f) < 0x40f02; diff --git a/src/include/device/agp.h b/src/include/device/agp.h index be2b833..b3791fe 100644 --- a/src/include/device/agp.h +++ b/src/include/device/agp.h @@ -7,7 +7,7 @@ unsigned int agp_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max); -unsigned int agp_scan_bridge(device_t dev, unsigned int max); +unsigned int agp_scan_bridge(struct device *dev, unsigned int max); extern struct device_operations default_agp_ops_bus; diff --git a/src/include/device/cardbus.h b/src/include/device/cardbus.h index 45ae24f..4443c15 100644 --- a/src/include/device/cardbus.h +++ b/src/include/device/cardbus.h @@ -5,8 +5,8 @@ #include <device/device.h> -void cardbus_read_resources(device_t dev); -void cardbus_enable_resources(device_t dev); +void cardbus_read_resources(struct device *dev); +void cardbus_enable_resources(struct device *dev); extern struct device_operations default_cardbus_ops_bus; diff --git a/src/include/device/device.h b/src/include/device/device.h index c67205c..fe8dbed 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -41,19 +41,19 @@ struct smbios_type11; struct acpi_rsdp; struct device_operations { - void (*read_resources)(device_t dev); - void (*set_resources)(device_t dev); - void (*enable_resources)(device_t dev); - void (*init)(device_t dev); - void (*final)(device_t dev); - unsigned int (*scan_bus)(device_t bus, unsigned int _max); - void (*enable)(device_t dev); - void (*disable)(device_t dev); - void (*set_link)(device_t dev, unsigned int link); + void (*read_resources)(struct device *dev); + void (*set_resources)(struct device *dev); + void (*enable_resources)(struct device *dev); + void (*init)(struct device *dev); + void (*final)(struct device *dev); + unsigned int (*scan_bus)(struct device *bus, unsigned int _max); + void (*enable)(struct device *dev); + void (*disable)(struct device *dev); + void (*set_link)(struct device *dev, unsigned int link); void (*reset_bus)(struct bus *bus); #if CONFIG_GENERATE_SMBIOS_TABLES - int (*get_smbios_data)(device_t dev, int *handle, unsigned long *current); - void (*get_smbios_strings)(device_t dev, struct smbios_type11 *t); + int (*get_smbios_data)(struct device *dev, int *handle, unsigned long *current); + void (*get_smbios_strings)(struct device *dev, struct smbios_type11 *t); #endif #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) unsigned long (*write_acpi_tables)(unsigned long start, struct acpi_rsdp *rsdp); @@ -62,7 +62,7 @@ struct device_operations { #endif const struct pci_operations *ops_pci; const struct smbus_bus_operations *ops_smbus_bus; - const struct pci_bus_operations * (*ops_pci_bus)(device_t dev); + const struct pci_bus_operations * (*ops_pci_bus)(struct device *dev); const struct pnp_mode_ops *ops_pnp_mode; }; @@ -76,9 +76,8 @@ static inline void device_noop(struct device *dev) {} struct bus { - - ROMSTAGE_CONST struct device * dev; /* This bridge device */ - ROMSTAGE_CONST struct device * children; /* devices behind this bridge */ + ROMSTAGE_CONST struct device *dev; /* This bridge device */ + ROMSTAGE_CONST struct device *children; /* devices behind this bridge */ ROMSTAGE_CONST struct bus *next; /* The next bridge on this device */ unsigned bridge_ctrl; /* Bridge control register */ unsigned char link_num; /* The index of this link */ @@ -98,7 +97,7 @@ struct pci_irq_info { unsigned int ioapic_irq_pin; unsigned int ioapic_src_pin; unsigned int ioapic_dst_id; - unsigned int ioapic_flags; + unsigned int ioapic_flags; }; struct device { @@ -159,7 +158,7 @@ extern uint64_t uma_memory_size; #endif /* Generic device interface functions */ -device_t alloc_dev(struct bus *parent, struct device_path *path); +struct device *alloc_dev(struct bus *parent, struct device_path *path); void dev_initialize_chips(void); void dev_enumerate(void); void dev_configure(void); @@ -175,30 +174,30 @@ unsigned int scan_bus(struct device *bus, unsigned int _max); void assign_resources(struct bus *bus); void enumerate_static_device(void); void enumerate_static_devices(void); -const char *dev_name(device_t dev); -const char *dev_path(device_t dev); -u32 dev_path_encode(device_t dev); +const char *dev_name(struct device *dev); +const char *dev_path(struct device *dev); +u32 dev_path_encode(struct device *dev); const char *bus_path(struct bus *bus); -void dev_set_enabled(device_t dev, int enable); +void dev_set_enabled(struct device *dev, int enable); void disable_children(struct bus *bus); /* Option ROM helper functions */ void run_bios(struct device *dev, unsigned long addr); /* Helper functions */ -device_t find_dev_path(struct bus *parent, struct device_path *path); -device_t alloc_find_dev(struct bus *parent, struct device_path *path); -device_t dev_find_device (u16 vendor, u16 device, device_t from); -device_t dev_find_class (unsigned int class, device_t from); -device_t dev_find_slot (unsigned int bus, unsigned int devfn); -device_t dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); -device_t dev_find_slot_pnp(u16 port, u16 device); -device_t dev_find_lapic(unsigned apic_id); +struct device *find_dev_path(struct bus *parent, struct device_path *path); +struct device *alloc_find_dev(struct bus *parent, struct device_path *path); +struct device *dev_find_device (u16 vendor, u16 device, struct device *from); +struct device *dev_find_class (unsigned int class, struct device *from); +struct device *dev_find_slot (unsigned int bus, unsigned int devfn); +struct device *dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); +struct device *dev_find_slot_pnp(u16 port, u16 device); +struct device *dev_find_lapic(unsigned apic_id); int dev_count_cpu(void); void remap_bsp_lapic(struct bus *cpu_bus); -device_t add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled); -void set_cpu_topology(device_t cpu, unsigned node, unsigned package, unsigned core, unsigned thread); +struct device *add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled); +void set_cpu_topology(struct device *cpu, unsigned node, unsigned package, unsigned core, unsigned thread); #define amd_cpu_topology(cpu, node, core) \ set_cpu_topology(cpu, node, 0, core, 0) @@ -207,7 +206,7 @@ void set_cpu_topology(device_t cpu, unsigned node, unsigned package, unsigned co set_cpu_topology(cpu, 0, package, core, thread) /* Debug functions */ -void print_resource_tree(struct device * root, int debug_level, +void print_resource_tree(struct device *root, int debug_level, const char *msg); void show_devs_tree(struct device *dev, int debug_level, int depth, int linknum); void show_devs_subtree(struct device *root, int debug_level, const char *msg); @@ -226,9 +225,9 @@ void show_all_devs_resources(int debug_level, const char* msg); extern struct device_operations default_dev_ops_root; void pci_domain_read_resources(struct device *dev); unsigned int pci_domain_scan_bus(struct device *dev, unsigned int _max); -unsigned int scan_static_bus(device_t bus, unsigned int _max); +unsigned int scan_static_bus(struct device *bus, unsigned int _max); -void fixed_mem_resource(device_t dev, unsigned long index, +void fixed_mem_resource(struct device *dev, unsigned long index, unsigned long basek, unsigned long sizek, unsigned long type); @@ -257,7 +256,7 @@ u32 find_pci_tolm(struct bus *bus); ROMSTAGE_CONST struct device * dev_find_slot (unsigned int bus, unsigned int devfn); -ROMSTAGE_CONST struct device *dev_find_next_pci_device( +ROMSTAGE_CONST struct device * dev_find_next_pci_device( ROMSTAGE_CONST struct device *previous_dev); ROMSTAGE_CONST struct device * dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); diff --git a/src/include/device/pci.h b/src/include/device/pci.h index 0670da4..3688322 100644 --- a/src/include/device/pci.h +++ b/src/include/device/pci.h @@ -32,7 +32,7 @@ /* Common pci operations without a standard interface */ struct pci_operations { /* set the Subsystem IDs for the PCI device */ - void (*set_subsystem)(device_t dev, unsigned vendor, unsigned device); + void (*set_subsystem)(struct device *dev, unsigned vendor, unsigned device); }; /* Common pci bus operations */ @@ -62,35 +62,35 @@ extern struct pci_driver epci_drivers[]; extern struct device_operations default_pci_ops_dev; extern struct device_operations default_pci_ops_bus; -void pci_dev_read_resources(device_t dev); -void pci_bus_read_resources(device_t dev); -void pci_dev_set_resources(device_t dev); -void pci_dev_enable_resources(device_t dev); -void pci_bus_enable_resources(device_t dev); +void pci_dev_read_resources(struct device *dev); +void pci_bus_read_resources(struct device *dev); +void pci_dev_set_resources(struct device *dev); +void pci_dev_enable_resources(struct device *dev); +void pci_bus_enable_resources(struct device *dev); void pci_bus_reset(struct bus *bus); -device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn); -unsigned int do_pci_scan_bridge(device_t bus, unsigned int max, +struct device *pci_probe_dev(struct device *dev, struct bus *bus, unsigned devfn); +unsigned int do_pci_scan_bridge(struct device *bus, unsigned int max, unsigned int (*do_scan_bus)(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max)); -unsigned int pci_scan_bridge(device_t bus, unsigned int max); +unsigned int pci_scan_bridge(struct device *bus, unsigned int max); unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max); uint8_t pci_moving_config8(struct device *dev, unsigned reg); uint16_t pci_moving_config16(struct device *dev, unsigned reg); uint32_t pci_moving_config32(struct device *dev, unsigned reg); struct resource *pci_get_resource(struct device *dev, unsigned long index); -void pci_dev_set_subsystem(device_t dev, unsigned vendor, unsigned device); +void pci_dev_set_subsystem(struct device *dev, unsigned vendor, unsigned device); void pci_dev_init(struct device *dev); -unsigned int pci_match_simple_dev(device_t dev, pci_devfn_t sdev); +unsigned int pci_match_simple_dev(struct device *dev, pci_devfn_t sdev); const char * pin_to_str(int pin); -int get_pci_irq_pins(device_t dev, device_t *parent_bdg); +int get_pci_irq_pins(struct device *dev, struct device **parent_bdg); void pci_assign_irqs(unsigned bus, unsigned slot, const unsigned char pIntAtoD[4]); #define PCI_IO_BRIDGE_ALIGN 4096 #define PCI_MEM_BRIDGE_ALIGN (1024*1024) -static inline const struct pci_operations *ops_pci(device_t dev) +static inline const struct pci_operations *ops_pci(struct device *dev) { const struct pci_operations *pops; pops = 0; @@ -106,8 +106,8 @@ static inline const struct pci_operations *ops_pci(device_t dev) unsigned pci_find_next_capability(pci_devfn_t dev, unsigned cap, unsigned last); unsigned pci_find_capability(pci_devfn_t dev, unsigned cap); #else /* !__PRE_RAM__ */ -unsigned pci_find_next_capability(device_t dev, unsigned cap, unsigned last); -unsigned pci_find_capability(device_t dev, unsigned cap); +unsigned pci_find_next_capability(struct device *dev, unsigned cap, unsigned last); +unsigned pci_find_capability(struct device *dev, unsigned cap); #endif /* __PRE_RAM__ */ void pci_early_bridge_init(void); diff --git a/src/include/device/pciexp.h b/src/include/device/pciexp.h index 87a5002..c7ff4f5 100644 --- a/src/include/device/pciexp.h +++ b/src/include/device/pciexp.h @@ -11,7 +11,7 @@ enum aspm_type { unsigned int pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max); -unsigned int pciexp_scan_bridge(device_t dev, unsigned int max); +unsigned int pciexp_scan_bridge(struct device *dev, unsigned int max); extern struct device_operations default_pciexp_ops_bus; diff --git a/src/include/device/pcix.h b/src/include/device/pcix.h index 4ffab5b..8cc83df 100644 --- a/src/include/device/pcix.h +++ b/src/include/device/pcix.h @@ -4,7 +4,7 @@ unsigned int pcix_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max); -unsigned int pcix_scan_bridge(device_t dev, unsigned int max); +unsigned int pcix_scan_bridge(struct device *dev, unsigned int max); const char *pcix_speed(u16 sstatus); extern struct device_operations default_pcix_ops_bus; diff --git a/src/include/device/pnp.h b/src/include/device/pnp.h index d0d6fa3..9290056 100644 --- a/src/include/device/pnp.h +++ b/src/include/device/pnp.h @@ -9,21 +9,21 @@ #ifndef __SIMPLE_DEVICE__ /* Primitive PNP resource manipulation */ -void pnp_write_config(device_t dev, u8 reg, u8 value); -u8 pnp_read_config(device_t dev, u8 reg); -void pnp_set_logical_device(device_t dev); -void pnp_set_enable(device_t dev, int enable); -int pnp_read_enable(device_t dev); -void pnp_set_iobase(device_t dev, u8 index, u16 iobase); -void pnp_set_irq(device_t dev, u8 index, u8 irq); -void pnp_set_drq(device_t dev, u8 index, u8 drq); +void pnp_write_config(struct device *dev, u8 reg, u8 value); +u8 pnp_read_config(struct device *dev, u8 reg); +void pnp_set_logical_device(struct device *dev); +void pnp_set_enable(struct device *dev, int enable); +int pnp_read_enable(struct device *dev); +void pnp_set_iobase(struct device *dev, u8 index, u16 iobase); +void pnp_set_irq(struct device *dev, u8 index, u8 irq); +void pnp_set_drq(struct device *dev, u8 index, u8 drq); /* PNP device operations */ -void pnp_read_resources(device_t dev); -void pnp_set_resources(device_t dev); -void pnp_enable_resources(device_t dev); -void pnp_enable(device_t dev); -void pnp_alt_enable(device_t dev); +void pnp_read_resources(struct device *dev); +void pnp_set_resources(struct device *dev); +void pnp_enable_resources(struct device *dev); +void pnp_enable(struct device *dev); +void pnp_alt_enable(struct device *dev); extern struct device_operations pnp_ops; @@ -52,16 +52,16 @@ struct pnp_info { #define PNP_MSC10 0x1000 struct io_info io0, io1, io2, io3; }; -struct resource *pnp_get_resource(device_t dev, unsigned index); +struct resource *pnp_get_resource(struct device *dev, unsigned index); void pnp_enable_devices(struct device *dev, struct device_operations *ops, unsigned int functions, struct pnp_info *info); struct pnp_mode_ops { - void (*enter_conf_mode)(device_t dev); - void (*exit_conf_mode)(device_t dev); + void (*enter_conf_mode)(struct device *dev); + void (*exit_conf_mode)(struct device *dev); }; -void pnp_enter_conf_mode(device_t dev); -void pnp_exit_conf_mode(device_t dev); +void pnp_enter_conf_mode(struct device *dev); +void pnp_exit_conf_mode(struct device *dev); #endif /* ! __SIMPLE_DEVICE__ */ -#endif /* DEVICE_PNP_H */ +#endif /*devICE_PNP_H */ diff --git a/src/include/device/smbus.h b/src/include/device/smbus.h index 073d7e2..7002459 100644 --- a/src/include/device/smbus.h +++ b/src/include/device/smbus.h @@ -8,17 +8,17 @@ /* Common SMBus bus operations */ struct smbus_bus_operations { - int (*quick_read) (device_t dev); - int (*quick_write) (device_t dev); - int (*recv_byte) (device_t dev); - int (*send_byte) (device_t dev, u8 value); - int (*read_byte) (device_t dev, u8 addr); - int (*write_byte) (device_t dev, u8 addr, u8 value); - int (*read_word) (device_t dev, u8 addr); - int (*write_word) (device_t dev, u8 addr, u16 value); - int (*process_call)(device_t dev, u8 cmd, u16 data); - int (*block_read) (device_t dev, u8 cmd, u8 bytes, u8 *buffer); - int (*block_write) (device_t dev, u8 cmd, u8 bytes, const u8 *buffer); + int (*quick_read) (struct device *dev); + int (*quick_write) (struct device *dev); + int (*recv_byte) (struct device *dev); + int (*send_byte) (struct device *dev, u8 value); + int (*read_byte) (struct device *dev, u8 addr); + int (*write_byte) (struct device *dev, u8 addr, u8 value); + int (*read_word) (struct device *dev, u8 addr); + int (*write_word) (struct device *dev, u8 addr, u16 value); + int (*process_call)(struct device *dev, u8 cmd, u16 data); + int (*block_read) (struct device *dev, u8 cmd, u8 bytes, u8 *buffer); + int (*block_write) (struct device *dev, u8 cmd, u8 bytes, const u8 *buffer); }; static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus) @@ -32,19 +32,19 @@ static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus) return bops; } -struct bus *get_pbus_smbus(device_t dev); -int smbus_set_link(device_t dev); - -int smbus_quick_read(device_t dev); -int smbus_quick_write(device_t dev); -int smbus_recv_byte(device_t dev); -int smbus_send_byte(device_t dev, u8 byte); -int smbus_read_byte(device_t dev, u8 addr); -int smbus_write_byte(device_t dev, u8 addr, u8 val); -int smbus_read_word(device_t dev, u8 addr); -int smbus_write_word(device_t dev, u8 addr, u16 val); -int smbus_process_call(device_t dev, u8 cmd, u16 data); -int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer); -int smbus_block_write(device_t dev, u8 cmd, u8 bytes, const u8 *buffer); - -#endif /* DEVICE_SMBUS_H */ +struct bus *get_pbus_smbus(struct device *dev); +int smbus_set_link(struct device *dev); + +int smbus_quick_read(struct device *dev); +int smbus_quick_write(struct device *dev); +int smbus_recv_byte(struct device *dev); +int smbus_send_byte(struct device *dev, u8 byte); +int smbus_read_byte(struct device *dev, u8 addr); +int smbus_write_byte(struct device *dev, u8 addr, u8 val); +int smbus_read_word(struct device *dev, u8 addr); +int smbus_write_word(struct device *dev, u8 addr, u16 val); +int smbus_process_call(struct device *dev, u8 cmd, u16 data); +int smbus_block_read(struct device *dev, u8 cmd, u8 bytes, u8 *buffer); +int smbus_block_write(struct device *dev, u8 cmd, u8 bytes, const u8 *buffer); + +#endif /*devICE_SMBUS_H */
1
0
0
0
Patch set updated for coreboot: e48cd7d device: Clarify correct typing of 'struct device *'
by Edward O'Callaghan
05 Nov '14
05 Nov '14
Edward O'Callaghan (eocallaghan(a)alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/7138
-gerrit commit e48cd7d1acdb3624011d5af91322096a78341fd8 Author: Edward O'Callaghan <eocallaghan(a)alterapraxis.com> Date: Sat Nov 1 13:55:04 2014 +1100 device: Clarify correct typing of 'struct device *' Disambiguate 'device_t' into 'struct device *', 'pci_devfn_t' and 'pnp_devfn_t' component types where appropriate. Change-Id: Ic4239efe0462d86694bf4ac0ec898f589b6adf1c Signed-off-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com> --- src/device/agp_device.c | 6 +-- src/device/cardbus_device.c | 8 ++-- src/device/cpu_device.c | 8 ++-- src/device/device.c | 14 +++---- src/device/device_romstage.c | 2 +- src/device/device_util.c | 35 ++++++++-------- src/device/hypertransport.c | 20 +++++---- src/device/oprom/yabel/biosemu.c | 2 +- src/device/oprom/yabel/compat/functions.c | 2 +- src/device/oprom/yabel/device.c | 2 +- src/device/oprom/yabel/io.c | 2 +- src/device/pci_device.c | 22 +++++----- src/device/pci_ops.c | 2 +- src/device/pci_rom.c | 2 +- src/device/pciexp_device.c | 22 +++++----- src/device/pcix_device.c | 6 +-- src/device/pnp_device.c | 40 +++++++++--------- src/device/root_device.c | 14 +++---- src/device/smbus_ops.c | 26 ++++++------ src/include/cpu/amd/model_fxx_rev.h | 7 ++-- src/include/device/agp.h | 2 +- src/include/device/cardbus.h | 4 +- src/include/device/device.h | 69 +++++++++++++++---------------- src/include/device/pci.h | 30 +++++++------- src/include/device/pciexp.h | 2 +- src/include/device/pcix.h | 2 +- src/include/device/pnp.h | 38 ++++++++--------- src/include/device/smbus.h | 54 ++++++++++++------------ src/include/reg_script.h | 6 +-- 29 files changed, 227 insertions(+), 222 deletions(-) diff --git a/src/device/agp_device.c b/src/device/agp_device.c index 550297a..fc23fe6 100644 --- a/src/device/agp_device.c +++ b/src/device/agp_device.c @@ -24,7 +24,7 @@ #include <device/pci_ids.h> #include <device/agp.h> -static void agp_tune_dev(device_t dev) +static void agp_tune_dev(struct device *dev) { unsigned int cap; @@ -38,7 +38,7 @@ static void agp_tune_dev(device_t dev) unsigned int agp_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max) { - device_t child; + struct device *child; max = pci_scan_bus(bus, min_devfn, max_devfn, max); @@ -53,7 +53,7 @@ unsigned int agp_scan_bus(struct bus *bus, unsigned int min_devfn, return max; } -unsigned int agp_scan_bridge(device_t dev, unsigned int max) +unsigned int agp_scan_bridge(struct device *dev, unsigned int max) { return do_pci_scan_bridge(dev, max, agp_scan_bus); } diff --git a/src/device/cardbus_device.c b/src/device/cardbus_device.c index f25f96c..e32ece3 100644 --- a/src/device/cardbus_device.c +++ b/src/device/cardbus_device.c @@ -38,7 +38,7 @@ #define CARDBUS_IO_SIZE 4096 #define CARDBUS_MEM_SIZE (32 * 1024 * 1024) -static void cardbus_record_bridge_resource(device_t dev, resource_t moving, +static void cardbus_record_bridge_resource(struct device *dev, resource_t moving, resource_t min_size, unsigned int index, unsigned long type) { struct resource *resource; @@ -70,7 +70,7 @@ static void cardbus_record_bridge_resource(device_t dev, resource_t moving, resource->size = min_size; } -static void cardbus_size_bridge_resource(device_t dev, unsigned int index) +static void cardbus_size_bridge_resource(struct device *dev, unsigned int index) { struct resource *resource; resource_t min_size; @@ -87,7 +87,7 @@ static void cardbus_size_bridge_resource(device_t dev, unsigned int index) } } -void cardbus_read_resources(device_t dev) +void cardbus_read_resources(struct device *dev) { resource_t moving_base, moving_limit, moving; unsigned long type; @@ -153,7 +153,7 @@ void cardbus_read_resources(device_t dev) compact_resources(dev); } -void cardbus_enable_resources(device_t dev) +void cardbus_enable_resources(struct device *dev) { u16 ctrl; diff --git a/src/device/cpu_device.c b/src/device/cpu_device.c index e76b539..7152d02 100644 --- a/src/device/cpu_device.c +++ b/src/device/cpu_device.c @@ -25,7 +25,7 @@ void remap_bsp_lapic(struct bus *cpu_bus) { struct device_path cpu_path; - device_t cpu; + struct device *cpu; u32 bsp_lapic_id = lapicid(); if (bsp_lapic_id) { @@ -37,10 +37,10 @@ void remap_bsp_lapic(struct bus *cpu_bus) } } -device_t add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled) +struct device *add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled) { struct device_path cpu_path; - device_t cpu; + struct device *cpu; /* Build the cpu device path */ cpu_path.type = DEVICE_PATH_APIC; @@ -61,7 +61,7 @@ device_t add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled) return cpu; } -void set_cpu_topology(device_t cpu, unsigned node, unsigned package, unsigned core, unsigned thread) +void set_cpu_topology(struct device *cpu, unsigned node, unsigned package, unsigned core, unsigned thread) { cpu->path.apic.node_id = node; cpu->path.apic.package_id = package; diff --git a/src/device/device.c b/src/device/device.c index e068cee..04fc725 100644 --- a/src/device/device.c +++ b/src/device/device.c @@ -114,9 +114,9 @@ uint64_t uma_memory_size = 0; * * @see device_path */ -static device_t __alloc_dev(struct bus *parent, struct device_path *path) +static struct device *__alloc_dev(struct bus *parent, struct device_path *path) { - device_t dev, child; + struct device *dev, *child; /* Find the last child of our parent. */ for (child = parent->children; child && child->sibling; /* */ ) @@ -148,9 +148,9 @@ static device_t __alloc_dev(struct bus *parent, struct device_path *path) return dev; } -device_t alloc_dev(struct bus *parent, struct device_path *path) +struct device *alloc_dev(struct bus *parent, struct device_path *path) { - device_t dev; + struct device *dev; spin_lock(&dev_lock); dev = __alloc_dev(parent, path); spin_unlock(&dev_lock); @@ -164,9 +164,9 @@ device_t alloc_dev(struct bus *parent, struct device_path *path) * @param path The relative path from the bus to the appropriate device. * @return Pointer to a device structure for the device on bus at path. */ -device_t alloc_find_dev(struct bus *parent, struct device_path *path) +struct device *alloc_find_dev(struct bus *parent, struct device_path *path) { - device_t child; + struct device *child; spin_lock(&dev_lock); child = find_dev_path(parent, path); if (!child) @@ -750,7 +750,7 @@ static void avoid_fixed_resources(struct device *dev) } } -device_t vga_pri = 0; +struct device *vga_pri = NULL; static void set_vga_bridge_bits(void) { /* diff --git a/src/device/device_romstage.c b/src/device/device_romstage.c index 987fdad..0c81d60 100644 --- a/src/device/device_romstage.c +++ b/src/device/device_romstage.c @@ -28,7 +28,7 @@ #include <device/resource.h> /** Linked list of ALL devices */ -ROMSTAGE_CONST struct device * ROMSTAGE_CONST all_devices = &dev_root; +ROMSTAGE_CONST struct device *ROMSTAGE_CONST all_devices = &dev_root; /** * Given a PCI bus and a devfn number, find the device structure. diff --git a/src/device/device_util.c b/src/device/device_util.c index d5466cb..2bdaff3 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -37,9 +37,9 @@ * @return Pointer to a device structure for the device on bus at path * or 0/NULL if no device is found. */ -device_t find_dev_path(struct bus *parent, struct device_path *path) +struct device *find_dev_path(struct bus *parent, struct device_path *path) { - device_t child; + struct device *child; for (child = parent->children; child; child = child->sibling) { if (path_eq(path, &child->path)) break; @@ -120,9 +120,10 @@ struct device *dev_find_slot_pnp(u16 port, u16 device) * @param apic_id The Local APIC ID number. * @return Pointer to the device structure (if found), 0 otherwise. */ -device_t dev_find_lapic(unsigned apic_id) +struct device *dev_find_lapic(unsigned apic_id) { - device_t dev, result = NULL; + struct device *dev = NULL; + struct device *result = NULL; for (dev = all_devices; dev; dev = dev->next) { if (dev->path.type == DEVICE_PATH_APIC && @@ -185,7 +186,7 @@ struct device *dev_find_class(unsigned int class, struct device *from) * @param dev The device path to encode. * @return Device path encoded into lower 3 bytes of dword. */ -u32 dev_path_encode(device_t dev) +u32 dev_path_encode(struct device *dev) { u32 ret; @@ -238,7 +239,7 @@ u32 dev_path_encode(device_t dev) * Warning: This function uses a static buffer. Don't call it more than once * from the same print statement! */ -const char *dev_path(device_t dev) +const char *dev_path(struct device *dev) { static char buffer[DEVICE_PATH_MAX]; @@ -308,7 +309,7 @@ const char *dev_path(device_t dev) return buffer; } -const char *dev_name(device_t dev) +const char *dev_name(struct device *dev) { if (dev->name) return dev->name; @@ -405,7 +406,7 @@ static int allocate_more_resources(void) * @param prev TODO * @return TODO. */ -static void free_resource(device_t dev, struct resource *res, +static void free_resource(struct device *dev, struct resource *res, struct resource *prev) { if (prev) @@ -424,7 +425,7 @@ static void free_resource(device_t dev, struct resource *res, * * @param dev The device to find the resource on. */ -void compact_resources(device_t dev) +void compact_resources(struct device *dev) { struct resource *res, *next, *prev = NULL; @@ -445,7 +446,7 @@ void compact_resources(device_t dev) * @param index The index of the resource on the device. * @return The resource, if it already exists. */ -struct resource *probe_resource(device_t dev, unsigned index) +struct resource *probe_resource(struct device *dev, unsigned index) { struct resource *res; @@ -468,7 +469,7 @@ struct resource *probe_resource(device_t dev, unsigned index) * @param index The index of the resource on the device. * @return TODO. */ -struct resource *new_resource(device_t dev, unsigned index) +struct resource *new_resource(struct device *dev, unsigned index) { struct resource *resource, *tail; @@ -515,7 +516,7 @@ struct resource *new_resource(device_t dev, unsigned index) * @param index The index of the resource on the device. * return TODO. */ -struct resource *find_resource(device_t dev, unsigned index) +struct resource *find_resource(struct device *dev, unsigned index) { struct resource *resource; @@ -629,7 +630,7 @@ const char *resource_type(struct resource *resource) * @param resource The resource that was just stored. * @param comment TODO */ -void report_resource_stored(device_t dev, struct resource *resource, +void report_resource_stored(struct device *dev, struct resource *resource, const char *comment) { char buf[10]; @@ -721,7 +722,7 @@ void search_global_resources(unsigned long type_mask, unsigned long type, } } -void dev_set_enabled(device_t dev, int enable) +void dev_set_enabled(struct device *dev, int enable) { if (dev->enabled == enable) return; @@ -736,7 +737,7 @@ void dev_set_enabled(device_t dev, int enable) void disable_children(struct bus *bus) { - device_t child; + struct device *child; for (child = bus->children; child; child = child->sibling) { struct bus *link; @@ -890,7 +891,7 @@ void show_all_devs_resources(int debug_level, const char* msg) } } -void fixed_mem_resource(device_t dev, unsigned long index, +void fixed_mem_resource(struct device *dev, unsigned long index, unsigned long basek, unsigned long sizek, unsigned long type) { struct resource *resource; @@ -939,7 +940,7 @@ u32 find_pci_tolm(struct bus *bus) /* Count of enabled CPUs */ int dev_count_cpu(void) { - device_t cpu; + struct device *cpu; int count = 0; for (cpu = all_devices; cpu; cpu = cpu->next) { diff --git a/src/device/hypertransport.c b/src/device/hypertransport.c index d9ab486..030ddea 100644 --- a/src/device/hypertransport.c +++ b/src/device/hypertransport.c @@ -41,9 +41,10 @@ #include <cpu/amd/model_fxx_rev.h> #endif -static device_t ht_scan_get_devs(device_t *old_devices) +static struct device *ht_scan_get_devs(struct device * *old_devices) { - device_t first, last; + struct device *first; + struct device *last; first = *old_devices; last = first; @@ -60,7 +61,7 @@ static device_t ht_scan_get_devs(device_t *old_devices) } if (first) { - device_t child; + struct device *child; /* Unlink the chain from the list of old devices. */ *old_devices = last->sibling; @@ -81,7 +82,7 @@ static device_t ht_scan_get_devs(device_t *old_devices) } #if OPT_HT_LINK == 1 -static unsigned ht_read_freq_cap(device_t dev, unsigned pos) +static unsigned ht_read_freq_cap(struct device *dev, unsigned pos) { /* Handle bugs in valid hypertransport frequency reporting. */ unsigned freq_cap; @@ -126,7 +127,7 @@ struct ht_link { unsigned char ctrl_off, config_off, freq_off, freq_cap_off; }; -static int ht_setup_link(struct ht_link *prev, device_t dev, unsigned pos) +static int ht_setup_link(struct ht_link *prev, struct device *dev, unsigned pos) { #if OPT_HT_LINK == 1 static const u8 link_width_to_pow2[] = { 3, 4, 0, 5, 1, 2, 0, 0 }; @@ -420,7 +421,10 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned min_devfn, * optimize link. */ unsigned int next_unitid, last_unitid, min_unitid, max_unitid; - device_t old_devices, dev, func, last_func = 0; + struct device *old_devices; + struct device *dev; + struct device *func; + struct device *last_func = NULL; struct ht_link prev; int ht_dev_num = 0; @@ -433,7 +437,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned min_devfn, */ unsigned int real_last_unitid = 0, end_used = 0; u8 real_last_pos = 0; - device_t real_last_dev = NULL; + struct device *real_last_dev = NULL; #endif /* Restore the hypertransport chain to it's uninitialized state. */ @@ -627,7 +631,7 @@ end_of_chain: * a problem in devicetree.cb. */ if (old_devices) { - device_t left; + struct device *left; for (left = old_devices; left; left = left->sibling) printk(BIOS_DEBUG, "%s\n", dev_path(left)); diff --git a/src/device/oprom/yabel/biosemu.c b/src/device/oprom/yabel/biosemu.c index d27a5f1..86197a8 100644 --- a/src/device/oprom/yabel/biosemu.c +++ b/src/device/oprom/yabel/biosemu.c @@ -62,7 +62,7 @@ mainboard_interrupt_handlers(int interrupt, yabel_handleIntFunc func) * will look for an ExpansionROM BAR and use the code from there. */ u32 -biosemu(u8 *biosmem, u32 biosmem_size, struct device * dev, unsigned long rom_addr) +biosemu(u8 *biosmem, u32 biosmem_size, struct device *dev, unsigned long rom_addr) { u8 *rom_image; int i = 0; diff --git a/src/device/oprom/yabel/compat/functions.c b/src/device/oprom/yabel/compat/functions.c index 27d0413..a132946 100644 --- a/src/device/oprom/yabel/compat/functions.c +++ b/src/device/oprom/yabel/compat/functions.c @@ -35,7 +35,7 @@ u8* vmem = NULL; extern u8 *biosmem; -void run_bios(struct device * dev, unsigned long addr) +void run_bios(struct device *dev, unsigned long addr) { biosmem = vmem; diff --git a/src/device/oprom/yabel/device.c b/src/device/oprom/yabel/device.c index 2f41847..37e6020 100644 --- a/src/device/oprom/yabel/device.c +++ b/src/device/oprom/yabel/device.c @@ -407,7 +407,7 @@ biosemu_dev_check_exprom(unsigned long rom_base_addr) } u8 -biosemu_dev_init(struct device * device) +biosemu_dev_init(struct device *device) { u8 rval = 0; //init bios_device struct diff --git a/src/device/oprom/yabel/io.c b/src/device/oprom/yabel/io.c index 08189a9..2d38ad7 100644 --- a/src/device/oprom/yabel/io.c +++ b/src/device/oprom/yabel/io.c @@ -390,7 +390,7 @@ u32 pci_cfg_read(X86EMU_pioAddr addr, u8 size) { u32 rval = 0xFFFFFFFF; - struct device * dev; + struct device *dev; if ((addr >= 0xCFC) && ((addr + size) <= 0xD00)) { // PCI Configuration Mechanism 1 step 1 // write to 0xCF8, sets bus, device, function and Config Space offset diff --git a/src/device/pci_device.c b/src/device/pci_device.c index 8351e9c..e82cb5c 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -157,7 +157,7 @@ unsigned pci_find_next_capability(struct device *dev, unsigned cap, * @param cap PCI_CAP_LIST_ID of the PCI capability we're looking for. * @return The next matching capability. */ -unsigned pci_find_capability(device_t dev, unsigned cap) +unsigned pci_find_capability(struct device *dev, unsigned cap) { return pci_find_next_capability(dev, cap, 0); } @@ -761,7 +761,7 @@ struct device_operations default_pci_ops_bus = { * @param dev Pointer to the device structure of the bridge. * @return Appropriate bridge operations. */ -static struct device_operations *get_pci_bridge_ops(device_t dev) +static struct device_operations *get_pci_bridge_ops(struct device *dev) { #if CONFIG_PCIX_PLUGIN_SUPPORT unsigned int pcixpos; @@ -959,7 +959,7 @@ static struct device *pci_scan_get_dev(struct device **list, unsigned int devfn) * @param devfn A device/function number to look at. * @return The device structure for the device (if found), NULL otherwise. */ -device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn) +struct device *pci_probe_dev(struct device * dev, struct bus *bus, unsigned devfn) { u32 id, class; u8 hdr_type; @@ -1066,7 +1066,7 @@ device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn) * @param sdev Simple device model identifier, created with PCI_DEV(). * @return Non-zero if bus:dev.fn of device matches. */ -unsigned int pci_match_simple_dev(device_t dev, pci_devfn_t sdev) +unsigned int pci_match_simple_dev(struct device *dev, pci_devfn_t sdev) { return dev->bus->secondary == PCI_DEV2SEGBUS(sdev) && dev->path.pci.devfn == PCI_DEV2DEVFN(sdev); @@ -1146,7 +1146,7 @@ unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, * There's probably a problem in devicetree.cb. */ if (old_devices) { - device_t left; + struct device *left; printk(BIOS_WARNING, "PCI: Left over static devices:\n"); for (left = old_devices; left; left = left->sibling) printk(BIOS_WARNING, "%s\n", dev_path(left)); @@ -1280,7 +1280,7 @@ unsigned int pci_scan_bridge(struct device *dev, unsigned int max) * @param max The highest bus number assigned up to now. * @return The maximum bus number found, after scanning all subordinate busses. */ -unsigned int pci_domain_scan_bus(device_t dev, unsigned int max) +unsigned int pci_domain_scan_bus(struct device *dev, unsigned int max) { max = pci_scan_bus(dev->link_list, PCI_DEVFN(0, 0), 0xff, max); return max; @@ -1326,10 +1326,10 @@ const char *pin_to_str(int pin) * @return The interrupt pin number (1 - 4) that 'dev' will * trigger when generating an interrupt */ -static int swizzle_irq_pins(device_t dev, device_t *parent_bridge) +static int swizzle_irq_pins(struct device *dev, struct device * *parent_bridge) { - device_t parent; /* Our current device's parent device */ - device_t child; /* The child device of the parent */ + struct device *parent; /* Our current device's parent device */ + struct device *child; /* The child device of the parent */ uint8_t parent_bus = 0; /* Parent Bus number */ uint16_t parent_devfn = 0; /* Parent Device and Function number */ uint16_t child_devfn = 0; /* Child Device and Function number */ @@ -1394,7 +1394,7 @@ static int swizzle_irq_pins(device_t dev, device_t *parent_bridge) * Errors: -1 is returned if the device is not enabled * -2 is returned if a parent bridge could not be found. */ -int get_pci_irq_pins(device_t dev, device_t *parent_bdg) +int get_pci_irq_pins(struct device *dev, struct device * *parent_bdg) { uint8_t bus = 0; /* The bus this device is on */ uint16_t devfn = 0; /* This device's device and function numbers */ @@ -1456,7 +1456,7 @@ void pci_assign_irqs(unsigned bus, unsigned slot, const unsigned char pIntAtoD[4]) { unsigned int funct; - device_t pdev; + struct device *pdev; u8 line, irq; /* Each slot may contain up to eight functions. */ diff --git a/src/device/pci_ops.c b/src/device/pci_ops.c index 6ddb493..73b4242 100644 --- a/src/device/pci_ops.c +++ b/src/device/pci_ops.c @@ -25,7 +25,7 @@ #include <device/pci_ids.h> #include <device/pci_ops.h> -const struct pci_bus_operations *pci_bus_default_ops(device_t dev) +const struct pci_bus_operations *pci_bus_default_ops(struct device *dev) { #if CONFIG_MMCONF_SUPPORT_DEFAULT return &pci_ops_mmconf; diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index 1bdccf0..b7fdde6 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -155,7 +155,7 @@ struct rom_header *pci_rom_load(struct device *dev, */ if (PCI_CLASS_DISPLAY_VGA == (dev->class >> 8)) { #if !CONFIG_MULTIPLE_VGA_ADAPTERS - extern device_t vga_pri; /* Primary VGA device (device.c). */ + extern struct device *vga_pri; /* Primary VGA device (device.c). */ if (dev != vga_pri) return NULL; /* Only one VGA supported. */ #endif if ((void *)PCI_VGA_RAM_IMAGE_START != rom_header) { diff --git a/src/device/pciexp_device.c b/src/device/pciexp_device.c index 87aea67..a38da40 100644 --- a/src/device/pciexp_device.c +++ b/src/device/pciexp_device.c @@ -30,7 +30,7 @@ * Re-train a PCIe link */ #define PCIE_TRAIN_RETRY 10000 -static int pciexp_retrain_link(device_t dev, unsigned cap) +static int pciexp_retrain_link(struct device *dev, unsigned cap) { unsigned try = PCIE_TRAIN_RETRY; u16 lnk; @@ -57,8 +57,8 @@ static int pciexp_retrain_link(device_t dev, unsigned cap) * and enable Common Clock Configuration if possible. If CCC is * enabled the link must be retrained. */ -static void pciexp_enable_common_clock(device_t root, unsigned root_cap, - device_t endp, unsigned endp_cap) +static void pciexp_enable_common_clock(struct device *root, unsigned root_cap, + struct device *endp, unsigned endp_cap) { u16 root_scc, endp_scc, lnkctl; @@ -96,8 +96,8 @@ static void pciexp_enable_common_clock(device_t root, unsigned root_cap, * by checking both root port and endpoint and returning * the highest latency value. */ -static int pciexp_aspm_latency(device_t root, unsigned root_cap, - device_t endp, unsigned endp_cap, +static int pciexp_aspm_latency(struct device *root, unsigned root_cap, + struct device *endp, unsigned endp_cap, enum aspm_type type) { int root_lat = 0, endp_lat = 0; @@ -139,8 +139,8 @@ static int pciexp_aspm_latency(device_t root, unsigned root_cap, * 2 = L1 Enabled * 3 = L0s and L1 Enabled */ -static enum aspm_type pciexp_enable_aspm(device_t root, unsigned root_cap, - device_t endp, unsigned endp_cap) +static enum aspm_type pciexp_enable_aspm(struct device *root, unsigned root_cap, + struct device *endp, unsigned endp_cap) { const char *aspm_type_str[] = { "None", "L0s", "L1", "L0s and L1" }; enum aspm_type apmc = PCIE_ASPM_NONE; @@ -182,9 +182,9 @@ static enum aspm_type pciexp_enable_aspm(device_t root, unsigned root_cap, } #endif /* CONFIG_PCIEXP_ASPM */ -static void pciexp_tune_dev(device_t dev) +static void pciexp_tune_dev(struct device *dev) { - device_t root = dev->bus->dev; + struct device *root = dev->bus->dev; unsigned int root_cap, cap; cap = pci_find_capability(dev, PCI_CAP_ID_PCIE); @@ -216,7 +216,7 @@ static void pciexp_tune_dev(device_t dev) unsigned int pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max) { - device_t child; + struct device *child; max = pci_scan_bus(bus, min_devfn, max_devfn, max); @@ -230,7 +230,7 @@ unsigned int pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, return max; } -unsigned int pciexp_scan_bridge(device_t dev, unsigned int max) +unsigned int pciexp_scan_bridge(struct device *dev, unsigned int max) { return do_pci_scan_bridge(dev, max, pciexp_scan_bus); } diff --git a/src/device/pcix_device.c b/src/device/pcix_device.c index a20c3bf..59355b5 100644 --- a/src/device/pcix_device.c +++ b/src/device/pcix_device.c @@ -24,7 +24,7 @@ #include <device/pci_ids.h> #include <device/pcix.h> -static void pcix_tune_dev(device_t dev) +static void pcix_tune_dev(struct device *dev) { u32 status; u16 orig_cmd, cmd; @@ -65,7 +65,7 @@ static void pcix_tune_dev(device_t dev) static void pcix_tune_bus(struct bus *bus) { - device_t child; + struct device *child; for (child = bus->children; child; child = child->sibling) pcix_tune_dev(child); @@ -112,7 +112,7 @@ const char *pcix_speed(u16 sstatus) return result; } -unsigned int pcix_scan_bridge(device_t dev, unsigned int max) +unsigned int pcix_scan_bridge(struct device *dev, unsigned int max) { unsigned int pos; u16 sstatus; diff --git a/src/device/pnp_device.c b/src/device/pnp_device.c index e4aa4d3..d49b7a9 100644 --- a/src/device/pnp_device.c +++ b/src/device/pnp_device.c @@ -32,13 +32,13 @@ /* PNP config mode wrappers */ -void pnp_enter_conf_mode(device_t dev) +void pnp_enter_conf_mode(struct device *dev) { if (dev->ops->ops_pnp_mode) dev->ops->ops_pnp_mode->enter_conf_mode(dev); } -void pnp_exit_conf_mode(device_t dev) +void pnp_exit_conf_mode(struct device *dev) { if (dev->ops->ops_pnp_mode) dev->ops->ops_pnp_mode->exit_conf_mode(dev); @@ -46,24 +46,24 @@ void pnp_exit_conf_mode(device_t dev) /* PNP fundamental operations */ -void pnp_write_config(device_t dev, u8 reg, u8 value) +void pnp_write_config(struct device *dev, u8 reg, u8 value) { outb(reg, dev->path.pnp.port); outb(value, dev->path.pnp.port + 1); } -u8 pnp_read_config(device_t dev, u8 reg) +u8 pnp_read_config(struct device *dev, u8 reg) { outb(reg, dev->path.pnp.port); return inb(dev->path.pnp.port + 1); } -void pnp_set_logical_device(device_t dev) +void pnp_set_logical_device(struct device *dev) { pnp_write_config(dev, 0x07, dev->path.pnp.device & 0xff); } -void pnp_set_enable(device_t dev, int enable) +void pnp_set_enable(struct device *dev, int enable) { u8 tmp, bitpos; @@ -80,7 +80,7 @@ void pnp_set_enable(device_t dev, int enable) pnp_write_config(dev, 0x30, tmp); } -int pnp_read_enable(device_t dev) +int pnp_read_enable(struct device *dev) { u8 tmp, bitpos; @@ -92,20 +92,20 @@ int pnp_read_enable(device_t dev) return !!(tmp & (1 << bitpos)); } -void pnp_set_iobase(device_t dev, u8 index, u16 iobase) +void pnp_set_iobase(struct device *dev, u8 index, u16 iobase) { /* Index == 0x60 or 0x62. */ pnp_write_config(dev, index + 0, (iobase >> 8) & 0xff); pnp_write_config(dev, index + 1, iobase & 0xff); } -void pnp_set_irq(device_t dev, u8 index, u8 irq) +void pnp_set_irq(struct device *dev, u8 index, u8 irq) { /* Index == 0x70 or 0x72. */ pnp_write_config(dev, index, irq); } -void pnp_set_drq(device_t dev, u8 index, u8 drq) +void pnp_set_drq(struct device *dev, u8 index, u8 drq) { /* Index == 0x74. */ pnp_write_config(dev, index, drq & 0xff); @@ -113,12 +113,12 @@ void pnp_set_drq(device_t dev, u8 index, u8 drq) /* PNP device operations */ -void pnp_read_resources(device_t dev) +void pnp_read_resources(struct device *dev) { return; } -static void pnp_set_resource(device_t dev, struct resource *resource) +static void pnp_set_resource(struct device *dev, struct resource *resource) { if (!(resource->flags & IORESOURCE_ASSIGNED)) { printk(BIOS_ERR, "ERROR: %s %02lx %s size: 0x%010llx " @@ -144,7 +144,7 @@ static void pnp_set_resource(device_t dev, struct resource *resource) report_resource_stored(dev, resource, ""); } -void pnp_set_resources(device_t dev) +void pnp_set_resources(struct device *dev) { struct resource *res; @@ -160,7 +160,7 @@ void pnp_set_resources(device_t dev) pnp_exit_conf_mode(dev); } -void pnp_enable_resources(device_t dev) +void pnp_enable_resources(struct device *dev) { pnp_enter_conf_mode(dev); pnp_set_logical_device(dev); @@ -168,7 +168,7 @@ void pnp_enable_resources(device_t dev) pnp_exit_conf_mode(dev); } -void pnp_enable(device_t dev) +void pnp_enable(struct device *dev) { if (!dev->enabled) { pnp_enter_conf_mode(dev); @@ -178,7 +178,7 @@ void pnp_enable(device_t dev) } } -void pnp_alt_enable(device_t dev) +void pnp_alt_enable(struct device *dev) { pnp_enter_conf_mode(dev); pnp_set_logical_device(dev); @@ -195,7 +195,7 @@ struct device_operations pnp_ops = { /* PNP chip operations */ -static void pnp_get_ioresource(device_t dev, u8 index, struct io_info *info) +static void pnp_get_ioresource(struct device *dev, u8 index, struct io_info *info) { struct resource *resource; unsigned moving, gran, step; @@ -246,7 +246,7 @@ static void pnp_get_ioresource(device_t dev, u8 index, struct io_info *info) resource->size = 1 << gran; } -static void get_resources(device_t dev, struct pnp_info *info) +static void get_resources(struct device *dev, struct pnp_info *info) { struct resource *resource; @@ -312,11 +312,11 @@ static void get_resources(device_t dev, struct pnp_info *info) } } -void pnp_enable_devices(device_t base_dev, struct device_operations *ops, +void pnp_enable_devices(struct device *base_dev, struct device_operations *ops, unsigned int functions, struct pnp_info *info) { struct device_path path; - device_t dev; + struct device *dev; int i; path.type = DEVICE_PATH_PNP; diff --git a/src/device/root_device.c b/src/device/root_device.c index 49fa711..fb32151 100644 --- a/src/device/root_device.c +++ b/src/device/root_device.c @@ -35,7 +35,7 @@ const char mainboard_name[] = CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_ * * @param root Pointer to the device structure for the system root device. */ -static void root_dev_read_resources(device_t root) +static void root_dev_read_resources(struct device *root) { printk(BIOS_ERR, "%s should never be called.\n", __func__); } @@ -48,7 +48,7 @@ static void root_dev_read_resources(device_t root) * * @param root Pointer to the device structure for the system root device. */ -static void root_dev_set_resources(device_t root) +static void root_dev_set_resources(struct device *root) { printk(BIOS_ERR, "%s should never be called.\n", __func__); } @@ -76,9 +76,9 @@ static void root_dev_set_resources(device_t root) * @return The largest bus number used. */ static int smbus_max = 0; -unsigned int scan_static_bus(device_t bus, unsigned int max) +unsigned int scan_static_bus(struct device *bus, unsigned int max) { - device_t child; + struct device *child; struct bus *link; printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus)); @@ -121,7 +121,7 @@ unsigned int scan_static_bus(device_t bus, unsigned int max) return max; } -static void root_dev_enable_resources(device_t dev) +static void root_dev_enable_resources(struct device *dev) { } @@ -134,12 +134,12 @@ static void root_dev_enable_resources(device_t dev) * @param max The current bus number scanned so far, usually 0x00. * @return The largest bus number used. */ -static unsigned int root_dev_scan_bus(device_t root, unsigned int max) +static unsigned int root_dev_scan_bus(struct device *root, unsigned int max) { return scan_static_bus(root, max); } -static void root_dev_init(device_t root) +static void root_dev_init(struct device *root) { } diff --git a/src/device/smbus_ops.c b/src/device/smbus_ops.c index 41b31ed..547d144 100644 --- a/src/device/smbus_ops.c +++ b/src/device/smbus_ops.c @@ -25,7 +25,7 @@ #include <device/path.h> #include <device/smbus.h> -struct bus *get_pbus_smbus(device_t dev) +struct bus *get_pbus_smbus(struct device *dev) { struct bus *pbus = dev->bus; @@ -51,7 +51,7 @@ struct bus *get_pbus_smbus(device_t dev) * * @param dev TODO. */ -int smbus_set_link(device_t dev) +int smbus_set_link(struct device *dev) { struct bus *pbus_a[4]; // 4 level mux only. Enough? struct bus *pbus = dev->bus; @@ -87,70 +87,70 @@ int smbus_set_link(device_t dev) } -int smbus_quick_read(device_t dev) +int smbus_quick_read(struct device *dev) { CHECK_PRESENCE(quick_read); return ops_smbus_bus(get_pbus_smbus(dev))->quick_read(dev); } -int smbus_quick_write(device_t dev) +int smbus_quick_write(struct device *dev) { CHECK_PRESENCE(quick_write); return ops_smbus_bus(get_pbus_smbus(dev))->quick_write(dev); } -int smbus_recv_byte(device_t dev) +int smbus_recv_byte(struct device *dev) { CHECK_PRESENCE(recv_byte); return ops_smbus_bus(get_pbus_smbus(dev))->recv_byte(dev); } -int smbus_send_byte(device_t dev, u8 byte) +int smbus_send_byte(struct device *dev, u8 byte) { CHECK_PRESENCE(send_byte); return ops_smbus_bus(get_pbus_smbus(dev))->send_byte(dev, byte); } -int smbus_read_byte(device_t dev, u8 addr) +int smbus_read_byte(struct device *dev, u8 addr) { CHECK_PRESENCE(read_byte); return ops_smbus_bus(get_pbus_smbus(dev))->read_byte(dev, addr); } -int smbus_write_byte(device_t dev, u8 addr, u8 val) +int smbus_write_byte(struct device *dev, u8 addr, u8 val) { CHECK_PRESENCE(write_byte); return ops_smbus_bus(get_pbus_smbus(dev))->write_byte(dev, addr, val); } -int smbus_read_word(device_t dev, u8 addr) +int smbus_read_word(struct device *dev, u8 addr) { CHECK_PRESENCE(read_word); return ops_smbus_bus(get_pbus_smbus(dev))->read_word(dev, addr); } -int smbus_write_word(device_t dev, u8 addr, u16 val) +int smbus_write_word(struct device *dev, u8 addr, u16 val) { CHECK_PRESENCE(write_word); return ops_smbus_bus(get_pbus_smbus(dev))->write_word(dev, addr, val); } -int smbus_process_call(device_t dev, u8 cmd, u16 data) +int smbus_process_call(struct device *dev, u8 cmd, u16 data) { CHECK_PRESENCE(process_call); return ops_smbus_bus(get_pbus_smbus(dev))->process_call(dev, cmd, data); } -int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer) +int smbus_block_read(struct device *dev, u8 cmd, u8 bytes, u8 *buffer) { CHECK_PRESENCE(block_read); @@ -158,7 +158,7 @@ int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer) bytes, buffer); } -int smbus_block_write(device_t dev, u8 cmd, u8 bytes, const u8 *buffer) +int smbus_block_write(struct device *dev, u8 cmd, u8 bytes, const u8 *buffer) { CHECK_PRESENCE(block_write); diff --git a/src/include/cpu/amd/model_fxx_rev.h b/src/include/cpu/amd/model_fxx_rev.h index 1e85596..c3ef4e9 100644 --- a/src/include/cpu/amd/model_fxx_rev.h +++ b/src/include/cpu/amd/model_fxx_rev.h @@ -1,4 +1,5 @@ #include <arch/cpu.h> +#include <arch/io.h> int init_processor_name(void); @@ -59,7 +60,7 @@ static int is_e0_later_in_bsp(int nodeid) return !is_cpu_pre_e0(); } // d0 will be treated as e0 with this methods, but the d0 nb_cfg_54 always 0 - device_t dev; + pci_devfn_t dev; dev = PCI_DEV(0, 0x18+nodeid,2); val_old = pci_read_config32(dev, 0x80); val = val_old; @@ -101,7 +102,7 @@ static inline int is_cpu_pre_f2(void) static inline int is_cpu_f0_in_bsp(int nodeid) { uint32_t dword; - device_t dev; + pci_devfn_t dev; dev = PCI_DEV(0, 0x18+nodeid, 3); dword = pci_read_config32(dev, 0xfc); return (dword & 0xfff00) == 0x40f00; @@ -109,7 +110,7 @@ static inline int is_cpu_f0_in_bsp(int nodeid) static inline int is_cpu_pre_f2_in_bsp(int nodeid) { uint32_t dword; - device_t dev; + pci_devfn_t dev; dev = PCI_DEV(0, 0x18+nodeid, 3); dword = pci_read_config32(dev, 0xfc); return (dword & 0xfff0f) < 0x40f02; diff --git a/src/include/device/agp.h b/src/include/device/agp.h index be2b833..b3791fe 100644 --- a/src/include/device/agp.h +++ b/src/include/device/agp.h @@ -7,7 +7,7 @@ unsigned int agp_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max); -unsigned int agp_scan_bridge(device_t dev, unsigned int max); +unsigned int agp_scan_bridge(struct device *dev, unsigned int max); extern struct device_operations default_agp_ops_bus; diff --git a/src/include/device/cardbus.h b/src/include/device/cardbus.h index 45ae24f..4443c15 100644 --- a/src/include/device/cardbus.h +++ b/src/include/device/cardbus.h @@ -5,8 +5,8 @@ #include <device/device.h> -void cardbus_read_resources(device_t dev); -void cardbus_enable_resources(device_t dev); +void cardbus_read_resources(struct device *dev); +void cardbus_enable_resources(struct device *dev); extern struct device_operations default_cardbus_ops_bus; diff --git a/src/include/device/device.h b/src/include/device/device.h index c67205c..fe8dbed 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -41,19 +41,19 @@ struct smbios_type11; struct acpi_rsdp; struct device_operations { - void (*read_resources)(device_t dev); - void (*set_resources)(device_t dev); - void (*enable_resources)(device_t dev); - void (*init)(device_t dev); - void (*final)(device_t dev); - unsigned int (*scan_bus)(device_t bus, unsigned int _max); - void (*enable)(device_t dev); - void (*disable)(device_t dev); - void (*set_link)(device_t dev, unsigned int link); + void (*read_resources)(struct device *dev); + void (*set_resources)(struct device *dev); + void (*enable_resources)(struct device *dev); + void (*init)(struct device *dev); + void (*final)(struct device *dev); + unsigned int (*scan_bus)(struct device *bus, unsigned int _max); + void (*enable)(struct device *dev); + void (*disable)(struct device *dev); + void (*set_link)(struct device *dev, unsigned int link); void (*reset_bus)(struct bus *bus); #if CONFIG_GENERATE_SMBIOS_TABLES - int (*get_smbios_data)(device_t dev, int *handle, unsigned long *current); - void (*get_smbios_strings)(device_t dev, struct smbios_type11 *t); + int (*get_smbios_data)(struct device *dev, int *handle, unsigned long *current); + void (*get_smbios_strings)(struct device *dev, struct smbios_type11 *t); #endif #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) unsigned long (*write_acpi_tables)(unsigned long start, struct acpi_rsdp *rsdp); @@ -62,7 +62,7 @@ struct device_operations { #endif const struct pci_operations *ops_pci; const struct smbus_bus_operations *ops_smbus_bus; - const struct pci_bus_operations * (*ops_pci_bus)(device_t dev); + const struct pci_bus_operations * (*ops_pci_bus)(struct device *dev); const struct pnp_mode_ops *ops_pnp_mode; }; @@ -76,9 +76,8 @@ static inline void device_noop(struct device *dev) {} struct bus { - - ROMSTAGE_CONST struct device * dev; /* This bridge device */ - ROMSTAGE_CONST struct device * children; /* devices behind this bridge */ + ROMSTAGE_CONST struct device *dev; /* This bridge device */ + ROMSTAGE_CONST struct device *children; /* devices behind this bridge */ ROMSTAGE_CONST struct bus *next; /* The next bridge on this device */ unsigned bridge_ctrl; /* Bridge control register */ unsigned char link_num; /* The index of this link */ @@ -98,7 +97,7 @@ struct pci_irq_info { unsigned int ioapic_irq_pin; unsigned int ioapic_src_pin; unsigned int ioapic_dst_id; - unsigned int ioapic_flags; + unsigned int ioapic_flags; }; struct device { @@ -159,7 +158,7 @@ extern uint64_t uma_memory_size; #endif /* Generic device interface functions */ -device_t alloc_dev(struct bus *parent, struct device_path *path); +struct device *alloc_dev(struct bus *parent, struct device_path *path); void dev_initialize_chips(void); void dev_enumerate(void); void dev_configure(void); @@ -175,30 +174,30 @@ unsigned int scan_bus(struct device *bus, unsigned int _max); void assign_resources(struct bus *bus); void enumerate_static_device(void); void enumerate_static_devices(void); -const char *dev_name(device_t dev); -const char *dev_path(device_t dev); -u32 dev_path_encode(device_t dev); +const char *dev_name(struct device *dev); +const char *dev_path(struct device *dev); +u32 dev_path_encode(struct device *dev); const char *bus_path(struct bus *bus); -void dev_set_enabled(device_t dev, int enable); +void dev_set_enabled(struct device *dev, int enable); void disable_children(struct bus *bus); /* Option ROM helper functions */ void run_bios(struct device *dev, unsigned long addr); /* Helper functions */ -device_t find_dev_path(struct bus *parent, struct device_path *path); -device_t alloc_find_dev(struct bus *parent, struct device_path *path); -device_t dev_find_device (u16 vendor, u16 device, device_t from); -device_t dev_find_class (unsigned int class, device_t from); -device_t dev_find_slot (unsigned int bus, unsigned int devfn); -device_t dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); -device_t dev_find_slot_pnp(u16 port, u16 device); -device_t dev_find_lapic(unsigned apic_id); +struct device *find_dev_path(struct bus *parent, struct device_path *path); +struct device *alloc_find_dev(struct bus *parent, struct device_path *path); +struct device *dev_find_device (u16 vendor, u16 device, struct device *from); +struct device *dev_find_class (unsigned int class, struct device *from); +struct device *dev_find_slot (unsigned int bus, unsigned int devfn); +struct device *dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); +struct device *dev_find_slot_pnp(u16 port, u16 device); +struct device *dev_find_lapic(unsigned apic_id); int dev_count_cpu(void); void remap_bsp_lapic(struct bus *cpu_bus); -device_t add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled); -void set_cpu_topology(device_t cpu, unsigned node, unsigned package, unsigned core, unsigned thread); +struct device *add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled); +void set_cpu_topology(struct device *cpu, unsigned node, unsigned package, unsigned core, unsigned thread); #define amd_cpu_topology(cpu, node, core) \ set_cpu_topology(cpu, node, 0, core, 0) @@ -207,7 +206,7 @@ void set_cpu_topology(device_t cpu, unsigned node, unsigned package, unsigned co set_cpu_topology(cpu, 0, package, core, thread) /* Debug functions */ -void print_resource_tree(struct device * root, int debug_level, +void print_resource_tree(struct device *root, int debug_level, const char *msg); void show_devs_tree(struct device *dev, int debug_level, int depth, int linknum); void show_devs_subtree(struct device *root, int debug_level, const char *msg); @@ -226,9 +225,9 @@ void show_all_devs_resources(int debug_level, const char* msg); extern struct device_operations default_dev_ops_root; void pci_domain_read_resources(struct device *dev); unsigned int pci_domain_scan_bus(struct device *dev, unsigned int _max); -unsigned int scan_static_bus(device_t bus, unsigned int _max); +unsigned int scan_static_bus(struct device *bus, unsigned int _max); -void fixed_mem_resource(device_t dev, unsigned long index, +void fixed_mem_resource(struct device *dev, unsigned long index, unsigned long basek, unsigned long sizek, unsigned long type); @@ -257,7 +256,7 @@ u32 find_pci_tolm(struct bus *bus); ROMSTAGE_CONST struct device * dev_find_slot (unsigned int bus, unsigned int devfn); -ROMSTAGE_CONST struct device *dev_find_next_pci_device( +ROMSTAGE_CONST struct device * dev_find_next_pci_device( ROMSTAGE_CONST struct device *previous_dev); ROMSTAGE_CONST struct device * dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); diff --git a/src/include/device/pci.h b/src/include/device/pci.h index 0670da4..3688322 100644 --- a/src/include/device/pci.h +++ b/src/include/device/pci.h @@ -32,7 +32,7 @@ /* Common pci operations without a standard interface */ struct pci_operations { /* set the Subsystem IDs for the PCI device */ - void (*set_subsystem)(device_t dev, unsigned vendor, unsigned device); + void (*set_subsystem)(struct device *dev, unsigned vendor, unsigned device); }; /* Common pci bus operations */ @@ -62,35 +62,35 @@ extern struct pci_driver epci_drivers[]; extern struct device_operations default_pci_ops_dev; extern struct device_operations default_pci_ops_bus; -void pci_dev_read_resources(device_t dev); -void pci_bus_read_resources(device_t dev); -void pci_dev_set_resources(device_t dev); -void pci_dev_enable_resources(device_t dev); -void pci_bus_enable_resources(device_t dev); +void pci_dev_read_resources(struct device *dev); +void pci_bus_read_resources(struct device *dev); +void pci_dev_set_resources(struct device *dev); +void pci_dev_enable_resources(struct device *dev); +void pci_bus_enable_resources(struct device *dev); void pci_bus_reset(struct bus *bus); -device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn); -unsigned int do_pci_scan_bridge(device_t bus, unsigned int max, +struct device *pci_probe_dev(struct device *dev, struct bus *bus, unsigned devfn); +unsigned int do_pci_scan_bridge(struct device *bus, unsigned int max, unsigned int (*do_scan_bus)(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max)); -unsigned int pci_scan_bridge(device_t bus, unsigned int max); +unsigned int pci_scan_bridge(struct device *bus, unsigned int max); unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max); uint8_t pci_moving_config8(struct device *dev, unsigned reg); uint16_t pci_moving_config16(struct device *dev, unsigned reg); uint32_t pci_moving_config32(struct device *dev, unsigned reg); struct resource *pci_get_resource(struct device *dev, unsigned long index); -void pci_dev_set_subsystem(device_t dev, unsigned vendor, unsigned device); +void pci_dev_set_subsystem(struct device *dev, unsigned vendor, unsigned device); void pci_dev_init(struct device *dev); -unsigned int pci_match_simple_dev(device_t dev, pci_devfn_t sdev); +unsigned int pci_match_simple_dev(struct device *dev, pci_devfn_t sdev); const char * pin_to_str(int pin); -int get_pci_irq_pins(device_t dev, device_t *parent_bdg); +int get_pci_irq_pins(struct device *dev, struct device **parent_bdg); void pci_assign_irqs(unsigned bus, unsigned slot, const unsigned char pIntAtoD[4]); #define PCI_IO_BRIDGE_ALIGN 4096 #define PCI_MEM_BRIDGE_ALIGN (1024*1024) -static inline const struct pci_operations *ops_pci(device_t dev) +static inline const struct pci_operations *ops_pci(struct device *dev) { const struct pci_operations *pops; pops = 0; @@ -106,8 +106,8 @@ static inline const struct pci_operations *ops_pci(device_t dev) unsigned pci_find_next_capability(pci_devfn_t dev, unsigned cap, unsigned last); unsigned pci_find_capability(pci_devfn_t dev, unsigned cap); #else /* !__PRE_RAM__ */ -unsigned pci_find_next_capability(device_t dev, unsigned cap, unsigned last); -unsigned pci_find_capability(device_t dev, unsigned cap); +unsigned pci_find_next_capability(struct device *dev, unsigned cap, unsigned last); +unsigned pci_find_capability(struct device *dev, unsigned cap); #endif /* __PRE_RAM__ */ void pci_early_bridge_init(void); diff --git a/src/include/device/pciexp.h b/src/include/device/pciexp.h index 87a5002..c7ff4f5 100644 --- a/src/include/device/pciexp.h +++ b/src/include/device/pciexp.h @@ -11,7 +11,7 @@ enum aspm_type { unsigned int pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max); -unsigned int pciexp_scan_bridge(device_t dev, unsigned int max); +unsigned int pciexp_scan_bridge(struct device *dev, unsigned int max); extern struct device_operations default_pciexp_ops_bus; diff --git a/src/include/device/pcix.h b/src/include/device/pcix.h index 4ffab5b..8cc83df 100644 --- a/src/include/device/pcix.h +++ b/src/include/device/pcix.h @@ -4,7 +4,7 @@ unsigned int pcix_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max); -unsigned int pcix_scan_bridge(device_t dev, unsigned int max); +unsigned int pcix_scan_bridge(struct device *dev, unsigned int max); const char *pcix_speed(u16 sstatus); extern struct device_operations default_pcix_ops_bus; diff --git a/src/include/device/pnp.h b/src/include/device/pnp.h index d0d6fa3..9290056 100644 --- a/src/include/device/pnp.h +++ b/src/include/device/pnp.h @@ -9,21 +9,21 @@ #ifndef __SIMPLE_DEVICE__ /* Primitive PNP resource manipulation */ -void pnp_write_config(device_t dev, u8 reg, u8 value); -u8 pnp_read_config(device_t dev, u8 reg); -void pnp_set_logical_device(device_t dev); -void pnp_set_enable(device_t dev, int enable); -int pnp_read_enable(device_t dev); -void pnp_set_iobase(device_t dev, u8 index, u16 iobase); -void pnp_set_irq(device_t dev, u8 index, u8 irq); -void pnp_set_drq(device_t dev, u8 index, u8 drq); +void pnp_write_config(struct device *dev, u8 reg, u8 value); +u8 pnp_read_config(struct device *dev, u8 reg); +void pnp_set_logical_device(struct device *dev); +void pnp_set_enable(struct device *dev, int enable); +int pnp_read_enable(struct device *dev); +void pnp_set_iobase(struct device *dev, u8 index, u16 iobase); +void pnp_set_irq(struct device *dev, u8 index, u8 irq); +void pnp_set_drq(struct device *dev, u8 index, u8 drq); /* PNP device operations */ -void pnp_read_resources(device_t dev); -void pnp_set_resources(device_t dev); -void pnp_enable_resources(device_t dev); -void pnp_enable(device_t dev); -void pnp_alt_enable(device_t dev); +void pnp_read_resources(struct device *dev); +void pnp_set_resources(struct device *dev); +void pnp_enable_resources(struct device *dev); +void pnp_enable(struct device *dev); +void pnp_alt_enable(struct device *dev); extern struct device_operations pnp_ops; @@ -52,16 +52,16 @@ struct pnp_info { #define PNP_MSC10 0x1000 struct io_info io0, io1, io2, io3; }; -struct resource *pnp_get_resource(device_t dev, unsigned index); +struct resource *pnp_get_resource(struct device *dev, unsigned index); void pnp_enable_devices(struct device *dev, struct device_operations *ops, unsigned int functions, struct pnp_info *info); struct pnp_mode_ops { - void (*enter_conf_mode)(device_t dev); - void (*exit_conf_mode)(device_t dev); + void (*enter_conf_mode)(struct device *dev); + void (*exit_conf_mode)(struct device *dev); }; -void pnp_enter_conf_mode(device_t dev); -void pnp_exit_conf_mode(device_t dev); +void pnp_enter_conf_mode(struct device *dev); +void pnp_exit_conf_mode(struct device *dev); #endif /* ! __SIMPLE_DEVICE__ */ -#endif /* DEVICE_PNP_H */ +#endif /*devICE_PNP_H */ diff --git a/src/include/device/smbus.h b/src/include/device/smbus.h index 073d7e2..7002459 100644 --- a/src/include/device/smbus.h +++ b/src/include/device/smbus.h @@ -8,17 +8,17 @@ /* Common SMBus bus operations */ struct smbus_bus_operations { - int (*quick_read) (device_t dev); - int (*quick_write) (device_t dev); - int (*recv_byte) (device_t dev); - int (*send_byte) (device_t dev, u8 value); - int (*read_byte) (device_t dev, u8 addr); - int (*write_byte) (device_t dev, u8 addr, u8 value); - int (*read_word) (device_t dev, u8 addr); - int (*write_word) (device_t dev, u8 addr, u16 value); - int (*process_call)(device_t dev, u8 cmd, u16 data); - int (*block_read) (device_t dev, u8 cmd, u8 bytes, u8 *buffer); - int (*block_write) (device_t dev, u8 cmd, u8 bytes, const u8 *buffer); + int (*quick_read) (struct device *dev); + int (*quick_write) (struct device *dev); + int (*recv_byte) (struct device *dev); + int (*send_byte) (struct device *dev, u8 value); + int (*read_byte) (struct device *dev, u8 addr); + int (*write_byte) (struct device *dev, u8 addr, u8 value); + int (*read_word) (struct device *dev, u8 addr); + int (*write_word) (struct device *dev, u8 addr, u16 value); + int (*process_call)(struct device *dev, u8 cmd, u16 data); + int (*block_read) (struct device *dev, u8 cmd, u8 bytes, u8 *buffer); + int (*block_write) (struct device *dev, u8 cmd, u8 bytes, const u8 *buffer); }; static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus) @@ -32,19 +32,19 @@ static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus) return bops; } -struct bus *get_pbus_smbus(device_t dev); -int smbus_set_link(device_t dev); - -int smbus_quick_read(device_t dev); -int smbus_quick_write(device_t dev); -int smbus_recv_byte(device_t dev); -int smbus_send_byte(device_t dev, u8 byte); -int smbus_read_byte(device_t dev, u8 addr); -int smbus_write_byte(device_t dev, u8 addr, u8 val); -int smbus_read_word(device_t dev, u8 addr); -int smbus_write_word(device_t dev, u8 addr, u16 val); -int smbus_process_call(device_t dev, u8 cmd, u16 data); -int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer); -int smbus_block_write(device_t dev, u8 cmd, u8 bytes, const u8 *buffer); - -#endif /* DEVICE_SMBUS_H */ +struct bus *get_pbus_smbus(struct device *dev); +int smbus_set_link(struct device *dev); + +int smbus_quick_read(struct device *dev); +int smbus_quick_write(struct device *dev); +int smbus_recv_byte(struct device *dev); +int smbus_send_byte(struct device *dev, u8 byte); +int smbus_read_byte(struct device *dev, u8 addr); +int smbus_write_byte(struct device *dev, u8 addr, u8 val); +int smbus_read_word(struct device *dev, u8 addr); +int smbus_write_word(struct device *dev, u8 addr, u16 val); +int smbus_process_call(struct device *dev, u8 cmd, u16 data); +int smbus_block_read(struct device *dev, u8 cmd, u8 bytes, u8 *buffer); +int smbus_block_write(struct device *dev, u8 cmd, u8 bytes, const u8 *buffer); + +#endif /*devICE_SMBUS_H */ diff --git a/src/include/reg_script.h b/src/include/reg_script.h index 97b4fb0..71be7c2 100644 --- a/src/include/reg_script.h +++ b/src/include/reg_script.h @@ -34,7 +34,7 @@ * are employed: * - Chaining of tables that allow runtime tables to chain to compile-time * tables. - * - Notion of current device (device_t) being worked on. This allows for + * - Notion of current device (struct device *) being worked on. This allows for * PCI config, io, and mmio on a particular device's resources. * * Note that when using REG_SCRIPT_COMMAND_NEXT there is an implicit push @@ -80,7 +80,7 @@ struct reg_script { union { uint32_t id; const struct reg_script *next; - device_t dev; + struct device *dev; unsigned int res_index; }; }; @@ -334,6 +334,6 @@ struct reg_script { _REG_SCRIPT_ENCODE_RAW(REG_SCRIPT_COMMAND_END, 0, 0, 0, 0, 0, 0, 0) void reg_script_run(const struct reg_script *script); -void reg_script_run_on_dev(device_t dev, const struct reg_script *step); +void reg_script_run_on_dev(struct device *dev, const struct reg_script *step); #endif /* REG_SCRIPT_H */
1
0
0
0
Patch set updated for coreboot: 6d9a786 device: Clarify correct typing of 'struct device *'
by Edward O'Callaghan
05 Nov '14
05 Nov '14
Edward O'Callaghan (eocallaghan(a)alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/7138
-gerrit commit 6d9a786a90afce870eab11d094e693f5cd0c030f Author: Edward O'Callaghan <eocallaghan(a)alterapraxis.com> Date: Sat Nov 1 13:55:04 2014 +1100 device: Clarify correct typing of 'struct device *' Disambiguate 'device_t' into 'struct device *', 'pci_devfn_t' and 'pnp_devfn_t' component types where appropriate. Change-Id: Ic4239efe0462d86694bf4ac0ec898f589b6adf1c Signed-off-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com> --- src/device/agp_device.c | 6 +-- src/device/cardbus_device.c | 8 ++-- src/device/cpu_device.c | 8 ++-- src/device/device.c | 14 +++---- src/device/device_romstage.c | 2 +- src/device/device_util.c | 35 ++++++++-------- src/device/hypertransport.c | 20 +++++---- src/device/oprom/yabel/biosemu.c | 2 +- src/device/oprom/yabel/compat/functions.c | 2 +- src/device/oprom/yabel/device.c | 2 +- src/device/oprom/yabel/io.c | 2 +- src/device/pci_device.c | 22 +++++----- src/device/pci_ops.c | 2 +- src/device/pci_rom.c | 2 +- src/device/pciexp_device.c | 22 +++++----- src/device/pcix_device.c | 6 +-- src/device/pnp_device.c | 40 +++++++++--------- src/device/root_device.c | 14 +++---- src/device/smbus_ops.c | 26 ++++++------ src/include/cpu/amd/model_fxx_rev.h | 7 ++-- src/include/device/agp.h | 2 +- src/include/device/cardbus.h | 4 +- src/include/device/device.h | 69 +++++++++++++++---------------- src/include/device/pci.h | 30 +++++++------- src/include/device/pciexp.h | 2 +- src/include/device/pcix.h | 2 +- src/include/device/pnp.h | 38 ++++++++--------- src/include/device/smbus.h | 54 ++++++++++++------------ src/include/reg_script.h | 6 +-- src/lib/reg_script.c | 6 +-- 30 files changed, 230 insertions(+), 225 deletions(-) diff --git a/src/device/agp_device.c b/src/device/agp_device.c index 550297a..fc23fe6 100644 --- a/src/device/agp_device.c +++ b/src/device/agp_device.c @@ -24,7 +24,7 @@ #include <device/pci_ids.h> #include <device/agp.h> -static void agp_tune_dev(device_t dev) +static void agp_tune_dev(struct device *dev) { unsigned int cap; @@ -38,7 +38,7 @@ static void agp_tune_dev(device_t dev) unsigned int agp_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max) { - device_t child; + struct device *child; max = pci_scan_bus(bus, min_devfn, max_devfn, max); @@ -53,7 +53,7 @@ unsigned int agp_scan_bus(struct bus *bus, unsigned int min_devfn, return max; } -unsigned int agp_scan_bridge(device_t dev, unsigned int max) +unsigned int agp_scan_bridge(struct device *dev, unsigned int max) { return do_pci_scan_bridge(dev, max, agp_scan_bus); } diff --git a/src/device/cardbus_device.c b/src/device/cardbus_device.c index f25f96c..e32ece3 100644 --- a/src/device/cardbus_device.c +++ b/src/device/cardbus_device.c @@ -38,7 +38,7 @@ #define CARDBUS_IO_SIZE 4096 #define CARDBUS_MEM_SIZE (32 * 1024 * 1024) -static void cardbus_record_bridge_resource(device_t dev, resource_t moving, +static void cardbus_record_bridge_resource(struct device *dev, resource_t moving, resource_t min_size, unsigned int index, unsigned long type) { struct resource *resource; @@ -70,7 +70,7 @@ static void cardbus_record_bridge_resource(device_t dev, resource_t moving, resource->size = min_size; } -static void cardbus_size_bridge_resource(device_t dev, unsigned int index) +static void cardbus_size_bridge_resource(struct device *dev, unsigned int index) { struct resource *resource; resource_t min_size; @@ -87,7 +87,7 @@ static void cardbus_size_bridge_resource(device_t dev, unsigned int index) } } -void cardbus_read_resources(device_t dev) +void cardbus_read_resources(struct device *dev) { resource_t moving_base, moving_limit, moving; unsigned long type; @@ -153,7 +153,7 @@ void cardbus_read_resources(device_t dev) compact_resources(dev); } -void cardbus_enable_resources(device_t dev) +void cardbus_enable_resources(struct device *dev) { u16 ctrl; diff --git a/src/device/cpu_device.c b/src/device/cpu_device.c index e76b539..7152d02 100644 --- a/src/device/cpu_device.c +++ b/src/device/cpu_device.c @@ -25,7 +25,7 @@ void remap_bsp_lapic(struct bus *cpu_bus) { struct device_path cpu_path; - device_t cpu; + struct device *cpu; u32 bsp_lapic_id = lapicid(); if (bsp_lapic_id) { @@ -37,10 +37,10 @@ void remap_bsp_lapic(struct bus *cpu_bus) } } -device_t add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled) +struct device *add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled) { struct device_path cpu_path; - device_t cpu; + struct device *cpu; /* Build the cpu device path */ cpu_path.type = DEVICE_PATH_APIC; @@ -61,7 +61,7 @@ device_t add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled) return cpu; } -void set_cpu_topology(device_t cpu, unsigned node, unsigned package, unsigned core, unsigned thread) +void set_cpu_topology(struct device *cpu, unsigned node, unsigned package, unsigned core, unsigned thread) { cpu->path.apic.node_id = node; cpu->path.apic.package_id = package; diff --git a/src/device/device.c b/src/device/device.c index e068cee..04fc725 100644 --- a/src/device/device.c +++ b/src/device/device.c @@ -114,9 +114,9 @@ uint64_t uma_memory_size = 0; * * @see device_path */ -static device_t __alloc_dev(struct bus *parent, struct device_path *path) +static struct device *__alloc_dev(struct bus *parent, struct device_path *path) { - device_t dev, child; + struct device *dev, *child; /* Find the last child of our parent. */ for (child = parent->children; child && child->sibling; /* */ ) @@ -148,9 +148,9 @@ static device_t __alloc_dev(struct bus *parent, struct device_path *path) return dev; } -device_t alloc_dev(struct bus *parent, struct device_path *path) +struct device *alloc_dev(struct bus *parent, struct device_path *path) { - device_t dev; + struct device *dev; spin_lock(&dev_lock); dev = __alloc_dev(parent, path); spin_unlock(&dev_lock); @@ -164,9 +164,9 @@ device_t alloc_dev(struct bus *parent, struct device_path *path) * @param path The relative path from the bus to the appropriate device. * @return Pointer to a device structure for the device on bus at path. */ -device_t alloc_find_dev(struct bus *parent, struct device_path *path) +struct device *alloc_find_dev(struct bus *parent, struct device_path *path) { - device_t child; + struct device *child; spin_lock(&dev_lock); child = find_dev_path(parent, path); if (!child) @@ -750,7 +750,7 @@ static void avoid_fixed_resources(struct device *dev) } } -device_t vga_pri = 0; +struct device *vga_pri = NULL; static void set_vga_bridge_bits(void) { /* diff --git a/src/device/device_romstage.c b/src/device/device_romstage.c index 987fdad..0c81d60 100644 --- a/src/device/device_romstage.c +++ b/src/device/device_romstage.c @@ -28,7 +28,7 @@ #include <device/resource.h> /** Linked list of ALL devices */ -ROMSTAGE_CONST struct device * ROMSTAGE_CONST all_devices = &dev_root; +ROMSTAGE_CONST struct device *ROMSTAGE_CONST all_devices = &dev_root; /** * Given a PCI bus and a devfn number, find the device structure. diff --git a/src/device/device_util.c b/src/device/device_util.c index d5466cb..2bdaff3 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -37,9 +37,9 @@ * @return Pointer to a device structure for the device on bus at path * or 0/NULL if no device is found. */ -device_t find_dev_path(struct bus *parent, struct device_path *path) +struct device *find_dev_path(struct bus *parent, struct device_path *path) { - device_t child; + struct device *child; for (child = parent->children; child; child = child->sibling) { if (path_eq(path, &child->path)) break; @@ -120,9 +120,10 @@ struct device *dev_find_slot_pnp(u16 port, u16 device) * @param apic_id The Local APIC ID number. * @return Pointer to the device structure (if found), 0 otherwise. */ -device_t dev_find_lapic(unsigned apic_id) +struct device *dev_find_lapic(unsigned apic_id) { - device_t dev, result = NULL; + struct device *dev = NULL; + struct device *result = NULL; for (dev = all_devices; dev; dev = dev->next) { if (dev->path.type == DEVICE_PATH_APIC && @@ -185,7 +186,7 @@ struct device *dev_find_class(unsigned int class, struct device *from) * @param dev The device path to encode. * @return Device path encoded into lower 3 bytes of dword. */ -u32 dev_path_encode(device_t dev) +u32 dev_path_encode(struct device *dev) { u32 ret; @@ -238,7 +239,7 @@ u32 dev_path_encode(device_t dev) * Warning: This function uses a static buffer. Don't call it more than once * from the same print statement! */ -const char *dev_path(device_t dev) +const char *dev_path(struct device *dev) { static char buffer[DEVICE_PATH_MAX]; @@ -308,7 +309,7 @@ const char *dev_path(device_t dev) return buffer; } -const char *dev_name(device_t dev) +const char *dev_name(struct device *dev) { if (dev->name) return dev->name; @@ -405,7 +406,7 @@ static int allocate_more_resources(void) * @param prev TODO * @return TODO. */ -static void free_resource(device_t dev, struct resource *res, +static void free_resource(struct device *dev, struct resource *res, struct resource *prev) { if (prev) @@ -424,7 +425,7 @@ static void free_resource(device_t dev, struct resource *res, * * @param dev The device to find the resource on. */ -void compact_resources(device_t dev) +void compact_resources(struct device *dev) { struct resource *res, *next, *prev = NULL; @@ -445,7 +446,7 @@ void compact_resources(device_t dev) * @param index The index of the resource on the device. * @return The resource, if it already exists. */ -struct resource *probe_resource(device_t dev, unsigned index) +struct resource *probe_resource(struct device *dev, unsigned index) { struct resource *res; @@ -468,7 +469,7 @@ struct resource *probe_resource(device_t dev, unsigned index) * @param index The index of the resource on the device. * @return TODO. */ -struct resource *new_resource(device_t dev, unsigned index) +struct resource *new_resource(struct device *dev, unsigned index) { struct resource *resource, *tail; @@ -515,7 +516,7 @@ struct resource *new_resource(device_t dev, unsigned index) * @param index The index of the resource on the device. * return TODO. */ -struct resource *find_resource(device_t dev, unsigned index) +struct resource *find_resource(struct device *dev, unsigned index) { struct resource *resource; @@ -629,7 +630,7 @@ const char *resource_type(struct resource *resource) * @param resource The resource that was just stored. * @param comment TODO */ -void report_resource_stored(device_t dev, struct resource *resource, +void report_resource_stored(struct device *dev, struct resource *resource, const char *comment) { char buf[10]; @@ -721,7 +722,7 @@ void search_global_resources(unsigned long type_mask, unsigned long type, } } -void dev_set_enabled(device_t dev, int enable) +void dev_set_enabled(struct device *dev, int enable) { if (dev->enabled == enable) return; @@ -736,7 +737,7 @@ void dev_set_enabled(device_t dev, int enable) void disable_children(struct bus *bus) { - device_t child; + struct device *child; for (child = bus->children; child; child = child->sibling) { struct bus *link; @@ -890,7 +891,7 @@ void show_all_devs_resources(int debug_level, const char* msg) } } -void fixed_mem_resource(device_t dev, unsigned long index, +void fixed_mem_resource(struct device *dev, unsigned long index, unsigned long basek, unsigned long sizek, unsigned long type) { struct resource *resource; @@ -939,7 +940,7 @@ u32 find_pci_tolm(struct bus *bus) /* Count of enabled CPUs */ int dev_count_cpu(void) { - device_t cpu; + struct device *cpu; int count = 0; for (cpu = all_devices; cpu; cpu = cpu->next) { diff --git a/src/device/hypertransport.c b/src/device/hypertransport.c index d9ab486..030ddea 100644 --- a/src/device/hypertransport.c +++ b/src/device/hypertransport.c @@ -41,9 +41,10 @@ #include <cpu/amd/model_fxx_rev.h> #endif -static device_t ht_scan_get_devs(device_t *old_devices) +static struct device *ht_scan_get_devs(struct device * *old_devices) { - device_t first, last; + struct device *first; + struct device *last; first = *old_devices; last = first; @@ -60,7 +61,7 @@ static device_t ht_scan_get_devs(device_t *old_devices) } if (first) { - device_t child; + struct device *child; /* Unlink the chain from the list of old devices. */ *old_devices = last->sibling; @@ -81,7 +82,7 @@ static device_t ht_scan_get_devs(device_t *old_devices) } #if OPT_HT_LINK == 1 -static unsigned ht_read_freq_cap(device_t dev, unsigned pos) +static unsigned ht_read_freq_cap(struct device *dev, unsigned pos) { /* Handle bugs in valid hypertransport frequency reporting. */ unsigned freq_cap; @@ -126,7 +127,7 @@ struct ht_link { unsigned char ctrl_off, config_off, freq_off, freq_cap_off; }; -static int ht_setup_link(struct ht_link *prev, device_t dev, unsigned pos) +static int ht_setup_link(struct ht_link *prev, struct device *dev, unsigned pos) { #if OPT_HT_LINK == 1 static const u8 link_width_to_pow2[] = { 3, 4, 0, 5, 1, 2, 0, 0 }; @@ -420,7 +421,10 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned min_devfn, * optimize link. */ unsigned int next_unitid, last_unitid, min_unitid, max_unitid; - device_t old_devices, dev, func, last_func = 0; + struct device *old_devices; + struct device *dev; + struct device *func; + struct device *last_func = NULL; struct ht_link prev; int ht_dev_num = 0; @@ -433,7 +437,7 @@ unsigned int hypertransport_scan_chain(struct bus *bus, unsigned min_devfn, */ unsigned int real_last_unitid = 0, end_used = 0; u8 real_last_pos = 0; - device_t real_last_dev = NULL; + struct device *real_last_dev = NULL; #endif /* Restore the hypertransport chain to it's uninitialized state. */ @@ -627,7 +631,7 @@ end_of_chain: * a problem in devicetree.cb. */ if (old_devices) { - device_t left; + struct device *left; for (left = old_devices; left; left = left->sibling) printk(BIOS_DEBUG, "%s\n", dev_path(left)); diff --git a/src/device/oprom/yabel/biosemu.c b/src/device/oprom/yabel/biosemu.c index d27a5f1..86197a8 100644 --- a/src/device/oprom/yabel/biosemu.c +++ b/src/device/oprom/yabel/biosemu.c @@ -62,7 +62,7 @@ mainboard_interrupt_handlers(int interrupt, yabel_handleIntFunc func) * will look for an ExpansionROM BAR and use the code from there. */ u32 -biosemu(u8 *biosmem, u32 biosmem_size, struct device * dev, unsigned long rom_addr) +biosemu(u8 *biosmem, u32 biosmem_size, struct device *dev, unsigned long rom_addr) { u8 *rom_image; int i = 0; diff --git a/src/device/oprom/yabel/compat/functions.c b/src/device/oprom/yabel/compat/functions.c index 27d0413..a132946 100644 --- a/src/device/oprom/yabel/compat/functions.c +++ b/src/device/oprom/yabel/compat/functions.c @@ -35,7 +35,7 @@ u8* vmem = NULL; extern u8 *biosmem; -void run_bios(struct device * dev, unsigned long addr) +void run_bios(struct device *dev, unsigned long addr) { biosmem = vmem; diff --git a/src/device/oprom/yabel/device.c b/src/device/oprom/yabel/device.c index 2f41847..37e6020 100644 --- a/src/device/oprom/yabel/device.c +++ b/src/device/oprom/yabel/device.c @@ -407,7 +407,7 @@ biosemu_dev_check_exprom(unsigned long rom_base_addr) } u8 -biosemu_dev_init(struct device * device) +biosemu_dev_init(struct device *device) { u8 rval = 0; //init bios_device struct diff --git a/src/device/oprom/yabel/io.c b/src/device/oprom/yabel/io.c index 08189a9..2d38ad7 100644 --- a/src/device/oprom/yabel/io.c +++ b/src/device/oprom/yabel/io.c @@ -390,7 +390,7 @@ u32 pci_cfg_read(X86EMU_pioAddr addr, u8 size) { u32 rval = 0xFFFFFFFF; - struct device * dev; + struct device *dev; if ((addr >= 0xCFC) && ((addr + size) <= 0xD00)) { // PCI Configuration Mechanism 1 step 1 // write to 0xCF8, sets bus, device, function and Config Space offset diff --git a/src/device/pci_device.c b/src/device/pci_device.c index 8351e9c..e82cb5c 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -157,7 +157,7 @@ unsigned pci_find_next_capability(struct device *dev, unsigned cap, * @param cap PCI_CAP_LIST_ID of the PCI capability we're looking for. * @return The next matching capability. */ -unsigned pci_find_capability(device_t dev, unsigned cap) +unsigned pci_find_capability(struct device *dev, unsigned cap) { return pci_find_next_capability(dev, cap, 0); } @@ -761,7 +761,7 @@ struct device_operations default_pci_ops_bus = { * @param dev Pointer to the device structure of the bridge. * @return Appropriate bridge operations. */ -static struct device_operations *get_pci_bridge_ops(device_t dev) +static struct device_operations *get_pci_bridge_ops(struct device *dev) { #if CONFIG_PCIX_PLUGIN_SUPPORT unsigned int pcixpos; @@ -959,7 +959,7 @@ static struct device *pci_scan_get_dev(struct device **list, unsigned int devfn) * @param devfn A device/function number to look at. * @return The device structure for the device (if found), NULL otherwise. */ -device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn) +struct device *pci_probe_dev(struct device * dev, struct bus *bus, unsigned devfn) { u32 id, class; u8 hdr_type; @@ -1066,7 +1066,7 @@ device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn) * @param sdev Simple device model identifier, created with PCI_DEV(). * @return Non-zero if bus:dev.fn of device matches. */ -unsigned int pci_match_simple_dev(device_t dev, pci_devfn_t sdev) +unsigned int pci_match_simple_dev(struct device *dev, pci_devfn_t sdev) { return dev->bus->secondary == PCI_DEV2SEGBUS(sdev) && dev->path.pci.devfn == PCI_DEV2DEVFN(sdev); @@ -1146,7 +1146,7 @@ unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, * There's probably a problem in devicetree.cb. */ if (old_devices) { - device_t left; + struct device *left; printk(BIOS_WARNING, "PCI: Left over static devices:\n"); for (left = old_devices; left; left = left->sibling) printk(BIOS_WARNING, "%s\n", dev_path(left)); @@ -1280,7 +1280,7 @@ unsigned int pci_scan_bridge(struct device *dev, unsigned int max) * @param max The highest bus number assigned up to now. * @return The maximum bus number found, after scanning all subordinate busses. */ -unsigned int pci_domain_scan_bus(device_t dev, unsigned int max) +unsigned int pci_domain_scan_bus(struct device *dev, unsigned int max) { max = pci_scan_bus(dev->link_list, PCI_DEVFN(0, 0), 0xff, max); return max; @@ -1326,10 +1326,10 @@ const char *pin_to_str(int pin) * @return The interrupt pin number (1 - 4) that 'dev' will * trigger when generating an interrupt */ -static int swizzle_irq_pins(device_t dev, device_t *parent_bridge) +static int swizzle_irq_pins(struct device *dev, struct device * *parent_bridge) { - device_t parent; /* Our current device's parent device */ - device_t child; /* The child device of the parent */ + struct device *parent; /* Our current device's parent device */ + struct device *child; /* The child device of the parent */ uint8_t parent_bus = 0; /* Parent Bus number */ uint16_t parent_devfn = 0; /* Parent Device and Function number */ uint16_t child_devfn = 0; /* Child Device and Function number */ @@ -1394,7 +1394,7 @@ static int swizzle_irq_pins(device_t dev, device_t *parent_bridge) * Errors: -1 is returned if the device is not enabled * -2 is returned if a parent bridge could not be found. */ -int get_pci_irq_pins(device_t dev, device_t *parent_bdg) +int get_pci_irq_pins(struct device *dev, struct device * *parent_bdg) { uint8_t bus = 0; /* The bus this device is on */ uint16_t devfn = 0; /* This device's device and function numbers */ @@ -1456,7 +1456,7 @@ void pci_assign_irqs(unsigned bus, unsigned slot, const unsigned char pIntAtoD[4]) { unsigned int funct; - device_t pdev; + struct device *pdev; u8 line, irq; /* Each slot may contain up to eight functions. */ diff --git a/src/device/pci_ops.c b/src/device/pci_ops.c index 6ddb493..73b4242 100644 --- a/src/device/pci_ops.c +++ b/src/device/pci_ops.c @@ -25,7 +25,7 @@ #include <device/pci_ids.h> #include <device/pci_ops.h> -const struct pci_bus_operations *pci_bus_default_ops(device_t dev) +const struct pci_bus_operations *pci_bus_default_ops(struct device *dev) { #if CONFIG_MMCONF_SUPPORT_DEFAULT return &pci_ops_mmconf; diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index 1bdccf0..b7fdde6 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -155,7 +155,7 @@ struct rom_header *pci_rom_load(struct device *dev, */ if (PCI_CLASS_DISPLAY_VGA == (dev->class >> 8)) { #if !CONFIG_MULTIPLE_VGA_ADAPTERS - extern device_t vga_pri; /* Primary VGA device (device.c). */ + extern struct device *vga_pri; /* Primary VGA device (device.c). */ if (dev != vga_pri) return NULL; /* Only one VGA supported. */ #endif if ((void *)PCI_VGA_RAM_IMAGE_START != rom_header) { diff --git a/src/device/pciexp_device.c b/src/device/pciexp_device.c index 87aea67..a38da40 100644 --- a/src/device/pciexp_device.c +++ b/src/device/pciexp_device.c @@ -30,7 +30,7 @@ * Re-train a PCIe link */ #define PCIE_TRAIN_RETRY 10000 -static int pciexp_retrain_link(device_t dev, unsigned cap) +static int pciexp_retrain_link(struct device *dev, unsigned cap) { unsigned try = PCIE_TRAIN_RETRY; u16 lnk; @@ -57,8 +57,8 @@ static int pciexp_retrain_link(device_t dev, unsigned cap) * and enable Common Clock Configuration if possible. If CCC is * enabled the link must be retrained. */ -static void pciexp_enable_common_clock(device_t root, unsigned root_cap, - device_t endp, unsigned endp_cap) +static void pciexp_enable_common_clock(struct device *root, unsigned root_cap, + struct device *endp, unsigned endp_cap) { u16 root_scc, endp_scc, lnkctl; @@ -96,8 +96,8 @@ static void pciexp_enable_common_clock(device_t root, unsigned root_cap, * by checking both root port and endpoint and returning * the highest latency value. */ -static int pciexp_aspm_latency(device_t root, unsigned root_cap, - device_t endp, unsigned endp_cap, +static int pciexp_aspm_latency(struct device *root, unsigned root_cap, + struct device *endp, unsigned endp_cap, enum aspm_type type) { int root_lat = 0, endp_lat = 0; @@ -139,8 +139,8 @@ static int pciexp_aspm_latency(device_t root, unsigned root_cap, * 2 = L1 Enabled * 3 = L0s and L1 Enabled */ -static enum aspm_type pciexp_enable_aspm(device_t root, unsigned root_cap, - device_t endp, unsigned endp_cap) +static enum aspm_type pciexp_enable_aspm(struct device *root, unsigned root_cap, + struct device *endp, unsigned endp_cap) { const char *aspm_type_str[] = { "None", "L0s", "L1", "L0s and L1" }; enum aspm_type apmc = PCIE_ASPM_NONE; @@ -182,9 +182,9 @@ static enum aspm_type pciexp_enable_aspm(device_t root, unsigned root_cap, } #endif /* CONFIG_PCIEXP_ASPM */ -static void pciexp_tune_dev(device_t dev) +static void pciexp_tune_dev(struct device *dev) { - device_t root = dev->bus->dev; + struct device *root = dev->bus->dev; unsigned int root_cap, cap; cap = pci_find_capability(dev, PCI_CAP_ID_PCIE); @@ -216,7 +216,7 @@ static void pciexp_tune_dev(device_t dev) unsigned int pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max) { - device_t child; + struct device *child; max = pci_scan_bus(bus, min_devfn, max_devfn, max); @@ -230,7 +230,7 @@ unsigned int pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, return max; } -unsigned int pciexp_scan_bridge(device_t dev, unsigned int max) +unsigned int pciexp_scan_bridge(struct device *dev, unsigned int max) { return do_pci_scan_bridge(dev, max, pciexp_scan_bus); } diff --git a/src/device/pcix_device.c b/src/device/pcix_device.c index a20c3bf..59355b5 100644 --- a/src/device/pcix_device.c +++ b/src/device/pcix_device.c @@ -24,7 +24,7 @@ #include <device/pci_ids.h> #include <device/pcix.h> -static void pcix_tune_dev(device_t dev) +static void pcix_tune_dev(struct device *dev) { u32 status; u16 orig_cmd, cmd; @@ -65,7 +65,7 @@ static void pcix_tune_dev(device_t dev) static void pcix_tune_bus(struct bus *bus) { - device_t child; + struct device *child; for (child = bus->children; child; child = child->sibling) pcix_tune_dev(child); @@ -112,7 +112,7 @@ const char *pcix_speed(u16 sstatus) return result; } -unsigned int pcix_scan_bridge(device_t dev, unsigned int max) +unsigned int pcix_scan_bridge(struct device *dev, unsigned int max) { unsigned int pos; u16 sstatus; diff --git a/src/device/pnp_device.c b/src/device/pnp_device.c index e4aa4d3..d49b7a9 100644 --- a/src/device/pnp_device.c +++ b/src/device/pnp_device.c @@ -32,13 +32,13 @@ /* PNP config mode wrappers */ -void pnp_enter_conf_mode(device_t dev) +void pnp_enter_conf_mode(struct device *dev) { if (dev->ops->ops_pnp_mode) dev->ops->ops_pnp_mode->enter_conf_mode(dev); } -void pnp_exit_conf_mode(device_t dev) +void pnp_exit_conf_mode(struct device *dev) { if (dev->ops->ops_pnp_mode) dev->ops->ops_pnp_mode->exit_conf_mode(dev); @@ -46,24 +46,24 @@ void pnp_exit_conf_mode(device_t dev) /* PNP fundamental operations */ -void pnp_write_config(device_t dev, u8 reg, u8 value) +void pnp_write_config(struct device *dev, u8 reg, u8 value) { outb(reg, dev->path.pnp.port); outb(value, dev->path.pnp.port + 1); } -u8 pnp_read_config(device_t dev, u8 reg) +u8 pnp_read_config(struct device *dev, u8 reg) { outb(reg, dev->path.pnp.port); return inb(dev->path.pnp.port + 1); } -void pnp_set_logical_device(device_t dev) +void pnp_set_logical_device(struct device *dev) { pnp_write_config(dev, 0x07, dev->path.pnp.device & 0xff); } -void pnp_set_enable(device_t dev, int enable) +void pnp_set_enable(struct device *dev, int enable) { u8 tmp, bitpos; @@ -80,7 +80,7 @@ void pnp_set_enable(device_t dev, int enable) pnp_write_config(dev, 0x30, tmp); } -int pnp_read_enable(device_t dev) +int pnp_read_enable(struct device *dev) { u8 tmp, bitpos; @@ -92,20 +92,20 @@ int pnp_read_enable(device_t dev) return !!(tmp & (1 << bitpos)); } -void pnp_set_iobase(device_t dev, u8 index, u16 iobase) +void pnp_set_iobase(struct device *dev, u8 index, u16 iobase) { /* Index == 0x60 or 0x62. */ pnp_write_config(dev, index + 0, (iobase >> 8) & 0xff); pnp_write_config(dev, index + 1, iobase & 0xff); } -void pnp_set_irq(device_t dev, u8 index, u8 irq) +void pnp_set_irq(struct device *dev, u8 index, u8 irq) { /* Index == 0x70 or 0x72. */ pnp_write_config(dev, index, irq); } -void pnp_set_drq(device_t dev, u8 index, u8 drq) +void pnp_set_drq(struct device *dev, u8 index, u8 drq) { /* Index == 0x74. */ pnp_write_config(dev, index, drq & 0xff); @@ -113,12 +113,12 @@ void pnp_set_drq(device_t dev, u8 index, u8 drq) /* PNP device operations */ -void pnp_read_resources(device_t dev) +void pnp_read_resources(struct device *dev) { return; } -static void pnp_set_resource(device_t dev, struct resource *resource) +static void pnp_set_resource(struct device *dev, struct resource *resource) { if (!(resource->flags & IORESOURCE_ASSIGNED)) { printk(BIOS_ERR, "ERROR: %s %02lx %s size: 0x%010llx " @@ -144,7 +144,7 @@ static void pnp_set_resource(device_t dev, struct resource *resource) report_resource_stored(dev, resource, ""); } -void pnp_set_resources(device_t dev) +void pnp_set_resources(struct device *dev) { struct resource *res; @@ -160,7 +160,7 @@ void pnp_set_resources(device_t dev) pnp_exit_conf_mode(dev); } -void pnp_enable_resources(device_t dev) +void pnp_enable_resources(struct device *dev) { pnp_enter_conf_mode(dev); pnp_set_logical_device(dev); @@ -168,7 +168,7 @@ void pnp_enable_resources(device_t dev) pnp_exit_conf_mode(dev); } -void pnp_enable(device_t dev) +void pnp_enable(struct device *dev) { if (!dev->enabled) { pnp_enter_conf_mode(dev); @@ -178,7 +178,7 @@ void pnp_enable(device_t dev) } } -void pnp_alt_enable(device_t dev) +void pnp_alt_enable(struct device *dev) { pnp_enter_conf_mode(dev); pnp_set_logical_device(dev); @@ -195,7 +195,7 @@ struct device_operations pnp_ops = { /* PNP chip operations */ -static void pnp_get_ioresource(device_t dev, u8 index, struct io_info *info) +static void pnp_get_ioresource(struct device *dev, u8 index, struct io_info *info) { struct resource *resource; unsigned moving, gran, step; @@ -246,7 +246,7 @@ static void pnp_get_ioresource(device_t dev, u8 index, struct io_info *info) resource->size = 1 << gran; } -static void get_resources(device_t dev, struct pnp_info *info) +static void get_resources(struct device *dev, struct pnp_info *info) { struct resource *resource; @@ -312,11 +312,11 @@ static void get_resources(device_t dev, struct pnp_info *info) } } -void pnp_enable_devices(device_t base_dev, struct device_operations *ops, +void pnp_enable_devices(struct device *base_dev, struct device_operations *ops, unsigned int functions, struct pnp_info *info) { struct device_path path; - device_t dev; + struct device *dev; int i; path.type = DEVICE_PATH_PNP; diff --git a/src/device/root_device.c b/src/device/root_device.c index 49fa711..fb32151 100644 --- a/src/device/root_device.c +++ b/src/device/root_device.c @@ -35,7 +35,7 @@ const char mainboard_name[] = CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_ * * @param root Pointer to the device structure for the system root device. */ -static void root_dev_read_resources(device_t root) +static void root_dev_read_resources(struct device *root) { printk(BIOS_ERR, "%s should never be called.\n", __func__); } @@ -48,7 +48,7 @@ static void root_dev_read_resources(device_t root) * * @param root Pointer to the device structure for the system root device. */ -static void root_dev_set_resources(device_t root) +static void root_dev_set_resources(struct device *root) { printk(BIOS_ERR, "%s should never be called.\n", __func__); } @@ -76,9 +76,9 @@ static void root_dev_set_resources(device_t root) * @return The largest bus number used. */ static int smbus_max = 0; -unsigned int scan_static_bus(device_t bus, unsigned int max) +unsigned int scan_static_bus(struct device *bus, unsigned int max) { - device_t child; + struct device *child; struct bus *link; printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus)); @@ -121,7 +121,7 @@ unsigned int scan_static_bus(device_t bus, unsigned int max) return max; } -static void root_dev_enable_resources(device_t dev) +static void root_dev_enable_resources(struct device *dev) { } @@ -134,12 +134,12 @@ static void root_dev_enable_resources(device_t dev) * @param max The current bus number scanned so far, usually 0x00. * @return The largest bus number used. */ -static unsigned int root_dev_scan_bus(device_t root, unsigned int max) +static unsigned int root_dev_scan_bus(struct device *root, unsigned int max) { return scan_static_bus(root, max); } -static void root_dev_init(device_t root) +static void root_dev_init(struct device *root) { } diff --git a/src/device/smbus_ops.c b/src/device/smbus_ops.c index 41b31ed..547d144 100644 --- a/src/device/smbus_ops.c +++ b/src/device/smbus_ops.c @@ -25,7 +25,7 @@ #include <device/path.h> #include <device/smbus.h> -struct bus *get_pbus_smbus(device_t dev) +struct bus *get_pbus_smbus(struct device *dev) { struct bus *pbus = dev->bus; @@ -51,7 +51,7 @@ struct bus *get_pbus_smbus(device_t dev) * * @param dev TODO. */ -int smbus_set_link(device_t dev) +int smbus_set_link(struct device *dev) { struct bus *pbus_a[4]; // 4 level mux only. Enough? struct bus *pbus = dev->bus; @@ -87,70 +87,70 @@ int smbus_set_link(device_t dev) } -int smbus_quick_read(device_t dev) +int smbus_quick_read(struct device *dev) { CHECK_PRESENCE(quick_read); return ops_smbus_bus(get_pbus_smbus(dev))->quick_read(dev); } -int smbus_quick_write(device_t dev) +int smbus_quick_write(struct device *dev) { CHECK_PRESENCE(quick_write); return ops_smbus_bus(get_pbus_smbus(dev))->quick_write(dev); } -int smbus_recv_byte(device_t dev) +int smbus_recv_byte(struct device *dev) { CHECK_PRESENCE(recv_byte); return ops_smbus_bus(get_pbus_smbus(dev))->recv_byte(dev); } -int smbus_send_byte(device_t dev, u8 byte) +int smbus_send_byte(struct device *dev, u8 byte) { CHECK_PRESENCE(send_byte); return ops_smbus_bus(get_pbus_smbus(dev))->send_byte(dev, byte); } -int smbus_read_byte(device_t dev, u8 addr) +int smbus_read_byte(struct device *dev, u8 addr) { CHECK_PRESENCE(read_byte); return ops_smbus_bus(get_pbus_smbus(dev))->read_byte(dev, addr); } -int smbus_write_byte(device_t dev, u8 addr, u8 val) +int smbus_write_byte(struct device *dev, u8 addr, u8 val) { CHECK_PRESENCE(write_byte); return ops_smbus_bus(get_pbus_smbus(dev))->write_byte(dev, addr, val); } -int smbus_read_word(device_t dev, u8 addr) +int smbus_read_word(struct device *dev, u8 addr) { CHECK_PRESENCE(read_word); return ops_smbus_bus(get_pbus_smbus(dev))->read_word(dev, addr); } -int smbus_write_word(device_t dev, u8 addr, u16 val) +int smbus_write_word(struct device *dev, u8 addr, u16 val) { CHECK_PRESENCE(write_word); return ops_smbus_bus(get_pbus_smbus(dev))->write_word(dev, addr, val); } -int smbus_process_call(device_t dev, u8 cmd, u16 data) +int smbus_process_call(struct device *dev, u8 cmd, u16 data) { CHECK_PRESENCE(process_call); return ops_smbus_bus(get_pbus_smbus(dev))->process_call(dev, cmd, data); } -int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer) +int smbus_block_read(struct device *dev, u8 cmd, u8 bytes, u8 *buffer) { CHECK_PRESENCE(block_read); @@ -158,7 +158,7 @@ int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer) bytes, buffer); } -int smbus_block_write(device_t dev, u8 cmd, u8 bytes, const u8 *buffer) +int smbus_block_write(struct device *dev, u8 cmd, u8 bytes, const u8 *buffer) { CHECK_PRESENCE(block_write); diff --git a/src/include/cpu/amd/model_fxx_rev.h b/src/include/cpu/amd/model_fxx_rev.h index 1e85596..c3ef4e9 100644 --- a/src/include/cpu/amd/model_fxx_rev.h +++ b/src/include/cpu/amd/model_fxx_rev.h @@ -1,4 +1,5 @@ #include <arch/cpu.h> +#include <arch/io.h> int init_processor_name(void); @@ -59,7 +60,7 @@ static int is_e0_later_in_bsp(int nodeid) return !is_cpu_pre_e0(); } // d0 will be treated as e0 with this methods, but the d0 nb_cfg_54 always 0 - device_t dev; + pci_devfn_t dev; dev = PCI_DEV(0, 0x18+nodeid,2); val_old = pci_read_config32(dev, 0x80); val = val_old; @@ -101,7 +102,7 @@ static inline int is_cpu_pre_f2(void) static inline int is_cpu_f0_in_bsp(int nodeid) { uint32_t dword; - device_t dev; + pci_devfn_t dev; dev = PCI_DEV(0, 0x18+nodeid, 3); dword = pci_read_config32(dev, 0xfc); return (dword & 0xfff00) == 0x40f00; @@ -109,7 +110,7 @@ static inline int is_cpu_f0_in_bsp(int nodeid) static inline int is_cpu_pre_f2_in_bsp(int nodeid) { uint32_t dword; - device_t dev; + pci_devfn_t dev; dev = PCI_DEV(0, 0x18+nodeid, 3); dword = pci_read_config32(dev, 0xfc); return (dword & 0xfff0f) < 0x40f02; diff --git a/src/include/device/agp.h b/src/include/device/agp.h index be2b833..b3791fe 100644 --- a/src/include/device/agp.h +++ b/src/include/device/agp.h @@ -7,7 +7,7 @@ unsigned int agp_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max); -unsigned int agp_scan_bridge(device_t dev, unsigned int max); +unsigned int agp_scan_bridge(struct device *dev, unsigned int max); extern struct device_operations default_agp_ops_bus; diff --git a/src/include/device/cardbus.h b/src/include/device/cardbus.h index 45ae24f..4443c15 100644 --- a/src/include/device/cardbus.h +++ b/src/include/device/cardbus.h @@ -5,8 +5,8 @@ #include <device/device.h> -void cardbus_read_resources(device_t dev); -void cardbus_enable_resources(device_t dev); +void cardbus_read_resources(struct device *dev); +void cardbus_enable_resources(struct device *dev); extern struct device_operations default_cardbus_ops_bus; diff --git a/src/include/device/device.h b/src/include/device/device.h index c67205c..fe8dbed 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -41,19 +41,19 @@ struct smbios_type11; struct acpi_rsdp; struct device_operations { - void (*read_resources)(device_t dev); - void (*set_resources)(device_t dev); - void (*enable_resources)(device_t dev); - void (*init)(device_t dev); - void (*final)(device_t dev); - unsigned int (*scan_bus)(device_t bus, unsigned int _max); - void (*enable)(device_t dev); - void (*disable)(device_t dev); - void (*set_link)(device_t dev, unsigned int link); + void (*read_resources)(struct device *dev); + void (*set_resources)(struct device *dev); + void (*enable_resources)(struct device *dev); + void (*init)(struct device *dev); + void (*final)(struct device *dev); + unsigned int (*scan_bus)(struct device *bus, unsigned int _max); + void (*enable)(struct device *dev); + void (*disable)(struct device *dev); + void (*set_link)(struct device *dev, unsigned int link); void (*reset_bus)(struct bus *bus); #if CONFIG_GENERATE_SMBIOS_TABLES - int (*get_smbios_data)(device_t dev, int *handle, unsigned long *current); - void (*get_smbios_strings)(device_t dev, struct smbios_type11 *t); + int (*get_smbios_data)(struct device *dev, int *handle, unsigned long *current); + void (*get_smbios_strings)(struct device *dev, struct smbios_type11 *t); #endif #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) && IS_ENABLED(CONFIG_PER_DEVICE_ACPI_TABLES) unsigned long (*write_acpi_tables)(unsigned long start, struct acpi_rsdp *rsdp); @@ -62,7 +62,7 @@ struct device_operations { #endif const struct pci_operations *ops_pci; const struct smbus_bus_operations *ops_smbus_bus; - const struct pci_bus_operations * (*ops_pci_bus)(device_t dev); + const struct pci_bus_operations * (*ops_pci_bus)(struct device *dev); const struct pnp_mode_ops *ops_pnp_mode; }; @@ -76,9 +76,8 @@ static inline void device_noop(struct device *dev) {} struct bus { - - ROMSTAGE_CONST struct device * dev; /* This bridge device */ - ROMSTAGE_CONST struct device * children; /* devices behind this bridge */ + ROMSTAGE_CONST struct device *dev; /* This bridge device */ + ROMSTAGE_CONST struct device *children; /* devices behind this bridge */ ROMSTAGE_CONST struct bus *next; /* The next bridge on this device */ unsigned bridge_ctrl; /* Bridge control register */ unsigned char link_num; /* The index of this link */ @@ -98,7 +97,7 @@ struct pci_irq_info { unsigned int ioapic_irq_pin; unsigned int ioapic_src_pin; unsigned int ioapic_dst_id; - unsigned int ioapic_flags; + unsigned int ioapic_flags; }; struct device { @@ -159,7 +158,7 @@ extern uint64_t uma_memory_size; #endif /* Generic device interface functions */ -device_t alloc_dev(struct bus *parent, struct device_path *path); +struct device *alloc_dev(struct bus *parent, struct device_path *path); void dev_initialize_chips(void); void dev_enumerate(void); void dev_configure(void); @@ -175,30 +174,30 @@ unsigned int scan_bus(struct device *bus, unsigned int _max); void assign_resources(struct bus *bus); void enumerate_static_device(void); void enumerate_static_devices(void); -const char *dev_name(device_t dev); -const char *dev_path(device_t dev); -u32 dev_path_encode(device_t dev); +const char *dev_name(struct device *dev); +const char *dev_path(struct device *dev); +u32 dev_path_encode(struct device *dev); const char *bus_path(struct bus *bus); -void dev_set_enabled(device_t dev, int enable); +void dev_set_enabled(struct device *dev, int enable); void disable_children(struct bus *bus); /* Option ROM helper functions */ void run_bios(struct device *dev, unsigned long addr); /* Helper functions */ -device_t find_dev_path(struct bus *parent, struct device_path *path); -device_t alloc_find_dev(struct bus *parent, struct device_path *path); -device_t dev_find_device (u16 vendor, u16 device, device_t from); -device_t dev_find_class (unsigned int class, device_t from); -device_t dev_find_slot (unsigned int bus, unsigned int devfn); -device_t dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); -device_t dev_find_slot_pnp(u16 port, u16 device); -device_t dev_find_lapic(unsigned apic_id); +struct device *find_dev_path(struct bus *parent, struct device_path *path); +struct device *alloc_find_dev(struct bus *parent, struct device_path *path); +struct device *dev_find_device (u16 vendor, u16 device, struct device *from); +struct device *dev_find_class (unsigned int class, struct device *from); +struct device *dev_find_slot (unsigned int bus, unsigned int devfn); +struct device *dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); +struct device *dev_find_slot_pnp(u16 port, u16 device); +struct device *dev_find_lapic(unsigned apic_id); int dev_count_cpu(void); void remap_bsp_lapic(struct bus *cpu_bus); -device_t add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled); -void set_cpu_topology(device_t cpu, unsigned node, unsigned package, unsigned core, unsigned thread); +struct device *add_cpu_device(struct bus *cpu_bus, unsigned apic_id, int enabled); +void set_cpu_topology(struct device *cpu, unsigned node, unsigned package, unsigned core, unsigned thread); #define amd_cpu_topology(cpu, node, core) \ set_cpu_topology(cpu, node, 0, core, 0) @@ -207,7 +206,7 @@ void set_cpu_topology(device_t cpu, unsigned node, unsigned package, unsigned co set_cpu_topology(cpu, 0, package, core, thread) /* Debug functions */ -void print_resource_tree(struct device * root, int debug_level, +void print_resource_tree(struct device *root, int debug_level, const char *msg); void show_devs_tree(struct device *dev, int debug_level, int depth, int linknum); void show_devs_subtree(struct device *root, int debug_level, const char *msg); @@ -226,9 +225,9 @@ void show_all_devs_resources(int debug_level, const char* msg); extern struct device_operations default_dev_ops_root; void pci_domain_read_resources(struct device *dev); unsigned int pci_domain_scan_bus(struct device *dev, unsigned int _max); -unsigned int scan_static_bus(device_t bus, unsigned int _max); +unsigned int scan_static_bus(struct device *bus, unsigned int _max); -void fixed_mem_resource(device_t dev, unsigned long index, +void fixed_mem_resource(struct device *dev, unsigned long index, unsigned long basek, unsigned long sizek, unsigned long type); @@ -257,7 +256,7 @@ u32 find_pci_tolm(struct bus *bus); ROMSTAGE_CONST struct device * dev_find_slot (unsigned int bus, unsigned int devfn); -ROMSTAGE_CONST struct device *dev_find_next_pci_device( +ROMSTAGE_CONST struct device * dev_find_next_pci_device( ROMSTAGE_CONST struct device *previous_dev); ROMSTAGE_CONST struct device * dev_find_slot_on_smbus (unsigned int bus, unsigned int addr); diff --git a/src/include/device/pci.h b/src/include/device/pci.h index 0670da4..3688322 100644 --- a/src/include/device/pci.h +++ b/src/include/device/pci.h @@ -32,7 +32,7 @@ /* Common pci operations without a standard interface */ struct pci_operations { /* set the Subsystem IDs for the PCI device */ - void (*set_subsystem)(device_t dev, unsigned vendor, unsigned device); + void (*set_subsystem)(struct device *dev, unsigned vendor, unsigned device); }; /* Common pci bus operations */ @@ -62,35 +62,35 @@ extern struct pci_driver epci_drivers[]; extern struct device_operations default_pci_ops_dev; extern struct device_operations default_pci_ops_bus; -void pci_dev_read_resources(device_t dev); -void pci_bus_read_resources(device_t dev); -void pci_dev_set_resources(device_t dev); -void pci_dev_enable_resources(device_t dev); -void pci_bus_enable_resources(device_t dev); +void pci_dev_read_resources(struct device *dev); +void pci_bus_read_resources(struct device *dev); +void pci_dev_set_resources(struct device *dev); +void pci_dev_enable_resources(struct device *dev); +void pci_bus_enable_resources(struct device *dev); void pci_bus_reset(struct bus *bus); -device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn); -unsigned int do_pci_scan_bridge(device_t bus, unsigned int max, +struct device *pci_probe_dev(struct device *dev, struct bus *bus, unsigned devfn); +unsigned int do_pci_scan_bridge(struct device *bus, unsigned int max, unsigned int (*do_scan_bus)(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max)); -unsigned int pci_scan_bridge(device_t bus, unsigned int max); +unsigned int pci_scan_bridge(struct device *bus, unsigned int max); unsigned int pci_scan_bus(struct bus *bus, unsigned min_devfn, unsigned max_devfn, unsigned int max); uint8_t pci_moving_config8(struct device *dev, unsigned reg); uint16_t pci_moving_config16(struct device *dev, unsigned reg); uint32_t pci_moving_config32(struct device *dev, unsigned reg); struct resource *pci_get_resource(struct device *dev, unsigned long index); -void pci_dev_set_subsystem(device_t dev, unsigned vendor, unsigned device); +void pci_dev_set_subsystem(struct device *dev, unsigned vendor, unsigned device); void pci_dev_init(struct device *dev); -unsigned int pci_match_simple_dev(device_t dev, pci_devfn_t sdev); +unsigned int pci_match_simple_dev(struct device *dev, pci_devfn_t sdev); const char * pin_to_str(int pin); -int get_pci_irq_pins(device_t dev, device_t *parent_bdg); +int get_pci_irq_pins(struct device *dev, struct device **parent_bdg); void pci_assign_irqs(unsigned bus, unsigned slot, const unsigned char pIntAtoD[4]); #define PCI_IO_BRIDGE_ALIGN 4096 #define PCI_MEM_BRIDGE_ALIGN (1024*1024) -static inline const struct pci_operations *ops_pci(device_t dev) +static inline const struct pci_operations *ops_pci(struct device *dev) { const struct pci_operations *pops; pops = 0; @@ -106,8 +106,8 @@ static inline const struct pci_operations *ops_pci(device_t dev) unsigned pci_find_next_capability(pci_devfn_t dev, unsigned cap, unsigned last); unsigned pci_find_capability(pci_devfn_t dev, unsigned cap); #else /* !__PRE_RAM__ */ -unsigned pci_find_next_capability(device_t dev, unsigned cap, unsigned last); -unsigned pci_find_capability(device_t dev, unsigned cap); +unsigned pci_find_next_capability(struct device *dev, unsigned cap, unsigned last); +unsigned pci_find_capability(struct device *dev, unsigned cap); #endif /* __PRE_RAM__ */ void pci_early_bridge_init(void); diff --git a/src/include/device/pciexp.h b/src/include/device/pciexp.h index 87a5002..c7ff4f5 100644 --- a/src/include/device/pciexp.h +++ b/src/include/device/pciexp.h @@ -11,7 +11,7 @@ enum aspm_type { unsigned int pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max); -unsigned int pciexp_scan_bridge(device_t dev, unsigned int max); +unsigned int pciexp_scan_bridge(struct device *dev, unsigned int max); extern struct device_operations default_pciexp_ops_bus; diff --git a/src/include/device/pcix.h b/src/include/device/pcix.h index 4ffab5b..8cc83df 100644 --- a/src/include/device/pcix.h +++ b/src/include/device/pcix.h @@ -4,7 +4,7 @@ unsigned int pcix_scan_bus(struct bus *bus, unsigned int min_devfn, unsigned int max_devfn, unsigned int max); -unsigned int pcix_scan_bridge(device_t dev, unsigned int max); +unsigned int pcix_scan_bridge(struct device *dev, unsigned int max); const char *pcix_speed(u16 sstatus); extern struct device_operations default_pcix_ops_bus; diff --git a/src/include/device/pnp.h b/src/include/device/pnp.h index d0d6fa3..9290056 100644 --- a/src/include/device/pnp.h +++ b/src/include/device/pnp.h @@ -9,21 +9,21 @@ #ifndef __SIMPLE_DEVICE__ /* Primitive PNP resource manipulation */ -void pnp_write_config(device_t dev, u8 reg, u8 value); -u8 pnp_read_config(device_t dev, u8 reg); -void pnp_set_logical_device(device_t dev); -void pnp_set_enable(device_t dev, int enable); -int pnp_read_enable(device_t dev); -void pnp_set_iobase(device_t dev, u8 index, u16 iobase); -void pnp_set_irq(device_t dev, u8 index, u8 irq); -void pnp_set_drq(device_t dev, u8 index, u8 drq); +void pnp_write_config(struct device *dev, u8 reg, u8 value); +u8 pnp_read_config(struct device *dev, u8 reg); +void pnp_set_logical_device(struct device *dev); +void pnp_set_enable(struct device *dev, int enable); +int pnp_read_enable(struct device *dev); +void pnp_set_iobase(struct device *dev, u8 index, u16 iobase); +void pnp_set_irq(struct device *dev, u8 index, u8 irq); +void pnp_set_drq(struct device *dev, u8 index, u8 drq); /* PNP device operations */ -void pnp_read_resources(device_t dev); -void pnp_set_resources(device_t dev); -void pnp_enable_resources(device_t dev); -void pnp_enable(device_t dev); -void pnp_alt_enable(device_t dev); +void pnp_read_resources(struct device *dev); +void pnp_set_resources(struct device *dev); +void pnp_enable_resources(struct device *dev); +void pnp_enable(struct device *dev); +void pnp_alt_enable(struct device *dev); extern struct device_operations pnp_ops; @@ -52,16 +52,16 @@ struct pnp_info { #define PNP_MSC10 0x1000 struct io_info io0, io1, io2, io3; }; -struct resource *pnp_get_resource(device_t dev, unsigned index); +struct resource *pnp_get_resource(struct device *dev, unsigned index); void pnp_enable_devices(struct device *dev, struct device_operations *ops, unsigned int functions, struct pnp_info *info); struct pnp_mode_ops { - void (*enter_conf_mode)(device_t dev); - void (*exit_conf_mode)(device_t dev); + void (*enter_conf_mode)(struct device *dev); + void (*exit_conf_mode)(struct device *dev); }; -void pnp_enter_conf_mode(device_t dev); -void pnp_exit_conf_mode(device_t dev); +void pnp_enter_conf_mode(struct device *dev); +void pnp_exit_conf_mode(struct device *dev); #endif /* ! __SIMPLE_DEVICE__ */ -#endif /* DEVICE_PNP_H */ +#endif /*devICE_PNP_H */ diff --git a/src/include/device/smbus.h b/src/include/device/smbus.h index 073d7e2..7002459 100644 --- a/src/include/device/smbus.h +++ b/src/include/device/smbus.h @@ -8,17 +8,17 @@ /* Common SMBus bus operations */ struct smbus_bus_operations { - int (*quick_read) (device_t dev); - int (*quick_write) (device_t dev); - int (*recv_byte) (device_t dev); - int (*send_byte) (device_t dev, u8 value); - int (*read_byte) (device_t dev, u8 addr); - int (*write_byte) (device_t dev, u8 addr, u8 value); - int (*read_word) (device_t dev, u8 addr); - int (*write_word) (device_t dev, u8 addr, u16 value); - int (*process_call)(device_t dev, u8 cmd, u16 data); - int (*block_read) (device_t dev, u8 cmd, u8 bytes, u8 *buffer); - int (*block_write) (device_t dev, u8 cmd, u8 bytes, const u8 *buffer); + int (*quick_read) (struct device *dev); + int (*quick_write) (struct device *dev); + int (*recv_byte) (struct device *dev); + int (*send_byte) (struct device *dev, u8 value); + int (*read_byte) (struct device *dev, u8 addr); + int (*write_byte) (struct device *dev, u8 addr, u8 value); + int (*read_word) (struct device *dev, u8 addr); + int (*write_word) (struct device *dev, u8 addr, u16 value); + int (*process_call)(struct device *dev, u8 cmd, u16 data); + int (*block_read) (struct device *dev, u8 cmd, u8 bytes, u8 *buffer); + int (*block_write) (struct device *dev, u8 cmd, u8 bytes, const u8 *buffer); }; static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus) @@ -32,19 +32,19 @@ static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus) return bops; } -struct bus *get_pbus_smbus(device_t dev); -int smbus_set_link(device_t dev); - -int smbus_quick_read(device_t dev); -int smbus_quick_write(device_t dev); -int smbus_recv_byte(device_t dev); -int smbus_send_byte(device_t dev, u8 byte); -int smbus_read_byte(device_t dev, u8 addr); -int smbus_write_byte(device_t dev, u8 addr, u8 val); -int smbus_read_word(device_t dev, u8 addr); -int smbus_write_word(device_t dev, u8 addr, u16 val); -int smbus_process_call(device_t dev, u8 cmd, u16 data); -int smbus_block_read(device_t dev, u8 cmd, u8 bytes, u8 *buffer); -int smbus_block_write(device_t dev, u8 cmd, u8 bytes, const u8 *buffer); - -#endif /* DEVICE_SMBUS_H */ +struct bus *get_pbus_smbus(struct device *dev); +int smbus_set_link(struct device *dev); + +int smbus_quick_read(struct device *dev); +int smbus_quick_write(struct device *dev); +int smbus_recv_byte(struct device *dev); +int smbus_send_byte(struct device *dev, u8 byte); +int smbus_read_byte(struct device *dev, u8 addr); +int smbus_write_byte(struct device *dev, u8 addr, u8 val); +int smbus_read_word(struct device *dev, u8 addr); +int smbus_write_word(struct device *dev, u8 addr, u16 val); +int smbus_process_call(struct device *dev, u8 cmd, u16 data); +int smbus_block_read(struct device *dev, u8 cmd, u8 bytes, u8 *buffer); +int smbus_block_write(struct device *dev, u8 cmd, u8 bytes, const u8 *buffer); + +#endif /*devICE_SMBUS_H */ diff --git a/src/include/reg_script.h b/src/include/reg_script.h index 97b4fb0..71be7c2 100644 --- a/src/include/reg_script.h +++ b/src/include/reg_script.h @@ -34,7 +34,7 @@ * are employed: * - Chaining of tables that allow runtime tables to chain to compile-time * tables. - * - Notion of current device (device_t) being worked on. This allows for + * - Notion of current device (struct device *) being worked on. This allows for * PCI config, io, and mmio on a particular device's resources. * * Note that when using REG_SCRIPT_COMMAND_NEXT there is an implicit push @@ -80,7 +80,7 @@ struct reg_script { union { uint32_t id; const struct reg_script *next; - device_t dev; + struct device *dev; unsigned int res_index; }; }; @@ -334,6 +334,6 @@ struct reg_script { _REG_SCRIPT_ENCODE_RAW(REG_SCRIPT_COMMAND_END, 0, 0, 0, 0, 0, 0, 0) void reg_script_run(const struct reg_script *script); -void reg_script_run_on_dev(device_t dev, const struct reg_script *step); +void reg_script_run_on_dev(struct device *dev, const struct reg_script *step); #endif /* REG_SCRIPT_H */ diff --git a/src/lib/reg_script.c b/src/lib/reg_script.c index 647723b..92ab3e9 100644 --- a/src/lib/reg_script.c +++ b/src/lib/reg_script.c @@ -42,13 +42,13 @@ #endif struct reg_script_context { - device_t dev; + pci_devfn_t dev; struct resource *res; const struct reg_script *step; }; static inline void reg_script_set_dev(struct reg_script_context *ctx, - device_t dev) + pci_devfn_t dev) { ctx->dev = dev; ctx->res = NULL; @@ -536,7 +536,7 @@ static void reg_script_run_next(struct reg_script_context *prev_ctx, reg_script_run_with_context(&ctx); } -void reg_script_run_on_dev(device_t dev, const struct reg_script *step) +void reg_script_run_on_dev(pci_devfn_t dev, const struct reg_script *step) { struct reg_script_context ctx;
1
0
0
0
New patch to review for coreboot: 24473a1 TESTing
by Edward O'Callaghan
05 Nov '14
05 Nov '14
Edward O'Callaghan (eocallaghan(a)alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/7338
-gerrit commit 24473a18bc5bd45edad0c3261b92d1df7e27ee46 Author: Edward O'Callaghan <eocallaghan(a)alterapraxis.com> Date: Wed Nov 5 18:07:45 2014 +1100 TESTing Change-Id: Ifc5fda36a5fe64b197f2020da99c698e75574667 Signed-off-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com> --- src/lib/reg_script.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/reg_script.c b/src/lib/reg_script.c index 503c6c0..5670c69 100644 --- a/src/lib/reg_script.c +++ b/src/lib/reg_script.c @@ -42,13 +42,13 @@ #endif struct reg_script_context { - device_t dev; + pci_devfn_t dev; struct resource *res; const struct reg_script *step; }; static inline void reg_script_set_dev(struct reg_script_context *ctx, - device_t dev) + pci_devfn_t dev) { ctx->dev = dev; ctx->res = NULL;
1
0
0
0
← Newer
1
...
128
129
130
131
132
133
134
...
145
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
Results per page:
10
25
50
100
200