edk2/MdeModulePkg
Mingjie Shen 049dc848c4 MdeModulePkg: Fix incorrect EfiPciWidth* enum literals
In arguments of EFI_PCI_IO_PROTOCOL member functions, replace the
EfiPciWidth* enum literals from
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH with the matching
EfiPciIoWidth* values from EFI_PCI_IO_PROTOCOL_WIDTH.

This keeps the call sites aligned with the protocol they actually use.
The old values were copied from EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL code,
so they obscured the intent of the calls and relied on an explicit
cast.

This mimics commit 8ba64a9a94 ("UefiPayloadPkg: Fix build failure with
CLANGPDB").

Generated by coccinelle script.

``` smpl
@initialize:python@
@@

def to_pci_io_width(name):
    return name.replace("EfiPciWidth", "EfiPciIoWidth", 1)

@normalize@
typedef EFI_PCI_IO_PROTOCOL;
typedef EDKII_PCI_DEVICE_PPI;
type T =~ "^EFI_PCI_IO_PROTOCOL_WIDTH$";
EFI_PCI_IO_PROTOCOL *x;
EDKII_PCI_DEVICE_PPI *y;
identifier bad =~ "EfiPciWidth(Uint|FifoUint|FillUint)(8|16|32|64)";
identifier top_op =~ "^(PollMem|PollIo|CopyMem)$";
identifier space =~ "^(Mem|Io|Pci)$";
identifier rw =~ "^(Read|Write)$";
fresh identifier good = script:python(bad) { to_pci_io_width(bad) };
expression first;
expression list rest;
@@
(
  x->top_op
|
  y->PciIo.top_op
|
  x->space.rw
|
  y->PciIo.space.rw
) (
  first,
- (T)bad
+ good
  ,
  rest
  )
```

Verified with:
- `build -p MdeModulePkg/MdeModulePkg.dsc -m MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf -a IA32 -b DEBUG -t GCC`
- `build -p MdeModulePkg/MdeModulePkg.dsc -m MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf -a X64 -b DEBUG -t GCC`

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2026-07-14 00:06:22 +00:00
..
Application MdeModulePkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
Bus MdeModulePkg: Fix incorrect EfiPciWidth* enum literals 2026-07-14 00:06:22 +00:00
Core MdeModulePkg: Dxe Core: Correct gMemoryTypeInformation Definition 2026-07-09 12:46:51 +00:00
Include MdeModulePkg: Follow pragma once coding convention 2026-06-25 19:40:31 +00:00
Library MdeModulePkg/ArmFfaLib: Use EFI_PAGES_TO_SIZE 2026-07-08 05:02:11 +00:00
Logo MdeModulePkg: Remove ARM32 Support 2025-09-25 22:04:10 +00:00
Test MdeModulePkg: Follow pragma once coding convention 2026-06-25 19:40:31 +00:00
Universal MdeModulePkg/TerminalDxe: Change print level to eliminate interference 2026-06-22 20:06:47 +00:00
MdeModulePkg.ci.yaml MdeModulePkg: Add duplicate exception for gUiAppFileGuid 2025-03-06 14:18:10 +01:00
MdeModulePkg.dec MdeModulePkg/PciBusDxe: Scan funcs when func 0 is absent 2026-06-25 13:09:52 +00:00
MdeModulePkg.dsc MdeModulePkg: Add support for generation of HEST table 2026-05-26 23:45:14 +00:00
MdeModulePkg.uni MdeModulePkg: Add platform limit for size in Resizable BAR 2026-02-25 03:40:14 +00:00
MdeModulePkgExtra.uni MdeModulePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:08 -07:00