fdcvar.h revision 135392
1239310Sdim/*- 2239310Sdim * Copyright (c) 2004 M. Warner Losh. 3239310Sdim * All rights reserved. 4239310Sdim * 5239310Sdim * Redistribution and use in source and binary forms, with or without 6239310Sdim * modification, are permitted provided that the following conditions 7239310Sdim * are met: 8239310Sdim * 1. Redistributions of source code must retain the above copyright 9239310Sdim * notice, this list of conditions, and the following disclaimer, 10239310Sdim * without modification, immediately at the beginning of the file. 11239310Sdim * 2. Redistributions in binary form must reproduce the above copyright 12239310Sdim * notice, this list of conditions and the following disclaimer in 13239310Sdim * the documentation and/or other materials provided with the 14239310Sdim * distribution. 15239310Sdim * 16239310Sdim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17239310Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18239310Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19239310Sdim * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 20249423Sdim * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21249423Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22239310Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23261991Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24239310Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25239310Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26239310Sdim * SUCH DAMAGE. 27239310Sdim * 28239310Sdim * $FreeBSD: head/sys/dev/fdc/fdcvar.h 135392 2004-09-17 18:50:38Z imp $ 29249423Sdim */ 30239310Sdim 31239310Sdim/* XXX should audit this file to see if additional copyrights needed */ 32239310Sdim 33239310Sdimenum fdc_type { 34239310Sdim FDC_NE765, FDC_ENHANCED, FDC_UNKNOWN = -1 35239310Sdim}; 36239310Sdim 37239310Sdim/* 38239310Sdim * Per controller structure (softc). 39239310Sdim */ 40261991Sdimstruct fdc_data { 41261991Sdim int fdcu; /* our unit number */ 42261991Sdim int dmachan; 43261991Sdim int flags; 44261991Sdim#define FDC_HASDMA 0x01 45261991Sdim#define FDC_STAT_VALID 0x08 46261991Sdim#define FDC_HAS_FIFO 0x10 47261991Sdim#define FDC_NEEDS_RESET 0x20 48261991Sdim#define FDC_NODMA 0x40 49261991Sdim struct fd_data *fd; /* The active drive */ 50261991Sdim int retry; 51249423Sdim int fdout; /* mirror of the w/o digital output reg */ 52261991Sdim u_int status[7]; /* copy of the registers */ 53261991Sdim enum fdc_type fdct; /* chip version of FDC */ 54261991Sdim int fdc_errs; /* number of logged errors */ 55261991Sdim struct bio_queue_head head; 56261991Sdim struct bio *bp; /* active buffer */ 57261991Sdim struct resource *res_ioport, *res_sts, *res_ctl, *res_irq, *res_drq; 58239310Sdim int rid_ioport, rid_sts, rid_ctl, rid_irq, rid_drq; 59239310Sdim bus_space_tag_t portt; 60239310Sdim bus_space_handle_t porth; 61239310Sdim bus_space_tag_t stst; 62239310Sdim bus_space_handle_t stsh; 63249423Sdim bus_space_tag_t ctlt; 64249423Sdim bus_space_handle_t ctlh; 65249423Sdim int port_off; 66249423Sdim int ctl_off; 67249423Sdim int sts_off; 68249423Sdim void *fdc_intr; 69249423Sdim struct device *fdc_dev; 70249423Sdim struct mtx fdc_mtx; 71249423Sdim struct proc *fdc_thread; 72249423Sdim}; 73239310Sdim 74extern devclass_t fdc_devclass; 75 76enum fdc_device_ivars { 77 FDC_IVAR_FDUNIT, 78 FDC_IVAR_FDTYPE, 79}; 80 81__BUS_ACCESSOR(fdc, fdunit, FDC, FDUNIT, int); 82__BUS_ACCESSOR(fdc, fdtype, FDC, FDTYPE, int); 83 84void fdc_release_resources(struct fdc_data *); 85int fdc_attach(device_t); 86int fdc_hints_probe(device_t); 87int fdc_detach(device_t dev); 88device_t fdc_add_child(device_t, const char *, int); 89int fdc_initial_reset(device_t, struct fdc_data *); 90int fdc_print_child(device_t, device_t); 91int fdc_read_ivar(device_t, device_t, int, uintptr_t *); 92int fdc_write_ivar(device_t, device_t, int, uintptr_t); 93int fdc_isa_alloc_resources(device_t, struct fdc_data *); 94