[Linaro-uefi,2/2] Platforms/AMD/Cello: add Realtek MAC override driver

Message ID 20170627185619.21847-3-ard.biesheuvel@linaro.org
State New
Headers show
Series
  • Platforms/AMD/Cello: implement MAC override
Related show

Commit Message

Ard Biesheuvel June 27, 2017, 6:56 p.m.
Deal with the missing MAC address on the Cello Realtek NIC by
incorporating an alternative driver that programs a hardcoded
MAC address.

The intention was to combine this driver with a PcdsDynamicHii
PCD which gets set automatically from a UEFI var, but I could
not get this to work, so for now, the MAC is hardcoded in the
image.

E.g.,

  build -p OpenPlatformPkg/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc \
        -D RENESAS_XHCI_FW_DIR=~/Downloads \
        -D RTK8169_MAC_OVERRIDE=0x0,0xE0,0x4C,0x97,0x3C,0xDC

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc | 7 +++++++
 Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf | 4 ++++
 2 files changed, 11 insertions(+)

Comments

Roy Franz June 27, 2017, 9:28 p.m. | #1
On Tue, Jun 27, 2017 at 11:56 AM, Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
> Deal with the missing MAC address on the Cello Realtek NIC by
> incorporating an alternative driver that programs a hardcoded
> MAC address.
>
> The intention was to combine this driver with a PcdsDynamicHii
> PCD which gets set automatically from a UEFI var, but I could
> not get this to work, so for now, the MAC is hardcoded in the
> image.
>
> E.g.,
>
>   build -p OpenPlatformPkg/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc \
>         -D RENESAS_XHCI_FW_DIR=~/Downloads \
>         -D RTK8169_MAC_OVERRIDE=0x0,0xE0,0x4C,0x97,0x3C,0xDC
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc | 7 +++++++
>  Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf | 4 ++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc b/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc
> index 90cda24ae49d..7e50ac179dc6 100644
> --- a/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc
> +++ b/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc
> @@ -698,3 +698,10 @@ DEFINE DO_FLASHER   = FALSE
>        ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
>    }
>  !endif
> +
> +!ifdef $(RTK8169_MAC_OVERRIDE)
> +  OpenPlatformPkg/Drivers/Net/Realtek8169MacOverride/Realtek8169MacOverride.inf
> +
> +[PcdsFixedAtBuild]
> +  gOpenPlatformTokenSpaceGuid.PcdMacOverride|{$(RTK8169_MAC_OVERRIDE)}
> +!endif
> diff --git a/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf b/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf
> index 6f7428f0c4ca..99becb445301 100644
> --- a/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf
> +++ b/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf
> @@ -240,6 +240,10 @@ READ_LOCK_STATUS   = TRUE
>    }
>  !endif
>
> +!ifdef $(RTK8169_MAC_OVERRIDE)
> +  INF OpenPlatformPkg/Drivers/Net/Realtek8169MacOverride/Realtek8169MacOverride.inf
> +!endif
> +
>  [FV.STYX_EFI]
>  FvAlignment        = 16
>  ERASE_POLARITY     = 1
> --
> 2.9.3
>

This works, and I get the supplied MAC address in Linux.

If I leave off the "-D RTK8169_MAC_OVERRIDE" option, I get a build failure with:
build.py...
/home/rfranz/cavium/cello/firmware-build/edk2/OpenPlatformPkg/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc(706):
error 3000: Invalid expression: This must be HEX value for NList or
Array: [0].
        gOpenPlatformTokenSpaceGuid PcdMacOverride {$(RTK8169_MAC_OVERRIDE)}

- Failed -

I see this line protected by the by the !ifdef, but that doesn't seem
to be working.

Roy
Ard Biesheuvel June 28, 2017, 1:36 p.m. | #2
On 27 June 2017 at 21:28, Roy Franz <rfranz@cavium.com> wrote:
> On Tue, Jun 27, 2017 at 11:56 AM, Ard Biesheuvel
> <ard.biesheuvel@linaro.org> wrote:
>> Deal with the missing MAC address on the Cello Realtek NIC by
>> incorporating an alternative driver that programs a hardcoded
>> MAC address.
>>
>> The intention was to combine this driver with a PcdsDynamicHii
>> PCD which gets set automatically from a UEFI var, but I could
>> not get this to work, so for now, the MAC is hardcoded in the
>> image.
>>
>> E.g.,
>>
>>   build -p OpenPlatformPkg/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc \
>>         -D RENESAS_XHCI_FW_DIR=~/Downloads \
>>         -D RTK8169_MAC_OVERRIDE=0x0,0xE0,0x4C,0x97,0x3C,0xDC
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>>  Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc | 7 +++++++
>>  Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf | 4 ++++
>>  2 files changed, 11 insertions(+)
>>
>> diff --git a/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc b/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc
>> index 90cda24ae49d..7e50ac179dc6 100644
>> --- a/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc
>> +++ b/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc
>> @@ -698,3 +698,10 @@ DEFINE DO_FLASHER   = FALSE
>>        ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
>>    }
>>  !endif
>> +
>> +!ifdef $(RTK8169_MAC_OVERRIDE)
>> +  OpenPlatformPkg/Drivers/Net/Realtek8169MacOverride/Realtek8169MacOverride.inf
>> +
>> +[PcdsFixedAtBuild]
>> +  gOpenPlatformTokenSpaceGuid.PcdMacOverride|{$(RTK8169_MAC_OVERRIDE)}
>> +!endif
>> diff --git a/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf b/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf
>> index 6f7428f0c4ca..99becb445301 100644
>> --- a/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf
>> +++ b/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf
>> @@ -240,6 +240,10 @@ READ_LOCK_STATUS   = TRUE
>>    }
>>  !endif
>>
>> +!ifdef $(RTK8169_MAC_OVERRIDE)
>> +  INF OpenPlatformPkg/Drivers/Net/Realtek8169MacOverride/Realtek8169MacOverride.inf
>> +!endif
>> +
>>  [FV.STYX_EFI]
>>  FvAlignment        = 16
>>  ERASE_POLARITY     = 1
>> --
>> 2.9.3
>>
>
> This works, and I get the supplied MAC address in Linux.
>
> If I leave off the "-D RTK8169_MAC_OVERRIDE" option, I get a build failure with:
> build.py...
> /home/rfranz/cavium/cello/firmware-build/edk2/OpenPlatformPkg/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc(706):
> error 3000: Invalid expression: This must be HEX value for NList or
> Array: [0].
>         gOpenPlatformTokenSpaceGuid PcdMacOverride {$(RTK8169_MAC_OVERRIDE)}
>
> - Failed -
>
> I see this line protected by the by the !ifdef, but that doesn't seem
> to be working.
>

How annoying :-(

I should be able to work around that quite easily, but annoying nonetheless...

Patch hide | download patch | download mbox

diff --git a/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc b/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc
index 90cda24ae49d..7e50ac179dc6 100644
--- a/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc
+++ b/Platforms/AMD/Styx/CelloBoard/CelloBoard.dsc
@@ -698,3 +698,10 @@  DEFINE DO_FLASHER   = FALSE
       ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
   }
 !endif
+
+!ifdef $(RTK8169_MAC_OVERRIDE)
+  OpenPlatformPkg/Drivers/Net/Realtek8169MacOverride/Realtek8169MacOverride.inf
+
+[PcdsFixedAtBuild]
+  gOpenPlatformTokenSpaceGuid.PcdMacOverride|{$(RTK8169_MAC_OVERRIDE)}
+!endif
diff --git a/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf b/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf
index 6f7428f0c4ca..99becb445301 100644
--- a/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf
+++ b/Platforms/AMD/Styx/CelloBoard/CelloBoard.fdf
@@ -240,6 +240,10 @@  READ_LOCK_STATUS   = TRUE
   }
 !endif
 
+!ifdef $(RTK8169_MAC_OVERRIDE)
+  INF OpenPlatformPkg/Drivers/Net/Realtek8169MacOverride/Realtek8169MacOverride.inf
+!endif
+
 [FV.STYX_EFI]
 FvAlignment        = 16
 ERASE_POLARITY     = 1