*/include/cpu: use unsigned int for number of address bits

The number of physical address bits and reserved address bits shouldn't
ever be negative, so change the return type of cpu_phys_address_size,
get_reserved_phys_addr_bits, and get_tme_keyid_bits from int to unsigned
int.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I9e67db6bf0c38f743b50e7273449cc028de13a8c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78072
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Reviewed-by: Varshit Pandya <pandyavarshit@gmail.com>
This commit is contained in:
Felix Held 2023-09-12 14:18:49 +02:00
parent 49c4584669
commit ff4d6be9f9
4 changed files with 6 additions and 6 deletions

View File

@ -44,7 +44,7 @@ unsigned int cpu_cpuid_extended_level(void)
return cpuid_eax(0x80000000); return cpuid_eax(0x80000000);
} }
int cpu_phys_address_size(void) unsigned int cpu_phys_address_size(void)
{ {
if (!(cpu_have_cpuid())) if (!(cpu_have_cpuid()))
return 32; return 32;

View File

@ -317,10 +317,10 @@ size_t get_cache_size(const struct cpu_cache_info *info);
bool fill_cpu_cache_info(uint8_t level, struct cpu_cache_info *info); bool fill_cpu_cache_info(uint8_t level, struct cpu_cache_info *info);
#if CONFIG(CPU_INTEL_COMMON) #if CONFIG(CPU_INTEL_COMMON)
int get_reserved_phys_addr_bits(void); unsigned int get_reserved_phys_addr_bits(void);
#else #else
/* Default implementation */ /* Default implementation */
static inline int get_reserved_phys_addr_bits(void) static inline unsigned int get_reserved_phys_addr_bits(void)
{ {
/* Default implementation */ /* Default implementation */
return 0; return 0;

View File

@ -248,7 +248,7 @@ bool is_tme_supported(void)
* configured in the MSRs according to the capabilities and platform * configured in the MSRs according to the capabilities and platform
* configuration. For instance, after FSP-M. * configuration. For instance, after FSP-M.
*/ */
static int get_tme_keyid_bits(void) static unsigned int get_tme_keyid_bits(void)
{ {
msr_t msr; msr_t msr;
@ -256,7 +256,7 @@ static int get_tme_keyid_bits(void)
return msr.hi & TME_ACTIVATE_HI_KEYID_BITS_MASK; return msr.hi & TME_ACTIVATE_HI_KEYID_BITS_MASK;
} }
int get_reserved_phys_addr_bits(void) unsigned int get_reserved_phys_addr_bits(void)
{ {
if (!is_tme_supported()) if (!is_tme_supported())
return 0; return 0;

View File

@ -9,7 +9,7 @@
void cpu_initialize(void); void cpu_initialize(void);
uintptr_t cpu_get_lapic_addr(void); uintptr_t cpu_get_lapic_addr(void);
struct bus; struct bus;
int cpu_phys_address_size(void); unsigned int cpu_phys_address_size(void);
#if ENV_RAMSTAGE #if ENV_RAMSTAGE
#define __cpu_driver __attribute__((used, __section__(".rodata.cpu_driver"))) #define __cpu_driver __attribute__((used, __section__(".rodata.cpu_driver")))