Changeset fbfe59d in mainline for uspace/lib/drv/include/pci_dev_iface.h
- Timestamp:
- 2018-06-25T21:45:05Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8119363
- Parents:
- 2498b95 (diff), e3107e2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/include/pci_dev_iface.h
r2498b95 rfbfe59d 42 42 #define PCI_VENDOR_ID 0x00 43 43 #define PCI_DEVICE_ID 0x02 44 #define PCI_STATUS 0x06 44 45 #define PCI_SUB_CLASS 0x0A 45 46 #define PCI_BASE_CLASS 0x0B 47 #define PCI_BAR0 0x10 48 #define PCI_CAP_PTR 0x34 49 50 #define PCI_BAR_COUNT 6 51 52 #define PCI_STATUS_CAP_LIST (1 << 4) 53 54 #define PCI_CAP_ID(c) ((c) + 0x0) 55 #define PCI_CAP_NEXT(c) ((c) + 0x1) 56 57 #define PCI_CAP_PMID 0x1 58 #define PCI_CAP_VENDORSPECID 0x9 46 59 47 60 extern errno_t pci_config_space_read_8(async_sess_t *, uint32_t, uint8_t *); … … 52 65 extern errno_t pci_config_space_write_16(async_sess_t *, uint32_t, uint16_t); 53 66 extern errno_t pci_config_space_write_32(async_sess_t *, uint32_t, uint32_t); 67 68 static inline errno_t 69 pci_config_space_cap_first(async_sess_t *sess, uint8_t *c, uint8_t *id) 70 { 71 errno_t rc; 72 uint16_t status; 73 74 rc = pci_config_space_read_16(sess, PCI_STATUS, &status); 75 if (rc != EOK) 76 return rc; 77 78 if (!(status & PCI_STATUS_CAP_LIST)) { 79 *c = 0; 80 return EOK; 81 } 82 83 rc = pci_config_space_read_8(sess, PCI_CAP_PTR, c); 84 if (rc != EOK) 85 return rc; 86 if (!c) 87 return EOK; 88 return pci_config_space_read_8(sess, PCI_CAP_ID(*c), id); 89 } 90 91 static inline errno_t 92 pci_config_space_cap_next(async_sess_t *sess, uint8_t *c, uint8_t *id) 93 { 94 errno_t rc = pci_config_space_read_8(sess, PCI_CAP_NEXT(*c), c); 95 if (rc != EOK) 96 return rc; 97 if (!c) 98 return EOK; 99 return pci_config_space_read_8(sess, PCI_CAP_ID(*c), id); 100 } 54 101 55 102 /** PCI device communication interface. */
Note:
See TracChangeset
for help on using the changeset viewer.