All of lore.kernel.org
 help / color / mirror / Atom feed
* enhancement request: setpci.mod to work on PCIe registers (0xfff) - currently limited to PCI registers (0xff)
@ 2023-03-28  9:54 Paul Stanley
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Stanley @ 2023-03-28  9:54 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 546 bytes --]

Hello everybody,

As per title, setpci.mod's setpci command can read/write up to 0xFF
registers but returns an incorrect (0xFF) value for any registers beyond
0xFF.. There is a 4K PCIe configuration space (0xFFF) per device.

eg:
setpci -s 0:1f.0 0xf0.l -> returns correct value
setpci -s 0:1f.0 0x200.l -> returns 0xff (incorrect)

Extending setpci.mod in this way would bring it's functionality in line
with EFI Shells 'mm' command that can read/write all 4K PCIe registers, as
well as pciutils' setpci command that can do the same.

Thank you

[-- Attachment #2: Type: text/html, Size: 1357 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: enhancement request: setpci.mod to work on PCIe registers (0xfff) - currently limited to PCI registers (0xff)
  2023-03-28  9:56 ` Nando
@ 2023-04-05 10:27   ` nando4eva
  0 siblings, 0 replies; 3+ messages in thread
From: nando4eva @ 2023-04-05 10:27 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]

 Have found the problem is grub2's setpci uses I/O-mapped read/write which are limited up to PCI register 0xff. Below is the offending code:

static inline grub_uint8_t
grub_pci_read_byte (grub_pci_address_t addr)
{
  grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
  return grub_inb (GRUB_PCI_DATA_REG + (addr & 3));
}
The solution: To modify grub2 code to do memory mapped read/write to PCIe register 0x209 (or up to full 4k) using formula along the lines of:

address=RCBA + -s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]] .. whatever it is.
PCIUtil's setpci does allow 4k register read/writes,  so there is a code base for it already.

    On Tuesday, 28 March 2023 at 08:56:10 pm AEDT, Nando <nando4eva@gmail.com> wrote:  
 
 Hello everybody,
As per title, setpci.mod's setpci command can read/write up to 0xFF registers but returns an incorrect (0xFF) value for any registers beyond 0xFF.. There is a 4K PCIe configuration space (0xFFF) per device.
eg: 
setpci -s 0:1f.0 0xf0.l -> returns correct valuesetpci -s 0:1f.0 0x200.l -> returns 0xff (incorrect)
Extending setpci.mod in this way would bring it's functionality in line with EFI Shells 'mm' command that can read/write all 4K PCIe registers, as well as pciutils' setpci command that can do the same.
Thank you  

[-- Attachment #2: Type: text/html, Size: 3715 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* enhancement request: setpci.mod to work on PCIe registers (0xfff) - currently limited to PCI registers (0xff)
@ 2023-03-28  9:56 ` Nando
  2023-04-05 10:27   ` nando4eva
  0 siblings, 1 reply; 3+ messages in thread
From: Nando @ 2023-03-28  9:56 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 546 bytes --]

Hello everybody,

As per title, setpci.mod's setpci command can read/write up to 0xFF
registers but returns an incorrect (0xFF) value for any registers beyond
0xFF.. There is a 4K PCIe configuration space (0xFFF) per device.

eg:
setpci -s 0:1f.0 0xf0.l -> returns correct value
setpci -s 0:1f.0 0x200.l -> returns 0xff (incorrect)

Extending setpci.mod in this way would bring it's functionality in line
with EFI Shells 'mm' command that can read/write all 4K PCIe registers, as
well as pciutils' setpci command that can do the same.

Thank you

[-- Attachment #2: Type: text/html, Size: 1357 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-05 10:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28  9:54 enhancement request: setpci.mod to work on PCIe registers (0xfff) - currently limited to PCI registers (0xff) Paul Stanley
     [not found] <CAA7dOE4ap+pk+8Zofxyb_rg6f6WGbutqbcjpoqk=dEejzasLjg.ref@mail.gmail.com>
2023-03-28  9:56 ` Nando
2023-04-05 10:27   ` nando4eva

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.