Changeset 91ca111 in mainline for uspace/drv/bus/usb/xhci/hw_struct/regs.h
- Timestamp:
- 2017-06-23T11:18:50Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 51b2693
- Parents:
- e4d7363
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/hw_struct/regs.h
re4d7363 r91ca111 483 483 typedef ioport32_t xhci_doorbell_t; 484 484 485 enum xhci_plt { 486 XHCI_PSI_PLT_SYMM, 487 XHCI_PSI_PLT_RSVD, 488 XHCI_PSI_PLT_RX, 489 XHCI_PSI_PLT_TX 490 }; 491 492 /** 493 * Protocol speed ID: section 7.2.1 494 */ 495 typedef struct xhci_psi { 496 xhci_dword_t psi; 497 } xhci_psi_t; 498 499 #define XHCI_PSI_PSIV psi, 32, RANGE, 3, 0 500 #define XHCI_PSI_PSIE psi, 32, RANGE, 5, 4 501 #define XHCI_PSI_PLT psi, 32, RANGE, 7, 6 502 #define XHCI_PSI_PFD psi, 32, FLAG, 8 503 #define XHCI_PSI_PSIM psi, 32, RANGE, 31, 16 504 505 enum xhci_extcap_type { 506 XHCI_EC_RESERVED = 0, 507 XHCI_EC_USB_LEGACY, 508 XHCI_EC_SUPPORTED_PROTOCOL, 509 XHCI_EC_EXTENDED_POWER_MANAGEMENT, 510 XHCI_EC_IOV, 511 XHCI_EC_MSI, 512 XHCI_EC_LOCALMEM, 513 XHCI_EC_DEBUG = 10, 514 XHCI_EC_MSIX = 17, 515 XHCI_EC_MAX = 255 516 }; 517 518 /** 519 * xHCI Extended Capability: section 7 520 */ 521 typedef struct xhci_extcap { 522 xhci_dword_t header; 523 xhci_dword_t cap_specific[]; 524 } xhci_extcap_t; 525 526 #define XHCI_EC_CAP_ID header, 32, RANGE, 7, 0 527 #define XHCI_EC_SIZE header, 32, RANGE, 15, 8 528 529 /* Supported protocol */ 530 #define XHCI_EC_SP_MINOR header, 32, RANGE, 23, 16 531 #define XHCI_EC_SP_MAJOR header, 32, RANGE, 31, 24 532 #define XHCI_EC_SP_NAME cap_specific[0], 32, FIELD 533 #define XHCI_EC_SP_CP_OFF cap_specific[1], 32, RANGE, 7, 0 534 #define XHCI_EC_SP_CP_COUNT cap_specific[1], 32, RANGE, 15, 8 535 #define XHCI_EC_SP_PSIC cap_specific[1], 32, RANGE, 31, 28 536 #define XHCI_EC_SP_SLOT_TYPE cap_specific[2], 32, RANGE, 4, 0 537 538 typedef union { 539 char str [4]; 540 uint32_t packed; 541 } xhci_sp_name_t; 542 543 static inline xhci_extcap_t *xhci_extcap_next(const xhci_extcap_t *cur) 544 { 545 unsigned dword_offset = XHCI_REG_RD(cur, XHCI_EC_SIZE); 546 if (!dword_offset) 547 return NULL; 548 return (xhci_extcap_t *) (((xhci_dword_t *) cur) + dword_offset); 549 } 550 551 static inline xhci_psi_t *xhci_extcap_psi(const xhci_extcap_t *ec, unsigned psid) 552 { 553 assert(XHCI_REG_RD(ec, XHCI_EC_CAP_ID) == XHCI_EC_SUPPORTED_PROTOCOL); 554 assert(XHCI_REG_RD(ec, XHCI_EC_SP_PSIC) > psid); 555 556 unsigned dword_offset = 4 + psid; 557 return (xhci_psi_t *) (((xhci_dword_t *) ec) + dword_offset); 558 } 559 560 /** 561 * USB Legacy Support: section 7.1 562 * 563 * Legacy support have an exception from dword-access, because it needs to be 564 * byte-accessed. 565 */ 566 typedef struct xhci_extcap_legsup { 567 ioport8_t cap_id; 568 ioport8_t size; /**< Next Capability Pointer */ 569 ioport8_t sem_bios; 570 ioport8_t sem_os; 571 572 xhci_dword_t usblegctlsts; /**< USB Legacy Support Control/Status - RW for BIOS, RO for OS */ 573 } xhci_legsup_t; 574 575 #define XHCI_LEGSUP_SEM_BIOS sem_bios, 8, FLAG, 0 576 #define XHCI_LEGSUP_SEM_OS sem_os, 8, FLAG, 0 577 485 578 #endif 486 579 /**
Note:
See TracChangeset
for help on using the changeset viewer.