aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/pci_caps/px.h22
-rw-r--r--lib/pci_caps.c32
2 files changed, 50 insertions, 4 deletions
diff --git a/include/pci_caps/px.h b/include/pci_caps/px.h
index e2eb36c..cd3c2f7 100644
--- a/include/pci_caps/px.h
+++ b/include/pci_caps/px.h
@@ -98,10 +98,24 @@ struct pxlcap {
} __attribute__((packed));
_Static_assert(sizeof(struct pxlcap) == 0x4, "bad PXLCAP size");
-struct pxlc {
- uint16_t stuff:16;
+union pxlc {
+ uint16_t raw;
+ struct {
+ uint16_t aspmc:2; /* Active State Power Management Control */
+ uint16_t rsvdp1:1;
+ uint16_t rcb:1; /* Read Completion Boundary */
+ uint16_t ld:1; /* Link Disable */
+ uint16_t rl:1; /* Retrain Link */
+ uint16_t ccc:1; /* Common Clock Configuration */
+ uint16_t es:1; /* Extended Synch */
+ uint16_t clkreq_en:1; /* Enable Clock Power Management */
+ uint16_t hawd:1; /* Hardware Autonomous Width Disable */
+ uint16_t lbmie:1; /* Link Bandwidth Management Interrupt Enable */
+ uint16_t labie:1; /* Link Autonomous Bandwidth Interrupt Enable */
+ uint16_t rsvdp2:4;
+ };
} __attribute__((packed));
-_Static_assert(sizeof(struct pxlc) == 0x2, "bad PXLC size");
+_Static_assert(sizeof(union pxlc) == 0x2, "bad PXLC size");
struct pxls {
uint16_t stuff:16;
@@ -239,7 +253,7 @@ struct pxcap {
/* Link Capabilities */
struct pxlcap pxlcap;
/* Link Control */
- struct pxlc pxlc;
+ union pxlc pxlc;
/* Link Status */
struct pxls pxls;
/* Slot Capabilities */
diff --git a/lib/pci_caps.c b/lib/pci_caps.c
index d7d312f..ec0dbd8 100644
--- a/lib/pci_caps.c
+++ b/lib/pci_caps.c
@@ -292,6 +292,30 @@ handle_px_pxdc_write(vfu_ctx_t *vfu_ctx, struct pxcap *px,
return 0;
}
+/* TODO implement */
+static int
+handle_px_pxlc_write(vfu_ctx_t *vfu_ctx UNUSED, struct pxcap *px UNUSED,
+ const union pxlc *const p UNUSED)
+{
+ return 0;
+}
+
+/* TODO implement */
+static int
+handle_px_pxsc_write(vfu_ctx_t *vfu_ctx UNUSED, struct pxcap *px UNUSED,
+ const struct pxsc *const p UNUSED)
+{
+ return 0;
+}
+
+/* TODO implement */
+static int
+handle_px_pxrc_write(vfu_ctx_t *vfu_ctx UNUSED, struct pxcap *px UNUSED,
+ const struct pxrc *const p UNUSED)
+{
+ return 0;
+}
+
static int
handle_px_pxdc2_write(vfu_ctx_t *vfu_ctx, struct pxcap *px,
const union pxdc2 *const p)
@@ -327,10 +351,18 @@ handle_px_write_2_bytes(vfu_ctx_t *vfu_ctx, struct pxcap *px, char *buf,
switch (off) {
case offsetof(struct pxcap, pxdc):
return handle_px_pxdc_write(vfu_ctx, px, (union pxdc *)buf);
+ case offsetof(struct pxcap, pxlc):
+ return handle_px_pxlc_write(vfu_ctx, px, (union pxlc *)buf);
+ case offsetof(struct pxcap, pxsc):
+ return handle_px_pxsc_write(vfu_ctx, px, (struct pxsc *)buf);
+ case offsetof(struct pxcap, pxrc):
+ return handle_px_pxrc_write(vfu_ctx, px, (struct pxrc *)buf);
case offsetof(struct pxcap, pxdc2):
return handle_px_pxdc2_write(vfu_ctx, px, (union pxdc2 *)buf);
case offsetof(struct pxcap, pxlc2):
return handle_px_pxlc2_write(vfu_ctx, px, (struct pxlc2 *)buf);
+ case offsetof(struct pxcap, pxsc2): /* RsvdZ */
+ return 0;
}
return ERROR_INT(EINVAL);
}