Skip to content

Commit 532df6f

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6: (277 commits) [SCSI] isci: fix checkpatch errors isci: Device reset should request sas_phy_reset(phy, true) isci: pare back error messsages isci: cleanup silicon revision detection isci: merge scu_unsolicited_frame.h into unsolicited_frame_control.h isci: merge sata.[ch] into request.c isci: kill 'get/set' macros isci: retire scic_sds_ and scic_ prefixes isci: unify isci_host and scic_sds_controller isci: unify isci_remote_device and scic_sds_remote_device isci: unify isci_port and scic_sds_port isci: fix scic_sds_remote_device_terminate_requests isci: unify isci_phy and scic_sds_phy isci: unify isci_request and scic_sds_request isci: rename / clean up scic_sds_stp_request isci: preallocate requests isci: combine request flags isci: unify can_queue tracking on the tci_pool, uplevel tag assignment isci: Terminate dev requests on FIS err bit rx in NCQ isci: fix frame received locking ...
2 parents fc52693 + a5ec7f8 commit 532df6f

40 files changed

+23622
-7
lines changed

drivers/scsi/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,19 @@ config SCSI_GDTH
830830
To compile this driver as a module, choose M here: the
831831
module will be called gdth.
832832

833+
config SCSI_ISCI
834+
tristate "Intel(R) C600 Series Chipset SAS Controller"
835+
depends on PCI && SCSI
836+
depends on X86
837+
# (temporary): known alpha quality driver
838+
depends on EXPERIMENTAL
839+
select SCSI_SAS_LIBSAS
840+
---help---
841+
This driver supports the 6Gb/s SAS capabilities of the storage
842+
control unit found in the Intel(R) C600 series chipset.
843+
844+
The experimental tag will be removed after the driver exits alpha
845+
833846
config SCSI_GENERIC_NCR5380
834847
tristate "Generic NCR5380/53c400 SCSI PIO support"
835848
depends on ISA && SCSI

drivers/scsi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ obj-$(CONFIG_SCSI_AACRAID) += aacraid/
7373
obj-$(CONFIG_SCSI_AIC7XXX_OLD) += aic7xxx_old.o
7474
obj-$(CONFIG_SCSI_AIC94XX) += aic94xx/
7575
obj-$(CONFIG_SCSI_PM8001) += pm8001/
76+
obj-$(CONFIG_SCSI_ISCI) += isci/
7677
obj-$(CONFIG_SCSI_IPS) += ips.o
7778
obj-$(CONFIG_SCSI_FD_MCS) += fd_mcs.o
7879
obj-$(CONFIG_SCSI_FUTURE_DOMAIN)+= fdomain.o

drivers/scsi/hpsa.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,7 @@ static void complete_scsi_command(struct CommandList *cp)
10371037
unsigned char sense_key;
10381038
unsigned char asc; /* additional sense code */
10391039
unsigned char ascq; /* additional sense code qualifier */
1040+
unsigned long sense_data_size;
10401041

10411042
ei = cp->err_info;
10421043
cmd = (struct scsi_cmnd *) cp->scsi_cmd;
@@ -1051,10 +1052,14 @@ static void complete_scsi_command(struct CommandList *cp)
10511052
cmd->result |= ei->ScsiStatus;
10521053

10531054
/* copy the sense data whether we need to or not. */
1054-
memcpy(cmd->sense_buffer, ei->SenseInfo,
1055-
ei->SenseLen > SCSI_SENSE_BUFFERSIZE ?
1056-
SCSI_SENSE_BUFFERSIZE :
1057-
ei->SenseLen);
1055+
if (SCSI_SENSE_BUFFERSIZE < sizeof(ei->SenseInfo))
1056+
sense_data_size = SCSI_SENSE_BUFFERSIZE;
1057+
else
1058+
sense_data_size = sizeof(ei->SenseInfo);
1059+
if (ei->SenseLen < sense_data_size)
1060+
sense_data_size = ei->SenseLen;
1061+
1062+
memcpy(cmd->sense_buffer, ei->SenseInfo, sense_data_size);
10581063
scsi_set_resid(cmd, ei->ResidualCnt);
10591064

10601065
if (ei->CommandStatus == 0) {
@@ -2580,7 +2585,8 @@ static int hpsa_passthru_ioctl(struct ctlr_info *h, void __user *argp)
25802585
c->SG[0].Ext = 0; /* we are not chaining*/
25812586
}
25822587
hpsa_scsi_do_simple_cmd_core(h, c);
2583-
hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_BIDIRECTIONAL);
2588+
if (iocommand.buf_size > 0)
2589+
hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_BIDIRECTIONAL);
25842590
check_ioctl_unit_attention(h, c);
25852591

25862592
/* Copy the error information out */

drivers/scsi/ibmvscsi/ibmvfc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4306,8 +4306,8 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)
43064306
spin_lock_irqsave(vhost->host->host_lock, flags);
43074307
if (rc == H_CLOSED)
43084308
vio_enable_interrupts(to_vio_dev(vhost->dev));
4309-
else if (rc || (rc = ibmvfc_send_crq_init(vhost)) ||
4310-
(rc = vio_enable_interrupts(to_vio_dev(vhost->dev)))) {
4309+
if (rc || (rc = ibmvfc_send_crq_init(vhost)) ||
4310+
(rc = vio_enable_interrupts(to_vio_dev(vhost->dev)))) {
43114311
ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD);
43124312
dev_err(vhost->dev, "Error after reset (rc=%d)\n", rc);
43134313
}

drivers/scsi/isci/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
obj-$(CONFIG_SCSI_ISCI) += isci.o
2+
isci-objs := init.o phy.o request.o \
3+
remote_device.o port.o \
4+
host.o task.o probe_roms.o \
5+
remote_node_context.o \
6+
remote_node_table.o \
7+
unsolicited_frame_control.o \
8+
port_config.o \

drivers/scsi/isci/firmware/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Makefile for create_fw
2+
#
3+
CC=gcc
4+
CFLAGS=-c -Wall -O2 -g
5+
LDFLAGS=
6+
SOURCES=create_fw.c
7+
OBJECTS=$(SOURCES:.cpp=.o)
8+
EXECUTABLE=create_fw
9+
10+
all: $(SOURCES) $(EXECUTABLE)
11+
12+
$(EXECUTABLE): $(OBJECTS)
13+
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
14+
15+
.c.o:
16+
$(CC) $(CFLAGS) $< -O $@
17+
18+
clean:
19+
rm -f *.o $(EXECUTABLE)

drivers/scsi/isci/firmware/README

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This defines the temporary binary blow we are to pass to the SCU
2+
driver to emulate the binary firmware that we will eventually be
3+
able to access via NVRAM on the SCU controller.
4+
5+
The current size of the binary blob is expected to be 149 bytes or larger
6+
7+
Header Types:
8+
0x1: Phy Masks
9+
0x2: Phy Gens
10+
0x3: SAS Addrs
11+
0xff: End of Data
12+
13+
ID string - u8[12]: "#SCU MAGIC#\0"
14+
Version - u8: 1
15+
SubVersion - u8: 0
16+
17+
Header Type - u8: 0x1
18+
Size - u8: 8
19+
Phy Mask - u32[8]
20+
21+
Header Type - u8: 0x2
22+
Size - u8: 8
23+
Phy Gen - u32[8]
24+
25+
Header Type - u8: 0x3
26+
Size - u8: 8
27+
Sas Addr - u64[8]
28+
29+
Header Type - u8: 0xf
30+
31+
32+
==============================================================================
33+
34+
Place isci_firmware.bin in /lib/firmware
35+
Be sure to recreate the initramfs image to include the firmware.
36+
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <unistd.h>
4+
#include <sys/types.h>
5+
#include <sys/stat.h>
6+
#include <fcntl.h>
7+
#include <string.h>
8+
#include <errno.h>
9+
#include <asm/types.h>
10+
#include <strings.h>
11+
#include <stdint.h>
12+
13+
#include "create_fw.h"
14+
#include "../probe_roms.h"
15+
16+
int write_blob(struct isci_orom *isci_orom)
17+
{
18+
FILE *fd;
19+
int err;
20+
size_t count;
21+
22+
fd = fopen(blob_name, "w+");
23+
if (!fd) {
24+
perror("Open file for write failed");
25+
fclose(fd);
26+
return -EIO;
27+
}
28+
29+
count = fwrite(isci_orom, sizeof(struct isci_orom), 1, fd);
30+
if (count != 1) {
31+
perror("Write data failed");
32+
fclose(fd);
33+
return -EIO;
34+
}
35+
36+
fclose(fd);
37+
38+
return 0;
39+
}
40+
41+
void set_binary_values(struct isci_orom *isci_orom)
42+
{
43+
int ctrl_idx, phy_idx, port_idx;
44+
45+
/* setting OROM signature */
46+
strncpy(isci_orom->hdr.signature, sig, strlen(sig));
47+
isci_orom->hdr.version = version;
48+
isci_orom->hdr.total_block_length = sizeof(struct isci_orom);
49+
isci_orom->hdr.hdr_length = sizeof(struct sci_bios_oem_param_block_hdr);
50+
isci_orom->hdr.num_elements = num_elements;
51+
52+
for (ctrl_idx = 0; ctrl_idx < 2; ctrl_idx++) {
53+
isci_orom->ctrl[ctrl_idx].controller.mode_type = mode_type;
54+
isci_orom->ctrl[ctrl_idx].controller.max_concurrent_dev_spin_up =
55+
max_num_concurrent_dev_spin_up;
56+
isci_orom->ctrl[ctrl_idx].controller.do_enable_ssc =
57+
enable_ssc;
58+
59+
for (port_idx = 0; port_idx < 4; port_idx++)
60+
isci_orom->ctrl[ctrl_idx].ports[port_idx].phy_mask =
61+
phy_mask[ctrl_idx][port_idx];
62+
63+
for (phy_idx = 0; phy_idx < 4; phy_idx++) {
64+
isci_orom->ctrl[ctrl_idx].phys[phy_idx].sas_address.high =
65+
(__u32)(sas_addr[ctrl_idx][phy_idx] >> 32);
66+
isci_orom->ctrl[ctrl_idx].phys[phy_idx].sas_address.low =
67+
(__u32)(sas_addr[ctrl_idx][phy_idx]);
68+
69+
isci_orom->ctrl[ctrl_idx].phys[phy_idx].afe_tx_amp_control0 =
70+
afe_tx_amp_control0;
71+
isci_orom->ctrl[ctrl_idx].phys[phy_idx].afe_tx_amp_control1 =
72+
afe_tx_amp_control1;
73+
isci_orom->ctrl[ctrl_idx].phys[phy_idx].afe_tx_amp_control2 =
74+
afe_tx_amp_control2;
75+
isci_orom->ctrl[ctrl_idx].phys[phy_idx].afe_tx_amp_control3 =
76+
afe_tx_amp_control3;
77+
}
78+
}
79+
}
80+
81+
int main(void)
82+
{
83+
int err;
84+
struct isci_orom *isci_orom;
85+
86+
isci_orom = malloc(sizeof(struct isci_orom));
87+
memset(isci_orom, 0, sizeof(struct isci_orom));
88+
89+
set_binary_values(isci_orom);
90+
91+
err = write_blob(isci_orom);
92+
if (err < 0) {
93+
free(isci_orom);
94+
return err;
95+
}
96+
97+
free(isci_orom);
98+
return 0;
99+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#ifndef _CREATE_FW_H_
2+
#define _CREATE_FW_H_
3+
#include "../probe_roms.h"
4+
5+
6+
/* we are configuring for 2 SCUs */
7+
static const int num_elements = 2;
8+
9+
/*
10+
* For all defined arrays:
11+
* elements 0-3 are for SCU0, ports 0-3
12+
* elements 4-7 are for SCU1, ports 0-3
13+
*
14+
* valid configurations for one SCU are:
15+
* P0 P1 P2 P3
16+
* ----------------
17+
* 0xF,0x0,0x0,0x0 # 1 x4 port
18+
* 0x3,0x0,0x4,0x8 # Phys 0 and 1 are a x2 port, phy 2 and phy 3 are each x1
19+
* # ports
20+
* 0x1,0x2,0xC,0x0 # Phys 0 and 1 are each x1 ports, phy 2 and phy 3 are a x2
21+
* # port
22+
* 0x3,0x0,0xC,0x0 # Phys 0 and 1 are a x2 port, phy 2 and phy 3 are a x2 port
23+
* 0x1,0x2,0x4,0x8 # Each phy is a x1 port (this is the default configuration)
24+
*
25+
* if there is a port/phy on which you do not wish to override the default
26+
* values, use the value assigned to UNINIT_PARAM (255).
27+
*/
28+
29+
/* discovery mode type (port auto config mode by default ) */
30+
31+
/*
32+
* if there is a port/phy on which you do not wish to override the default
33+
* values, use the value "0000000000000000". SAS address of zero's is
34+
* considered invalid and will not be used.
35+
*/
36+
#ifdef MPC
37+
static const int mode_type = SCIC_PORT_MANUAL_CONFIGURATION_MODE;
38+
static const __u8 phy_mask[2][4] = { {1, 2, 4, 8},
39+
{1, 2, 4, 8} };
40+
static const unsigned long long sas_addr[2][4] = { { 0x5FCFFFFFF0000001ULL,
41+
0x5FCFFFFFF0000002ULL,
42+
0x5FCFFFFFF0000003ULL,
43+
0x5FCFFFFFF0000004ULL },
44+
{ 0x5FCFFFFFF0000005ULL,
45+
0x5FCFFFFFF0000006ULL,
46+
0x5FCFFFFFF0000007ULL,
47+
0x5FCFFFFFF0000008ULL } };
48+
#else /* APC (default) */
49+
static const int mode_type = SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE;
50+
static const __u8 phy_mask[2][4];
51+
static const unsigned long long sas_addr[2][4] = { { 0x5FCFFFFF00000001ULL,
52+
0x5FCFFFFF00000001ULL,
53+
0x5FCFFFFF00000001ULL,
54+
0x5FCFFFFF00000001ULL },
55+
{ 0x5FCFFFFF00000002ULL,
56+
0x5FCFFFFF00000002ULL,
57+
0x5FCFFFFF00000002ULL,
58+
0x5FCFFFFF00000002ULL } };
59+
#endif
60+
61+
/* Maximum number of concurrent device spin up */
62+
static const int max_num_concurrent_dev_spin_up = 1;
63+
64+
/* enable of ssc operation */
65+
static const int enable_ssc;
66+
67+
/* AFE_TX_AMP_CONTROL */
68+
static const unsigned int afe_tx_amp_control0 = 0x000bdd08;
69+
static const unsigned int afe_tx_amp_control1 = 0x000ffc00;
70+
static const unsigned int afe_tx_amp_control2 = 0x000b7c09;
71+
static const unsigned int afe_tx_amp_control3 = 0x000afc6e;
72+
73+
static const char blob_name[] = "isci_firmware.bin";
74+
static const char sig[] = "ISCUOEMB";
75+
static const unsigned char version = 0x10;
76+
77+
#endif

0 commit comments

Comments
 (0)