public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Rebecca Cran" <rebecca@bsdio.com>
To: "Corvin Köhne" <corvink@FreeBSD.org>, devel@edk2.groups.io
Cc: Michael D Kinney <michael.d.kinney@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Zhiguang Liu <zhiguang.liu@intel.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Peter Grehan <grehan@freebsd.org>
Subject: Re: [PATCH 1/1] OvmfPkg/BhyveBhf: install bhyve's ACPI tables
Date: Mon, 17 Apr 2023 05:53:27 -0600	[thread overview]
Message-ID: <f19165db-d7b8-545e-5d24-53d103076dbb@bsdio.com> (raw)
In-Reply-To: <20230417114601.398383-1-corvink@FreeBSD.org>

On 4/17/23 5:46 AM, Corvin Köhne wrote:
> +
> +/**
> +  Get the address of bhyve's ACPI Root System Description Pointer (RSDP).
> +
> +  @param  RsdpPtr             Return pointer to RSDP.
> +
> +  @return EFI_SUCCESS         Bhyve's RSDP successfully found.
> +  @return EFI_NOT_FOUND       Couldn't find bhyve's RSDP.
> +  @return EFI_UNSUPPORTED     Revision is lower than 2.
> +  @return EFI_PROTOCOL_ERROR  Invalid RSDP found.

I think these should be @retval instead of @return ?

> +    if (Rsdp->Revision < 2) {
> +      DEBUG ((DEBUG_INFO, "%a: unsupported RSDP found\n", __FUNCTION__));

You missed converting this __FUNCTION__ to __func__.

> +    //
> +    // For ACPI 1.0/2.0/3.0 the checksum of first 20 bytes should be 0.
> +    // For ACPI 2.0/3.0 the checksum of the entire table should be 0.
> +    //
> +    UINT8  Sum = CalculateCheckSum8 (
> +                   (CONST UINT8 *)Rsdp,
> +                   sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
> +                   );

Variables should be declared at the top of the function, and initialized 
separately.

> +    if (Sum != 0) {
> +      DEBUG ((
> +        DEBUG_INFO,
> +        "%a: RSDP header checksum not valid: 0x%02x\n",
> +        __func__,
> +        Sum
> +        ));
> +      return EFI_PROTOCOL_ERROR;
> +    }
> +
> +    Sum = CalculateCheckSum8 (
> +            (CONST UINT8 *)Rsdp,
> +            sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
> +            );
> +    if (Sum != 0) {
> +      DEBUG ((
> +        DEBUG_INFO,
> +        "%a: RSDP table checksum not valid: 0x%02x\n",
> +        __func__,
> +        Sum
> +        ));
> +      return EFI_PROTOCOL_ERROR;
> +    }
> +
> +    //
> +    // RSDP was found and is valid
> +    //
> +    *RsdpPtr = Rsdp;
> +
> +    return EFI_SUCCESS;
> +  }
> +
> +  DEBUG ((DEBUG_INFO, "%a: RSDP not found\n", __func__));
Should these DEBUG_INFO messages which appear to be warnings/errors use 
DEBUG_WARN or DEBUG_ERROR, instead?


-- 
Rebecca Cran


       reply	other threads:[~2023-04-17 11:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230417114601.398383-1-corvink@FreeBSD.org>
2023-04-17 11:53 ` Rebecca Cran [this message]
2023-05-03  2:25   ` [PATCH 1/1] OvmfPkg/BhyveBhf: install bhyve's ACPI tables Rebecca Cran
2023-05-03  7:43     ` Corvin Köhne
2023-05-03 14:50       ` Rebecca Cran
2023-04-17 12:14 ` Gerd Hoffmann
2023-04-17 12:45   ` Corvin Köhne
2023-04-17 15:15     ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f19165db-d7b8-545e-5d24-53d103076dbb@bsdio.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox