提交 be7bce25 编写于 作者: T Taku Izumi 提交者: Jesse Barnes

PCI hotplug: shpchp: message refinement

This patch refines messages in shpchp module.  The main changes are as
follows:

 - remove the trailing "."
 - remove __func__ as much as possible
 - capitalize the first letter of messages
 - show PCI device address including its domain
Signed-off-by: NTaku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
上级 f98ca311
...@@ -253,7 +253,7 @@ static inline struct slot *shpchp_find_slot(struct controller *ctrl, u8 device) ...@@ -253,7 +253,7 @@ static inline struct slot *shpchp_find_slot(struct controller *ctrl, u8 device)
return slot; return slot;
} }
ctrl_err(ctrl, "%s: slot (device=0x%x) not found\n", __func__, device); ctrl_err(ctrl, "Slot (device=0x%02x) not found\n", device);
return NULL; return NULL;
} }
...@@ -288,8 +288,8 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot) ...@@ -288,8 +288,8 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot)
perr_set = pcix_bridge_errors_reg & PERR_OBSERVED_MASK; perr_set = pcix_bridge_errors_reg & PERR_OBSERVED_MASK;
if (perr_set) { if (perr_set) {
ctrl_dbg(p_slot->ctrl, ctrl_dbg(p_slot->ctrl,
"%s W1C: Bridge_Errors[ PERR_OBSERVED = %08X]\n", "Bridge_Errors[ PERR_OBSERVED = %08X] (W1C)\n",
__func__ , perr_set); perr_set);
pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, perr_set); pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, perr_set);
} }
...@@ -298,8 +298,7 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot) ...@@ -298,8 +298,7 @@ static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot)
pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, &pcix_mem_base_reg); pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, &pcix_mem_base_reg);
rse_set = pcix_mem_base_reg & RSE_MASK; rse_set = pcix_mem_base_reg & RSE_MASK;
if (rse_set) { if (rse_set) {
ctrl_dbg(p_slot->ctrl, "%s W1C: Memory_Base_Limit[ RSE ]\n", ctrl_dbg(p_slot->ctrl, "Memory_Base_Limit[ RSE ] (W1C)\n");
__func__);
pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set);
} }
......
...@@ -89,7 +89,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot) ...@@ -89,7 +89,7 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = hotplug_slot->private; struct slot *slot = hotplug_slot->private;
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot)); __func__, slot_name(slot));
kfree(slot->hotplug_slot->info); kfree(slot->hotplug_slot->info);
...@@ -136,9 +136,11 @@ static int init_slots(struct controller *ctrl) ...@@ -136,9 +136,11 @@ static int init_slots(struct controller *ctrl)
snprintf(name, SLOT_NAME_SIZE, "%d", slot->number); snprintf(name, SLOT_NAME_SIZE, "%d", slot->number);
hotplug_slot->ops = &shpchp_hotplug_slot_ops; hotplug_slot->ops = &shpchp_hotplug_slot_ops;
ctrl_dbg(ctrl, "Registering bus=%x dev=%x hp_slot=%x sun=%x " ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x "
"slot_device_offset=%x\n", slot->bus, slot->device, "hp_slot=%x sun=%x slot_device_offset=%x\n",
slot->hp_slot, slot->number, ctrl->slot_device_offset); pci_domain_nr(ctrl->pci_dev->subordinate),
slot->bus, slot->device, slot->hp_slot, slot->number,
ctrl->slot_device_offset);
retval = pci_hp_register(slot->hotplug_slot, retval = pci_hp_register(slot->hotplug_slot,
ctrl->pci_dev->subordinate, slot->device, name); ctrl->pci_dev->subordinate, slot->device, name);
if (retval) { if (retval) {
...@@ -189,7 +191,7 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) ...@@ -189,7 +191,7 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
{ {
struct slot *slot = get_slot(hotplug_slot); struct slot *slot = get_slot(hotplug_slot);
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot)); __func__, slot_name(slot));
hotplug_slot->info->attention_status = status; hotplug_slot->info->attention_status = status;
...@@ -202,7 +204,7 @@ static int enable_slot (struct hotplug_slot *hotplug_slot) ...@@ -202,7 +204,7 @@ static int enable_slot (struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = get_slot(hotplug_slot); struct slot *slot = get_slot(hotplug_slot);
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot)); __func__, slot_name(slot));
return shpchp_sysfs_enable_slot(slot); return shpchp_sysfs_enable_slot(slot);
...@@ -212,7 +214,7 @@ static int disable_slot (struct hotplug_slot *hotplug_slot) ...@@ -212,7 +214,7 @@ static int disable_slot (struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = get_slot(hotplug_slot); struct slot *slot = get_slot(hotplug_slot);
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot)); __func__, slot_name(slot));
return shpchp_sysfs_disable_slot(slot); return shpchp_sysfs_disable_slot(slot);
...@@ -223,7 +225,7 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -223,7 +225,7 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
struct slot *slot = get_slot(hotplug_slot); struct slot *slot = get_slot(hotplug_slot);
int retval; int retval;
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot)); __func__, slot_name(slot));
retval = slot->hpc_ops->get_power_status(slot, value); retval = slot->hpc_ops->get_power_status(slot, value);
...@@ -238,7 +240,7 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -238,7 +240,7 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
struct slot *slot = get_slot(hotplug_slot); struct slot *slot = get_slot(hotplug_slot);
int retval; int retval;
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot)); __func__, slot_name(slot));
retval = slot->hpc_ops->get_attention_status(slot, value); retval = slot->hpc_ops->get_attention_status(slot, value);
...@@ -253,7 +255,7 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -253,7 +255,7 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
struct slot *slot = get_slot(hotplug_slot); struct slot *slot = get_slot(hotplug_slot);
int retval; int retval;
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot)); __func__, slot_name(slot));
retval = slot->hpc_ops->get_latch_status(slot, value); retval = slot->hpc_ops->get_latch_status(slot, value);
...@@ -268,7 +270,7 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -268,7 +270,7 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
struct slot *slot = get_slot(hotplug_slot); struct slot *slot = get_slot(hotplug_slot);
int retval; int retval;
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot)); __func__, slot_name(slot));
retval = slot->hpc_ops->get_adapter_status(slot, value); retval = slot->hpc_ops->get_adapter_status(slot, value);
...@@ -284,7 +286,7 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, ...@@ -284,7 +286,7 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot,
struct slot *slot = get_slot(hotplug_slot); struct slot *slot = get_slot(hotplug_slot);
int retval; int retval;
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot)); __func__, slot_name(slot));
retval = slot->hpc_ops->get_max_bus_speed(slot, value); retval = slot->hpc_ops->get_max_bus_speed(slot, value);
...@@ -299,7 +301,7 @@ static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp ...@@ -299,7 +301,7 @@ static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp
struct slot *slot = get_slot(hotplug_slot); struct slot *slot = get_slot(hotplug_slot);
int retval; int retval;
ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
__func__, slot_name(slot)); __func__, slot_name(slot));
retval = slot->hpc_ops->get_cur_bus_speed(slot, value); retval = slot->hpc_ops->get_cur_bus_speed(slot, value);
...@@ -331,14 +333,14 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -331,14 +333,14 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
if (!ctrl) { if (!ctrl) {
dev_err(&pdev->dev, "%s : out of memory\n", __func__); dev_err(&pdev->dev, "%s: Out of memory\n", __func__);
goto err_out_none; goto err_out_none;
} }
INIT_LIST_HEAD(&ctrl->slot_list); INIT_LIST_HEAD(&ctrl->slot_list);
rc = shpc_init(ctrl, pdev); rc = shpc_init(ctrl, pdev);
if (rc) { if (rc) {
ctrl_dbg(ctrl, "controller initialization failed\n"); ctrl_dbg(ctrl, "Controller initialization failed\n");
goto err_out_free_ctrl; goto err_out_free_ctrl;
} }
...@@ -347,7 +349,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -347,7 +349,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* Setup the slot information structures */ /* Setup the slot information structures */
rc = init_slots(ctrl); rc = init_slots(ctrl);
if (rc) { if (rc) {
ctrl_err(ctrl, "slot initialization failed\n"); ctrl_err(ctrl, "Slot initialization failed\n");
goto err_out_release_ctlr; goto err_out_release_ctlr;
} }
......
...@@ -62,7 +62,7 @@ u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl) ...@@ -62,7 +62,7 @@ u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
u32 event_type; u32 event_type;
/* Attention Button Change */ /* Attention Button Change */
ctrl_dbg(ctrl, "Attention button interrupt received.\n"); ctrl_dbg(ctrl, "Attention button interrupt received\n");
p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
...@@ -86,13 +86,13 @@ u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl) ...@@ -86,13 +86,13 @@ u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
u32 event_type; u32 event_type;
/* Switch Change */ /* Switch Change */
ctrl_dbg(ctrl, "Switch interrupt received.\n"); ctrl_dbg(ctrl, "Switch interrupt received\n");
p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save));
p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
ctrl_dbg(ctrl, "%s: Card present %x Power status %x\n", ctrl_dbg(ctrl, "Card present %x Power status %x\n",
__func__, p_slot->presence_save, p_slot->pwr_save); p_slot->presence_save, p_slot->pwr_save);
if (getstatus) { if (getstatus) {
/* /*
...@@ -123,7 +123,7 @@ u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl) ...@@ -123,7 +123,7 @@ u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
u32 event_type; u32 event_type;
/* Presence Change */ /* Presence Change */
ctrl_dbg(ctrl, "Presence/Notify input change.\n"); ctrl_dbg(ctrl, "Presence/Notify input change\n");
p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
...@@ -158,7 +158,7 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl) ...@@ -158,7 +158,7 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
u32 event_type; u32 event_type;
/* Power fault */ /* Power fault */
ctrl_dbg(ctrl, "Power fault interrupt received.\n"); ctrl_dbg(ctrl, "Power fault interrupt received\n");
p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
...@@ -178,7 +178,7 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl) ...@@ -178,7 +178,7 @@ u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
event_type = INT_POWER_FAULT; event_type = INT_POWER_FAULT;
/* set power fault status for this board */ /* set power fault status for this board */
p_slot->status = 0xFF; p_slot->status = 0xFF;
ctrl_info(ctrl, "power fault bit %x set\n", hp_slot); ctrl_info(ctrl, "Power fault bit %x set\n", hp_slot);
} }
queue_interrupt_event(p_slot, event_type); queue_interrupt_event(p_slot, event_type);
...@@ -194,7 +194,7 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot, ...@@ -194,7 +194,7 @@ static int change_bus_speed(struct controller *ctrl, struct slot *p_slot,
{ {
int rc = 0; int rc = 0;
ctrl_dbg(ctrl, "%s: change to speed %d\n", __func__, speed); ctrl_dbg(ctrl, "Change speed to %d\n", speed);
if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) {
ctrl_err(ctrl, "%s: Issue of set bus speed mode command " ctrl_err(ctrl, "%s: Issue of set bus speed mode command "
"failed\n", __func__); "failed\n", __func__);
...@@ -215,8 +215,8 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot, ...@@ -215,8 +215,8 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot,
*/ */
if (flag) { if (flag) {
if (asp < bsp) { if (asp < bsp) {
ctrl_err(ctrl, "%s: speed of bus %x and adapter %x " ctrl_err(ctrl, "Speed of bus %x and adapter %x "
"mismatch\n", __func__, bsp, asp); "mismatch\n", bsp, asp);
rc = WRONG_BUS_FREQUENCY; rc = WRONG_BUS_FREQUENCY;
} }
return rc; return rc;
...@@ -246,6 +246,7 @@ static int board_added(struct slot *p_slot) ...@@ -246,6 +246,7 @@ static int board_added(struct slot *p_slot)
int rc = 0; int rc = 0;
enum pci_bus_speed asp, bsp, msp; enum pci_bus_speed asp, bsp, msp;
struct controller *ctrl = p_slot->ctrl; struct controller *ctrl = p_slot->ctrl;
struct pci_bus *parent = ctrl->pci_dev->subordinate;
hp_slot = p_slot->device - ctrl->slot_device_offset; hp_slot = p_slot->device - ctrl->slot_device_offset;
...@@ -256,7 +257,7 @@ static int board_added(struct slot *p_slot) ...@@ -256,7 +257,7 @@ static int board_added(struct slot *p_slot)
/* Power on slot without connecting to bus */ /* Power on slot without connecting to bus */
rc = p_slot->hpc_ops->power_on_slot(p_slot); rc = p_slot->hpc_ops->power_on_slot(p_slot);
if (rc) { if (rc) {
ctrl_err(ctrl, "%s: Failed to power on slot\n", __func__); ctrl_err(ctrl, "Failed to power on slot\n");
return -1; return -1;
} }
...@@ -272,29 +273,27 @@ static int board_added(struct slot *p_slot) ...@@ -272,29 +273,27 @@ static int board_added(struct slot *p_slot)
/* turn on board, blink green LED, turn off Amber LED */ /* turn on board, blink green LED, turn off Amber LED */
if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) {
ctrl_err(ctrl, "%s: Issue of Slot Enable command" ctrl_err(ctrl, "Issue of Slot Enable command failed\n");
" failed\n", __func__);
return rc; return rc;
} }
} }
rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp); rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp);
if (rc) { if (rc) {
ctrl_err(ctrl, "%s: Can't get adapter speed or bus mode " ctrl_err(ctrl, "Can't get adapter speed or "
"mismatch\n", __func__); "bus mode mismatch\n");
return WRONG_BUS_FREQUENCY; return WRONG_BUS_FREQUENCY;
} }
rc = p_slot->hpc_ops->get_cur_bus_speed(p_slot, &bsp); rc = p_slot->hpc_ops->get_cur_bus_speed(p_slot, &bsp);
if (rc) { if (rc) {
ctrl_err(ctrl, "%s: Can't get bus operation speed\n", __func__); ctrl_err(ctrl, "Can't get bus operation speed\n");
return WRONG_BUS_FREQUENCY; return WRONG_BUS_FREQUENCY;
} }
rc = p_slot->hpc_ops->get_max_bus_speed(p_slot, &msp); rc = p_slot->hpc_ops->get_max_bus_speed(p_slot, &msp);
if (rc) { if (rc) {
ctrl_err(ctrl, "%s: Can't get max bus operation speed\n", ctrl_err(ctrl, "Can't get max bus operation speed\n");
__func__);
msp = bsp; msp = bsp;
} }
...@@ -312,8 +311,7 @@ static int board_added(struct slot *p_slot) ...@@ -312,8 +311,7 @@ static int board_added(struct slot *p_slot)
/* turn on board, blink green LED, turn off Amber LED */ /* turn on board, blink green LED, turn off Amber LED */
if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) {
ctrl_err(ctrl, "%s: Issue of Slot Enable command failed\n", ctrl_err(ctrl, "Issue of Slot Enable command failed\n");
__func__);
return rc; return rc;
} }
...@@ -324,15 +322,15 @@ static int board_added(struct slot *p_slot) ...@@ -324,15 +322,15 @@ static int board_added(struct slot *p_slot)
/* Check for a power fault */ /* Check for a power fault */
if (p_slot->status == 0xFF) { if (p_slot->status == 0xFF) {
/* power fault occurred, but it was benign */ /* power fault occurred, but it was benign */
ctrl_dbg(ctrl, "%s: power fault\n", __func__); ctrl_dbg(ctrl, "%s: Power fault\n", __func__);
rc = POWER_FAILURE; rc = POWER_FAILURE;
p_slot->status = 0; p_slot->status = 0;
goto err_exit; goto err_exit;
} }
if (shpchp_configure_device(p_slot)) { if (shpchp_configure_device(p_slot)) {
ctrl_err(ctrl, "Cannot add device at 0x%x:0x%x\n", ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n",
p_slot->bus, p_slot->device); pci_domain_nr(parent), p_slot->bus, p_slot->device);
goto err_exit; goto err_exit;
} }
...@@ -373,7 +371,7 @@ static int remove_board(struct slot *p_slot) ...@@ -373,7 +371,7 @@ static int remove_board(struct slot *p_slot)
hp_slot = p_slot->device - ctrl->slot_device_offset; hp_slot = p_slot->device - ctrl->slot_device_offset;
p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
ctrl_dbg(ctrl, "In %s, hp_slot = %d\n", __func__, hp_slot); ctrl_dbg(ctrl, "%s: hp_slot = %d\n", __func__, hp_slot);
/* Change status to shutdown */ /* Change status to shutdown */
if (p_slot->is_a_board) if (p_slot->is_a_board)
...@@ -389,8 +387,7 @@ static int remove_board(struct slot *p_slot) ...@@ -389,8 +387,7 @@ static int remove_board(struct slot *p_slot)
rc = p_slot->hpc_ops->set_attention_status(p_slot, 0); rc = p_slot->hpc_ops->set_attention_status(p_slot, 0);
if (rc) { if (rc) {
ctrl_err(ctrl, "%s: Issue of Set Attention command failed\n", ctrl_err(ctrl, "Issue of Set Attention command failed\n");
__func__);
return rc; return rc;
} }
...@@ -526,7 +523,6 @@ static void handle_button_press_event(struct slot *p_slot) ...@@ -526,7 +523,6 @@ static void handle_button_press_event(struct slot *p_slot)
*/ */
ctrl_info(ctrl, "Button cancel on Slot(%s)\n", ctrl_info(ctrl, "Button cancel on Slot(%s)\n",
slot_name(p_slot)); slot_name(p_slot));
ctrl_dbg(ctrl, "%s: button cancel\n", __func__);
cancel_delayed_work(&p_slot->work); cancel_delayed_work(&p_slot->work);
if (p_slot->state == BLINKINGOFF_STATE) if (p_slot->state == BLINKINGOFF_STATE)
p_slot->hpc_ops->green_led_on(p_slot); p_slot->hpc_ops->green_led_on(p_slot);
...@@ -565,7 +561,7 @@ static void interrupt_event_handler(struct work_struct *work) ...@@ -565,7 +561,7 @@ static void interrupt_event_handler(struct work_struct *work)
handle_button_press_event(p_slot); handle_button_press_event(p_slot);
break; break;
case INT_POWER_FAULT: case INT_POWER_FAULT:
ctrl_dbg(p_slot->ctrl, "%s: power fault\n", __func__); ctrl_dbg(p_slot->ctrl, "%s: Power fault\n", __func__);
p_slot->hpc_ops->set_attention_status(p_slot, 1); p_slot->hpc_ops->set_attention_status(p_slot, 1);
p_slot->hpc_ops->green_led_off(p_slot); p_slot->hpc_ops->green_led_off(p_slot);
break; break;
...@@ -660,7 +656,7 @@ static int shpchp_disable_slot (struct slot *p_slot) ...@@ -660,7 +656,7 @@ static int shpchp_disable_slot (struct slot *p_slot)
} }
rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
if (rc || !getstatus) { if (rc || !getstatus) {
ctrl_info(ctrl, "Already disabled slot(%s)\n", ctrl_info(ctrl, "Already disabled on slot(%s)\n",
slot_name(p_slot)); slot_name(p_slot));
goto out; goto out;
} }
......
...@@ -320,8 +320,7 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) ...@@ -320,8 +320,7 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
if (!shpc_poll_ctrl_busy(ctrl)) { if (!shpc_poll_ctrl_busy(ctrl)) {
/* After 1 sec and and the controller is still busy */ /* After 1 sec and and the controller is still busy */
ctrl_err(ctrl, "%s : Controller is still busy after 1 sec.\n", ctrl_err(ctrl, "Controller is still busy after 1 sec\n");
__func__);
retval = -EBUSY; retval = -EBUSY;
goto out; goto out;
} }
...@@ -344,8 +343,9 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd) ...@@ -344,8 +343,9 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
cmd_status = hpc_check_cmd_status(slot->ctrl); cmd_status = hpc_check_cmd_status(slot->ctrl);
if (cmd_status) { if (cmd_status) {
ctrl_err(ctrl, "%s: Failed to issued command 0x%x " ctrl_err(ctrl,
"(error code = %d)\n", __func__, cmd, cmd_status); "Failed to issued command 0x%x (error code = %d)\n",
cmd, cmd_status);
retval = -EIO; retval = -EIO;
} }
out: out:
...@@ -364,15 +364,15 @@ static int hpc_check_cmd_status(struct controller *ctrl) ...@@ -364,15 +364,15 @@ static int hpc_check_cmd_status(struct controller *ctrl)
break; break;
case 1: case 1:
retval = SWITCH_OPEN; retval = SWITCH_OPEN;
ctrl_err(ctrl, "%s: Switch opened!\n", __func__); ctrl_err(ctrl, "Switch opened!\n");
break; break;
case 2: case 2:
retval = INVALID_CMD; retval = INVALID_CMD;
ctrl_err(ctrl, "%s: Invalid HPC command!\n", __func__); ctrl_err(ctrl, "Invalid HPC command!\n");
break; break;
case 4: case 4:
retval = INVALID_SPEED_MODE; retval = INVALID_SPEED_MODE;
ctrl_err(ctrl, "%s: Invalid bus speed/mode!\n", __func__); ctrl_err(ctrl, "Invalid bus speed/mode!\n");
break; break;
default: default:
retval = cmd_status; retval = cmd_status;
...@@ -773,8 +773,8 @@ static irqreturn_t shpc_isr(int irq, void *dev_id) ...@@ -773,8 +773,8 @@ static irqreturn_t shpc_isr(int irq, void *dev_id)
continue; continue;
slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot));
ctrl_dbg(ctrl, "%s: Slot %x with intr, slot register = %x\n", ctrl_dbg(ctrl, "Slot %x with intr, slot register = %x\n",
__func__, hp_slot, slot_reg); hp_slot, slot_reg);
if (slot_reg & MRL_CHANGE_DETECTED) if (slot_reg & MRL_CHANGE_DETECTED)
shpchp_handle_switch_change(hp_slot, ctrl); shpchp_handle_switch_change(hp_slot, ctrl);
...@@ -949,6 +949,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) ...@@ -949,6 +949,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
u8 i; u8 i;
ctrl->pci_dev = pdev; /* pci_dev of the P2P bridge */ ctrl->pci_dev = pdev; /* pci_dev of the P2P bridge */
ctrl_dbg(ctrl, "Hotplug Controller:\n");
if ((pdev->vendor == PCI_VENDOR_ID_AMD) || (pdev->device == if ((pdev->vendor == PCI_VENDOR_ID_AMD) || (pdev->device ==
PCI_DEVICE_ID_AMD_GOLAM_7450)) { PCI_DEVICE_ID_AMD_GOLAM_7450)) {
...@@ -958,38 +959,33 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) ...@@ -958,38 +959,33 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
} else { } else {
ctrl->cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC); ctrl->cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC);
if (!ctrl->cap_offset) { if (!ctrl->cap_offset) {
ctrl_err(ctrl, "%s : cap_offset == 0\n", __func__); ctrl_err(ctrl, "Cannot find PCI capability\n");
goto abort; goto abort;
} }
ctrl_dbg(ctrl, "%s: cap_offset = %x\n", __func__, ctrl_dbg(ctrl, " cap_offset = %x\n", ctrl->cap_offset);
ctrl->cap_offset);
rc = shpc_indirect_read(ctrl, 0, &shpc_base_offset); rc = shpc_indirect_read(ctrl, 0, &shpc_base_offset);
if (rc) { if (rc) {
ctrl_err(ctrl, "%s: cannot read base_offset\n", ctrl_err(ctrl, "Cannot read base_offset\n");
__func__);
goto abort; goto abort;
} }
rc = shpc_indirect_read(ctrl, 3, &tempdword); rc = shpc_indirect_read(ctrl, 3, &tempdword);
if (rc) { if (rc) {
ctrl_err(ctrl, "%s: cannot read slot config\n", ctrl_err(ctrl, "Cannot read slot config\n");
__func__);
goto abort; goto abort;
} }
num_slots = tempdword & SLOT_NUM; num_slots = tempdword & SLOT_NUM;
ctrl_dbg(ctrl, "%s: num_slots (indirect) %x\n", ctrl_dbg(ctrl, " num_slots (indirect) %x\n", num_slots);
__func__, num_slots);
for (i = 0; i < 9 + num_slots; i++) { for (i = 0; i < 9 + num_slots; i++) {
rc = shpc_indirect_read(ctrl, i, &tempdword); rc = shpc_indirect_read(ctrl, i, &tempdword);
if (rc) { if (rc) {
ctrl_err(ctrl, "%s: cannot read creg " ctrl_err(ctrl,
"(index = %d)\n", __func__, i); "Cannot read creg (index = %d)\n", i);
goto abort; goto abort;
} }
ctrl_dbg(ctrl, "%s: offset %d: value %x\n", ctrl_dbg(ctrl, " offset %d: value %x\n", i, tempdword);
__func__, i, tempdword);
} }
ctrl->mmio_base = ctrl->mmio_base =
...@@ -1003,25 +999,25 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) ...@@ -1003,25 +999,25 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
rc = pci_enable_device(pdev); rc = pci_enable_device(pdev);
if (rc) { if (rc) {
ctrl_err(ctrl, "%s: pci_enable_device failed\n", __func__); ctrl_err(ctrl, "pci_enable_device failed\n");
goto abort; goto abort;
} }
if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) { if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) {
ctrl_err(ctrl, "%s: cannot reserve MMIO region\n", __func__); ctrl_err(ctrl, "Cannot reserve MMIO region\n");
rc = -1; rc = -1;
goto abort; goto abort;
} }
ctrl->creg = ioremap(ctrl->mmio_base, ctrl->mmio_size); ctrl->creg = ioremap(ctrl->mmio_base, ctrl->mmio_size);
if (!ctrl->creg) { if (!ctrl->creg) {
ctrl_err(ctrl, "%s: cannot remap MMIO region %lx @ %lx\n", ctrl_err(ctrl, "Cannot remap MMIO region %lx @ %lx\n",
__func__, ctrl->mmio_size, ctrl->mmio_base); ctrl->mmio_size, ctrl->mmio_base);
release_mem_region(ctrl->mmio_base, ctrl->mmio_size); release_mem_region(ctrl->mmio_base, ctrl->mmio_size);
rc = -1; rc = -1;
goto abort; goto abort;
} }
ctrl_dbg(ctrl, "%s: ctrl->creg %p\n", __func__, ctrl->creg); ctrl_dbg(ctrl, "ctrl->creg %p\n", ctrl->creg);
mutex_init(&ctrl->crit_sect); mutex_init(&ctrl->crit_sect);
mutex_init(&ctrl->cmd_lock); mutex_init(&ctrl->cmd_lock);
...@@ -1040,21 +1036,21 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) ...@@ -1040,21 +1036,21 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
/* Mask Global Interrupt Mask & Command Complete Interrupt Mask */ /* Mask Global Interrupt Mask & Command Complete Interrupt Mask */
tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE);
ctrl_dbg(ctrl, "%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); ctrl_dbg(ctrl, "SERR_INTR_ENABLE = %x\n", tempdword);
tempdword |= (GLOBAL_INTR_MASK | GLOBAL_SERR_MASK | tempdword |= (GLOBAL_INTR_MASK | GLOBAL_SERR_MASK |
COMMAND_INTR_MASK | ARBITER_SERR_MASK); COMMAND_INTR_MASK | ARBITER_SERR_MASK);
tempdword &= ~SERR_INTR_RSVDZ_MASK; tempdword &= ~SERR_INTR_RSVDZ_MASK;
shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword); shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword);
tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE);
ctrl_dbg(ctrl, "%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); ctrl_dbg(ctrl, "SERR_INTR_ENABLE = %x\n", tempdword);
/* Mask the MRL sensor SERR Mask of individual slot in /* Mask the MRL sensor SERR Mask of individual slot in
* Slot SERR-INT Mask & clear all the existing event if any * Slot SERR-INT Mask & clear all the existing event if any
*/ */
for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) {
slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot));
ctrl_dbg(ctrl, "%s: Default Logical Slot Register %d " ctrl_dbg(ctrl, "Default Logical Slot Register %d value %x\n",
"value %x\n", __func__, hp_slot, slot_reg); hp_slot, slot_reg);
slot_reg |= (PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK | slot_reg |= (PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK |
BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK | BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK |
CON_PFAULT_INTR_MASK | MRL_CHANGE_SERR_MASK | CON_PFAULT_INTR_MASK | MRL_CHANGE_SERR_MASK |
...@@ -1079,8 +1075,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) ...@@ -1079,8 +1075,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED, rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED,
MY_NAME, (void *)ctrl); MY_NAME, (void *)ctrl);
ctrl_dbg(ctrl, "%s: request_irq %d for hpc%d (returns %d)\n", ctrl_dbg(ctrl, "request_irq %d for hpc%d (returns %d)\n",
__func__, ctrl->pci_dev->irq, ctrl->pci_dev->irq,
atomic_read(&shpchp_num_controllers), rc); atomic_read(&shpchp_num_controllers), rc);
if (rc) { if (rc) {
ctrl_err(ctrl, "Can't get irq %d for the hotplug " ctrl_err(ctrl, "Can't get irq %d for the hotplug "
...@@ -1088,9 +1084,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) ...@@ -1088,9 +1084,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
goto abort_iounmap; goto abort_iounmap;
} }
} }
ctrl_dbg(ctrl, "%s: HPC at b:d:f:irq=0x%x:%x:%x:%x\n", ctrl_dbg(ctrl, "HPC at %s irq=%x\n", pci_name(pdev), pdev->irq);
__func__, pdev->bus->number, PCI_SLOT(pdev->devfn),
PCI_FUNC(pdev->devfn), pdev->irq);
/* /*
* If this is the first controller to be initialized, * If this is the first controller to be initialized,
...@@ -1109,8 +1103,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) ...@@ -1109,8 +1103,8 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
*/ */
for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) {
slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot));
ctrl_dbg(ctrl, "%s: Default Logical Slot Register %d " ctrl_dbg(ctrl, "Default Logical Slot Register %d value %x\n",
"value %x\n", __func__, hp_slot, slot_reg); hp_slot, slot_reg);
slot_reg &= ~(PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK | slot_reg &= ~(PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK |
BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK | BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK |
CON_PFAULT_INTR_MASK | SLOT_REG_RSVDZ_MASK); CON_PFAULT_INTR_MASK | SLOT_REG_RSVDZ_MASK);
...@@ -1123,8 +1117,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev) ...@@ -1123,8 +1117,7 @@ int shpc_init(struct controller *ctrl, struct pci_dev *pdev)
SERR_INTR_RSVDZ_MASK); SERR_INTR_RSVDZ_MASK);
shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword); shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword);
tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE);
ctrl_dbg(ctrl, "%s: SERR_INTR_ENABLE = %x\n", ctrl_dbg(ctrl, "SERR_INTR_ENABLE = %x\n", tempdword);
__func__, tempdword);
} }
return 0; return 0;
......
...@@ -49,9 +49,7 @@ static void program_fw_provided_values(struct pci_dev *dev) ...@@ -49,9 +49,7 @@ static void program_fw_provided_values(struct pci_dev *dev)
/* use default values if we can't get them from firmware */ /* use default values if we can't get them from firmware */
if (get_hp_params_from_firmware(dev, &hpp) || if (get_hp_params_from_firmware(dev, &hpp) ||
!hpp.t0 || (hpp.t0->revision > 1)) { !hpp.t0 || (hpp.t0->revision > 1)) {
printk(KERN_WARNING warn("Could not get hotplug parameters. Use defaults\n");
"%s: Could not get hotplug parameters. Use defaults\n",
__func__);
hpp.t0 = &hpp.type0_data; hpp.t0 = &hpp.type0_data;
hpp.t0->revision = 0; hpp.t0->revision = 0;
hpp.t0->cache_line_size = 8; hpp.t0->cache_line_size = 8;
...@@ -105,9 +103,9 @@ int __ref shpchp_configure_device(struct slot *p_slot) ...@@ -105,9 +103,9 @@ int __ref shpchp_configure_device(struct slot *p_slot)
dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0));
if (dev) { if (dev) {
ctrl_err(ctrl, ctrl_err(ctrl, "Device %s already exists "
"Device %s already exists at %x:%x, cannot hot-add\n", "at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev),
pci_name(dev), p_slot->bus, p_slot->device); pci_domain_nr(parent), p_slot->bus, p_slot->device);
pci_dev_put(dev); pci_dev_put(dev);
return -EINVAL; return -EINVAL;
} }
...@@ -173,8 +171,8 @@ int shpchp_unconfigure_device(struct slot *p_slot) ...@@ -173,8 +171,8 @@ int shpchp_unconfigure_device(struct slot *p_slot)
struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
struct controller *ctrl = p_slot->ctrl; struct controller *ctrl = p_slot->ctrl;
ctrl_dbg(ctrl, "%s: bus/dev = %x/%x\n", ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:%02x\n",
__func__, p_slot->bus, p_slot->device); __func__, pci_domain_nr(parent), p_slot->bus, p_slot->device);
for (j=0; j<8 ; j++) { for (j=0; j<8 ; j++) {
struct pci_dev* temp = pci_get_slot(parent, struct pci_dev* temp = pci_get_slot(parent,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册