Fork me on GitHub
Fiwix symbol
Welcome to the Fiwix project
A UNIX-like kernel for the i386 architecture
Fiwix kernel

News

21-Feb-2022

During the last weeks I have been working to include support for the PCI local bus in the kernel and, at the same time, to improve the serial driver to also support PCI devices (only QEMU serial PCI at the moment), so I can test it easily. The PCI driver only scans the first 8 buses but can be easily extensible to scan more. This restriction obeys the fact that only QEMU PCI serial devices are supported so far, and so there is no need to scan the whole 256 PCI buses.

Two new configuration options have been created:

#define CONFIG_PCI
#define CONFIG_PCI_NAMES

The first one, if defined, will include PCI support when building the kernel. The second one will print the Vendor ID and Device ID of every known PCI device during the kernel boot up.

The following is a screen shot to show the new PCI messages during the boot up sequence:

New PCI messages during kernel boot up

You can see 6 PCI devices detected but only one is known by the kernel (the serial controller).

The first part of each PCI line includes the bus, the device and the function numbers of every single device detected during the PCI bus scan. The second part shows the vendor id, the device id, the class and the subclass. Finally the name is only added if it's known by the kernel, or <NULL> if the option CONFIG_PCI_NAMES was not defined.

According the PCI ID Repository, the name of the devices unknown by the kernel are:

  • 8086:1237 is a Intel Corporation, 440FX - 82441FX PMC [Natoma]
  • 8086:7000 is a Intel Corporation, 82371SB PIIX3 ISA [Natoma/Triton II]
  • 8086:7010 is a Intel Corporation, 82371SB PIIX3 IDE [Natoma/Triton II]
  • 8086:7113 is a Intel Corporation, 82371AB/EB/MB PIIX4 ACPI
  • 1234:1111 is a QEMU Virtual Video Controller

After porting the PCI Utils package (which will be included in the next FiwixOS version), the result is practically the same:

# ./lspci -i pci.ids.gz
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Device 1234:1111 (rev 02)
00:03.0 Serial controller: Red Hat, Inc. QEMU PCI 16550A Adapter (rev 01)

You can also see in the above screen shot that the QEMU was configured to include 4 ISA serial devices and 1 PCI serial device, using the following options:

-chardev pty,id=pciserial \
-device pci-serial,chardev=pciserial \
-serial pty \
-serial pty \
-serial pty \
-serial pty \

Since the QEMU PCI serial device is now known by the kernel, it shows its vendor id and device id names in addition to the PCI location and other information.

OK, now that the kernel recognizes the 5 serial devices, I wanted to test them altogether to see if the driver is working well. First I need to edit the /etc/inittab file and enable the agetty program for each device:

# Serial ttys
S0:2345:respawn:/sbin/agetty -L 9600 ttyS0
S1:2345:respawn:/sbin/agetty -L 9600 ttyS1
S2:2345:respawn:/sbin/agetty -L 9600 ttyS2
S3:2345:respawn:/sbin/agetty -L 9600 ttyS3
S4:2345:respawn:/sbin/agetty -L 9600 ttyS4

Then I run telinit q to tell to init that its configuration file has changed. Right after that, 5 new processes appear in the process list:

Process list

Now I only need to log into the system from each serial tty and execute something as fancy as the ncurses test program called worm:

Process list with 5 worms running

and this is the result!


First   Previous