:p
atchew
Login
For CSM, the highest priority is zero. In SeaBIOS that means "don't", and the highest priority is 1. So we end up with the fun outcome that booting from NVMe worked only when it *wasn't* selected as the primary boot target, because we don't actually run the nvme_controller_setup() thread for an NVMe controller if its boot prio is zero. Signed-off-by: David Woodhouse <dwmw2@infradead.org> --- src/fw/csm.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/fw/csm.c b/src/fw/csm.c index XXXXXXX..XXXXXXX 100644 --- a/src/fw/csm.c +++ b/src/fw/csm.c @@ -XXX,XX +XXX,XX @@ handle_csm(struct bregs *regs) csm_return(regs); } +static int csm_prio_to_seabios(u16 csm_prio) +{ + switch (csm_prio) { + case BBS_DO_NOT_BOOT_FROM: + case BBS_IGNORE_ENTRY: + return -1; + + case BBS_LOWEST_PRIORITY: + case BBS_UNPRIORITIZED_ENTRY: + default: + return csm_prio + 1; + } +} + int csm_bootprio_ata(struct pci_device *pci, int chanid, int slave) { if (!csm_boot_table) @@ -XXX,XX +XXX,XX @@ int csm_bootprio_ata(struct pci_device *pci, int chanid, int slave) int index = 1 + (chanid * 2) + slave; dprintf(3, "CSM bootprio for ATA%d,%d (index %d) is %d\n", chanid, slave, index, bbs[index].BootPriority); - return bbs[index].BootPriority; + return csm_prio_to_seabios(bbs[index].BootPriority); } int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid) @@ -XXX,XX +XXX,XX @@ int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid) return -1; BBS_TABLE *bbs = (void *)csm_boot_table->BbsTable; dprintf(3, "CSM bootprio for FDC is %d\n", bbs[0].BootPriority); - return bbs[0].BootPriority; + return csm_prio_to_seabios(bbs[0].BootPriority); } int csm_bootprio_pci(struct pci_device *pci) @@ -XXX,XX +XXX,XX @@ int csm_bootprio_pci(struct pci_device *pci) if (pci->bdf == pci_to_bdf(bbs[i].Bus, bbs[i].Device, bbs[i].Function)) { dprintf(3, "CSM bootprio for PCI(%d,%d,%d) is %d\n", bbs[i].Bus, bbs[i].Device, bbs[i].Function, bbs[i].BootPriority); - return bbs[i].BootPriority; + return csm_prio_to_seabios(bbs[i].BootPriority); } } return -1; _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
Explicitly handle the BBS_DO_NOT_BOOT_FROM and BBS_IGNORE_ENTRY values. Also add one to the other priority values, as find_prio() does for entries from bootorder. SeaBIOS uses zero for an item explicitly selected in interactive_bootmenu(). Signed-off-by: David Woodhouse <dwmw2@infradead.org> --- v2: No code change, just correct the commit message. v3: Add comment in code as requested by agraf, update commit message more. src/fw/csm.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/fw/csm.c b/src/fw/csm.c index XXXXXXX..XXXXXXX 100644 --- a/src/fw/csm.c +++ b/src/fw/csm.c @@ -XXX,XX +XXX,XX @@ handle_csm(struct bregs *regs) csm_return(regs); } +static int csm_prio_to_seabios(u16 csm_prio) +{ + switch (csm_prio) { + case BBS_DO_NOT_BOOT_FROM: + case BBS_IGNORE_ENTRY: + return -1; + + case BBS_LOWEST_PRIORITY: + case BBS_UNPRIORITIZED_ENTRY: + default: + // SeaBIOS default priorities start at 1, with 0 being used for + // an item explicitly selected from interactive_bootmenu(). + // As in find_prio(), add 1 to the value being returned. + return csm_prio + 1; + } +} + int csm_bootprio_ata(struct pci_device *pci, int chanid, int slave) { if (!csm_boot_table) @@ -XXX,XX +XXX,XX @@ int csm_bootprio_ata(struct pci_device *pci, int chanid, int slave) int index = 1 + (chanid * 2) + slave; dprintf(3, "CSM bootprio for ATA%d,%d (index %d) is %d\n", chanid, slave, index, bbs[index].BootPriority); - return bbs[index].BootPriority; + return csm_prio_to_seabios(bbs[index].BootPriority); } int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid) @@ -XXX,XX +XXX,XX @@ int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid) return -1; BBS_TABLE *bbs = (void *)csm_boot_table->BbsTable; dprintf(3, "CSM bootprio for FDC is %d\n", bbs[0].BootPriority); - return bbs[0].BootPriority; + return csm_prio_to_seabios(bbs[0].BootPriority); } int csm_bootprio_pci(struct pci_device *pci) @@ -XXX,XX +XXX,XX @@ int csm_bootprio_pci(struct pci_device *pci) if (pci->bdf == pci_to_bdf(bbs[i].Bus, bbs[i].Device, bbs[i].Function)) { dprintf(3, "CSM bootprio for PCI(%d,%d,%d) is %d\n", bbs[i].Bus, bbs[i].Device, bbs[i].Function, bbs[i].BootPriority); - return bbs[i].BootPriority; + return csm_prio_to_seabios(bbs[i].BootPriority); } } return -1; _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org