10 Commits
v0.8 ... v0.9

Author SHA1 Message Date
Mario Bălănică
105f7b9fc9 Silicon/Rockchip: PWMLib: Insert delay after locking previous period & duty
Otherwise the new values would sometimes be ignored.
2023-10-07 23:04:01 +03:00
Mario Bălănică
8b6b3a6242 Add basic Secure Boot support 2023-10-06 22:30:49 +03:00
Mario Bălănică
f1ca49412c Use latest GCC instead of GCC5
"build: : warning: Toolchain GCC5 is deprecated and will be removed before the
edk2-stable202402 release. You should use 'GCCNOLTO' instead of 'GCC49', and
'GCC' instead of 'GCC5'"
2023-10-06 17:30:14 +03:00
Mario Bălănică
8921a37b17 Update to latest rkbin
* ATF (BL31) to v1.40
  * ddrbin to v1.12
2023-10-06 16:54:37 +03:00
Mario Bălănică
c2bb0235c5 Silicon/RK3588: Move ACPI code to its own platform driver 2023-10-06 15:15:48 +03:00
Mario Bălănică
9b56a310f1 Add Device Tree support
The included DTBs correspond to:
  * <a8384552a2/arch/arm64/boot/dts/rockchip>
  * roc-rk3588s-pc: <b8646da212/arch/arm64/boot/dts/rockchip>

See README for more details.
2023-10-06 14:18:04 +03:00
Mario Bălănică
6175a503df Update README.md 2023-09-19 04:37:43 +03:00
Mario Bălănică
f6b305c705 Add RTL MAC address programming guide to README
Thanks to @strygin
2023-09-19 04:01:52 +03:00
Mario Bălănică
06dcc238c6 Remove references to RPi and Arm Juno 2023-09-18 05:02:02 +03:00
Mario Bălănică
842db13abd Silicon/RK3588: Uninstall EFI_MEMORY_ATTRIBUTE_PROTOCOL
Older versions of rhboot's shim use this protocol incorrectly and lead to a
Synchronous Exception.

Many distros haven't updated yet, so uninstall the protocol as a workaround for
the time being.

See:
  - https://github.com/microsoft/mu_silicon_arm_tiano/issues/124
  - https://edk2.groups.io/g/devel/topic/99631663
2023-09-18 04:14:27 +03:00
84 changed files with 1417 additions and 181 deletions

View File

@@ -66,10 +66,28 @@ jobs:
shell: bash
run: echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
- name: Set up Secure Boot default keys
run: |
mkdir keys
# We don't really need a usable PK, so just generate a public key for it and discard the private key
openssl req -new -x509 -newkey rsa:2048 -subj "/CN=Rockchip Platform Key/" -keyout /dev/null -outform DER -out keys/pk.cer -days 7300 -nodes -sha256
curl -L https://go.microsoft.com/fwlink/?LinkId=321185 -o keys/ms_kek.cer
curl -L https://go.microsoft.com/fwlink/?linkid=321192 -o keys/ms_db1.cer
curl -L https://go.microsoft.com/fwlink/?linkid=321194 -o keys/ms_db2.cer
curl -L https://uefi.org/sites/default/files/resources/dbxupdate_arm64.bin -o keys/arm64_dbx.bin
- name: Build platform
shell: bash
run: |
./build.sh --device ${{matrix.PLATFORM}} --release ${{matrix.CONFIGURATION}}
export BUILD_FLAGS="-D SECURE_BOOT_ENABLE=TRUE"
export DEFAULT_KEYS="-D DEFAULT_KEYS=TRUE \
-D PK_DEFAULT_FILE=keys/pk.cer \
-D KEK_DEFAULT_FILE1=keys/ms_kek.cer \
-D DB_DEFAULT_FILE1=keys/ms_db1.cer \
-D DB_DEFAULT_FILE2=keys/ms_db2.cer \
-D DBX_DEFAULT_FILE1=keys/arm64_dbx.bin"
./build.sh --device ${{matrix.PLATFORM}} --release ${{matrix.CONFIGURATION}} --build-flags="${BUILD_FLAGS} ${DEFAULT_KEYS}"
mv RK3588_NOR_FLASH.img ${{matrix.PLATFORM}}_UEFI_${{matrix.CONFIGURATION}}_${{steps.get_version_tag.outputs.version}}.img
- name: Upload artifact

141
README.md
View File

@@ -46,18 +46,24 @@ Applicable to all platforms unless otherwise noted.
| Voltage regulators (RK806, RK860) | 🟢 Working | |
| FUSB302 USB Type-C Controller | 🔴 Not working | Required for PD negotiation and connector orientation switching |
## Supported OSes (with ACPI)
## Supported OSes
### In ACPI mode
| OS | Version | Tested/supported hardware | Notes |
| --- | --- | --- | --- |
| Windows | 10 (1904x), 11 | [Status](https://github.com/worproject/Rockchip-Windows-Drivers#hardware-support-status) ||
| NetBSD | 10 | Display, UART, USB, PCIe (incl. NVME), SATA, eMMC, GMAC Ethernet ||
| VMware ESXi Arm Fling | >= 1.12 | Display, USB | * PCIe devices will hang at boot, need to disable in settings or leave the ports empty.<br>* GMAC Ethernet gets detected but does not work. |
| Linux | tested Ubuntu 22.04, kernel 5.15.0-75-generic | Display, UART, USB, PCIe (incl. NVME & Ethernet), SATA | For full hardware functionality, use a kernel with RK3588 support and platform Device Tree supplied by Grub. |
| Linux | tested Ubuntu 22.04, kernel 5.15.0-75-generic | Display, UART, USB, PCIe (incl. NVME & Ethernet), SATA | For full hardware functionality, use a kernel with RK3588 support and switch to Device Tree mode. |
#### Additional limitations when using ACPI
* Devices behind PCIe switches do not work (e.g. the two NICs on Mixtile Blade 3).
* GMAC is limited to Gigabit speed (i.e. no 10/100).
### In Device Tree mode
| OS | Version | Tested/supported hardware | Notes |
| --- | --- | --- | --- |
| Rockchip SDK Linux | 5.10 legacy, tested with [Armbian rk3588-live-iso](https://github.com/amazingfate/rk3588-live-iso) | Platform-dependent, most peripherals work. | If using a different kernel, see [Device Tree configuration](#device-tree-configuration). |
## Getting started
### 1. Requirements
* One of the [supported devices](#supported-platforms).
@@ -93,6 +99,8 @@ At this stage, you can press <kbd>Esc</kbd> to enter the firmware setup, <kbd>F1
Check the [Supported peripherals](#supported-peripherals) and [Supported OSes](#supported-oses-with-acpi) sections to see what's currently possible with this firmware.
Also check the configuration options described below, some of which may need to be changed depending on the OS used.
If you experience any issues, please see the [Troubleshooting](#troubleshooting) section.
## Configuration settings
@@ -102,10 +110,60 @@ Configuration through the user interface is fairly straightforward and help info
Configuration through the UEFI shell is more advanced and mostly useful for scripts. See [Setting configuration options via the shell](#setting-configuration-options-via-the-shell).
#### Tips
If you only wish to boot non-Windows OSes, go to the configuration menu -> `ACPI` and set `USB 2.0 Support` to `Enabled`, in order to get maximum speed from USB 2.0 ports.
### Tips
* CPU clocks are set to 816 MHz (boot default) on platforms without a cooling fan included. If you have adequate cooling, go to the configuration menu -> `CPU Performance` and set all Cluster Presets to `Maximum`.
Booting Windows with this option enabled will cause it to crash.
* If you only wish to boot non-Windows OSes in ACPI mode, go to the configuration menu -> `ACPI / Device Tree` and set `USB 2.0 Support` to `Enabled`, in order to get maximum speed from USB 2.0 ports.
Booting Windows with this option enabled will cause it to crash.
### Device Tree configuration
For rich Linux support, it is recommended to enable Device Tree mode. You can do so by going to the configuration menu -> `ACPI / Device Tree` and setting `Config Table Mode` to `Device Tree`.
By default, the firmware installs a [DTB compatible with (most) Rockchip SDK Linux 5.10 legacy kernel variants](https://github.com/edk2-porting/edk2-rk3588/tree/master/edk2-rockchip-non-osi/Platform/Rockchip/DeviceTree).
#### Custom Device Tree Blob (DTB) override and overlays
It is also possible to provide a custom DTB and overlays. To enable this, go to the configuration menu -> `ACPI / Device Tree` and set `Support DTB override & overlays` to `Enabled`.
The firmware will now look for overrides in the partition of a selected boot option / OS loader. In most cases this will be the first FAT32 EFI System Partition.
* The base DTB must be located at `\dtb\base\<PLATFORM-DT-NAME>.dtb`.
* The overlays can be placed in:
* `\dtb\overlays` - will be applied first, regardless of the platform.
* `\dtb\overlays\<PLATFORM-DT-NAME>` - will be applied only to the specified platform.
and must have the `.dtbo` extension.
The paths above are relative to the root of the file system. That is, the `dtb` directory must not be placed in a sub-directory.
`<PLATFORM-DT-NAME>` can be:
| Name | Platform |
| --------------------------------------- | ----------------------------- |
| `rk3588s-9tripod-linux` | Indiedroid Nova |
| `roc-rk3588s-pc` | ROC-RK3588S-PC / Station M3 |
| `rk3588-nanopc-t6` | NanoPC T6 |
| `rk3588s-nanopi-r6c` | NanoPi R6C |
| `rk3588s-nanopi-r6s` | NanoPi R6S |
| `rk3588-hinlink-h88k` | H88K |
| `rk3588s-khadas-edge2` | Edge2 |
| `rk3588-blueberry-minipc-linux` | R58 Mini |
| `rk3588-blueberry-edge-v12-linux` | R58X (v1.2) |
| `rk3588-blade3-v101-linux` | Blade 3 |
| `rk3588s-orangepi-5` | Orange Pi 5 |
| `rk3588-orangepi-5-plus` | Orange Pi 5 Plus |
| `rk3588s-rock-5a` | ROCK 5A |
| `rk3588-rock-5b` | ROCK 5B |
In the absence of a custom base DTB override, the overlays are applied on top of the firmware-provided DTB.
The firmware applies some fix-ups to its own DTB depending on the user settings (e.g. PCIe/SATA/USB selection, making SATA overlays redundant). These fix-ups are not applied to a custom base DTB - overlays must be used instead.
If the application of an overlay fails (e.g. due to it being invalid in regard to the base DTB), all overlays are discarded, including those that got applied up to that point.
If the custom base DTB is invalid, the firmware-provided one will be passed to the OS instead.
This entire process is logged to the [serial console](#advanced-troubleshooting). There's currently no other way to see potential errors.
## Updating the firmware
If the storage is only used for UEFI and nothing else, simply download the latest image and flash it as described in the [Getting started](#getting-started) section.
@@ -145,25 +203,60 @@ If the LED:
#### Nothing shows up on the screen
Make sure you've flashed the firmware correctly and that it is the version designed for your device. In most cases this is the culprit.
The display must support a resolution of at least 1080p at 60 Hz.
If you're using HDMI and the system has two ports, only one will work. Try both.
If you're using USB-C to DisplayPort, only one orientation of the USB-C connector will work. Check both.
Assuming the firmware loads fine:
* The display must support a resolution of at least 1080p at 60 Hz.
* If you're using HDMI and the system has two ports, only one will work. Try both.
* If you're using USB-C to DisplayPort, only one orientation of the USB-C connector will work. Check both.
If you are not able to get any display output, the only way to interact with UEFI is via the [serial console](#advanced-troubleshooting).
#### USB 3 devices do not work
Try a different port.
If you're using USB-C, 3.0 devices will only work in one orientation of the connector. Check both.
This can also be a power issue.
* Try a different port.
* If you're using USB-C, 3.0 devices will only work in one orientation of the connector. Check both.
* Make sure the power supply and cable are good
#### Networking does not work
Only Realtek PCIe and USB controllers are supported. Native Gigabit provided by RK3588 isn't.
* Only Realtek PCIe and USB controllers are supported. Native Gigabit provided by RK3588 isn't.
Some boards do not have a MAC address set at factory and will show-up as being all zeros in UEFI. There is no documented fix available yet. See [issue 42](https://github.com/edk2-porting/edk2-rk3588/issues/42) for more info.
* Some boards with Realtek NICs do not have a MAC address set at factory and will show-up as being all zeros in UEFI, possibly preventing the adapter from obtaining an IP address.
You can easily fix this by writing the MAC address manually:
1. Boot into Linux and open up a terminal. The commands below apply to Armbian with legacy kernel.
2. Install the headers for your kernel version:
```bash
sudo apt install -y linux-headers-legacy-rk35xx
```
3. Clone Realtek PGTool and build the driver:
```bash
git clone https://github.com/redchenjs/rtnicpg
cd rtnicpg
make
```
4. Unload all Realtek modules and load the driver built above:
```bash
sudo rmmod pgdrv
sudo ./pgload.sh
```
Note: make sure there aren't any remaining Realtek modules loaded after this, except for the new `pgdrv`.<br> If you have `r8125` built-in, you might have to reboot with `initcall_blacklist=rtl8125_init_module` as a kernel parameter (in Grub).
5. Burn a MAC address into the eFuses:
For only one NIC:
```bash
sudo ./rtnicpg-aarch64-linux-gnu /efuse /nodeid 00E04C001234
```
For two or more:
```bash
sudo ./rtnicpg-aarch64-linux-gnu /efuse /# 1 /nodeid 00E04C001234
sudo ./rtnicpg-aarch64-linux-gnu /efuse /# 2 /nodeid 00E04C001235
```
`00E04C001234` is an example address. You can generate random and unique ones using: <https://www.macvendorlookup.com/mac-address-generator>
**Note:** the number of eFuses is limited, thus MAC addresses can only be changed a few times.
### Advanced troubleshooting
The firmware will log detailed information to the serial console when using a debug version. See the [release notes](https://github.com/edk2-porting/edk2-rk3588/releases) for details on how to obtain this version.
@@ -303,11 +396,21 @@ Default values and supported options depend on the platform. Check documentation
| ------------- | ------------- | --------------------------------- |
| Support State | `Pcie30State` | Enabled = `0x00000001`<br> Disabled = `0x00000000` |
### ACPI configuration
### ACPI / Device Tree
| Variable | NAME | VALUE |
| ----------------- | ----------------- | --------------------------------- |
| Config Table Mode | `ConfigTableMode` | ACPI = `0x00000001`<br> DeviceTree = `0x00000002`<br> Both = `0x00000003` |
#### ACPI Configuration
| Variable | NAME | VALUE |
| --------------- | --------------- | --------------------------------- |
| USB 2.0 Support | `AcpiUsb2State` | Enabled = `0x00000001`<br> Disabled = `0x00000000` |
#### Device Tree Configuration
| Variable | NAME | VALUE |
| ------------------------------- | --------------------- | --------------------------------- |
| Support DTB override & overlays | `FdtSupportOverrides` | Enabled = `0x01`<br> Disabled = `0x00` |
### Cooling fan
| Variable | NAME | VALUE |
| --------------- | ----------------- | --------------------------------- |
@@ -332,7 +435,7 @@ Some non-critical components have been ported from Rockchip's U-Boot fork and ar
* UsbDpPhy
* DwDpLib
The firmware will continue to work without them, minus the additional functionality they provide.
The files in `edk2-rockchip-non-osi` are licensed as **GPL-2.0-only**.
The license for some of the blobs in the `misc/rkbin/` directory can be found at: <https://github.com/rockchip-linux/rkbin/blob/master/LICENSE>. Note that it also contains binaries built from open-source projects such as U-Boot (SPL), Arm Trusted Firmware and OP-TEE, having a different license.

View File

@@ -10,11 +10,12 @@ function _help(){
echo " --all, -a: build all devices."
echo " --gui: Enable simple-init GUI."
echo " --release MODE, -r MODE: Release mode for building, default is 'DEBUG', 'RELEASE' alternatively."
echo " --toolchain TOOLCHAIN: Set toolchain, default is 'GCC5'."
echo " --toolchain TOOLCHAIN: Set toolchain, default is 'GCC'."
echo " --skip-rootfs-gen: skip generating SimpleInit rootfs to speed up building."
echo " --clean, -C: clean workspace and output."
echo " --distclean, -D: clean up all files that are not in repo."
echo " --outputdir, -O: output folder."
echo " --build-flags: flags appended to the EDK2 build process."
echo " --help, -h: show this help."
echo
exit "${1}"
@@ -37,8 +38,11 @@ function _build_idblock(){
FLASHFILES="FlashHead.bin FlashData.bin FlashBoot.bin"
rm -f rk35*_spl_loader_*.bin idblock.bin rk35*_ddr_*.bin rk35*_usbplug*.bin UsbHead.bin ${FLASHFILES}
DDRBIN=$(grep '^FlashData' ${ROOTDIR}/misc/rkbin/RKBOOT/${MINIALL_INI} | cut -d = -f 2-)
SPL=$(grep '^FlashBoot' ${ROOTDIR}/misc/rkbin/RKBOOT/${MINIALL_INI} | cut -d = -f 2-)
# Create idblock.bin
${ROOTDIR}/misc/tools/${MACHINE_TYPE}/mkimage -n rk3588 -T rksd -d ${ROOTDIR}/misc/rkbin/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin:${ROOTDIR}/misc/rkbin/bin/rk35/rk3588_spl_v1.12.bin idblock.bin
${ROOTDIR}/misc/tools/${MACHINE_TYPE}/mkimage -n rk3588 -T rksd -d ${ROOTDIR}/misc/rkbin/${DDRBIN}:${ROOTDIR}/misc/rkbin/${SPL} idblock.bin
popd
echo " => idblock.bin build done"
}
@@ -116,6 +120,7 @@ function _build(){
-D FIRMWARE_VER="${GITCOMMIT}" \
-D ENABLE_SIMPLE_INIT="${BUILD_GUI}" \
-D CONFIG_SOC="${SOC}" \
${BUILD_FLAGS} \
||return "$?"
_pack
@@ -137,11 +142,12 @@ DEVICE=""
MODE=DEBUG
CLEAN=false
DISTCLEAN=false
TOOLCHAIN=GCC5
TOOLCHAIN=GCC
BUILD_FLAGS=""
export ROOTDIR OUTDIR
export GEN_ROOTFS=true
export BUILD_GUI=false
OPTS="$(getopt -o t:d:haCDO:r -l toolchain:,device:,help,all,skip-rootfs-gen,gui,clean,distclean,outputdir:,release: -n 'build.sh' -- "$@")"||exit 1
OPTS="$(getopt -o t:d:haCDO:r -l toolchain:,device:,help,all,skip-rootfs-gen,gui,clean,distclean,outputdir:,release:,build-flags: -n 'build.sh' -- "$@")"||exit 1
eval set -- "${OPTS}"
while true
do case "${1}" in
@@ -154,6 +160,7 @@ do case "${1}" in
--gui) BUILD_GUI=true;shift;;
-r|--release) MODE="${2}";shift 2;;
-t|--toolchain) TOOLCHAIN="${2}";shift 2;;
--build-flags) BUILD_FLAGS="${2}";shift 2;;
-h|--help) _help 0;shift;;
--) shift;break;;
*) _help 1;;
@@ -183,10 +190,10 @@ done
[ -f "configs/${DEVICE}.conf" ]||[ "${DEVICE}" == "all" ]||_error "Device configuration not found"
export CROSS_COMPILE="${CROSS_COMPILE:-aarch64-linux-gnu-}"
export GCC5_AARCH64_PREFIX="${CROSS_COMPILE}"
export GCC_AARCH64_PREFIX="${CROSS_COMPILE}"
export CLANG38_AARCH64_PREFIX="${CROSS_COMPILE}"
# export PACKAGES_PATH="$_EDK2:$_EDK2_PLATFORMS:$_SIMPLE_INIT:$PWD"
export PACKAGES_PATH="${ROOTDIR}/edk2:${ROOTDIR}/edk2-platforms:${ROOTDIR}/edk2-rockchip:${ROOTDIR}/edk2-non-osi:${ROOTDIR}:${_SIMPLE_INIT}"
export PACKAGES_PATH="${ROOTDIR}/edk2:${ROOTDIR}/edk2-platforms:${ROOTDIR}/edk2-rockchip:${ROOTDIR}/edk2-rockchip-non-osi:${ROOTDIR}/edk2-non-osi:${ROOTDIR}:${_SIMPLE_INIT}"
export WORKSPACE="${OUTDIR}/workspace"
GITCOMMIT="$(git describe --tags --always)"||GITCOMMIT="unknown"
export GITCOMMIT

View File

@@ -0,0 +1,8 @@
# Rockchip Platform Device Trees
## Sources
* <https://github.com/armbian/linux-rockchip/tree/a8384552a2e009797aa5b3e9a046d30e8d2e5d3c/arch/arm64/boot/dts/rockchip>
* roc-rk3588s-pc: <https://gitlab.com/firefly-linux/kernel/-/tree/b8646da2122f45a2c02082d949427b80d2e89b1f/arch/arm64/boot/dts/rockchip>
## License
SPDX-License-Identifier: GPL-2.0-only

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,5 +9,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588s-9tripod-linux.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -62,7 +62,7 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"ameriDroid"
gRockchipTokenSpaceGuid.PcdFamilyName|"Indiedroid"
gRockchipTokenSpaceGuid.PcdProductUrl|"https://indiedroid.us"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588s-9tripod-linux.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588s-9tripod-linux"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,5 +9,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE Platform/Firefly/ROC-RK3588S-PC/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/roc-rk3588s-pc.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -42,4 +42,4 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"Firefly"
gRockchipTokenSpaceGuid.PcdFamilyName|"ROC"
gRockchipTokenSpaceGuid.PcdProductUrl|"https://en.t-firefly.com/product/industry/rocrk3588spc"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"roc-rk3588s-pc.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"roc-rk3588s-pc"

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,5 +9,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588-nanopc-t6.dtb
}
# Splash screen logo
INF MdeModulePkg/Logo/LogoDxe.inf

View File

@@ -60,7 +60,7 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"FriendlyElec"
gRockchipTokenSpaceGuid.PcdFamilyName|"NanoPi 6"
gRockchipTokenSpaceGuid.PcdProductUrl|"https://wiki.friendlyelec.com/wiki/index.php/NanoPC-T6"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-nanopc-t6.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-nanopc-t6"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }

View File

@@ -10,5 +10,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588s-nanopi-r6c.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -61,7 +61,7 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"FriendlyElec"
gRockchipTokenSpaceGuid.PcdFamilyName|"NanoPi"
gRockchipTokenSpaceGuid.PcdProductUrl|"https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R6"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588s-nanopi-r6c.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588s-nanopi-r6c"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,5 +9,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588s-nanopi-r6s.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -60,7 +60,7 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"FriendlyElec"
gRockchipTokenSpaceGuid.PcdFamilyName|"NanoPi 6"
gRockchipTokenSpaceGuid.PcdProductUrl|"https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R6S"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588s-nanopi-r6s.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588s-nanopi-r6s"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,5 +9,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588-hinlink-h88k.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -60,7 +60,7 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"Hinlink"
gRockchipTokenSpaceGuid.PcdFamilyName|"H88K"
gRockchipTokenSpaceGuid.PcdProductUrl|"http://www.hinlink.com/"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-hinlink-h88k.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-hinlink-h88k"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,6 +9,11 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588s-khadas-edge2.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -59,7 +59,7 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"Khadas"
gRockchipTokenSpaceGuid.PcdFamilyName|"Edge"
gRockchipTokenSpaceGuid.PcdProductUrl|"https://www.khadas.com/edge2"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588s-khadas-edge2.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588s-khadas-edge2"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51, 0x18 }

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,5 +9,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588-blueberry-minipc-linux.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -63,7 +63,7 @@
gRockchipTokenSpaceGuid.PcdFamilyName|"R58"
gRockchipTokenSpaceGuid.PcdProductUrl|"https://www.mekotronics.com/h-pd-76.html"
gRockchipTokenSpaceGuid.PcdBoardName|"MINI-PC-RK3588-4D32-V1.0"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-blueberry-minipc-linux.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-blueberry-minipc-linux"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,5 +9,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588-blueberry-edge-v12-linux.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -60,7 +60,7 @@
gRockchipTokenSpaceGuid.PcdFamilyName|"R58"
gRockchipTokenSpaceGuid.PcdProductUrl|"https://www.mekotronics.com/h-pd-75.html"
gRockchipTokenSpaceGuid.PcdBoardName|"EDGE-RK3588-4D32-V1.2"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-blueberry-edge-v10-linux.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-blueberry-edge-v12-linux"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,5 +9,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588-blade3-v101-linux.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -56,7 +56,7 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"Mixtile"
gRockchipTokenSpaceGuid.PcdFamilyName|"Blade"
gRockchipTokenSpaceGuid.PcdProductUrl|"https://www.mixtile.com/blade-3/"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-blade3-v101-linux.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-blade3-v101-linux"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43 }

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,5 +9,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588s-orangepi-5.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -60,7 +60,7 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"Orange Pi"
gRockchipTokenSpaceGuid.PcdFamilyName|"Orange Pi 5"
gRockchipTokenSpaceGuid.PcdProductUrl|"http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/details/Orange-Pi-5.html"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588s-orangepi-5.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588s-orangepi-5"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,5 +9,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588-orangepi-5-plus.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -59,7 +59,7 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"Orange Pi"
gRockchipTokenSpaceGuid.PcdFamilyName|"Orange Pi 5"
gRockchipTokenSpaceGuid.PcdProductUrl|"http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/details/Orange-Pi-5-plus.html"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-orangepi-5-plus.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-orangepi-5-plus"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,5 +9,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588s-rock-5a.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -54,7 +54,7 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"Radxa"
gRockchipTokenSpaceGuid.PcdFamilyName|"ROCK 5"
gRockchipTokenSpaceGuid.PcdProductUrl|"https://wiki.radxa.com/Rock5/hardware/5a"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588s-rock-5a.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588s-rock-5a"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43 }

View File

@@ -13,7 +13,7 @@
#include "AcpiTables.h"
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RKCP ", "RK3588 ", 2)
{
Scope (\_SB_)
{

View File

@@ -9,5 +9,10 @@
# ACPI Support
INF RuleOverride = ACPITABLE $(PLATFORM_DIRECTORY)/AcpiTables/AcpiTables.inf
# Device Tree Support
FILE FREEFORM = gDtPlatformDefaultDtbFileGuid {
SECTION RAW = Platform/Rockchip/DeviceTree/rk3588-rock-5b.dtb
}
# Splash screen logo
INF $(VENDOR_DIRECTORY)/Drivers/LogoDxe/LogoDxe.inf

View File

@@ -60,7 +60,7 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"Radxa"
gRockchipTokenSpaceGuid.PcdFamilyName|"ROCK 5"
gRockchipTokenSpaceGuid.PcdProductUrl|"https://wiki.radxa.com/Rock5/hardware/5b"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-rock-5b.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"rk3588-rock-5b"
# I2C
gRockchipTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x42, 0x43, 0x51 }

View File

@@ -42,7 +42,7 @@
gRockchipTokenSpaceGuid.PcdPlatformVendorName|"Station PC"
gRockchipTokenSpaceGuid.PcdFamilyName|"Station M"
gRockchipTokenSpaceGuid.PcdProductUrl|"https://www.stationpc.com/product/stationm3"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"roc-rk3588s-pc.dtb"
gRockchipTokenSpaceGuid.PcdDeviceTreeName|"roc-rk3588s-pc"
#
# CPU Performance default values

View File

@@ -409,11 +409,7 @@ SMBIOS_TABLE_TYPE7 mCacheInfoType7_L1D = {
0, // Cache Speed unknown
CacheErrorSingleBit, // Error Correction
CacheTypeData, // System Cache Type
#if (RPI_MODEL == 4)
CacheAssociativity2Way // Associativity
#else
CacheAssociativity4Way // Associativity
#endif
};
CHAR8 *mCacheInfoType7Strings_L1D[] = {
"L1 Data",

View File

@@ -22,6 +22,11 @@
INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
!if $(SECURE_BOOT_ENABLE) == TRUE
!include ArmPlatformPkg/SecureBootDefaultKeys.fdf.inc
INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
INF SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.inf
!endif
#
# Status LED support
@@ -75,11 +80,6 @@
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
#
# DeviceTree Support
#
INF EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf
#
# SMBIOS Support
#

View File

@@ -9,6 +9,7 @@
#include <Library/DebugLib.h>
#include <Library/IoLib.h>
#include <Library/TimerLib.h>
#include <Library/PWMLib.h>
#define PWM_INT_EN(ch) (1 << (ch))
@@ -81,6 +82,7 @@ RkPwmSetConfig (
Ctrl = MmioRead32(Base + ChannelOffset + PWM_CTRL_OFFSET);
Ctrl |= PWM_LOCK;
MmioWrite32(Base + ChannelOffset + PWM_CTRL_OFFSET, Ctrl);
MicroSecondDelay (1);
MmioWrite32(Base + ChannelOffset + PWM_PERIOD_HPR_OFFSET, PeriodCycle);
MmioWrite32(Base + ChannelOffset + PWM_DUTY_LPR_OFFSET, DutyCycle);

View File

@@ -21,6 +21,7 @@
[LibraryClasses]
DebugLib
IoLib
TimerLib
[Packages]
EmbeddedPkg/EmbeddedPkg.dec

View File

@@ -16,16 +16,6 @@
#include "AcpiTables.h"
/*
* Windows 10 on the Raspberry Pi 3 requires a specific OEM Id for FADT.
* We replace the one that was defined in "AcpiTables.h", so that it is
* picked by the ACPI_HEADER () macro.
*/
#if (RPI_MODEL == 3)
#undef EFI_ACPI_OEM_ID
#define EFI_ACPI_OEM_ID {'R','O','C','K',' ',' '}
#endif
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE Fadt = {
ACPI_HEADER (
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,

View File

@@ -12,6 +12,8 @@
#include <Library/PcdLib.h>
#include <IndustryStandard/Acpi.h>
#include "AcpiTables.h"
#define GTDT_GLOBAL_FLAGS_MAPPED EFI_ACPI_5_0_GTDT_GLOBAL_FLAG_MEMORY_MAPPED_BLOCK_PRESENT
#define GTDT_GLOBAL_FLAGS_NOT_MAPPED 0
#define GTDT_GLOBAL_FLAGS_EDGE EFI_ACPI_5_0_GTDT_GLOBAL_FLAG_INTERRUPT_MODE
@@ -32,24 +34,6 @@
#define GTDT_GTIMER_FLAGS (GTDT_TIMER_ACTIVE_LOW | GTDT_TIMER_LEVEL_TRIGGERED)
#define EFI_ACPI_ARM_OEM_ID 'A','R','M','L','T','D' // OEMID 6 bytes long
#define EFI_ACPI_ARM_OEM_TABLE_ID SIGNATURE_64('A','R','M','-','J','U','N','O') // OEM table id 8 bytes long
#define EFI_ACPI_ARM_OEM_REVISION 0x20140727
#define EFI_ACPI_ARM_CREATOR_ID SIGNATURE_32('A','R','M',' ')
#define EFI_ACPI_ARM_CREATOR_REVISION 0x00000099
#define ARM_ACPI_HEADER(Signature, Type, Revision) { \
Signature, /* UINT32 Signature */ \
sizeof (Type), /* UINT32 Length */ \
Revision, /* UINT8 Revision */ \
0, /* UINT8 Checksum */ \
{ EFI_ACPI_ARM_OEM_ID }, /* UINT8 OemId[6] */ \
EFI_ACPI_ARM_OEM_TABLE_ID, /* UINT64 OemTableId */ \
EFI_ACPI_ARM_OEM_REVISION, /* UINT32 OemRevision */ \
EFI_ACPI_ARM_CREATOR_ID, /* UINT32 CreatorId */ \
EFI_ACPI_ARM_CREATOR_REVISION /* UINT32 CreatorRevision */ \
}
#pragma pack (1)
typedef struct {
@@ -60,7 +44,7 @@ typedef struct {
GENERIC_TIMER_DESCRIPTION_TABLE Gtdt = {
{
ARM_ACPI_HEADER(
ACPI_HEADER(
EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
GENERIC_TIMER_DESCRIPTION_TABLE,
EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION

View File

@@ -14,24 +14,6 @@
#pragma pack(1)
#define EFI_ACPI_ARM_OEM_ID 'A','R','M','L','T','D' // OEMID 6 bytes long
#define EFI_ACPI_ARM_OEM_TABLE_ID SIGNATURE_64('A','R','M','-','J','U','N','O') // OEM table id 8 bytes long
#define EFI_ACPI_ARM_OEM_REVISION 0x20140727
#define EFI_ACPI_ARM_CREATOR_ID SIGNATURE_32('A','R','M',' ')
#define EFI_ACPI_ARM_CREATOR_REVISION 0x00000099
#define ARM_ACPI_HEADER(Signature, Type, Revision) { \
Signature, /* UINT32 Signature */ \
sizeof (Type), /* UINT32 Length */ \
Revision, /* UINT8 Revision */ \
0, /* UINT8 Checksum */ \
{ EFI_ACPI_ARM_OEM_ID }, /* UINT8 OemId[6] */ \
EFI_ACPI_ARM_OEM_TABLE_ID, /* UINT64 OemTableId */ \
EFI_ACPI_ARM_OEM_REVISION, /* UINT32 OemRevision */ \
EFI_ACPI_ARM_CREATOR_ID, /* UINT32 CreatorId */ \
EFI_ACPI_ARM_CREATOR_REVISION /* UINT32 CreatorRevision */ \
}
typedef struct
{
EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE ItsNode;
@@ -58,7 +40,7 @@ ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort =
{
// EFI_ACPI_6_0_IO_REMAPPING_TABLE
{
ARM_ACPI_HEADER // EFI_ACPI_DESCRIPTION_HEADER
ACPI_HEADER // EFI_ACPI_DESCRIPTION_HEADER
(
EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE,
ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE,

View File

@@ -1,4 +1,6 @@
/** @file
*
* ACPI platform driver
*
* Copyright (c) 2020, Jeremy Linton
* Copyright (c) 2023, Mario Bălănică <mariobalanica02@gmail.com>
@@ -10,12 +12,8 @@
#include <Library/AcpiLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <VarStoreData.h>
#include "RK3588DxeFormSetGuid.h"
#include "Acpi.h"
STATIC CONST EFI_GUID mAcpiTableFile = {
0x7E374E25, 0x8E01, 0x4FEE, { 0x87, 0xf2, 0x39, 0x0C, 0x23, 0xC6, 0x06, 0xCD }
};
@@ -176,33 +174,26 @@ AcpiHandleDynamicNamespace (
return TRUE;
}
VOID
EFI_STATUS
EFIAPI
ApplyAcpiVariables (
VOID
AcpiPlatformDxeInitialize (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
// TO-DO: Add a HII variable to let the user decide if they want ACPI (and/or DT).
LocateAndInstallAcpiFromFvConditional (&mAcpiTableFile, &AcpiHandleDynamicNamespace);
}
EFI_STATUS Status;
VOID
EFIAPI
SetupAcpiVariables (
VOID
)
{
UINTN Size;
UINT32 Var32;
EFI_STATUS Status;
Size = sizeof (UINT32);
Status = gRT->GetVariable (L"AcpiUsb2State",
&gRK3588DxeFormSetGuid,
NULL, &Size, &Var32);
if (EFI_ERROR (Status)) {
Status = PcdSet32S (PcdAcpiUsb2State, FixedPcdGet32 (PcdAcpiUsb2StateDefault));
ASSERT_EFI_ERROR (Status);
if ((PcdGet32 (PcdConfigTableMode) & CONFIG_TABLE_MODE_ACPI) == 0) {
DEBUG ((DEBUG_WARN, "AcpiPlatform: ACPI support is disabled by the settings.\n"));
return EFI_UNSUPPORTED;
}
Status = LocateAndInstallAcpiFromFvConditional (&mAcpiTableFile, &AcpiHandleDynamicNamespace);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "AcpiPlatform: Failed to install firmware ACPI as config table. Status=%r\n",
Status));
return Status;
}
return EFI_SUCCESS;
}

View File

@@ -0,0 +1,49 @@
#/** @file
#
# ACPI platform driver
#
# Copyright (c) 2023, Mario Bălănică <mariobalanica02@gmail.com>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#**/
[Defines]
INF_VERSION = 0x0001001A
BASE_NAME = AcpiPlatformDxe
FILE_GUID = 1f7decf3-c2dc-49ee-a932-8074718cdc6d
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
ENTRY_POINT = AcpiPlatformDxeInitialize
[Sources]
AcpiPlatformDxe.c
[Packages]
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
Silicon/Rockchip/RockchipPkg.dec
Silicon/Rockchip/RK3588/RK3588.dec
[LibraryClasses]
AcpiLib
BaseMemoryLib
DebugLib
UefiDriverEntryPoint
[Guids]
[Protocols]
[Pcd]
gRK3588TokenSpaceGuid.PcdConfigTableMode
gRK3588TokenSpaceGuid.PcdAcpiUsb2State
gRK3588TokenSpaceGuid.PcdComboPhy0Mode
gRK3588TokenSpaceGuid.PcdComboPhy1Mode
gRK3588TokenSpaceGuid.PcdComboPhy2Mode
gRK3588TokenSpaceGuid.PcdPcie30Supported
gRK3588TokenSpaceGuid.PcdPcie30State
[Depex]
gRockchipPlatformConfigAppliedProtocolGuid

View File

@@ -0,0 +1,713 @@
/** @file
*
* Flattened Device Tree platform driver
*
* Copyright (c) 2023, Mario Bălănică <mariobalanica02@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
**/
#include <Protocol/LoadedImage.h>
#include <Protocol/SimpleFileSystem.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/PrintLib.h>
#include <Library/DxeServicesLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <libfdt.h>
#include <Guid/Fdt.h>
#include <Guid/FileInfo.h>
#include <VarStoreData.h>
#define MAX_PATH_LENGTH 512
STATIC VOID *mPlatformFdt;
STATIC VOID *mLoadedImageEventRegistration;
STATIC
INTN
EFIAPI
StriCmp (
IN CONST CHAR16 *String1,
IN CONST CHAR16 *String2
)
{
while ((*String1 != L'\0') &&
(CharToUpper (*String1) == CharToUpper (*String2))) {
String1++;
String2++;
}
return CharToUpper (*String1) - CharToUpper (*String2);
}
STATIC
BOOLEAN
EFIAPI
StrEndsWith (
IN CONST CHAR16 *String,
IN CONST CHAR16 *Extension
)
{
UINTN StringLength = StrLen (String);
UINTN ExtensionLength = StrLen (Extension);
if (StringLength < ExtensionLength) {
return FALSE;
}
return StriCmp (String + StringLength - ExtensionLength, Extension) == 0;
}
STATIC
EFI_STATUS
EFIAPI
FdtOpenIntoAlloc (
IN OUT VOID **Fdt,
IN OUT VOID **DestinationFdt, OPTIONAL
IN UINTN Size
)
{
VOID *NewFdt;
INTN Ret;
NewFdt = AllocatePool (Size);
if (NewFdt == NULL) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Not enough resources to reallocate FDT (%d bytes).\n",
Size));
return EFI_OUT_OF_RESOURCES;
}
Ret = fdt_open_into (*Fdt, NewFdt, Size);
if (Ret) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to copy FDT. Ret=%a\n", fdt_strerror (Ret)));
FreePool (NewFdt);
return EFI_LOAD_ERROR;
}
if (DestinationFdt != NULL) {
*DestinationFdt = NewFdt;
} else {
FreePool (*Fdt);
*Fdt = NewFdt;
}
return EFI_SUCCESS;
}
STATIC
EFI_STATUS
EFIAPI
ReadFdtFromFilePath (
IN EFI_FILE_PROTOCOL *Root,
IN CHAR16 *Path,
IN OUT UINTN *FileSize, OPTIONAL
IN OUT VOID **Fdt
)
{
EFI_STATUS Status;
EFI_FILE_PROTOCOL *File;
UINTN FileBufferSize;
UINTN FileInfoSize;
EFI_FILE_INFO *FileInfo = NULL;
INT32 Ret;
Status = Root->Open (Root, &File, Path, EFI_FILE_MODE_READ, 0);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Couldn't open '%s'. Status=%r\n", Path, Status));
return Status;
}
if (FileSize == NULL) {
FileInfoSize = 0;
Status = File->GetInfo (File, &gEfiFileInfoGuid, &FileInfoSize, NULL);
if (EFI_ERROR (Status) && FileInfoSize == 0) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to get '%s' file info size. Status=%r\n",
Path, Status));
goto Exit;
}
FileInfo = AllocatePool (FileInfoSize);
if (FileInfo == NULL) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Not enough resources for '%s' file info (%d bytes).\n",
Path, FileInfoSize));
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
}
Status = File->GetInfo (File, &gEfiFileInfoGuid, &FileInfoSize, FileInfo);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to get '%s' file info. Status=%r\n",
Path, Status));
goto Exit;
}
FileBufferSize = FileInfo->FileSize;
} else {
FileBufferSize = *FileSize;
}
*Fdt = AllocatePool (FileBufferSize);
if (*Fdt == NULL) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Not enough resources for '%s' file buffer (%d bytes).\n",
Path, FileBufferSize));
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
}
Status = File->Read (File, &FileBufferSize, *Fdt);
if (EFI_ERROR (Status)) {
if (FileSize != NULL) {
*FileSize = FileBufferSize;
}
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to read '%s' (%d bytes). Status=%r\n",
Path, FileBufferSize, Status));
goto Exit;
}
Ret = fdt_check_header (*Fdt);
if (Ret) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: '%s' has an invalid header! Ret=%a\n",
Path, fdt_strerror (Ret)));
Status = EFI_NOT_FOUND;
goto Exit;
}
Exit:
Root->Close (File);
if (FileInfo != NULL) {
FreePool (FileInfo);
}
if (EFI_ERROR (Status) && *Fdt != NULL) {
FreePool (*Fdt);
*Fdt = NULL;
}
return Status;
}
#define FDT_GET_USED_SIZE(Fdt) (fdt_off_dt_struct (Fdt) \
+ fdt_size_dt_struct (Fdt) \
+ fdt_size_dt_strings (Fdt))
STATIC
EFI_STATUS
EFIAPI
InstallOverlaysFromDirectoryPath (
IN EFI_FILE_PROTOCOL *Root,
IN CHAR16 *Path,
IN OUT VOID **Fdt,
IN OUT UINTN *OverlaysCount
)
{
EFI_STATUS Status;
EFI_FILE_PROTOCOL *Dir;
UINTN DirEntryInfoSize;
UINTN CurrentInfoSize;
EFI_FILE_INFO *DirEntryInfo;
VOID *FdtOverlay;
UINTN FdtSize;
INT32 Ret;
Status = Root->Open (Root, &Dir, Path, EFI_FILE_MODE_READ, 0);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Couldn't open directory '%s'. Status=%r\n",
Path, Status));
return Status;
}
DirEntryInfoSize = sizeof (EFI_FILE_INFO) + MAX_PATH_LENGTH;
DirEntryInfo = AllocatePool (DirEntryInfoSize);
if (DirEntryInfo == NULL) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Not enough resources for '%s' directory entry info.\n",
Path));
Root->Close (Dir);
return EFI_OUT_OF_RESOURCES;
}
DEBUG ((DEBUG_INFO, "FdtPlatform: Processing overlays in sub-directory '%s'\n", Path));
while (TRUE) {
CurrentInfoSize = DirEntryInfoSize;
Status = Dir->Read (Dir, &CurrentInfoSize, (VOID *) DirEntryInfo);
if (EFI_ERROR (Status) || CurrentInfoSize == 0) {
// Reached end of directory?
ASSERT (CurrentInfoSize <= DirEntryInfoSize);
ASSERT_EFI_ERROR (Status);
break;
}
if (DirEntryInfo->Attribute & EFI_FILE_DIRECTORY) {
continue;
}
if (!StrEndsWith (DirEntryInfo->FileName, L".dtbo")) {
continue;
}
DEBUG ((DEBUG_INFO, "FdtPlatform: Installing overlay '%s'\n",
DirEntryInfo->FileName));
Status = ReadFdtFromFilePath (Dir, DirEntryInfo->FileName,
&DirEntryInfo->FileSize, &FdtOverlay);
if (EFI_ERROR (Status)) {
if (Status == EFI_OUT_OF_RESOURCES) {
break;
}
continue;
}
FdtSize = FDT_GET_USED_SIZE (*Fdt);
if (FdtSize + DirEntryInfo->FileSize >= fdt_totalsize (*Fdt)) {
//
// Expand the buffer by at least 8 KB, so we don't end up
// reallocating for every small overlay.
//
FdtSize = fdt_totalsize (*Fdt) + MAX (DirEntryInfo->FileSize, SIZE_8KB);
Status = FdtOpenIntoAlloc (Fdt, NULL, FdtSize);
if (EFI_ERROR (Status)) {
FreePool (FdtOverlay);
break;
}
}
Ret = fdt_overlay_apply (*Fdt, FdtOverlay);
FreePool (FdtOverlay);
if (Ret) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to apply overlay '%s' (%d bytes). Ret=%a\n",
DirEntryInfo->FileName, DirEntryInfo->FileSize, fdt_strerror (Ret)));
if (Ret == -FDT_ERR_NOSPACE) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: FDT bytes used: %d, total: %d\n",
FDT_GET_USED_SIZE (*Fdt), fdt_totalsize (*Fdt)));
}
//
// The FDT is damaged at this point, we can't continue.
//
Status = EFI_LOAD_ERROR;
break;
}
*OverlaysCount += 1;
}
FreePool (DirEntryInfo);
Root->Close (Dir);
return Status;
}
STATIC CHAR16 mDtbOverrideRootPath[] = L"\\dtb";
STATIC
EFI_STATUS
EFIAPI
FdtPlatformProcessFileSystem (
IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem
)
{
EFI_STATUS Status;
EFI_FILE_PROTOCOL *Root;
EFI_FILE_PROTOCOL *DtbDir;
UINTN PathSize;
CHAR16 *Path;
CHAR8 *FdtName;
VOID *Fdt = NULL;
VOID *NewFdt = NULL;
VOID *FdtToInstall = NULL;
UINTN OverlaysCount = 0;
Status = FileSystem->OpenVolume (FileSystem, &Root);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to open volume. Status=%r\n", Status));
return Status;
}
Status = Root->Open (Root, &DtbDir, mDtbOverrideRootPath, EFI_FILE_MODE_READ, 0);
if (EFI_ERROR (Status)) {
if (Status != EFI_NOT_FOUND) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to open directory '%s'. Status=%r\n",
mDtbOverrideRootPath, Status));
}
return Status;
} else {
DEBUG ((DEBUG_INFO, "FdtPlatform: Found override directory '%s'.\n",
mDtbOverrideRootPath));
}
PathSize = MAX_PATH_LENGTH * sizeof (CHAR16);
Path = AllocatePool (PathSize);
if (Path == NULL) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Not enough resources for '%s' access path.\n",
mDtbOverrideRootPath));
Root->Close (DtbDir);
return EFI_OUT_OF_RESOURCES;
}
FdtName = FixedPcdGetPtr (PcdDeviceTreeName);
//
// Try to open the FDT override.
//
UnicodeSPrint (Path, PathSize, L"base\\%a.dtb", FdtName);
Status = ReadFdtFromFilePath (DtbDir, Path, NULL, &Fdt);
if (EFI_ERROR (Status)) {
if (mPlatformFdt == NULL) {
goto Exit;
}
Fdt = mPlatformFdt;
} else {
DEBUG ((DEBUG_INFO, "FdtPlatform: Loaded FDT override '%s'.\n", Path));
}
//
// Clone the FDT so that we can restore the original one
// in case it gets damaged.
//
Status = FdtOpenIntoAlloc (&Fdt, &NewFdt, fdt_totalsize (Fdt));
if (EFI_ERROR (Status)) {
goto Exit;
}
//
// Process the overlays common to all platforms.
//
Status = InstallOverlaysFromDirectoryPath (DtbDir, L"overlays", &NewFdt, &OverlaysCount);
if (Status == EFI_LOAD_ERROR || Status == EFI_OUT_OF_RESOURCES) {
goto Exit;
}
//
// Process the platform-specific overlays.
//
UnicodeSPrint (Path, PathSize, L"overlays\\%a", FdtName);
Status = InstallOverlaysFromDirectoryPath (DtbDir, Path, &NewFdt, &OverlaysCount);
if (Status == EFI_LOAD_ERROR || Status == EFI_OUT_OF_RESOURCES) {
goto Exit;
}
Exit:
Root->Close (DtbDir);
FreePool (Path);
if (NewFdt != NULL) {
if (fdt_check_header (NewFdt) == 0) {
FdtToInstall = NewFdt;
DEBUG ((DEBUG_INFO, "FdtPlatform: Using FDT with %d overlays merged.\n", OverlaysCount));
} else {
FreePool (NewFdt);
}
}
if (Fdt != NULL && Fdt != mPlatformFdt) {
if (FdtToInstall == NULL && fdt_check_header (Fdt) == 0) {
FdtToInstall = Fdt;
DEBUG ((DEBUG_INFO, "FdtPlatform: Using original FDT without overlays.\n"));
} else {
FreePool (Fdt);
}
}
if (FdtToInstall != NULL) {
Status = gBS->InstallConfigurationTable (&gFdtTableGuid, FdtToInstall);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to install the new FDT as config table. Status=%r\n",
Status));
}
}
return Status;
}
STATIC
VOID
EFIAPI
NotifyLoadedImage (
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
EFI_HANDLE *Handles;
UINTN HandleCount;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem;
while (TRUE) {
Status = gBS->LocateHandleBuffer (
ByRegisterNotify,
NULL,
mLoadedImageEventRegistration,
&HandleCount,
&Handles
);
if (EFI_ERROR (Status)) {
if (Status != EFI_NOT_FOUND) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to locate gEfiLoadedImageProtocolGuid. Status=%r\n",
Status));
}
break;
}
ASSERT (HandleCount == 1);
Status = gBS->HandleProtocol (
Handles[0],
&gEfiLoadedImageProtocolGuid,
(VOID **)&LoadedImage
);
FreePool (Handles);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to get gEfiLoadedImageProtocolGuid. Status=%r\n",
Status));
break;
}
if (LoadedImage->DeviceHandle == NULL) {
continue;
}
Status = gBS->HandleProtocol (
LoadedImage->DeviceHandle,
&gEfiSimpleFileSystemProtocolGuid,
(VOID **)&FileSystem
);
if (EFI_ERROR (Status)) {
if (Status != EFI_UNSUPPORTED) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to get gEfiSimpleFileSystemProtocolGuid. Status=%r\n",
Status));
}
continue;
}
Status = FdtPlatformProcessFileSystem (FileSystem);
if (EFI_ERROR (Status)) {
if (Status != EFI_NOT_FOUND) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to process the file system. Status=%r\n", Status));
}
continue;
}
}
}
STATIC
VOID
EFIAPI
NotifyReadyToBoot (
IN EFI_EVENT Event,
IN VOID *Context
)
{
gBS->CloseEvent (Event);
EfiCreateProtocolNotifyEvent (
&gEfiLoadedImageProtocolGuid,
TPL_CALLBACK,
NotifyLoadedImage,
NULL,
&mLoadedImageEventRegistration
);
}
STATIC
VOID
EFIAPI
NotifyExitBootServices (
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
VOID *Dtb;
Status = EfiGetSystemConfigurationTable (&gFdtTableGuid, &Dtb);
if (EFI_ERROR (Status) || Dtb == NULL) {
DEBUG ((DEBUG_WARN, "FdtPlatform: No FDT installed!\n"));
} else if (fdt_totalsize (Dtb) <= SIZE_4KB) {
// Some loaders may install a dummy table, warn in this case too.
DEBUG ((DEBUG_WARN, "FdtPlatform: No usable FDT installed!\n"));
}
}
STATIC
EFI_STATUS
EFIAPI
FdtEnableNode (
IN VOID *Fdt,
IN CONST CHAR8 *NodePath,
IN BOOLEAN Enable
)
{
INT32 Node;
INT32 Ret;
CHAR8 *NodeStatus;
Node = fdt_path_offset (Fdt, NodePath);
if (Node < 0) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Couldn't locate FDT node path '%a'. Ret=%a\n",
NodePath, fdt_strerror (Node)));
return EFI_NOT_FOUND;
}
NodeStatus = Enable ? "okay" : "disabled";
Ret = fdt_setprop_string (Fdt, Node, "status", NodeStatus);
if (Ret) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Failed to set '%a' status to '%a'. Ret=%a\n",
NodePath, NodeStatus, fdt_strerror (Ret)));
return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
}
STATIC
VOID
EFIAPI
FdtFixupComboPhyDevices (
IN VOID *Fdt
)
{
DEBUG ((DEBUG_INFO, "FdtPlatform: Fixing up Combo PHY devices (PCIe, SATA, USB)\n"));
FdtEnableNode (Fdt, "/pcie@fe170000",
PcdGet32 (PcdComboPhy1Mode) == COMBO_PHY_MODE_PCIE);
FdtEnableNode (Fdt, "/pcie@fe180000",
PcdGet32 (PcdComboPhy2Mode) == COMBO_PHY_MODE_PCIE);
FdtEnableNode (Fdt, "/pcie@fe190000",
PcdGet32 (PcdComboPhy0Mode) == COMBO_PHY_MODE_PCIE);
FdtEnableNode (Fdt, "/sata@fe210000",
PcdGet32 (PcdComboPhy0Mode) == COMBO_PHY_MODE_SATA);
FdtEnableNode (Fdt, "/sata@fe220000",
PcdGet32 (PcdComboPhy1Mode) == COMBO_PHY_MODE_SATA);
FdtEnableNode (Fdt, "/sata@fe230000",
PcdGet32 (PcdComboPhy2Mode) == COMBO_PHY_MODE_SATA);
FdtEnableNode (Fdt, "/usbhost3_0",
PcdGet32 (PcdComboPhy2Mode) == COMBO_PHY_MODE_USB3);
}
STATIC
VOID
EFIAPI
FdtFixupPcie3Devices (
IN VOID *Fdt
)
{
if (!FixedPcdGetBool (PcdPcie30Supported)) {
return;
}
DEBUG ((DEBUG_INFO, "FdtPlatform: Fixing up PCIe 3 devices\n"));
FdtEnableNode (Fdt, "/pcie@fe150000",
PcdGet32 (PcdPcie30State) == PCIE30_STATE_ENABLED);
}
STATIC
VOID
EFIAPI
ApplyPlatformFdtFixups (
IN VOID *Fdt
)
{
FdtFixupComboPhyDevices (Fdt);
FdtFixupPcie3Devices (Fdt);
}
STATIC
EFI_STATUS
EFIAPI
LoadPlatformFdt (
OUT VOID **PlatformFdt
)
{
EFI_STATUS Status;
VOID *Fdt;
UINTN FdtSize;
INT32 Ret;
Status = GetSectionFromAnyFv (
&gDtPlatformDefaultDtbFileGuid,
EFI_SECTION_RAW,
0,
&Fdt,
&FdtSize
);
if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND;
}
Ret = fdt_check_header (Fdt);
if (Ret) {
DEBUG ((DEBUG_ERROR, "FdtPlatform: Firmware FDT has an invalid header! Ret=%a\n",
fdt_strerror (Ret)));
return EFI_NOT_FOUND;
}
// Expand the FDT a bit to give room for any additions.
Status = FdtOpenIntoAlloc (&Fdt, NULL, fdt_totalsize (Fdt) + SIZE_1KB);
if (EFI_ERROR (Status)) {
return Status;
}
*PlatformFdt = Fdt;
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
FdtPlatformDxeInitialize (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_EVENT Event;
if ((PcdGet32 (PcdConfigTableMode) & CONFIG_TABLE_MODE_FDT) == 0) {
DEBUG ((DEBUG_WARN, "FdtPlatform: FDT support is disabled by the settings.\n"));
return EFI_UNSUPPORTED;
}
if (PcdGet8 (PcdFdtSupportOverrides)) {
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL, // Type
TPL_CALLBACK, // NotifyTpl
NotifyReadyToBoot, // NotifyFunction
NULL, // NotifyContext
&gEfiEventReadyToBootGuid, // EventGroup
&Event // Event
);
ASSERT_EFI_ERROR (Status);
}
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL, // Type
TPL_CALLBACK, // NotifyTpl
NotifyExitBootServices, // NotifyFunction
NULL, // NotifyContext
&gEfiEventExitBootServicesGuid, // EventGroup
&Event // Event
);
ASSERT_EFI_ERROR (Status);
Status = LoadPlatformFdt (&mPlatformFdt);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "FdtPlatform: Failed to load firmware FDT. Status=%r\n", Status));
return EFI_SUCCESS;
}
ApplyPlatformFdtFixups (mPlatformFdt);
Status = gBS->InstallConfigurationTable (&gFdtTableGuid, mPlatformFdt);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "FdtPlatform: Failed to install firmware DTB as config table. Status=%r\n",
Status));
}
return EFI_SUCCESS;
}

View File

@@ -0,0 +1,61 @@
#/** @file
#
# Flattened Device Tree platform driver
#
# Copyright (c) 2023, Mario Bălănică <mariobalanica02@gmail.com>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#**/
[Defines]
INF_VERSION = 0x0001001A
BASE_NAME = FdtPlatformDxe
FILE_GUID = 5d028f9c-bb17-4ff5-8c61-dbb4474e4a13
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
ENTRY_POINT = FdtPlatformDxeInitialize
[Sources]
FdtPlatformDxe.c
[Packages]
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
Silicon/Rockchip/RockchipPkg.dec
Silicon/Rockchip/RK3588/RK3588.dec
[LibraryClasses]
BaseLib
DebugLib
PrintLib
DxeServicesLib
MemoryAllocationLib
UefiBootServicesTableLib
UefiDriverEntryPoint
UefiLib
FdtLib
[Guids]
gFdtTableGuid
gDtPlatformDefaultDtbFileGuid
gEfiEventReadyToBootGuid
gEfiEventExitBootServicesGuid
[Protocols]
gEfiLoadedImageProtocolGuid
gEfiSimpleFileSystemProtocolGuid
[Pcd]
gRockchipTokenSpaceGuid.PcdDeviceTreeName
gRK3588TokenSpaceGuid.PcdConfigTableMode
gRK3588TokenSpaceGuid.PcdFdtSupportOverrides
gRK3588TokenSpaceGuid.PcdComboPhy0Mode
gRK3588TokenSpaceGuid.PcdComboPhy1Mode
gRK3588TokenSpaceGuid.PcdComboPhy2Mode
gRK3588TokenSpaceGuid.PcdPcie30Supported
gRK3588TokenSpaceGuid.PcdPcie30State
[Depex]
gRockchipPlatformConfigAppliedProtocolGuid

View File

@@ -0,0 +1,63 @@
/** @file
*
* Copyright (c) 2020, Jeremy Linton
* Copyright (c) 2023, Mario Bălănică <mariobalanica02@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
**/
#include <Library/DebugLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <VarStoreData.h>
#include "RK3588DxeFormSetGuid.h"
#include "ConfigTable.h"
VOID
EFIAPI
ApplyConfigTableVariables (
VOID
)
{
/* nothing to do here, the PCDs are read by AcpiPlatformDxe and FdtPlatformDxe */
}
VOID
EFIAPI
SetupConfigTableVariables (
VOID
)
{
UINTN Size;
UINT32 Var32;
UINT8 Var8;
EFI_STATUS Status;
Size = sizeof (UINT32);
Status = gRT->GetVariable (L"ConfigTableMode",
&gRK3588DxeFormSetGuid,
NULL, &Size, &Var32);
if (EFI_ERROR (Status)) {
Status = PcdSet32S (PcdConfigTableMode, PcdGet32 (PcdConfigTableMode));
ASSERT_EFI_ERROR (Status);
}
Size = sizeof (UINT32);
Status = gRT->GetVariable (L"AcpiUsb2State",
&gRK3588DxeFormSetGuid,
NULL, &Size, &Var32);
if (EFI_ERROR (Status)) {
Status = PcdSet32S (PcdAcpiUsb2State, FixedPcdGet32 (PcdAcpiUsb2StateDefault));
ASSERT_EFI_ERROR (Status);
}
Size = sizeof (UINT8);
Status = gRT->GetVariable (L"FdtSupportOverrides",
&gRK3588DxeFormSetGuid,
NULL, &Size, &Var8);
if (EFI_ERROR (Status)) {
Status = PcdSet8S (PcdFdtSupportOverrides, PcdGet8 (PcdFdtSupportOverrides));
ASSERT_EFI_ERROR (Status);
}
}

View File

@@ -6,8 +6,8 @@
*
**/
#ifndef __RK3588DXE_ACPI_H__
#define __RK3588DXE_ACPI_H__
#ifndef __RK3588DXE_CONFIG_TABLE_H__
#define __RK3588DXE_CONFIG_TABLE_H__
//
// Don't declare these in the VFR file.
@@ -15,15 +15,15 @@
#ifndef VFR_FILE_INCLUDE
VOID
EFIAPI
ApplyAcpiVariables (
ApplyConfigTableVariables (
VOID
);
VOID
EFIAPI
SetupAcpiVariables (
SetupConfigTableVariables (
VOID
);
#endif // VFR_FILE_INCLUDE
#endif // __RK3588DXE_ACPI_H__
#endif // __RK3588DXE_CONFIG_TABLE_H__

View File

@@ -8,6 +8,7 @@
**/
#include <Uefi.h>
#include <Protocol/MemoryAttribute.h>
#include <Library/ArmLib.h>
#include <Library/CacheMaintenanceLib.h>
#include <Library/DebugLib.h>
@@ -33,7 +34,7 @@
#include "CpuPerformance.h"
#include "ComboPhy.h"
#include "PciExpress30.h"
#include "Acpi.h"
#include "ConfigTable.h"
#include "FanControl.h"
#include "UsbDpPhy.h"
@@ -158,7 +159,7 @@ SetupVariables (
SetupCpuPerfVariables ();
SetupComboPhyVariables ();
SetupPcie30Variables ();
SetupAcpiVariables ();
SetupConfigTableVariables ();
SetupCoolingFanVariables ();
SetupUsbDpPhyVariables ();
@@ -203,7 +204,7 @@ ApplyVariables (
ApplyCpuClockVariables ();
ApplyComboPhyVariables ();
ApplyPcie30Variables ();
ApplyAcpiVariables ();
ApplyConfigTableVariables ();
ApplyCoolingFanVariables ();
ApplyUsbDpPhyVariables ();
@@ -404,6 +405,69 @@ RK3588NotifyReadyToBoot (
gBS->CloseEvent (Event);
}
/**
This function uninstalls the recently added EFI_MEMORY_ATTRIBUTE_PROTOCOL
to workaround older versions of OS loaders/shims using it incorrectly and
throwing a Synchronous Exception.
See:
- https://github.com/microsoft/mu_silicon_arm_tiano/issues/124
- https://edk2.groups.io/g/devel/topic/99631663
**/
STATIC
VOID
EFIAPI
UninstallMemoryAttributeProtocol (
VOID
)
{
EFI_STATUS Status;
EFI_HANDLE *Handles;
UINTN HandleCount;
EFI_MEMORY_ATTRIBUTE_PROTOCOL *MemoryAttributeProtocol;
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiMemoryAttributeProtocolGuid,
NULL,
&HandleCount,
&Handles
);
ASSERT_EFI_ERROR (Status);
ASSERT (HandleCount == 1);
Status = gBS->HandleProtocol (
Handles[0],
&gEfiMemoryAttributeProtocolGuid,
(VOID **)&MemoryAttributeProtocol
);
ASSERT_EFI_ERROR (Status);
Status = gBS->UninstallMultipleProtocolInterfaces (
Handles[0],
&gEfiMemoryAttributeProtocolGuid,
MemoryAttributeProtocol,
NULL
);
ASSERT_EFI_ERROR (Status);
gBS->FreePool (Handles);
}
STATIC
VOID
EFIAPI
RK3588NotifyEndOfDxe (
IN EFI_EVENT Event,
IN VOID *Context
)
{
gBS->CloseEvent (Event);
UninstallMemoryAttributeProtocol ();
}
EFI_STATUS
EFIAPI
RK3588EntryPoint (
@@ -413,7 +477,7 @@ RK3588EntryPoint (
{
EFI_STATUS Status;
VOID *EfiVariableArchRegistrationEvent;
EFI_EVENT ReadyToBootEvent;
EFI_EVENT Event;
PlatformEarlyInit();
@@ -431,7 +495,15 @@ RK3588EntryPoint (
Status = EfiCreateEventReadyToBootEx (TPL_CALLBACK,
RK3588NotifyReadyToBoot,
NULL,
&ReadyToBootEvent);
&Event);
ASSERT_EFI_ERROR (Status);
Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
RK3588NotifyEndOfDxe,
NULL,
&gEfiEndOfDxeEventGroupGuid,
&Event);
ASSERT_EFI_ERROR (Status);
Status = RK3588InitPeripherals ();

View File

@@ -18,7 +18,7 @@
CpuPerformance.c
ComboPhy.c
PciExpress30.c
Acpi.c
ConfigTable.c
FanControl.c
UsbDpPhy.c
RK3588DxeHii.uni
@@ -36,7 +36,6 @@
[LibraryClasses]
CacheMaintenanceLib
DebugLib
AcpiLib
IoLib
BaseMemoryLib
UefiBootServicesTableLib
@@ -54,8 +53,9 @@
RockchipPlatformLib
[Protocols]
gRk860xRegulatorProtocolGuid ## CONSUMES
gEfiVariableWriteArchProtocolGuid ## CONSUMES
gEfiMemoryAttributeProtocolGuid ## CONSUMES
gRk860xRegulatorProtocolGuid ## CONSUMES
gRockchipPlatformConfigAppliedProtocolGuid ## PRODUCES
[Pcd]
@@ -91,8 +91,10 @@
gRK3588TokenSpaceGuid.PcdPcie30Supported
gRK3588TokenSpaceGuid.PcdPcie30State
gRK3588TokenSpaceGuid.PcdConfigTableMode
gRK3588TokenSpaceGuid.PcdAcpiUsb2StateDefault
gRK3588TokenSpaceGuid.PcdAcpiUsb2State
gRK3588TokenSpaceGuid.PcdFdtSupportOverrides
gRK3588TokenSpaceGuid.PcdHasOnBoardFanOutput
gRK3588TokenSpaceGuid.PcdCoolingFanState

View File

@@ -123,14 +123,26 @@
#string STR_PCIE30_STATE_HELP #language en-US "Enable or disable PCIe 3.0 support."
/*
* ACPI configuration
* ACPI / Device Tree configuration
*/
#string STR_ACPI_FORM_TITLE #language en-US "ACPI"
#string STR_ACPI_FORM_HELP #language en-US "Configure the ACPI support."
#string STR_CONFIG_TABLE_FORM_TITLE #language en-US "ACPI / Device Tree"
#string STR_CONFIG_TABLE_FORM_HELP #language en-US "Configure the ACPI and Device Tree system tables support."
#string STR_CONFIG_TABLE_MODE_PROMPT #language en-US "Config Table Mode"
#string STR_CONFIG_TABLE_MODE_HELP #language en-US "Choose what config tables to expose to the OS.\n\nACPI - provides basic hardware support (USB, PCIe, SATA) for most OS/kernel versions.\n\nDevice Tree - provides extensive hardware support specific to a kernel version.\nThe firmware includes a DTB compatible with Rockchip SDK Linux 5.10 legacy kernel.\n\nIf both are exposed, the OS will decide which one to use."
#string STR_CONFIG_TABLE_MODE_ACPI #language en-US "ACPI"
#string STR_CONFIG_TABLE_MODE_FDT #language en-US "Device Tree"
#string STR_CONFIG_TABLE_MODE_ACPI_FDT #language en-US "Both"
#string STR_CONFIG_TABLE_ACPI_SUBTITLE #language en-US "ACPI Configuration"
#string STR_ACPI_USB2_STATE_PROMPT #language en-US "USB 2.0 Support"
#string STR_ACPI_USB2_STATE_HELP #language en-US "Enable or disable the USB 2.0 (EHCI) controllers.\n\nThis option is disabled by default due to compatibility issues with Windows, but it can be enabled for other OSes."
#string STR_CONFIG_TABLE_FDT_SUBTITLE #language en-US "Device Tree Configuration"
#string STR_FDT_SUPPORT_OVERRIDES_PROMPT #language en-US "Support DTB override & overlays"
#string STR_FDT_SUPPORT_OVERRIDES_HELP #language en-US "Enable or disable support for overriding the firmware-provided DTB and installing overlays.\n\nCheck firmware documentation for more details."
/*
* Cooling fan configuration
*/

View File

@@ -121,11 +121,21 @@ formset
name = Pcie30State,
guid = RK3588DXE_FORMSET_GUID;
efivarstore CONFIG_TABLE_MODE_VARSTORE_DATA,
attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
name = ConfigTableMode,
guid = RK3588DXE_FORMSET_GUID;
efivarstore ACPI_USB2_STATE_VARSTORE_DATA,
attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
name = AcpiUsb2State,
guid = RK3588DXE_FORMSET_GUID;
efivarstore FDT_SUPPORT_OVERRIDES_VARSTORE_DATA,
attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
name = FdtSupportOverrides,
guid = RK3588DXE_FORMSET_GUID;
efivarstore COOLING_FAN_STATE_VARSTORE_DATA,
attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
name = CoolingFanState,
@@ -163,8 +173,8 @@ formset
#endif
goto 0x1004,
prompt = STRING_TOKEN(STR_ACPI_FORM_TITLE),
help = STRING_TOKEN(STR_ACPI_FORM_HELP);
prompt = STRING_TOKEN(STR_CONFIG_TABLE_FORM_TITLE),
help = STRING_TOKEN(STR_CONFIG_TABLE_FORM_HELP);
#if FixedPcdGetBool (PcdHasOnBoardFanOutput)
goto 0x1005,
@@ -448,16 +458,45 @@ formset
#endif
form formid = 0x1004,
title = STRING_TOKEN(STR_ACPI_FORM_TITLE);
title = STRING_TOKEN(STR_CONFIG_TABLE_FORM_TITLE);
oneof varid = AcpiUsb2State.State,
prompt = STRING_TOKEN(STR_ACPI_USB2_STATE_PROMPT),
help = STRING_TOKEN(STR_ACPI_USB2_STATE_HELP),
oneof varid = ConfigTableMode.Mode,
prompt = STRING_TOKEN(STR_CONFIG_TABLE_MODE_PROMPT),
help = STRING_TOKEN(STR_CONFIG_TABLE_MODE_HELP),
flags = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED,
default = FixedPcdGet32 (PcdAcpiUsb2StateDefault),
option text = STRING_TOKEN(STR_DISABLED), value = ACPI_USB2_STATE_DISABLED, flags = 0;
option text = STRING_TOKEN(STR_ENABLED), value = ACPI_USB2_STATE_ENABLED, flags = 0;
default = CONFIG_TABLE_MODE_ACPI,
option text = STRING_TOKEN(STR_CONFIG_TABLE_MODE_ACPI), value = CONFIG_TABLE_MODE_ACPI, flags = 0;
option text = STRING_TOKEN(STR_CONFIG_TABLE_MODE_FDT), value = CONFIG_TABLE_MODE_FDT, flags = 0;
option text = STRING_TOKEN(STR_CONFIG_TABLE_MODE_ACPI_FDT), value = CONFIG_TABLE_MODE_ACPI_FDT, flags = 0;
endoneof;
suppressif (get(ConfigTableMode.Mode) & CONFIG_TABLE_MODE_ACPI) == 0;
subtitle text = STRING_TOKEN(STR_NULL_STRING);
subtitle text = STRING_TOKEN(STR_CONFIG_TABLE_ACPI_SUBTITLE);
oneof varid = AcpiUsb2State.State,
prompt = STRING_TOKEN(STR_ACPI_USB2_STATE_PROMPT),
help = STRING_TOKEN(STR_ACPI_USB2_STATE_HELP),
flags = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED,
default = FixedPcdGet32 (PcdAcpiUsb2StateDefault),
option text = STRING_TOKEN(STR_DISABLED), value = ACPI_USB2_STATE_DISABLED, flags = 0;
option text = STRING_TOKEN(STR_ENABLED), value = ACPI_USB2_STATE_ENABLED, flags = 0;
endoneof;
endif;
suppressif (get(ConfigTableMode.Mode) & CONFIG_TABLE_MODE_FDT) == 0;
subtitle text = STRING_TOKEN(STR_NULL_STRING);
subtitle text = STRING_TOKEN(STR_CONFIG_TABLE_FDT_SUBTITLE);
oneof varid = FdtSupportOverrides.State,
prompt = STRING_TOKEN(STR_FDT_SUPPORT_OVERRIDES_PROMPT),
help = STRING_TOKEN(STR_FDT_SUPPORT_OVERRIDES_HELP),
flags = NUMERIC_SIZE_1 | INTERACTIVE | RESET_REQUIRED,
default = FALSE,
option text = STRING_TOKEN(STR_DISABLED), value = FALSE, flags = 0;
option text = STRING_TOKEN(STR_ENABLED), value = TRUE, flags = 0;
endoneof;
endif;
endform;
#if FixedPcdGetBool (PcdHasOnBoardFanOutput)

View File

@@ -1,6 +1,6 @@
/** @file
*
* RPi defines for constructing ACPI tables
* RK3588 defines for constructing ACPI tables
*
* Copyright (c) 2020, Pete Batard <pete@akeo.ie>
* Copyright (c) 2019, ARM Ltd. All rights reserved.

View File

@@ -45,12 +45,23 @@ typedef struct {
UINT32 State;
} PCIE30_STATE_VARSTORE_DATA;
#define CONFIG_TABLE_MODE_ACPI 0x00000001
#define CONFIG_TABLE_MODE_FDT 0x00000002
#define CONFIG_TABLE_MODE_ACPI_FDT 0x00000003
typedef struct {
UINT32 Mode;
} CONFIG_TABLE_MODE_VARSTORE_DATA;
#define ACPI_USB2_STATE_DISABLED 0
#define ACPI_USB2_STATE_ENABLED 1
typedef struct {
UINT32 State;
} ACPI_USB2_STATE_VARSTORE_DATA;
typedef struct {
UINT8 State;
} FDT_SUPPORT_OVERRIDES_VARSTORE_DATA;
#define COOLING_FAN_STATE_DISABLED 0
#define COOLING_FAN_STATE_ENABLED 1
typedef struct {

View File

@@ -79,7 +79,9 @@
gRK3588TokenSpaceGuid.PcdPcie30State|0|UINT32|0x00000201
gRK3588TokenSpaceGuid.PcdConfigTableMode|0|UINT32|0x00000300
gRK3588TokenSpaceGuid.PcdAcpiUsb2State|0|UINT32|0x00000301
gRK3588TokenSpaceGuid.PcdFdtSupportOverrides|0|UINT8|0x00000351
gRK3588TokenSpaceGuid.PcdCoolingFanState|0|UINT32|0x00000401
gRK3588TokenSpaceGuid.PcdCoolingFanSpeed|0|UINT32|0x00000402

View File

@@ -131,6 +131,16 @@ READ_LOCK_STATUS = TRUE
#
INF Silicon/Rockchip/RK3588/Drivers/GmacPlatformDxe/GmacPlatformDxe.inf
#
# ACPI Support
#
INF Silicon/Rockchip/RK3588/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
#
# Device Tree Support
#
INF Silicon/Rockchip/RK3588/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf
#
# Custom platform components
#

View File

@@ -44,6 +44,10 @@
DEFINE USBDP_PHY_USB3_STATE_DISABLED = 0
DEFINE USBDP_PHY_USB3_STATE_ENABLED = 1
DEFINE CONFIG_TABLE_MODE_ACPI = 0x00000001
DEFINE CONFIG_TABLE_MODE_FDT = 0x00000002
DEFINE CONFIG_TABLE_MODE_ACPI_FDT = 0x00000003
#
# Silicon/Rockchip/RK3588/Drivers/RK3588Dxe/CpuPerformance.h
#
@@ -297,9 +301,11 @@
gRK3588TokenSpaceGuid.PcdPcie30State|L"Pcie30State"|gRK3588DxeFormSetGuid|0x0|gRK3588TokenSpaceGuid.PcdPcie30Supported
#
# ACPI
# ACPI / Device Tree
#
gRK3588TokenSpaceGuid.PcdConfigTableMode|L"ConfigTableMode"|gRK3588DxeFormSetGuid|0x0|$(CONFIG_TABLE_MODE_ACPI)
gRK3588TokenSpaceGuid.PcdAcpiUsb2State|L"AcpiUsb2State"|gRK3588DxeFormSetGuid|0x0|gRK3588TokenSpaceGuid.PcdAcpiUsb2StateDefault
gRK3588TokenSpaceGuid.PcdFdtSupportOverrides|L"FdtSupportOverrides"|gRK3588DxeFormSetGuid|0x0|FALSE
#
# Cooling Fan
@@ -342,3 +348,13 @@
# GMAC Init Driver
#
Silicon/Rockchip/RK3588/Drivers/GmacPlatformDxe/GmacPlatformDxe.inf
#
# ACPI Support
#
Silicon/Rockchip/RK3588/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
#
# Device Tree Support
#
Silicon/Rockchip/RK3588/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf

View File

@@ -111,10 +111,25 @@
# SCMI Mailbox Transport Layer
ArmMtlLib|Silicon/Rockchip/Library/RkMtlLib/RkMtlLib.inf
#
# Secure Boot dependencies
#
!if $(SECURE_BOOT_ENABLE) == TRUE
TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf
# re-use the UserPhysicalPresent() dummy implementation from the ovmf tree
PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
!else
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
!endif
# VariableRuntimeDxe Requirements
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf
@@ -163,9 +178,6 @@
SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
# Flattened Device Tree (FDT) access library
FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
@@ -314,6 +326,10 @@
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
FspiLib|Silicon/Rockchip/Library/FspiLib/FspiLib.inf
!if $(SECURE_BOOT_ENABLE) == TRUE
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
!endif
[LibraryClasses.AARCH64]
ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
@@ -326,7 +342,7 @@ FspiLib|Silicon/Rockchip/Library/FspiLib/FspiLib.inf
[BuildOptions]
# RVCT:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
*_*_*_CC_FLAGS = -DDEFAULT_DARK
*_GCC5_AARCH64_CC_FLAGS = -Wno-error=uninitialized -Wno-error=stringop-overflow -Wno-error=unused-function -Wno-error=unused-variable
GCC:*_*_AARCH64_CC_FLAGS = -Wno-error=uninitialized -Wno-error=stringop-overflow -Wno-error=unused-function -Wno-error=unused-variable
[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
GCC:*_*_ARM_DLINK_FLAGS = -z common-page-size=0x1000
@@ -406,9 +422,15 @@ FspiLib|Silicon/Rockchip/Library/FspiLib/FspiLib.inf
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0
!if $(SECURE_BOOT_ENABLE) == TRUE
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|600
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|400
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|1500
!else
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|50
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|20
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400
!endif
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0
@@ -429,6 +451,16 @@ FspiLib|Silicon/Rockchip/Library/FspiLib/FspiLib.inf
#gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000
#gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000
!if $(SECURE_BOOT_ENABLE) == TRUE
# override the default values from SecurityPkg to ensure images from all sources are verified in secure boot
gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04
gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
!endif
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
[PcdsDynamicHii.common.DEFAULT]
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|10 # Variable: L"Timeout"
@@ -464,7 +496,17 @@ FspiLib|Silicon/Rockchip/Library/FspiLib/FspiLib.inf
#
ArmPkg/Drivers/CpuDxe/CpuDxe.inf
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
!if $(SECURE_BOOT_ENABLE) == TRUE
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
<LibraryClasses>
NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
}
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
SecurityPkg/EnrollFromDefaultKeysApp/EnrollFromDefaultKeysApp.inf
SecurityPkg/VariableAuthenticated/SecureBootDefaultKeysDxe/SecureBootDefaultKeysDxe.inf
!else
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
!endif
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
@@ -530,14 +572,6 @@ FspiLib|Silicon/Rockchip/Library/FspiLib/FspiLib.inf
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
#
# DeviceTree Support
#
EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf {
<LibraryClasses>
DtPlatformDtbLoaderLib|EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf
}
#
# SMBIOS Support
#