mmc: Lenovo N22 Braswell SD slot fixes
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Hans de Goede
Can you try running:
ls -ld /sys/bus/pci/devices/0000:00:12.0/firmware_node and if that exists do:
cat /sys/bus/pci/devices/0000:00:12.0/firmware_node/status I wonder if the PCI "slot" does have a ACPI companion-node and if that has a status attribute, and if yes to both what the status attribute says.
Done. Results below, collected on Debian vanilla, Fedora Live without Secure Boot, and Fedora Live with Secure Boot enabled. The results are identical across all three.
firmware_node:
ls -ld /sys/bus/pci/devices/0000:00:12.0/firmware_node
lrwxrwxrwx 1 root root 0
/sys/bus/pci/devices/0000:00:12.0/firmware_node ->
../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/80860F14:01
cat /sys/bus/pci/devices/0000:00:12.0/firmware_node/status
0ACPI device status (identical across all three boot environments):
80860F14:00 status: 15 (eMMC controller, working)
80860F14:01 status: 0 (SD slot companion, disabled)
INT33BB:00 status: 15 (present)Identity of 80860F14:01:
hid: 80860F14
uid: 3
path: \_SB_.PCI0.SDHC
adr: 0x00120000
hrv: 1
physical_node -> ../../../../pci0000:00/0000:00:12.0Identity of INT33BB:00 for comparison:
hid: INT33BB
uid: 2
path: \_SB_.PCI0.SDHB
adr: 0x00110000
hrv: 2The adr fields are notable. 80860F14:01 has adr 0x00120000 which maps to PCI 00:12.0, the SD slot. INT33BB:00 has adr 0x00110000 which maps to PCI 00:11.0, a different device. INT33BB:00 does not appear to be the ACPI companion for the SD slot.
80860F14:01 at path \_SB_.PCI0.SDHC with physical_node pointing directly to 0000:00:12.0 appears to be the correct disabled companion for the SD slot.
Regarding the BIOS mode test: the N22 was booted into Fedora Workstation 41 Live both with Secure Boot disabled and with Secure Boot enabled. In the Secure Boot run, dmesg confirmed:
secureboot: Secure boot enabled
Kernel is locked down from EFI Secure Boot mode
integrity: Loaded X.509 cert 'Microsoft Corporation UEFI CA 2011: 13adbf4309bd82709c8cd54f316ed522988a1bd4'
I did not observe any BIOS mode switch. The ACPI device status values were identical across all three boot environments.
Fedora dmesg shows the same broken sequence as Debian vanilla:
[ 14.272600] mmc0: SDHCI controller on ACPI [INT33BB:00] using ADMA
[ 14.285627] mmc1: SDHCI controller on ACPI [80860F14:00] using ADMA
[ 14.375047] sdhci-pci 0000:00:12.0: SDHCI controller found [8086:2296] (rev 21)
[ 14.456554] mmc0: Failed to initialize a non-removable card
[ 14.457130] mmc1: new HS200 MMC card at address 0001
... sdhci-pci 0000:00:12.0 repeating, BusMaster- throughoutThe full acpidump (233KB) is available at:
Given that 80860F14:01 is present with physical_node pointing to 0000:00:12.0 but disabled with status 0, would enabling it via the override_status_id mechanism in drivers/acpi/x86/utils.c be the right direction? And would that alone be sufficient to let the correct ACPI path own the SD slot, or would INT33BB:00 still need to be handled separately?
Hi,
Quoted 13 lines · Nelson Johnson
Quoted 7 lines · Hans de Goede
Can you try running:
ls -ld /sys/bus/pci/devices/0000:00:12.0/firmware_node and if that exists do:
cat /sys/bus/pci/devices/0000:00:12.0/firmware_node/status I wonder if the PCI "slot" does have a ACPI companion-node and if that has a status attribute, and if yes to both what the status attribute says.Done. Results below, collected on Debian vanilla, Fedora Live without Secure Boot, and Fedora Live with Secure Boot enabled. The results are identical across all three.
Quoted 6 lines
firmware_node:ls -ld /sys/bus/pci/devices/0000:00:12.0/firmware_node lrwxrwxrwx 1 root root 0 /sys/bus/pci/devices/0000:00:12.0/firmware_node -> ../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/80860F14:01
Ok, interesting so the 80860F14:01 gets seen as a companion to the 0000:00:12.0 PCI slot/function. Even though it looks like 80860F14:01 should simply be a standalone ACPI enumerated SD card controller and 0000:00:12.0 should not be visible on the PCI bus at all.
Note both PCI 0000:00:12.0 and 80860F14:01 point to the same hw, but typically only one of the ways of seeing the hw is enabled for the OS. Well I guess that is the case here since 80860F14:01 reports _STA = 0.
Quoted 27 lines
cat /sys/bus/pci/devices/0000:00:12.0/firmware_node/status 0ACPI device status (identical across all three boot environments):
80860F14:00 status: 15 (eMMC controller, working) 80860F14:01 status: 0 (SD slot companion, disabled) INT33BB:00 status: 15 (present)Identity of 80860F14:01:
hid: 80860F14 uid: 3 path: \_SB_.PCI0.SDHC adr: 0x00120000 hrv: 1 physical_node -> ../../../../pci0000:00/0000:00:12.0Identity of INT33BB:00 for comparison:
hid: INT33BB uid: 2 path: \_SB_.PCI0.SDHB adr: 0x00110000 hrv: 2
Quoted 8 lines
The adr fields are notable. 80860F14:01 has adr
0x00120000which maps to PCI 00:12.0, the SD slot. INT33BB:00 has adr0x00110000which maps to PCI 00:11.0, a different device. INT33BB:00 does not appear to be the ACPI companion for the SD slot.80860F14:01 at path \_SB_.PCI0.SDHC with
physical_nodepointing directly to 0000:00:12.0 appears to be the correct disabled companion for the SD slot.
Right but the 80860F14:01 dev being disabled seems correct, since it should only be enabled when PCI enumeration for 0000:00:12.0 is disabled.
Given that it is weird it has an _ADR ACIP field at all, since it is not a PCI companion, it is another way to enumerate the same hw when PCI enumeration for that "ip block" is disabled.
Quoted 11 lines
Regarding the BIOS mode test: the N22 was booted into Fedora Workstation 41 Live both with Secure Boot disabled and with Secure Boot enabled. In the Secure Boot run, dmesg confirmed:
secureboot: Secure boot enabled
Kernel is locked down from EFI Secure Boot mode
integrity: Loaded X.509 cert 'Microsoft Corporation UEFI CA 2011:13adbf4309bd82709c8cd54f316ed522988a1bd4'I did not observe any BIOS mode switch. The ACPI device status values were identical across all three boot environments.
Ok, thank you for trying.
Have you looked for a BIOS update from Lenovo ? Also have you tried to do "load setup defaults" or something similar in the BIOS ?
It is possible that the layout of (hidden) BIOS parameters has changed between BIOS versions and the updater was not smart enough to wipe the nvram. Then you're using a set of hidden BIOS parameters meant for an older version which can wreck havoc.
Given how funky this all is, looking for a BIOS update + doing load-setu-defaults + save in the BIOS would be one of the first things I would try.
Quoted 11 lines
Fedora dmesg shows the same broken sequence as Debian vanilla:
[ 14.272600] mmc0: SDHCI controller on ACPI [INT33BB:00] using ADMA [ 14.285627] mmc1: SDHCI controller on ACPI [80860F14:00] using ADMA [ 14.375047] sdhci-pci 0000:00:12.0: SDHCI controller found [8086:2296] (rev 21) [ 14.456554] mmc0: Failed to initialize a non-removable card [ 14.457130] mmc1: new HS200 MMC card at address 0001 ... sdhci-pci 0000:00:12.0 repeating, BusMaster- throughoutThe full acpidump (233KB) is available at:
Quoted 8 lines
Given that 80860F14:01 is present with
physical_nodepointing to 0000:00:12.0 but disabled with status 0, would enabling it via theoverride_status_idmechanism indrivers/acpi/x86/utils.cbe the right direction? And would that alone be sufficient to let the correct ACPI path own the SD slot, or would INT33BB:00 still need to be handled separately?
I think that the whole INT33BB:00 device is a red-herring and can simply be ignored. It uses SI0A as base address, where as 80860F14:00 uses SD0A as base address.
These Braswell chips have 3 SD/MMC controllers:
1. The eMMC controller, this seems to be ACPI [80860F14:00] on your hw
2. A SDIO controller for SDIO attached wifi, this seems to be ACPI [INT33BB:00] on your hw and is unused (Wifi attached over PCI?)
3. A SD card slot controller, this seems to be pci 0000:00:12.0 on your hw, that or ACPI [80860F14:01]. I suspect things might work better in ACPI [80860F14:01] enumeration mode, but that would require disabling the PCI enumeration otherwise things get even more funky ...
So I think the INT33BB:00 device describes the actual SDIO controller and you don't need to disable it.
So the first thing to do would be to test your original patches without the patch to disable the INT33BB probing in the sdhci-acpi code.
Once we've confirmed that that patch is not necessary we can look at fixing the issues with the PCI enumerated sd-card slot controller.
And yes trying to override _STA for 80860F14:01 is an interesting experiment, this will give the shdci-pci driver access to the sdcard detect GPIO I believe. And also to some power-management functions, so maybe that is enough to fix things.
Since Linux sees the 80860F14:01 as a PCI-companion it should not instantiate a platform-device for it, so sdhci-acpi will not try to use it.
But first do the bios-update (if available) + load-setup-defaults + save thingie please.
Regards,
Hans
Quoted 7 lines · Hans de Goede
Have you looked for a BIOS update from Lenovo? Also have you tried to do "load setup defaults" or something similar in the BIOS?
So the first thing to do would be to test your original patches without the patch to disable the INT33BB probing in the sdhci-acpi code.
Quoted 5 lines
And yes trying to override
_STAfor 80860F14:01 is an interesting experiment.But first do the bios-update (if available) + load-setup-defaults + save thingie please.
Results of all three tests follow.
BIOS update check:
The N22 is running BIOS version 0YCN26WW dated 2019-03-11. This is the latest version available from Lenovo for this model — no newer version exists. fwupd confirms no System Firmware updates are available. Load Setup Defaults was performed and all visible BIOS settings were reset. ACPI device status was unchanged after reset:
80860F14:00 status: 15
80860F14:01 status: 0
INT33BB:00 status: 15Stale NVRAM does not appear to be the cause. This BIOS was present during all previous testing reported in this thread.
Patches 1 and 2 without Patch 3:
Tested on a kernel built from the vanilla 6.19.6 base with only Patches 1 and 2 applied. The SD slot works correctly without Patch 3. sdhci-pci binds 0000:00:12.0, BusMaster is enabled, and the 128GB SDXC card is detected at UHS-I SDR104. INT33BB:00 still fails to initialize as a non-removable card but does not prevent sdhci-pci from owning the controller. Patch 3 is not necessary on this machine.
[ 3.055743] mmc0: SDHCI controller on ACPI [INT33BB:00] using ADMA
[ 3.063153] sdhci-pci 0000:00:12.0: SDHCI controller found [8086:2296] (rev 21)
[ 3.063881] mmc1: SDHCI controller on PCI [0000:00:12.0] using ADMA
[ 3.248057] mmc0: Failed to initialize a non-removable card
[ 4.007369] mmc1: new UHS-I speed SDR104 SDXC card at address aaaa
[ 4.179918] mmcblk1: mmc1:aaaa SD128 119 GiB Control: BusMaster+
Kernel driver in use: sdhci-pci
override _STA for 80860F14:01 experiment:
Tested on a vanilla 6.19.6 kernel with a PRESENT_ENTRY_HID entry added to the override_status_ids table in drivers/acpi/x86/utils.c:
PRESENT_ENTRY_HID("80860F14", "3", INTEL_ATOM_AIRMONT, {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "N22"),
}),The override did not change 80860F14:01 status. It remained at 0 after boot. sdhci-pci did not bind, BusMaster stayed off, and the SD card was not detected. The broken behavior was identical to vanilla. The override as implemented here did not take effect.
Given that Patches 1 and 2 alone restore full functionality, is a two-patch v2 series the right next step, or is there something further you would like to investigate first?
Quoted 9 lines · Nelson Johnson
Quoted 7 lines · Hans de Goede
Can you try running:
ls -ld /sys/bus/pci/devices/0000:00:12.0/firmware_node and if that exists do:
cat /sys/bus/pci/devices/0000:00:12.0/firmware_node/status I wonder if the PCI "slot" does have a ACPI companion-node and if that has a status attribute, and if yes to both what the status attribute says.
Quoted 3 lines
Done. Results below, collected on Debian vanilla, Fedora Live without Secure Boot, and Fedora Live with Secure Boot enabled. The results are identical across all three.
A side note: Your email lost the In-reply-to and possibly other headers, so it looks like a new email thread, however by subject it seems as a reply into the previous discussion. Check if you have nothing wrong with your email setup.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 4 lines · Andy Shevchenko
A side note: Your email lost the In-reply-to and possibly other headers, so it looks like a new email thread, however by subject it seems as a reply into the previous discussion. Check if you have nothing wrong with your email setup.
Apologies for the broken threading. It looks like my last reply did not preserve the expected threading headers on-list. As a first-time submitter I was not aware of the distinction between on-list and off-list replies. I will reply to list-archived messages going forward and double-check the generated headers before sending.