xref: /haiku/docs/develop/kernel/pci_serial_debug.rst (revision 3d4afef9cba2f328e238089d4609d00d4b1524f3)
1Using PCI serial ports for debugging
2====================================
3
4Modern systems usually don't come with a built-in serial port anymore. This
5is unconvenient for low level debugging, since the serial port allows access
6to early boot log as well as kernel debugger, even when the display or keyboard
7are not working.
8
9It is fortunately possible to add a serial port over the PCI bus on machines
10which have appropriate expansion ports. This can be done using expresscard,
11mini-PCI, or PCI express ports.
12
13Devices known to work
14---------------------
15
16Dexlan XMT01A (https://www.accessoires-informatiques.com/Prix/EXPRESSCARD-PCIE-POUR-PORTABLE-23842.html)
17	Uses MOSCHIP 9922 controller
18
19Devices to be tested
20--------------------
21
22https://smile.amazon.com/Industrial-Desktop-Bracket-Moschip-MCS9922/dp/B003D3MFHM/
23
24Configuring
25-----------
26
27- Install the card in your computer
28- Boot Haiku and look in the syslog for the PCI bus scan for the device:
29
30.. code-block:: text
31
32    KERN: PCI: [dom 0, bus  5] bus   5, device  0, function  0: vendor 9710, device 9922, revision 00
33    KERN: PCI:   class_base 07, class_function 00, class_api 02
34    KERN: PCI:   vendor 9710: MosChip Semiconductor Technology Ltd.
35    KERN: PCI:   device 9922: MCS9922 PCIe Multi-I/O Controller
36    KERN: PCI:   info: Communication controller (Serial controller, 16550)
37    KERN: PCI:   line_size 10, latency 00, header_type 80, BIST 00
38    KERN: PCI:   ROM base host 00000000, pci 00000000, size 00000000
39    KERN: PCI:   cardbus_CIS 00000000, subsystem_id 1000, subsystem_vendor_id a000
40    KERN: PCI:   interrupt_line 0b, interrupt_pin 01, min_grant 00, max_latency 00
41    KERN: PCI:   base reg 0: host 00004000, pci 0000KERN: 4000, size 00000008, flags 01
42    KERN: PCI:   base reg 1: host f1c01000, pci f1c01000, size 00001000, flags 00
43    KERN: PCI:   base reg 2: host 00000000, pci 00000000, size 00000000, flags 00
44    KERN: PCI:   base reg 3: host 00000000, pci 00000000, size 00000000, flags 00
45    KERN: PCI:   base reg 4: host 00000000, pci 00000000, size 00000000, flags 00
46    KERN: PCI:   base reg 5: host f1c00000, pci f1c00000, size 00001000, flags 00
47    KERN: PCI:   Capabilities: MSI, PM, PCIe
48    KERN: PCI:   Extended capabilities: Virtual Channel, Advanced Error Reporting
49
50
51Write down the address of "base reg 0", this is where the serial port registers
52are mapped (it is probably possible to get this information from lspci on Linux
53as well?)
54
55Configure serial debug in config/settings/kernel/drivers/kernel:
56
57.. code-block:: text
58
59    serial_debug_output true
60    serial_debug_speed 115200
61    serial_debug_port 0x4000
62
63Now your kernel is configured to send its output to the serial port. You can
64connect another machine to it (using an USB to serial adapter and a NULL modem
65cable, for example) and use SerialConnect or a similar tool to see the output
66and access the KDL prompt.
67
68Happy debugging!
69