Sun 09 Oct 2016 10:49:32 AM UTC, original submission:
A problem I found 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. I pointed the issue out on the linux-serial mailing list
http://www.spinics.net/lists/linux-serial/msg23997.html
also, but Greg KH seems to be of the opinion that Grub should be fixed, not Linux.
|