]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - os_darwin.h
import smartmontools 7.0
[mirror_smartmontools-debian.git] / os_darwin.h
1 /*
2 * os_generic.h
3 *
4 * Home page of code is: http://www.smartmontools.org
5 *
6 * Copyright (C) 2004-8 Geoff Keating <geoffk@geoffk.org>
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11 #ifndef OS_DARWIN_H_
12 #define OS_DARWIN_H_
13
14 #define OS_DARWIN_H_CVSID "$Id: os_darwin.h 4760 2018-08-19 18:45:53Z chrfranke $\n"
15
16 #define kIOATABlockStorageDeviceClass "IOATABlockStorageDevice"
17
18 // Isn't in 10.3.9?
19
20 #ifndef kIOPropertySMARTCapableKey
21 #define kIOPropertySMARTCapableKey "SMART Capable"
22 #endif
23
24 // NVMe definitions, non documented, experimental
25 #define kIOPropertyNVMeSMARTCapableKey "NVMe SMART Capable"
26
27 // Constant to init driver
28 #define kIONVMeSMARTUserClientTypeID CFUUIDGetConstantUUIDWithBytes(NULL, \
29 0xAA, 0x0F, 0xA6, 0xF9, 0xC2, 0xD6, 0x45, 0x7F, 0xB1, 0x0B, \
30 0x59, 0xA1, 0x32, 0x53, 0x29, 0x2F)
31
32 // Constant to use plugin interface
33 #define kIONVMeSMARTInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
34 0xcc, 0xd1, 0xdb, 0x19, 0xfd, 0x9a, 0x4d, 0xaf, 0xbf, 0x95, \
35 0x12, 0x45, 0x4b, 0x23, 0xa, 0xb6)
36
37 // interface structure, obtained using lldb, could be incomplete or wrong
38 typedef struct IONVMeSMARTInterface
39 {
40 IUNKNOWN_C_GUTS;
41
42 UInt16 version;
43 UInt16 revision;
44
45 // NVMe smart data, returns nvme_smart_log structure
46 IOReturn ( *SMARTReadData )( void * interface,
47 struct nvme_smart_log * NVMeSMARTData );
48
49 // NVMe IdentifyData, returns nvme_id_ctrl per namespace
50 IOReturn ( *GetIdentifyData )( void * interface,
51 struct nvme_id_ctrl * NVMeIdentifyControllerStruct,
52 unsigned int ns );
53
54 // Always getting kIOReturnDeviceError
55 IOReturn ( *GetFieldCounters )( void * interface,
56 char * FieldCounters );
57 // Returns 0
58 IOReturn ( *ScheduleBGRefresh )( void * interface);
59
60 // Always returns kIOReturnDeviceError, probably expects pointer to some
61 // structure as an argument
62 IOReturn ( *GetLogPage )( void * interface, void * data, unsigned int, unsigned int);
63
64
65 /* GetSystemCounters Looks like a table with an attributes. Sample result:
66
67 0x101022200: 0x01 0x00 0x08 0x00 0x00 0x00 0x00 0x00
68 0x101022208: 0x00 0x00 0x00 0x00 0x02 0x00 0x08 0x00
69 0x101022210: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
70 0x101022218: 0x03 0x00 0x08 0x00 0xf1 0x74 0x26 0x01
71 0x101022220: 0x00 0x00 0x00 0x00 0x04 0x00 0x08 0x00
72 0x101022228: 0x0a 0x91 0xb1 0x00 0x00 0x00 0x00 0x00
73 0x101022230: 0x05 0x00 0x08 0x00 0x24 0x9f 0xfe 0x02
74 0x101022238: 0x00 0x00 0x00 0x00 0x06 0x00 0x08 0x00
75 0x101022240: 0x9b 0x42 0x38 0x02 0x00 0x00 0x00 0x00
76 0x101022248: 0x07 0x00 0x08 0x00 0xdd 0x08 0x00 0x00
77 0x101022250: 0x00 0x00 0x00 0x00 0x08 0x00 0x08 0x00
78 0x101022258: 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00
79 0x101022260: 0x09 0x00 0x08 0x00 0x00 0x00 0x00 0x00
80 0x101022268: 0x00 0x00 0x00 0x00 0x0a 0x00 0x04 0x00
81 .........
82 0x101022488: 0x74 0x00 0x08 0x00 0x00 0x00 0x00 0x00
83 0x101022490: 0x00 0x00 0x00 0x00 0x75 0x00 0x40 0x02
84 0x101022498: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
85 */
86 IOReturn ( *GetSystemCounters )( void * interface, char *, unsigned int *);
87
88
89 /* GetAlgorithmCounters returns mostly 0
90 0x102004000: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
91 0x102004008: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
92 0x102004010: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
93 0x102004018: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
94 0x102004020: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
95 0x102004028: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
96 0x102004038: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
97 0x102004040: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
98 0x102004048: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
99 0x102004050: 0x00 0x00 0x00 0x00 0x80 0x00 0x00 0x00
100 0x102004058: 0x80 0x00 0x00 0x00 0x00 0x00 0x00 0x00
101 0x102004060: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
102 0x102004068: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
103 0x102004070: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
104 0x102004078: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
105 0x102004080: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
106 0x102004088: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
107 0x102004090: 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00
108 0x102004098: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
109
110 */
111 IOReturn ( *GetAlgorithmCounters )( void * interface, char *, unsigned int *);
112 } IONVMeSMARTInterface;
113
114
115 #endif /* OS_DARWIN_H_ */