hwconf.c
上传用户:dqzhongke1
上传日期:2022-06-26
资源大小:667k
文件大小:10k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* hwconf.c - Hardware configuration support module */
  2. /*
  3.  * Copyright (c) 2006-2007 Wind River Systems, Inc.
  4.  *
  5.  * The right to copy, distribute, modify or otherwise make use
  6.  * of this software may be licensed only pursuant to the terms
  7.  * of an applicable Wind River license agreement.
  8.  */
  9. /*
  10. modification history
  11. --------------------
  12. 01d,09apr07,b_m  modify to use m85xxCCSR driver.
  13. 01c,09mar06,wap  Allow either mottsec or motetsec driver to be used
  14.                  (SPR #118829)
  15. 01b,07feb06,wap  Add VxBus parameter table
  16. 01a,16jan06,dtr  written.
  17. */
  18. #include <vxWorks.h>
  19. #include <vxBusLib.h>
  20. #include <hwif/vxbus/vxBus.h>
  21. #include <hwif/vxbus/vxbPlbLib.h>
  22. #include <hwif/vxbus/hwConf.h>
  23. #include <../src/hwif/h/vxbus/vxbRapidIO.h>
  24. #include <hwif/util/vxbParamSys.h>
  25. #include <config.h>
  26. const struct hcfResource motEtsecHEnd0Resources[] = {
  27.     { "regBase", HCF_RES_INT, { (void *)(CCSBAR + 0x24000) } },
  28.     { "txInt", HCF_RES_INT, { (void *)EPIC_TSEC1TX_INT_VEC } },
  29.     { "txIntLevel", HCF_RES_INT, { (void *)EPIC_TSEC1TX_INT_VEC } },
  30.     { "rxInt", HCF_RES_INT, { (void *)EPIC_TSEC1RX_INT_VEC } },
  31.     { "rxIntLevel", HCF_RES_INT, { (void *)EPIC_TSEC1RX_INT_VEC } },
  32.     { "errInt", HCF_RES_INT, { (void *)EPIC_TSEC1ERR_INT_VEC } },
  33.     { "errIntLevel", HCF_RES_INT, { (void *)EPIC_TSEC1ERR_INT_VEC } },
  34. };
  35. #define etsecHEnd0Num 7
  36. const struct hcfResource motEtsecHEnd1Resources[] = {
  37.     { "regBase", HCF_RES_INT, { (void *)(CCSBAR + 0x25000) } },
  38.     { "txInt", HCF_RES_INT, { (void *)EPIC_TSEC2TX_INT_VEC } },
  39.     { "txIntLevel", HCF_RES_INT, { (void *)EPIC_TSEC2TX_INT_VEC } },
  40.     { "rxInt", HCF_RES_INT, { (void *)EPIC_TSEC2RX_INT_VEC } },
  41.     { "rxIntLevel", HCF_RES_INT, { (void *)EPIC_TSEC2RX_INT_VEC } },
  42.     { "errInt", HCF_RES_INT, { (void *)EPIC_TSEC2ERR_INT_VEC } },
  43.     { "errIntLevel", HCF_RES_INT, { (void *)EPIC_TSEC2ERR_INT_VEC } },
  44. };
  45. #define etsecHEnd1Num 7
  46. const struct hcfResource motEtsecHEnd2Resources[] = {
  47.     { "regBase", HCF_RES_INT, { (void *)(CCSBAR + 0x26000) } },
  48.     { "txInt", HCF_RES_INT, { (void *)EPIC_TSEC3TX_INT_VEC } },
  49.     { "txIntLevel", HCF_RES_INT, { (void *)EPIC_TSEC3TX_INT_VEC } },
  50.     { "rxInt", HCF_RES_INT, { (void *)EPIC_TSEC3RX_INT_VEC } },
  51.     { "rxIntLevel", HCF_RES_INT, { (void *)EPIC_TSEC3RX_INT_VEC } },
  52.     { "errInt", HCF_RES_INT, { (void *)EPIC_TSEC3ERR_INT_VEC } },
  53.     { "errIntLevel", HCF_RES_INT, { (void *)EPIC_TSEC3ERR_INT_VEC } },
  54. };
  55. #define etsecHEnd2Num 7
  56. const struct hcfResource motEtsecHEnd3Resources[] = {
  57.     { "regBase", HCF_RES_INT, { (void *)(CCSBAR + 0x27000) } },
  58.     { "txInt", HCF_RES_INT, { (void *)EPIC_TSEC4TX_INT_VEC } },
  59.     { "txIntLevel", HCF_RES_INT, { (void *)EPIC_TSEC4TX_INT_VEC } },
  60.     { "rxInt", HCF_RES_INT, { (void *)EPIC_TSEC4RX_INT_VEC } },
  61.     { "rxIntLevel", HCF_RES_INT, { (void *)EPIC_TSEC4RX_INT_VEC } },
  62.     { "errInt", HCF_RES_INT, { (void *)EPIC_TSEC4ERR_INT_VEC } },
  63.     { "errIntLevel", HCF_RES_INT, { (void *)EPIC_TSEC4ERR_INT_VEC } },
  64. };
  65. #define etsecHEnd3Num 7
  66. /*
  67.  * On the SBC8548 board, PHYs are physically wired according
  68.  * to the following table:
  69.  *
  70.  *  Data port pins Management port pins MII address
  71.  * -------------- -------------------- -----------
  72.  * PHY0:        TSEC0           TSEC0                   1 
  73.  * PHY1:        TSEC1           TSEC0                   2
  74.  * PHY2: (note) TSEC2           TSEC0                   3 (note)
  75.  * PHY3: (note) TSEC3           TSEC0                   4 (note)
  76.  *
  77.  * The tricky part is that the PHYs have their management pins
  78.  * connected to TSEC0. We have to make it look like PHY1 is connected
  79.  * to TSEC1, so we provide a remapping resource that will cause
  80.  * PHY1 to be attached to miibus1 instead of miibus0.
  81.  *
  82.  * Note: PHY2 and PHY3 do not exist on the SBC8548, but the corresponding
  83.  * TSEC signals are routed to a high-speed expansion connector. So, as a
  84.  * placeholder for the following structures, addresses 27 and 28 were
  85.  * entered for the phyAddr fields.
  86.  *
  87.  */
  88. const struct hcfResource phy0Resources[] = {
  89.     { "realBus", HCF_RES_INT, { (void *)0 } },
  90.     { "phyAddr", HCF_RES_INT, { (void *)1 } },
  91.     { "virtBus", HCF_RES_INT, { (void *)0 } }
  92. };
  93. #define phy0Num NELEMENTS(phy0Resources)
  94. const struct hcfResource phy1Resources[] = {
  95.     { "realBus", HCF_RES_INT, { (void *)0 } },
  96.     { "phyAddr", HCF_RES_INT, { (void *)2 } },
  97.     { "virtBus", HCF_RES_INT, { (void *)1 } }
  98. };
  99. #define phy1Num NELEMENTS(phy1Resources)
  100. const struct hcfResource phy2Resources[] = {
  101.     { "realBus", HCF_RES_INT, { (void *)0 } },
  102.     { "phyAddr", HCF_RES_INT, { (void *)3 } },
  103.     { "virtBus", HCF_RES_INT, { (void *)2 } }
  104. };
  105. #define phy2Num NELEMENTS(phy2Resources)
  106. const struct hcfResource phy3Resources[] = {
  107.     { "realBus", HCF_RES_INT, { (void *)0 } },
  108.     { "phyAddr", HCF_RES_INT, { (void *)4 } },
  109.     { "virtBus", HCF_RES_INT, { (void *)3 } }
  110. };
  111. #define phy3Num NELEMENTS(phy3Resources)
  112. #ifdef INCLUDE_RAPIDIO_BUS
  113. const struct hcfResource m85xxRio0Resources[] = {
  114. { "regBase", HCF_RES_INT, {(void *)RAPIDIO_BASE} },
  115. { "deviceBase", HCF_RES_INT, {(void *)(RAPIDIO_ADRS + 0x0000000)}},
  116. { "deviceSize", HCF_RES_INT, {(void *)(RAPIDIO_SIZE - 0x0000000)}},
  117. { "rioBusAdrs", HCF_RES_INT, {(void *)RAPIDIO_BUS_ADRS }},
  118. { "rioBusSize", HCF_RES_INT, {(void *)RAPIDIO_BUS_SIZE }}
  119. };
  120. #define m85xxRio0Num    NELEMENTS(m85xxRio0Resources)
  121. const struct hcfResource m85xxCPU0Resources[] = {
  122. { "regBase", HCF_RES_INT, {(void *)RAPIDIO_BASE }},
  123. { "targetID", HCF_RES_INT, {(void *)0 }},
  124. { "outboundWindow0",     HCF_RES_INT, {(void *)RIO_CHANNEL_RESERVED }},
  125. { "outboundWindow1",     HCF_RES_INT, {(void *)RIO_CHANNEL_MAINT }},
  126. { "outboundWindow2",     HCF_RES_INT, {(void *)RIO_CHANNEL_CFG }},
  127. { "outboundWindow3",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  128. { "outboundWindow4",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  129. { "outboundWindow5",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  130. { "outboundWindow6",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  131. { "outboundWindow7",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  132. { "outboundWindow8",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  133. { "inboundWindow0",     HCF_RES_INT, {(void *)RIO_CHANNEL_RESERVED }},
  134. { "inboundWindow1",     HCF_RES_INT, {(void *)RIO_CHANNEL_SM }},
  135. { "inboundWindow2",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  136. { "inboundWindow3",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  137. { "inboundWindow4",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }}
  138. };
  139. #define m85xxCPU0Num    NELEMENTS(m85xxCPU0Resources)
  140. const struct hcfResource m85xxCPU1Resources[] = {
  141. { "regBase", HCF_RES_INT, {(void *)RAPIDIO_BASE }},
  142. { "targetID", HCF_RES_INT, {(void *) 0x9 }},
  143. { "hopCount", HCF_RES_INT, {(void *) 0x0 }},
  144. { "outboundWindow0",     HCF_RES_INT, {(void *)RIO_CHANNEL_RESERVED }},
  145. { "outboundWindow1",     HCF_RES_INT, {(void *)RIO_CHANNEL_SM }},
  146. { "outboundWindow2",     HCF_RES_INT, {(void *)RIO_CHANNEL_TAS_SET }},
  147. { "outboundWindow3",     HCF_RES_INT, {(void *)RIO_CHANNEL_TAS_CLEAR }},
  148. { "outboundWindow4",     HCF_RES_INT, {(void *)RIO_CHANNEL_DOORBELL }},
  149. { "outboundWindow5",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  150. { "outboundWindow6",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  151. { "outboundWindow7",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  152. { "outboundWindow8",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  153. { "inboundWindow0",     HCF_RES_INT, {(void *) RIO_CHANNEL_RESERVED}},
  154. { "inboundWindow1",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  155. { "inboundWindow2",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  156. { "inboundWindow3",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }},
  157. { "inboundWindow4",     HCF_RES_INT, {(void *)RIO_CHANNEL_UNRESERVED }}
  158. };
  159. #define m85xxCPU1Num    NELEMENTS(m85xxCPU1Resources)
  160. const struct hcfResource m85xxLawBarResources[] = {
  161. { "regBase", HCF_RES_INT, {(void *)CCSBAR} },
  162. { "LAWBAR0", HCF_RES_STRING, {"reserved"} },
  163. { "LAWBAR1", HCF_RES_STRING, {"reserved"} },
  164. { "LAWBAR2", HCF_RES_STRING, {"reserved"} },
  165. { "LAWBAR3", HCF_RES_STRING, {"reserved"} },
  166. { "LAWBAR4", HCF_RES_STRING, {"reserved"} },
  167. { "LAWBAR5", HCF_RES_STRING, {"reserved"} },
  168. { "LAWBAR6", HCF_RES_STRING, {"reserved"} },
  169. { "LAWBAR7", HCF_RES_STRING, {"m85xxRio"} }
  170. };
  171. #define m85xxLawBarNum    NELEMENTS(m85xxLawBarResources)
  172. const struct hcfResource smEnd0Resources[] = {
  173. { "regBase", HCF_RES_INT, {(void *)CCSBAR} },
  174. { "SM_ANCHOR_OFFSET", HCF_RES_INT, {(void *)SM_ANCHOR_OFFSET}},
  175. { "SM_MEM_ADRS", HCF_RES_INT,{(void *)SM_MEM_ADRS }},
  176. { "SM_MEM_SIZE", HCF_RES_INT,{(void *)SM_MEM_SIZE}},
  177. { "SM_TAS_TYPE", HCF_RES_INT,{(void *)SM_TAS_TYPE} },
  178. { "SM_INT_TYPE", HCF_RES_INT,{(void *)SM_INT_TYPE} },
  179. { "SM_INT_ARG1", HCF_RES_INT,{(void *)SM_INT_ARG1}},
  180. { "SM_INT_ARG2", HCF_RES_INT, {(void *)SM_INT_ARG2}},
  181. { "SM_INT_ARG3", HCF_RES_INT, {(void *)SM_INT_ARG3}},
  182. { "SM_MBLK_NUM", HCF_RES_INT, {(void *)600}},
  183. { "SM_CBLK_NUM", HCF_RES_INT, {(void *)200}}
  184. };
  185. #define smEnd0Num    NELEMENTS(smEnd0Resources)
  186. #endif /* INCLUDE_RAPIDIO_BUS */
  187. const struct hcfDevice hcfDeviceList[] = {
  188. #ifdef INCLUDE_MOT_TSEC_HEND
  189.     { "mottsecHEnd", 0, VXB_BUSID_PLB, 0, etsecHEnd0Num, motEtsecHEnd0Resources },
  190.     { "mottsecHEnd", 1, VXB_BUSID_PLB, 0, etsecHEnd1Num, motEtsecHEnd1Resources },
  191.     { "mottsecHEnd", 2, VXB_BUSID_PLB, 0, etsecHEnd2Num, motEtsecHEnd2Resources },
  192.     { "mottsecHEnd", 3, VXB_BUSID_PLB, 0, etsecHEnd3Num, motEtsecHEnd3Resources },
  193. #endif
  194. #ifdef INCLUDE_MOT_ETSEC_HEND
  195.     { "motetsecHEnd", 0, VXB_BUSID_PLB, 0, etsecHEnd0Num, motEtsecHEnd0Resources },
  196.     { "motetsecHEnd", 1, VXB_BUSID_PLB, 0, etsecHEnd1Num, motEtsecHEnd1Resources },
  197.     { "motetsecHEnd", 2, VXB_BUSID_PLB, 0, etsecHEnd2Num, motEtsecHEnd2Resources },
  198.     { "motetsecHEnd", 3, VXB_BUSID_PLB, 0, etsecHEnd3Num, motEtsecHEnd3Resources },
  199. #endif
  200.     { "phy", 0, VXB_BUSID_MII, 0, phy0Num, phy0Resources },
  201.     { "phy", 1, VXB_BUSID_MII, 0, phy1Num, phy1Resources },
  202.     { "phy", 2, VXB_BUSID_MII, 0, phy2Num, phy2Resources },
  203.     { "phy", 3, VXB_BUSID_MII, 0, phy3Num, phy3Resources },
  204. #ifdef INCLUDE_RAPIDIO_BUS
  205.     { "m85xxRio", 0, VXB_BUSID_PLB, 0, m85xxRio0Num, m85xxRio0Resources },
  206.     { "m85xxCPU", 0, VXB_BUSID_RAPIDIO, 0, m85xxCPU0Num, m85xxCPU0Resources },
  207.     { "m85xxCPU", 1, VXB_BUSID_RAPIDIO, 0, m85xxCPU1Num, m85xxCPU1Resources },
  208.     { "m85xxCCSR", 0, VXB_BUSID_PLB, 0, m85xxLawBarNum, m85xxLawBarResources },
  209.     { "smEnd", 0, VXB_BUSID_PLB,0, smEnd0Num, smEnd0Resources}
  210. #endif
  211. };
  212. const int hcfDeviceNum = NELEMENTS(hcfDeviceList);
  213. VXB_INST_PARAM_OVERRIDE sysInstParamTable[] =
  214.     {
  215.     { NULL, 0, NULL, VXB_PARAM_END_OF_LIST, {(void *)0} }
  216.     };