sbp2, ohci1394 cleanups:
sbp2: various code formatting cleanups ohci1394: remove form feed characters Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jody McIntyre <scjody@modernduck.com>
This commit is contained in:
parent
e309fc6d71
commit
a237f35fdd
|
@ -3201,8 +3201,6 @@ static struct hpsb_host_driver ohci1394_driver = {
|
|||
.hw_csr_reg = ohci_hw_csr_reg,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***********************************
|
||||
* PCI Driver Interface functions *
|
||||
***********************************/
|
||||
|
@ -3606,8 +3604,6 @@ static struct pci_driver ohci1394_pci_driver = {
|
|||
.suspend = ohci1394_pci_suspend,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***********************************
|
||||
* OHCI1394 Video Interface *
|
||||
***********************************/
|
||||
|
@ -3714,7 +3710,6 @@ EXPORT_SYMBOL(ohci1394_init_iso_tasklet);
|
|||
EXPORT_SYMBOL(ohci1394_register_iso_tasklet);
|
||||
EXPORT_SYMBOL(ohci1394_unregister_iso_tasklet);
|
||||
|
||||
|
||||
/***********************************
|
||||
* General module initialization *
|
||||
***********************************/
|
||||
|
|
|
@ -151,18 +151,15 @@ static int force_inquiry_hack;
|
|||
module_param(force_inquiry_hack, int, 0444);
|
||||
MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)");
|
||||
|
||||
|
||||
/*
|
||||
* Export information about protocols/devices supported by this driver.
|
||||
*/
|
||||
static struct ieee1394_device_id sbp2_id_table[] = {
|
||||
{
|
||||
.match_flags =IEEE1394_MATCH_SPECIFIER_ID |
|
||||
IEEE1394_MATCH_VERSION,
|
||||
.match_flags = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION,
|
||||
.specifier_id = SBP2_UNIT_SPEC_ID_ENTRY & 0xffffff,
|
||||
.version = SBP2_SW_VERSION_ENTRY & 0xffffff
|
||||
},
|
||||
{ }
|
||||
.version = SBP2_SW_VERSION_ENTRY & 0xffffff},
|
||||
{}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(ieee1394, sbp2_id_table);
|
||||
|
@ -221,7 +218,6 @@ static u32 global_outstanding_dmas = 0;
|
|||
|
||||
#define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args)
|
||||
|
||||
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
|
@ -287,7 +283,6 @@ static u32 sbp2_broken_inquiry_list[] = {
|
|||
* General utility functions
|
||||
**************************************/
|
||||
|
||||
|
||||
#ifndef __BIG_ENDIAN
|
||||
/*
|
||||
* Converts a buffer from be32 to cpu byte ordering. Length is in bytes.
|
||||
|
@ -324,7 +319,8 @@ static __inline__ void sbp2util_cpu_to_be32_buffer(void *buffer, int length)
|
|||
/*
|
||||
* Debug packet dump routine. Length is in bytes.
|
||||
*/
|
||||
static void sbp2util_packet_dump(void *buffer, int length, char *dump_name, u32 dump_phys_addr)
|
||||
static void sbp2util_packet_dump(void *buffer, int length, char *dump_name,
|
||||
u32 dump_phys_addr)
|
||||
{
|
||||
int i;
|
||||
unsigned char *dump = buffer;
|
||||
|
@ -345,7 +341,7 @@ static void sbp2util_packet_dump(void *buffer, int length, char *dump_name, u32
|
|||
printk(" ");
|
||||
if ((i & 0xf) == 0)
|
||||
printk("\n ");
|
||||
printk("%02x ", (int) dump[i]);
|
||||
printk("%02x ", (int)dump[i]);
|
||||
}
|
||||
printk("\n");
|
||||
|
||||
|
@ -364,9 +360,9 @@ static int sbp2util_down_timeout(atomic_t *done, int timeout)
|
|||
|
||||
for (i = timeout; (i > 0 && atomic_read(done) == 0); i-= HZ/10) {
|
||||
if (msleep_interruptible(100)) /* 100ms */
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
return ((i > 0) ? 0:1);
|
||||
return (i > 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
/* Free's an allocated packet */
|
||||
|
@ -389,7 +385,8 @@ static int sbp2util_node_write_no_wait(struct node_entry *ne, u64 addr,
|
|||
if (!packet)
|
||||
return -ENOMEM;
|
||||
|
||||
hpsb_set_packet_complete_task(packet, (void (*)(void*))sbp2_free_packet,
|
||||
hpsb_set_packet_complete_task(packet,
|
||||
(void (*)(void *))sbp2_free_packet,
|
||||
packet);
|
||||
|
||||
hpsb_node_fill_packet(ne, packet);
|
||||
|
@ -420,17 +417,19 @@ static int sbp2util_create_command_orb_pool(struct scsi_id_instance_data *scsi_i
|
|||
command = (struct sbp2_command_info *)
|
||||
kmalloc(sizeof(struct sbp2_command_info), GFP_ATOMIC);
|
||||
if (!command) {
|
||||
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
|
||||
return(-ENOMEM);
|
||||
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock,
|
||||
flags);
|
||||
return -ENOMEM;
|
||||
}
|
||||
memset(command, '\0', sizeof(struct sbp2_command_info));
|
||||
command->command_orb_dma =
|
||||
pci_map_single (hi->host->pdev, &command->command_orb,
|
||||
pci_map_single(hi->host->pdev, &command->command_orb,
|
||||
sizeof(struct sbp2_command_orb),
|
||||
PCI_DMA_BIDIRECTIONAL);
|
||||
SBP2_DMA_ALLOC("single command orb DMA");
|
||||
command->sge_dma =
|
||||
pci_map_single (hi->host->pdev, &command->scatter_gather_element,
|
||||
pci_map_single(hi->host->pdev,
|
||||
&command->scatter_gather_element,
|
||||
sizeof(command->scatter_gather_element),
|
||||
PCI_DMA_BIDIRECTIONAL);
|
||||
SBP2_DMA_ALLOC("scatter_gather_element");
|
||||
|
@ -488,7 +487,7 @@ static struct sbp2_command_info *sbp2util_find_command_for_orb(
|
|||
list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) {
|
||||
if (command->command_orb_dma == orb) {
|
||||
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
|
||||
return (command);
|
||||
return command;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -496,7 +495,7 @@ static struct sbp2_command_info *sbp2util_find_command_for_orb(
|
|||
|
||||
SBP2_ORB_DEBUG("could not match command orb %x", (unsigned int)orb);
|
||||
|
||||
return(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -513,12 +512,12 @@ static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_
|
|||
list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) {
|
||||
if (command->Current_SCpnt == SCpnt) {
|
||||
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
|
||||
return (command);
|
||||
return command;
|
||||
}
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
|
||||
return(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -545,7 +544,7 @@ static struct sbp2_command_info *sbp2util_allocate_command_orb(
|
|||
SBP2_ERR("sbp2util_allocate_command_orb - No orbs available!");
|
||||
}
|
||||
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
|
||||
return (command);
|
||||
return command;
|
||||
}
|
||||
|
||||
/* Free our DMA's */
|
||||
|
@ -587,7 +586,8 @@ static void sbp2util_free_command_dma(struct sbp2_command_info *command)
|
|||
/*
|
||||
* This function moves a command to the completed orb list.
|
||||
*/
|
||||
static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_id, struct sbp2_command_info *command)
|
||||
static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_id,
|
||||
struct sbp2_command_info *command)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
|
@ -606,8 +606,6 @@ static inline int sbp2util_node_is_available(struct scsi_id_instance_data *scsi_
|
|||
return scsi_id && scsi_id->ne && !scsi_id->ne->in_limbo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************************************
|
||||
* IEEE-1394 core driver stack related section
|
||||
*********************************************/
|
||||
|
@ -769,7 +767,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
|
|||
|
||||
/* Register our host with the SCSI stack. */
|
||||
scsi_host = scsi_host_alloc(&scsi_driver_template,
|
||||
sizeof (unsigned long));
|
||||
sizeof(unsigned long));
|
||||
if (!scsi_host) {
|
||||
SBP2_ERR("failed to register scsi host");
|
||||
goto failed_alloc;
|
||||
|
@ -790,7 +788,6 @@ failed_alloc:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static void sbp2_host_reset(struct hpsb_host *host)
|
||||
{
|
||||
struct sbp2scsi_host_info *hi;
|
||||
|
@ -804,7 +801,6 @@ static void sbp2_host_reset(struct hpsb_host *host)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function is where we first pull the node unique ids, and then
|
||||
* allocate memory and register a SBP-2 device.
|
||||
|
@ -818,7 +814,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
|
|||
|
||||
/* Login FIFO DMA */
|
||||
scsi_id->login_response =
|
||||
pci_alloc_consistent(hi->host->pdev, sizeof(struct sbp2_login_response),
|
||||
pci_alloc_consistent(hi->host->pdev,
|
||||
sizeof(struct sbp2_login_response),
|
||||
&scsi_id->login_response_dma);
|
||||
if (!scsi_id->login_response)
|
||||
goto alloc_fail;
|
||||
|
@ -826,7 +823,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
|
|||
|
||||
/* Query logins ORB DMA */
|
||||
scsi_id->query_logins_orb =
|
||||
pci_alloc_consistent(hi->host->pdev, sizeof(struct sbp2_query_logins_orb),
|
||||
pci_alloc_consistent(hi->host->pdev,
|
||||
sizeof(struct sbp2_query_logins_orb),
|
||||
&scsi_id->query_logins_orb_dma);
|
||||
if (!scsi_id->query_logins_orb)
|
||||
goto alloc_fail;
|
||||
|
@ -834,7 +832,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
|
|||
|
||||
/* Query logins response DMA */
|
||||
scsi_id->query_logins_response =
|
||||
pci_alloc_consistent(hi->host->pdev, sizeof(struct sbp2_query_logins_response),
|
||||
pci_alloc_consistent(hi->host->pdev,
|
||||
sizeof(struct sbp2_query_logins_response),
|
||||
&scsi_id->query_logins_response_dma);
|
||||
if (!scsi_id->query_logins_response)
|
||||
goto alloc_fail;
|
||||
|
@ -842,7 +841,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
|
|||
|
||||
/* Reconnect ORB DMA */
|
||||
scsi_id->reconnect_orb =
|
||||
pci_alloc_consistent(hi->host->pdev, sizeof(struct sbp2_reconnect_orb),
|
||||
pci_alloc_consistent(hi->host->pdev,
|
||||
sizeof(struct sbp2_reconnect_orb),
|
||||
&scsi_id->reconnect_orb_dma);
|
||||
if (!scsi_id->reconnect_orb)
|
||||
goto alloc_fail;
|
||||
|
@ -850,7 +850,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
|
|||
|
||||
/* Logout ORB DMA */
|
||||
scsi_id->logout_orb =
|
||||
pci_alloc_consistent(hi->host->pdev, sizeof(struct sbp2_logout_orb),
|
||||
pci_alloc_consistent(hi->host->pdev,
|
||||
sizeof(struct sbp2_logout_orb),
|
||||
&scsi_id->logout_orb_dma);
|
||||
if (!scsi_id->logout_orb)
|
||||
goto alloc_fail;
|
||||
|
@ -858,7 +859,8 @@ static int sbp2_start_device(struct scsi_id_instance_data *scsi_id)
|
|||
|
||||
/* Login ORB DMA */
|
||||
scsi_id->login_orb =
|
||||
pci_alloc_consistent(hi->host->pdev, sizeof(struct sbp2_login_orb),
|
||||
pci_alloc_consistent(hi->host->pdev,
|
||||
sizeof(struct sbp2_login_orb),
|
||||
&scsi_id->login_orb_dma);
|
||||
if (!scsi_id->login_orb) {
|
||||
alloc_fail:
|
||||
|
@ -906,7 +908,7 @@ alloc_fail:
|
|||
|
||||
kfree(scsi_id);
|
||||
|
||||
SBP2_ERR ("Could not allocate memory for scsi_id");
|
||||
SBP2_ERR("Could not allocate memory for scsi_id");
|
||||
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -1054,36 +1056,39 @@ static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id)
|
|||
* This function deals with physical dma write requests (for adapters that do not support
|
||||
* physical dma in hardware). Mostly just here for debugging...
|
||||
*/
|
||||
static int sbp2_handle_physdma_write(struct hpsb_host *host, int nodeid, int destid, quadlet_t *data,
|
||||
u64 addr, size_t length, u16 flags)
|
||||
static int sbp2_handle_physdma_write(struct hpsb_host *host, int nodeid,
|
||||
int destid, quadlet_t *data, u64 addr,
|
||||
size_t length, u16 flags)
|
||||
{
|
||||
|
||||
/*
|
||||
* 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);
|
||||
memcpy(bus_to_virt((u32) addr), data, length);
|
||||
sbp2util_packet_dump(data, length, "sbp2 phys dma write by device",
|
||||
(u32) addr);
|
||||
return RCODE_COMPLETE;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function deals with physical dma read requests (for adapters that do not support
|
||||
* physical dma in hardware). Mostly just here for debugging...
|
||||
*/
|
||||
static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid, quadlet_t *data,
|
||||
u64 addr, size_t length, u16 flags)
|
||||
static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid,
|
||||
quadlet_t *data, u64 addr, size_t length,
|
||||
u16 flags)
|
||||
{
|
||||
|
||||
/*
|
||||
* 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);
|
||||
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
|
||||
|
||||
|
||||
/**************************************
|
||||
* SBP-2 protocol related section
|
||||
**************************************/
|
||||
|
@ -1147,12 +1152,12 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
|
|||
|
||||
if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, 2*HZ)) {
|
||||
SBP2_INFO("Error querying logins to SBP-2 device - timed out");
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (scsi_id->status_block.ORB_offset_lo != scsi_id->query_logins_orb_dma) {
|
||||
SBP2_INFO("Error querying logins to SBP-2 device - timed out");
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (STATUS_GET_RESP(scsi_id->status_block.ORB_offset_hi_misc) ||
|
||||
|
@ -1160,7 +1165,7 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
|
|||
STATUS_GET_SBP_STATUS(scsi_id->status_block.ORB_offset_hi_misc)) {
|
||||
|
||||
SBP2_INFO("Error querying logins to SBP-2 device - timed out");
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
sbp2util_cpu_to_be32_buffer(scsi_id->query_logins_response, sizeof(struct sbp2_query_logins_response));
|
||||
|
@ -1177,7 +1182,7 @@ static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id)
|
|||
SBP2_DEBUG("Number of active logins: %d", active_logins);
|
||||
|
||||
if (active_logins >= max_logins) {
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1196,13 +1201,13 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
|
|||
|
||||
if (!scsi_id->login_orb) {
|
||||
SBP2_DEBUG("sbp2_login_device: login_orb not alloc'd!");
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (!exclusive_login) {
|
||||
if (sbp2_query_logins(scsi_id)) {
|
||||
SBP2_INFO("Device does not support any more concurrent logins");
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1269,7 +1274,7 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
|
|||
*/
|
||||
if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, 20*HZ)) {
|
||||
SBP2_ERR("Error logging into SBP-2 device - login timed-out");
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1277,7 +1282,7 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
|
|||
*/
|
||||
if (scsi_id->status_block.ORB_offset_lo != scsi_id->login_orb_dma) {
|
||||
SBP2_ERR("Error logging into SBP-2 device - login timed-out");
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1288,7 +1293,7 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
|
|||
STATUS_GET_SBP_STATUS(scsi_id->status_block.ORB_offset_hi_misc)) {
|
||||
|
||||
SBP2_ERR("Error logging into SBP-2 device - login failed");
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1312,7 +1317,7 @@ static int sbp2_login_device(struct scsi_id_instance_data *scsi_id)
|
|||
|
||||
SBP2_INFO("Logged into SBP-2 device");
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1366,8 +1371,7 @@ static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id)
|
|||
atomic_set(&scsi_id->sbp2_login_complete, 0);
|
||||
|
||||
error = hpsb_node_write(scsi_id->ne,
|
||||
scsi_id->sbp2_management_agent_addr,
|
||||
data, 8);
|
||||
scsi_id->sbp2_management_agent_addr, data, 8);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
@ -1377,7 +1381,7 @@ static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id)
|
|||
|
||||
SBP2_INFO("Logged out of SBP-2 device");
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1437,8 +1441,7 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id)
|
|||
atomic_set(&scsi_id->sbp2_login_complete, 0);
|
||||
|
||||
error = hpsb_node_write(scsi_id->ne,
|
||||
scsi_id->sbp2_management_agent_addr,
|
||||
data, 8);
|
||||
scsi_id->sbp2_management_agent_addr, data, 8);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
@ -1447,7 +1450,7 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id)
|
|||
*/
|
||||
if (sbp2util_down_timeout(&scsi_id->sbp2_login_complete, HZ)) {
|
||||
SBP2_ERR("Error reconnecting to SBP-2 device - reconnect timed-out");
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1455,7 +1458,7 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id)
|
|||
*/
|
||||
if (scsi_id->status_block.ORB_offset_lo != scsi_id->reconnect_orb_dma) {
|
||||
SBP2_ERR("Error reconnecting to SBP-2 device - reconnect timed-out");
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1466,12 +1469,12 @@ static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id)
|
|||
STATUS_GET_SBP_STATUS(scsi_id->status_block.ORB_offset_hi_misc)) {
|
||||
|
||||
SBP2_ERR("Error reconnecting to SBP-2 device - reconnect failed");
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
HPSB_DEBUG("Reconnected to SBP-2 device");
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1494,10 +1497,9 @@ static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id)
|
|||
SBP2_ERR("sbp2_set_busy_timeout error");
|
||||
}
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function is called to parse sbp2 device's config rom unit
|
||||
* directory. Used to determine things like sbp2 management agent offset,
|
||||
|
@ -1532,9 +1534,10 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
|
|||
(kv->value.csr_offset << 2);
|
||||
|
||||
SBP2_DEBUG("sbp2_management_agent_addr = %x",
|
||||
(unsigned int) management_agent_addr);
|
||||
(unsigned int)management_agent_addr);
|
||||
} else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) {
|
||||
scsi_id->sbp2_lun = ORB_SET_LUN(kv->value.immediate);
|
||||
scsi_id->sbp2_lun =
|
||||
ORB_SET_LUN(kv->value.immediate);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1542,14 +1545,14 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
|
|||
/* Command spec organization */
|
||||
command_set_spec_id = kv->value.immediate;
|
||||
SBP2_DEBUG("sbp2_command_set_spec_id = %x",
|
||||
(unsigned int) command_set_spec_id);
|
||||
(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);
|
||||
(unsigned int)command_set);
|
||||
break;
|
||||
|
||||
case SBP2_UNIT_CHARACTERISTICS_KEY:
|
||||
|
@ -1559,7 +1562,7 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
|
|||
*/
|
||||
unit_characteristics = kv->value.immediate;
|
||||
SBP2_DEBUG("sbp2_unit_characteristics = %x",
|
||||
(unsigned int) unit_characteristics);
|
||||
(unsigned int)unit_characteristics);
|
||||
break;
|
||||
|
||||
case SBP2_FIRMWARE_REVISION_KEY:
|
||||
|
@ -1567,9 +1570,10 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
|
|||
firmware_revision = kv->value.immediate;
|
||||
if (force_inquiry_hack)
|
||||
SBP2_INFO("sbp2_firmware_revision = %x",
|
||||
(unsigned int) firmware_revision);
|
||||
else SBP2_DEBUG("sbp2_firmware_revision = %x",
|
||||
(unsigned int) firmware_revision);
|
||||
(unsigned int)firmware_revision);
|
||||
else
|
||||
SBP2_DEBUG("sbp2_firmware_revision = %x",
|
||||
(unsigned int)firmware_revision);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1647,8 +1651,9 @@ static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id)
|
|||
SBP2_DEBUG("sbp2_max_speed_and_size");
|
||||
|
||||
/* Initial setting comes from the hosts speed map */
|
||||
scsi_id->speed_code = hi->host->speed_map[NODEID_TO_NODE(hi->host->node_id) * 64
|
||||
+ NODEID_TO_NODE(scsi_id->ne->nodeid)];
|
||||
scsi_id->speed_code =
|
||||
hi->host->speed_map[NODEID_TO_NODE(hi->host->node_id) * 64 +
|
||||
NODEID_TO_NODE(scsi_id->ne->nodeid)];
|
||||
|
||||
/* Bump down our speed if the user requested it */
|
||||
if (scsi_id->speed_code > max_speed) {
|
||||
|
@ -1659,15 +1664,16 @@ static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id)
|
|||
|
||||
/* Payload size is the lesser of what our speed supports and what
|
||||
* our host supports. */
|
||||
scsi_id->max_payload_size = min(sbp2_speedto_max_payload[scsi_id->speed_code],
|
||||
(u8)(hi->host->csr.max_rec - 1));
|
||||
scsi_id->max_payload_size =
|
||||
min(sbp2_speedto_max_payload[scsi_id->speed_code],
|
||||
(u8) (hi->host->csr.max_rec - 1));
|
||||
|
||||
HPSB_DEBUG("Node " NODE_BUS_FMT ": Max speed [%s] - Max payload [%u]",
|
||||
NODE_BUS_ARGS(hi->host, scsi_id->ne->nodeid),
|
||||
hpsb_speedto_str[scsi_id->speed_code],
|
||||
1 << ((u32)scsi_id->max_payload_size + 2));
|
||||
1 << ((u32) scsi_id->max_payload_size + 2));
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1702,7 +1708,7 @@ static int sbp2_agent_reset(struct scsi_id_instance_data *scsi_id, int wait)
|
|||
*/
|
||||
scsi_id->last_orb = NULL;
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1716,10 +1722,9 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id,
|
|||
unsigned int scsi_request_bufflen,
|
||||
void *scsi_request_buffer,
|
||||
enum dma_data_direction dma_dir)
|
||||
|
||||
{
|
||||
struct sbp2scsi_host_info *hi = scsi_id->hi;
|
||||
struct scatterlist *sgpnt = (struct scatterlist *) scsi_request_buffer;
|
||||
struct scatterlist *sgpnt = (struct scatterlist *)scsi_request_buffer;
|
||||
struct sbp2_command_orb *command_orb = &command->command_orb;
|
||||
struct sbp2_unrestricted_page_table *scatter_gather_element =
|
||||
&command->scatter_gather_element[0];
|
||||
|
@ -1865,9 +1870,9 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id,
|
|||
command->dma_dir = dma_dir;
|
||||
command->dma_size = scsi_request_bufflen;
|
||||
command->dma_type = CMD_DMA_SINGLE;
|
||||
command->cmd_dma = pci_map_single (hi->host->pdev, scsi_request_buffer,
|
||||
command->dma_size,
|
||||
command->dma_dir);
|
||||
command->cmd_dma =
|
||||
pci_map_single(hi->host->pdev, scsi_request_buffer,
|
||||
command->dma_size, command->dma_dir);
|
||||
SBP2_DMA_ALLOC("single bulk");
|
||||
|
||||
/*
|
||||
|
@ -1954,7 +1959,7 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id,
|
|||
memset(command_orb->cdb, 0, 12);
|
||||
memcpy(command_orb->cdb, scsi_cmd, COMMAND_SIZE(*scsi_cmd));
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2018,7 +2023,8 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
|
|||
cpu_to_be32(command->command_orb_dma);
|
||||
/* Tells hardware that this pointer is valid */
|
||||
scsi_id->last_orb->next_ORB_hi = 0x0;
|
||||
pci_dma_sync_single_for_device(hi->host->pdev, scsi_id->last_orb_dma,
|
||||
pci_dma_sync_single_for_device(hi->host->pdev,
|
||||
scsi_id->last_orb_dma,
|
||||
sizeof(struct sbp2_command_orb),
|
||||
PCI_DMA_BIDIRECTIONAL);
|
||||
|
||||
|
@ -2032,14 +2038,14 @@ static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
|
|||
|
||||
if (sbp2util_node_write_no_wait(ne, addr, &data, 4) < 0) {
|
||||
SBP2_ERR("sbp2util_node_write_no_wait failed");
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
scsi_id->last_orb = command_orb;
|
||||
scsi_id->last_orb_dma = command->command_orb_dma;
|
||||
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2066,7 +2072,7 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
|
|||
*/
|
||||
command = sbp2util_allocate_command_orb(scsi_id, SCpnt, done);
|
||||
if (!command) {
|
||||
return(-EIO);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2101,10 +2107,9 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
|
|||
*/
|
||||
sbp2_link_orb_command(scsi_id, command);
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Translates SBP-2 status into SCSI sense data for check conditions
|
||||
*/
|
||||
|
@ -2132,7 +2137,7 @@ static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense
|
|||
sense_data[14] = sbp2_status[20];
|
||||
sense_data[15] = sbp2_status[21];
|
||||
|
||||
return(sbp2_status[8] & 0x3f); /* return scsi status */
|
||||
return sbp2_status[8] & 0x3f; /* return scsi status */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2190,14 +2195,14 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest
|
|||
|
||||
if (!host) {
|
||||
SBP2_ERR("host is NULL - this is bad!");
|
||||
return(RCODE_ADDRESS_ERROR);
|
||||
return RCODE_ADDRESS_ERROR;
|
||||
}
|
||||
|
||||
hi = hpsb_get_hostinfo(&sbp2_highlevel, host);
|
||||
|
||||
if (!hi) {
|
||||
SBP2_ERR("host info is NULL - this is bad!");
|
||||
return(RCODE_ADDRESS_ERROR);
|
||||
return RCODE_ADDRESS_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2214,7 +2219,7 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest
|
|||
|
||||
if (!scsi_id) {
|
||||
SBP2_ERR("scsi_id is NULL - device is gone?");
|
||||
return(RCODE_ADDRESS_ERROR);
|
||||
return RCODE_ADDRESS_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2312,10 +2317,9 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest
|
|||
SBP2_ORB_DEBUG("command orb completed");
|
||||
}
|
||||
|
||||
return(RCODE_COMPLETE);
|
||||
return RCODE_COMPLETE;
|
||||
}
|
||||
|
||||
|
||||
/**************************************
|
||||
* SCSI interface related section
|
||||
**************************************/
|
||||
|
@ -2448,7 +2452,8 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
|
|||
* complete the command, just let it get retried at the end of the
|
||||
* bus reset.
|
||||
*/
|
||||
if (!hpsb_node_entry_valid(scsi_id->ne) && (scsi_status != SBP2_SCSI_STATUS_GOOD)) {
|
||||
if (!hpsb_node_entry_valid(scsi_id->ne)
|
||||
&& (scsi_status != SBP2_SCSI_STATUS_GOOD)) {
|
||||
SBP2_ERR("Bus reset in progress - retry command later");
|
||||
return;
|
||||
}
|
||||
|
@ -2510,7 +2515,8 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
|
|||
* If a bus reset is in progress and there was an error, complete
|
||||
* the command as busy so that it will get retried.
|
||||
*/
|
||||
if (!hpsb_node_entry_valid(scsi_id->ne) && (scsi_status != SBP2_SCSI_STATUS_GOOD)) {
|
||||
if (!hpsb_node_entry_valid(scsi_id->ne)
|
||||
&& (scsi_status != SBP2_SCSI_STATUS_GOOD)) {
|
||||
SBP2_ERR("Completing command with busy (bus reset)");
|
||||
SCpnt->result = DID_BUS_BUSY << 16;
|
||||
}
|
||||
|
@ -2531,17 +2537,15 @@ static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
|
|||
/*
|
||||
* Tell scsi stack that we're done with this command
|
||||
*/
|
||||
done (SCpnt);
|
||||
done(SCpnt);
|
||||
}
|
||||
|
||||
|
||||
static int sbp2scsi_slave_alloc(struct scsi_device *sdev)
|
||||
{
|
||||
((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = sdev;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int sbp2scsi_slave_configure(struct scsi_device *sdev)
|
||||
{
|
||||
blk_queue_dma_alignment(sdev->request_queue, (512 - 1));
|
||||
|
@ -2550,14 +2554,12 @@ static int sbp2scsi_slave_configure(struct scsi_device *sdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void sbp2scsi_slave_destroy(struct scsi_device *sdev)
|
||||
{
|
||||
((struct scsi_id_instance_data *)sdev->host->hostdata[0])->sdev = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called by scsi stack when something has really gone wrong. Usually
|
||||
* called when a command has timed-out for some reason.
|
||||
|
@ -2603,7 +2605,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
|
|||
sbp2scsi_complete_all_commands(scsi_id, DID_BUS_BUSY);
|
||||
}
|
||||
|
||||
return(SUCCESS);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2629,12 +2631,14 @@ static int sbp2scsi_reset(struct scsi_cmnd *SCpnt)
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
static const char *sbp2scsi_info (struct Scsi_Host *host)
|
||||
static const char *sbp2scsi_info(struct Scsi_Host *host)
|
||||
{
|
||||
return "SCSI emulation for IEEE-1394 SBP-2 Devices";
|
||||
}
|
||||
|
||||
static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct scsi_device *sdev;
|
||||
struct scsi_id_instance_data *scsi_id;
|
||||
|
@ -2705,7 +2709,6 @@ static int sbp2_module_init(void)
|
|||
/* Set max sectors (module load option). Default is 255 sectors. */
|
||||
scsi_driver_template.max_sectors = max_sectors;
|
||||
|
||||
|
||||
/* Register our high level driver with 1394 stack */
|
||||
hpsb_register_highlevel(&sbp2_highlevel);
|
||||
|
||||
|
|
|
@ -333,10 +333,8 @@ struct sbp2_command_info {
|
|||
#define SBP2_BREAKAGE_128K_MAX_TRANSFER 0x1
|
||||
#define SBP2_BREAKAGE_INQUIRY_HACK 0x2
|
||||
|
||||
|
||||
struct sbp2scsi_host_info;
|
||||
|
||||
|
||||
/*
|
||||
* Information needed on a per scsi id basis (one for each sbp2 device)
|
||||
*/
|
||||
|
@ -406,7 +404,6 @@ struct scsi_id_instance_data {
|
|||
u32 workarounds;
|
||||
};
|
||||
|
||||
|
||||
/* Sbp2 host data structure (one per IEEE1394 host) */
|
||||
struct sbp2scsi_host_info {
|
||||
struct hpsb_host *host; /* IEEE1394 host */
|
||||
|
|
Loading…
Reference in New Issue