|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | + |
| 3 | +#define GPS_DSM_GUID "A3132D01-8CDA-49BA-A52E-BC9D46DF6B81" |
| 4 | +#define GPS_REVISION_ID 0x00000200 |
| 5 | +#define GPS_FUNC_SUPPORT 0x00000000 |
| 6 | +#define GPS_FUNC_PSHARESTATUS 0x00000020 |
| 7 | +#define GPS_FUNC_PSHAREPARAMS 0x0000002A |
| 8 | + |
| 9 | +Method(GPS, 2, Serialized) { |
| 10 | + Printf(" GPU GPS") |
| 11 | + Switch(ToInteger(Arg0)) { |
| 12 | + Case(GPS_FUNC_SUPPORT) { |
| 13 | + Printf(" Supported Functions") |
| 14 | + Return(ITOB( |
| 15 | + (1 << GPS_FUNC_SUPPORT) | |
| 16 | + (1 << GPS_FUNC_PSHARESTATUS) | |
| 17 | + (1 << GPS_FUNC_PSHAREPARAMS) |
| 18 | + )) |
| 19 | + } |
| 20 | + Case(GPS_FUNC_PSHARESTATUS) { |
| 21 | + Printf(" Power Share Status") |
| 22 | + Return(ITOB(0)) |
| 23 | + } |
| 24 | + Case(GPS_FUNC_PSHAREPARAMS) { |
| 25 | + Printf(" Power Share Parameters") |
| 26 | + |
| 27 | + CreateField(Arg1, 0, 4, QTYP) // Query type |
| 28 | + |
| 29 | + Name(GPSP, Buffer(36) { 0x00 }) |
| 30 | + CreateDWordField(GPSP, 0, RSTS) // Response status |
| 31 | + CreateDWordField(GPSP, 4, VERS) // Version |
| 32 | + |
| 33 | + // Set query type of response |
| 34 | + RSTS = QTYP |
| 35 | + // Set version of response |
| 36 | + VERS = 0x00010000 |
| 37 | + |
| 38 | + Switch(ToInteger(QTYP)) { |
| 39 | + Case(0) { |
| 40 | + Printf(" Request Current Information") |
| 41 | + // No required information |
| 42 | + Return(GPSP) |
| 43 | + } |
| 44 | + Case(1) { |
| 45 | + Printf(" Request Supported Fields") |
| 46 | + // Support GPU temperature field |
| 47 | + RSTS |= (1 << 8) |
| 48 | + Return(GPSP) |
| 49 | + } |
| 50 | + Case(2) { |
| 51 | + Printf(" Request Current Limits") |
| 52 | + // No required limits |
| 53 | + Return(GPSP) |
| 54 | + } |
| 55 | + Default { |
| 56 | + Printf(" Unknown Query: %o", SFST(QTYP)) |
| 57 | + Return(NV_ERROR_UNSUPPORTED) |
| 58 | + } |
| 59 | + } |
| 60 | + } |
| 61 | + Default { |
| 62 | + Printf(" Unsupported function: %o", SFST(Arg0)) |
| 63 | + Return(NV_ERROR_UNSUPPORTED) |
| 64 | + } |
| 65 | + } |
| 66 | +} |
0 commit comments