2018-01-27 04:22:04 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* PCI Hot Plug Controller Driver for RPA-compliant PPC64 platform.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 Linda Xie <lxie@us.ibm.com>
|
|
|
|
*
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Send feedback to <lxie@us.ibm.com>,
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PPC64PHP_H
|
|
|
|
#define _PPC64PHP_H
|
|
|
|
|
|
|
|
#include <linux/pci.h>
|
2006-10-20 15:23:05 +08:00
|
|
|
#include <linux/pci_hotplug.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define DR_INDICATOR 9002
|
|
|
|
#define DR_ENTITY_SENSE 9003
|
|
|
|
|
|
|
|
#define POWER_ON 100
|
|
|
|
#define POWER_OFF 0
|
|
|
|
|
|
|
|
#define LED_OFF 0
|
|
|
|
#define LED_ON 1 /* continuous on */
|
|
|
|
#define LED_ID 2 /* slow blinking */
|
|
|
|
#define LED_ACTION 3 /* fast blinking */
|
|
|
|
|
|
|
|
/* Sensor values from rtas_get-sensor */
|
|
|
|
#define EMPTY 0 /* No card in slot */
|
|
|
|
#define PRESENT 1 /* Card in slot */
|
|
|
|
|
|
|
|
#define MY_NAME "rpaphp"
|
2012-01-13 07:02:20 +08:00
|
|
|
extern bool rpaphp_debug;
|
2005-04-17 06:20:36 +08:00
|
|
|
#define dbg(format, arg...) \
|
|
|
|
do { \
|
2013-11-15 02:28:18 +08:00
|
|
|
if (rpaphp_debug) \
|
2005-04-17 06:20:36 +08:00
|
|
|
printk(KERN_DEBUG "%s: " format, \
|
2015-12-28 05:21:11 +08:00
|
|
|
MY_NAME, ## arg); \
|
2005-04-17 06:20:36 +08:00
|
|
|
} while (0)
|
2015-12-28 05:21:11 +08:00
|
|
|
#define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME, ## arg)
|
|
|
|
#define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME, ## arg)
|
|
|
|
#define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* slot states */
|
|
|
|
|
|
|
|
#define NOT_VALID 3
|
|
|
|
#define NOT_CONFIGURED 2
|
|
|
|
#define CONFIGURED 1
|
|
|
|
#define EMPTY 0
|
|
|
|
|
hotplug/drc-info: Add code to search ibm,drc-info property
rpadlpar_core.c: Provide parallel routines to search the older device-
tree properties ("ibm,drc-indexes", "ibm,drc-names", "ibm,drc-types"
and "ibm,drc-power-domains"), or the new property "ibm,drc-info".
The interface to examine the DRC information is changed from a "get"
function that returns values for local verification elsewhere, to a
"check" function that validates the 'name' and/or 'type' of a device
node. This update hides the format of the underlying device-tree
properties, and concentrates the value checks into a single function
without requiring the user to verify whether a search was successful.
Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-12-02 07:19:48 +08:00
|
|
|
/* DRC constants */
|
|
|
|
|
|
|
|
#define MAX_DRC_NAME_LEN 64
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* struct slot - slot information for each *physical* slot
|
|
|
|
*/
|
|
|
|
struct slot {
|
|
|
|
struct list_head rpaphp_slot_list;
|
|
|
|
int state;
|
|
|
|
u32 index;
|
|
|
|
u32 type;
|
|
|
|
u32 power_domain;
|
|
|
|
char *name;
|
2005-07-26 00:13:38 +08:00
|
|
|
struct device_node *dn;
|
|
|
|
struct pci_bus *bus;
|
|
|
|
struct list_head *pci_devs;
|
2005-04-17 06:20:36 +08:00
|
|
|
struct hotplug_slot *hotplug_slot;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct hotplug_slot_ops rpaphp_hotplug_slot_ops;
|
|
|
|
extern struct list_head rpaphp_slot_head;
|
|
|
|
|
|
|
|
/* function prototypes */
|
|
|
|
|
|
|
|
/* rpaphp_pci.c */
|
2013-04-13 02:02:59 +08:00
|
|
|
int rpaphp_enable_slot(struct slot *slot);
|
|
|
|
int rpaphp_get_sensor_state(struct slot *slot, int *state);
|
2005-09-29 08:33:38 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* rpaphp_core.c */
|
2013-04-13 02:02:59 +08:00
|
|
|
int rpaphp_add_slot(struct device_node *dn);
|
hotplug/drc-info: Add code to search ibm,drc-info property
rpadlpar_core.c: Provide parallel routines to search the older device-
tree properties ("ibm,drc-indexes", "ibm,drc-names", "ibm,drc-types"
and "ibm,drc-power-domains"), or the new property "ibm,drc-info".
The interface to examine the DRC information is changed from a "get"
function that returns values for local verification elsewhere, to a
"check" function that validates the 'name' and/or 'type' of a device
node. This update hides the format of the underlying device-tree
properties, and concentrates the value checks into a single function
without requiring the user to verify whether a search was successful.
Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-12-02 07:19:48 +08:00
|
|
|
int rpaphp_check_drc_props(struct device_node *dn, char *drc_name,
|
|
|
|
char *drc_type);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* rpaphp_slot.c */
|
2013-04-13 02:02:59 +08:00
|
|
|
void dealloc_slot_struct(struct slot *slot);
|
|
|
|
struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_name, int power_domain);
|
|
|
|
int rpaphp_register_slot(struct slot *slot);
|
|
|
|
int rpaphp_deregister_slot(struct slot *slot);
|
2013-11-15 02:28:18 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif /* _PPC64PHP_H */
|