diff mbox series

[2/2] acpi: fadt: remove hard-coded FADT version

Message ID 20210813170229.472683-2-alex.hung@canonical.com
State Accepted
Headers show
Series [1/2] acpi: fadt: clarify comments of FACS and HW-reduced mode | expand

Commit Message

Alex Hung Aug. 13, 2021, 5:02 p.m. UTC
FADT version is the same as ACPI version, and minor is only the lower 4
bits since ACPI 6.4.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/acpi/fadt/fadt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Ivan Hu Aug. 16, 2021, 5:40 a.m. UTC | #1
On 8/14/21 1:02 AM, Alex Hung wrote:
> FADT version is the same as ACPI version, and minor is only the lower 4
> bits since ACPI 6.4.
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/fadt/fadt.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c
> index acf767e5..fc8b5987 100644
> --- a/src/acpi/fadt/fadt.c
> +++ b/src/acpi/fadt/fadt.c
> @@ -196,15 +196,15 @@ static int fadt_checksum(fwts_framework *fw)
>  
>  static int fadt_revision(fwts_framework *fw)
>  {
> -	const uint8_t LATEST_MAJOR = 6;
> -	const uint8_t LATEST_MINOR = 3;
> +	const uint8_t LATEST_MAJOR = (FWTS_ACPI_VERSION_NOW & 0xF00) >> 8;
> +	const uint8_t LATEST_MINOR = (FWTS_ACPI_VERSION_NOW & 0xFF) >> 4;
>  	uint8_t major;
>  	uint8_t minor;
>  
>  	major = fadt->header.revision;
>  	minor = 0;
>  	if (major >= 5 && fadt->header.length >= 268)
> -		minor = fadt->minor_version;   /* field added ACPI 5.1 */
> +		minor = fadt->minor_version & 0xF;   /* field added ACPI 5.1 */
>  
>  	fwts_log_info(fw, "FADT revision: %" PRIu8 ".%" PRIu8, major, minor);
>  	fwts_log_info(fw, "FADT table length: %" PRIu32, fadt->header.length);
> 


Acked-by: Ivan Hu <ivan.hu@canonical.com>
Colin Ian King Aug. 24, 2021, 1:24 p.m. UTC | #2
On 13/08/2021 18:02, Alex Hung wrote:
> FADT version is the same as ACPI version, and minor is only the lower 4
> bits since ACPI 6.4.
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/fadt/fadt.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c
> index acf767e5..fc8b5987 100644
> --- a/src/acpi/fadt/fadt.c
> +++ b/src/acpi/fadt/fadt.c
> @@ -196,15 +196,15 @@ static int fadt_checksum(fwts_framework *fw)
>  
>  static int fadt_revision(fwts_framework *fw)
>  {
> -	const uint8_t LATEST_MAJOR = 6;
> -	const uint8_t LATEST_MINOR = 3;
> +	const uint8_t LATEST_MAJOR = (FWTS_ACPI_VERSION_NOW & 0xF00) >> 8;
> +	const uint8_t LATEST_MINOR = (FWTS_ACPI_VERSION_NOW & 0xFF) >> 4;
>  	uint8_t major;
>  	uint8_t minor;
>  
>  	major = fadt->header.revision;
>  	minor = 0;
>  	if (major >= 5 && fadt->header.length >= 268)
> -		minor = fadt->minor_version;   /* field added ACPI 5.1 */
> +		minor = fadt->minor_version & 0xF;   /* field added ACPI 5.1 */
>  
>  	fwts_log_info(fw, "FADT revision: %" PRIu8 ".%" PRIu8, major, minor);
>  	fwts_log_info(fw, "FADT table length: %" PRIu32, fadt->header.length);
> 


Acked-by: Colin Ian King <colin.king@canonical.com>
diff mbox series

Patch

diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c
index acf767e5..fc8b5987 100644
--- a/src/acpi/fadt/fadt.c
+++ b/src/acpi/fadt/fadt.c
@@ -196,15 +196,15 @@  static int fadt_checksum(fwts_framework *fw)
 
 static int fadt_revision(fwts_framework *fw)
 {
-	const uint8_t LATEST_MAJOR = 6;
-	const uint8_t LATEST_MINOR = 3;
+	const uint8_t LATEST_MAJOR = (FWTS_ACPI_VERSION_NOW & 0xF00) >> 8;
+	const uint8_t LATEST_MINOR = (FWTS_ACPI_VERSION_NOW & 0xFF) >> 4;
 	uint8_t major;
 	uint8_t minor;
 
 	major = fadt->header.revision;
 	minor = 0;
 	if (major >= 5 && fadt->header.length >= 268)
-		minor = fadt->minor_version;   /* field added ACPI 5.1 */
+		minor = fadt->minor_version & 0xF;   /* field added ACPI 5.1 */
 
 	fwts_log_info(fw, "FADT revision: %" PRIu8 ".%" PRIu8, major, minor);
 	fwts_log_info(fw, "FADT table length: %" PRIu32, fadt->header.length);