|
Packit |
7e09eb |
/*
|
|
Packit |
7e09eb |
* Intel(R) Enclosure LED Utilities
|
|
Packit |
7e09eb |
* Copyright (C) 2016-2017 Intel Corporation.
|
|
Packit |
7e09eb |
*
|
|
Packit |
7e09eb |
* This program is free software; you can redistribute it and/or modify it
|
|
Packit |
7e09eb |
* under the terms and conditions of the GNU General Public License,
|
|
Packit |
7e09eb |
* version 2, as published by the Free Software Foundation.
|
|
Packit |
7e09eb |
*
|
|
Packit |
7e09eb |
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
Packit |
7e09eb |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
Packit |
7e09eb |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
Packit |
7e09eb |
* more details.
|
|
Packit |
7e09eb |
*
|
|
Packit |
7e09eb |
* You should have received a copy of the GNU General Public License along with
|
|
Packit |
7e09eb |
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
Packit |
7e09eb |
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
|
Packit |
7e09eb |
*
|
|
Packit |
7e09eb |
*/
|
|
Packit |
7e09eb |
|
|
Packit |
7e09eb |
#ifndef PCI_SLOT_H_INCLUDED_
|
|
Packit |
7e09eb |
#define PCI_SLOT_H_INCLUDED_
|
|
Packit |
7e09eb |
|
|
Packit |
7e09eb |
/**
|
|
Packit |
7e09eb |
* @brief PCI hotplug slot structure.
|
|
Packit |
7e09eb |
*
|
|
Packit |
7e09eb |
* This structure describes a PCI hotplug slot exposed by the hotplug driver.
|
|
Packit |
7e09eb |
*/
|
|
Packit |
7e09eb |
struct pci_slot {
|
|
Packit |
7e09eb |
/**
|
|
Packit |
7e09eb |
* Path to PCI hotplug slot in sysfs tree.
|
|
Packit |
7e09eb |
*/
|
|
Packit |
7e09eb |
char *sysfs_path;
|
|
Packit |
7e09eb |
|
|
Packit |
7e09eb |
/**
|
|
Packit |
7e09eb |
* PCI hotplug slot address.
|
|
Packit |
7e09eb |
*/
|
|
Packit |
7e09eb |
char *address;
|
|
Packit |
7e09eb |
|
|
Packit |
7e09eb |
/**
|
|
Packit |
7e09eb |
* State of the Amber LED of the PCI slot.
|
|
Packit |
7e09eb |
*/
|
|
Packit |
7e09eb |
int attention;
|
|
Packit |
7e09eb |
};
|
|
Packit |
7e09eb |
|
|
Packit |
7e09eb |
/**
|
|
Packit |
7e09eb |
* @brief Allocates memory for a PCI hotplug slot structure.
|
|
Packit |
7e09eb |
*
|
|
Packit |
7e09eb |
* This function allocates memory for a new structure describing hotplug slot.
|
|
Packit |
7e09eb |
* It reads the sysfs entries and populates structure fields.
|
|
Packit |
7e09eb |
*
|
|
Packit |
7e09eb |
* @param[in] path Path to a PCI hotplug slot in sysfs tree.
|
|
Packit |
7e09eb |
* The path begins with "/sys/bus/pci/slots/".
|
|
Packit |
7e09eb |
*
|
|
Packit |
7e09eb |
* @return Pointer to PCI hotplug slot structure if successful, otherwise the
|
|
Packit |
7e09eb |
* function returns NULL pointer. The NULL pointer means either the
|
|
Packit |
7e09eb |
* specified path is invalid or there's not enough memory in the system
|
|
Packit |
7e09eb |
* to allocated new structure.
|
|
Packit |
7e09eb |
*/
|
|
Packit |
7e09eb |
struct pci_slot *pci_slot_init(const char *path);
|
|
Packit |
7e09eb |
|
|
Packit |
7e09eb |
/**
|
|
Packit |
7e09eb |
* @brief Releases an PCI hotplug slot structure.
|
|
Packit |
7e09eb |
*
|
|
Packit |
7e09eb |
* This function releases memory allocated for PCI hotplug slotstructure.
|
|
Packit |
7e09eb |
*
|
|
Packit |
7e09eb |
* @param[in] slot Pointer to PCI hotplug slot structure.
|
|
Packit |
7e09eb |
*
|
|
Packit |
7e09eb |
* @return The function does not return a value.
|
|
Packit |
7e09eb |
*/
|
|
Packit |
7e09eb |
void pci_slot_fini(struct pci_slot *slot);
|
|
Packit |
7e09eb |
|
|
Packit |
7e09eb |
#endif // PCI_SLOT_H_INCLUDED_
|