Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * PCI Hot Plug Controller Driver for RPA-compliant PPC64 platform.
0004  *
0005  * Copyright (C) 2003 Linda Xie <lxie@us.ibm.com>
0006  *
0007  * All rights reserved.
0008  *
0009  * Send feedback to <lxie@us.ibm.com>,
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   /* continuous on */
0027 #define LED_ID      2   /* slow blinking */
0028 #define LED_ACTION  3   /* fast blinking */
0029 
0030 /* Sensor values from rtas_get-sensor */
0031 #define EMPTY           0   /* No card in slot */
0032 #define PRESENT         1   /* Card in slot */
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 /* slot states */
0047 
0048 #define NOT_VALID   3
0049 #define NOT_CONFIGURED  2
0050 #define CONFIGURED  1
0051 #define EMPTY       0
0052 
0053 /* DRC constants */
0054 
0055 #define MAX_DRC_NAME_LEN 64
0056 
0057 /*
0058  * struct slot - slot information for each *physical* slot
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 /* function prototypes */
0083 
0084 /* rpaphp_pci.c */
0085 int rpaphp_enable_slot(struct slot *slot);
0086 int rpaphp_get_sensor_state(struct slot *slot, int *state);
0087 
0088 /* rpaphp_core.c */
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 /* rpaphp_slot.c */
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              /* _PPC64PHP_H */