diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-05-09 01:15:10 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:47 -0400 |
commit | 3bff9d54ecba84e538da822349a9a6fd6e534539 (patch) | |
tree | 9a780a1ed7f1a82c1d381a6676ff742b904ea4be | |
parent | 63a3a15fb00ef49e50e98ff675094afcd92f113a (diff) |
isci: uplevel state machine
unify core/sci_base_state.h and core/sci_base_state_machine.[ch] into
state_machine.[ch]
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/scsi/isci/Makefile | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/core/sci_base_state.h | 84 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_phy.c | 3 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_phy.h | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_port.h | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_request.h | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_smp_request.c | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_ssp_request.c | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_stp_pio_request.h | 1 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_stp_request.c | 3 | ||||
-rw-r--r-- | drivers/scsi/isci/host.h | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_node_context.c | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_node_context.h | 3 | ||||
-rw-r--r-- | drivers/scsi/isci/state_machine.c (renamed from drivers/scsi/isci/core/sci_base_state_machine.c) | 13 | ||||
-rw-r--r-- | drivers/scsi/isci/state_machine.h (renamed from drivers/scsi/isci/core/sci_base_state_machine.h) | 24 |
15 files changed, 31 insertions, 116 deletions
diff --git a/drivers/scsi/isci/Makefile b/drivers/scsi/isci/Makefile index 0153b0fe13b8..cfc640f9dc3f 100644 --- a/drivers/scsi/isci/Makefile +++ b/drivers/scsi/isci/Makefile | |||
@@ -3,6 +3,7 @@ obj-$(CONFIG_SCSI_ISCI) += isci.o | |||
3 | isci-objs := init.o phy.o request.o sata.o \ | 3 | isci-objs := init.o phy.o request.o sata.o \ |
4 | remote_device.o port.o timers.o \ | 4 | remote_device.o port.o timers.o \ |
5 | host.o task.o probe_roms.o \ | 5 | host.o task.o probe_roms.o \ |
6 | state_machine.o \ | ||
6 | remote_node_context.o \ | 7 | remote_node_context.o \ |
7 | remote_node_table.o \ | 8 | remote_node_table.o \ |
8 | unsolicited_frame_control.o \ | 9 | unsolicited_frame_control.o \ |
@@ -13,5 +14,4 @@ isci-objs := init.o phy.o request.o sata.o \ | |||
13 | core/scic_sds_phy.o \ | 14 | core/scic_sds_phy.o \ |
14 | core/scic_sds_ssp_request.o \ | 15 | core/scic_sds_ssp_request.o \ |
15 | core/scic_sds_smp_request.o \ | 16 | core/scic_sds_smp_request.o \ |
16 | core/sci_base_state_machine.o \ | ||
17 | core/sci_util.o | 17 | core/sci_util.o |
diff --git a/drivers/scsi/isci/core/sci_base_state.h b/drivers/scsi/isci/core/sci_base_state.h deleted file mode 100644 index d64efac1f090..000000000000 --- a/drivers/scsi/isci/core/sci_base_state.h +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | /* | ||
2 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
3 | * redistributing this file, you may do so under either license. | ||
4 | * | ||
5 | * GPL LICENSE SUMMARY | ||
6 | * | ||
7 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of version 2 of the GNU General Public License as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
21 | * The full GNU General Public License is included in this distribution | ||
22 | * in the file called LICENSE.GPL. | ||
23 | * | ||
24 | * BSD LICENSE | ||
25 | * | ||
26 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. | ||
27 | * All rights reserved. | ||
28 | * | ||
29 | * Redistribution and use in source and binary forms, with or without | ||
30 | * modification, are permitted provided that the following conditions | ||
31 | * are met: | ||
32 | * | ||
33 | * * Redistributions of source code must retain the above copyright | ||
34 | * notice, this list of conditions and the following disclaimer. | ||
35 | * * Redistributions in binary form must reproduce the above copyright | ||
36 | * notice, this list of conditions and the following disclaimer in | ||
37 | * the documentation and/or other materials provided with the | ||
38 | * distribution. | ||
39 | * * Neither the name of Intel Corporation nor the names of its | ||
40 | * contributors may be used to endorse or promote products derived | ||
41 | * from this software without specific prior written permission. | ||
42 | * | ||
43 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
44 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
45 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
46 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
47 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
48 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
49 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
50 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
51 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
52 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
54 | */ | ||
55 | |||
56 | #ifndef _SCI_BASE_STATE_H_ | ||
57 | #define _SCI_BASE_STATE_H_ | ||
58 | |||
59 | typedef void (*sci_base_state_handler_t)(void); | ||
60 | |||
61 | typedef void (*sci_state_transition_t)(void *base_object); | ||
62 | |||
63 | /** | ||
64 | * struct sci_base_state - The base state object abstracts the fields common to | ||
65 | * all state objects defined in SCI. | ||
66 | * | ||
67 | * | ||
68 | */ | ||
69 | struct sci_base_state { | ||
70 | /** | ||
71 | * This field is a function pointer that defines the method to be | ||
72 | * invoked when the state is entered. | ||
73 | */ | ||
74 | sci_state_transition_t enter_state; | ||
75 | |||
76 | /** | ||
77 | * This field is a function pointer that defines the method to be | ||
78 | * invoked when the state is exited. | ||
79 | */ | ||
80 | sci_state_transition_t exit_state; | ||
81 | |||
82 | }; | ||
83 | |||
84 | #endif /* _SCI_BASE_STATE_H_ */ | ||
diff --git a/drivers/scsi/isci/core/scic_sds_phy.c b/drivers/scsi/isci/core/scic_sds_phy.c index c82ccb93fd9b..6b49d94bc9cc 100644 --- a/drivers/scsi/isci/core/scic_sds_phy.c +++ b/drivers/scsi/isci/core/scic_sds_phy.c | |||
@@ -56,8 +56,7 @@ | |||
56 | #include <scsi/sas.h> | 56 | #include <scsi/sas.h> |
57 | #include "sas.h" | 57 | #include "sas.h" |
58 | #include "host.h" | 58 | #include "host.h" |
59 | #include "sci_base_state.h" | 59 | #include "state_machine.h" |
60 | #include "sci_base_state_machine.h" | ||
61 | #include "scic_phy.h" | 60 | #include "scic_phy.h" |
62 | #include "scic_sds_phy.h" | 61 | #include "scic_sds_phy.h" |
63 | #include "scic_sds_port.h" | 62 | #include "scic_sds_port.h" |
diff --git a/drivers/scsi/isci/core/scic_sds_phy.h b/drivers/scsi/isci/core/scic_sds_phy.h index 472718d2f444..0d7bab3fc93b 100644 --- a/drivers/scsi/isci/core/scic_sds_phy.h +++ b/drivers/scsi/isci/core/scic_sds_phy.h | |||
@@ -59,7 +59,7 @@ | |||
59 | #include "sas.h" | 59 | #include "sas.h" |
60 | #include "scic_phy.h" | 60 | #include "scic_phy.h" |
61 | #include "registers.h" | 61 | #include "registers.h" |
62 | #include "sci_base_state_machine.h" | 62 | #include "state_machine.h" |
63 | #include <scsi/libsas.h> | 63 | #include <scsi/libsas.h> |
64 | 64 | ||
65 | struct scic_sds_port; | 65 | struct scic_sds_port; |
diff --git a/drivers/scsi/isci/core/scic_sds_port.h b/drivers/scsi/isci/core/scic_sds_port.h index 4b28c5acd758..a351525b1c49 100644 --- a/drivers/scsi/isci/core/scic_sds_port.h +++ b/drivers/scsi/isci/core/scic_sds_port.h | |||
@@ -60,7 +60,7 @@ | |||
60 | #include "isci.h" | 60 | #include "isci.h" |
61 | #include "sas.h" | 61 | #include "sas.h" |
62 | #include "registers.h" | 62 | #include "registers.h" |
63 | #include "sci_base_state_machine.h" | 63 | #include "state_machine.h" |
64 | 64 | ||
65 | struct scic_sds_controller; | 65 | struct scic_sds_controller; |
66 | struct scic_sds_phy; | 66 | struct scic_sds_phy; |
diff --git a/drivers/scsi/isci/core/scic_sds_request.h b/drivers/scsi/isci/core/scic_sds_request.h index 5ce7ff2aed9a..a8d74a15a86b 100644 --- a/drivers/scsi/isci/core/scic_sds_request.h +++ b/drivers/scsi/isci/core/scic_sds_request.h | |||
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | #include "isci.h" | 59 | #include "isci.h" |
60 | #include "scic_io_request.h" | 60 | #include "scic_io_request.h" |
61 | #include "sci_base_state_machine.h" | 61 | #include "state_machine.h" |
62 | #include "scu_task_context.h" | 62 | #include "scu_task_context.h" |
63 | #include "scic_sds_stp_request.h" | 63 | #include "scic_sds_stp_request.h" |
64 | #include "sas.h" | 64 | #include "sas.h" |
diff --git a/drivers/scsi/isci/core/scic_sds_smp_request.c b/drivers/scsi/isci/core/scic_sds_smp_request.c index 7f338948ae0d..6a2b65b9cf0f 100644 --- a/drivers/scsi/isci/core/scic_sds_smp_request.c +++ b/drivers/scsi/isci/core/scic_sds_smp_request.c | |||
@@ -54,7 +54,7 @@ | |||
54 | */ | 54 | */ |
55 | 55 | ||
56 | #include <scsi/sas.h> | 56 | #include <scsi/sas.h> |
57 | #include "sci_base_state_machine.h" | 57 | #include "state_machine.h" |
58 | #include "remote_device.h" | 58 | #include "remote_device.h" |
59 | #include "scic_sds_request.h" | 59 | #include "scic_sds_request.h" |
60 | #include "scic_sds_smp_request.h" | 60 | #include "scic_sds_smp_request.h" |
diff --git a/drivers/scsi/isci/core/scic_sds_ssp_request.c b/drivers/scsi/isci/core/scic_sds_ssp_request.c index 137f6ddac82c..3fdf68be7a4d 100644 --- a/drivers/scsi/isci/core/scic_sds_ssp_request.c +++ b/drivers/scsi/isci/core/scic_sds_ssp_request.c | |||
@@ -54,7 +54,7 @@ | |||
54 | */ | 54 | */ |
55 | 55 | ||
56 | #include "host.h" | 56 | #include "host.h" |
57 | #include "sci_base_state_machine.h" | 57 | #include "state_machine.h" |
58 | #include "scic_sds_request.h" | 58 | #include "scic_sds_request.h" |
59 | #include "scu_completion_codes.h" | 59 | #include "scu_completion_codes.h" |
60 | #include "scu_task_context.h" | 60 | #include "scu_task_context.h" |
diff --git a/drivers/scsi/isci/core/scic_sds_stp_pio_request.h b/drivers/scsi/isci/core/scic_sds_stp_pio_request.h index d0ae5909aee2..e015a1114760 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_pio_request.h +++ b/drivers/scsi/isci/core/scic_sds_stp_pio_request.h | |||
@@ -56,7 +56,6 @@ | |||
56 | #ifndef _SCIC_SDS_SATA_PIO_REQUEST_H_ | 56 | #ifndef _SCIC_SDS_SATA_PIO_REQUEST_H_ |
57 | #define _SCIC_SDS_SATA_PIO_REQUEST_H_ | 57 | #define _SCIC_SDS_SATA_PIO_REQUEST_H_ |
58 | 58 | ||
59 | #include "sci_base_state.h" | ||
60 | #include "scic_sds_request.h" | 59 | #include "scic_sds_request.h" |
61 | #include "scu_task_context.h" | 60 | #include "scu_task_context.h" |
62 | 61 | ||
diff --git a/drivers/scsi/isci/core/scic_sds_stp_request.c b/drivers/scsi/isci/core/scic_sds_stp_request.c index 9a787e25b48b..308f486514e9 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_request.c +++ b/drivers/scsi/isci/core/scic_sds_stp_request.c | |||
@@ -55,8 +55,7 @@ | |||
55 | 55 | ||
56 | #include <scsi/sas.h> | 56 | #include <scsi/sas.h> |
57 | #include "sas.h" | 57 | #include "sas.h" |
58 | #include "sci_base_state.h" | 58 | #include "state_machine.h" |
59 | #include "sci_base_state_machine.h" | ||
60 | #include "scic_io_request.h" | 59 | #include "scic_io_request.h" |
61 | #include "remote_device.h" | 60 | #include "remote_device.h" |
62 | #include "scic_sds_request.h" | 61 | #include "scic_sds_request.h" |
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h index 64edac8ccce1..9c5d121ce791 100644 --- a/drivers/scsi/isci/host.h +++ b/drivers/scsi/isci/host.h | |||
@@ -59,7 +59,7 @@ | |||
59 | #include "remote_device.h" | 59 | #include "remote_device.h" |
60 | #include "phy.h" | 60 | #include "phy.h" |
61 | #include "pool.h" | 61 | #include "pool.h" |
62 | #include "sci_base_state_machine.h" | 62 | #include "state_machine.h" |
63 | #include "remote_node_table.h" | 63 | #include "remote_node_table.h" |
64 | #include "registers.h" | 64 | #include "registers.h" |
65 | #include "scu_unsolicited_frame.h" | 65 | #include "scu_unsolicited_frame.h" |
diff --git a/drivers/scsi/isci/remote_node_context.c b/drivers/scsi/isci/remote_node_context.c index af4759383db4..5891f3d50177 100644 --- a/drivers/scsi/isci/remote_node_context.c +++ b/drivers/scsi/isci/remote_node_context.c | |||
@@ -54,7 +54,7 @@ | |||
54 | */ | 54 | */ |
55 | 55 | ||
56 | #include "host.h" | 56 | #include "host.h" |
57 | #include "sci_base_state_machine.h" | 57 | #include "state_machine.h" |
58 | #include "scic_sds_port.h" | 58 | #include "scic_sds_port.h" |
59 | #include "remote_device.h" | 59 | #include "remote_device.h" |
60 | #include "remote_node_context.h" | 60 | #include "remote_node_context.h" |
diff --git a/drivers/scsi/isci/remote_node_context.h b/drivers/scsi/isci/remote_node_context.h index 540a49a9c94d..a763468fa74f 100644 --- a/drivers/scsi/isci/remote_node_context.h +++ b/drivers/scsi/isci/remote_node_context.h | |||
@@ -64,8 +64,7 @@ | |||
64 | * | 64 | * |
65 | */ | 65 | */ |
66 | 66 | ||
67 | #include "sci_base_state.h" | 67 | #include "state_machine.h" |
68 | #include "sci_base_state_machine.h" | ||
69 | 68 | ||
70 | /** | 69 | /** |
71 | * | 70 | * |
diff --git a/drivers/scsi/isci/core/sci_base_state_machine.c b/drivers/scsi/isci/state_machine.c index a704709eed87..6057782af8c2 100644 --- a/drivers/scsi/isci/core/sci_base_state_machine.c +++ b/drivers/scsi/isci/state_machine.c | |||
@@ -60,7 +60,7 @@ | |||
60 | * | 60 | * |
61 | */ | 61 | */ |
62 | 62 | ||
63 | #include "sci_base_state_machine.h" | 63 | #include "state_machine.h" |
64 | 64 | ||
65 | static void sci_state_machine_exit_state(struct sci_base_state_machine *sm) | 65 | static void sci_state_machine_exit_state(struct sci_base_state_machine *sm) |
66 | { | 66 | { |
@@ -121,9 +121,6 @@ void sci_base_state_machine_construct(struct sci_base_state_machine *sm, | |||
121 | void sci_base_state_machine_start(struct sci_base_state_machine *sm) | 121 | void sci_base_state_machine_start(struct sci_base_state_machine *sm) |
122 | { | 122 | { |
123 | sm->current_state_id = sm->initial_state_id; | 123 | sm->current_state_id = sm->initial_state_id; |
124 | #if defined(SCI_BASE_ENABLE_SUBJECT_NOTIFICATION) | ||
125 | sci_base_subject_notify(&sm->parent); | ||
126 | #endif | ||
127 | sci_state_machine_enter_state(sm); | 124 | sci_state_machine_enter_state(sm); |
128 | } | 125 | } |
129 | 126 | ||
@@ -137,9 +134,6 @@ void sci_base_state_machine_stop( | |||
137 | struct sci_base_state_machine *sm) | 134 | struct sci_base_state_machine *sm) |
138 | { | 135 | { |
139 | sci_state_machine_exit_state(sm); | 136 | sci_state_machine_exit_state(sm); |
140 | #if defined(SCI_BASE_ENABLE_SUBJECT_NOTIFICATION) | ||
141 | sci_base_subject_notify(&sm->parent); | ||
142 | #endif | ||
143 | } | 137 | } |
144 | 138 | ||
145 | /** | 139 | /** |
@@ -158,11 +152,6 @@ void sci_base_state_machine_change_state( | |||
158 | sm->previous_state_id = sm->current_state_id; | 152 | sm->previous_state_id = sm->current_state_id; |
159 | sm->current_state_id = next_state; | 153 | sm->current_state_id = next_state; |
160 | 154 | ||
161 | #if defined(SCI_BASE_ENABLE_SUBJECT_NOTIFICATION) | ||
162 | /* Notify of the state change prior to entering the state. */ | ||
163 | sci_base_subject_notify(&sm->parent); | ||
164 | #endif | ||
165 | |||
166 | sci_state_machine_enter_state(sm); | 155 | sci_state_machine_enter_state(sm); |
167 | } | 156 | } |
168 | 157 | ||
diff --git a/drivers/scsi/isci/core/sci_base_state_machine.h b/drivers/scsi/isci/state_machine.h index c0cf33bbecc8..c29eb4271d05 100644 --- a/drivers/scsi/isci/core/sci_base_state_machine.h +++ b/drivers/scsi/isci/state_machine.h | |||
@@ -56,18 +56,32 @@ | |||
56 | #ifndef _SCI_BASE_STATE_MACHINE_H_ | 56 | #ifndef _SCI_BASE_STATE_MACHINE_H_ |
57 | #define _SCI_BASE_STATE_MACHINE_H_ | 57 | #define _SCI_BASE_STATE_MACHINE_H_ |
58 | 58 | ||
59 | #include <linux/string.h> | 59 | #include <linux/types.h> |
60 | |||
61 | typedef void (*sci_base_state_handler_t)(void); | ||
62 | |||
63 | typedef void (*sci_state_transition_t)(void *base_object); | ||
60 | 64 | ||
61 | /** | 65 | /** |
62 | * This file contains all structures, constants, or method declarations common | 66 | * struct sci_base_state - The base state object abstracts the fields common to |
63 | * to all state machines defined in SCI. | 67 | * all state objects defined in SCI. |
64 | * | 68 | * |
65 | * | 69 | * |
66 | */ | 70 | */ |
71 | struct sci_base_state { | ||
72 | /** | ||
73 | * This field is a function pointer that defines the method to be | ||
74 | * invoked when the state is entered. | ||
75 | */ | ||
76 | sci_state_transition_t enter_state; | ||
67 | 77 | ||
78 | /** | ||
79 | * This field is a function pointer that defines the method to be | ||
80 | * invoked when the state is exited. | ||
81 | */ | ||
82 | sci_state_transition_t exit_state; | ||
68 | 83 | ||
69 | #include "sci_base_state.h" | 84 | }; |
70 | |||
71 | 85 | ||
72 | /** | 86 | /** |
73 | * SET_STATE_HANDLER() - | 87 | * SET_STATE_HANDLER() - |