Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Arasan driver to fail gracefully when no card is present #37

Closed
andreiw opened this issue Apr 16, 2020 · 2 comments
Closed

Improve Arasan driver to fail gracefully when no card is present #37

andreiw opened this issue Apr 16, 2020 · 2 comments
Labels
uefi-future Everything is possible given enough time and energy

Comments

@andreiw
Copy link
Member

andreiw commented Apr 16, 2020

Booting UEFI from USB or network still requires an SD card, because the Arasan driver will loop forever on I/O errors. Unfortunately the Pi Foundation didn't wire up the card detect pin so we have to do something more creative.

@ehem
Copy link

ehem commented Jul 13, 2020

With USB boot available on all variants of Raspberry PI, this now becomes a show-stopping issue.

Might getting the MMC2 controller working solve this issue?

Does the lower level loader provide any indications what method booted the Raspberry PI? (being loaded from a USB device is an implicit instruction to load from USB device) Might it be possible to disable the Arasan driver via command-line?

@pbatard
Copy link
Member

pbatard commented Jul 13, 2020

@ehem: A patch was submitted more than a week ago with a fix for this. We are (more or less) waiting for it to be upstreamed at this stage. Please please please, do not assume that you get the full picture of what is really happening from the presence or absence of updates in this issue tracker. This is NOT twitter: you won't find real-time updates of the work being done here. So if you really want to know what's going on, susbcribe to edk2-devel and monitor Pi related patches there, thank you.

leiflindholm pushed a commit to tianocore/edk2-platforms that referenced this issue Jul 14, 2020
The Raspberry Pi 3 and Pi 4 platforms (with latest EEPROM) can boot
straight from USB, without the need for an SD card being present.
However, the IsCardPresent () calls from the ArasanMmcHost and SdHost
drivers are currently hardwired to return TRUE, which results in
straight to USB boot failing due to the SD drivers looping on
errors while trying to poke at a non-existent card...

Ideally, we would use the Card Detect signal from the uSD slot, to
report on the presence or absence of a card, but the Raspberry Pi
Foundation did not wire those signals in the Pi 2 and subsequent
models, leaving us with only potentially interfering SD commands
as means to perform card detection.

As a result of this, we are left with no other choice but limit
detection to occurring only once, prior to formal SD card init,
and then return the detected value for subsequent calls. This,
however, is more than good enough for the intended purpose, which
is to allow straight to USB boot. The sequence is a simplified
variant of the identification code in MmcDxe.

Tested on Raspberry Pi 2B, 3B and CM3 (for both SD controllers)
and Pi 4 (for Arasan, as that's the only controller available today)

Addresses pftf/RPi3#13, pftf/RPi3#14, pftf/RPi4#37.

Co-authored-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Tested-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
uefi-future Everything is possible given enough time and energy
Projects
None yet
Development

No branches or pull requests

3 participants