smartmontools  SVN Rev 4440
Utility to control and monitor storage systems with "S.M.A.R.T."
os_darwin.h
Go to the documentation of this file.
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  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * You should have received a copy of the GNU General Public License
14  * (for example COPYING); if not, write to the Free Software Foundation,
15  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  *
17  * This code was originally developed as a Senior Thesis by Michael Cornwell
18  * at the Concurrent Systems Laboratory (now part of the Storage Systems
19  * Research Center), Jack Baskin School of Engineering, University of
20  * California, Santa Cruz. http://ssrc.soe.ucsc.edu/
21  *
22  */
23 
24 #ifndef OS_DARWIN_H_
25 #define OS_DARWIN_H_
26 
27 #define OS_DARWIN_H_CVSID "$Id: os_darwin.h 4438 2017-09-20 18:00:42Z samm2 $\n"
28 
29 #define kIOATABlockStorageDeviceClass "IOATABlockStorageDevice"
30 
31 // Isn't in 10.3.9?
32 
33 #ifndef kIOPropertySMARTCapableKey
34 #define kIOPropertySMARTCapableKey "SMART Capable"
35 #endif
36 
37 // NVMe definitions, non documented, experimental
38 #define kIOPropertyNVMeSMARTCapableKey "NVMe SMART Capable"
39 
40 // Constant to init driver
41 #define kIONVMeSMARTUserClientTypeID CFUUIDGetConstantUUIDWithBytes(NULL, \
42  0xAA, 0x0F, 0xA6, 0xF9, 0xC2, 0xD6, 0x45, 0x7F, 0xB1, 0x0B, \
43  0x59, 0xA1, 0x32, 0x53, 0x29, 0x2F)
44 
45 // Constant to use plugin interface
46 #define kIONVMeSMARTInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
47  0xcc, 0xd1, 0xdb, 0x19, 0xfd, 0x9a, 0x4d, 0xaf, 0xbf, 0x95, \
48  0x12, 0x45, 0x4b, 0x23, 0xa, 0xb6)
49 
50 // interface structure, obtained using lldb, could be incomplete or wrong
51 typedef struct IONVMeSMARTInterface
52 {
54 
55  UInt16 version;
56  UInt16 revision;
57 
58  // NVMe smart data, returns nvme_smart_log structure
59  IOReturn ( *SMARTReadData )( void * interface,
60  struct nvme_smart_log * NVMeSMARTData );
61 
62  // NVMe IdentifyData, returns nvme_id_ctrl per namespace
63  IOReturn ( *GetIdentifyData )( void * interface,
64  struct nvme_id_ctrl * NVMeIdentifyControllerStruct,
65  unsigned int ns );
66 
67  // Always getting kIOReturnDeviceError
68  IOReturn ( *GetFieldCounters )( void * interface,
69  char * FieldCounters );
70  // Returns 0
71  IOReturn ( *ScheduleBGRefresh )( void * interface);
72 
73  // Always returns kIOReturnDeviceError, probably expects pointer to some
74  // structure as an argument
75  IOReturn ( *GetLogPage )( void * interface, void * data, unsigned int, unsigned int);
76 
77 
78  /* GetSystemCounters Looks like a table with an attributes. Sample result:
79 
80  0x101022200: 0x01 0x00 0x08 0x00 0x00 0x00 0x00 0x00
81  0x101022208: 0x00 0x00 0x00 0x00 0x02 0x00 0x08 0x00
82  0x101022210: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
83  0x101022218: 0x03 0x00 0x08 0x00 0xf1 0x74 0x26 0x01
84  0x101022220: 0x00 0x00 0x00 0x00 0x04 0x00 0x08 0x00
85  0x101022228: 0x0a 0x91 0xb1 0x00 0x00 0x00 0x00 0x00
86  0x101022230: 0x05 0x00 0x08 0x00 0x24 0x9f 0xfe 0x02
87  0x101022238: 0x00 0x00 0x00 0x00 0x06 0x00 0x08 0x00
88  0x101022240: 0x9b 0x42 0x38 0x02 0x00 0x00 0x00 0x00
89  0x101022248: 0x07 0x00 0x08 0x00 0xdd 0x08 0x00 0x00
90  0x101022250: 0x00 0x00 0x00 0x00 0x08 0x00 0x08 0x00
91  0x101022258: 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00
92  0x101022260: 0x09 0x00 0x08 0x00 0x00 0x00 0x00 0x00
93  0x101022268: 0x00 0x00 0x00 0x00 0x0a 0x00 0x04 0x00
94  .........
95  0x101022488: 0x74 0x00 0x08 0x00 0x00 0x00 0x00 0x00
96  0x101022490: 0x00 0x00 0x00 0x00 0x75 0x00 0x40 0x02
97  0x101022498: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
98  */
99  IOReturn ( *GetSystemCounters )( void * interface, char *, unsigned int *);
100 
101 
102  /* GetAlgorithmCounters returns mostly 0
103  0x102004000: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
104  0x102004008: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
105  0x102004010: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
106  0x102004018: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
107  0x102004020: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
108  0x102004028: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
109  0x102004038: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
110  0x102004040: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
111  0x102004048: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
112  0x102004050: 0x00 0x00 0x00 0x00 0x80 0x00 0x00 0x00
113  0x102004058: 0x80 0x00 0x00 0x00 0x00 0x00 0x00 0x00
114  0x102004060: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
115  0x102004068: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
116  0x102004070: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
117  0x102004078: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
118  0x102004080: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
119  0x102004088: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
120  0x102004090: 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00
121  0x102004098: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
122 
123  */
124  IOReturn ( *GetAlgorithmCounters )( void * interface, char *, unsigned int *);
126 
127 
128 #endif /* OS_DARWIN_H_ */
IOReturn(* ScheduleBGRefresh)(void *interface)
Definition: os_darwin.h:71
IOReturn(* GetFieldCounters)(void *interface, char *FieldCounters)
Definition: os_darwin.h:68
ptr_t data
Definition: megaraid.h:94
IOReturn(* GetSystemCounters)(void *interface, char *, unsigned int *)
Definition: os_darwin.h:99
IOReturn(* GetAlgorithmCounters)(void *interface, char *, unsigned int *)
Definition: os_darwin.h:124
struct IONVMeSMARTInterface IONVMeSMARTInterface
IOReturn(* SMARTReadData)(void *interface, struct nvme_smart_log *NVMeSMARTData)
Definition: os_darwin.h:59
IOReturn(* GetIdentifyData)(void *interface, struct nvme_id_ctrl *NVMeIdentifyControllerStruct, unsigned int ns)
Definition: os_darwin.h:63
IOReturn(* GetLogPage)(void *interface, void *data, unsigned int, unsigned int)
Definition: os_darwin.h:75