Skip to contentSkip to conversation

PNPACPI probes serial twice, messes up serial console

DISCUSSION Keith Owens 3 participants 11 messages Mar 20, 2007 – Apr 6, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

------- Blind-Carbon-Copy

X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.1
From: Keith Owens <[email protected]>
To: [email protected]
cc: [email protected]
Subject: PNPACPI probes serial twice, messes up serial console
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Tue, 20 Mar 2007 17:46:46 +1100
Message-ID: <[email protected]>

Dell SC1425 x86_64 running in i386 mode (the problem also occurs in x86_64 mode). Kernel 2.6.21-rc4, gcc 4.1.0. Config extract at end.

Booting with 'console=tty console=ttyS0,9600'. The serial console on ttyS0 (0x3f8, irq 4) is probed twice, once from serial8250_init() and again from serial_pnp_probe(). The serial console output is correct until the second probe (from PNP) gets to these lines in serial8250_config_port()

	if (flags & UART_CONFIG_TYPE)
		autoconfig(up, probeflags);

After the call to autoconfig(), the serial console starts printing NUL characters instead of the console output. The number of NUL characters corresponds closely with the number of characters written to the VT console, IOW it outputs each serial character as NUL instead of the correct character. When the kernel boots /sbin/init, the console resets to printing normal characters.

AFAICT, the second probe of the UART is doing something nasty to the hardware. This is not a recent problem, I can reproduce the problem on 2.6.16. Booting with pnpacpi=off removes the problem, but that supresses all the PNPACPI code, not just the second probe of the serial devices.

Should pnpacpi probe and setup the serial devices even when thay have already been setup? Or this is something strange about the UART in this particular box?

FWIW, the serial console is plugged into a serial to USB converter (pl2303), my laptop has no serial ports. That should not make a difference, but just in case it does ...

Config extract:

X86_32=y
GENERIC_TIME=y
CLOCKSOURCE_WATCHDOG=y
GENERIC_CLOCKEVENTS=y GENERIC_CLOCKEVENTS_BROADCAST=y LOCKDEP_SUPPORT=y
STACKTRACE_SUPPORT=y
SEMAPHORE_SLEEPERS=y
X86=y
MMU=y
ZONE_DMA=y
GENERIC_ISA_DMA=y
GENERIC_IOMAP=y
GENERIC_BUG=y
GENERIC_HWEIGHT=y
ARCH_MAY_HAVE_PC_FDC=y
DMI=y DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" EXPERIMENTAL=y
LOCK_KERNEL=y
INIT_ENV_ARG_LIMIT=32 LOCALVERSION="-i386-kaos" LOCALVERSION_AUTO=y
SWAP=y
SYSVIPC=y
SYSVIPC_SYSCTL=y
POSIX_MQUEUE=y
IKCONFIG=y
IKCONFIG_PROC=y
SYSFS_DEPRECATED=y
CC_OPTIMIZE_FOR_SIZE=y
SYSCTL=y
EMBEDDED=y
SYSCTL_SYSCALL=y
KALLSYMS=y
KALLSYMS_ALL=y
HOTPLUG=y
PRINTK=y
BUG=y
ELF_CORE=y
BASE_FULL=y
FUTEX=y
EPOLL=y
SHMEM=y
SLAB=y
VM_EVENT_COUNTERS=y
RT_MUTEXES=y
BASE_SMALL=0
MODULES=y
MODULE_UNLOAD=y
KMOD=y
STOP_MACHINE=y
BLOCK=y
LBD=y
LSF=y
IOSCHED_NOOP=y
IOSCHED_AS=y
IOSCHED_DEADLINE=y
IOSCHED_CFQ=y
DEFAULT_DEADLINE=y DEFAULT_IOSCHED="deadline"
TICK_ONESHOT=y
HIGH_RES_TIMERS=y
SMP=y
X86_PC=y
MPENTIUM4=y
X86_CMPXCHG=y
X86_L1_CACHE_SHIFT=7 RWSEM_XCHGADD_ALGORITHM=y GENERIC_CALIBRATE_DELAY=y
X86_WP_WORKS_OK=y
X86_INVLPG=y
X86_BSWAP=y
X86_POPAD_OK=y
X86_CMPXCHG64=y
X86_GOOD_APIC=y
X86_INTEL_USERCOPY=y
X86_USE_PPRO_CHECKSUM=y
X86_TSC=y
HPET_TIMER=y
HPET_EMULATE_RTC=y
NR_CPUS=8
SCHED_SMT=y
PREEMPT_NONE=y
X86_LOCAL_APIC=y
X86_IO_APIC=y
X86_MCE=y
X86_MCE_NONFATAL=y
X86_MCE_P4THERMAL=y
MICROCODE=m
MICROCODE_OLD_INTERFACE=y
X86_MSR=m
X86_CPUID=m
HIGHMEM4G=y
VMSPLIT_3G=y
PAGE_OFFSET=0xC0000000
HIGHMEM=y
ARCH_FLATMEM_ENABLE=y ARCH_SPARSEMEM_ENABLE=y ARCH_SELECT_MEMORY_MODEL=y ARCH_POPULATES_NODE_MAP=y SELECT_MEMORY_MODEL=y
FLATMEM_MANUAL=y
FLATMEM=y
FLAT_NODE_MEM_MAP=y
SPARSEMEM_STATIC=y
SPLIT_PTLOCK_CPUS=4
ZONE_DMA_FLAG=1
MTRR=y
IRQBALANCE=y
HZ_250=y
HZ=250
PHYSICAL_START=0x100000 PHYSICAL_ALIGN=0x100000
COMPAT_VDSO=y
ARCH_ENABLE_MEMORY_HOTPLUG=y
PM=y
ACPI=y
ACPI_PROCFS=y
ACPI_BUTTON=m
ACPI_FAN=m
ACPI_PROCESSOR=m
ACPI_BLACKLIST_YEAR=0
ACPI_EC=y
ACPI_POWER=y
ACPI_SYSTEM=y
PCI=y
PCI_GOANY=y
PCI_BIOS=y
PCI_DIRECT=y
PCI_MMCONFIG=y
PCIEPORTBUS=y
PCIEAER=y
PCI_MSI=y
HT_IRQ=y
ISA_DMA_API=y
BINFMT_ELF=y
BINFMT_MISC=m
NET=y
PACKET=y
PACKET_MMAP=y
UNIX=y
XFRM=y
INET=y
IP_MULTICAST=y
IP_ADVANCED_ROUTER=y
ASK_IP_FIB_HASH=y
IP_FIB_HASH=y
IP_ROUTE_MULTIPATH=y
IP_ROUTE_VERBOSE=y
SYN_COOKIES=y
INET_XFRM_MODE_BEET=y
INET_DIAG=y
INET_TCP_DIAG=y
TCP_CONG_CUBIC=y
DEFAULT_TCP_CONG="cubic"
NETFILTER=y
NETFILTER_NETLINK=m
NETFILTER_NETLINK_LOG=m
NETFILTER_XTABLES=y NETFILTER_XT_TARGET_CLASSIFY=m NETFILTER_XT_TARGET_MARK=m NETFILTER_XT_MATCH_COMMENT=m NETFILTER_XT_MATCH_DCCP=m NETFILTER_XT_MATCH_ESP=m NETFILTER_XT_MATCH_LENGTH=m NETFILTER_XT_MATCH_LIMIT=m NETFILTER_XT_MATCH_MAC=m NETFILTER_XT_MATCH_MARK=m NETFILTER_XT_MATCH_MULTIPORT=m NETFILTER_XT_MATCH_PKTTYPE=m NETFILTER_XT_MATCH_QUOTA=m NETFILTER_XT_MATCH_REALM=m NETFILTER_XT_MATCH_SCTP=m NETFILTER_XT_MATCH_STATISTIC=m NETFILTER_XT_MATCH_TCPMSS=m
IP_NF_IPTABLES=y
IP_NF_MATCH_IPRANGE=m
IP_NF_MATCH_TOS=m
IP_NF_MATCH_RECENT=m
IP_NF_MATCH_ECN=m
IP_NF_MATCH_AH=m
IP_NF_MATCH_TTL=m
IP_NF_MATCH_OWNER=m
IP_NF_MATCH_ADDRTYPE=m
IP_NF_FILTER=y
IP_NF_TARGET_REJECT=y
IP_NF_TARGET_ULOG=y
VLAN_8021Q=y
NET_CLS_ROUTE=y
STANDALONE=y
PREVENT_FIRMWARE_BUILD=y
FW_LOADER=m
CONNECTOR=m
PNP=y
PNP_DEBUG=y
PNPACPI=y
BLK_DEV_FD=m
BLK_DEV_LOOP=m
IDE=m
IDE_MAX_HWIFS=4
BLK_DEV_IDE=m
BLK_DEV_IDEDISK=m
IDEDISK_MULTI_MODE=y
BLK_DEV_IDECD=m
IDE_TASK_IOCTL=y
BLK_DEV_IDEPCI=y
IDEPCI_SHARE_IRQ=y
BLK_DEV_IDEDMA_PCI=y
IDEDMA_PCI_AUTO=y
BLK_DEV_PIIX=m
BLK_DEV_IDEDMA=y
IDEDMA_AUTO=y
RAID_ATTRS=m
SCSI=y
SCSI_PROC_FS=y
BLK_DEV_SD=y
CHR_DEV_SG=y
SCSI_CONSTANTS=y
SCSI_SPI_ATTRS=y
SCSI_3W_9XXX=y
SCSI_SYM53C8XX_2=y SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 SCSI_SYM53C8XX_DEFAULT_TAGS=16 SCSI_SYM53C8XX_MAX_TAGS=64 SCSI_SYM53C8XX_MMIO=y
ATA=y
ATA_PIIX=y
SATA_ACPI=y
MD=y
BLK_DEV_MD=y
MD_RAID1=y
BLK_DEV_DM=y
DM_SNAPSHOT=y
DM_MIRROR=y
NETDEVICES=y
DUMMY=m
BONDING=m
E1000=y
E1000_NAPI=y
SKY2=m
NETCONSOLE=m
NETPOLL=y
NET_POLL_CONTROLLER=y
INPUT=y
INPUT_KEYBOARD=y
KEYBOARD_ATKBD=y
SERIO=y
SERIO_I8042=y
SERIO_LIBPS2=y
SERIO_RAW=m
VT=y
VT_CONSOLE=y
HW_CONSOLE=y
SERIAL_8250=y
SERIAL_8250_CONSOLE=y
SERIAL_8250_PCI=m
SERIAL_8250_PNP=y
SERIAL_8250_NR_UARTS=4 SERIAL_8250_RUNTIME_UARTS=4
SERIAL_CORE=y
SERIAL_CORE_CONSOLE=y
UNIX98_PTYS=y
IPMI_HANDLER=y
IPMI_PANIC_EVENT=y
IPMI_DEVICE_INTERFACE=y
IPMI_SI=y
IPMI_WATCHDOG=y
IPMI_POWEROFF=m
WATCHDOG=y
SOFT_WATCHDOG=m
I8XX_TCO=y
NVRAM=m
RTC=y
HPET=y
HPET_MMAP=y
I2C=y
I2C_CHARDEV=m
I2C_ALGOBIT=m
I2C_I801=y
SENSORS_EEPROM=m
HWMON=y
VGA_CONSOLE=y
DUMMY_CONSOLE=y
HID=y
USB_ARCH_HAS_HCD=y
USB_ARCH_HAS_OHCI=y
USB_ARCH_HAS_EHCI=y
USB=y
USB_DEVICEFS=y
USB_EHCI_HCD=y
USB_STORAGE=m
USB_HID=y
USB_MON=y
USB_SERIAL=m
USB_SERIAL_GENERIC=y
USB_SERIAL_PL2303=m
EDAC=y
EDAC_MM_EDAC=y
EDAC_E752X=y
EDAC_POLL=y
EXT2_FS=m
EXT3_FS=y
JBD=y
XFS_FS=y
INOTIFY=y
INOTIFY_USER=y
ISO9660_FS=m
JOLIET=y
UDF_FS=m
UDF_NLS=y
FAT_FS=m
MSDOS_FS=m
VFAT_FS=m
FAT_DEFAULT_CODEPAGE=850 FAT_DEFAULT_IOCHARSET="iso8859-1"
PROC_FS=y
PROC_KCORE=y
PROC_SYSCTL=y
SYSFS=y
TMPFS=y
RAMFS=y
NFS_FS=y
NFS_V3=y
NFSD=y
NFSD_V3=y
LOCKD=y
LOCKD_V4=y
EXPORTFS=y
NFS_COMMON=y
SUNRPC=y
MSDOS_PARTITION=y
NLS=m
NLS_DEFAULT="iso8859-15"
NLS_CODEPAGE_437=m
NLS_CODEPAGE_850=m
NLS_CODEPAGE_865=m
NLS_ASCII=m
NLS_ISO8859_1=m
NLS_ISO8859_15=m
NLS_UTF8=m
TRACE_IRQFLAGS_SUPPORT=y
ENABLE_MUST_CHECK=y
MAGIC_SYSRQ=y
DEBUG_KERNEL=y
LOG_BUF_SHIFT=16
DETECT_SOFTLOCKUP=y
DEBUG_SPINLOCK=y
DEBUG_MUTEXES=y
DEBUG_BUGVERBOSE=y
FORCED_INLINING=y
DEBUG_STACKOVERFLOW=y
DEBUG_RODATA=y
X86_FIND_SMP_CONFIG=y
X86_MPPARSE=y
DOUBLEFAULT=y
KDB=y
KDB_MODULES=y
KDB_CONTINUE_CATASTROPHIC=0
BITREVERSE=y
CRC32=y
PLIST=y
HAS_IOMEM=y
HAS_IOPORT=y
GENERIC_HARDIRQS=y
GENERIC_IRQ_PROBE=y
GENERIC_PENDING_IRQ=y
X86_SMP=y
X86_HT=y
X86_BIOS_REBOOT=y
X86_TRAMPOLINE=y
KTIME_SCALAR=y

------- End of Blind-Carbon-Copy

#1 lore raw
Quoted 3 lines · Keith Owens

Should pnpacpi probe and setup the serial devices even when thay have already been setup? Or this is something strange about the UART in this particular box?

Yes, so it can be associated with the correct device.

No idea why it's affecting your serial console though - the autoconfig should be transparent once it's completed. Sure, if you enable serial debugging (thereby making it produce output during the autoconfig) it will mess it up, but that's the standard gun and foot scenario.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#2 lore raw
In reply to Keith Owens
Quoted 3 lines · Keith Owens

Booting with 'console=tty console=ttyS0,9600'. The serial console on ttyS0 (0x3f8, irq 4) is probed twice, once from serial8250_init() and again from serial_pnp_probe().

I played with this last summer, but was too timid to finish it and post it. My plan was to remove the legacy SERIAL_PORT_DFNS, make platform devices for them, and only register the platform devices in the absence of PNP.

My motivation at the time was to prevent 8250 from claiming IRDA devices that happened to live at legacy UART addresses. I also wanted to make IRDA (smsc-ircc2 in my case) smart enough to use PNP to locate its devices, since 8250 would no longer claim them.

Here's the dusty patch (against 2.6.18-rc1-mm2). If it seems like a reasonable thing to do, I can update it, polish it up, add a changelog, and post it.

drivers/serial/8250_x86.c new file +67 -0
Index: work-mm2/drivers/serial/8250_x86.c
===================================================================
@@ -0,0 +1,67 @@
+/*
+ * Legacy COM port devices for x86 platforms without PNPBIOS or ACPI.
+ * Data taken from include/asm-i386/serial.h.
+ *
+ * (c) Copyright 2006 Hewlett-Packard Development Company, L.P.
+ *	Bjorn Helgaas <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/pnp.h>
+#include <linux/serial_8250.h>
+
+/* Standard COM flags (except for COM4, because of the 8514 problem) */
+#ifdef CONFIG_SERIAL_DETECT_IRQ
+#define COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ)
+#define COM4_FLAGS (UPF_BOOT_AUTOCONF | UPF_AUTO_IRQ)
+#else
+#define COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST)
+#define COM4_FLAGS UPF_BOOT_AUTOCONF
+#endif
+
+#define PORT(_base,_irq,_flags)				\
+	{						\
+		.iobase		= _base,		\
+		.irq		= _irq,			\
+		.uartclk	= 1843200,		\
+		.iotype		= UPIO_PORT,		\
+		.flags		= _flags,		\
+	}
+
+static struct plat_serial8250_port x86_com_data[] = {
+	PORT(0x3F8, 4, COM_FLAGS),
+	PORT(0x2F8, 3, COM_FLAGS),
+	PORT(0x3E8, 4, COM_FLAGS),
+	PORT(0x2E8, 3, COM4_FLAGS),
+	{ },
+};
+
+static struct platform_device x86_com_device = {
+	.name			= "serial8250",
+	.id			= PLAT8250_DEV_X86,
+	.dev			= {
+		.platform_data	= x86_com_data,
+	},
+};
+
+static int __init serial8250_x86_com_init(void)
+{
+#ifdef CONFIG_SERIAL_8250_PNP
+	extern int serial8250_nopnp;
+
+	if (pnp_platform_devices && !serial8250_nopnp)
+		return 0;
+#endif
+
+	return platform_device_register(&x86_com_device);
+}
+
+module_init(serial8250_x86_com_init);
+
+MODULE_AUTHOR("Bjorn Helgaas");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Generic 8250/16x50 legacy probe module");
drivers/serial/Makefile +1 -0
Index: work-mm2/drivers/serial/Makefile
===================================================================
@@ -7,6 +7,7 @@
 obj-$(CONFIG_SERIAL_CORE) += serial_core.o
 obj-$(CONFIG_SERIAL_21285) += 21285.o
 obj-$(CONFIG_SERIAL_8250) += 8250.o
+obj-$(CONFIG_SERIAL_8250_X86) += 8250_x86.o
 obj-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.o
 obj-$(CONFIG_SERIAL_8250_GSC) += 8250_gsc.o
 obj-$(CONFIG_SERIAL_8250_PCI) += 8250_pci.o
include/linux/serial_8250.h +1 -0
Index: work-mm2/include/linux/serial_8250.h
===================================================================
@@ -44,6 +44,7 @@
 	PLAT8250_DEV_HUB6,
 	PLAT8250_DEV_MCA,
 	PLAT8250_DEV_AU1X00,
+	PLAT8250_DEV_X86,
 };
 
 /*
include/asm-i386/serial.h +0 -16
Index: work-mm2/include/asm-i386/serial.h
===================================================================
@@ -11,19 +11,3 @@
  * megabits/second; but this requires the faster clock.
  */
 #define BASE_BAUD ( 1843200 / 16 )
-
-/* Standard COM flags (except for COM4, because of the 8514 problem) */
-#ifdef CONFIG_SERIAL_DETECT_IRQ
-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
-#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
-#else
-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
-#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
-#endif
-
-#define SERIAL_PORT_DFNS			\
-	/* UART CLK   PORT IRQ     FLAGS        */			\
-	{ 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS },	/* ttyS0 */	\
-	{ 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS },	/* ttyS1 */	\
-	{ 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS },	/* ttyS2 */	\
-	{ 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS },	/* ttyS3 */
drivers/serial/Kconfig +25 -5
Index: work-mm2/drivers/serial/Kconfig
===================================================================
@@ -63,6 +63,22 @@
 
 	  If unsure, say N.
 
+config SERIAL_8250_X86
+	tristate "8250/16550 legacy COM port support" if EMBEDDED
+	depends on SERIAL_8250 && X86
+	default SERIAL_8250
+	help
+	  Say Y here if you have legacy COM ports and PNP is disabled
+	  or not available.
+
+	  This driver is for the legacy COM1, COM2, COM3, and COM4 ports at
+	  I/O ports 0x3f8, 0x2f8, 0x3e8, and 0x2e8.  On machines newer than
+	  1995 or so, these ports are described by PNPBIOS or ACPI, and
+	  8250_pnp should be used instead of this driver.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called 8250_x86.
+
 config SERIAL_8250_GSC
 	tristate
 	depends on SERIAL_8250 && GSC
@@ -73,17 +89,21 @@
 	depends on SERIAL_8250 && PCI
 	default SERIAL_8250
 	help
-	  This builds standard PCI serial support. You may be able to
-	  disable this feature if you only need legacy serial support.
-	  Saves about 9K.
+	  Say Y here if you have PCI serial ports.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called 8250_pci.
 
 config SERIAL_8250_PNP
 	tristate "8250/16550 PNP device support" if EMBEDDED
 	depends on SERIAL_8250 && PNP
 	default SERIAL_8250
 	help
-	  This builds standard PNP serial support. You may be able to
-	  disable this feature if you only need legacy serial support.
+	  Say Y here if you have serial ports described by PNPBIOS or ACPI.
+	  These are typically ports built into the system board.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called 8250_pnp.
 
 config SERIAL_8250_HP300
 	tristate
include/asm-x86_64/serial.h +0 -16
Index: work-mm2/include/asm-x86_64/serial.h
===================================================================
@@ -11,19 +11,3 @@
  * megabits/second; but this requires the faster clock.
  */
 #define BASE_BAUD ( 1843200 / 16 )
-
-/* Standard COM flags (except for COM4, because of the 8514 problem) */
-#ifdef CONFIG_SERIAL_DETECT_IRQ
-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
-#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
-#else
-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
-#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
-#endif
-
-#define SERIAL_PORT_DFNS			\
-	/* UART CLK   PORT IRQ     FLAGS        */			\
-	{ 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS },	/* ttyS0 */	\
-	{ 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS },	/* ttyS1 */	\
-	{ 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS },	/* ttyS2 */	\
-	{ 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS },	/* ttyS3 */
drivers/serial/8250_pnp.c +9 -0
Index: work-mm2/drivers/serial/8250_pnp.c
===================================================================
@@ -458,8 +458,17 @@
 	.remove		= __devexit_p(serial_pnp_remove),
 };
 
+int serial8250_nopnp;
+module_param_named(nopnp, serial8250_nopnp, bool, 0);
+MODULE_PARM_DESC(nopnp, "Do not use PNP to detect serial ports");
+
 static int __init serial8250_pnp_init(void)
 {
+	if (serial8250_nopnp) {
+		printk("skipping 8250_pnp registration\n");
+		return 0;
+	}
+
 	return pnp_register_driver(&serial_pnp_driver);
 }
 
#3 lore raw

include/linux/serial_8250.h line 47

Quoted 9 lines · Bjorn Helgaas

Index: work-mm2/include/linux/serial_8250.h
===================================================================

include/linux/serial_8250.h +1 -0
@@ -44,6 +44,7 @@
 	PLAT8250_DEV_HUB6,
 	PLAT8250_DEV_MCA,
 	PLAT8250_DEV_AU1X00,
+	PLAT8250_DEV_X86,

There's no need for PLAT8250_DEV_X86 if x86 went to the model that ARM and all the others which I did convert use - iow, PLAT8250_DEV_PLATFORM and friends.

They're there so that the arch/* code can provide their serial port information to the 8250 driver instead of using include/asm-*/serial.h

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#4 lore raw
In reply to Bjorn Helgaas
Quoted 10 lines · Bjorn Helgaas
Quoted 3 lines · Keith Owens

Booting with 'console=tty console=ttyS0,9600'. The serial console on ttyS0 (0x3f8, irq 4) is probed twice, once from serial8250_init() and again from serial_pnp_probe().

I played with this last summer, but was too timid to finish it and post it. My plan was to remove the legacy SERIAL_PORT_DFNS, make platform devices for them, and only register the platform devices in the absence of PNP.

Quoted 8 lines

My motivation at the time was to prevent 8250 from claiming IRDA devices that happened to live at legacy UART addresses. I also wanted to make IRDA (smsc-ircc2 in my case) smart enough to use PNP to locate its devices, since 8250 would no longer claim them.

Here's the dusty patch (against 2.6.18-rc1-mm2). If it seems like a reasonable thing to do, I can update it, polish it up, add a changelog, and post it.

Keith, does this patch help? Russell didn't complain about it, so if it fixes your problem, maybe we could put it in -mm and see if it breaks anything else.

Bjorn

#5 lore raw
Quoted 16 lines · Bjorn Helgaas
Quoted 15 lines · Bjorn Helgaas
Quoted 3 lines · Keith Owens

Booting with 'console=tty console=ttyS0,9600'. The serial console on ttyS0 (0x3f8, irq 4) is probed twice, once from serial8250_init() and again from serial_pnp_probe().

I played with this last summer, but was too timid to finish it and post it. My plan was to remove the legacy SERIAL_PORT_DFNS, make platform devices for them, and only register the platform devices in the absence of PNP.

My motivation at the time was to prevent 8250 from claiming IRDA devices that happened to live at legacy UART addresses. I also wanted to make IRDA (smsc-ircc2 in my case) smart enough to use PNP to locate its devices, since 8250 would no longer claim them.

Quoted 7 lines
Quoted 3 lines

Here's the dusty patch (against 2.6.18-rc1-mm2). If it seems like a reasonable thing to do, I can update it, polish it up, add a changelog, and post it.

Keith, does this patch help? Russell didn't complain about it, so if it fixes your problem, maybe we could put it in -mm and see if it breaks anything else.

Yes I did.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#6 lore raw
Quoted 21 lines · Russell King
Quoted 20 lines · Bjorn Helgaas
Quoted 18 lines · Bjorn Helgaas
Quoted 3 lines · Keith Owens

Booting with 'console=tty console=ttyS0,9600'. The serial console on ttyS0 (0x3f8, irq 4) is probed twice, once from serial8250_init() and again from serial_pnp_probe().

I played with this last summer, but was too timid to finish it and post it. My plan was to remove the legacy SERIAL_PORT_DFNS, make platform devices for them, and only register the platform devices in the absence of PNP.

My motivation at the time was to prevent 8250 from claiming IRDA devices that happened to live at legacy UART addresses. I also wanted to make IRDA (smsc-ircc2 in my case) smart enough to use PNP to locate its devices, since 8250 would no longer claim them.

Here's the dusty patch (against 2.6.18-rc1-mm2). If it seems like a reasonable thing to do, I can update it, polish it up, add a changelog, and post it.

Quoted 5 lines
Quoted 3 lines

Keith, does this patch help? Russell didn't complain about it, so if it fixes your problem, maybe we could put it in -mm and see if it breaks anything else.

Yes I did.

Sorry. What I should have said was "Russell gave constructive feedback for a minor improvement, but didn't complain about the overall approach of converting to platform devices, so if the patch solves your (Keith's) problem, I'll incorporate Russell's feedback and send an updated patch to Andrew."

Bjorn

#7 lore raw
Quoted 26 lines · Bjorn Helgaas
Quoted 25 lines · Russell King
Quoted 23 lines · Bjorn Helgaas
Quoted 10 lines · Bjorn Helgaas
Quoted 3 lines · Keith Owens

Booting with 'console=tty console=ttyS0,9600'. The serial console on ttyS0 (0x3f8, irq 4) is probed twice, once from serial8250_init() and again from serial_pnp_probe().

I played with this last summer, but was too timid to finish it and post it. My plan was to remove the legacy SERIAL_PORT_DFNS, make platform devices for them, and only register the platform devices in the absence of PNP.

Quoted 8 lines

My motivation at the time was to prevent 8250 from claiming IRDA devices that happened to live at legacy UART addresses. I also wanted to make IRDA (smsc-ircc2 in my case) smart enough to use PNP to locate its devices, since 8250 would no longer claim them.

Here's the dusty patch (against 2.6.18-rc1-mm2). If it seems like a reasonable thing to do, I can update it, polish it up, add a changelog, and post it.

Keith, does this patch help? Russell didn't complain about it, so if it fixes your problem, maybe we could put it in -mm and see if it breaks anything else.

Quoted 7 lines
Quoted 1 line

Yes I did.

Sorry. What I should have said was "Russell gave constructive feedback for a minor improvement, but didn't complain about the overall approach of converting to platform devices, so if the patch solves your (Keith's) problem, I'll incorporate Russell's feedback and send an updated patch to Andrew."

I did also point out that the autoconfig should be transparent, and if it isn't there's probably a bug in there somewhere.

So I partly view this patch as a papering over of the real problem, but for other reasons it's more or less the right direction for stuff to go. Except that the x86 definitions should be in arch/i386 rather than drivers/serial, like the other architectures which have been converted to this model already do.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#8 lore raw
In reply to Bjorn Helgaas
Quoted 16 lines · Bjorn Helgaas (on Wed, 21 Mar 2007 10:35:38 -0600) wrote:
Quoted 15 lines · Bjorn Helgaas
Quoted 3 lines · Keith Owens

Booting with 'console=tty console=ttyS0,9600'. The serial console on ttyS0 (0x3f8, irq 4) is probed twice, once from serial8250_init() and again from serial_pnp_probe().

I played with this last summer, but was too timid to finish it and post it. My plan was to remove the legacy SERIAL_PORT_DFNS, make platform devices for them, and only register the platform devices in the absence of PNP.

My motivation at the time was to prevent 8250 from claiming IRDA devices that happened to live at legacy UART addresses. I also wanted to make IRDA (smsc-ircc2 in my case) smart enough to use PNP to locate its devices, since 8250 would no longer claim them.

Quoted 7 lines
Quoted 3 lines

Here's the dusty patch (against 2.6.18-rc1-mm2). If it seems like a reasonable thing to do, I can update it, polish it up, add a changelog, and post it.

Keith, does this patch help? Russell didn't complain about it, so if it fixes your problem, maybe we could put it in -mm and see if it breaks anything else.

The aim of the patch looks sensible, but it will not compile for 2.6.21-rc4. 8250_x86.c tests pnp_platform_devices, which does not exist. Also the combination of CONFIG_SERIAL_8250_X86=y and CONFIG_SERIAL_8250_PNP=m would result in 8250_x86.o being built into vmlinux but referring to serial8250_nopnp in module 8250_pnp.o, kernel to module references are tricky.

#9 lore raw
Quoted 6 lines · Keith Owens

The aim of the patch looks sensible, but it will not compile for 2.6.21-rc4. 8250_x86.c tests pnp_platform_devices, which does not exist. Also the combination of CONFIG_SERIAL_8250_X86=y and CONFIG_SERIAL_8250_PNP=m would result in 8250_x86.o being built into vmlinux but referring to serial8250_nopnp in module 8250_pnp.o, kernel to module references are tricky.

OK, I'll rework it and update it. It will probably take me a couple weeks though.

#10 lore raw
In reply to Keith Owens
Quoted 6 lines · Keith Owens

The aim of the patch looks sensible, but it will not compile for 2.6.21-rc4. 8250_x86.c tests pnp_platform_devices, which does not exist. Also the combination of CONFIG_SERIAL_8250_X86=y and CONFIG_SERIAL_8250_PNP=m would result in 8250_x86.o being built into vmlinux but referring to serial8250_nopnp in module 8250_pnp.o, kernel to module references are tricky.

I posted an updated series of patches a couple days ago:
http://lkml.org/lkml/2007/4/4/540

Let me know whether they work for you.

Bjorn