Date: Thu, 2 Nov 2006 21:16:08 +0100 (CET) From: Stefan Richter Subject: ieee1394: sbp2: remove debug macros No need to keep them in released sources. Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 300 ++-------------------------------------- 1 files changed, 20 insertions(+), 280 deletions(-) Index: linux/drivers/ieee1394/sbp2.c =================================================================== --- linux.orig/drivers/ieee1394/sbp2.c 2006-10-31 19:57:14.000000000 +0100 +++ linux/drivers/ieee1394/sbp2.c 2006-10-31 19:57:16.000000000 +0100 @@ -179,54 +179,9 @@ MODULE_PARM_DESC(workarounds, "Work arou ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE) ", or a combination)"); -/* - * Debug levels, configured via kernel config, or enable here. - */ - -#define CONFIG_IEEE1394_SBP2_DEBUG 0 -/* #define CONFIG_IEEE1394_SBP2_DEBUG_ORBS */ -/* #define CONFIG_IEEE1394_SBP2_DEBUG_DMA */ -/* #define CONFIG_IEEE1394_SBP2_DEBUG 1 */ -/* #define CONFIG_IEEE1394_SBP2_DEBUG 2 */ -/* #define CONFIG_IEEE1394_SBP2_PACKET_DUMP */ - -#ifdef CONFIG_IEEE1394_SBP2_DEBUG_ORBS -#define SBP2_ORB_DEBUG(fmt, args...) HPSB_ERR("sbp2(%s): "fmt, __FUNCTION__, ## args) -static u32 global_outstanding_command_orbs = 0; -#define outstanding_orb_incr global_outstanding_command_orbs++ -#define outstanding_orb_decr global_outstanding_command_orbs-- -#else -#define SBP2_ORB_DEBUG(fmt, args...) do {} while (0) -#define outstanding_orb_incr do {} while (0) -#define outstanding_orb_decr do {} while (0) -#endif - -#ifdef CONFIG_IEEE1394_SBP2_DEBUG_DMA -#define SBP2_DMA_ALLOC(fmt, args...) \ - HPSB_ERR("sbp2(%s)alloc(%d): "fmt, __FUNCTION__, \ - ++global_outstanding_dmas, ## args) -#define SBP2_DMA_FREE(fmt, args...) \ - HPSB_ERR("sbp2(%s)free(%d): "fmt, __FUNCTION__, \ - --global_outstanding_dmas, ## args) -static u32 global_outstanding_dmas = 0; -#else -#define SBP2_DMA_ALLOC(fmt, args...) do {} while (0) -#define SBP2_DMA_FREE(fmt, args...) do {} while (0) -#endif -#if CONFIG_IEEE1394_SBP2_DEBUG >= 2 -#define SBP2_DEBUG(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) -#define SBP2_INFO(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) -#elif CONFIG_IEEE1394_SBP2_DEBUG == 1 -#define SBP2_DEBUG(fmt, args...) HPSB_DEBUG("sbp2: "fmt, ## args) -#define SBP2_INFO(fmt, args...) HPSB_INFO("sbp2: "fmt, ## args) -#else -#define SBP2_DEBUG(fmt, args...) do {} while (0) -#define SBP2_INFO(fmt, args...) HPSB_INFO("sbp2: "fmt, ## args) -#endif - -#define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) -#define SBP2_DEBUG_ENTER() SBP2_DEBUG("%s", __FUNCTION__) +#define SBP2_INFO(fmt, args...) HPSB_INFO("sbp2: "fmt, ## args) +#define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) /* * Globals @@ -433,42 +388,6 @@ static inline void sbp2util_cpu_to_be32_ #define sbp2util_cpu_to_be32_buffer(x,y) do {} while (0) #endif -#ifdef CONFIG_IEEE1394_SBP2_PACKET_DUMP -/* - * Debug packet dump routine. Length is in bytes. - */ -static void sbp2util_packet_dump(void *buffer, int length, char *dump_name, - u32 dump_phys_addr) -{ - int i; - unsigned char *dump = buffer; - - if (!dump || !length || !dump_name) - return; - - if (dump_phys_addr) - printk("[%s, 0x%x]", dump_name, dump_phys_addr); - else - printk("[%s]", dump_name); - for (i = 0; i < length; i++) { - if (i > 0x3f) { - printk("\n ..."); - break; - } - if ((i & 0x3) == 0) - printk(" "); - if ((i & 0xf) == 0) - printk("\n "); - printk("%02x ", (int)dump[i]); - } - printk("\n"); - - return; -} -#else -#define sbp2util_packet_dump(w,x,y,z) do {} while (0) -#endif - static DECLARE_WAIT_QUEUE_HEAD(access_wq); /* @@ -582,13 +501,11 @@ static int sbp2util_create_command_orb_p pci_map_single(hi->host->pdev, &command->command_orb, sizeof(struct sbp2_command_orb), PCI_DMA_TODEVICE); - SBP2_DMA_ALLOC("single command orb DMA"); command->sge_dma = pci_map_single(hi->host->pdev, &command->scatter_gather_element, sizeof(command->scatter_gather_element), PCI_DMA_BIDIRECTIONAL); - SBP2_DMA_ALLOC("scatter_gather_element"); INIT_LIST_HEAD(&command->list); list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed); } @@ -615,12 +532,9 @@ static void sbp2util_remove_command_orb_ pci_unmap_single(host->pdev, command->command_orb_dma, sizeof(struct sbp2_command_orb), PCI_DMA_TODEVICE); - SBP2_DMA_FREE("single command orb DMA"); pci_unmap_single(host->pdev, command->sge_dma, sizeof(command->scatter_gather_element), PCI_DMA_BIDIRECTIONAL); - SBP2_DMA_FREE("scatter_gather_element"); - kfree(command); } } @@ -648,9 +562,6 @@ static struct sbp2_command_info *sbp2uti } } spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); - - SBP2_ORB_DEBUG("could not match command orb %x", (unsigned int)orb); - return NULL; } @@ -713,15 +624,13 @@ static void sbp2util_free_command_dma(st host = scsi_id->ud->ne->host; if (command->cmd_dma) { - if (command->dma_type == CMD_DMA_SINGLE) { + if (command->dma_type == CMD_DMA_SINGLE) pci_unmap_single(host->pdev, command->cmd_dma, command->dma_size, command->dma_dir); - SBP2_DMA_FREE("single bulk"); - } else if (command->dma_type == CMD_DMA_PAGE) { + else if (command->dma_type == CMD_DMA_PAGE) pci_unmap_page(host->pdev, command->cmd_dma, command->dma_size, command->dma_dir); - SBP2_DMA_FREE("single page"); - } /* XXX: Check for CMD_DMA_NONE bug */ + /* XXX: Check for CMD_DMA_NONE bug */ command->dma_type = CMD_DMA_NONE; command->cmd_dma = 0; } @@ -729,7 +638,6 @@ static void sbp2util_free_command_dma(st if (command->sge_buffer) { pci_unmap_sg(host->pdev, command->sge_buffer, command->dma_size, command->dma_dir); - SBP2_DMA_FREE("scatter list"); command->sge_buffer = NULL; } } @@ -764,8 +672,6 @@ static int sbp2_probe(struct device *dev struct unit_directory *ud; struct scsi_id_instance_data *scsi_id; - SBP2_DEBUG_ENTER(); - ud = container_of(dev, struct unit_directory, device); /* Don't probe UD's that have the LUN flag. We'll probe the LUN(s) @@ -789,8 +695,6 @@ static int sbp2_remove(struct device *de struct scsi_id_instance_data *scsi_id; struct scsi_device *sdev; - SBP2_DEBUG_ENTER(); - ud = container_of(dev, struct unit_directory, device); scsi_id = ud->device.driver_data; if (!scsi_id) @@ -822,8 +726,6 @@ static int sbp2_update(struct unit_direc { struct scsi_id_instance_data *scsi_id = ud->device.driver_data; - SBP2_DEBUG_ENTER(); - if (sbp2_reconnect_device(scsi_id)) { /* @@ -872,8 +774,6 @@ static struct scsi_id_instance_data *sbp struct Scsi_Host *scsi_host = NULL; struct scsi_id_instance_data *scsi_id = NULL; - SBP2_DEBUG_ENTER(); - scsi_id = kzalloc(sizeof(*scsi_id), GFP_KERNEL); if (!scsi_id) { SBP2_ERR("failed to create scsi_id"); @@ -901,7 +801,6 @@ static struct scsi_id_instance_data *sbp SBP2_ERR("failed to allocate hostinfo"); goto failed_alloc; } - SBP2_DEBUG("sbp2_alloc_device: allocated hostinfo"); hi->host = ud->ne->host; INIT_LIST_HEAD(&hi->scsi_ids); @@ -992,8 +891,6 @@ static int sbp2_start_device(struct scsi struct sbp2scsi_host_info *hi = scsi_id->hi; int error; - SBP2_DEBUG_ENTER(); - /* Login FIFO DMA */ scsi_id->login_response = pci_alloc_consistent(hi->host->pdev, @@ -1001,7 +898,6 @@ static int sbp2_start_device(struct scsi &scsi_id->login_response_dma); if (!scsi_id->login_response) goto alloc_fail; - SBP2_DMA_ALLOC("consistent DMA region for login FIFO"); /* Query logins ORB DMA */ scsi_id->query_logins_orb = @@ -1010,7 +906,6 @@ static int sbp2_start_device(struct scsi &scsi_id->query_logins_orb_dma); if (!scsi_id->query_logins_orb) goto alloc_fail; - SBP2_DMA_ALLOC("consistent DMA region for query logins ORB"); /* Query logins response DMA */ scsi_id->query_logins_response = @@ -1019,7 +914,6 @@ static int sbp2_start_device(struct scsi &scsi_id->query_logins_response_dma); if (!scsi_id->query_logins_response) goto alloc_fail; - SBP2_DMA_ALLOC("consistent DMA region for query logins response"); /* Reconnect ORB DMA */ scsi_id->reconnect_orb = @@ -1028,7 +922,6 @@ static int sbp2_start_device(struct scsi &scsi_id->reconnect_orb_dma); if (!scsi_id->reconnect_orb) goto alloc_fail; - SBP2_DMA_ALLOC("consistent DMA region for reconnect ORB"); /* Logout ORB DMA */ scsi_id->logout_orb = @@ -1037,7 +930,6 @@ static int sbp2_start_device(struct scsi &scsi_id->logout_orb_dma); if (!scsi_id->logout_orb) goto alloc_fail; - SBP2_DMA_ALLOC("consistent DMA region for logout ORB"); /* Login ORB DMA */ scsi_id->login_orb = @@ -1046,9 +938,6 @@ static int sbp2_start_device(struct scsi &scsi_id->login_orb_dma); if (!scsi_id->login_orb) goto alloc_fail; - SBP2_DMA_ALLOC("consistent DMA region for login ORB"); - - SBP2_DEBUG("New SBP-2 device inserted, SCSI ID = %x", scsi_id->ud->id); /* * Create our command orb pool @@ -1118,8 +1007,6 @@ static void sbp2_remove_device(struct sc { struct sbp2scsi_host_info *hi; - SBP2_DEBUG_ENTER(); - if (!scsi_id) return; @@ -1135,53 +1022,36 @@ static void sbp2_remove_device(struct sc list_del(&scsi_id->scsi_list); - if (scsi_id->login_response) { + if (scsi_id->login_response) pci_free_consistent(hi->host->pdev, sizeof(struct sbp2_login_response), scsi_id->login_response, scsi_id->login_response_dma); - SBP2_DMA_FREE("single login FIFO"); - } - - if (scsi_id->login_orb) { + if (scsi_id->login_orb) pci_free_consistent(hi->host->pdev, sizeof(struct sbp2_login_orb), scsi_id->login_orb, scsi_id->login_orb_dma); - SBP2_DMA_FREE("single login ORB"); - } - - if (scsi_id->reconnect_orb) { + if (scsi_id->reconnect_orb) pci_free_consistent(hi->host->pdev, sizeof(struct sbp2_reconnect_orb), scsi_id->reconnect_orb, scsi_id->reconnect_orb_dma); - SBP2_DMA_FREE("single reconnect orb"); - } - - if (scsi_id->logout_orb) { + if (scsi_id->logout_orb) pci_free_consistent(hi->host->pdev, sizeof(struct sbp2_logout_orb), scsi_id->logout_orb, scsi_id->logout_orb_dma); - SBP2_DMA_FREE("single logout orb"); - } - - if (scsi_id->query_logins_orb) { + if (scsi_id->query_logins_orb) pci_free_consistent(hi->host->pdev, sizeof(struct sbp2_query_logins_orb), scsi_id->query_logins_orb, scsi_id->query_logins_orb_dma); - SBP2_DMA_FREE("single query logins orb"); - } - - if (scsi_id->query_logins_response) { + if (scsi_id->query_logins_response) pci_free_consistent(hi->host->pdev, sizeof(struct sbp2_query_logins_response), scsi_id->query_logins_response, scsi_id->query_logins_response_dma); - SBP2_DMA_FREE("single query logins data"); - } if (scsi_id->status_fifo_addr != CSR1212_INVALID_ADDR_SPACE) hpsb_unregister_addrspace(&sbp2_highlevel, hi->host, @@ -1192,8 +1062,6 @@ static void sbp2_remove_device(struct sc if (hi) module_put(hi->host->driver->owner); - SBP2_DEBUG("SBP-2 device removed, SCSI ID = %d", scsi_id->ud->id); - kfree(scsi_id); } @@ -1211,8 +1079,6 @@ static int sbp2_handle_physdma_write(str * Manually put the data in the right place. */ memcpy(bus_to_virt((u32) addr), data, length); - sbp2util_packet_dump(data, length, "sbp2 phys dma write by device", - (u32) addr); return RCODE_COMPLETE; } @@ -1229,8 +1095,6 @@ static int sbp2_handle_physdma_read(stru * Grab data from memory and send a read response. */ memcpy(data, bus_to_virt((u32) addr), length); - sbp2util_packet_dump(data, length, "sbp2 phys dma read by device", - (u32) addr); return RCODE_COMPLETE; } #endif @@ -1250,8 +1114,6 @@ static int sbp2_query_logins(struct scsi int max_logins; int active_logins; - SBP2_DEBUG_ENTER(); - scsi_id->query_logins_orb->reserved1 = 0x0; scsi_id->query_logins_orb->reserved2 = 0x0; @@ -1272,9 +1134,6 @@ static int sbp2_query_logins(struct scsi sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb)); - sbp2util_packet_dump(scsi_id->query_logins_orb, sizeof(struct sbp2_query_logins_orb), - "sbp2 query logins orb", scsi_id->query_logins_orb_dma); - memset(scsi_id->query_logins_response, 0, sizeof(struct sbp2_query_logins_response)); data[0] = ORB_SET_NODE_ID(hi->host->node_id); @@ -1300,9 +1159,6 @@ static int sbp2_query_logins(struct scsi sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_response, sizeof(struct sbp2_query_logins_response)); - SBP2_DEBUG("length_max_logins = %x", - (unsigned int)scsi_id->query_logins_response->length_max_logins); - max_logins = RESPONSE_GET_MAX_LOGINS(scsi_id->query_logins_response->length_max_logins); SBP2_INFO("Maximum concurrent logins supported: %d", max_logins); @@ -1325,12 +1181,8 @@ static int sbp2_login_device(struct scsi struct sbp2scsi_host_info *hi = scsi_id->hi; quadlet_t data[2]; - SBP2_DEBUG_ENTER(); - - if (!scsi_id->login_orb) { - SBP2_DEBUG("%s: login_orb not alloc'd!", __FUNCTION__); + if (!scsi_id->login_orb) return -EIO; - } if (!exclusive_login) { if (sbp2_query_logins(scsi_id)) { @@ -1362,9 +1214,6 @@ static int sbp2_login_device(struct scsi sbp2util_cpu_to_be32_buffer(scsi_id->login_orb, sizeof(struct sbp2_login_orb)); - sbp2util_packet_dump(scsi_id->login_orb, sizeof(struct sbp2_login_orb), - "sbp2 login orb", scsi_id->login_orb_dma); - memset(scsi_id->login_response, 0, sizeof(struct sbp2_login_response)); data[0] = ORB_SET_NODE_ID(hi->host->node_id); @@ -1403,11 +1252,6 @@ static int sbp2_login_device(struct scsi /* * Grab our command block agent address from the login response. */ - SBP2_DEBUG("command_block_agent_hi = %x", - (unsigned int)scsi_id->login_response->command_block_agent_hi); - SBP2_DEBUG("command_block_agent_lo = %x", - (unsigned int)scsi_id->login_response->command_block_agent_lo); - scsi_id->sbp2_command_block_agent_addr = ((u64)scsi_id->login_response->command_block_agent_hi) << 32; scsi_id->sbp2_command_block_agent_addr |= ((u64)scsi_id->login_response->command_block_agent_lo); @@ -1427,8 +1271,6 @@ static int sbp2_logout_device(struct scs quadlet_t data[2]; int error; - SBP2_DEBUG_ENTER(); - /* * Set-up logout ORB */ @@ -1454,9 +1296,6 @@ static int sbp2_logout_device(struct scs */ sbp2util_cpu_to_be32_buffer(scsi_id->logout_orb, sizeof(struct sbp2_logout_orb)); - sbp2util_packet_dump(scsi_id->logout_orb, sizeof(struct sbp2_logout_orb), - "sbp2 logout orb", scsi_id->logout_orb_dma); - /* * Ok, let's write to the target's management agent register */ @@ -1487,8 +1326,6 @@ static int sbp2_reconnect_device(struct quadlet_t data[2]; int error; - SBP2_DEBUG_ENTER(); - /* * Set-up reconnect ORB */ @@ -1515,9 +1352,6 @@ static int sbp2_reconnect_device(struct */ sbp2util_cpu_to_be32_buffer(scsi_id->reconnect_orb, sizeof(struct sbp2_reconnect_orb)); - sbp2util_packet_dump(scsi_id->reconnect_orb, sizeof(struct sbp2_reconnect_orb), - "sbp2 reconnect orb", scsi_id->reconnect_orb_dma); - data[0] = ORB_SET_NODE_ID(hi->host->node_id); data[1] = scsi_id->reconnect_orb_dma; sbp2util_cpu_to_be32_buffer(data, 8); @@ -1560,8 +1394,6 @@ static int sbp2_set_busy_timeout(struct { quadlet_t data; - SBP2_DEBUG_ENTER(); - data = cpu_to_be32(SBP2_BUSY_TIMEOUT_VALUE); if (hpsb_node_write(scsi_id->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4)) SBP2_ERR("%s error", __FUNCTION__); @@ -1584,8 +1416,6 @@ static void sbp2_parse_unit_directory(st unsigned workarounds; int i; - SBP2_DEBUG_ENTER(); - management_agent_addr = 0x0; command_set_spec_id = 0x0; command_set = 0x0; @@ -1596,32 +1426,25 @@ static void sbp2_parse_unit_directory(st csr1212_for_each_dir_entry(ud->ne->csr, kv, ud->ud_kv, dentry) { switch (kv->key.id) { case CSR1212_KV_ID_DEPENDENT_INFO: - if (kv->key.type == CSR1212_KV_TYPE_CSR_OFFSET) { + if (kv->key.type == CSR1212_KV_TYPE_CSR_OFFSET) /* Save off the management agent address */ management_agent_addr = CSR1212_REGISTER_SPACE_BASE + (kv->value.csr_offset << 2); - SBP2_DEBUG("sbp2_management_agent_addr = %x", - (unsigned int)management_agent_addr); - } else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) { + else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) scsi_id->sbp2_lun = ORB_SET_LUN(kv->value.immediate); - } break; case SBP2_COMMAND_SET_SPEC_ID_KEY: /* Command spec organization */ command_set_spec_id = kv->value.immediate; - SBP2_DEBUG("sbp2_command_set_spec_id = %x", - (unsigned int)command_set_spec_id); break; case SBP2_COMMAND_SET_KEY: /* Command set used by sbp2 device */ command_set = kv->value.immediate; - SBP2_DEBUG("sbp2_command_set = %x", - (unsigned int)command_set); break; case SBP2_UNIT_CHARACTERISTICS_KEY: @@ -1630,15 +1453,11 @@ static void sbp2_parse_unit_directory(st * that I'm not yet paying attention to) */ unit_characteristics = kv->value.immediate; - SBP2_DEBUG("sbp2_unit_characteristics = %x", - (unsigned int)unit_characteristics); break; case SBP2_FIRMWARE_REVISION_KEY: /* Firmware revision */ firmware_revision = kv->value.immediate; - SBP2_DEBUG("sbp2_firmware_revision = %x", - (unsigned int)firmware_revision); break; default: @@ -1714,8 +1533,6 @@ static int sbp2_max_speed_and_size(struc struct sbp2scsi_host_info *hi = scsi_id->hi; u8 payload; - SBP2_DEBUG_ENTER(); - scsi_id->speed_code = hi->host->speed[NODEID_TO_NODE(scsi_id->ne->nodeid)]; @@ -1756,8 +1573,6 @@ static int sbp2_agent_reset(struct scsi_ int retval; unsigned long flags; - SBP2_DEBUG_ENTER(); - cancel_delayed_work(&scsi_id->protocol_work); if (wait) flush_scheduled_work(); @@ -1801,7 +1616,6 @@ static void sbp2_prep_command_orb_sg(str if ((scsi_use_sg == 1) && (sgpnt[0].length <= SBP2_MAX_SG_ELEMENT_LENGTH)) { - SBP2_DEBUG("Only one s/g element"); command->dma_size = sgpnt[0].length; command->dma_type = CMD_DMA_PAGE; command->cmd_dma = pci_map_page(hi->host->pdev, @@ -1809,7 +1623,6 @@ static void sbp2_prep_command_orb_sg(str sgpnt[0].offset, command->dma_size, command->dma_dir); - SBP2_DMA_ALLOC("single page scatter element"); orb->data_descriptor_lo = command->cmd_dma; orb->misc |= ORB_SET_DATA_SIZE(command->dma_size); @@ -1822,8 +1635,6 @@ static void sbp2_prep_command_orb_sg(str int i, count = pci_map_sg(hi->host->pdev, sgpnt, scsi_use_sg, dma_dir); - SBP2_DMA_ALLOC("scatter list"); - command->dma_size = scsi_use_sg; command->sge_buffer = sgpnt; @@ -1857,10 +1668,6 @@ static void sbp2_prep_command_orb_sg(str /* Number of page table (s/g) elements */ orb->misc |= ORB_SET_DATA_SIZE(sg_count); - sbp2util_packet_dump(sg_element, - (sizeof(struct sbp2_unrestricted_page_table)) * sg_count, - "sbp2 s/g list", command->sge_dma); - /* Byte swap page tables if necessary */ sbp2util_cpu_to_be32_buffer(sg_element, (sizeof(struct sbp2_unrestricted_page_table)) * @@ -1885,8 +1692,6 @@ static void sbp2_prep_command_orb_no_sg( orb->data_descriptor_hi = ORB_SET_NODE_ID(hi->host->node_id); orb->misc |= ORB_SET_DIRECTION(orb_direction); - SBP2_DMA_ALLOC("single bulk"); - /* * Handle case where we get a command w/o s/g enabled (but * check for transfers larger than 64K) @@ -1936,10 +1741,6 @@ static void sbp2_prep_command_orb_no_sg( /* Number of page table (s/g) elements */ orb->misc |= ORB_SET_DATA_SIZE(sg_count); - sbp2util_packet_dump(sg_element, - (sizeof(struct sbp2_unrestricted_page_table)) * sg_count, - "sbp2 s/g list", command->sge_dma); - /* Byte swap page tables if necessary */ sbp2util_cpu_to_be32_buffer(sg_element, (sizeof(struct sbp2_unrestricted_page_table)) * @@ -1991,20 +1792,16 @@ static void sbp2_create_command_orb(stru /* Set-up our pagetable stuff */ if (orb_direction == ORB_DIRECTION_NO_DATA_TRANSFER) { - SBP2_DEBUG("No data transfer"); command_orb->data_descriptor_hi = 0x0; command_orb->data_descriptor_lo = 0x0; command_orb->misc |= ORB_SET_DIRECTION(1); - } else if (scsi_use_sg) { - SBP2_DEBUG("Use scatter/gather"); + } else if (scsi_use_sg) sbp2_prep_command_orb_sg(command_orb, hi, command, scsi_use_sg, sgpnt, orb_direction, dma_dir); - } else { - SBP2_DEBUG("No scatter/gather"); + else sbp2_prep_command_orb_no_sg(command_orb, hi, command, sgpnt, orb_direction, scsi_request_bufflen, scsi_request_buffer, dma_dir); - } /* Byte swap command ORB if necessary */ sbp2util_cpu_to_be32_buffer(command_orb, sizeof(struct sbp2_command_orb)); @@ -2029,10 +1826,6 @@ static void sbp2_link_orb_command(struct size_t length; unsigned long flags; - outstanding_orb_incr; - SBP2_ORB_DEBUG("sending command orb %p, total orbs = %x", - command_orb, global_outstanding_command_orbs); - pci_dma_sync_single_for_device(hi->host->pdev, command->command_orb_dma, sizeof(struct sbp2_command_orb), PCI_DMA_TODEVICE); @@ -2081,8 +1874,6 @@ static void sbp2_link_orb_command(struct scsi_id->last_orb_dma = command->command_orb_dma; spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); - SBP2_ORB_DEBUG("write to %s register, command orb %p", - last_orb ? "DOORBELL" : "ORB_POINTER", command_orb); if (sbp2util_node_write_no_wait(scsi_id->ne, addr, data, length)) { /* * sbp2util_node_write_no_wait failed. We certainly ran out @@ -2112,17 +1903,12 @@ static int sbp2_send_command(struct scsi unsigned int request_bufflen = SCpnt->request_bufflen; struct sbp2_command_info *command; - SBP2_DEBUG_ENTER(); - SBP2_DEBUG("SCSI transfer size = %x", request_bufflen); - SBP2_DEBUG("SCSI s/g elements = %x", (unsigned int)SCpnt->use_sg); - /* * Allocate a command orb and s/g structure */ command = sbp2util_allocate_command_orb(scsi_id, SCpnt, done); - if (!command) { + if (!command) return -EIO; - } /* * Now actually fill in the comamnd orb and sbp2 s/g list @@ -2131,9 +1917,6 @@ static int sbp2_send_command(struct scsi request_bufflen, SCpnt->request_buffer, SCpnt->sc_data_direction); - sbp2util_packet_dump(&command->command_orb, sizeof(struct sbp2_command_orb), - "sbp2 command orb", command->command_orb_dma); - /* * Link up the orb, and ring the doorbell if needed */ @@ -2147,8 +1930,6 @@ static int sbp2_send_command(struct scsi */ static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data) { - SBP2_DEBUG_ENTER(); - /* * Ok, it's pretty ugly... ;-) */ @@ -2187,10 +1968,6 @@ static int sbp2_handle_status_write(stru struct sbp2_command_info *command; unsigned long flags; - SBP2_DEBUG_ENTER(); - - sbp2util_packet_dump(data, length, "sbp2 status write by device", (u32)addr); - if (unlikely(length < 8 || length > sizeof(struct sbp2_status_block))) { SBP2_ERR("Wrong size of status block"); return RCODE_ADDRESS_ERROR; @@ -2240,17 +2017,12 @@ static int sbp2_handle_status_write(stru command = sbp2util_find_command_for_orb(scsi_id, sb->ORB_offset_lo); if (command) { - SBP2_DEBUG("Found status for command ORB"); pci_dma_sync_single_for_cpu(hi->host->pdev, command->command_orb_dma, sizeof(struct sbp2_command_orb), PCI_DMA_TODEVICE); pci_dma_sync_single_for_cpu(hi->host->pdev, command->sge_dma, sizeof(command->scatter_gather_element), PCI_DMA_BIDIRECTIONAL); - - SBP2_ORB_DEBUG("matched command orb %p", &command->command_orb); - outstanding_orb_decr; - /* * Matched status with command, now grab scsi command pointers * and check status. @@ -2279,21 +2051,15 @@ static int sbp2_handle_status_write(stru /* * See if the target stored any scsi status information. */ - if (STATUS_GET_LEN(h) > 1) { - SBP2_DEBUG("CHECK CONDITION"); + if (STATUS_GET_LEN(h) > 1) scsi_status = sbp2_status_to_sense_data( (unchar *)sb, SCpnt->sense_buffer); - } /* * Check to see if the dead bit is set. If so, we'll * have to initiate a fetch agent reset. */ - if (STATUS_TEST_DEAD(h)) { - SBP2_DEBUG("Dead bit set - " - "initiating fetch agent reset"); + if (STATUS_TEST_DEAD(h)) sbp2_agent_reset(scsi_id, 0); - } - SBP2_ORB_DEBUG("completing command orb %p", &command->command_orb); } /* @@ -2322,13 +2088,9 @@ static int sbp2_handle_status_write(stru } } - if (SCpnt) { - SBP2_DEBUG("Completing SCSI command"); + if (SCpnt) sbp2scsi_complete_command(scsi_id, scsi_status, SCpnt, command->Current_done); - SBP2_ORB_DEBUG("command orb completed"); - } - return RCODE_COMPLETE; } @@ -2348,11 +2110,6 @@ static int sbp2scsi_queuecommand(struct struct sbp2scsi_host_info *hi; int result = DID_NO_CONNECT << 16; - SBP2_DEBUG_ENTER(); -#if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP) - scsi_print_command(SCpnt); -#endif - if (!sbp2util_node_is_available(scsi_id)) goto done; @@ -2375,7 +2132,6 @@ static int sbp2scsi_queuecommand(struct * (autorequest sense) */ if (SCpnt->cmnd[0] == REQUEST_SENSE) { - SBP2_DEBUG("REQUEST_SENSE"); memcpy(SCpnt->request_buffer, SCpnt->sense_buffer, SCpnt->request_bufflen); memset(SCpnt->sense_buffer, 0, sizeof(SCpnt->sense_buffer)); sbp2scsi_complete_command(scsi_id, SBP2_SCSI_STATUS_GOOD, SCpnt, done); @@ -2429,11 +2185,8 @@ static void sbp2scsi_complete_all_comman struct sbp2_command_info *command; unsigned long flags; - SBP2_DEBUG_ENTER(); - spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { - SBP2_DEBUG("Found pending command to complete"); lh = scsi_id->sbp2_command_orb_inuse.next; command = list_entry(lh, struct sbp2_command_info, list); pci_dma_sync_single_for_cpu(hi->host->pdev, command->command_orb_dma, @@ -2462,8 +2215,6 @@ static void sbp2scsi_complete_command(st u32 scsi_status, struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) { - SBP2_DEBUG_ENTER(); - /* * Sanity */ @@ -2486,12 +2237,7 @@ static void sbp2scsi_complete_command(st break; case SBP2_SCSI_STATUS_CHECK_CONDITION: - SBP2_DEBUG("SBP2_SCSI_STATUS_CHECK_CONDITION"); SCpnt->result = CHECK_CONDITION << 1 | DID_OK << 16; -#if CONFIG_IEEE1394_SBP2_DEBUG >= 1 - scsi_print_command(SCpnt); - scsi_print_sense(SBP2_DEVICE_NAME, SCpnt); -#endif break; case SBP2_SCSI_STATUS_SELECTION_TIMEOUT: @@ -2586,7 +2332,6 @@ static int sbp2scsi_abort(struct scsi_cm spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); command = sbp2util_find_command_for_SCpnt(scsi_id, SCpnt); if (command) { - SBP2_DEBUG("Found command to abort"); pci_dma_sync_single_for_cpu(hi->host->pdev, command->command_orb_dma, sizeof(struct sbp2_command_orb), @@ -2656,8 +2401,6 @@ static int sbp2_module_init(void) { int ret; - SBP2_DEBUG_ENTER(); - /* Module load debug option to force one command at a time (serializing I/O) */ if (serialize_io) { scsi_driver_template.can_queue = 1; @@ -2684,10 +2427,7 @@ static int sbp2_module_init(void) static void __exit sbp2_module_exit(void) { - SBP2_DEBUG_ENTER(); - hpsb_unregister_protocol(&sbp2_driver); - hpsb_unregister_highlevel(&sbp2_highlevel); }