Skip to content

Commit fdea2c7

Browse files
authored
added support for extended device state (#464)
Signed-off-by: Joshua Santosh Ranjan <joshua.santosh.ranjan@intel.com>
1 parent d0f1514 commit fdea2c7

4 files changed

Lines changed: 133 additions & 1 deletion

File tree

scripts/sysman/EXT_DeviceState.rst

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<%
2+
import re
3+
from templates import helper as th
4+
%><%
5+
OneApi=tags['$OneApi']
6+
x=tags['$x']
7+
X=x.upper()
8+
s=tags['$s']
9+
S=s.upper()
10+
%>
11+
:orphan:
12+
13+
.. _ZES_extension_device_state:
14+
15+
============================
16+
Device State Extension
17+
============================
18+
19+
API
20+
----
21+
22+
* Enumerations
23+
* ${s}_device_ext_state_version_t
24+
* ${s}_device_state_ext_flags_t
25+
26+
* Structures
27+
28+
* ${s}_device_ext_state_t
29+
30+
31+
Device State
32+
~~~~~~~~~~~~~~
33+
34+
This extension provides additional device state information beyond the basic reset and repair status
35+
available through the standard ${s}DeviceGetState API. The extension allows applications to query
36+
extended device states including wedged condition, survivability mode, and flash override status.
37+
38+
The ${s}_device_ext_state_t structure can be passed via the pNext chain of ${s}_device_state_t to
39+
retrieve these additional state flags.
40+
41+
Multiple flags may be set simultaneously if the device is in multiple states.
42+
43+
Usage Example
44+
~~~~~~~~~~~~~
45+
46+
.. parsed-literal::
47+
48+
// Query basic device state
49+
${s}_device_state_t deviceState = {};
50+
deviceState.stype = ${S}_STRUCTURE_TYPE_DEVICE_STATE;
51+
deviceState.pNext = nullptr;
52+
53+
// Add extended state structure to pNext chain
54+
${s}_device_ext_state_t extendedState = {};
55+
extendedState.stype = ${S}_STRUCTURE_TYPE_DEVICE_EXT_STATE;
56+
extendedState.pNext = nullptr;
57+
deviceState.pNext = &extendedState;
58+
59+
// Get device state including extended flags
60+
${s}DeviceGetState(hDevice, &deviceState);
61+
62+
// Check extended device state flags
63+
if (extendedState.flags & ${S}_DEVICE_EXT_STATE_FLAGS_WEDGED) {
64+
// Device is wedged - recovery action needed
65+
}
66+
67+
if (extendedState.flags & ${S}_DEVICE_EXT_STATE_FLAGS_SURVIVABILITY) {
68+
// Device is in survivability mode
69+
}
70+
71+
if (extendedState.flags & ${S}_DEVICE_EXT_STATE_FLAGS_FLASH_OVERRIDE) {
72+
// Device has flash override enabled
73+
}

scripts/sysman/common.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ etors:
285285
value: "0x00020017"
286286
desc: $s_oem_serial_id_ext_properties_t
287287
version: "1.17"
288+
- name: DEVICE_EXT_STATE
289+
value: "0x00020018"
290+
desc: $s_device_ext_state_t
291+
version: "1.17"
288292
--- #-------------------------------------------------------------------------
289293
type: struct
290294
desc: "Base for all properties types"

scripts/sysman/device.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ etors:
104104
desc: "Apply FLR reset"
105105
--- #--------------------------------------------------------------------------
106106
type: struct
107-
desc: "Device state"
107+
desc: "Device state. To retrieve the current device state, please use $s_device_ext_state_t as pNext."
108108
class: $sDevice
109109
name: $s_device_state_t
110110
base: $s_base_state_t

scripts/sysman/deviceState.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#
2+
# Copyright (C) 2026 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
# See YaML.md for syntax definition
7+
#
8+
--- #--------------------------------------------------------------------------
9+
type: header
10+
desc: "Intel $OneApi Level-Zero Sysman Extension APIs for Device State"
11+
version: "1.17"
12+
--- #--------------------------------------------------------------------------
13+
type: macro
14+
desc: "Device State Extension Name"
15+
version: "1.17"
16+
name: $S_DEVICE_EXT_STATE_NAME
17+
value: '"$S_extension_device_state"'
18+
--- #--------------------------------------------------------------------------
19+
type: enum
20+
desc: "Device State Extension Version(s)"
21+
version: "1.17"
22+
name: $s_device_ext_state_version_t
23+
etors:
24+
- name: "1_0"
25+
value: "$X_MAKE_VERSION( 1, 0 )"
26+
desc: "version 1.0"
27+
--- #--------------------------------------------------------------------------
28+
type: enum
29+
desc: "Device state flags"
30+
version: "1.17"
31+
class: $sDevice
32+
name: $s_device_state_ext_flags_t
33+
etors:
34+
- name: NORMAL
35+
desc: "The device is operating normally"
36+
- name: WEDGED
37+
desc: "The device is wedged"
38+
- name: SURVIVABILITY
39+
desc: "The device is in survivability mode"
40+
- name: FLASH_OVERRIDE
41+
desc: "The device has flash override enabled"
42+
--- #--------------------------------------------------------------------------
43+
type: struct
44+
desc: "Extension properties for Device State"
45+
version: "1.17"
46+
class: $sDevice
47+
name: $s_device_ext_state_t
48+
base: $s_base_state_t
49+
members:
50+
- type: $s_device_state_ext_flags_t
51+
name: flags
52+
desc: "[out] Device state flags. Returns 0 (if state cannot be determined) or a combination of $s_device_state_ext_flags_t"
53+
details:
54+
- "This structure may be returned from $sDeviceGetState via the `pNext` member of $s_device_state_t"
55+
- "Provides extended device state information including wedged state, survivability mode, and flash override status"

0 commit comments

Comments
 (0)