haiku/docs/develop/kernel/pci_serial_debug.rst
Adrien Destugues a5061ecec5 Generate developer docs with Sphinx
An effort was started some time ago to consolidate all internal
documentation in the git tree. However, this was just an accumulation of
files in various formats without any strucutre or way to browse it,
which results in no one even knowing that we have docs here.

This converts most of the files to restructuredtext and uses Sphinx to
generate an HTML browsable user manual (with a table of content and a
first attempt to put things in a global hierarchy).

There are almost no changes to the documentation content in this commit
(some obviously obsolete things were removed). The plan is to get the
toolchain up and running to make these docs easily available, and only
then see about improving the content. We can migrate some things off the
wiki and website, and rework the table of contents to have some more
hierarchy levels because currently it's a bit messy.

Change-Id: I924ac9dc6e753887ab56f18a09bdb0a1e1793bfd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4370
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
2021-08-27 11:41:17 +00:00

69 lines
2.8 KiB
ReStructuredText

Using PCI serial ports for debugging
====================================
Modern systems usually don't come with a built-in serial port anymore. This
is unconvenient for low level debugging, since the serial port allows access
to early boot log as well as kernel debugger, even when the display or keyboard
are not working.
It is fortunately possible to add a serial port over the PCI bus on machines
which have appropriate expansion ports. This can be done using expresscard,
mini-PCI, or PCI express ports.
Devices known to work
---------------------
Dexlan XMT01A (https://www.accessoires-informatiques.com/Prix/EXPRESSCARD-PCIE-POUR-PORTABLE-23842.html)
Uses MOSCHIP 9922 controller
Devices to be tested
--------------------
https://smile.amazon.com/Industrial-Desktop-Bracket-Moschip-MCS9922/dp/B003D3MFHM/
Configuring
-----------
- Install the card in your computer
- Boot Haiku and look in the syslog for the PCI bus scan for the device:
.. code-block:: text
KERN: PCI: [dom 0, bus 5] bus 5, device 0, function 0: vendor 9710, device 9922, revision 00
KERN: PCI: class_base 07, class_function 00, class_api 02
KERN: PCI: vendor 9710: MosChip Semiconductor Technology Ltd.
KERN: PCI: device 9922: MCS9922 PCIe Multi-I/O Controller
KERN: PCI: info: Communication controller (Serial controller, 16550)
KERN: PCI: line_size 10, latency 00, header_type 80, BIST 00
KERN: PCI: ROM base host 00000000, pci 00000000, size 00000000
KERN: PCI: cardbus_CIS 00000000, subsystem_id 1000, subsystem_vendor_id a000
KERN: PCI: interrupt_line 0b, interrupt_pin 01, min_grant 00, max_latency 00
KERN: PCI: base reg 0: host 00004000, pci 0000KERN: 4000, size 00000008, flags 01
KERN: PCI: base reg 1: host f1c01000, pci f1c01000, size 00001000, flags 00
KERN: PCI: base reg 2: host 00000000, pci 00000000, size 00000000, flags 00
KERN: PCI: base reg 3: host 00000000, pci 00000000, size 00000000, flags 00
KERN: PCI: base reg 4: host 00000000, pci 00000000, size 00000000, flags 00
KERN: PCI: base reg 5: host f1c00000, pci f1c00000, size 00001000, flags 00
KERN: PCI: Capabilities: MSI, PM, PCIe
KERN: PCI: Extended capabilities: Virtual Channel, Advanced Error Reporting
Write down the address of "base reg 0", this is where the serial port registers
are mapped (it is probably possible to get this information from lspci on Linux
as well?)
Configure serial debug in config/settings/kernel/drivers/kernel:
.. code-block:: text
serial_debug_output true
serial_debug_speed 115200
serial_debug_port 0x4000
Now your kernel is configured to send its output to the serial port. You can
connect another machine to it (using an USB to serial adapter and a NULL modem
cable, for example) and use SerialConnect or a similar tool to see the output
and access the KDL prompt.
Happy debugging!