diff options
author | Kashyap, Desai <kashyap.desai@lsi.com> | 2009-12-16 08:25:26 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-02-08 19:19:42 -0500 |
commit | 50d5c60634673a79f8d88564e10345b50fca7378 (patch) | |
tree | 837ce67b8dad98caddfc9469acecaca124ceea1d /drivers/scsi/mpt2sas/mpt2sas_config.c | |
parent | f7c95ef02b564d9984c0655c9659791b1dd5d7ad (diff) |
[SCSI] mpt2sas: Added phy_enable and set_phy_speed sysfs callback support.
Added new callbacks phy_enable and set_phy_speed in the
mpt2sas_transport_functions template. This will allow end user to
enable/disable phys and change links rates using the SysFS interface.
Current implementation only supports direct attached phys, but we
could in the future add support for expander based phys.
A new subroutine mpt2sas_config_set_sas_iounit_pg1 was added;
this wrapper function used to send request to controller firmware to modify
the phys and link rates. A new subroutine _transport_find_local_phy was added;
a function for easly obtaining the local phy object for direct attached.
Example to disable a phy
echo 0 > /sys/class/phy3:0/enable
Example to enable the same phy
echo 1 > /sys/class/phy3:0/enable
Example to change the link rate to 1.5
#echo "1.5 Gbit" > /sys/class/phy3:0/maximum_linkrate
#cat /sys/class/phy3:0/negotiated_linkrate
1.5 Gbit
Example to change the link rate to 3.0
#echo "3.0 Gbit" > /sys/class/phy3:0/maximum_linkrate
#cat /sys/class/phy3:0/negotiated_linkrate
3.0 Gbit
Example to change the link rate to 6.0
#echo "6.0 Gbit" > /sys/class/phy3:0/maximum_linkrate
#cat /sys/class/phy3:0/negotiated_linkrate
6.0 Gbit
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_config.c')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_config.c | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_config.c b/drivers/scsi/mpt2sas/mpt2sas_config.c index 594a389c6526..411c27d7f787 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_config.c +++ b/drivers/scsi/mpt2sas/mpt2sas_config.c | |||
@@ -324,7 +324,9 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t | |||
324 | if (r != 0) | 324 | if (r != 0) |
325 | goto out; | 325 | goto out; |
326 | if (mpi_request->Action == | 326 | if (mpi_request->Action == |
327 | MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT) { | 327 | MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT || |
328 | mpi_request->Action == | ||
329 | MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM) { | ||
328 | ioc->base_add_sg_single(&mpi_request->PageBufferSGE, | 330 | ioc->base_add_sg_single(&mpi_request->PageBufferSGE, |
329 | MPT2_CONFIG_COMMON_WRITE_SGLFLAGS | mem.sz, | 331 | MPT2_CONFIG_COMMON_WRITE_SGLFLAGS | mem.sz, |
330 | mem.page_dma); | 332 | mem.page_dma); |
@@ -882,7 +884,7 @@ mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
882 | } | 884 | } |
883 | 885 | ||
884 | /** | 886 | /** |
885 | * mpt2sas_config_get_sas_iounit_pg1 - obtain sas iounit page 0 | 887 | * mpt2sas_config_get_sas_iounit_pg1 - obtain sas iounit page 1 |
886 | * @ioc: per adapter object | 888 | * @ioc: per adapter object |
887 | * @mpi_reply: reply mf payload returned from firmware | 889 | * @mpi_reply: reply mf payload returned from firmware |
888 | * @config_page: contents of the config page | 890 | * @config_page: contents of the config page |
@@ -907,7 +909,7 @@ mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
907 | mpi_request.Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; | 909 | mpi_request.Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; |
908 | mpi_request.ExtPageType = MPI2_CONFIG_EXTPAGETYPE_SAS_IO_UNIT; | 910 | mpi_request.ExtPageType = MPI2_CONFIG_EXTPAGETYPE_SAS_IO_UNIT; |
909 | mpi_request.Header.PageNumber = 1; | 911 | mpi_request.Header.PageNumber = 1; |
910 | mpi_request.Header.PageVersion = MPI2_SASIOUNITPAGE0_PAGEVERSION; | 912 | mpi_request.Header.PageVersion = MPI2_SASIOUNITPAGE1_PAGEVERSION; |
911 | mpt2sas_base_build_zero_len_sge(ioc, &mpi_request.PageBufferSGE); | 913 | mpt2sas_base_build_zero_len_sge(ioc, &mpi_request.PageBufferSGE); |
912 | r = _config_request(ioc, &mpi_request, mpi_reply, | 914 | r = _config_request(ioc, &mpi_request, mpi_reply, |
913 | MPT2_CONFIG_PAGE_DEFAULT_TIMEOUT, NULL, 0); | 915 | MPT2_CONFIG_PAGE_DEFAULT_TIMEOUT, NULL, 0); |
@@ -922,6 +924,49 @@ mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
922 | } | 924 | } |
923 | 925 | ||
924 | /** | 926 | /** |
927 | * mpt2sas_config_set_sas_iounit_pg1 - send sas iounit page 1 | ||
928 | * @ioc: per adapter object | ||
929 | * @mpi_reply: reply mf payload returned from firmware | ||
930 | * @config_page: contents of the config page | ||
931 | * @sz: size of buffer passed in config_page | ||
932 | * Context: sleep. | ||
933 | * | ||
934 | * Calling function should call config_get_number_hba_phys prior to | ||
935 | * this function, so enough memory is allocated for config_page. | ||
936 | * | ||
937 | * Returns 0 for success, non-zero for failure. | ||
938 | */ | ||
939 | int | ||
940 | mpt2sas_config_set_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | ||
941 | *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz) | ||
942 | { | ||
943 | Mpi2ConfigRequest_t mpi_request; | ||
944 | int r; | ||
945 | |||
946 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | ||
947 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | ||
948 | mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER; | ||
949 | mpi_request.Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; | ||
950 | mpi_request.ExtPageType = MPI2_CONFIG_EXTPAGETYPE_SAS_IO_UNIT; | ||
951 | mpi_request.Header.PageNumber = 1; | ||
952 | mpi_request.Header.PageVersion = MPI2_SASIOUNITPAGE1_PAGEVERSION; | ||
953 | mpt2sas_base_build_zero_len_sge(ioc, &mpi_request.PageBufferSGE); | ||
954 | r = _config_request(ioc, &mpi_request, mpi_reply, | ||
955 | MPT2_CONFIG_PAGE_DEFAULT_TIMEOUT, NULL, 0); | ||
956 | if (r) | ||
957 | goto out; | ||
958 | |||
959 | mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT; | ||
960 | _config_request(ioc, &mpi_request, mpi_reply, | ||
961 | MPT2_CONFIG_PAGE_DEFAULT_TIMEOUT, config_page, sz); | ||
962 | mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM; | ||
963 | r = _config_request(ioc, &mpi_request, mpi_reply, | ||
964 | MPT2_CONFIG_PAGE_DEFAULT_TIMEOUT, config_page, sz); | ||
965 | out: | ||
966 | return r; | ||
967 | } | ||
968 | |||
969 | /** | ||
925 | * mpt2sas_config_get_expander_pg0 - obtain expander page 0 | 970 | * mpt2sas_config_get_expander_pg0 - obtain expander page 0 |
926 | * @ioc: per adapter object | 971 | * @ioc: per adapter object |
927 | * @mpi_reply: reply mf payload returned from firmware | 972 | * @mpi_reply: reply mf payload returned from firmware |