Enumeration of ISA serial ports inconsistent between Linux and GRUB2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch?id=refs/tags/v4.8>Hi everyone,

I would like to report a what looks to me like a bug in the serial8250 driver. The problem is, that the enumeration of legacy (ISA) serial devices seems to be inconsistent between this driver and what the Grub2 bootloader does. It seems in Linux the order of the serial ports is hardcoded here:

--- linux/drivers/tty/serial/8250/8250_core.c ---

static const struct old_serial_port old_serial_port[] = {
	SERIAL_PORT_DFNS /* defined in asm/serial.h */
};

---

It uses the traditional ordering 3F8,2F8,3E8,2E8:

--- linux/arch/x86/include/asm/serial.h ---

|#define SERIAL_PORT_DFNS \ /* UART CLK PORT IRQ FLAGS */\ { .uart = 0, BASE_BAUD, 0x3F8, 4, STD_COMX_FLAGS }, /* ttyS0 */\ { .uart = 0, BASE_BAUD, 0x2F8, 3, STD_COMX_FLAGS }, /* ttyS1 */\ { .uart = 0, BASE_BAUD, 0x3E8, 4, STD_COMX_FLAGS }, /* ttyS2 */\ { .uart = 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */|


---

Grub on the other hand looks up the order of the devices in the BIOS memory area:

--- grub-2.02/grub-core/term/ns8250.c ---
#ifdef GRUB_MACHINE_PCBIOS
#include <grub/machine/memory.h>
static const unsigned short *serial_hw_io_addr = (const unsigned short *) GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR;
#define GRUB_SERIAL_PORT_NUM 4
---

This area is hardcoded at address 0x400:

--- grub-2.02/include/grub/i386/pc/memory.h ---
#define GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR 0x400
---

I would like to note that this inconsistency is a real problem, as some motherboards (like e.g. a Supermicro X10DRi with default BIOS settings) have a different order stored there:

---
# hexdump -s 0x400 -n 8 /dev/mem
0000400 02f8 03f8 0000 0000
---

For later reference, the above code snippets are from Linux tag v4.8 and Grub2 tag grub-2.02-beta3.

Best regards,

Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux