fdcvar.h revision 256281
167754Smsmith/*- 267754Smsmith * Copyright (c) 2004-2005 M. Warner Losh. 367754Smsmith * All rights reserved. 467754Smsmith * 567754Smsmith * Redistribution and use in source and binary forms, with or without 667754Smsmith * modification, are permitted provided that the following conditions 767754Smsmith * are met: 867754Smsmith * 1. Redistributions of source code must retain the above copyright 967754Smsmith * notice, this list of conditions and the following disclaimer. 1067754Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1167754Smsmith * notice, this list of conditions and the following disclaimer in the 1267754Smsmith * documentation and/or other materials provided with the distribution. 1367754Smsmith * 1467754Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1567754Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1667754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1767754Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1867754Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1967754Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2067754Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2167754Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2267754Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2367754Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2467754Smsmith * SUCH DAMAGE. 2567754Smsmith * 2667754Smsmith * $FreeBSD: stable/10/sys/dev/fdc/fdcvar.h 140469 2005-01-19 07:46:38Z imp $ 2767754Smsmith */ 2867754Smsmith 2967754Smsmith/* XXX should audit this file to see if additional copyrights needed */ 3067754Smsmith 3167754Smsmithenum fdc_type { 3267754Smsmith FDC_NE765, FDC_ENHANCED, FDC_UNKNOWN = -1 3367754Smsmith}; 3467754Smsmith 3567754Smsmith/* 3667754Smsmith * Per controller structure (softc). 3767754Smsmith */ 3867754Smsmithstruct fdc_data { 3967754Smsmith int fdcu; /* our unit number */ 4067754Smsmith int dmachan; 4167754Smsmith int flags; 4267754Smsmith#define FDC_HASDMA 0x01 4367754Smsmith#define FDC_STAT_VALID 0x08 4467754Smsmith#define FDC_HAS_FIFO 0x10 4567754Smsmith#define FDC_NEEDS_RESET 0x20 4667754Smsmith#define FDC_NODMA 0x40 /* Don't do DMA */ 4767754Smsmith#define FDC_NOFAST 0x80 /* Don't register isr as a fast one */ 4867754Smsmith#define FDC_KTHREAD_EXIT 0x1000 /* request worker thread to stop */ 4967754Smsmith#define FDC_KTHREAD_ALIVE 0x2000 /* worker thread is alive */ 5067754Smsmith struct fd_data *fd; /* The active drive */ 5167754Smsmith int retry; 5267754Smsmith int fdout; /* mirror of the w/o digital output reg */ 5367754Smsmith u_int status[7]; /* copy of the registers */ 5467754Smsmith enum fdc_type fdct; /* chip version of FDC */ 5567754Smsmith int fdc_errs; /* number of logged errors */ 5667754Smsmith struct bio_queue_head head; 5767754Smsmith struct bio *bp; /* active buffer */ 5867754Smsmith struct resource *res_irq, *res_drq; 5967754Smsmith int rid_irq, rid_drq; 6067754Smsmith#define FDC_MAXREG 8 6167754Smsmith int ridio[FDC_MAXREG]; 6267754Smsmith struct resource *resio[FDC_MAXREG]; 6367754Smsmith bus_space_tag_t iot; 6467754Smsmith bus_space_handle_t ioh[FDC_MAXREG]; 6567754Smsmith int ioff[FDC_MAXREG]; 6667754Smsmith void *fdc_intr; 6767754Smsmith struct device *fdc_dev; 6867754Smsmith struct mtx fdc_mtx; 6967754Smsmith struct proc *fdc_thread; 7067754Smsmith}; 7167754Smsmith 7267754Smsmithextern devclass_t fdc_devclass; 7367754Smsmith 7467754Smsmithenum fdc_device_ivars { 7567754Smsmith FDC_IVAR_FDUNIT, 7667754Smsmith FDC_IVAR_FDTYPE, 7767754Smsmith}; 7867754Smsmith 7967754Smsmith__BUS_ACCESSOR(fdc, fdunit, FDC, FDUNIT, int); 8067754Smsmith__BUS_ACCESSOR(fdc, fdtype, FDC, FDTYPE, int); 8167754Smsmith 8267754Smsmithvoid fdc_release_resources(struct fdc_data *); 8367754Smsmithint fdc_attach(device_t); 8467754Smsmithint fdc_hints_probe(device_t); 8567754Smsmithint fdc_detach(device_t dev); 8667754Smsmithdevice_t fdc_add_child(device_t, const char *, int); 8767754Smsmithint fdc_initial_reset(device_t, struct fdc_data *); 8867754Smsmithint fdc_print_child(device_t, device_t); 8967754Smsmithint fdc_read_ivar(device_t, device_t, int, uintptr_t *); 9067754Smsmithint fdc_write_ivar(device_t, device_t, int, uintptr_t); 9167754Smsmithint fdc_isa_alloc_resources(device_t, struct fdc_data *); 9267754Smsmith