CommonDevices.asi 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. /** @file
  2. Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. **/
  5. //
  6. // Hardware Monitor
  7. Device(HM00) {
  8. Name(_HID, "APMC0D29")
  9. Name(_UID, "HWM0")
  10. Name(_DDN, "HWM0")
  11. Name(_CCA, ONE)
  12. Name(_STR, Unicode("Hardware Monitor Device"))
  13. Method(_STA, 0, NotSerialized) {
  14. return (0xF)
  15. }
  16. Name (_DSD, Package () {
  17. ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
  18. Package() {
  19. Package() {"pcc-channel", 14}
  20. }
  21. })
  22. }
  23. //
  24. // Hardware Monitor
  25. Device(HM01) {
  26. Name(_HID, "APMC0D29")
  27. Name(_UID, "HWM1")
  28. Name(_DDN, "HWM1")
  29. Name(_CCA, ONE)
  30. Name(_STR, Unicode("Hardware Monitor Device"))
  31. Method(_STA, 0, NotSerialized) {
  32. return (0xF)
  33. }
  34. Name (_DSD, Package () {
  35. ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
  36. Package() {
  37. Package() {"pcc-channel", 29}
  38. }
  39. })
  40. }
  41. //
  42. // Hardware Monitor
  43. Device(HM02) {
  44. Name(_HID, "AMPC0005")
  45. Name(_UID, "HWM2")
  46. Name(_DDN, "HWM2")
  47. Name(_CCA, ONE)
  48. Name(_STR, Unicode("Altra SoC Hardware Monitor Device"))
  49. Method(_STA, 0, NotSerialized) {
  50. return (0xF)
  51. }
  52. Name(_CRS, ResourceTemplate() {
  53. QWordMemory (
  54. ResourceProducer, // ResourceUsage
  55. PosDecode, // Decode
  56. MinFixed, // IsMinFixed
  57. MaxFixed, // IsMaxFixed
  58. Cacheable, // Cacheable
  59. ReadWrite, // ReadAndWrite
  60. 0x0000000000000000, // AddressGranularity - GRA
  61. 0x0000000088900000, // AddressMinimum - MIN
  62. 0x000000008891FFFF, // AddressMaximum - MAX
  63. 0x0000000000000000, // AddressTranslation - TRA
  64. 0x0000000000020000 // RangeLength - LEN
  65. )
  66. })
  67. }
  68. //
  69. // Hardware Monitor
  70. Device(HM03) {
  71. Name(_HID, "AMPC0005")
  72. Name(_UID, "HWM3")
  73. Name(_DDN, "HWM3")
  74. Name(_CCA, ONE)
  75. Name(_STR, Unicode("Altra SoC Hardware Monitor Device"))
  76. Method(_STA, 0, NotSerialized) {
  77. return (0xF)
  78. }
  79. Name(_CRS, ResourceTemplate() {
  80. QWordMemory (
  81. ResourceProducer, // ResourceUsage
  82. PosDecode, // Decode
  83. MinFixed, // IsMinFixed
  84. MaxFixed, // IsMaxFixed
  85. Cacheable, // Cacheable
  86. ReadWrite, // ReadAndWrite
  87. 0x0000000000000000, // AddressGranularity - GRA
  88. 0x00000000C0000000, // AddressMinimum - MIN
  89. 0x00000000C001FFFF, // AddressMaximum - MAX
  90. 0x0000000000000000, // AddressTranslation - TRA
  91. 0x0000000000020000 // RangeLength - LEN
  92. )
  93. })
  94. }
  95. //
  96. // DesignWare I2C on AHBC bus
  97. Device(I2C4) {
  98. Name(_HID, "APMC0D0F")
  99. Name(_UID, 4)
  100. Name(_STR, Unicode("Altra Max I2C Device"))
  101. Method(_STA, 0, NotSerialized) {
  102. return (0x0f)
  103. }
  104. Name(_CCA, ONE)
  105. Name(_CRS, ResourceTemplate() {
  106. QWordMemory (
  107. ResourceProducer, // ResourceUsage
  108. PosDecode, // Decode
  109. MinFixed, // IsMinFixed
  110. MaxFixed, // IsMaxFixed
  111. NonCacheable, // Cacheable
  112. ReadWrite, // ReadAndWrite
  113. 0x0000000000000000, // AddressGranularity - GRA
  114. 0x00001000026B0000, // AddressMinimum - MIN
  115. 0x00001000026BFFFF, // AddressMaximum - MAX
  116. 0x0000000000000000, // AddressTranslation - TRA
  117. 0x0000000000010000 // RangeLength - LEN
  118. )
  119. Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 105 }
  120. })
  121. Device (IPI) {
  122. Name(_HID, "AMPC0004")
  123. Name(_CID, "IPI0001")
  124. Name(_STR, Unicode("IPMI_SSIF"))
  125. Name(_UID, 0)
  126. Name(_CCA, ONE)
  127. Method(_STA, 0, NotSerialized) {
  128. Return (0x0f)
  129. }
  130. Method(_IFT) {
  131. Return(0x04) // IPMI SSIF
  132. }
  133. Method(_ADR) {
  134. Return(0x10) // SSIF slave address
  135. }
  136. Method(_SRV) {
  137. Return(0x0200) // IPMI Specification Revision
  138. }
  139. Name(_CRS, ResourceTemplate ()
  140. {
  141. I2cSerialBusV2 (0x0010, ControllerInitiated, 0x00061A80,
  142. AddressingMode7Bit, "\\_SB.I2C4",
  143. 0x00, ResourceConsumer,, Exclusive,
  144. // Vendor specific data:
  145. // "BMC0",
  146. // Flags (2 bytes): SMBUS variable length (Bit 0), Read Checksum (Bit 1), Verify Checksum (Bit 2)
  147. RawDataBuffer () { 0x42, 0x4D, 0x43, 0x30, 0x7, 0x0 }
  148. )
  149. })
  150. }
  151. Name(SSCN, Package() { 427, 499, 0 })
  152. Name(FMCN, Package() { 164, 319, 0 })
  153. }
  154. //
  155. // Report APEI Errors to GHES via SCI notification.
  156. // SCI notification requires one GED and one HED Device
  157. // GED = Generic Event Device (ACPI0013)
  158. // HED = Hardware Error Device (PNP0C33)
  159. //
  160. Device(GED0) {
  161. Name(_HID, "ACPI0013")
  162. Name(_UID, Zero)
  163. Method(_STA) {
  164. Return (0xF)
  165. }
  166. Name(_CRS, ResourceTemplate () {
  167. Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 84 } // GHES
  168. })
  169. }
  170. // Shutdown button using GED.
  171. Device(GED1) {
  172. Name(_HID, "ACPI0013")
  173. Name(_CID, "ACPI0013")
  174. Name(_UID, One)
  175. Method(_STA) {
  176. Return (0xF)
  177. }
  178. Name(_CRS, ResourceTemplate () {
  179. Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 327 }
  180. })
  181. OperationRegion(PDDR, SystemMemory, 0x1000027B0004, 4)
  182. Field(PDDR, DWordAcc, NoLock, Preserve) {
  183. STDI, 8
  184. }
  185. OperationRegion(INTE, SystemMemory, 0x1000027B0030, 4)
  186. Field(INTE, DWordAcc, NoLock, Preserve) {
  187. STDE, 8
  188. }
  189. OperationRegion(INTT, SystemMemory, 0x1000027B0034, 4)
  190. Field(INTT, DWordAcc, NoLock, Preserve) {
  191. TYPE, 8
  192. }
  193. OperationRegion(INTP, SystemMemory, 0x1000027B0038, 4)
  194. Field(INTP, DWordAcc, NoLock, Preserve) {
  195. POLA, 8
  196. }
  197. OperationRegion(INTS, SystemMemory, 0x1000027B003c, 4)
  198. Field(INTS, DWordAcc, NoLock, Preserve) {
  199. STDS, 8
  200. }
  201. OperationRegion(INTC, SystemMemory, 0x1000027B0040, 4)
  202. Field(INTC, DWordAcc, NoLock, Preserve) {
  203. SINT, 8
  204. }
  205. OperationRegion(INTM, SystemMemory, 0x1000027B0044, 4)
  206. Field(INTM, DWordAcc, NoLock, Preserve) {
  207. MASK, 8
  208. }
  209. Method(_INI, 0, NotSerialized) {
  210. // Set level type, low active (shutdown)
  211. Store (0x00, TYPE)
  212. Store (0x00, POLA)
  213. // Set Input type (shutdown)
  214. Store (0x00, STDI)
  215. // Enable interrupt (shutdown)
  216. Store (0x80, STDE)
  217. // Unmask the interrupt.
  218. Store (0x00, MASK)
  219. }
  220. Method(_EVT, 1) {
  221. Switch (ToInteger(Arg0)) {
  222. Case (327) {
  223. if (And (STDS, 0x80)) {
  224. //Clear the interrupt.
  225. Store (0x80, SINT)
  226. // Notify OSPM the power button is pressed
  227. Notify (\_SB.PWRB, 0x80)
  228. }
  229. }
  230. }
  231. }
  232. }
  233. // Power button device description
  234. Device(PWRB) {
  235. Name(_HID, EISAID("PNP0C0C"))
  236. Name(_ADR, 0)
  237. Name(_UID, 0)
  238. Name(_CCA, ONE)
  239. Method(_STA, 0, Notserialized) {
  240. Return (0x0b)
  241. }
  242. }
  243. //
  244. // UART0 PL011
  245. Device(URT0) {
  246. Name(_HID, "ARMH0011")
  247. Name(_UID, 0)
  248. Name(_CCA, ONE)
  249. Method(_STA, 0, NotSerialized) {
  250. return (0x0f)
  251. }
  252. Name(_CRS, ResourceTemplate() {
  253. QWordMemory (
  254. ResourceProducer, // ResourceUsage
  255. PosDecode, // Decode
  256. MinFixed, // IsMinFixed
  257. MaxFixed, // IsMaxFixed
  258. NonCacheable, // Cacheable
  259. ReadWrite, // ReadAndWrite
  260. 0x0000000000000000, // AddressGranularity - GRA
  261. 0x0000100002600000, // AddressMinimum - MIN
  262. 0x0000100002600FFF, // AddressMaximum - MAX
  263. 0x0000000000000000, // AddressTranslation - TRA
  264. 0x0000000000001000 // RangeLength - LEN
  265. )
  266. Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 98 }
  267. })
  268. } // UART0
  269. //
  270. // UART2 PL011
  271. Device(URT2) {
  272. Name(_HID, "ARMH0011")
  273. Name(_UID, 1)
  274. Name(_CCA, ONE)
  275. Method(_STA, 0, NotSerialized) {
  276. return (0x0f)
  277. }
  278. Name(_CRS, ResourceTemplate() {
  279. QWordMemory (
  280. ResourceProducer, // ResourceUsage
  281. PosDecode, // Decode
  282. MinFixed, // IsMinFixed
  283. MaxFixed, // IsMaxFixed
  284. NonCacheable, // Cacheable
  285. ReadWrite, // ReadAndWrite
  286. 0x0000000000000000, // AddressGranularity - GRA
  287. 0x0000100002620000, // AddressMinimum - MIN
  288. 0x0000100002620FFF, // AddressMaximum - MAX
  289. 0x0000000000000000, // AddressTranslation - TRA
  290. 0x0000000000001000 // RangeLength - LEN
  291. )
  292. Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 100 }
  293. })
  294. } // UART1
  295. Device(HED0)
  296. {
  297. Name(_HID, EISAID("PNP0C33"))
  298. Name(_UID, Zero)
  299. }
  300. Device(NVDR) {
  301. Name(_HID, "ACPI0012")
  302. Method(_STA, 0, NotSerialized) {
  303. return (0xf)
  304. }
  305. Method (_DSM, 0x4, Serialized) {
  306. // Not support any functions for now
  307. Return (Buffer() {0})
  308. }
  309. Device (NVD1) {
  310. Name(_ADR, 0x0330) //NFIT Device Handle (SK0, MCU3, Channel 3, Slot 0)
  311. Name(SMRT, Buffer(13) {0})
  312. CreateDWordField(SMRT, 0, BSTA)
  313. CreateWordField(SMRT, 4, BHTH)
  314. CreateWordField(SMRT, 6, BTMP)
  315. CreateByteField(SMRT, 8, BETH)
  316. CreateByteField(SMRT, 9, BWTH)
  317. CreateByteField(SMRT, 10, BNLF)
  318. OperationRegion(BUF1, SystemMemory, 0x88980000, 16)
  319. Field (BUF1, DWordAcc, NoLock, Preserve) {
  320. STAT, 32, //Status
  321. HLTH, 16, //Module Health
  322. CTMP, 16, //Module Current Status
  323. ETHS, 8, //Error Threshold Status
  324. WTHS, 8, //Warning Threshold Status
  325. NVLF, 8, //NVM Lifetime
  326. , 40 //Reserve
  327. }
  328. Method (_DSM, 0x4, Serialized) {
  329. //Accept only MSF Family type NVDIMM DSM functions
  330. If(LEqual(Arg0, ToUUID ("1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05"))) {
  331. //Handle Func 0 query implemented commands
  332. If(LEqual(Arg2, 0)) {
  333. //Check revision and returned proper implemented commands
  334. //Support only health check for now
  335. Return (Buffer() {0x01, 0x08}) //Byte 0: 0x1
  336. }
  337. //Handle MSF DSM Func 11 Get Smart and Health Info
  338. If(LEqual(Arg2, 11)) {
  339. Store(\_SB.NVDR.NVD1.STAT, BSTA)
  340. Store(\_SB.NVDR.NVD1.HLTH, BHTH)
  341. Store(\_SB.NVDR.NVD1.CTMP, BTMP)
  342. Store(\_SB.NVDR.NVD1.ETHS, BETH)
  343. Store(\_SB.NVDR.NVD1.WTHS, BWTH)
  344. Store(\_SB.NVDR.NVD1.NVLF, BNLF)
  345. Return (SMRT)
  346. }
  347. }
  348. Return (Buffer() {0})
  349. }
  350. Method(_STA, 0, NotSerialized) {
  351. return (0xf)
  352. }
  353. }
  354. Device (NVD2) {
  355. Name(_ADR, 0x0770) //NFIT Device Handle (SK0, MCU7, Channel 7, Slot 0)
  356. Name(SMRT, Buffer(13) {0})
  357. CreateDWordField(SMRT, 0, BSTA)
  358. CreateWordField(SMRT, 4, BHTH)
  359. CreateWordField(SMRT, 6, BTMP)
  360. CreateByteField(SMRT, 8, BETH)
  361. CreateByteField(SMRT, 9, BWTH)
  362. CreateByteField(SMRT, 10, BNLF)
  363. OperationRegion(BUF1, SystemMemory, 0x88988000, 16)
  364. Field (BUF1, DWordAcc, NoLock, Preserve) {
  365. STAT, 32, //Status
  366. HLTH, 16, //Module Health
  367. CTMP, 16, //Module Current Status
  368. ETHS, 8, //Error Threshold Status
  369. WTHS, 8, //Warning Threshold Status
  370. NVLF, 8, //NVM Lifetime
  371. , 40 //Reserve
  372. }
  373. Method (_DSM, 0x4, Serialized) {
  374. //Accept only MSF Family type NVDIMM DSM functions
  375. If(LEqual(Arg0, ToUUID ("1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05"))) {
  376. //Handle Func 0 query implemented commands
  377. If(LEqual(Arg2, 0)) {
  378. //Check revision and returned proper implemented commands
  379. //Support only health check for now
  380. Return (Buffer() {0x01, 0x08}) //Byte 0: 0x1
  381. }
  382. //Handle MSF DSM Func 11 Get Smart and Health Info
  383. If(LEqual(Arg2, 11)) {
  384. Store(\_SB.NVDR.NVD2.STAT, BSTA)
  385. Store(\_SB.NVDR.NVD2.HLTH, BHTH)
  386. Store(\_SB.NVDR.NVD2.CTMP, BTMP)
  387. Store(\_SB.NVDR.NVD2.ETHS, BETH)
  388. Store(\_SB.NVDR.NVD2.WTHS, BWTH)
  389. Store(\_SB.NVDR.NVD2.NVLF, BNLF)
  390. Return (SMRT)
  391. }
  392. }
  393. Return (Buffer() {0})
  394. }
  395. Method(_STA, 0, NotSerialized) {
  396. return (0xf)
  397. }
  398. }
  399. Device (NVD3) {
  400. Name(_ADR, 0x1330) //NFIT Device Handle (SK1, MCU3, Channel 3, Slot 0)
  401. Name(SMRT, Buffer(13) {0})
  402. CreateDWordField(SMRT, 0, BSTA)
  403. CreateWordField(SMRT, 4, BHTH)
  404. CreateWordField(SMRT, 6, BTMP)
  405. CreateByteField(SMRT, 8, BETH)
  406. CreateByteField(SMRT, 9, BWTH)
  407. CreateByteField(SMRT, 10, BNLF)
  408. OperationRegion(BUF1, SystemMemory, 0xC0080000, 16)
  409. Field (BUF1, DWordAcc, NoLock, Preserve) {
  410. STAT, 32, //Status
  411. HLTH, 16, //Module Health
  412. CTMP, 16, //Module Current Status
  413. ETHS, 8, //Error Threshold Status
  414. WTHS, 8, //Warning Threshold Status
  415. NVLF, 8, //NVM Lifetime
  416. , 40 //Reserve
  417. }
  418. Method (_DSM, 0x4, Serialized) {
  419. //Accept only MSF Family type NVDIMM DSM functions
  420. If(LEqual(Arg0, ToUUID ("1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05"))) {
  421. //Handle Func 0 query implemented commands
  422. If(LEqual(Arg2, 0)) {
  423. //Check revision and returned proper implemented commands
  424. //Support only health check for now
  425. Return (Buffer() {0x01, 0x08}) //Byte 0: 0x1
  426. }
  427. //Handle MSF DSM Func 11 Get Smart and Health Info
  428. If(LEqual(Arg2, 11)) {
  429. Store(\_SB.NVDR.NVD3.STAT, BSTA)
  430. Store(\_SB.NVDR.NVD3.HLTH, BHTH)
  431. Store(\_SB.NVDR.NVD3.CTMP, BTMP)
  432. Store(\_SB.NVDR.NVD3.ETHS, BETH)
  433. Store(\_SB.NVDR.NVD3.WTHS, BWTH)
  434. Store(\_SB.NVDR.NVD3.NVLF, BNLF)
  435. Return (SMRT)
  436. }
  437. }
  438. Return (Buffer() {0})
  439. }
  440. Method(_STA, 0, NotSerialized) {
  441. return (0xf)
  442. }
  443. }
  444. Device (NVD4) {
  445. Name(_ADR, 0x1770) //NFIT Device Handle (SK1, MCU7, Channel 7, Slot 0)
  446. Name(SMRT, Buffer(13) {0})
  447. CreateDWordField(SMRT, 0, BSTA)
  448. CreateWordField(SMRT, 4, BHTH)
  449. CreateWordField(SMRT, 6, BTMP)
  450. CreateByteField(SMRT, 8, BETH)
  451. CreateByteField(SMRT, 9, BWTH)
  452. CreateByteField(SMRT, 10, BNLF)
  453. OperationRegion(BUF1, SystemMemory, 0xC0088000, 16)
  454. Field (BUF1, DWordAcc, NoLock, Preserve) {
  455. STAT, 32, //Status
  456. HLTH, 16, //Module Health
  457. CTMP, 16, //Module Current Status
  458. ETHS, 8, //Error Threshold Status
  459. WTHS, 8, //Warning Threshold Status
  460. NVLF, 8, //NVM Lifetime
  461. , 40 //Reserve
  462. }
  463. Method (_DSM, 0x4, Serialized) {
  464. //Accept only MSF Family type NVDIMM DSM functions
  465. If(LEqual(Arg0, ToUUID ("1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05"))) {
  466. //Handle Func 0 query implemented commands
  467. If(LEqual(Arg2, 0)) {
  468. //Check revision and returned proper implemented commands
  469. //Support only health check for now
  470. Return (Buffer() {0x01, 0x08}) //Byte 0: 0x1
  471. }
  472. //Handle MSF DSM Func 11 Get Smart and Health Info
  473. If(LEqual(Arg2, 11)) {
  474. Store(\_SB.NVDR.NVD4.STAT, BSTA)
  475. Store(\_SB.NVDR.NVD4.HLTH, BHTH)
  476. Store(\_SB.NVDR.NVD4.CTMP, BTMP)
  477. Store(\_SB.NVDR.NVD4.ETHS, BETH)
  478. Store(\_SB.NVDR.NVD4.WTHS, BWTH)
  479. Store(\_SB.NVDR.NVD4.NVLF, BNLF)
  480. Return (SMRT)
  481. }
  482. }
  483. Return (Buffer() {0})
  484. }
  485. Method(_STA, 0, NotSerialized) {
  486. return (0xf)
  487. }
  488. }
  489. }