From: Bryan Thompson <bryan.thompson@xxxxxxxxxx> Replace the POSTCODE_LINUX macro used throughout visorbus with a visorbus function. Signed-off-by: Bryan Thompson <bryan.thompson@xxxxxxxxxx> Signed-off-by: David Kershner <david.kershner@xxxxxxxxxx> --- drivers/staging/unisys/visorbus/visorbus_main.c | 90 +++++++--- drivers/staging/unisys/visorbus/visorchipset.c | 194 +++++++++++++--------- drivers/staging/unisys/visorbus/vmcallinterface.h | 28 +--- 3 files changed, 183 insertions(+), 129 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index 3457ef3..50063ac 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -578,6 +578,43 @@ static int client_bus_info_debugfs_open(struct inode *inode, struct file *file) EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts); /** + * visorbus_log_postcode() - logs a 64-bit value comprised of the inputs + * to the Unisys hypervisor log file + * @file: a unique 8-bit value representing the file + * @event: a unique 12-bit value representing the event to log + * @line: the line of the postcode call + * @info_high: 16 bits of data to log + * @info_low: 16 bits of data to log + * @severity: the Unisys hypervisor log severity level of the postcode + * + * visorbus_log_postcode generates a value in the form 0xAABBBCCCDDDDEEEE where + * A is file + * B is event + * C is line + * D is info_high + * E is info_low + * Please also note that the resulting postcode is in hex, so if you are + * searching for the __LINE__ number, convert it first to decimal. The line + * number combined with driver and type of call, will allow you to track down + * exactly what line an error occurred on, or where the last driver + * entered/exited from. + */ +void +visorbus_log_postcode(enum driver_pc file, enum event_pc event, u16 line, + u16 info_high, u16 info_low, enum diag_severity severity) +{ + u64 postcode; + + postcode = (((u64)file) << 56) | + (((u64)event) << 44) | + ((((u64)line) & 0xFFF) << 32) | + ((((u64)info_high) & 0xFFFF) << 16) | + (((u64)info_low) & 0xFFFF); + unisys_extended_vmcall(VMCALL_POST_CODE_LOGEVENT, severity, + MDS_APPOS, postcode); +} + +/** * create_visor_device() - create visor device as a result of receiving the * controlvm device_create message for a new device * @dev: a freshly-zeroed struct visor_device, containing only filled-in values @@ -607,8 +644,9 @@ static int client_bus_info_debugfs_open(struct inode *inode, struct file *file) u32 chipset_bus_no = dev->chipset_bus_no; u32 chipset_dev_no = dev->chipset_dev_no; - POSTCODE_LINUX(DEVICE_CREATE_ENTRY_PC, chipset_dev_no, chipset_bus_no, - DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_CREATE_ENTRY_PC, __LINE__, + chipset_dev_no, chipset_bus_no, + DIAG_SEVERITY_PRINT); mutex_init(&dev->visordriver_callback_lock); dev->device.bus = &visorbus_type; @@ -648,8 +686,8 @@ static int client_bus_info_debugfs_open(struct inode *inode, struct file *file) */ err = device_add(&dev->device); if (err < 0) { - POSTCODE_LINUX(DEVICE_ADD_PC, 0, chipset_bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_ADD_PC, __LINE__, + 0, chipset_bus_no, DIAG_SEVERITY_ERR); goto err_put; } @@ -966,7 +1004,8 @@ int visorbus_register_visor_driver(struct visor_driver *drv) int err; struct spar_vbus_headerinfo *hdr_info; - POSTCODE_LINUX(BUS_CREATE_ENTRY_PC, 0, 0, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CREATE_ENTRY_PC, __LINE__, + 0, 0, DIAG_SEVERITY_PRINT); hdr_info = kzalloc(sizeof(*hdr_info), GFP_KERNEL); if (!hdr_info) @@ -993,8 +1032,8 @@ int visorbus_register_visor_driver(struct visor_driver *drv) } if (device_register(&dev->device) < 0) { - POSTCODE_LINUX(DEVICE_CREATE_FAILURE_PC, 0, id, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_CREATE_FAILURE_PC, + __LINE__, 0, id, DIAG_SEVERITY_ERR); err = -ENODEV; goto err_debugfs_created; } @@ -1092,16 +1131,18 @@ int visorbus_register_visor_driver(struct visor_driver *drv) int rc; u32 bus_no = dev->chipset_bus_no; - POSTCODE_LINUX(BUS_CREATE_ENTRY_PC, 0, bus_no, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CREATE_ENTRY_PC, __LINE__, 0, + bus_no, DIAG_SEVERITY_PRINT); rc = create_bus_instance(dev); - POSTCODE_LINUX(BUS_CREATE_EXIT_PC, 0, bus_no, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CREATE_EXIT_PC, __LINE__, 0, + bus_no, DIAG_SEVERITY_PRINT); if (rc < 0) - POSTCODE_LINUX(BUS_CREATE_FAILURE_PC, 0, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CREATE_FAILURE_PC, + __LINE__, 0, bus_no, DIAG_SEVERITY_ERR); else - POSTCODE_LINUX(CHIPSET_INIT_SUCCESS_PC, 0, bus_no, - DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, CHIPSET_INIT_SUCCESS_PC, + __LINE__, 0, bus_no, DIAG_SEVERITY_PRINT); bus_create_response(dev, rc); } @@ -1120,18 +1161,20 @@ int visorbus_register_visor_driver(struct visor_driver *drv) u32 bus_no = dev_info->chipset_bus_no; u32 dev_no = dev_info->chipset_dev_no; - POSTCODE_LINUX(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no, - DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_CREATE_ENTRY_PC, __LINE__, + dev_no, bus_no, DIAG_SEVERITY_PRINT); rc = create_visor_device(dev_info); device_create_response(dev_info, rc); if (rc < 0) - POSTCODE_LINUX(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_CREATE_FAILURE_PC, + __LINE__, dev_no, bus_no, + DIAG_SEVERITY_ERR); else - POSTCODE_LINUX(DEVICE_CREATE_SUCCESS_PC, dev_no, bus_no, - DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_CREATE_SUCCESS_PC, + __LINE__, dev_no, bus_no, + DIAG_SEVERITY_PRINT); } void @@ -1297,7 +1340,8 @@ int visorbus_register_visor_driver(struct visor_driver *drv) { int err; - POSTCODE_LINUX(DRIVER_ENTRY_PC, 0, 0, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, DRIVER_ENTRY_PC, __LINE__, 0, 0, + DIAG_SEVERITY_PRINT); visorbus_debugfs_dir = debugfs_create_dir("visorbus", NULL); if (!visorbus_debugfs_dir) @@ -1307,7 +1351,8 @@ int visorbus_register_visor_driver(struct visor_driver *drv) err = create_bus_type(); if (err < 0) { - POSTCODE_LINUX(BUS_CREATE_ENTRY_PC, 0, 0, DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CREATE_ENTRY_PC, + __LINE__, 0, 0, DIAG_SEVERITY_ERR); goto error; } @@ -1316,7 +1361,8 @@ int visorbus_register_visor_driver(struct visor_driver *drv) return 0; error: - POSTCODE_LINUX(CHIPSET_INIT_FAILURE_PC, 0, err, DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, CHIPSET_INIT_FAILURE_PC, + __LINE__, 0, err, DIAG_SEVERITY_ERR); return err; } diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index d7148c3..c1c3f90 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -519,14 +519,16 @@ struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no, int rc = CONTROLVM_RESP_SUCCESS; int res = 0; - POSTCODE_LINUX(CHIPSET_INIT_ENTRY_PC, 0, 0, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, CHIPSET_INIT_ENTRY_PC, __LINE__, + 0, 0, DIAG_SEVERITY_PRINT); if (chipset_inited) { rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; res = -EIO; goto out_respond; } chipset_inited = 1; - POSTCODE_LINUX(CHIPSET_INIT_EXIT_PC, 0, 0, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, CHIPSET_INIT_EXIT_PC, __LINE__, + 0, 0, DIAG_SEVERITY_PRINT); /* * Set features to indicate we support parahotplug (if Command @@ -591,15 +593,16 @@ enum crash_obj_type { saved_crash_message_count), &local_crash_msg_count, sizeof(u16)); if (err) { - POSTCODE_LINUX(CRASH_DEV_CTRL_RD_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + CRASH_DEV_CTRL_RD_FAILURE_PC, __LINE__, 0, + 0, DIAG_SEVERITY_ERR); return err; } if (local_crash_msg_count != CONTROLVM_CRASHMSG_MAX) { - POSTCODE_LINUX(CRASH_DEV_COUNT_FAILURE_PC, 0, - local_crash_msg_count, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + CRASH_DEV_COUNT_FAILURE_PC, __LINE__, 0, + local_crash_msg_count, DIAG_SEVERITY_ERR); return -EIO; } @@ -608,8 +611,9 @@ enum crash_obj_type { saved_crash_message_offset), &local_crash_msg_offset, sizeof(u32)); if (err) { - POSTCODE_LINUX(CRASH_DEV_CTRL_RD_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + CRASH_DEV_CTRL_RD_FAILURE_PC, __LINE__, 0, + 0, DIAG_SEVERITY_ERR); return err; } @@ -619,8 +623,9 @@ enum crash_obj_type { msg, sizeof(struct controlvm_message)); if (err) { - POSTCODE_LINUX(SAVE_MSG_BUS_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + SAVE_MSG_BUS_FAILURE_PC, __LINE__, + 0, 0, DIAG_SEVERITY_ERR); return err; } } else { @@ -630,8 +635,9 @@ enum crash_obj_type { msg, sizeof(struct controlvm_message)); if (err) { - POSTCODE_LINUX(SAVE_MSG_DEV_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + SAVE_MSG_DEV_FAILURE_PC, __LINE__, + 0, 0, DIAG_SEVERITY_ERR); return err; } } @@ -702,16 +708,16 @@ enum crash_obj_type { bus_info = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL); if (bus_info && (bus_info->state.created == 1)) { - POSTCODE_LINUX(BUS_CREATE_FAILURE_PC, 0, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CREATE_FAILURE_PC, + __LINE__, 0, bus_no, DIAG_SEVERITY_ERR); err = -EEXIST; goto err_respond; } bus_info = kzalloc(sizeof(*bus_info), GFP_KERNEL); if (!bus_info) { - POSTCODE_LINUX(BUS_CREATE_FAILURE_PC, 0, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CREATE_FAILURE_PC, + __LINE__, 0, bus_no, DIAG_SEVERITY_ERR); err = -ENOMEM; goto err_respond; } @@ -720,7 +726,8 @@ enum crash_obj_type { bus_info->chipset_bus_no = bus_no; bus_info->chipset_dev_no = BUS_ROOT_DEVICE; - POSTCODE_LINUX(BUS_CREATE_ENTRY_PC, 0, bus_no, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CREATE_ENTRY_PC, __LINE__, + 0, bus_no, DIAG_SEVERITY_PRINT); if (uuid_le_cmp(cmd->create_bus.bus_inst_uuid, spar_siovm_uuid) == 0) save_crash_message(inmsg, CRASH_BUS); @@ -729,9 +736,9 @@ enum crash_obj_type { pmsg_hdr = kzalloc(sizeof(*pmsg_hdr), GFP_KERNEL); if (!pmsg_hdr) { - POSTCODE_LINUX(MALLOC_FAILURE_PC, cmd, - bus_info->chipset_bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + MALLOC_FAILURE_PC, __LINE__, 0, + bus_no, DIAG_SEVERITY_ERR); err = -ENOMEM; goto err_free_bus_info; } @@ -747,8 +754,8 @@ enum crash_obj_type { cmd->create_bus.bus_data_type_uuid); if (!visorchannel) { - POSTCODE_LINUX(BUS_CREATE_FAILURE_PC, 0, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CREATE_FAILURE_PC, + __LINE__, 0, bus_no, DIAG_SEVERITY_ERR); err = -ENOMEM; goto err_free_pending_msg; } @@ -757,7 +764,8 @@ enum crash_obj_type { /* Response will be handled by chipset_bus_create */ chipset_bus_create(bus_info); - POSTCODE_LINUX(BUS_CREATE_EXIT_PC, 0, bus_no, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CREATE_EXIT_PC, __LINE__, 0, + bus_no, DIAG_SEVERITY_PRINT); return 0; err_free_pending_msg: @@ -798,9 +806,9 @@ enum crash_obj_type { if (inmsg->hdr.flags.response_expected == 1) { pmsg_hdr = kzalloc(sizeof(*pmsg_hdr), GFP_KERNEL); if (!pmsg_hdr) { - POSTCODE_LINUX(MALLOC_FAILURE_PC, cmd, - bus_info->chipset_bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + MALLOC_FAILURE_PC, __LINE__, 0, + bus_no, DIAG_SEVERITY_ERR); err = -ENOMEM; goto err_respond; } @@ -830,23 +838,23 @@ enum crash_obj_type { int err = 0; bus_no = cmd->configure_bus.bus_no; - POSTCODE_LINUX(BUS_CONFIGURE_ENTRY_PC, 0, bus_no, - DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CONFIGURE_ENTRY_PC, __LINE__, + 0, bus_no, DIAG_SEVERITY_PRINT); bus_info = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL); if (!bus_info) { - POSTCODE_LINUX(BUS_CONFIGURE_FAILURE_PC, 0, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CONFIGURE_FAILURE_PC, + __LINE__, 0, bus_no, DIAG_SEVERITY_ERR); err = -EINVAL; goto err_respond; } else if (bus_info->state.created == 0) { - POSTCODE_LINUX(BUS_CONFIGURE_FAILURE_PC, 0, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CONFIGURE_FAILURE_PC, + __LINE__, 0, bus_no, DIAG_SEVERITY_ERR); err = -EINVAL; goto err_respond; } else if (bus_info->pending_msg_hdr) { - POSTCODE_LINUX(BUS_CONFIGURE_FAILURE_PC, 0, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CONFIGURE_FAILURE_PC, + __LINE__, 0, bus_no, DIAG_SEVERITY_ERR); err = -EIO; goto err_respond; } @@ -861,8 +869,8 @@ enum crash_obj_type { parser_param_start(parser_ctx, PARSERSTRING_NAME); bus_info->name = parser_string_get(parser_ctx); - POSTCODE_LINUX(BUS_CONFIGURE_EXIT_PC, 0, bus_no, - DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, BUS_CONFIGURE_EXIT_PC, + __LINE__, 0, bus_no, DIAG_SEVERITY_PRINT); if (inmsg->hdr.flags.response_expected == 1) bus_responder(inmsg->hdr.id, &inmsg->hdr, err); @@ -888,31 +896,35 @@ enum crash_obj_type { bus_info = visorbus_get_device_by_id(bus_no, BUS_ROOT_DEVICE, NULL); if (!bus_info) { - POSTCODE_LINUX(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_CREATE_FAILURE_PC, + __LINE__, dev_no, bus_no, + DIAG_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; goto out_respond; } if (bus_info->state.created == 0) { - POSTCODE_LINUX(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_CREATE_FAILURE_PC, + __LINE__, dev_no, bus_no, + DIAG_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; goto out_respond; } dev_info = visorbus_get_device_by_id(bus_no, dev_no, NULL); if (dev_info && (dev_info->state.created == 1)) { - POSTCODE_LINUX(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_CREATE_FAILURE_PC, + __LINE__, dev_no, bus_no, + DIAG_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; goto out_respond; } dev_info = kzalloc(sizeof(*dev_info), GFP_KERNEL); if (!dev_info) { - POSTCODE_LINUX(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_CREATE_FAILURE_PC, + __LINE__, dev_no, bus_no, + DIAG_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED; goto out_respond; } @@ -924,8 +936,8 @@ enum crash_obj_type { /* not sure where the best place to set the 'parent' */ dev_info->device.parent = &bus_info->device; - POSTCODE_LINUX(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no, - DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_CREATE_ENTRY_PC, + __LINE__, dev_no, bus_no, DIAG_SEVERITY_PRINT); visorchannel = visorchannel_create_with_lock(cmd->create_device.channel_addr, @@ -934,8 +946,9 @@ enum crash_obj_type { cmd->create_device.data_type_uuid); if (!visorchannel) { - POSTCODE_LINUX(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_CREATE_FAILURE_PC, + __LINE__, dev_no, bus_no, + DIAG_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED; goto out_free_dev_info; } @@ -958,8 +971,8 @@ enum crash_obj_type { } /* Chipset_device_create will send response */ chipset_device_create(dev_info); - POSTCODE_LINUX(DEVICE_CREATE_EXIT_PC, dev_no, bus_no, - DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, DEVICE_CREATE_EXIT_PC, __LINE__, + dev_no, bus_no, DIAG_SEVERITY_PRINT); return; out_free_dev_info: @@ -983,14 +996,16 @@ enum crash_obj_type { dev_info = visorbus_get_device_by_id(bus_no, dev_no, NULL); if (!dev_info) { - POSTCODE_LINUX(DEVICE_CHANGESTATE_FAILURE_PC, dev_no, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + DEVICE_CHANGESTATE_FAILURE_PC, __LINE__, + dev_no, bus_no, DIAG_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; goto err_respond; } if (dev_info->state.created == 0) { - POSTCODE_LINUX(DEVICE_CHANGESTATE_FAILURE_PC, dev_no, bus_no, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + DEVICE_CHANGESTATE_FAILURE_PC, __LINE__, + dev_no, bus_no, DIAG_SEVERITY_ERR); rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; goto err_respond; } @@ -1135,16 +1150,18 @@ enum crash_obj_type { offsetof(struct spar_controlvm_channel_protocol, request_payload_offset), &payload_offset, sizeof(payload_offset)) < 0) { - POSTCODE_LINUX(CONTROLVM_INIT_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + CONTROLVM_INIT_FAILURE_PC, __LINE__, 0, 0, + DIAG_SEVERITY_ERR); return; } if (visorchannel_read(controlvm_channel, offsetof(struct spar_controlvm_channel_protocol, request_payload_bytes), &payload_bytes, sizeof(payload_bytes)) < 0) { - POSTCODE_LINUX(CONTROLVM_INIT_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + CONTROLVM_INIT_FAILURE_PC, __LINE__, 0, 0, + DIAG_SEVERITY_ERR); return; } initialize_controlvm_payload_info(phys_addr, @@ -1564,7 +1581,8 @@ static u64 controlvm_get_channel_address(void) u32 local_crash_msg_offset; u16 local_crash_msg_count; - POSTCODE_LINUX(CRASH_DEV_ENTRY_PC, 0, 0, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, CRASH_DEV_ENTRY_PC, __LINE__, 0, + 0, DIAG_SEVERITY_PRINT); /* send init chipset msg */ msg.hdr.id = CONTROLVM_CHIPSET_INIT; @@ -1578,15 +1596,16 @@ static u64 controlvm_get_channel_address(void) offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_count), &local_crash_msg_count, sizeof(u16)) < 0) { - POSTCODE_LINUX(CRASH_DEV_CTRL_RD_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + CRASH_DEV_CTRL_RD_FAILURE_PC, __LINE__, 0, + 0, DIAG_SEVERITY_ERR); return; } if (local_crash_msg_count != CONTROLVM_CRASHMSG_MAX) { - POSTCODE_LINUX(CRASH_DEV_COUNT_FAILURE_PC, 0, - local_crash_msg_count, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + CRASH_DEV_COUNT_FAILURE_PC, __LINE__, 0, + local_crash_msg_count, DIAG_SEVERITY_ERR); return; } @@ -1595,8 +1614,9 @@ static u64 controlvm_get_channel_address(void) offsetof(struct spar_controlvm_channel_protocol, saved_crash_message_offset), &local_crash_msg_offset, sizeof(u32)) < 0) { - POSTCODE_LINUX(CRASH_DEV_CTRL_RD_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + CRASH_DEV_CTRL_RD_FAILURE_PC, __LINE__, 0, + 0, DIAG_SEVERITY_ERR); return; } @@ -1605,8 +1625,9 @@ static u64 controlvm_get_channel_address(void) local_crash_msg_offset, &local_crash_bus_msg, sizeof(struct controlvm_message)) < 0) { - POSTCODE_LINUX(CRASH_DEV_RD_BUS_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + CRASH_DEV_RD_BUS_FAILURE_PC, __LINE__, 0, + 0, DIAG_SEVERITY_ERR); return; } @@ -1616,8 +1637,9 @@ static u64 controlvm_get_channel_address(void) sizeof(struct controlvm_message), &local_crash_dev_msg, sizeof(struct controlvm_message)) < 0) { - POSTCODE_LINUX(CRASH_DEV_RD_DEV_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + CRASH_DEV_RD_DEV_FAILURE_PC, __LINE__, 0, + 0, DIAG_SEVERITY_ERR); return; } @@ -1625,8 +1647,9 @@ static u64 controlvm_get_channel_address(void) if (local_crash_bus_msg.cmd.create_bus.channel_addr) { bus_create(&local_crash_bus_msg); } else { - POSTCODE_LINUX(CRASH_DEV_BUS_NULL_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + CRASH_DEV_BUS_NULL_FAILURE_PC, __LINE__, + 0, 0, DIAG_SEVERITY_ERR); return; } @@ -1634,11 +1657,13 @@ static u64 controlvm_get_channel_address(void) if (local_crash_dev_msg.cmd.create_device.channel_addr) { my_device_create(&local_crash_dev_msg); } else { - POSTCODE_LINUX(CRASH_DEV_DEV_NULL_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + CRASH_DEV_DEV_NULL_FAILURE_PC, __LINE__, + 0, 0, DIAG_SEVERITY_ERR); return; } - POSTCODE_LINUX(CRASH_DEV_EXIT_PC, 0, 0, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, CRASH_DEV_EXIT_PC, __LINE__, 0, + 0, DIAG_SEVERITY_PRINT); } void @@ -2174,12 +2199,14 @@ static long visorchipset_ioctl(struct file *file, unsigned int cmd, visorchipset_platform_device.dev.devt = major_dev; if (platform_device_register(&visorchipset_platform_device) < 0) { - POSTCODE_LINUX(DEVICE_REGISTER_FAILURE_PC, 0, 0, - DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, + DEVICE_REGISTER_FAILURE_PC, __LINE__, 0, + 0, DIAG_SEVERITY_ERR); err = -ENODEV; goto error_cancel_work; } - POSTCODE_LINUX(CHIPSET_INIT_SUCCESS_PC, 0, 0, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, CHIPSET_INIT_SUCCESS_PC, + __LINE__, 0, 0, DIAG_SEVERITY_PRINT); err = visorbus_init(); if (err < 0) @@ -2201,14 +2228,16 @@ static long visorchipset_ioctl(struct file *file, unsigned int cmd, visorchannel_destroy(controlvm_channel); error: - POSTCODE_LINUX(CHIPSET_INIT_FAILURE_PC, 0, err, DIAG_SEVERITY_ERR); + visorbus_log_postcode(CURRENT_FILE_PC, CHIPSET_INIT_FAILURE_PC, + __LINE__, 0, err, DIAG_SEVERITY_ERR); return err; } static int visorchipset_exit(struct acpi_device *acpi_device) { - POSTCODE_LINUX(DRIVER_EXIT_PC, 0, 0, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, DRIVER_EXIT_PC, __LINE__, 0, 0, + DIAG_SEVERITY_PRINT); visorbus_exit(); @@ -2219,7 +2248,8 @@ static long visorchipset_ioctl(struct file *file, unsigned int cmd, visorchipset_file_cleanup(visorchipset_platform_device.dev.devt); platform_device_unregister(&visorchipset_platform_device); - POSTCODE_LINUX(DRIVER_EXIT_PC, 0, 0, DIAG_SEVERITY_PRINT); + visorbus_log_postcode(CURRENT_FILE_PC, DRIVER_EXIT_PC, __LINE__, 0, 0, + DIAG_SEVERITY_PRINT); return 0; } diff --git a/drivers/staging/unisys/visorbus/vmcallinterface.h b/drivers/staging/unisys/visorbus/vmcallinterface.h index 674a88b..4df47bc 100644 --- a/drivers/staging/unisys/visorbus/vmcallinterface.h +++ b/drivers/staging/unisys/visorbus/vmcallinterface.h @@ -148,30 +148,8 @@ enum event_pc { /* POSTCODE event identifier tuples */ SAVE_MSG_DEV_FAILURE_PC = 0x01F, }; -/* Write a 64-bit value to the hypervisor's log file - * POSTCODE_LINUX generates a value in the form 0xAABBBCCCDDDDEEEE where - * A is an identifier for the file logging the postcode - * B is an identifier for the event logging the postcode - * C is the line logging the postcode - * D is additional information the caller wants to log - * E is additional information the caller wants to log - * Please also note that the resulting postcode is in hex, so if you are - * searching for the __LINE__ number, convert it first to decimal. The line - * number combined with driver and type of call, will allow you to track down - * exactly what line an error occurred on, or where the last driver - * entered/exited from. - */ - -#define POSTCODE_LINUX(EVENT_PC, pc16bit1, pc16bit2, severity) \ -do { \ - unsigned long long post_code_temp; \ - post_code_temp = (((u64)CURRENT_FILE_PC) << 56) | \ - (((u64)EVENT_PC) << 44) | \ - ((((u64)__LINE__) & 0xFFF) << 32) | \ - ((((u64)pc16bit1) & 0xFFFF) << 16) | \ - (((u64)pc16bit2) & 0xFFFF); \ - unisys_extended_vmcall(VMCALL_POST_CODE_LOGEVENT, severity, \ - MDS_APPOS, post_code_temp); \ -} while (0) +void visorbus_log_postcode(enum driver_pc file, enum event_pc event, u16 line, + u16 info_high, u16 info_low, + enum diag_severity severity); #endif /* __IOMONINTF_H__ */ -- 1.9.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel