summaryrefslogtreecommitdiff
path: root/Platform/Marvell
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-04-26 15:53:05 +0100
committerLeif Lindholm <leif@developerbox>2017-10-29 16:47:25 +0000
commitcf06f33ac588b036cfb8f94c331e3a61233dfa37 (patch)
tree19e9934a7a245354f15fb17ef64cde51cec920e9 /Platform/Marvell
parentcc0d33dcdb664d0c9ce794c22530aaf445f2ab81 (diff)
downloadedk2-platforms-cf06f33ac588b036cfb8f94c331e3a61233dfa37.tar.xz
Marvell/Library: MppLib: Take 0xFF placeholders into account
The MppSel definition PCDs contain 0xFF placeholders for values that should be left untouched. MppLib needs to be taught how to take those into account. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Marcin Wojtas <mw@semihalf.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'Platform/Marvell')
-rw-r--r--Platform/Marvell/Library/MppLib/MppLib.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/Platform/Marvell/Library/MppLib/MppLib.c b/Platform/Marvell/Library/MppLib/MppLib.c
index 383c8204cc..297725f6af 100644
--- a/Platform/Marvell/Library/MppLib/MppLib.c
+++ b/Platform/Marvell/Library/MppLib/MppLib.c
@@ -79,18 +79,24 @@ SetRegisterValue (
BOOLEAN ReverseFlag
)
{
- UINT32 i, j, CtrlVal;
+ UINT32 i, j, CtrlVal, CtrlMask, PinIndex;
INTN Sign;
Sign = ReverseFlag ? -1 : 1;
for (i = 0; i < RegCount; i++) {
CtrlVal = 0;
+ CtrlMask = 0;
for (j = 0; j < MPP_PINS_PER_REG; j++) {
- CtrlVal |= MPP_PIN_VAL(7 * (UINTN) ReverseFlag + j * Sign,
- MppRegPcd[i][7 * (UINTN) ReverseFlag + j * Sign]);
+
+ PinIndex = 7 * (UINTN)ReverseFlag + j * Sign;
+
+ if (MppRegPcd[i][PinIndex] != 0xff) {
+ CtrlVal |= MPP_PIN_VAL(PinIndex, MppRegPcd[i][PinIndex]);
+ CtrlMask |= MPP_PIN_VAL(PinIndex, 0xf);
+ }
}
- MmioWrite32 (BaseAddr + 4 * i * Sign, CtrlVal);
+ MmioAndThenOr32 (BaseAddr + 4 * i * Sign, ~CtrlMask, CtrlVal);
}
}