[patch] sdcard: skip detection of PCI sdhci controllers if etc/sdcard used
Some BayTrail ChromeOS devices have the eMMC controller hidden (thus requiring the use of etc/sdcard), while others do not, making it problematic to have a single payload which serves all devices properly. Therefore, if the CBFS contains etc/sdcard entries, skip detection of any visible PCI sdhci controllers in order to avoid duplicate entries in the boot menu. patch implementation suggested by Kevin O'Connor :) Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> --- src/hw/sdcard.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c index 7e0875f..32cdb14 100644 --- a/src/hw/sdcard.c +++ b/src/hw/sdcard.c @@ -557,11 +557,14 @@ sdcard_setup(void) run_thread(sdcard_romfile_setup, file); } - struct pci_device *pci; - foreachpci(pci) { - if (pci->class != PCI_CLASS_SYSTEM_SDHCI || pci->prog_if >= 2) - // Not an SDHCI controller following SDHCI spec - continue; - run_thread(sdcard_pci_setup, pci); + //only scan for PCI controllers if etc/sdcard* not used + if (file == NULL) { + struct pci_device *pci; + foreachpci(pci) { + if (pci->class != PCI_CLASS_SYSTEM_SDHCI || pci->prog_if >= 2) + // Not an SDHCI controller following SDHCI spec + continue; + run_thread(sdcard_pci_setup, pci); + } } } -- 2.5.0
On Thu, Mar 10, 2016 at 12:38:14AM -0600, Matt DeVillier wrote:
Some BayTrail ChromeOS devices have the eMMC controller hidden (thus requiring the use of etc/sdcard), while others do not, making it problematic to have a single payload which serves all devices properly. Therefore, if the CBFS contains etc/sdcard entries, skip detection of any visible PCI sdhci controllers in order to avoid duplicate entries in the boot menu.
John, would disabling PCI scans for sd controllers when any etc/sdcard files exist work okay for the machines you've tested with? [...]
diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c index 7e0875f..32cdb14 100644 --- a/src/hw/sdcard.c +++ b/src/hw/sdcard.c @@ -557,11 +557,14 @@ sdcard_setup(void) run_thread(sdcard_romfile_setup, file); }
- struct pci_device *pci; - foreachpci(pci) { - if (pci->class != PCI_CLASS_SYSTEM_SDHCI || pci->prog_if >= 2) - // Not an SDHCI controller following SDHCI spec - continue; - run_thread(sdcard_pci_setup, pci); + //only scan for PCI controllers if etc/sdcard* not used + if (file == NULL) {
Unless I've missed something, this test (file==NULL) is always true here. Maybe add a counter or flag in the romfile search loop. -Kevin
+ struct pci_device *pci; + foreachpci(pci) { + if (pci->class != PCI_CLASS_SYSTEM_SDHCI || pci->prog_if >= 2) + // Not an SDHCI controller following SDHCI spec + continue; + run_thread(sdcard_pci_setup, pci); + } } }
On 3/10/2016 9:03 AM, Kevin O'Connor wrote:
On Thu, Mar 10, 2016 at 12:38:14AM -0600, Matt DeVillier wrote:
Some BayTrail ChromeOS devices have the eMMC controller hidden (thus requiring the use of etc/sdcard), while others do not, making it problematic to have a single payload which serves all devices properly. Therefore, if the CBFS contains etc/sdcard entries, skip detection of any visible PCI sdhci controllers in order to avoid duplicate entries in the boot menu. John, would disabling PCI scans for sd controllers when any etc/sdcard files exist work okay for the machines you've tested with?
[...]
diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c index 7e0875f..32cdb14 100644 --- a/src/hw/sdcard.c +++ b/src/hw/sdcard.c @@ -557,11 +557,14 @@ sdcard_setup(void) run_thread(sdcard_romfile_setup, file); }
- struct pci_device *pci; - foreachpci(pci) { - if (pci->class != PCI_CLASS_SYSTEM_SDHCI || pci->prog_if >= 2) - // Not an SDHCI controller following SDHCI spec - continue; - run_thread(sdcard_pci_setup, pci); + //only scan for PCI controllers if etc/sdcard* not used + if (file == NULL) { Unless I've missed something, this test (file==NULL) is always true here. Maybe add a counter or flag in the romfile search loop.
-Kevin
whoops, you're correct - I'll rework this shortly
+ struct pci_device *pci; + foreachpci(pci) { + if (pci->class != PCI_CLASS_SYSTEM_SDHCI || pci->prog_if >= 2) + // Not an SDHCI controller following SDHCI spec + continue; + run_thread(sdcard_pci_setup, pci); + } } }
On 2016-03-10 15:03, Kevin O'Connor wrote:
> On Thu, Mar 10, 2016 at 12:38:14AM -0600, Matt DeVillier wrote:
>> Some BayTrail ChromeOS devices have the eMMC controller hidden (thus
>> requiring the use of etc/sdcard), while others do not, making it
>> problematic
>> to have a single payload which serves all devices properly.
>> Therefore, if
>> the CBFS contains etc/sdcard entries, skip detection of any visible
>> PCI
>> sdhci controllers in order to avoid duplicate entries in the boot
>> menu.
>
> John, would disabling PCI scans for sd controllers when any etc/sdcard
> files exist work okay for the machines you've tested with?
I don't know why it wouldn't work, Kevin, unless some of the models do
both e.g. a hidden device for the eMMC and an unhidden device for the SD
card.
>
> [...]
>> diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c
>> index 7e0875f..32cdb14 100644
>> --- a/src/hw/sdcard.c
>> +++ b/src/hw/sdcard.c
>> @@ -557,11 +557,14 @@ sdcard_setup(void)
>> run_thread(sdcard_romfile_setup, file);
>> }
>>
>> - struct pci_device *pci;
>> - foreachpci(pci) {
>> - if (pci->class != PCI_CLASS_SYSTEM_SDHCI || pci->prog_if >=
>> 2)
>> - // Not an SDHCI controller following SDHCI spec
>> - continue;
>> - run_thread(sdcard_pci_setup, pci);
>> + //only scan for PCI controllers if etc/sdcard* not used
>> + if (file == NULL) {
>
> Unless I've missed something, this test (file==NULL) is always true
> here. Maybe add a counter or flag in the romfile search loop.
>
> -Kevin
>
>> + struct pci_device *pci;
>> + foreachpci(pci) {
>> + if (pci->class != PCI_CLASS_SYSTEM_SDHCI || pci->prog_if
>> >= 2)
>> + // Not an SDHCI controller following SDHCI spec
>> + continue;
>> + run_thread(sdcard_pci_setup, pci);
>> + }
>> }
>> }
participants (3)
-
John Lewis -
Kevin O'Connor -
Matt DeVillier