Commit 15232ece authored by Kenji Kaneshige's avatar Kenji Kaneshige Committed by Greg Kroah-Hartman

pciehp: cleanup pciehp.h

This patch cleans up pciehp.h. This has no functional change.
Signed-off-by: default avatarKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: default avatarKristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a0f018da
...@@ -44,11 +44,17 @@ extern int pciehp_poll_time; ...@@ -44,11 +44,17 @@ extern int pciehp_poll_time;
extern int pciehp_debug; extern int pciehp_debug;
extern int pciehp_force; extern int pciehp_force;
/*#define dbg(format, arg...) do { if (pciehp_debug) printk(KERN_DEBUG "%s: " format, MY_NAME , ## arg); } while (0)*/ #define dbg(format, arg...) \
#define dbg(format, arg...) do { if (pciehp_debug) printk("%s: " format, MY_NAME , ## arg); } while (0) do { \
#define err(format, arg...) printk(KERN_ERR "%s: " format, MY_NAME , ## arg) if (pciehp_debug) \
#define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg) printk("%s: " format, MY_NAME , ## arg); \
#define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) } while (0)
#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)
#define SLOT_NAME_SIZE 10 #define SLOT_NAME_SIZE 10
struct slot { struct slot {
...@@ -113,8 +119,6 @@ struct controller { ...@@ -113,8 +119,6 @@ struct controller {
#define POWERON_STATE 3 #define POWERON_STATE 3
#define POWEROFF_STATE 4 #define POWEROFF_STATE 4
#define PCI_TO_PCI_BRIDGE_CLASS 0x00060400
/* Error messages */ /* Error messages */
#define INTERLOCK_OPEN 0x00000002 #define INTERLOCK_OPEN 0x00000002
#define ADD_NOT_SUPPORTED 0x00000003 #define ADD_NOT_SUPPORTED 0x00000003
...@@ -126,10 +130,6 @@ struct controller { ...@@ -126,10 +130,6 @@ struct controller {
#define WRONG_BUS_FREQUENCY 0x0000000D #define WRONG_BUS_FREQUENCY 0x0000000D
#define POWER_FAILURE 0x0000000E #define POWER_FAILURE 0x0000000E
#define REMOVE_NOT_SUPPORTED 0x00000003
#define DISABLE_CARD 1
/* Field definitions in Slot Capabilities Register */ /* Field definitions in Slot Capabilities Register */
#define ATTN_BUTTN_PRSN 0x00000001 #define ATTN_BUTTN_PRSN 0x00000001
#define PWR_CTRL_PRSN 0x00000002 #define PWR_CTRL_PRSN 0x00000002
...@@ -145,38 +145,21 @@ struct controller { ...@@ -145,38 +145,21 @@ struct controller {
#define PWR_LED(cap) (cap & PWR_LED_PRSN) #define PWR_LED(cap) (cap & PWR_LED_PRSN)
#define HP_SUPR_RM(cap) (cap & HP_SUPR_RM_SUP) #define HP_SUPR_RM(cap) (cap & HP_SUPR_RM_SUP)
/* extern int pciehp_event_start_thread(void);
* error Messages extern void pciehp_event_stop_thread(void);
*/ extern int pciehp_enable_slot(struct slot *slot);
#define msg_initialization_err "Initialization failure, error=%d\n" extern int pciehp_disable_slot(struct slot *slot);
#define msg_button_on "PCI slot #%s - powering on due to button press.\n"
#define msg_button_off "PCI slot #%s - powering off due to button press.\n"
#define msg_button_cancel "PCI slot #%s - action canceled due to button press.\n"
#define msg_button_ignore "PCI slot #%s - button press ignored. (action in progress...)\n"
/* controller functions */
extern int pciehp_event_start_thread (void);
extern void pciehp_event_stop_thread (void);
extern int pciehp_enable_slot (struct slot *slot);
extern int pciehp_disable_slot (struct slot *slot);
extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl); extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl);
extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl); extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl);
extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl); extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl);
extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl); extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl);
/* extern void long_delay (int delay); */ extern int pciehp_configure_device(struct slot *p_slot);
extern int pciehp_unconfigure_device(struct slot *p_slot);
/* pci functions */ int pcie_init(struct controller *ctrl, struct pcie_device *dev);
extern int pciehp_configure_device (struct slot *p_slot);
extern int pciehp_unconfigure_device (struct slot *p_slot);
/* Global variables */ /* Global variables */
extern struct controller *pciehp_ctrl_list; extern struct controller *pciehp_ctrl_list;
/* Inline functions */
static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device)
{ {
struct slot *slot; struct slot *slot;
...@@ -192,8 +175,6 @@ static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) ...@@ -192,8 +175,6 @@ static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device)
static inline int wait_for_ctrl_irq(struct controller *ctrl) static inline int wait_for_ctrl_irq(struct controller *ctrl)
{ {
int retval = 0;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
add_wait_queue(&ctrl->queue, &wait); add_wait_queue(&ctrl->queue, &wait);
...@@ -205,44 +186,38 @@ static inline int wait_for_ctrl_irq(struct controller *ctrl) ...@@ -205,44 +186,38 @@ static inline int wait_for_ctrl_irq(struct controller *ctrl)
remove_wait_queue(&ctrl->queue, &wait); remove_wait_queue(&ctrl->queue, &wait);
if (signal_pending(current)) if (signal_pending(current))
retval = -EINTR; return -EINTR;
return retval; return 0;
} }
int pcie_init(struct controller *ctrl, struct pcie_device *dev);
struct hpc_ops { struct hpc_ops {
int (*power_on_slot) (struct slot *slot); int (*power_on_slot)(struct slot *slot);
int (*power_off_slot) (struct slot *slot); int (*power_off_slot)(struct slot *slot);
int (*get_power_status) (struct slot *slot, u8 *status); int (*get_power_status)(struct slot *slot, u8 *status);
int (*get_attention_status) (struct slot *slot, u8 *status); int (*get_attention_status)(struct slot *slot, u8 *status);
int (*set_attention_status) (struct slot *slot, u8 status); int (*set_attention_status)(struct slot *slot, u8 status);
int (*get_latch_status) (struct slot *slot, u8 *status); int (*get_latch_status)(struct slot *slot, u8 *status);
int (*get_adapter_status) (struct slot *slot, u8 *status); int (*get_adapter_status)(struct slot *slot, u8 *status);
int (*get_max_bus_speed)(struct slot *slot, enum pci_bus_speed *speed);
int (*get_max_bus_speed) (struct slot *slot, enum pci_bus_speed *speed); int (*get_cur_bus_speed)(struct slot *slot, enum pci_bus_speed *speed);
int (*get_cur_bus_speed) (struct slot *slot, enum pci_bus_speed *speed); int (*get_max_lnk_width)(struct slot *slot, enum pcie_link_width *val);
int (*get_cur_lnk_width)(struct slot *slot, enum pcie_link_width *val);
int (*get_max_lnk_width) (struct slot *slot, enum pcie_link_width *value); int (*query_power_fault)(struct slot *slot);
int (*get_cur_lnk_width) (struct slot *slot, enum pcie_link_width *value); void (*green_led_on)(struct slot *slot);
void (*green_led_off)(struct slot *slot);
int (*query_power_fault) (struct slot *slot); void (*green_led_blink)(struct slot *slot);
void (*green_led_on) (struct slot *slot); void (*release_ctlr)(struct controller *ctrl);
void (*green_led_off) (struct slot *slot); int (*check_lnk_status)(struct controller *ctrl);
void (*green_led_blink) (struct slot *slot);
void (*release_ctlr) (struct controller *ctrl);
int (*check_lnk_status) (struct controller *ctrl);
}; };
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/actypes.h> #include <acpi/actypes.h>
#include <linux/pci-acpi.h> #include <linux/pci-acpi.h>
#define pciehp_get_hp_hw_control_from_firmware(dev) \ #define pciehp_get_hp_hw_control_from_firmware(dev) \
pciehp_acpi_get_hp_hw_control_from_firmware(dev) pciehp_acpi_get_hp_hw_control_from_firmware(dev)
static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev, static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev,
struct hotplug_params *hpp) struct hotplug_params *hpp)
......
...@@ -357,7 +357,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ ...@@ -357,7 +357,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
/* Setup the slot information structures */ /* Setup the slot information structures */
rc = init_slots(ctrl); rc = init_slots(ctrl);
if (rc) { if (rc) {
err(msg_initialization_err, 6); err("%s: slot initialization failed\n", PCIE_MODULE_NAME);
goto err_out_release_ctlr; goto err_out_release_ctlr;
} }
......
...@@ -655,7 +655,7 @@ static void interrupt_event_handler(struct controller *ctrl) ...@@ -655,7 +655,7 @@ static void interrupt_event_handler(struct controller *ctrl)
warn("Not a valid state\n"); warn("Not a valid state\n");
return; return;
} }
info(msg_button_cancel, slot_name(p_slot)); info("PCI slot #%s - action canceled due to button press.\n", slot_name(p_slot));
p_slot->state = STATIC_STATE; p_slot->state = STATIC_STATE;
} }
/* ***********Button Pressed (No action on 1st press...) */ /* ***********Button Pressed (No action on 1st press...) */
...@@ -668,12 +668,12 @@ static void interrupt_event_handler(struct controller *ctrl) ...@@ -668,12 +668,12 @@ static void interrupt_event_handler(struct controller *ctrl)
/* slot is on */ /* slot is on */
dbg("slot is on\n"); dbg("slot is on\n");
p_slot->state = BLINKINGOFF_STATE; p_slot->state = BLINKINGOFF_STATE;
info(msg_button_off, slot_name(p_slot)); info("PCI slot #%s - powering off due to button press.\n", slot_name(p_slot));
} else { } else {
/* slot is off */ /* slot is off */
dbg("slot is off\n"); dbg("slot is off\n");
p_slot->state = BLINKINGON_STATE; p_slot->state = BLINKINGON_STATE;
info(msg_button_on, slot_name(p_slot)); info("PCI slot #%s - powering on due to button press.\n", slot_name(p_slot));
} }
/* Wait for exclusive access to hardware */ /* Wait for exclusive access to hardware */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment