Hi! I’m creating a edk2 driver to be able to read the SD card contents in UEFI stage, and eventually boot from this device. SD card contains Linux kernel, dtb and rootfs.
In the design we have a Realtek RTS5264 SD card reader, which is attached to the Orin NX using PCIe. Since Orin doesn't have internal flash, the SD card is needed as a boot media, that's why edk2 driver is needed.
I was able to add a Rts5264 DXE driver to edk2-nvidia:
https://github.com/NVIDIA/edk2-nvidiaI’m able to build the driver, and run it when the PCIe device matching Vendor ID and Product ID of this chip is enumerated in UEFI. Then it performs register writes to the RTS5264 chip to enable power for SD card, etc.
See example log:
```
add-symbol-file /workspace/Build/Jetson/DEBUG_GCC5/AARCH64/Platform/NVIDIA/Jetson/Drivers/Rts5264/Rts5264/DEBUG/Rts5264Dxe.dll 0x46A9FF000
Loading driver at 0x0046A9FE000 EntryPoint=0x0046AA0756C Rts5264Dxe.efi
ListPciDevices: Segment: FF Bus: 0x00 Device: 0x00 Function: 0x00 Vendor ID: 0xFFFF Device ID:0x0000
ListPciDevices: Segment: 01 Bus: 0x00 Device: 0x00 Function: 0x00 Vendor ID: 0x10DE Device ID:0x229E
ListPciDevices: Segment: 01 Bus: 0x01 Device: 0x00 Function: 0x00 Vendor ID: 0x10EC Device ID:0x5264
ListPciDevices: Segment: 04 Bus: 0x00 Device: 0x00 Function: 0x00 Vendor ID: 0x10DE Device ID:0x229C
ListPciDevices: Segment: 04 Bus: 0x01 Device: 0x00 Function: 0x00 Vendor ID: 0x8086 Device ID:0x2723
ListPciDevices: Segment: 07 Bus: 0x00 Device: 0x00 Function: 0x00 Vendor ID: 0x10DE Device ID:0x229A
ListPciDevices: Segment: 08 Bus: 0x00 Device: 0x00 Function: 0x00 Vendor ID: 0x10DE Device ID:0x229C
ListPciDevices: Segment: 08 Bus: 0x01 Device: 0x00 Function: 0x00 Vendor ID: 0x10EC Device ID:0x8168
MnpSyncSendPacket: No network cable detected.
RTS5264_START: Querying protocols on incoming ControllerHandle 46792BE98
RTS5264_START: ControllerHandle 46792BE98 HAS DevicePath: VenHw(1E5A432C-0466-4D31-B009-D4D9239271D3)/MemoryMapped(0xB,0x14100000,0x1411FFFF)/PciRoot(0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)
RTS5264_START: ControllerHandle 46792BE98 HAS PciIo Protocol (queried by HandleProtocol).
RTS5264_START: Raw BAR1 value: 0x40000000 (Type: MmYsNRts5264: IC Version: 0x1
RTS5264: Powering on card...
RTS5264: Setting initial clock...
```
However, I struggle with connecting this driver to the filesystem in edk2, to be able to read/write, and eventually boot from the SD card.
Can you please outline the steps that should be taken, which protocols should I implement to be able to read the SD card via this driver?
I'm new to edk2 so every piece of good advice will be useful.
Thank you!
Filip