Skip to content

Commit eebab7e

Browse files
aikbjorn-helgaas
authored andcommitted
PCI/DOE: Support discovery version 2
PCIe r6.1, sec 6.30.1.1 defines a "DOE Discovery Version" field in the DOE Discovery Request Data Object Contents (3rd DW) as: 15:8 DOE Discovery Version – must be 02h if the Capability Version in the Data Object Exchange Extended Capability is 02h or greater. Add support for the version on devices with the DOE v2 capability. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexey Kardashevskiy <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]>
1 parent 4cece76 commit eebab7e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

drivers/pci/doe.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,13 @@ static void pci_doe_task_complete(struct pci_doe_task *task)
383383
complete(task->private);
384384
}
385385

386-
static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 *index, u16 *vid,
386+
static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 capver, u8 *index, u16 *vid,
387387
u8 *protocol)
388388
{
389389
u32 request_pl = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX,
390-
*index);
390+
*index) |
391+
FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER,
392+
(capver >= 2) ? 2 : 0);
391393
__le32 request_pl_le = cpu_to_le32(request_pl);
392394
__le32 response_pl_le;
393395
u32 response_pl;
@@ -421,13 +423,17 @@ static int pci_doe_cache_protocols(struct pci_doe_mb *doe_mb)
421423
{
422424
u8 index = 0;
423425
u8 xa_idx = 0;
426+
u32 hdr = 0;
427+
428+
pci_read_config_dword(doe_mb->pdev, doe_mb->cap_offset, &hdr);
424429

425430
do {
426431
int rc;
427432
u16 vid;
428433
u8 prot;
429434

430-
rc = pci_doe_discovery(doe_mb, &index, &vid, &prot);
435+
rc = pci_doe_discovery(doe_mb, PCI_EXT_CAP_VER(hdr), &index,
436+
&vid, &prot);
431437
if (rc)
432438
return rc;
433439

include/uapi/linux/pci_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,7 @@
11441144
#define PCI_DOE_DATA_OBJECT_HEADER_2_LENGTH 0x0003ffff
11451145

11461146
#define PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX 0x000000ff
1147+
#define PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER 0x0000ff00
11471148
#define PCI_DOE_DATA_OBJECT_DISC_RSP_3_VID 0x0000ffff
11481149
#define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL 0x00ff0000
11491150
#define PCI_DOE_DATA_OBJECT_DISC_RSP_3_NEXT_INDEX 0xff000000

0 commit comments

Comments
 (0)