Skip to content
/ edk2 Public

MdeModulePkg/BayhubSdMmcOverrideDxe: add#304

Draft
filipleple wants to merge 1 commit intodasharofrom
fix_sd_driver_integration
Draft

MdeModulePkg/BayhubSdMmcOverrideDxe: add#304
filipleple wants to merge 1 commit intodasharofrom
fix_sd_driver_integration

Conversation

@filipleple
Copy link
Member

Replace the direct mOverride = &BhtOverride assignment in InitializeSdMmcPciHcDxe with a standalone DXE driver that installs gEdkiiSdMmcOverrideProtocolGuid, which SdMmcPciHcDxe already discovers via LocateProtocol in SdMmcPciHcDriverBindingStart.

The previous integration had two problems. First, assigning mOverride in the entry point before any DriverBindingStart call meant the LocateProtocol lookup was always skipped, making it impossible for any other platform driver to provide an alternative override. Second, BayhubHost.c depended on SdMmcPciHcDxe-internal headers and helpers (SdMmcHcOrMmio, SdMmcHcRwMmio, SdMmcHcClockSupply, SD_MMC_HC_PRIVATE_DATA), preventing it from being compiled as a separate module.

The new BayhubSdMmcOverrideDxe driver uses EFI_PCI_IO_PROTOCOL directly for all SDHCI register access and provides BhtHostClockSupply as a self-contained 400 KHz initialisation routine, removing all dependencies on SdMmcPciHcDxe internals.

SdMmcPciHcDxe is restored to its upstream state; BayhubHost sources are removed from it entirely.

Platform firmware that requires BayHub SD/eMMC support should include both SdMmcPciHcDxe.inf and BayhubSdMmcOverrideDxe.inf in its DSC.

Replace the direct `mOverride = &BhtOverride` assignment in
InitializeSdMmcPciHcDxe with a standalone DXE driver that installs
gEdkiiSdMmcOverrideProtocolGuid, which SdMmcPciHcDxe already discovers
via LocateProtocol in SdMmcPciHcDriverBindingStart.

The previous integration had two problems. First, assigning mOverride
in the entry point before any DriverBindingStart call meant the
LocateProtocol lookup was always skipped, making it impossible for
any other platform driver to provide an alternative override. Second,
BayhubHost.c depended on SdMmcPciHcDxe-internal headers and helpers
(SdMmcHcOrMmio, SdMmcHcRwMmio, SdMmcHcClockSupply,
SD_MMC_HC_PRIVATE_DATA), preventing it from being compiled as a
separate module.

The new BayhubSdMmcOverrideDxe driver uses EFI_PCI_IO_PROTOCOL
directly for all SDHCI register access and provides BhtHostClockSupply
as a self-contained 400 KHz initialisation routine, removing all
dependencies on SdMmcPciHcDxe internals.

SdMmcPciHcDxe is restored to its upstream state; BayhubHost sources
are removed from it entirely.

Platform firmware that requires BayHub SD/eMMC support should include
both SdMmcPciHcDxe.inf and BayhubSdMmcOverrideDxe.inf in its DSC.

Signed-off-by: Filip Lewinski <filip.lewinski@3mdeb.com>
@filipleple filipleple self-assigned this Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant