1 /*
2  * os_os2.c
3  *
4  * Home page of code is: http://www.smartmontools.org
5  *
6  * Copyright (C) 2004-8 Yuri Dario
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #ifndef OS_OS2_H_
12 #define OS_OS2_H_
13 
14 #define OS_XXXX_H_CVSID "$Id: os_os2.h 4760 2018-08-19 18:45:53Z chrfranke $\n"
15 
16 // Additional material should start here.  Note: to keep the '-V' CVS
17 // reporting option working as intended, you should only #include
18 // system include files <something.h>.  Local #include files
19 // <"something.h"> should be #included in os_generic.c
20 
21 #define INCL_DOS
22 #include <os2.h>
23 
24 #include "os_linux.h"
25 
26 #pragma pack(1)
27 
28 /* IOCTL definitions from s506oem.h (primarily required for SMART calls) */
29 #define DSKSP_CAT_SMART             0x80  /* SMART IOCTL category */
30 #define DSKSP_SMART_ONOFF           0x20  /* turn SMART on or off */
31 #define DSKSP_SMART_AUTOSAVE_ONOFF  0x21  /* turn SMART autosave on or off */
32 #define DSKSP_SMART_SAVE            0x22  /* force save of SMART data */
33 #define DSKSP_SMART_GETSTATUS       0x23  /* get SMART status (pass/fail) */
34 #define DSKSP_SMART_GET_ATTRIBUTES  0x24  /* get SMART attributes table */
35 #define DSKSP_SMART_GET_THRESHOLDS  0x25  /* get SMART thresholds table */
36 #define DSKSP_SMART_GET_LOG         0x26  /* get SMART log        table */
37 #define DSKSP_SMART_AUTO_OFFLINE    0x27  /* set SMART offline autosave timer */
38 #define DSKSP_SMART_EXEC_OFFLINE 0x28 /* execute SMART immediate offline */
39 
40 #define SMART_CMD_ON      1   /* on  value for related SMART functions */
41 #define SMART_CMD_OFF     0   /* off value for related SMART functions */
42 
43 #define DSKSP_CAT_GENERIC           0x90  /* generic IOCTL category */
44 #define DSKSP_GET_INQUIRY_DATA      0x42  /* get ATA/ATAPI inquiry data */
45 
46 typedef struct _DSKSP_CommandParameters {
47   BYTE byPhysicalUnit;		   /* physical unit number 0-n */
48 				   /* 0 = 1st disk, 1 = 2nd disk, ...*/
49 				   /* 0x80 = Pri/Mas, 0x81=Pri/Sla, 0x82=Sec/Mas,*/
50 } DSKSP_CommandParameters, *PDSKSP_CommandParameters;
51 
52 struct SMART_ParamExt {
53   UCHAR      byPhysicalUnit;  // 0=Pri/Mas, 1=Pri/Sla, 2=Sec/Mas, etc.
54   ULONG      LogAddress;      // valid values 0-255. See ATA/ATPI standard
55                               // for details
56   ULONG      SectorCount;     // valid values 0-255  See ATA/ATPI standard
57                               // for details
58   ULONG      reserved;        // reserved. must be set to 0
59 };
60 
61 const char * danisdev="\\DEV\\IBMS506$"; // DANIS506
62 const char * danispref="hd";
63 const char * ahcidev="\\DEV\\OS2AHCI$";  // OS2AHCI
64 const char * ahcipref="ahci";
65 
66 #endif /* OS_GENERIC_H_ */
67