Changeset e07257e in mainline
- Timestamp:
- 2018-05-22T19:06:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 69927fa
- Parents:
- 6413967
- git-author:
- Jakub Jermar <jakub@…> (2018-04-08 20:42:58)
- git-committer:
- Jakub Jermar <jakub@…> (2018-05-22 19:06:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/include/pci_dev_iface.h
r6413967 re07257e 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_CAP_PTR 0x34 48 49 #define PCI_STATUS_CAP_LIST (1 << 4) 50 51 #define PCI_CAP_ID(c) ((c) + 0x0) 52 #define PCI_CAP_NEXT(c) ((c) + 0x1) 53 54 #define PCI_CAP_PMID 0x1 55 #define PCI_CAP_VENDORSPECID 0x9 46 56 47 57 extern errno_t pci_config_space_read_8(async_sess_t *, uint32_t, uint8_t *); … … 52 62 extern errno_t pci_config_space_write_16(async_sess_t *, uint32_t, uint16_t); 53 63 extern errno_t pci_config_space_write_32(async_sess_t *, uint32_t, uint32_t); 64 65 static inline errno_t 66 pci_config_space_cap_first(async_sess_t *sess, uint8_t *c, uint8_t *id) 67 { 68 errno_t rc; 69 uint16_t status; 70 71 rc = pci_config_space_read_16(sess, PCI_STATUS, &status); 72 if (rc != EOK) 73 return rc; 74 75 if (!(status & PCI_STATUS_CAP_LIST)) { 76 *c = 0; 77 return EOK; 78 } 79 80 rc = pci_config_space_read_8(sess, PCI_CAP_PTR, c); 81 if (rc != EOK) 82 return rc; 83 if (!c) 84 return EOK; 85 return pci_config_space_read_8(sess, PCI_CAP_ID(*c), id); 86 } 87 88 static inline errno_t 89 pci_config_space_cap_next(async_sess_t *sess, uint8_t *c, uint8_t *id) 90 { 91 errno_t rc = pci_config_space_read_8(sess, PCI_CAP_NEXT(*c), c); 92 if (rc != EOK) 93 return rc; 94 if (!c) 95 return EOK; 96 return pci_config_space_read_8(sess, PCI_CAP_ID(*c), id); 97 } 54 98 55 99 /** PCI device communication interface. */
Note:
See TracChangeset
for help on using the changeset viewer.