#include <asm/io.h>
#include "pci_hotplug.h"
-#if !defined(CONFIG_HOTPLUG_PCI_PCIE_MODULE)
- #define MY_NAME "pciehp"
-#else
- #define MY_NAME THIS_MODULE->name
-#endif
+#define MY_NAME "pciehp"
extern int pciehp_poll_mode;
extern int pciehp_poll_time;
struct pci_dev* pci_dev;
};
-#define SLOT_MAGIC 0x67267321
struct slot {
- u32 magic;
struct slot *next;
u8 bus;
u8 device;
struct controller {
struct controller *next;
struct semaphore crit_sect; /* critical section semaphore */
- void * hpc_ctlr_handle; /* HPC controller handle */
+ void *hpc_ctlr_handle; /* HPC controller handle */
int num_slots; /* Number of slots on ctlr */
- int slot_num_inc; /* 1 or -1 */
+ int slot_num_inc; /* 1 or -1 */
struct pci_resource *mem_head;
struct pci_resource *p_mem_head;
struct pci_resource *io_head;
#define msg_initialization_err "Initialization failure, error=%d\n"
#define msg_HPC_rev_error "Unsupported revision of the PCI hot plug controller found.\n"
#define msg_HPC_non_pcie "The PCI hot plug controller is not supported by this driver.\n"
-#define msg_HPC_not_supported "This system is not supported by this version of pciephd mdoule. Upgrade to a newer version of pciehpd\n"
+#define msg_HPC_not_supported "This system is not supported by this version of pciephd module. Upgrade to a newer version of pciehpd\n"
#define msg_unable_to_save "Unable to store PCI hot plug add resource information. This system must be rebooted before adding any PCI devices.\n"
#define msg_button_on "PCI slot #%d - powering on due to button press.\n"
#define msg_button_off "PCI slot #%d - powering off due to button press.\n"
extern void pciehp_create_ctrl_files (struct controller *ctrl);
/* controller functions */
-extern void pciehp_pushbutton_thread (unsigned long event_pointer);
extern int pciehprm_find_available_resources (struct controller *ctrl);
extern int pciehp_event_start_thread (void);
extern void pciehp_event_stop_thread (void);
/* Inline functions */
-
-/* Inline functions to check the sanity of a pointer that is passed to us */
-static inline int slot_paranoia_check (struct slot *slot, const char *function)
-{
- if (!slot) {
- dbg("%s - slot == NULL", function);
- return -1;
- }
- if (slot->magic != SLOT_MAGIC) {
- dbg("%s - bad magic number for slot", function);
- return -1;
- }
- if (!slot->hotplug_slot) {
- dbg("%s - slot->hotplug_slot == NULL!", function);
- return -1;
- }
- return 0;
-}
-
-static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const char *function)
-{
- struct slot *slot;
-
- if (!hotplug_slot) {
- dbg("%s - hotplug_slot == NULL\n", function);
- return NULL;
- }
-
- slot = (struct slot *)hotplug_slot->private;
- if (slot_paranoia_check (slot, function))
- return NULL;
- return slot;
-}
-
-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 *p_slot, *tmp_slot = NULL;
- if (!ctrl)
- return NULL;
-
p_slot = ctrl->slot;
dbg("p_slot = %p\n", p_slot);
p_slot = tmp_slot;
}
- return (p_slot);
+ return p_slot;
}
-static inline int wait_for_ctrl_irq (struct controller *ctrl)
+static inline int wait_for_ctrl_irq(struct controller *ctrl)
{
int retval = 0;
typedef u8(*php_intr_callback_t) (unsigned int change_id, void *instance_id);
-int pcie_init( struct controller *ctrl, struct pci_dev *pdev,
+int pcie_init(struct controller *ctrl, struct pci_dev *pdev,
php_intr_callback_t attention_button_callback,
php_intr_callback_t switch_change_callback,
php_intr_callback_t presence_change_callback,
/* This has no meaning for PCI Express, as there is only 1 slot per port */
-int pcie_get_ctlr_slot_config( struct controller *ctrl,
+int pcie_get_ctlr_slot_config(struct controller *ctrl,
int *num_ctlr_slots,
int *first_device_num,
int *physical_slot_num,
int *flags);
struct hpc_ops {
- int (*power_on_slot ) (struct slot *slot);
- int (*power_off_slot ) (struct slot *slot);
- int (*get_power_status) (struct slot *slot, u8 *status);
+ int (*power_on_slot) (struct slot *slot);
+ int (*power_off_slot) (struct slot *slot);
+ int (*get_power_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 (*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_max_bus_speed) (struct slot *slot, enum pci_bus_speed *speed);
void (*green_led_off) (struct slot *slot);
void (*green_led_blink) (struct slot *slot);
void (*release_ctlr) (struct controller *ctrl);
- int (*check_lnk_status) (struct controller *ctrl);
+ int (*check_lnk_status) (struct controller *ctrl);
};
#endif /* _PCIEHP_H */