From d418c7c4cf93b050f651000a36ca8aebade7e123 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 2 May 2024 01:02:42 -0400 Subject: kernel: pci: Add more register definitions Signed-off-by: Ian Moffett --- sys/include/dev/pci/pciregs.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'sys/include') diff --git a/sys/include/dev/pci/pciregs.h b/sys/include/dev/pci/pciregs.h index 732e88c..13a9fc0 100644 --- a/sys/include/dev/pci/pciregs.h +++ b/sys/include/dev/pci/pciregs.h @@ -32,9 +32,35 @@ #include +#define PCIREG_VENDOR_ID 0x00 /* 16 bits */ +#define PCIREG_DEVICE_ID 0x02 /* 16 bits */ +#define PCIREG_CLASSREV 0x08 /* 32 bits */ +#define PCIREG_BAR0 0x10 /* 32 bits */ +#define PCIREG_BAR1 0x14 /* 32 bits */ +#define PCIREG_BAR2 0x18 /* 32 bits */ +#define PCIREG_BAR3 0x1C /* 32 bits */ +#define PCIREG_BAR4 0x20 /* 32 bits */ +#define PCIREG_BAR5 0x24 /* 32 bits */ +#define PCIREG_IRQLINE 0x3C /* 8 bits */ +#define PCIREG_CMDSTATUS 0x04 /* command (15:0), status (31:16) */ + +/* Macros to extract PCIREG_CLASSREV bits */ +#define PCIREG_CLASS(CLASSREV) (CLASSREV >> 24) +#define PCIREG_SUBCLASS(CLASSREV) ((CLASSREV >> 16) & 0xFF) +#define PCIREG_REVID(CLASSREV) (CLASSREV & 0xFF) +#define PCIREG_PROGIF(CLASSREV) ((CLASSREV >> 8) & 0xFF) + +/* Macros to extract PCIREG_CMDSTATUS bits */ +#define PCIREG_COMMAND(CMDSTATUS) (CMDSTATUS & 0xFFFF) +#define PCIREG_STATUS(CMDSTATUS) (CMDSTATUS >> 16) + /* PCI command register bits */ #define PCI_IO_SPACE __BIT(0) /* Respond to I/O space accesses */ #define PCI_MEM_SPACE __BIT(1) /* Respond to mem space accesses */ #define PCI_BUS_MASTERING __BIT(2) /* Enable bus mastering */ +/* PCI status register bits */ +#define PCI_STATUS_CAPLIST __BIT(4) +#define PCI_STATUS_66MHZ __BIT(5) + #endif /* !_PCIREGS_H_ */ -- cgit v1.2.3