pcie_hp.h revision 269473047d747f7815af570197e4ef7322d3632c
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_PCIE_HP_H
#define _SYS_PCIE_HP_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
#include <sys/pcie_impl.h>
#endif /* _KERNEL */
#include "../../../../../common/pci/pci_strings.h"
#define PCIEHPC_PROP_HELP "help"
#define PCIEHPC_PROP_ALL "all"
#define PCIEHPC_PROP_LED_FAULT "fault_led"
#define PCIEHPC_PROP_LED_POWER "power_led"
#define PCIEHPC_PROP_LED_ATTN "attn_led"
#define PCIEHPC_PROP_LED_ACTIVE "active_led"
#define PCIEHPC_PROP_CARD_TYPE "card_type"
#define PCIEHPC_PROP_BOARD_TYPE "board_type"
#define PCIEHPC_PROP_SLOT_CONDITION "slot_condition"
#define PCIEHPC_PROP_VALUE_UNKNOWN "unknown"
#define PCIEHPC_PROP_VALUE_ON "on"
#define PCIEHPC_PROP_VALUE_OFF "off"
#define PCIEHPC_PROP_VALUE_BLINK "blink"
#define PCIEHPC_PROP_VALUE_PCIHOTPLUG "pci hotplug"
#define PCIEHPC_PROP_VALUE_OK "ok"
#define PCIEHPC_PROP_VALUE_FAILING "failing"
#define PCIEHPC_PROP_VALUE_FAILED "failed"
#define PCIEHPC_PROP_VALUE_UNUSABLE "unusable"
#define PCIEHPC_PROP_VALUE_LED "<on|off|blink>"
#define PCIEHPC_PROP_VALUE_TYPE "<type description>"
#define PCIEHPC_PROP_VALUE_CONDITION "<unknown|ok|failing|failed|unusable>"
/* condition */
#define PCIEHPC_PROP_COND_OK "ok"
#define PCIEHPC_PROP_COND_FAILING "failing"
#define PCIEHPC_PROP_COND_FAILED "failed"
#define PCIEHPC_PROP_COND_UNUSABLE "unusable"
#define PCIEHPC_PROP_COND_UNKNOWN "unknown"
#ifdef _KERNEL
/* cmd to change slot state */
#define PCIE_GET_HP_CTRL(dip) \
#define PCIE_IS_PCIE_HOTPLUG_CAPABLE(bus_p) \
#define PCIE_IS_PCI_HOTPLUG_CAPABLE(bus_p) \
#define PCIE_IS_PCIE_HOTPLUG_ENABLED(bus_p) \
#define PCIE_IS_PCI_HOTPLUG_ENABLED(bus_p) \
typedef struct pcie_hp_ctrl pcie_hp_ctrl_t;
typedef struct pcie_hp_slot pcie_hp_slot_t;
/*
* Maximum length of the string converted from the digital number of pci device
* number and function number, including the string's end mark. For example,
* device number 0 and function number 255 (ARI case), then the length is
* (1 + 3 + 1).
*/
#define PCIE_HP_DEV_FUNC_NUM_STRING_LEN 5
/*
* Length of the characters in a PCI port name.
* The format of the PCI port name is: pci.d,f where d is device number, f is
* function number. The constant string and characters are "pci." and ",".
*/
#define PCIE_HP_PORT_NAME_STRING_LEN 5
/* Platform specific ops (Native HP, ACPI, etc.) */
typedef struct pcie_hp_ops {
/* initialize/setup hot plug controller hw */
/* uninitialize hot plug controller hw */
/* initialize slot information structure */
/* uninitialize slot information structure */
/* slot poweron */
/* slot poweroff */
/* uninitialize hot plug controller hw */
/* enable hot plug interrupts/events */
/* disable hot plug interrupts/events */
/* Slot occupant information structure */
#define PCIE_HP_MAX_OCCUPANTS 128
typedef struct pcie_hp_occupant_info {
int i;
char *id[PCIE_HP_MAX_OCCUPANTS];
/*
* pcie_hp_led_t
*
* Type definitions for LED type
*/
typedef enum {
/*
* pcie_hp_led_state_t
*
* Type definitions for LED state
*/
typedef enum {
/*
* PCI and PCI Express Hotplug slot structure
*/
struct pcie_hp_slot {
/* For cfgadm condition. */
/* Synchronization variable(s) for hot plug events */
};
/*
*/
typedef struct pcie_hp_regops {
void *cookie;
/*
* PCI and PCI Express Hotplug controller structure
*/
struct pcie_hp_ctrl {
/* Slot information */
/* PCI Express Hotplug specific fields */
/* (Native, ACPI) */
/* PCI Hotplug (SHPC) specific fields */
int hc_curr_bus_speed; /* Current Bus Speed */
/* Platform implementation specific data if any: ACPI, CK804,... */
void *hc_misc_data;
};
/*
* Control structure for tree walk during configure/unconfigure operation.
*/
typedef struct pcie_hp_cn_cfg_t {
void *slotp;
int rv; /* Return error code */
/* error occurred */
void *cn_private; /* Connection specific data */
/*
* arg for unregistering port of a pci bridge
*/
typedef struct pcie_hp_unreg_port {
/* pci bridge dip to which the port is associated */
/*
* Connector number of the physical slot whose dependent ports will be
* unregistered. If NULL, then all the ports of the pci bridge dip will
* be unregistered.
*/
int connector_num;
int rv;
/*
* arg for getting a port's state
*/
typedef struct pcie_hp_port_state {
char *cn_name;
int rv;
/* hc_flags */
/* PCIe hotplug friendly functions */
int pci_dev);
int pci_dev);
extern int pcie_create_minor_node(pcie_hp_ctrl_t *, int);
extern void pcie_remove_minor_node(pcie_hp_ctrl_t *, int);
extern const struct pci_class_strings_s class_pci[];
extern int class_pci_items;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_PCIE_HP_H */