From: "Wu, Hao A" <hao.a.wu@intel.com>
To: Pedro Falcato <pedro.falcato@gmail.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Subject: Re: [PATCH 2/2] SourceLevelDebugPkg/DebugAgent: Delete the CRC16 implementation
Date: Mon, 28 Mar 2022 00:14:27 +0000 [thread overview]
Message-ID: <DM6PR11MB40251A76014E82B489417152CA1D9@DM6PR11MB4025.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220327005748.92041-3-pedro.falcato@gmail.com>
Hello,
My local test shows that the results between the old (SourceLevelDebugPkg) & new (MdePkg) CRC16 implementation are different:
UINT8 Array[16] = {1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1};
UINT16 a, b;
a = CalculateCrc16New(Array, sizeof(Array), 0xFFFF);
b = CalculateCrc16Old(Array, sizeof(Array), 0xFFFF);
Result:
a = 0x0af5
b = 0x2778
My take is that for the SourceLevelDebugPkg case, the CRC16 result should be the same (at BIOS host side). Otherwise, the target side will have issue for the CRC check.
Best Regards,
Hao Wu
> -----Original Message-----
> From: Pedro Falcato <pedro.falcato@gmail.com>
> Sent: Sunday, March 27, 2022 8:58 AM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A <hao.a.wu@intel.com>
> Subject: [PATCH 2/2] SourceLevelDebugPkg/DebugAgent: Delete the CRC16
> implementation
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871
>
> Deletes the CRC16 implementation as CalculateCrc16() is being merged into
> BaseLib.
>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
> ---
> .../DebugAgent/DebugAgentCommon/DebugAgent.c | 35 -------------------
> 1 file changed, 35 deletions(-)
>
> diff --git
> a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgen
> t.c
> b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgen
> t.c
> index a1e61a6ef90e..62c6a235d425 100644
> ---
> a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgen
> t.c
> +++
> b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgen
> t
> +++ .c
> @@ -126,41 +126,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED
> EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAg
>
> GLOBAL_REMOVE_IF_UNREFERENCED UINTN mVectorHandoffInfoCount =
> sizeof (mVectorHandoffInfoDebugAgent) / sizeof
> (EFI_VECTOR_HANDOFF_INFO);
>
> -/**
> - Calculate CRC16 for target data.
> -
> - @param[in] Data The target data.
> - @param[in] DataSize The target data size.
> - @param[in] Crc Initial CRC.
> -
> - @return UINT16 The CRC16 value.
> -
> -**/
> -UINT16
> -CalculateCrc16 (
> - IN UINT8 *Data,
> - IN UINTN DataSize,
> - IN UINT16 Crc
> - )
> -{
> - UINTN Index;
> - UINTN BitIndex;
> -
> - for (Index = 0; Index < DataSize; Index++) {
> - Crc ^= (UINT16)Data[Index];
> - for (BitIndex = 0; BitIndex < 8; BitIndex++) {
> - if ((Crc & 0x8000) != 0) {
> - Crc <<= 1;
> - Crc ^= 0x1021;
> - } else {
> - Crc <<= 1;
> - }
> - }
> - }
> -
> - return Crc;
> -}
> -
> /**
> Read IDT entry to check if IDT entries are setup by Debug Agent.
>
> --
> 2.35.1
next prev parent reply other threads:[~2022-03-28 0:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-27 0:57 [PATCH 0/2] Add CRC16 and CRC32c to MdePkg/BaseLib Pedro Falcato
2022-03-27 0:57 ` [PATCH 1/2] MdePkg/BaseLib: Add CRC16 and CRC32c implementations Pedro Falcato
2022-03-27 0:57 ` [PATCH 2/2] SourceLevelDebugPkg/DebugAgent: Delete the CRC16 implementation Pedro Falcato
2022-03-28 0:14 ` Wu, Hao A [this message]
2022-03-28 1:49 ` Pedro Falcato
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=DM6PR11MB40251A76014E82B489417152CA1D9@DM6PR11MB4025.namprd11.prod.outlook.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