* Correct value for PCD_DATABASE_OFFSET_MASK
@ 2021-06-30 12:54 Konstantin Aladyshev
0 siblings, 0 replies; only message in thread
From: Konstantin Aladyshev @ 2021-06-30 12:54 UTC (permalink / raw)
To: devel
Hello!
I was investigating implementation of the PCD database
(https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h).
According to my understanding LocalTokenNumber is implemented this way:
```
|31 30 29 28|27 26 25 24|23 22 21 20|19 18 17 16 15 14 13 12 11 9 8
7 6 5 4 3 2 1 0
| X X X X| X X X X| X X X X| X X X X X X X X X X X
X X X X X X X X
\___________/\__________/\__________/\______________________________________________________/
PCD_TYPE PCD_DATUM PCD_DATUM_2 PCD_DATABASE_OFFSET_MASK
```
PCD_DATABASE_OFFSET_MASK is defined as follows:
```
#define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_ALL_SET |
PCD_DATUM_TYPE_ALL_SET | PCD_DATUM_TYPE_UINT8_BOOLEAN))
```
But PCD_DATUM_TYPE_UINT8_BOOLEAN is only 1 bit:
```
#define PCD_DATUM_TYPE_UINT8_BOOLEAN (0x1U << PCD_DATUM_TYPE_SHIFT2)
```
Therefore PCD_DATABASE_OFFSET_MASK is getting assigned to bits [(0-19),(21-23)].
Shouldn't it be something like this:
```
#define PCD_DATUM_TYPE_2_ALL_SET (PCD_DATUM_TYPE_UINT8_BOOLEAN | \
(0x2U << PCD_DATUM_TYPE_SHIFT2) | \
(0x4U << PCD_DATUM_TYPE_SHIFT2) | \
(0x8U << PCD_DATUM_TYPE_SHIFT2))
#define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_ALL_SET |
PCD_DATUM_TYPE_ALL_SET | PCD_DATUM_TYPE_2_ALL_SET))
```
If it is really an error, I can make a patch.
Best regards.
Konstantin Aladyshev
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-30 12:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-30 12:54 Correct value for PCD_DATABASE_OFFSET_MASK Konstantin Aladyshev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox