Debian Codegraph @

src/vendorcode/cavium/include/bdk/libbdk-hal/bdk-sata.h

raw symbols SCIP
1 /***********************license start***********************************
2 * Copyright (c) 2003-2017 Cavium Inc. ([email protected]). All rights
3 * reserved.
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 *
18 * * Neither the name of Cavium Inc. nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
21 * permission.
22 *
23 * This Software, including technical data, may be subject to U.S. export
24 * control laws, including the U.S. Export Administration Act and its
25 * associated regulations, and may be subject to export or import
26 * regulations in other countries.
27 *
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT
31 * TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
32 * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
33 * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
34 * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
35 * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT,
36 * QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK
37 * ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
39
40 /**
41 * @file
42 *
43 * This file provides a SATA driver
44 *
45 * <hr>$Revision: 49448 $<hr>
46 *
47 * @addtogroup hal
48 * @{
49 */
50
51 /**
52 * SATA pattern generation and loopback supports a number of
53 * modes. This enumeration describes the modes used by
54 * bdk_sata_bist_fir().
55 */
56 typedef enum
57 {
58 BDK_SATA_BIST_FIS_RETIMED, /* Send FIS to tell device to enter Retimed loopback */
59 BDK_SATA_BIST_FIS_ANALOG, /* Send FIS to tell device to enter Analog loopback */
60 BDK_SATA_BIST_FIS_TX_ONLY, /* Send FIS to tell device to transit only */
61 BDK_SATA_BIST_SW_RETIMED, /* No FIS, just enter local retimed loopback */
62 BDK_SATA_BIST_SW_TX_ONLY_SSOP, /* No FIS, just enter local transit only, SSOP pattern */
63 BDK_SATA_BIST_SW_TX_ONLY_HTDP, /* No FIS, just enter local transit only, HTDP pattern */
64 BDK_SATA_BIST_SW_TX_ONLY_LTDP, /* No FIS, just enter local transit only, LTDP pattern */
65 BDK_SATA_BIST_SW_TX_ONLY_LFSCP, /* No FIS, just enter local transit only, LFSCP pattern */
66 BDK_SATA_BIST_SW_TX_ONLY_COMP, /* No FIS, just enter local transit only, COMP pattern */
67 BDK_SATA_BIST_SW_TX_ONLY_LBP, /* No FIS, just enter local transit only, LBP pattern */
68 BDK_SATA_BIST_SW_TX_ONLY_MFTP, /* No FIS, just enter local transit only, MFTP pattern */
69 BDK_SATA_BIST_SW_TX_ONLY_HFTP, /* No FIS, just enter local transit only, HFTP pattern */
70 BDK_SATA_BIST_SW_TX_ONLY_LFTP, /* No FIS, just enter local transit only, LFTP pattern */
71 } bdk_sata_bist_fis_t;
72
73 /**
74 * Return the number of SATA controllers on the chip
75 *
76 * @param node Node to query
77 *
78 * @return Number of controllers, could be zero.
79 */
80 int bdk_sata_get_controllers(bdk_node_t node);
81
82 /**
83 * Initialize a SATA controller and begin device detection
84 *
85 * @param node Node to initialize
86 * @param controller Which controller to initialize
87 *
88 * @return Zero on success, negative on failure
89 */
90 int bdk_sata_initialize(bdk_node_t node, int controller);
91
92 /**
93 * Shutdown a SATA controller
94 *
95 * @param node Node to access
96 * @param controller Controller to shutdown
97 *
98 * @return Zero on success, negative on failure
99 */
100 int bdk_sata_shutdown(bdk_node_t node, int controller);
101
102 /**
103 * Return the number of SATA ports connected to this AHCI controller
104 *
105 * @param node Node to query
106 * @param controller SATA controller
107 *
108 * @return Number of ports. Zero if the controller doesn't connect to a QLM.
109 */
110 int bdk_sata_get_ports(bdk_node_t node, int controller);
111
112 /**
113 * Identify the SATA device connected to a controller
114 *
115 * @param node Node to query
116 * @param controller Controller to query
117 * @param port Which SATA port on the controller, zero based
118 *
119 * @return Size of the disk in bytes
120 */
121 uint64_t bdk_sata_identify(bdk_node_t node, int controller, int port);
122
123 /**
124 * Read data from a SATA device
125 *
126 * @param node Node the controller is on
127 * @param controller Which controller
128 * @param port Which port on the controller, zero based
129 * @param lba 48 bit Block address to read
130 * @param sectors Number of 512 bytes sectors to read
131 * @param buffer Buffer to receive the data. Must be at least 512 * sectors in size
132 *
133 * @return Zero on success, negative on failure
134 */
135 int bdk_sata_read(bdk_node_t node, int controller, int port, uint64_t lba, int sectors, void *buffer);
136
137 /**
138 * Write data to a SATA device
139 *
140 * @param node Node the controller is on
141 * @param controller Which controller
142 * @param port Which port on the controller, zero based
143 * @param lba 48 bit Block address to write
144 * @param sectors Number of 512 bytes sectors to write
145 * @param buffer Data buffer to write. Must be at least 512 * sectors in size
146 *
147 * @return Zero on success, negative on failure
148 */
149 int bdk_sata_write(bdk_node_t node, int controller, int port, uint64_t lba, int sectors, const void *buffer);
150
151 /**
152 * Enter one of the SATA pattern generation / loop testing modes
153 *
154 * @param node Node to access
155 * @param controller SATA controller to access
156 * @param port Which port on the controller
157 * @param mode Test mode to enter
158 *
159 * @return Zero on success, negative on failure
160 */
161 int bdk_sata_bist_fis(bdk_node_t node, int controller, int port, bdk_sata_bist_fis_t mode);
162
163 /** @} */