isci: convert scic_timeout_timer to sci_timer
[deliverable/linux.git] / drivers / scsi / isci / host.h
CommitLineData
6f231dda
DW
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 */
ce2b3261 55#ifndef _SCI_HOST_H_
6f231dda
DW
56#define _SCI_HOST_H_
57
6f231dda 58#include "remote_device.h"
ce2b3261 59#include "phy.h"
cc9203bf 60#include "pool.h"
3bff9d54 61#include "state_machine.h"
cc9203bf 62#include "remote_node_table.h"
63a3a15f 63#include "registers.h"
cc9203bf 64#include "scu_unsolicited_frame.h"
63a3a15f 65#include "unsolicited_frame_control.h"
e2f8db50 66#include "probe_roms.h"
cc9203bf
DW
67
68struct scic_sds_request;
69struct scu_task_context;
70
e2f8db50 71
cc9203bf
DW
72/**
73 * struct scic_power_control -
74 *
75 * This structure defines the fields for managing power control for direct
76 * attached disk devices.
77 */
78struct scic_power_control {
79 /**
80 * This field is set when the power control timer is running and cleared when
81 * it is not.
82 */
83 bool timer_started;
84
85 /**
0473661a 86 * Timer to control when the directed attached disks can consume power.
cc9203bf 87 */
0473661a 88 struct sci_timer timer;
cc9203bf
DW
89
90 /**
91 * This field is used to keep track of how many phys are put into the
92 * requesters field.
93 */
94 u8 phys_waiting;
95
96 /**
97 * This field is used to keep track of how many phys have been granted to consume power
98 */
99 u8 phys_granted_power;
100
101 /**
102 * This field is an array of phys that we are waiting on. The phys are direct
103 * mapped into requesters via struct scic_sds_phy.phy_index
104 */
105 struct scic_sds_phy *requesters[SCI_MAX_PHYS];
106
107};
108
e2f8db50
DW
109struct scic_sds_port_configuration_agent;
110typedef void (*port_config_fn)(struct scic_sds_controller *,
111 struct scic_sds_port_configuration_agent *,
112 struct scic_sds_port *, struct scic_sds_phy *);
113
114struct scic_sds_port_configuration_agent {
115 u16 phy_configured_mask;
116 u16 phy_ready_mask;
117 struct {
118 u8 min_index;
119 u8 max_index;
120 } phy_valid_port_range[SCI_MAX_PHYS];
121 bool timer_pending;
122 port_config_fn link_up_handler;
123 port_config_fn link_down_handler;
ac0eeb4f 124 struct sci_timer timer;
e2f8db50
DW
125};
126
cc9203bf
DW
127/**
128 * struct scic_sds_controller -
129 *
130 * This structure represents the SCU controller object.
131 */
132struct scic_sds_controller {
133 /**
134 * This field contains the information for the base controller state
135 * machine.
136 */
137 struct sci_base_state_machine state_machine;
138
139 /**
6cb5853d 140 * Timer for controller start/stop operations.
cc9203bf 141 */
6cb5853d 142 struct sci_timer timer;
cc9203bf
DW
143
144 /**
145 * This field contains the user parameters to be utilized for this
146 * core controller object.
147 */
148 union scic_user_parameters user_parameters;
149
150 /**
151 * This field contains the OEM parameters to be utilized for this
152 * core controller object.
153 */
154 union scic_oem_parameters oem_parameters;
155
156 /**
157 * This field contains the port configuration agent for this controller.
158 */
159 struct scic_sds_port_configuration_agent port_agent;
160
161 /**
162 * This field is the array of device objects that are currently constructed
163 * for this controller object. This table is used as a fast lookup of device
164 * objects that need to handle device completion notifications from the
165 * hardware. The table is RNi based.
166 */
167 struct scic_sds_remote_device *device_table[SCI_MAX_REMOTE_DEVICES];
168
169 /**
170 * This field is the array of IO request objects that are currently active for
171 * this controller object. This table is used as a fast lookup of the io
172 * request object that need to handle completion queue notifications. The
173 * table is TCi based.
174 */
175 struct scic_sds_request *io_request_table[SCI_MAX_IO_REQUESTS];
176
177 /**
178 * This field is the free RNi data structure
179 */
180 struct scic_remote_node_table available_remote_nodes;
181
182 /**
183 * This field is the TCi pool used to manage the task context index.
184 */
185 SCI_POOL_CREATE(tci_pool, u16, SCI_MAX_IO_REQUESTS);
186
187 /**
188 * This filed is the struct scic_power_control data used to controll when direct
189 * attached devices can consume power.
190 */
191 struct scic_power_control power_control;
192
193 /**
194 * This field is the array of sequence values for the IO Tag fields. Even
195 * though only 4 bits of the field is used for the sequence the sequence is 16
196 * bits in size so the sequence can be bitwise or'd with the TCi to build the
197 * IO Tag value.
198 */
199 u16 io_request_sequence[SCI_MAX_IO_REQUESTS];
200
201 /**
202 * This field in the array of sequence values for the RNi. These are used
203 * to control io request build to io request start operations. The sequence
204 * value is recorded into an io request when it is built and is checked on
205 * the io request start operation to make sure that there was not a device
206 * hot plug between the build and start operation.
207 */
208 u8 remote_device_sequence[SCI_MAX_REMOTE_DEVICES];
209
210 /**
211 * This field is a pointer to the memory allocated by the driver for the task
212 * context table. This data is shared between the hardware and software.
213 */
214 struct scu_task_context *task_context_table;
215
216 /**
217 * This field is a pointer to the memory allocated by the driver for the
218 * remote node context table. This table is shared between the hardware and
219 * software.
220 */
221 union scu_remote_node_context *remote_node_context_table;
222
223 /**
224 * This field is a pointer to the completion queue. This memory is
225 * written to by the hardware and read by the software.
226 */
227 u32 *completion_queue;
228
229 /**
230 * This field is the software copy of the completion queue get pointer. The
231 * controller object writes this value to the hardware after processing the
232 * completion entries.
233 */
234 u32 completion_queue_get;
235
236 /**
237 * This field is the minimum of the number of hardware supported port entries
238 * and the software requested port entries.
239 */
240 u32 logical_port_entries;
241
242 /**
243 * This field is the minimum number of hardware supported completion queue
244 * entries and the software requested completion queue entries.
245 */
246 u32 completion_queue_entries;
247
248 /**
249 * This field is the minimum number of hardware supported event entries and
250 * the software requested event entries.
251 */
252 u32 completion_event_entries;
253
254 /**
255 * This field is the minimum number of devices supported by the hardware and
256 * the number of devices requested by the software.
257 */
258 u32 remote_node_entries;
259
260 /**
261 * This field is the minimum number of IO requests supported by the hardware
262 * and the number of IO requests requested by the software.
263 */
264 u32 task_context_entries;
265
266 /**
267 * This object contains all of the unsolicited frame specific
268 * data utilized by the core controller.
269 */
270 struct scic_sds_unsolicited_frame_control uf_control;
271
272 /* Phy Startup Data */
273 /**
274 * This field is the driver timer handle for controller phy request startup.
275 * On controller start the controller will start each PHY individually in
276 * order of phy index.
277 */
278 void *phy_startup_timer;
279
280 /**
281 * This field is set when the phy_startup_timer is running and is cleared when
282 * the phy_startup_timer is stopped.
283 */
284 bool phy_startup_timer_pending;
285
286 /**
287 * This field is the index of the next phy start. It is initialized to 0 and
288 * increments for each phy index that is started.
289 */
290 u32 next_phy_to_start;
291
292 /**
293 * This field controlls the invalid link up notifications to the SCI_USER. If
294 * an invalid_link_up notification is reported a bit for the PHY index is set
295 * so further notifications are not made. Once the PHY object reports link up
296 * and is made part of a port then this bit for the PHY index is cleared.
297 */
298 u8 invalid_phy_mask;
299
300 /*
301 * This field saves the current interrupt coalescing number of the controller.
302 */
303 u16 interrupt_coalesce_number;
304
305 /*
306 * This field saves the current interrupt coalescing timeout value in microseconds.
307 */
308 u32 interrupt_coalesce_timeout;
309
310 /**
311 * This field is a pointer to the memory mapped register space for the
312 * struct smu_registers.
313 */
314 struct smu_registers __iomem *smu_registers;
315
316 /**
317 * This field is a pointer to the memory mapped register space for the
318 * struct scu_registers.
319 */
320 struct scu_registers __iomem *scu_registers;
321
322};
6f231dda 323
6f231dda 324struct isci_host {
cc3dbd0a 325 struct scic_sds_controller sci;
6f231dda
DW
326 union scic_oem_parameters oem_parameters;
327
328 int id; /* unique within a given pci device */
7c40a803 329 struct list_head timers;
6f231dda
DW
330 void *core_ctrl_memory;
331 struct dma_pool *dma_pool;
6f231dda 332 struct isci_phy phys[SCI_MAX_PHYS];
e531381e 333 struct isci_port ports[SCI_MAX_PORTS + 1]; /* includes dummy port */
6f231dda
DW
334 struct sas_ha_struct sas_ha;
335
336 int can_queue;
337 spinlock_t queue_lock;
338 spinlock_t state_lock;
339
340 struct pci_dev *pdev;
6f231dda
DW
341
342 enum isci_status status;
0cf89d1d
DW
343 #define IHOST_START_PENDING 0
344 #define IHOST_STOP_PENDING 1
345 unsigned long flags;
346 wait_queue_head_t eventq;
6f231dda
DW
347 struct Scsi_Host *shost;
348 struct tasklet_struct completion_tasklet;
6f231dda 349 struct list_head requests_to_complete;
11b00c19 350 struct list_head requests_to_errorback;
6f231dda 351 spinlock_t scic_lock;
d9c37390 352
57f20f4e 353 struct isci_remote_device devices[SCI_MAX_REMOTE_DEVICES];
6f231dda
DW
354};
355
cc9203bf
DW
356/**
357 * enum scic_sds_controller_states - This enumeration depicts all the states
358 * for the common controller state machine.
359 */
360enum scic_sds_controller_states {
361 /**
362 * Simply the initial state for the base controller state machine.
363 */
364 SCI_BASE_CONTROLLER_STATE_INITIAL = 0,
365
366 /**
367 * This state indicates that the controller is reset. The memory for
368 * the controller is in it's initial state, but the controller requires
369 * initialization.
370 * This state is entered from the INITIAL state.
371 * This state is entered from the RESETTING state.
372 */
373 SCI_BASE_CONTROLLER_STATE_RESET,
374
375 /**
376 * This state is typically an action state that indicates the controller
377 * is in the process of initialization. In this state no new IO operations
378 * are permitted.
379 * This state is entered from the RESET state.
380 */
381 SCI_BASE_CONTROLLER_STATE_INITIALIZING,
382
383 /**
384 * This state indicates that the controller has been successfully
385 * initialized. In this state no new IO operations are permitted.
386 * This state is entered from the INITIALIZING state.
387 */
388 SCI_BASE_CONTROLLER_STATE_INITIALIZED,
389
390 /**
391 * This state indicates the the controller is in the process of becoming
392 * ready (i.e. starting). In this state no new IO operations are permitted.
393 * This state is entered from the INITIALIZED state.
394 */
395 SCI_BASE_CONTROLLER_STATE_STARTING,
396
397 /**
398 * This state indicates the controller is now ready. Thus, the user
399 * is able to perform IO operations on the controller.
400 * This state is entered from the STARTING state.
401 */
402 SCI_BASE_CONTROLLER_STATE_READY,
403
404 /**
405 * This state is typically an action state that indicates the controller
406 * is in the process of resetting. Thus, the user is unable to perform
407 * IO operations on the controller. A reset is considered destructive in
408 * most cases.
409 * This state is entered from the READY state.
410 * This state is entered from the FAILED state.
411 * This state is entered from the STOPPED state.
412 */
413 SCI_BASE_CONTROLLER_STATE_RESETTING,
414
415 /**
416 * This state indicates that the controller is in the process of stopping.
417 * In this state no new IO operations are permitted, but existing IO
418 * operations are allowed to complete.
419 * This state is entered from the READY state.
420 */
421 SCI_BASE_CONTROLLER_STATE_STOPPING,
422
423 /**
424 * This state indicates that the controller has successfully been stopped.
425 * In this state no new IO operations are permitted.
426 * This state is entered from the STOPPING state.
427 */
428 SCI_BASE_CONTROLLER_STATE_STOPPED,
429
430 /**
431 * This state indicates that the controller could not successfully be
432 * initialized. In this state no new IO operations are permitted.
433 * This state is entered from the INITIALIZING state.
434 * This state is entered from the STARTING state.
435 * This state is entered from the STOPPING state.
436 * This state is entered from the RESETTING state.
437 */
438 SCI_BASE_CONTROLLER_STATE_FAILED,
439
440 SCI_BASE_CONTROLLER_MAX_STATES
441
442};
443
444
445
6f231dda
DW
446/**
447 * struct isci_pci_info - This class represents the pci function containing the
448 * controllers. Depending on PCI SKU, there could be up to 2 controllers in
449 * the PCI function.
450 */
451#define SCI_MAX_MSIX_INT (SCI_NUM_MSI_X_INT*SCI_MAX_CONTROLLERS)
452
453struct isci_pci_info {
454 struct msix_entry msix_entries[SCI_MAX_MSIX_INT];
b329aff1 455 struct isci_host *hosts[SCI_MAX_CONTROLLERS];
d044af17 456 struct isci_orom *orom;
6f231dda
DW
457};
458
459static inline struct isci_pci_info *to_pci_info(struct pci_dev *pdev)
460{
461 return pci_get_drvdata(pdev);
462}
463
b329aff1
DW
464#define for_each_isci_host(id, ihost, pdev) \
465 for (id = 0, ihost = to_pci_info(pdev)->hosts[id]; \
466 id < ARRAY_SIZE(to_pci_info(pdev)->hosts) && ihost; \
467 ihost = to_pci_info(pdev)->hosts[++id])
6f231dda 468
cc9203bf 469static inline enum isci_status isci_host_get_state(struct isci_host *isci_host)
6f231dda
DW
470{
471 return isci_host->status;
472}
473
cc9203bf
DW
474static inline void isci_host_change_state(struct isci_host *isci_host,
475 enum isci_status status)
6f231dda
DW
476{
477 unsigned long flags;
478
479 dev_dbg(&isci_host->pdev->dev,
480 "%s: isci_host = %p, state = 0x%x",
481 __func__,
482 isci_host,
483 status);
484 spin_lock_irqsave(&isci_host->state_lock, flags);
485 isci_host->status = status;
486 spin_unlock_irqrestore(&isci_host->state_lock, flags);
487
488}
489
cc9203bf 490static inline int isci_host_can_queue(struct isci_host *isci_host, int num)
6f231dda
DW
491{
492 int ret = 0;
493 unsigned long flags;
494
495 spin_lock_irqsave(&isci_host->queue_lock, flags);
496 if ((isci_host->can_queue - num) < 0) {
497 dev_dbg(&isci_host->pdev->dev,
498 "%s: isci_host->can_queue = %d\n",
499 __func__,
500 isci_host->can_queue);
501 ret = -SAS_QUEUE_FULL;
502
503 } else
504 isci_host->can_queue -= num;
505
506 spin_unlock_irqrestore(&isci_host->queue_lock, flags);
507
508 return ret;
509}
510
cc9203bf 511static inline void isci_host_can_dequeue(struct isci_host *isci_host, int num)
6f231dda
DW
512{
513 unsigned long flags;
514
515 spin_lock_irqsave(&isci_host->queue_lock, flags);
516 isci_host->can_queue += num;
517 spin_unlock_irqrestore(&isci_host->queue_lock, flags);
518}
519
0cf89d1d
DW
520static inline void wait_for_start(struct isci_host *ihost)
521{
522 wait_event(ihost->eventq, !test_bit(IHOST_START_PENDING, &ihost->flags));
523}
524
525static inline void wait_for_stop(struct isci_host *ihost)
526{
527 wait_event(ihost->eventq, !test_bit(IHOST_STOP_PENDING, &ihost->flags));
528}
529
6ad31fec
DW
530static inline void wait_for_device_start(struct isci_host *ihost, struct isci_remote_device *idev)
531{
532 wait_event(ihost->eventq, !test_bit(IDEV_START_PENDING, &idev->flags));
533}
534
535static inline void wait_for_device_stop(struct isci_host *ihost, struct isci_remote_device *idev)
536{
d9c37390 537 wait_event(ihost->eventq, !test_bit(IDEV_STOP_PENDING, &idev->flags));
6ad31fec 538}
0cf89d1d 539
4393aa4e
DW
540static inline struct isci_host *dev_to_ihost(struct domain_device *dev)
541{
542 return dev->port->ha->lldd_ha;
543}
6f231dda 544
cc3dbd0a
AW
545static inline struct isci_host *scic_to_ihost(struct scic_sds_controller *scic)
546{
547 /* XXX delete after merging scic_sds_contoller and isci_host */
548 struct isci_host *ihost = container_of(scic, typeof(*ihost), sci);
549
550 return ihost;
551}
552
6f231dda 553/**
cc9203bf 554 * INCREMENT_QUEUE_GET() -
6f231dda 555 *
cc9203bf
DW
556 * This macro will increment the specified index to and if the index wraps to 0
557 * it will toggel the cycle bit.
6f231dda 558 */
cc9203bf
DW
559#define INCREMENT_QUEUE_GET(index, cycle, entry_count, bit_toggle) \
560 { \
561 if ((index) + 1 == entry_count) { \
562 (index) = 0; \
563 (cycle) = (cycle) ^ (bit_toggle); \
564 } else { \
565 index = index + 1; \
566 } \
567 }
6f231dda 568
6f231dda 569/**
cc9203bf 570 * scic_sds_controller_get_protocol_engine_group() -
6f231dda 571 *
cc9203bf
DW
572 * This macro returns the protocol engine group for this controller object.
573 * Presently we only support protocol engine group 0 so just return that
6f231dda 574 */
cc9203bf 575#define scic_sds_controller_get_protocol_engine_group(controller) 0
6f231dda
DW
576
577/**
cc9203bf 578 * scic_sds_io_tag_construct() -
6f231dda 579 *
cc9203bf 580 * This macro constructs an IO tag from the sequence and index values.
6f231dda 581 */
cc9203bf
DW
582#define scic_sds_io_tag_construct(sequence, task_index) \
583 ((sequence) << 12 | (task_index))
6f231dda 584
cc9203bf
DW
585/**
586 * scic_sds_io_tag_get_sequence() -
587 *
588 * This macro returns the IO sequence from the IO tag value.
589 */
590#define scic_sds_io_tag_get_sequence(io_tag) \
591 (((io_tag) & 0xF000) >> 12)
592
593/**
594 * scic_sds_io_tag_get_index() -
595 *
596 * This macro returns the TCi from the io tag value
597 */
598#define scic_sds_io_tag_get_index(io_tag) \
599 ((io_tag) & 0x0FFF)
600
601/**
602 * scic_sds_io_sequence_increment() -
603 *
604 * This is a helper macro to increment the io sequence count. We may find in
605 * the future that it will be faster to store the sequence count in such a way
606 * as we dont perform the shift operation to build io tag values so therefore
607 * need a way to incrment them correctly
608 */
609#define scic_sds_io_sequence_increment(value) \
610 ((value) = (((value) + 1) & 0x000F))
611
612/* expander attached sata devices require 3 rnc slots */
613static inline int scic_sds_remote_device_node_count(struct scic_sds_remote_device *sci_dev)
614{
615 struct domain_device *dev = sci_dev_to_domain(sci_dev);
616
617 if ((dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) &&
618 !sci_dev->is_direct_attached)
619 return SCU_STP_REMOTE_NODE_COUNT;
620 return SCU_SSP_REMOTE_NODE_COUNT;
621}
622
623/**
624 * scic_sds_controller_set_invalid_phy() -
625 *
626 * This macro will set the bit in the invalid phy mask for this controller
627 * object. This is used to control messages reported for invalid link up
628 * notifications.
629 */
630#define scic_sds_controller_set_invalid_phy(controller, phy) \
631 ((controller)->invalid_phy_mask |= (1 << (phy)->phy_index))
632
633/**
634 * scic_sds_controller_clear_invalid_phy() -
635 *
636 * This macro will clear the bit in the invalid phy mask for this controller
637 * object. This is used to control messages reported for invalid link up
638 * notifications.
639 */
640#define scic_sds_controller_clear_invalid_phy(controller, phy) \
641 ((controller)->invalid_phy_mask &= ~(1 << (phy)->phy_index))
642
643static inline struct device *scic_to_dev(struct scic_sds_controller *scic)
644{
645 return &scic_to_ihost(scic)->pdev->dev;
646}
647
648static inline struct device *sciphy_to_dev(struct scic_sds_phy *sci_phy)
649{
650 struct isci_phy *iphy = sci_phy_to_iphy(sci_phy);
651
652 if (!iphy || !iphy->isci_port || !iphy->isci_port->isci_host)
653 return NULL;
654
655 return &iphy->isci_port->isci_host->pdev->dev;
656}
657
658static inline struct device *sciport_to_dev(struct scic_sds_port *sci_port)
659{
660 struct isci_port *iport = sci_port_to_iport(sci_port);
661
662 if (!iport || !iport->isci_host)
663 return NULL;
664
665 return &iport->isci_host->pdev->dev;
666}
667
668static inline struct device *scirdev_to_dev(struct scic_sds_remote_device *sci_dev)
669{
670 struct isci_remote_device *idev =
671 container_of(sci_dev, typeof(*idev), sci);
672
673 if (!idev || !idev->isci_port || !idev->isci_port->isci_host)
674 return NULL;
675
676 return &idev->isci_port->isci_host->pdev->dev;
677}
678
679enum {
680 ISCI_SI_REVA0,
681 ISCI_SI_REVA2,
682 ISCI_SI_REVB0,
683};
684
685extern int isci_si_rev;
686
687static inline bool is_a0(void)
688{
689 return isci_si_rev == ISCI_SI_REVA0;
690}
691
692static inline bool is_a2(void)
693{
694 return isci_si_rev == ISCI_SI_REVA2;
695}
696
697static inline bool is_b0(void)
698{
699 return isci_si_rev > ISCI_SI_REVA2;
700}
701
702void scic_sds_controller_post_request(struct scic_sds_controller *scic,
703 u32 request);
704void scic_sds_controller_release_frame(struct scic_sds_controller *scic,
705 u32 frame_index);
706void scic_sds_controller_copy_sata_response(void *response_buffer,
707 void *frame_header,
708 void *frame_buffer);
709enum sci_status scic_sds_controller_allocate_remote_node_context(struct scic_sds_controller *scic,
710 struct scic_sds_remote_device *sci_dev,
711 u16 *node_id);
712void scic_sds_controller_free_remote_node_context(
713 struct scic_sds_controller *scic,
714 struct scic_sds_remote_device *sci_dev,
715 u16 node_id);
716union scu_remote_node_context *scic_sds_controller_get_remote_node_context_buffer(
717 struct scic_sds_controller *scic,
718 u16 node_id);
719
720struct scic_sds_request *scic_request_by_tag(struct scic_sds_controller *scic,
721 u16 io_tag);
722
723struct scu_task_context *scic_sds_controller_get_task_context_buffer(
724 struct scic_sds_controller *scic,
725 u16 io_tag);
726
727void scic_sds_controller_power_control_queue_insert(
728 struct scic_sds_controller *scic,
729 struct scic_sds_phy *sci_phy);
730
731void scic_sds_controller_power_control_queue_remove(
732 struct scic_sds_controller *scic,
733 struct scic_sds_phy *sci_phy);
734
735void scic_sds_controller_link_up(
736 struct scic_sds_controller *scic,
737 struct scic_sds_port *sci_port,
738 struct scic_sds_phy *sci_phy);
739
740void scic_sds_controller_link_down(
741 struct scic_sds_controller *scic,
742 struct scic_sds_port *sci_port,
743 struct scic_sds_phy *sci_phy);
744
745void scic_sds_controller_remote_device_stopped(
746 struct scic_sds_controller *scic,
747 struct scic_sds_remote_device *sci_dev);
748
749void scic_sds_controller_copy_task_context(
750 struct scic_sds_controller *scic,
751 struct scic_sds_request *this_request);
752
753void scic_sds_controller_register_setup(struct scic_sds_controller *scic);
754
755enum sci_status scic_controller_continue_io(struct scic_sds_request *sci_req);
756int isci_host_scan_finished(struct Scsi_Host *, unsigned long);
757void isci_host_scan_start(struct Scsi_Host *);
6f231dda
DW
758
759int isci_host_init(struct isci_host *);
760
761void isci_host_init_controller_names(
762 struct isci_host *isci_host,
763 unsigned int controller_idx);
764
765void isci_host_deinit(
766 struct isci_host *);
767
768void isci_host_port_link_up(
769 struct isci_host *,
770 struct scic_sds_port *,
771 struct scic_sds_phy *);
772int isci_host_dev_found(struct domain_device *);
773
774void isci_host_remote_device_start_complete(
775 struct isci_host *,
776 struct isci_remote_device *,
777 enum sci_status);
778
cc9203bf
DW
779void scic_controller_disable_interrupts(
780 struct scic_sds_controller *scic);
781
782enum sci_status scic_controller_start_io(
783 struct scic_sds_controller *scic,
784 struct scic_sds_remote_device *remote_device,
785 struct scic_sds_request *io_request,
786 u16 io_tag);
787
788enum sci_task_status scic_controller_start_task(
789 struct scic_sds_controller *scic,
790 struct scic_sds_remote_device *remote_device,
791 struct scic_sds_request *task_request,
792 u16 io_tag);
793
794enum sci_status scic_controller_terminate_request(
795 struct scic_sds_controller *scic,
796 struct scic_sds_remote_device *remote_device,
797 struct scic_sds_request *request);
798
799enum sci_status scic_controller_complete_io(
800 struct scic_sds_controller *scic,
801 struct scic_sds_remote_device *remote_device,
802 struct scic_sds_request *io_request);
803
804u16 scic_controller_allocate_io_tag(
805 struct scic_sds_controller *scic);
806
807enum sci_status scic_controller_free_io_tag(
808 struct scic_sds_controller *scic,
809 u16 io_tag);
e2f8db50
DW
810
811void scic_sds_port_configuration_agent_construct(
812 struct scic_sds_port_configuration_agent *port_agent);
813
814enum sci_status scic_sds_port_configuration_agent_initialize(
815 struct scic_sds_controller *controller,
816 struct scic_sds_port_configuration_agent *port_agent);
cc9203bf 817#endif
This page took 0.087244 seconds and 5 git commands to generate.