1 | ///////////////////////////////////////////////////////////////////////////////
|
---|
2 | //
|
---|
3 | // FILENAME: intelliprop.h
|
---|
4 | // PROJECT :
|
---|
5 | // KEYWORDS:
|
---|
6 | // LANGUAGE: C++
|
---|
7 | // INTELLIPROP AUTHOR : caseyb
|
---|
8 | // CREATED : 07/13/2016
|
---|
9 | //
|
---|
10 | // DESCRIPTION:
|
---|
11 | //
|
---|
12 | // TESTS USED/CREATED:
|
---|
13 | //
|
---|
14 | // REVISION HISTORY: Rev1.0
|
---|
15 | // Date Person Description
|
---|
16 | // -------- ----------- -------------------------------------------------------
|
---|
17 | //
|
---|
18 | // CURRENT ISSUES: none.
|
---|
19 | //
|
---|
20 | // REMAINING WORK:
|
---|
21 | //
|
---|
22 | //
|
---|
23 | // This media contains an authorized copy or copies of material owned by
|
---|
24 | // IntelliProp Inc. This ownership notice and any other notices included in
|
---|
25 | // machine readable copies must be reproduced on all authorized copies.
|
---|
26 | //
|
---|
27 | // This is confidential and unpublished property of IntelliProp Inc.
|
---|
28 | //
|
---|
29 | // All rights reserved.
|
---|
30 | // Copyright [$Year] [IntelliProp Inc.]
|
---|
31 | //
|
---|
32 | // Licensed under the IntelliProp Software Products License,
|
---|
33 | // Version 1.0 (the \"License\");
|
---|
34 | //
|
---|
35 | // You may not use this file except in compliance with the IntelliProp
|
---|
36 | // Software Products License Agreement.
|
---|
37 | //
|
---|
38 | // Unless required by applicable law or agreed to in writing, software
|
---|
39 | // distributed under the License is distributed on an \"AS IS\" BASIS,
|
---|
40 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
41 | //
|
---|
42 | ///////////////////////////////////////////////////////////////////////////////
|
---|
43 |
|
---|
44 | /*
|
---|
45 | * intelliprop.h
|
---|
46 | *
|
---|
47 | * Home page of code is: http://www.smartmontools.org
|
---|
48 | *
|
---|
49 | * Copyright (C) 2016 Casey Biemiller
|
---|
50 | * Copyright (C) 2002-11 Bruce Allen
|
---|
51 | * Copyright (C) 2008-15 Christian Franke
|
---|
52 | * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
|
---|
53 | *
|
---|
54 | * This program is free software; you can redistribute it and/or modify
|
---|
55 | * it under the terms of the GNU General Public License as published by
|
---|
56 | * the Free Software Foundation; either version 2, or (at your option)
|
---|
57 | * any later version.
|
---|
58 | *
|
---|
59 | * You should have received a copy of the GNU General Public License
|
---|
60 | * (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
|
---|
61 | *
|
---|
62 | * This code was originally developed as a Senior Thesis by Michael Cornwell
|
---|
63 | * at the Concurrent Systems Laboratory (now part of the Storage Systems
|
---|
64 | * Research Center), Jack Baskin School of Engineering, University of
|
---|
65 | * California, Santa Cruz. http://ssrc.soe.ucsc.edu/
|
---|
66 | *
|
---|
67 | */
|
---|
68 |
|
---|
69 | #ifndef INTELLIPROP_H_
|
---|
70 | #define INTELLIPROP_H_
|
---|
71 |
|
---|
72 |
|
---|
73 | #include "dev_interface.h" // ata_device
|
---|
74 | #include "atacmds.h" //ATTR_PACKED and ASSERT_SIZEOF_STRUCT
|
---|
75 |
|
---|
76 | //Vendor Specific log addresses
|
---|
77 | #define LOG_C0 0xC0
|
---|
78 | #define PAGE_0 0
|
---|
79 |
|
---|
80 | //Return Codes
|
---|
81 | #define IPRSUCCESS 0
|
---|
82 | #define IPRDEVFAIL 1
|
---|
83 | #define IPRCODEFAIL 2
|
---|
84 | #define IPRCMDFAIL 3
|
---|
85 |
|
---|
86 | //This struct is used for the Vendor Specific log C0 on devices that support it.
|
---|
87 | #pragma pack(1)
|
---|
88 | struct iprop_internal_log
|
---|
89 | {
|
---|
90 | uint32_t drive_select; // Bytes - [ 3: 0] of Log C0
|
---|
91 | uint32_t obsolete; // Bytes - [ 7: 4] of Log C0
|
---|
92 | uint8_t mode_control; // Byte - [ 8] of Log C0
|
---|
93 | uint8_t log_passthrough; // Byte - [ 9] of Log C0
|
---|
94 | uint16_t tier_id; // Bytes - [ 11: 10] of Log C0
|
---|
95 | uint32_t hw_version; // Bytes - [ 15: 12] of Log C0
|
---|
96 | uint32_t fw_version; // Bytes - [ 19: 16] of Log C0
|
---|
97 | uint8_t variant[8]; // Bytes - [ 27: 20] of Log C0
|
---|
98 | uint8_t reserved[228]; // Bytes - [255: 28] of Log C0
|
---|
99 | uint16_t port_0_settings[3]; // Bytes - [263:256] of Log C0
|
---|
100 | uint16_t port_0_reserved;
|
---|
101 | uint16_t port_1_settings[3]; // Bytes - [271:264] of Log C0
|
---|
102 | uint16_t port_1_reserved;
|
---|
103 | uint16_t port_2_settings[3]; // Bytes - [279:272] of Log C0
|
---|
104 | uint16_t port_2_reserved;
|
---|
105 | uint16_t port_3_settings[3]; // Bytes - [287:280] of Log C0
|
---|
106 | uint16_t port_3_reserved;
|
---|
107 | uint16_t port_4_settings[3]; // Bytes - [295:288] of Log C0
|
---|
108 | uint16_t port_4_reserved;
|
---|
109 | uint8_t reserved2[214]; // Bytes - [509:296] of Log C0
|
---|
110 | uint16_t crc; // Bytes - [511:510] of Log C0
|
---|
111 | } ATTR_PACKED;
|
---|
112 | #pragma pack()
|
---|
113 | ASSERT_SIZEOF_STRUCT(iprop_internal_log, 512);
|
---|
114 |
|
---|
115 |
|
---|
116 | // VS LOG MODE CONTROL BITS
|
---|
117 | enum {
|
---|
118 | IPROP_VS_LOG_MODE_CTL_AUTO_SUPPORTED = (0 << 0), // NOTE: Not supported
|
---|
119 | IPROP_VS_LOG_MODE_CTL_MANUAL_SUPPORTED = (1 << 1),
|
---|
120 | IPROP_VS_LOG_MODE_CTL_AUTO_ENABLED = (0 << 2), // NOTE: Not supported
|
---|
121 | IPROP_VS_LOG_MODE_CTL_MANUAL_ENABLED = (1 << 3),
|
---|
122 | };
|
---|
123 |
|
---|
124 |
|
---|
125 | // VS LOG PORT SETTING BITS
|
---|
126 | enum {
|
---|
127 | IPROP_VS_LOG_PORT_WRITE_ENABLE_MASK = 0xC000,
|
---|
128 | IPROP_VS_LOG_PORT_WRITE_ENABLE_VALID = 0x8000,
|
---|
129 | IPROP_VS_LOG_PORT_RX_DC_GAIN_MASK = 0x3000,
|
---|
130 | IPROP_VS_LOG_PORT_RX_DC_GAIN_SHIFT = 12,
|
---|
131 | IPROP_VS_LOG_PORT_RX_EQ_MASK = 0x0F00,
|
---|
132 | IPROP_VS_LOG_PORT_RX_EQ_SHIFT = 8,
|
---|
133 | IPROP_VS_LOG_PORT_TX_PREEMP_MASK = 0x00F8,
|
---|
134 | IPROP_VS_LOG_PORT_TX_PREEMP_SHIFT = 3,
|
---|
135 | IPROP_VS_LOG_PORT_TX_VOD_MASK = 0x0007,
|
---|
136 | IPROP_VS_LOG_PORT_TX_VOD_SHIFT = 0,
|
---|
137 | };
|
---|
138 |
|
---|
139 | //Used to get options selected in smartctl.cpp to functions in intelliprop.cpp
|
---|
140 | struct intelliprop_args
|
---|
141 | {
|
---|
142 | bool issue_intelliprop_cmd;
|
---|
143 | bool is_routed_cmd;
|
---|
144 | int drive_select;
|
---|
145 | };
|
---|
146 |
|
---|
147 | void iprop_dump_log_structure(struct iprop_internal_log const * const log);
|
---|
148 |
|
---|
149 | //The only function that should need to be called for ata devices.
|
---|
150 | int iprop_main_ata(ata_device * device, intelliprop_args iprop_args);
|
---|
151 | #endif /* INTELLIPROP_H_ */
|
---|