|
Packit Service |
db8df9 |
/*
|
|
Packit Service |
db8df9 |
* Intel(R) Enclosure LED Utilities
|
|
Packit Service |
db8df9 |
* Copyright (C) 2009-2020 Intel Corporation.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* This program is free software; you can redistribute it and/or modify it
|
|
Packit Service |
db8df9 |
* under the terms and conditions of the GNU General Public License,
|
|
Packit Service |
db8df9 |
* version 2, as published by the Free Software Foundation.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
Packit Service |
db8df9 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
Packit Service |
db8df9 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
Packit Service |
db8df9 |
* more details.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* You should have received a copy of the GNU General Public License along with
|
|
Packit Service |
db8df9 |
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
Packit Service |
db8df9 |
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
#ifndef _CNTRL_H_INCLUDED_
|
|
Packit Service |
db8df9 |
#define _CNTRL_H_INCLUDED_
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* This enumeration type lists all supported storage controller types.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
enum cntrl_type {
|
|
Packit Service |
db8df9 |
CNTRL_TYPE_UNKNOWN = 0,
|
|
Packit Service |
db8df9 |
CNTRL_TYPE_DELLSSD,
|
|
Packit Service |
db8df9 |
CNTRL_TYPE_VMD,
|
|
Packit Service |
db8df9 |
CNTRL_TYPE_SCSI,
|
|
Packit Service |
db8df9 |
CNTRL_TYPE_AHCI,
|
|
Packit Service |
db8df9 |
CNTRL_TYPE_NPEM,
|
|
Packit Service |
db8df9 |
CNTRL_TYPE_AMD,
|
|
Packit Service |
db8df9 |
};
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* @brief Storage controller device structure.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* This structure describes a storage controller device existing in the system.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
struct cntrl_device {
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* Path to the device in sysfs tree.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
char *sysfs_path;
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* Type of storage controller device.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
enum cntrl_type cntrl_type;
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* Flag if scsi controller driver is "isci"
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
int isci_present;
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
struct _host_type {
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* ibpi state buffer for directly attached devices
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
struct gpio_tx_register_byte *ibpi_state_buffer;
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* outbound raw byte stream
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
unsigned char bitstream[4];
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* bitstream's flush flag
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
int flush;
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* host identifier for different hba instances
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
int host_id;
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* number of total phy ports
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
int ports;
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* pointer to next structure
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
struct _host_type *next;
|
|
Packit Service |
db8df9 |
} *hosts;
|
|
Packit Service |
db8df9 |
};
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* @brief Allocates a new controller device structure.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* This function allocates memory for a new structure of storage controller
|
|
Packit Service |
db8df9 |
* device. It reads the sysfs entries and populates structure fields.
|
|
Packit Service |
db8df9 |
* The function registers only supported storage controllers.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @param[in] path path to storage controller in sysfs tree.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @return Pointer to storage controller structure if successful, otherwise the
|
|
Packit Service |
db8df9 |
* function returns NULL pointer. The NULL pointer means that controller
|
|
Packit Service |
db8df9 |
* device is not supported.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
struct cntrl_device *cntrl_device_init(const char *path);
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* @brief Releases a controller device structure.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* This function releases memory allocated for controller device structure.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @param[in] device pointer to controller device structure.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @return The function does not return a value.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
void cntrl_device_fini(struct cntrl_device *device);
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
/**
|
|
Packit Service |
db8df9 |
* @brief Prints given controller to stdout.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* This function prints the path and type of controller device given as
|
|
Packit Service |
db8df9 |
* argument.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @param[in] ctrl_dev address to element from a
|
|
Packit Service |
db8df9 |
* controller list.
|
|
Packit Service |
db8df9 |
*
|
|
Packit Service |
db8df9 |
* @return The function does not return a value.
|
|
Packit Service |
db8df9 |
*/
|
|
Packit Service |
db8df9 |
void print_cntrl(struct cntrl_device *ctrl_dev);
|
|
Packit Service |
db8df9 |
|
|
Packit Service |
db8df9 |
#endif /* _CNTRL_H_INCLUDED_ */
|