Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 44820
b: refs/heads/master
c: 0abe68c
h: refs/heads/master
v: v3
  • Loading branch information
Kenji Kaneshige authored and Greg Kroah-Hartman committed Dec 20, 2006
1 parent 112a434 commit 16a8c9f
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 250 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ab17443a3df35abe4b7529e83511a591aa7384f3
refs/heads/master: 0abe68ce24973a23fcc6cbce80343f68656de7b6
42 changes: 6 additions & 36 deletions trunk/drivers/pci/hotplug/shpchp.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ struct event_info {
struct controller {
struct mutex crit_sect; /* critical section mutex */
struct mutex cmd_lock; /* command lock */
struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */
int num_slots; /* Number of slots on ctlr */
int slot_num_inc; /* 1 or -1 */
struct pci_dev *pci_dev;
Expand All @@ -102,6 +101,8 @@ struct controller {
u32 cap_offset;
unsigned long mmio_base;
unsigned long mmio_size;
void __iomem *creg;
struct timer_list poll_timer;
};


Expand Down Expand Up @@ -176,10 +177,10 @@ extern int __must_check shpchp_create_ctrl_files(struct controller *ctrl);
extern int shpchp_sysfs_enable_slot(struct slot *slot);
extern int shpchp_sysfs_disable_slot(struct slot *slot);

extern u8 shpchp_handle_attention_button(u8 hp_slot, void *inst_id);
extern u8 shpchp_handle_switch_change(u8 hp_slot, void *inst_id);
extern u8 shpchp_handle_presence_change(u8 hp_slot, void *inst_id);
extern u8 shpchp_handle_power_fault(u8 hp_slot, void *inst_id);
extern u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl);
extern u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl);
extern u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl);
extern u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl);

/* pci functions */
extern int shpchp_save_config(struct controller *ctrl, int busnumber, int num_ctlr_slots, int first_device_num);
Expand Down Expand Up @@ -262,24 +263,6 @@ enum ctrl_offsets {
SLOT11 = offsetof(struct ctrl_reg, slot11),
SLOT12 = offsetof(struct ctrl_reg, slot12),
};
typedef u8(*php_intr_callback_t) (u8 hp_slot, void *instance_id);
struct php_ctlr_state_s {
struct php_ctlr_state_s *pnext;
struct pci_dev *pci_dev;
unsigned int irq;
unsigned long flags; /* spinlock's */
u32 slot_device_offset;
u32 num_slots;
struct timer_list int_poll_timer; /* Added for poll event */
php_intr_callback_t attention_button_callback;
php_intr_callback_t switch_change_callback;
php_intr_callback_t presence_change_callback;
php_intr_callback_t power_fault_callback;
void *callback_instance_id;
void __iomem *creg; /* Ptr to controller register space */
};
/* 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)
Expand Down Expand Up @@ -400,21 +383,8 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot)
pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, pcix_misc2_temp);
}

enum php_ctlr_type {
PCI,
ISA,
ACPI
};

int shpc_init( struct controller *ctrl, struct pci_dev *pdev);

int shpc_get_ctlr_slot_config( struct controller *ctrl,
int *num_ctlr_slots,
int *first_device_num,
int *physical_slot_num,
int *updown,
int *flags);

struct hpc_ops {
int (*power_on_slot ) (struct slot *slot);
int (*slot_enable ) (struct slot *slot);
Expand Down
45 changes: 1 addition & 44 deletions trunk/drivers/pci/hotplug/shpchp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,36 +211,6 @@ void cleanup_slots(struct controller *ctrl)
}
}

static int get_ctlr_slot_config(struct controller *ctrl)
{
int num_ctlr_slots;
int first_device_num;
int physical_slot_num;
int updown;
int rc;
int flags;

rc = shpc_get_ctlr_slot_config(ctrl, &num_ctlr_slots,
&first_device_num, &physical_slot_num,
&updown, &flags);
if (rc) {
err("%s: get_ctlr_slot_config fail for b:d (%x:%x)\n",
__FUNCTION__, ctrl->bus, ctrl->device);
return -1;
}

ctrl->num_slots = num_ctlr_slots;
ctrl->slot_device_offset = first_device_num;
ctrl->first_slot = physical_slot_num;
ctrl->slot_num_inc = updown; /* either -1 or 1 */

dbg("%s: num_slot(0x%x) 1st_dev(0x%x) psn(0x%x) updown(%d) for b:d "
"(%x:%x)\n", __FUNCTION__, num_ctlr_slots, first_device_num,
physical_slot_num, updown, ctrl->bus, ctrl->device);

return 0;
}

/*
* set_attention_status - Turns the Amber LED for a slot on, off or blink
*/
Expand Down Expand Up @@ -386,8 +356,6 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
int rc;
struct controller *ctrl;
struct slot *t_slot;
int first_device_num; /* first PCI device number */
int num_ctlr_slots; /* number of slots implemented */

if (!is_shpc_capable(pdev))
return -ENODEV;
Expand Down Expand Up @@ -416,17 +384,6 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dbg("ctrl bus=0x%x, device=%x, function=%x, irq=%x\n",
ctrl->bus, ctrl->device, ctrl->function, pdev->irq);

/*
* Save configuration headers for this and subordinate PCI buses
*/
rc = get_ctlr_slot_config(ctrl);
if (rc) {
err(msg_initialization_err, rc);
goto err_out_release_ctlr;
}
first_device_num = ctrl->slot_device_offset;
num_ctlr_slots = ctrl->num_slots;

ctrl->add_support = 1;

/* Setup the slot information structures */
Expand All @@ -437,7 +394,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}

/* Now hpc_functions (slot->hpc_ops->functions) are ready */
t_slot = shpchp_find_slot(ctrl, first_device_num);
t_slot = shpchp_find_slot(ctrl, ctrl->slot_device_offset);

/* Check for operation bus speed */
rc = t_slot->hpc_ops->get_cur_bus_speed(t_slot, &ctrl->speed);
Expand Down
12 changes: 4 additions & 8 deletions trunk/drivers/pci/hotplug/shpchp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type)
return 0;
}

u8 shpchp_handle_attention_button(u8 hp_slot, void *inst_id)
u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
{
struct controller *ctrl = (struct controller *) inst_id;
struct slot *p_slot;
u32 event_type;

Expand All @@ -81,9 +80,8 @@ u8 shpchp_handle_attention_button(u8 hp_slot, void *inst_id)

}

u8 shpchp_handle_switch_change(u8 hp_slot, void *inst_id)
u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
{
struct controller *ctrl = (struct controller *) inst_id;
struct slot *p_slot;
u8 getstatus;
u32 event_type;
Expand Down Expand Up @@ -120,9 +118,8 @@ u8 shpchp_handle_switch_change(u8 hp_slot, void *inst_id)
return 1;
}

u8 shpchp_handle_presence_change(u8 hp_slot, void *inst_id)
u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
{
struct controller *ctrl = (struct controller *) inst_id;
struct slot *p_slot;
u32 event_type;

Expand Down Expand Up @@ -154,9 +151,8 @@ u8 shpchp_handle_presence_change(u8 hp_slot, void *inst_id)
return 1;
}

u8 shpchp_handle_power_fault(u8 hp_slot, void *inst_id)
u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
{
struct controller *ctrl = (struct controller *) inst_id;
struct slot *p_slot;
u32 event_type;

Expand Down
Loading

0 comments on commit 16a8c9f

Please sign in to comment.