summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/include
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-09-19 01:28:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-09-19 01:28:05 +0000
commit46911b0071ccd5e207be26083b1d9b72aa6625f5 (patch)
treef2c4eca541bfba15862b333fb96748cebd739264 /sys/arch/amd64/include
parentb579d725ddc6e1ea153c58b780804b32d0ad0d2a (diff)
floppy support; form@openbsd.ru
Diffstat (limited to 'sys/arch/amd64/include')
-rw-r--r--sys/arch/amd64/include/ioctl_fd.h130
-rw-r--r--sys/arch/amd64/include/isa_machdep.h74
2 files changed, 156 insertions, 48 deletions
diff --git a/sys/arch/amd64/include/ioctl_fd.h b/sys/arch/amd64/include/ioctl_fd.h
new file mode 100644
index 00000000000..51f95755e5d
--- /dev/null
+++ b/sys/arch/amd64/include/ioctl_fd.h
@@ -0,0 +1,130 @@
+/* $OpenBSD: ioctl_fd.h,v 1.1 2005/09/19 01:28:04 deraadt Exp $ */
+
+/*
+ * Copyright (C) 1992-1994 by Joerg Wunsch, Dresden
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * From: Id: ioctl_fd.h,v 1.7 1994/10/30 19:17:39 joerg Exp
+ */
+
+#ifndef _AMD64_IOCTL_FD_H_
+#define _AMD64_IOCTL_FD_H_
+
+#include <sys/ioccom.h>
+
+#define FD_FORMAT_VERSION 110 /* used to validate before formatting */
+#define FD_MAX_NSEC 36 /* highest known number of spt - allow for */
+ /* 2.88 MB drives */
+
+struct fd_formb {
+ int format_version; /* == FD_FORMAT_VERSION */
+ int cyl, head;
+ int transfer_rate; /* fdreg.h: FDC_???KBPS */
+
+ union {
+ struct fd_form_data {
+ /*
+ * DO NOT CHANGE THE LAYOUT OF THIS STRUCTS
+ * it is hardware-dependant since it exactly
+ * matches the byte sequence to write to FDC
+ * during its `format track' operation
+ */
+ u_char secshift; /* 0 -> 128, ...; usually 2 -> 512 */
+ u_char nsecs; /* must be <= FD_MAX_NSEC */
+ u_char gaplen; /* GAP 3 length; usually 84 */
+ u_char fillbyte; /* usually 0xf6 */
+ struct fd_idfield_data {
+ /*
+ * data to write into id fields;
+ * for obscure formats, they mustn't match
+ * the real values (but mostly do)
+ */
+ u_char cylno; /* 0 thru 79 (or 39) */
+ u_char headno; /* 0, or 1 */
+ u_char secno; /* starting at 1! */
+ u_char secsize; /* usually 2 */
+ } idfields[FD_MAX_NSEC]; /* 0 <= idx < nsecs used */
+ } structured;
+ u_char raw[1]; /* to have continuous indexed access */
+ } format_info;
+};
+
+/* make life easier */
+# define fd_formb_secshift format_info.structured.secshift
+# define fd_formb_nsecs format_info.structured.nsecs
+# define fd_formb_gaplen format_info.structured.gaplen
+# define fd_formb_fillbyte format_info.structured.fillbyte
+/* these data must be filled in for(i = 0; i < fd_formb_nsecs; i++) */
+# define fd_formb_cylno(i) format_info.structured.idfields[i].cylno
+# define fd_formb_headno(i) format_info.structured.idfields[i].headno
+# define fd_formb_secno(i) format_info.structured.idfields[i].secno
+# define fd_formb_secsize(i) format_info.structured.idfields[i].secsize
+
+/*
+ * Floppies come in various flavors, e.g., 1.2MB vs 1.44MB; here is how
+ * we tell them apart.
+ */
+struct fd_type {
+ int sectrac; /* sectors per track */
+ int heads; /* number of heads */
+ int seccyl; /* sectors per cylinder */
+ int secsize; /* size code for sectors */
+ int datalen; /* data len when secsize = 0 */
+ int steprate; /* step rate and head unload time */
+ int gap1; /* gap len between sectors */
+ int gap2; /* formatting gap */
+ int tracks; /* total num of tracks */
+ int size; /* size of disk in sectors */
+ int step; /* steps per cylinder */
+ int rate; /* transfer speed code */
+ char *name;
+};
+
+
+#define FD_FORM _IOW('F', 61, struct fd_formb) /* format a track */
+#define FD_GTYPE _IOR('F', 62, struct fd_type) /* get drive type */
+#define FD_STYPE _IOW('F', 63, struct fd_type) /* set drive type */
+
+#define FD_GOPTS _IOR('F', 64, int) /* drive options, see below */
+#define FD_SOPTS _IOW('F', 65, int)
+
+#define FDOPT_NORETRY 0x0001 /* no retries on failure (cleared on close) */
+
+/*
+ * The following definitions duplicate those in sys/i386/isa/fdreg.h
+ * They are here since their values are to be used in the above
+ * structure when formatting a floppy. For very obvious reasons, both
+ * definitions must match ;-)
+ */
+#ifndef FDC_500KBPS
+#define FDC_500KBPS 0x00 /* 500KBPS MFM drive transfer rate */
+#define FDC_300KBPS 0x01 /* 300KBPS MFM drive transfer rate */
+#define FDC_250KBPS 0x02 /* 250KBPS MFM drive transfer rate */
+#define FDC_125KBPS 0x03 /* 125KBPS FM drive transfer rate */
+ /* for some controllers 1MPBS instead */
+#endif /* FDC_500KBPS */
+
+
+#endif /* !_AMD64_IOCTL_FD_H__ */
diff --git a/sys/arch/amd64/include/isa_machdep.h b/sys/arch/amd64/include/isa_machdep.h
index 306eed9ef8e..01b139bd707 100644
--- a/sys/arch/amd64/include/isa_machdep.h
+++ b/sys/arch/amd64/include/isa_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa_machdep.h,v 1.1 2004/01/28 01:39:39 mickey Exp $ */
+/* $OpenBSD: isa_machdep.h,v 1.2 2005/09/19 01:28:04 deraadt Exp $ */
/* $NetBSD: isa_machdep.h,v 1.2 2003/05/09 23:51:28 fvdl Exp $ */
/*-
@@ -118,53 +118,6 @@ int isa_mem_alloc(bus_space_tag_t, bus_size_t, bus_size_t,
bus_addr_t, int, bus_addr_t *, bus_space_handle_t *);
void isa_mem_free(bus_space_tag_t, bus_space_handle_t, bus_size_t);
-#define isa_dmainit(ic, bst, dmat, d) \
- _isa_dmainit(&(ic)->ic_dmastate, (bst), (dmat), (d))
-#define isa_dmacascade(ic, c) \
- _isa_dmacascade(&(ic)->ic_dmastate, (c))
-#define isa_dmamaxsize(ic, c) \
- _isa_dmamaxsize(&(ic)->ic_dmastate, (c))
-#define isa_dmamap_create(ic, c, s, f) \
- _isa_dmamap_create(&(ic)->ic_dmastate, (c), (s), (f))
-#define isa_dmamap_destroy(ic, c) \
- _isa_dmamap_destroy(&(ic)->ic_dmastate, (c))
-#define isa_dmastart(ic, c, a, n, p, f, bf) \
- _isa_dmastart(&(ic)->ic_dmastate, (c), (a), (n), (p), (f), (bf))
-#define isa_dmaabort(ic, c) \
- _isa_dmaabort(&(ic)->ic_dmastate, (c))
-#define isa_dmacount(ic, c) \
- _isa_dmacount(&(ic)->ic_dmastate, (c))
-#define isa_dmafinished(ic, c) \
- _isa_dmafinished(&(ic)->ic_dmastate, (c))
-#define isa_dmadone(ic, c) \
- _isa_dmadone(&(ic)->ic_dmastate, (c))
-#define isa_dmafreeze(ic) \
- _isa_dmafreeze(&(ic)->ic_dmastate)
-#define isa_dmathaw(ic) \
- _isa_dmathaw(&(ic)->ic_dmastate)
-#define isa_dmamem_alloc(ic, c, s, ap, f) \
- _isa_dmamem_alloc(&(ic)->ic_dmastate, (c), (s), (ap), (f))
-#define isa_dmamem_free(ic, c, a, s) \
- _isa_dmamem_free(&(ic)->ic_dmastate, (c), (a), (s))
-#define isa_dmamem_map(ic, c, a, s, kp, f) \
- _isa_dmamem_map(&(ic)->ic_dmastate, (c), (a), (s), (kp), (f))
-#define isa_dmamem_unmap(ic, c, k, s) \
- _isa_dmamem_unmap(&(ic)->ic_dmastate, (c), (k), (s))
-#define isa_dmamem_mmap(ic, c, a, s, o, p, f) \
- _isa_dmamem_mmap(&(ic)->ic_dmastate, (c), (a), (s), (o), (p), (f))
-#define isa_drq_alloc(ic, c) \
- _isa_drq_alloc(&(ic)->ic_dmastate, c)
-#define isa_drq_free(ic, c) \
- _isa_drq_free(&(ic)->ic_dmastate, c)
-#define isa_drq_isfree(ic, c) \
- _isa_drq_isfree(&(ic)->ic_dmastate, (c))
-#define isa_malloc(ic, c, s, p, f) \
- _isa_malloc(&(ic)->ic_dmastate, (c), (s), (p), (f))
-#define isa_free(a, p) \
- _isa_free((a), (p))
-#define isa_mappage(m, o, p) \
- _isa_mappage((m), (o), (p))
-
int isa_intr_check(isa_chipset_tag_t, int, int);
/*
@@ -181,6 +134,31 @@ void isa_reinit_irq(void);
extern struct x86_bus_dma_tag isa_bus_dma_tag;
/*
+ * Cookie used by ISA dma. A pointer to one of these it stashed in
+ * the DMA map.
+ */
+struct x86_isa_dma_cookie {
+ int id_flags; /* flags; see below */
+
+ void *id_origbuf; /* pointer to orig buffer if
+ bouncing */
+ bus_size_t id_origbuflen; /* ...and size */
+
+ void *id_bouncebuf; /* pointer to the bounce buffer */
+ bus_size_t id_bouncebuflen; /* ...and size */
+ int id_nbouncesegs; /* number of valid bounce segs */
+ bus_dma_segment_t id_bouncesegs[0]; /* array of bounce buffer
+ physical memory segments */
+};
+
+/* id_flags */
+#define ID_MIGHT_NEED_BOUNCE 0x01 /* map could need bounce buffers */
+#define ID_HAS_BOUNCE 0x02 /* map currently has bounce buffers */
+#define ID_IS_BOUNCING 0x04 /* map is bouncing current xfer */
+
+
+
+/*
* XXX Various seemingly PC-specific constants, some of which may be
* unnecessary anyway.
*/