1 /*-
2 * Copyright (c) 2003-04 3ware, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 */
28
29 /*
30 * 3ware driver for 9000 series storage controllers.
31 *
32 * Author: Vinod Kashyap
33 */
34
35
36 /* Global data structures */
37 extern char twa_fw_img[];
38 extern int twa_fw_img_size;
39 extern struct twa_message twa_aen_table[];
40 extern char *twa_aen_severity_table[];
41 extern struct twa_message twa_error_table[];
42
43
44 /* Functions in twa.c */
45 extern int twa_setup(struct twa_softc *sc); /* do early driver/controller setup */
46 extern int twa_deinit_ctlr(struct twa_softc *sc); /* stop controller */
47 extern void twa_interrupt(struct twa_softc *sc); /* ISR */
48 extern int twa_ioctl(struct twa_softc *sc, int cmd, void *addr);/* handle user request */
49 extern void twa_enable_interrupts(struct twa_softc *sc); /* enable controller interrupts */
50 extern void twa_disable_interrupts(struct twa_softc *sc); /* disable controller interrupts */
51 extern void twa_complete_io(struct twa_request *tr); /* I/O completion callback */
52 extern int twa_reset(struct twa_softc *sc); /* (soft) reset controller */
53 extern int twa_submit_io(struct twa_request *tr); /* wrapper to twa_start */
54 extern int twa_start(struct twa_request *tr); /* submit command to controller */
55 extern char *twa_find_msg_string(struct twa_message *table, u_int16_t code);/* lookup a msg */
56 extern struct twa_request *twa_get_request(struct twa_softc *sc);/* get a req pkt from free pool */
57 extern void twa_release_request(struct twa_request *tr); /* put a req pkt back into free pool */
58 extern void twa_describe_controller(struct twa_softc *sc); /* describe controller info */
59 extern void twa_print_controller(struct twa_softc *sc); /* print controller state */
60
61 /* Functions in twa_freebsd.c */
62 extern void twa_write_pci_config(struct twa_softc *sc, u_int32_t value, int size);/* write to pci config space */
63 extern int twa_alloc_req_pkts(struct twa_softc *sc, int num_reqs); /* alloc req & cmd pkts */
64 extern int twa_map_request(struct twa_request *tr); /* copy cmd pkt & data to DMA'able memory */
65 extern void twa_unmap_request(struct twa_request *tr); /* undo mapping */
66
67 /* Functions in twa_cam.c */
68 extern void twa_request_bus_scan(struct twa_softc *sc); /* request CAM for a bus scan */
69 extern int twa_send_scsi_cmd(struct twa_request *tr, int cmd);/* send down a SCSI cmd */
70 extern void twa_scsi_complete(struct twa_request *tr); /* complete a SCSI cmd by calling CAM */
71 extern void twa_drain_busy_queue(struct twa_softc *sc); /* drain busy queue (during reset) */
72
73 extern int twa_cam_setup(struct twa_softc *sc); /* attach to CAM */
74 extern void twa_cam_detach(struct twa_softc *sc); /* detach from CAM */
75 extern void twa_allow_new_requests(struct twa_softc *sc, void *ccb);/* unfreeze ccb flow from CAM */
76 extern void twa_disallow_new_requests(struct twa_softc *sc);/* freeze ccb flow from CAM */
77 extern void twa_set_timer(struct twa_request *tr); /* Set a timer to time a given request */
78 extern void twa_unset_timer(struct twa_request *tr);/* Unset a previously set timer */
79
Cache object: f35760f14c810d4cd9a1b0d532d67ac1
|