Enabling PCI-E I/O space access for serial port

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
prontoguy
Posts: 3
Joined: Tue Jul 12, 2022 2:19 am

Enabling PCI-E I/O space access for serial port

Post by prontoguy »

Hello,

I am trying to use PCI-E serial port with UEFI. Unfortunately I cannot initialize serial port.
I checked with GRUB if it is working and while booted in i386-pc (legacy mode), I can configure serial port and everything works fine. However, when I boot x86_64-efi GRUB it says "serial port isn't found" when I try to access it same way I do under CSM.

I also displayed information about serial port device under EFI shell with `pci` command and it reports "(00) I/O space access enabled: 0", what probably is my problem.
I would like to ask if it is possible to enable I/O space access and use that PCI-E adapter for debugging purposes with EFI bootloader?
Octocontrabass
Member
Member
Posts: 5218
Joined: Mon Mar 25, 2013 7:01 pm

Re: Enabling PCI-E I/O space access for serial port

Post by Octocontrabass »

prontoguy wrote:I would like to ask if it is possible to enable I/O space access and use that PCI-E adapter for debugging purposes with EFI bootloader?
Before or after you exit boot services?

Before you exit boot services, you should use the Serial I/O Protocol to access it.

After you exit boot services, you can locate the adapter by enumerating PCI and enable its port-mapped I/O by setting bit 0 of the command register in the device's PCI configuration space.
User avatar
jzef
Posts: 18
Joined: Wed Mar 02, 2016 10:23 am

Re: Enabling PCI-E I/O space access for serial port

Post by jzef »

I use PCIe Serial card for debug WinXP 64-bit on pure UEFI. For debugging (WinDbg) to work, you need:
  • the PCIe Serial card must support access Port-Mapped I/O (PMIO) (or maybe MIXED Port-Mapped I/O (PMIO) + Memory-Mapped I/O (MMIO)
  • under UEFI Shell you need to set bit 0 of command register in PCI config space e.g. my card has bus dev func 04 00 00:

    Code: Select all

    mm 04000004 1 -pci
  • debugging must be enabled in the BCD file - for my card I need speed 14400
  • kdcom.dll must be patched - instead of the I/O address for COM1 03F8 the PCIe card address - mine has D000
  • in WinDbg I need to set the speed to 115200
My card have higher CLK and therefore it must be so 14400 in BCD & 115200 in WinDbg

Read this my topic: I am looking for a PCIe card for WinXP debugging

Legacy BIOS WinDbg success: https://www.wincert.net/forum/topic/184 ... ent=137843
Pure UEFI (CSM Disabled) WinDbg success: https://www.wincert.net/forum/topic/184 ... ent=138077

Edited

I have built a SerialDxe.efi driver that enable I/O access (no need use mm 04000004 1 -pci anymore) but to debug Windows I still have to use baudrate 14400 in BCD and 115200 in Windbg:
SerialDxe.efi driver for my PCIe serial card
Post Reply