cpu-hotplug.asl 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* CPU hotplug */
  2. Scope(\_SB) {
  3. /* Objects filled in by run-time generated SSDT */
  4. External(NTFY, MethodObj)
  5. External(CPON, PkgObj)
  6. /* Methods called by run-time generated SSDT Processor objects */
  7. Method(CPMA, 1, NotSerialized) {
  8. /*
  9. * _MAT method - create an madt apic buffer
  10. * Arg0 = Processor ID = Local APIC ID
  11. * Local0 = CPON flag for this cpu
  12. */
  13. Store(DerefOf(Index(CPON, Arg0)), Local0)
  14. /* Local1 = Buffer (in madt apic form) to return */
  15. Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
  16. /* Update the processor id, lapic id, and enable/disable status */
  17. Store(Arg0, Index(Local1, 2))
  18. Store(Arg0, Index(Local1, 3))
  19. Store(Local0, Index(Local1, 4))
  20. Return (Local1)
  21. }
  22. Method(CPST, 1, NotSerialized) {
  23. /*
  24. * _STA method - return ON status of cpu
  25. * Arg0 = Processor ID = Local APIC ID
  26. * Local0 = CPON flag for this cpu
  27. */
  28. Store(DerefOf(Index(CPON, Arg0)), Local0)
  29. If (Local0) {
  30. Return (0xf)
  31. } Else {
  32. Return (0x0)
  33. }
  34. }
  35. Method(CPEJ, 2, NotSerialized) {
  36. /* _EJ0 method - eject callback */
  37. Sleep(200)
  38. }
  39. /* CPU hotplug notify method */
  40. OperationRegion(PRST, SystemIO, 0xaf00, 32)
  41. Field(PRST, ByteAcc, NoLock, Preserve) {
  42. PRS, 256
  43. }
  44. Method(PRSC, 0) {
  45. /* Local5 = active cpu bitmap */
  46. Store(PRS, Local5)
  47. /* Local2 = last read byte from bitmap */
  48. Store(Zero, Local2)
  49. /* Local0 = Processor ID / APIC ID iterator */
  50. Store(Zero, Local0)
  51. While (LLess(Local0, SizeOf(CPON))) {
  52. /* Local1 = CPON flag for this cpu */
  53. Store(DerefOf(Index(CPON, Local0)), Local1)
  54. If (And(Local0, 0x07)) {
  55. /* Shift down previously read bitmap byte */
  56. ShiftRight(Local2, 1, Local2)
  57. } Else {
  58. /* Read next byte from cpu bitmap */
  59. Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
  60. }
  61. /* Local3 = active state for this cpu */
  62. Store(And(Local2, 1), Local3)
  63. If (LNotEqual(Local1, Local3)) {
  64. /* State change - update CPON with new state */
  65. Store(Local3, Index(CPON, Local0))
  66. /* Do CPU notify */
  67. If (LEqual(Local3, 1)) {
  68. NTFY(Local0, 1)
  69. } Else {
  70. NTFY(Local0, 3)
  71. }
  72. }
  73. Increment(Local0)
  74. }
  75. }
  76. }