discover.h
来自「6440linuxDriver的源代码」· C头文件 代码 · 共 2,308 行 · 第 1/5 页
H
2,308 行
#ifndef __DISCOVER_H__#define __DISCOVER_H__#include "com_define.h"/* assume the maximum number of phys in an expander device is 128 */#define MAXIMUM_EXPANDER_PHYS 128/* assume the maximum number of indexes per phy is 128 */#define MAXIMUM_EXPANDER_INDEXES 128/* limit to 8 initiators for this example */#define MAXIMUM_INITIATORS 8/* defines for address frame types */#define ADDRESS_IDENTIFY_FRAME 0x00#define ADDRESS_OPEN_FRAME 0x01/* hardware uses its own definition.commented out for now until needed// defines for SSP frame types#define SSP_DATA_FRAME 0x01#define SSP_XFERRDY_FRAME 0x05#define SSP_COMMAND_FRAME 0x06#define SSP_RESPONSE_FRAME 0x07#define SSP_TASK_FRAME 0x16*//* defines for SMP frame types */#define SMP_REQUEST_FRAME 0x40#define SMP_RESPONSE_FRAME 0x41/* defines for SMP request functions */#define REPORT_GENERAL 0x00#define REPORT_MANUFACTURER_INFORMATION 0x01#define READ_GPIO_REGISTER 0x02#define REPORT_SELF_CONFGRIGRUATION_STATUS 0x03#define DISCOVER 0x10#define REPORT_PHY_ERROR_LOG 0x11#define REPORT_PHY_SATA 0x12#define REPORT_ROUTE_INFORMATION 0x13#define REPORT_PHY_EVENT_INFORMATION 0x14#define REPORT_PHY_BROADCAST_COUNTS 0x15#define DISCOVER_LIST 0x16#define REPORT_EXPANDER_ROUTE_TABLE 0x17#define CONFIGURE_GENERAL 0x80#define ENABLE_DISABLE_ZONING 0x81#define WRITE_GPIO_REGISTER 0x82#define ZONED_BROADCAST 0x85#define CONFIGURE_ROUTE_INFORMATION 0x90#define PHY_CONTROL 0x91#define PHY_TEST 0x92#define CONFIGURE_PHY_EVENT_INFORMATION 0x93/* replaced by existing definition//defines for the protocol bits#define SATA 0x01#define SMP 0x02#define STP 0x04#define SSP 0x08*/enum sas_proto { SATA_PROTO = 1, SAS_PROTO_SMP = 2, /* protocol */ SAS_PROTO_STP = 4, /* protocol */ SAS_PROTO_SSP = 8, /* protocol */ SAS_PROTO_ALL = 0xE,};/* defines for open responses, arbitrary values, not defined in the spec */#define OPEN_ACCEPT 0#define OPEN_REJECT_BAD_DESTINATION 1#define OPEN_REJECT_RATE_NOT_SUPPORTED 2#define OPEN_REJECT_NO_DESTINATION 3#define OPEN_REJECT_PATHWAY_BLOCKED 4#define OPEN_REJECT_PROTOCOL_NOT_SUPPORTED 5#define OPEN_REJECT_RESERVE_ABANDON 6#define OPEN_REJECT_RESERVE_CONTINUE 7#define OPEN_REJECT_RESERVE_INITIALIZE 8#define OPEN_REJECT_RESERVE_STOP 9#define OPEN_REJECT_RETRY 10#define OPEN_REJECT_STP_RESOURCES_BUSY 11#define OPEN_REJECT_WRONG_DESTINATION 12#define OPEN_REJECT_WAITING_ON_BREAK 13/* definitions for discovery algorithm use */enum{ SAS_SIMPLE_LEVEL_DESCENT = 0, SAS_UNIQUE_LEVEL_DESCENT};enum{ SAS_10_COMPATIBLE = 0, SAS_11_COMPATIBLE};/* definitions for SMP function results */enum SMPFunctionResult{ SMP_REQUEST_ACCEPTED = 0, SMP_FUNCTION_ACCEPTED = 0, SMP_UNKNOWN_FUNCTION, SMP_FUNCTION_FAILED, SMP_INVALID_REQUEST_FRAME_LENGTH, SMP_PHY_DOES_NOT_EXIST = 0x10, SMP_INDEX_DOES_NOT_EXIST, SMP_PHY_DOES_NOT_SUPPORT_SATA, SMP_UNKNOWN_PHY_OPERATION, SMP_UNKNOWN_PHY_TEST_FUNCTION, SMP_UNKNOWN_PHY_TEST_FUNCTION_IN_PROGRESS, SMP_PHY_VACANT, SMP_PHY_EVENT_INFORMATION_SOURCE_NOT_SUPPORTED, SMP_ZONE_VIOLATION = 0x20, SMP_PHYSICAL_PRESENCE_NOT_ASSERTED, SMP_UNKNOWN_ENABLE_DISABLE_ZONING_VALUE};/* use existing definitionattached and device could share onecommon structure//DeviceType enum DeviceType{ NO_DEVICE = 0, END_DEVICE, EDGE_EXPANDER_DEVICE, FANOUT_EXPANDER_DEVICE, END = END_DEVICE, EDGE = EDGE_EXPANDER_DEVICE, FANOUT = FANOUT_EXPANDER_DEVICE };//AttachedDeviceTypeenum AttachedDeviceType{ ATTACHED_NO_DEVICE = 0, ATTACHED_END_DEVICE, ATTACHED_EXPANDER_DEVICE, ATTACHED_COMPLIANT_EXPANDER_DEVICE};*//* DEV_TYPE values */enum DeviceType { NO_DEVICE = 0, /* protocol */ SAS_END_DEV = 1, /* protocol */ EDGE_DEV = 2, /* protocol */ FANOUT_DEV = 3, /* protocol */ SAS_HA = 4, SATA_DEV = 5, SATA_PM = 7, SATA_PM_PORT= 8,};/* RoutingAttribute */enum RoutingAttribute{ DIRECT = 0, SUBTRACTIVE, TABLE, /* this attribute is a psuedo attribute, used to reflect the function result of SMP_PHY_VACANT in a fabricated discover response */ PHY_NOT_USED = 15};/* ConnectorType */enum ConnectorType{ UNKNOWN_CONNECTOR = 0, SFF_8470_EXTERNAL_WIDE, SFF_8484_INTERNAL_WIDE = 0x10, SFF_8484_COMPACT_INTERNAL_WIDE, SFF_8482_BACKPLANE = 0x20, SATA_HOST_PLUG, SAS_DEVICE_PLUG, SATA_DEVICE_PLUG};/* RouteFlag */enum DisableRouteEntry{ ENABLED = 0, DISABLED};/* combined with existing definition// PhyLinkRate(s)enum PhysicalLinkRate{ RATE_UNKNOWN = 0, PHY_DISABLED, PHY_FAILED, SPINUP_HOLD_OOB, PORT_SELECTOR_DETECTED, RESET_IN_PROGRESS,// this is a psuedo link rate, used to reflect the function// result of SMP_PHY_VACANT in a fabricated discover response PHY_DOES_NOT_EXIST, GBPS_1_5 = 8, GBPS_3_0 = 9};*//* Connect_Rate */enum PhysicalLinkRate { PHY_LINKRATE_NONE = 0, PHY_LINKRATE_UNKNOWN = 0, PHY_DISABLED, PHY_RESET_PROBLEM, PHY_SPINUP_HOLD, PHY_PORT_SELECTOR, RESET_IN_PROGRESS, /* this is a psuedo link rate, used to reflect the function result of SMP_PHY_VACANT in a fabricated discover response */ PHY_DOES_NOT_EXIST, PHY_LINKRATE_1_5 = 0x08, PHY_LINKRATE_G1 = PHY_LINKRATE_1_5, PHY_LINKRATE_3 = 0x09, PHY_LINKRATE_G2 = PHY_LINKRATE_3, PHY_LINKRATE_6 = 0x0A,};/* PhyOperation */enum PhyOperation{ PHY_NOP = 0, LINK_RESET, HARD_RESET, DISABLE, CLEAR_ERROR_LOG = 5, CLEAR_AFFILIATION, TRANSMIT_SATA_PORT_SELECTION_SIGNAL, CLEAR_STP_NEXUS_LOSS};/* EnableDisableZoning*/enum EnableDisableZoning{ NO_CHANGE=0, ENABLE_ZONING, DISABLE_ZONING,};/* BroadcastType*/enum BroadcastType{ BROADCAST_CHANGE = 0, BROADCAST_RESERVED_CHANGE0, BROADCAST_RESERVED_CHANGE1, BROADCAST_SES, BROADCAST_EXPANDER, BROADCAST_ASYNCHRONOUS_EVENT, BROADCAST_RESERVED_CHANGE3, BROADCAST_RESERVED_CHANGE4, };/* DescriptorType */enum DescriptorType{ LONG_FORMAT_DESCRIPTOR=0, SHORT_FORMAT_DESCRIPTOR,};/* PortType */enum PortType{ PORT_IS_TARGET=0, PORT_IS_INITIATOR};/* common type is already defined // provide the simple type definitionstypedef unsigned char MV_U8;typedef unsigned short MV_U16;typedef unsigned long MV_U32;typedef unsigned _int64 MV_U64;*//* * The structures assume a char bitfield is valid, this is compiler * dependent defines would be more portable, but less descriptive * the Identify frame is exchanged following OOB, for this * code it contains the identity information for the attached device * and the initiator application client. */enum { FRAME_PORT_TYPE_SMP = (1 << 1), FRAME_PORT_TYPE_STP = (1 << 2), FRAME_PORT_TYPE_SSP = (1 << 3), FRAME_ATT_DEV_TYPE_SMP = (1 << 1), FRAME_ATT_DEV_TYPE_STP = (1 << 2), FRAME_ATT_DEV_TYPE_SSP = (1 << 3), FRAME_ATT_DEV_SATA_DEV = (1 << 0), FRAME_ATT_DEV_SATA_HOST = (1 << 0), FRAME_ATT_DEV_SATA_SELECTOR = (1 << 7),};struct Identify{/* byte 0 */#if __MV_BIG_ENDIAN_BITFIELD__ MV_U8 RestrictedByte0Bit7 : 1; MV_U8 DeviceType : 3; MV_U8 AddressFrameType : 4;#else /* 0x0: ADDRESS_IDENTIFY_FRAME */ MV_U8 AddressFrameType : 4; /* 001b: End device * 010b: Edge expander device * 011b: Fanout expander device * Others: Reserved. */ MV_U8 DeviceType : 3; MV_U8 RestrictedByte0Bit7 : 1;#endif /* __MV_BIG_ENDIAN_BITFIELD__ *//* byte 1 */ MV_U8 RestrictedByte1;/* byte 2 */ MV_U8 InitiatorBits;/* byte 3 */ MV_U8 TargetBits;/* byte 4-11 */ MV_U8 DeviceName[8];/* byte 12-19 */ MV_U64 SASAddress;/* byte 20 */ MV_U8 PhyIdentifier;/* byte 21 */#if __MV_BIG_ENDIAN_BITFIELD__ MV_U8 ReservedByte21Bit1_7 : 7; MV_U8 BreakReplyCapable : 1;#else MV_U8 BreakReplyCapable : 1; MV_U8 ReservedByte21Bit1_7 : 7;#endif /* __MV_BIG_ENDIAN_BITFIELD__ *//* byte 22-27 */ MV_U8 ReservedByte22_27[6];/* byte 28-31 */ MV_U32 CRC;}; /* struct Identify *//*replaced by struct _OPEN_ADDRESS_FRAME */#if 0/* the Open address frame is used to send open requests */struct OpenAddress{ /* byte 0 */ MV_U8 AddressFrameType:4; /* ADDRESS_OPEN_FRAME=0x01 */ MV_U8 Protocol:3; /* 000b: SMP */ /* 001b: SSP */ /* 010b: STP */ MV_U8 InitiatorPort:1; /* 1: SourcePort is InitiatorPort */ /* 0: SourcePort is TargetPort */ /* byte 1 */ MV_U8 ConnectionRate:4; /* 0x8: 1.5 Gbps */ /* 0x9: 3.0 Gbps */ /* All others: reserved */ MV_U8 Features:4; /* set to 0 */ /* byte 2-3 */ MV_U16 InitiatorConnectionTag; /* byte 4-11 */ MV_U64 DestinationSASAddress; /* byte 12-19 */ MV_U64 SourceSASAddress; /* byte 20 */ MV_U8 CompatibleFeatures; /* set to 0 */ /* byte 21 */ MV_U8 PathwayBlockedCount; /* byte 22-23 */ MV_U16 ArbitrationWaitTime; /* byte 24-27 */ MV_U8 MoreCompatibleFeatures[4]; /* set to 0 */ /* byte 28-31 */ MV_U32 CRC;}; /* struct OpenAddress */#endif/* request specific bytes for a general input function */struct SMPRequestGeneralInput{ /* byte 4-7 */ MV_U32 CRC;};/* request specific bytes for a phy input function */struct SMPRequestPhyInput{ /* byte 4-7 */ MV_U8 IgnoredByte4_7[4]; /* byte 8 */ MV_U8 ReservedByte8; /* byte 9 */ MV_U8 PhyIdentifier; /* byte 10 */ MV_U8 IgnoredByte10; /* byte 11 */ MV_U8 ReservedByte11; /* byte 12-15 */ MV_U32 CRC;}; /* struct SMPRequestPhyInput *//* request specific bytes for a self configuration expander function */struct SMPRequestSelfConfigurationInput{ /* byte 4-6 */ MV_U8 IgnoredByte4_6[3]; /* byte 7 */ MV_U8 StartSelfConfigurationStatusDescriptorIndex; /* byte 8-11 */ MV_U32 CRC;}; /* struct SMPRequestSelfConfigurationInput *//* request specific bytes for a request route function */struct SMPRequestRouteInformationInput{ /* byte 4-5 */ MV_U8 IgnoredByte4_5[2]; /* byte 6-7 */ MV_U8 ExpanderRouteIndex[2]; /* byte 8 */ MV_U8 ReservedByte8; /* byte 9 */ MV_U8 PhyIdentifier; /* byte 10 */ MV_U8 IgnoredByte10; /* byte 11 */ MV_U8 ReservedByte11; /* byte 12-15 */ MV_U32 CRC;}; /* struct SMPRequestRouteInformationInput *//* request specific bytes for SMP DISCOVER LIST function */struct SMPRequestDiscoverList{ /* byte 4-7 */ MV_U8 ReservedByte4_7[4]; /* byte 8 */ MV_U8 StartingPhyIdentifier; /* byte 9 */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?