Linux

核心參數“console”和“earlycon”指的是舊硬體?

  • December 2, 2019

我首先通過調查參數發現了這一點,earlycon但發現選項console看起來幾乎相同。兩者都在下面,並取自以下來源:

從文件中console我們有:

console=    [KNL] Output console device and options.

   tty<n>  Use the virtual console device <n>.

   ttyS<n>[,options]
   ttyUSB0[,options]
       Use the specified serial port.  The options are of
       the form "bbbbpnf", where "bbbb" is the baud rate,
       "p" is parity ("n", "o", or "e"), "n" is number of
       bits, and "f" is flow control ("r" for RTS or
       omit it).  Default is "9600n8".

       See Documentation/serial-console.txt for more
       information.  See
       Documentation/networking/netconsole.txt for an
       alternative.

   uart[8250],io,<addr>[,options]
   uart[8250],mmio,<addr>[,options]
   uart[8250],mmio16,<addr>[,options]
   uart[8250],mmio32,<addr>[,options]
   uart[8250],0x<addr>[,options]
       Start an early, polled-mode console on the 8250/16550
       UART at the specified I/O port or MMIO address,
       switching to the matching ttyS device later.
       MMIO inter-register address stride is either 8-bit
       (mmio), 16-bit (mmio16), or 32-bit (mmio32).
       If none of [io|mmio|mmio16|mmio32], <addr> is assumed
       to be equivalent to 'mmio'. 'options' are specified in
       the same format described for ttyS above; if unspecified,
       the h/w is not re-initialized.

   hvc<n>  Use the hypervisor console device <n>. This is for
       both Xen and PowerPC hypervisors.

           If the device connected to the port is not a TTY but a braille
           device, prepend "brl," before the device type, for instance
       console=brl,ttyS0
   For now, only VisioBraille is supported.

從文件中earlycon我們有:

earlycon=   [KNL] Output early console device and options.

       When used with no options, the early console is
       determined by the stdout-path property in device
       tree's chosen node.

   cdns,<addr>
       Start an early, polled-mode console on a cadence serial
       port at the specified address. The cadence serial port
       must already be setup and configured. Options are not
       yet supported.

   uart[8250],io,<addr>[,options]
   uart[8250],mmio,<addr>[,options]
   uart[8250],mmio32,<addr>[,options]
   uart[8250],mmio32be,<addr>[,options]
   uart[8250],0x<addr>[,options]
       Start an early, polled-mode console on the 8250/16550
       UART at the specified I/O port or MMIO address.
       MMIO inter-register address stride is either 8-bit
       (mmio) or 32-bit (mmio32 or mmio32be).
       If none of [io|mmio|mmio32|mmio32be], <addr> is assumed
       to be equivalent to 'mmio'. 'options' are specified
       in the same format described for "console=ttyS<n>"; if
       unspecified, the h/w is not initialized.

   pl011,<addr>
   pl011,mmio32,<addr>
       Start an early, polled-mode console on a pl011 serial
       port at the specified address. The pl011 serial port
       must already be setup and configured. Options are not
       yet supported.  If 'mmio32' is specified, then only
       the driver will use only 32-bit accessors to read/write
       the device registers.

   meson,<addr>
       Start an early, polled-mode console on a meson serial
       port at the specified address. The serial port must
       already be setup and configured. Options are not yet
       supported.

   msm_serial,<addr>
       Start an early, polled-mode console on an msm serial
       port at the specified address. The serial port
       must already be setup and configured. Options are not
       yet supported.

   msm_serial_dm,<addr>
       Start an early, polled-mode console on an msm serial
       dm port at the specified address. The serial port
       must already be setup and configured. Options are not
       yet supported.

   smh Use ARM semihosting calls for early console.

   s3c2410,<addr>
   s3c2412,<addr>
   s3c2440,<addr>
   s3c6400,<addr>
   s5pv210,<addr>
   exynos4210,<addr>
       Use early console provided by serial driver available
       on Samsung SoCs, requires selecting proper type and
       a correct base address of the selected UART port. The
       serial port must already be setup and configured.
       Options are not yet supported.

   lpuart,<addr>
   lpuart32,<addr>
       Use early console provided by Freescale LP UART driver
       found on Freescale Vybrid and QorIQ LS1021A processors.
       A valid base address must be provided, and the serial
       port must already be setup and configured.

   armada3700_uart,<addr>
       Start an early, polled-mode console on the
       Armada 3700 serial port at the specified
       address. The serial port must already be setup
       and configured. Options are not yet supported.

使用範例如下:

earlycon=uart8250,0x21c0500

我的問題是:

  • 為什麼會提到8250/16550物理硬體?這個舊的實現是否已經成型為現代設計的介面規範?也就是說,當這些通信設備位於 SoC 外部時,我們是否仍在使用兼容的 UART 驅動程序?
  • 如果 MMIO 是Memory Mapped IO,那麼在這種情況下,“正常” IO 指的是什麼?
  • 參數是什麼<addr>?這是您執行此核心的特定 SoC 的 UART 配置寄存器的開始嗎?大多數 UART 配置寄存器是否符合特定的寄存器佈局,以便通用 UART 驅動程序可以適當地配置硬體?

我確信有人仍在這樣做,但早在 ILO/DRAC/等之前的日子。變得便宜且無處不在,在緊急情況或 oops 的情況下獲得“帶外”訪問控制台的最佳方式是通過串列埠。您將在機架中安裝終端伺服器,然後將電纜連接到伺服器的串列埠。一些 BIOS 支持控制台重定向到串列埠(例如 1999+ 時間範圍內的 VA Linux 和 SuperMicro 伺服器)。

8250/16550 UARTS是當時最流行的一些串口晶片,這意味著它們在Linux下將是最好的支持,並且它們都使用8250核心驅動程序(該系列中的更多型號都使用了同一個司機)。

我懷疑許多打算由 linux 使用的 SoC 設計都在其中內置了 8250/16550 兼容的 UART,因為它是一個簡單的按鈕——有據可查且經過良好測試的驅動程序。儘管希望他們建構了後來的多字節緩衝區版本(當然,即使按照今天的標準,即使是“慢速”處理器也可以比 115k 串列埠接收到的串列中斷更頻繁地提供服務)。IIRC Mac 有一個用於本地/Apple Talk 的串列埠(不記得哪個是協議,哪個是硬體),它執行 248k。不過,那是在 CPU 達到 60Mhz 的時候。

這可能是 MMIO 和埠 I/O 之間區別的最佳答案:https ://en.wikipedia.org/wiki/Memory-mapped_I/O我不太了解該級別,無法將其歸結為。

上面的連結可能會回答這些目的是什麼,但基本上它是一個記憶體地址。

引用自:https://unix.stackexchange.com/questions/292661