Skip to content

Commit d539117

Browse files
committed
Merge branch 'pci/doe'
- Add support for DOE Discovery version 2 (Alexey Kardashevskiy) * pci/doe: PCI/DOE: Support discovery version 2
2 parents 83711a1 + eebab7e commit d539117

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)