0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef _PPC64PHP_H
0014 #define _PPC64PHP_H
0015
0016 #include <linux/pci.h>
0017 #include <linux/pci_hotplug.h>
0018
0019 #define DR_INDICATOR 9002
0020 #define DR_ENTITY_SENSE 9003
0021
0022 #define POWER_ON 100
0023 #define POWER_OFF 0
0024
0025 #define LED_OFF 0
0026 #define LED_ON 1
0027 #define LED_ID 2
0028 #define LED_ACTION 3
0029
0030
0031 #define EMPTY 0
0032 #define PRESENT 1
0033
0034 #define MY_NAME "rpaphp"
0035 extern bool rpaphp_debug;
0036 #define dbg(format, arg...) \
0037 do { \
0038 if (rpaphp_debug) \
0039 printk(KERN_DEBUG "%s: " format, \
0040 MY_NAME, ## arg); \
0041 } while (0)
0042 #define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME, ## arg)
0043 #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME, ## arg)
0044 #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg)
0045
0046
0047
0048 #define NOT_VALID 3
0049 #define NOT_CONFIGURED 2
0050 #define CONFIGURED 1
0051 #define EMPTY 0
0052
0053
0054
0055 #define MAX_DRC_NAME_LEN 64
0056
0057
0058
0059
0060 struct slot {
0061 struct list_head rpaphp_slot_list;
0062 int state;
0063 u32 index;
0064 u32 type;
0065 u32 power_domain;
0066 u8 attention_status;
0067 char *name;
0068 struct device_node *dn;
0069 struct pci_bus *bus;
0070 struct list_head *pci_devs;
0071 struct hotplug_slot hotplug_slot;
0072 };
0073
0074 extern const struct hotplug_slot_ops rpaphp_hotplug_slot_ops;
0075 extern struct list_head rpaphp_slot_head;
0076
0077 static inline struct slot *to_slot(struct hotplug_slot *hotplug_slot)
0078 {
0079 return container_of(hotplug_slot, struct slot, hotplug_slot);
0080 }
0081
0082
0083
0084
0085 int rpaphp_enable_slot(struct slot *slot);
0086 int rpaphp_get_sensor_state(struct slot *slot, int *state);
0087
0088
0089 int rpaphp_add_slot(struct device_node *dn);
0090 int rpaphp_check_drc_props(struct device_node *dn, char *drc_name,
0091 char *drc_type);
0092
0093
0094 void dealloc_slot_struct(struct slot *slot);
0095 struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_name, int power_domain);
0096 int rpaphp_register_slot(struct slot *slot);
0097 int rpaphp_deregister_slot(struct slot *slot);
0098
0099 #endif