|
| 1 | +From 6fd469063b7515dae4ee845775b299a2e5c1cf2a Mon Sep 17 00:00:00 2001 |
| 2 | +From: Andy Ross <andrew.j.ross@intel.com> |
| 3 | +Date: Mon, 9 Nov 2015 14:58:17 -0800 |
| 4 | +Subject: [PATCH] x86: early_printk: Allow for skipping PCI class check |
| 5 | + |
| 6 | +Some PCI UART devices have nonstandard class codes, but still want to |
| 7 | +be used as a boot console. Allow for skipping the class check on such |
| 8 | +platforms when you know that the passed device is correct. |
| 9 | + |
| 10 | +--- |
| 11 | + arch/x86/kernel/early_printk.c | 21 ++++++++++++++++----- |
| 12 | + 1 file changed, 16 insertions(+), 5 deletions(-) |
| 13 | + |
| 14 | +diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c |
| 15 | +index 21bf924..27ae392 100644 |
| 16 | +--- a/arch/x86/kernel/early_printk.c |
| 17 | ++++ b/arch/x86/kernel/early_printk.c |
| 18 | +@@ -218,7 +218,7 @@ static __init void early_pci_serial_init(char *s) |
| 19 | + { |
| 20 | + unsigned divisor; |
| 21 | + unsigned long baud = DEFAULT_BAUD; |
| 22 | +- u8 bus, slot, func; |
| 23 | ++ u8 bus, slot, func, classcheck = 1; |
| 24 | + u32 classcode, bar0; |
| 25 | + u16 cmdreg; |
| 26 | + char *e; |
| 27 | +@@ -246,6 +246,15 @@ static __init void early_pci_serial_init(char *s) |
| 28 | + func = (u8)simple_strtoul(s, &e, 16); |
| 29 | + s = e; |
| 30 | + |
| 31 | ++ /* |
| 32 | ++ * Not all PCI UART devices have sane class codes, so allow a |
| 33 | ++ * "noclasscheck" flag to be prepended to disable the test. |
| 34 | ++ */ |
| 35 | ++ if (strstarts(s, ",noclasscheck")) { |
| 36 | ++ classcheck = 0; |
| 37 | ++ s += 13; |
| 38 | ++ } |
| 39 | ++ |
| 40 | + /* A baud might be following */ |
| 41 | + if (*s == ',') |
| 42 | + s++; |
| 43 | +@@ -260,10 +269,12 @@ static __init void early_pci_serial_init(char *s) |
| 44 | + /* |
| 45 | + * Verify it is a UART type device |
| 46 | + */ |
| 47 | +- if (((classcode >> 16 != PCI_CLASS_COMMUNICATION_MODEM) && |
| 48 | +- (classcode >> 16 != PCI_CLASS_COMMUNICATION_SERIAL)) || |
| 49 | +- (((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */ |
| 50 | +- return; |
| 51 | ++ if (classcheck) { |
| 52 | ++ if (((classcode >> 16 != PCI_CLASS_COMMUNICATION_MODEM) && |
| 53 | ++ (classcode >> 16 != PCI_CLASS_COMMUNICATION_SERIAL)) || |
| 54 | ++ (((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */ |
| 55 | ++ return; |
| 56 | ++ } |
| 57 | + |
| 58 | + /* |
| 59 | + * Determine if it is IO or memory mapped |
| 60 | +-- |
| 61 | +1.9.1 |
| 62 | + |
0 commit comments