Deleted Added
full compact
aac.c (212661) aac.c (212756)
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2001 Scott Long
4 * Copyright (c) 2000 BSDi
5 * Copyright (c) 2001 Adaptec, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2001 Scott Long
4 * Copyright (c) 2000 BSDi
5 * Copyright (c) 2001 Adaptec, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/aac/aac.c 212661 2010-09-15 14:24:21Z attilio $");
31__FBSDID("$FreeBSD: head/sys/dev/aac/aac.c 212756 2010-09-16 17:49:10Z attilio $");
32
33/*
34 * Driver for the Adaptec 'FSA' family of PCI/SCSI RAID adapters.
35 */
36#define AAC_DRIVERNAME "aac"
37
38#include "opt_aac.h"
39

--- 144 unchanged lines hidden (view full) ---

184
185/* Debugging and Diagnostics */
186static void aac_describe_controller(struct aac_softc *sc);
187static char *aac_describe_code(struct aac_code_lookup *table,
188 u_int32_t code);
189
190/* Management Interface */
191static d_open_t aac_open;
32
33/*
34 * Driver for the Adaptec 'FSA' family of PCI/SCSI RAID adapters.
35 */
36#define AAC_DRIVERNAME "aac"
37
38#include "opt_aac.h"
39

--- 144 unchanged lines hidden (view full) ---

184
185/* Debugging and Diagnostics */
186static void aac_describe_controller(struct aac_softc *sc);
187static char *aac_describe_code(struct aac_code_lookup *table,
188 u_int32_t code);
189
190/* Management Interface */
191static d_open_t aac_open;
192static d_close_t aac_close;
193static d_ioctl_t aac_ioctl;
194static d_poll_t aac_poll;
192static d_ioctl_t aac_ioctl;
193static d_poll_t aac_poll;
194static void aac_cdevpriv_dtor(void *arg);
195static int aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib);
196static int aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t arg);
197static void aac_handle_aif(struct aac_softc *sc,
198 struct aac_fib *fib);
199static int aac_rev_check(struct aac_softc *sc, caddr_t udata);
200static int aac_open_aif(struct aac_softc *sc, caddr_t arg);
201static int aac_close_aif(struct aac_softc *sc, caddr_t arg);
202static int aac_getnext_aif(struct aac_softc *sc, caddr_t arg);

--- 4 unchanged lines hidden (view full) ---

207static int aac_supported_features(struct aac_softc *sc, caddr_t uptr);
208static void aac_ioctl_event(struct aac_softc *sc,
209 struct aac_event *event, void *arg);
210static struct aac_mntinforesp *
211 aac_get_container_info(struct aac_softc *sc, struct aac_fib *fib, int cid);
212
213static struct cdevsw aac_cdevsw = {
214 .d_version = D_VERSION,
195static int aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib);
196static int aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t arg);
197static void aac_handle_aif(struct aac_softc *sc,
198 struct aac_fib *fib);
199static int aac_rev_check(struct aac_softc *sc, caddr_t udata);
200static int aac_open_aif(struct aac_softc *sc, caddr_t arg);
201static int aac_close_aif(struct aac_softc *sc, caddr_t arg);
202static int aac_getnext_aif(struct aac_softc *sc, caddr_t arg);

--- 4 unchanged lines hidden (view full) ---

207static int aac_supported_features(struct aac_softc *sc, caddr_t uptr);
208static void aac_ioctl_event(struct aac_softc *sc,
209 struct aac_event *event, void *arg);
210static struct aac_mntinforesp *
211 aac_get_container_info(struct aac_softc *sc, struct aac_fib *fib, int cid);
212
213static struct cdevsw aac_cdevsw = {
214 .d_version = D_VERSION,
215 .d_flags = D_NEEDGIANT | D_TRACKCLOSE,
215 .d_flags = D_NEEDGIANT,
216 .d_open = aac_open,
216 .d_open = aac_open,
217 .d_close = aac_close,
218 .d_ioctl = aac_ioctl,
219 .d_poll = aac_poll,
220 .d_name = "aac",
221};
222
223MALLOC_DEFINE(M_AACBUF, "aacbuf", "Buffers for the AAC driver");
224
225/* sysctl node */

--- 2571 unchanged lines hidden (view full) ---

2797static int
2798aac_open(struct cdev *dev, int flags, int fmt, struct thread *td)
2799{
2800 struct aac_softc *sc;
2801
2802 sc = dev->si_drv1;
2803 fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
2804 device_busy(sc->aac_dev);
217 .d_ioctl = aac_ioctl,
218 .d_poll = aac_poll,
219 .d_name = "aac",
220};
221
222MALLOC_DEFINE(M_AACBUF, "aacbuf", "Buffers for the AAC driver");
223
224/* sysctl node */

--- 2571 unchanged lines hidden (view full) ---

2796static int
2797aac_open(struct cdev *dev, int flags, int fmt, struct thread *td)
2798{
2799 struct aac_softc *sc;
2800
2801 sc = dev->si_drv1;
2802 fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
2803 device_busy(sc->aac_dev);
2804 devfs_set_cdevpriv(sc, aac_cdevpriv_dtor);
2805
2806 return 0;
2807}
2808
2809static int
2805
2806 return 0;
2807}
2808
2809static int
2810aac_close(struct cdev *dev, int flags, int fmt, struct thread *td)
2811{
2812 struct aac_softc *sc;
2813
2814 sc = dev->si_drv1;
2815 fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
2816 device_unbusy(sc->aac_dev);
2817
2818 return 0;
2819}
2820
2821static int
2822aac_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
2823{
2824 union aac_statrequest *as;
2825 struct aac_softc *sc;
2826 int error = 0;
2827
2828 as = (union aac_statrequest *)arg;
2829 sc = dev->si_drv1;

--- 366 unchanged lines hidden (view full) ---

3196 mtx_lock(&sc->aac_io_lock);
3197 aac_release_command(cm);
3198 mtx_unlock(&sc->aac_io_lock);
3199 }
3200 return(error);
3201}
3202
3203/*
2810aac_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
2811{
2812 union aac_statrequest *as;
2813 struct aac_softc *sc;
2814 int error = 0;
2815
2816 as = (union aac_statrequest *)arg;
2817 sc = dev->si_drv1;

--- 366 unchanged lines hidden (view full) ---

3184 mtx_lock(&sc->aac_io_lock);
3185 aac_release_command(cm);
3186 mtx_unlock(&sc->aac_io_lock);
3187 }
3188 return(error);
3189}
3190
3191/*
3192 * cdevpriv interface private destructor.
3193 */
3194static void
3195aac_cdevpriv_dtor(void *arg)
3196{
3197 struct aac_softc *sc;
3198
3199 sc = arg;
3200 fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
3201 mtx_lock(&Giant);
3202 device_unbusy(sc->aac_dev);
3203 mtx_unlock(&Giant);
3204}
3205
3206/*
3204 * Handle an AIF sent to us by the controller; queue it for later reference.
3205 * If the queue fills up, then drop the older entries.
3206 */
3207static void
3208aac_handle_aif(struct aac_softc *sc, struct aac_fib *fib)
3209{
3210 struct aac_aif_command *aif;
3211 struct aac_container *co, *co_next;

--- 562 unchanged lines hidden ---
3207 * Handle an AIF sent to us by the controller; queue it for later reference.
3208 * If the queue fills up, then drop the older entries.
3209 */
3210static void
3211aac_handle_aif(struct aac_softc *sc, struct aac_fib *fib)
3212{
3213 struct aac_aif_command *aif;
3214 struct aac_container *co, *co_next;

--- 562 unchanged lines hidden ---