Add in the twa(4) driver. This adds in support for the 3Ware
[dragonfly.git] / sys / dev / raid / twa / twa_externs.h
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  * $DragonFly: src/sys/dev/raid/twa/twa_externs.h,v 1.1 2004/04/16 20:13:16 drhodus Exp $
28  */
29
30 /*
31  * 3ware driver for 9000 series storage controllers.
32  *
33  * Author: Vinod Kashyap
34  */
35
36
37 /* Global data structures */
38 extern char                     twa_fw_img[];
39 extern int                      twa_fw_img_size;
40 extern struct twa_message       twa_aen_table[];
41 extern char                     *twa_aen_severity_table[];
42 extern struct twa_message       twa_error_table[];
43
44
45 /* Functions in twa.c */
46 extern int      twa_setup(struct twa_softc *sc);                /* do early driver/controller setup */
47 extern int      twa_deinit_ctlr(struct twa_softc *sc);          /* stop controller */
48 extern void     twa_interrupt(struct twa_softc *sc);            /* ISR */
49 extern int      twa_ioctl(struct twa_softc *sc, int cmd, void *addr);/* handle user request */
50 extern void     twa_enable_interrupts(struct twa_softc *sc);    /* enable controller interrupts */
51 extern void     twa_disable_interrupts(struct twa_softc *sc);   /* disable controller interrupts */
52 extern void     twa_complete_io(struct twa_request *tr);        /* I/O completion callback */
53 extern int      twa_reset(struct twa_softc *sc);                /* (soft) reset controller */
54 extern int      twa_submit_io(struct twa_request *tr);          /* wrapper to twa_start */
55 extern int      twa_start(struct twa_request *tr);              /* submit command to controller */
56 extern char     *twa_find_msg_string(struct twa_message *table, u_int16_t code);/* lookup a msg */
57 extern struct twa_request *twa_get_request(struct twa_softc *sc);/* get a req pkt from free pool */
58 extern void     twa_release_request(struct twa_request *tr);    /* put a req pkt back into free pool */
59 extern void     twa_describe_controller(struct twa_softc *sc);  /* describe controller info */
60 extern void     twa_print_controller(struct twa_softc *sc);     /* print controller state */
61
62 /* Functions in twa_freebsd.c */
63 extern void     twa_write_pci_config(struct twa_softc *sc, u_int32_t value, int size);/* write to pci config space */
64 extern int      twa_alloc_req_pkts(struct twa_softc *sc, int num_reqs); /* alloc req & cmd pkts */
65 extern int      twa_map_request(struct twa_request *tr);        /* copy cmd pkt & data to DMA'able memory */
66 extern void     twa_unmap_request(struct twa_request *tr);      /* undo mapping */
67
68 /* Functions in twa_cam.c */
69 extern void     twa_request_bus_scan(struct twa_softc *sc);     /* request CAM for a bus scan */
70 extern int      twa_send_scsi_cmd(struct twa_request *tr, int cmd);/* send down a SCSI cmd */
71 extern void     twa_scsi_complete(struct twa_request *tr);      /* complete a SCSI cmd by calling CAM */
72 extern void     twa_drain_busy_queue(struct twa_softc *sc);     /* drain busy queue (during reset) */
73
74 extern int      twa_cam_setup(struct twa_softc *sc);            /* attach to CAM */
75 extern void     twa_cam_detach(struct twa_softc *sc);           /* detach from CAM */
76 extern void     twa_allow_new_requests(struct twa_softc *sc, void *ccb);/* unfreeze ccb flow from CAM */
77 extern void     twa_disallow_new_requests(struct twa_softc *sc);/* freeze ccb flow from CAM */
78