Deleted Added
full compact
fdc.c (64453) fdc.c (64880)
1/*
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Don Ahn.
7 *
8 * Libretto PCMCIA floppy support by David Horwitt (dhorwitt@ucsd.edu)

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

42 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
43 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
45 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
46 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * SUCH DAMAGE.
48 *
49 * from: @(#)fd.c 7.4 (Berkeley) 5/25/91
1/*
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Don Ahn.
7 *
8 * Libretto PCMCIA floppy support by David Horwitt (dhorwitt@ucsd.edu)

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

42 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
43 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
45 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
46 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * SUCH DAMAGE.
48 *
49 * from: @(#)fd.c 7.4 (Berkeley) 5/25/91
50 * $FreeBSD: head/sys/dev/fdc/fdc.c 64453 2000-08-09 12:45:04Z n_hibma $
50 * $FreeBSD: head/sys/dev/fdc/fdc.c 64880 2000-08-20 21:34:39Z phk $
51 *
52 */
53
54#include "opt_fdc.h"
51 *
52 */
53
54#include "opt_fdc.h"
55#include "opt_devfs.h"
55#include "card.h"
56
57#include <sys/param.h>
58#include <sys/systm.h>
59#include <sys/kernel.h>
60#include <sys/bio.h>
61#include <sys/bus.h>
62#include <sys/conf.h>

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

78#include <machine/stdarg.h>
79
80#include <isa/isavar.h>
81#include <isa/isareg.h>
82#include <isa/fdreg.h>
83#include <isa/fdc.h>
84#include <isa/rtc.h>
85
56#include "card.h"
57
58#include <sys/param.h>
59#include <sys/systm.h>
60#include <sys/kernel.h>
61#include <sys/bio.h>
62#include <sys/bus.h>
63#include <sys/conf.h>

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

79#include <machine/stdarg.h>
80
81#include <isa/isavar.h>
82#include <isa/isareg.h>
83#include <isa/fdreg.h>
84#include <isa/fdc.h>
85#include <isa/rtc.h>
86
87#ifdef DEVFS
88#include <sys/ctype.h>
89#include <sys/eventhandler.h>
90#include <fs/devfs/devfs.h>
91#endif
92
86/* misuse a flag to identify format operation */
87
88/* configuration flags */
89#define FDC_PRETEND_D0 (1 << 0) /* pretend drive 0 to be there */
90#define FDC_NO_FIFO (1 << 2) /* do not enable FIFO */
91
92/* internally used only, not really from CMOS: */
93#define RTCFDT_144M_PRETENDED 0x1000

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

940 fdc_pccard_methods,
941 sizeof(struct fdc_data)
942};
943
944DRIVER_MODULE(fdc, pccard, fdc_pccard_driver, fdc_devclass, 0, 0);
945
946#endif /* NCARD > 0 */
947
93/* misuse a flag to identify format operation */
94
95/* configuration flags */
96#define FDC_PRETEND_D0 (1 << 0) /* pretend drive 0 to be there */
97#define FDC_NO_FIFO (1 << 2) /* do not enable FIFO */
98
99/* internally used only, not really from CMOS: */
100#define RTCFDT_144M_PRETENDED 0x1000

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

947 fdc_pccard_methods,
948 sizeof(struct fdc_data)
949};
950
951DRIVER_MODULE(fdc, pccard, fdc_pccard_driver, fdc_devclass, 0, 0);
952
953#endif /* NCARD > 0 */
954
955#ifdef DEVFS
956static void fd_clone __P((void *arg, char *name, int namelen, dev_t *dev));
957
958static struct {
959 char *match;
960 int minor;
961 int link;
962} fd_suffix[] = {
963 { "a", 0, 1 },
964 { "b", 0, 1 },
965 { "c", 0, 1 },
966 { "d", 0, 1 },
967 { "e", 0, 1 },
968 { "f", 0, 1 },
969 { "g", 0, 1 },
970 { "h", 0, 1 },
971 { ".1720", 1, 0 },
972 { ".1480", 2, 0 },
973 { ".1440", 3, 0 },
974 { ".1200", 4, 0 },
975 { ".820", 5, 0 },
976 { ".800", 6, 0 },
977 { ".720", 7, 0 },
978 { ".360", 8, 0 },
979 { ".640", 9, 0 },
980 { ".1232", 10, 0 },
981 { 0, 0 }
982};
983static void
984fd_clone(arg, name, namelen, dev)
985 void *arg;
986 char *name;
987 int namelen;
988 dev_t *dev;
989{
990 int u, d, i;
991 char *n;
992 dev_t pdev;
993
994 if (*dev != NODEV)
995 return;
996 if (devfs_stdclone(name, &n, "fd", &u) != 2)
997 return;
998 for (i = 0; ; i++) {
999 if (fd_suffix[i].match == NULL)
1000 return;
1001 if (strcmp(n, fd_suffix[i].match))
1002 continue;
1003 d = fd_suffix[i].minor;
1004 break;
1005 }
1006 if (fd_suffix[i].link == 0) {
1007 *dev = make_dev(&fd_cdevsw, (u << 6) + d,
1008 UID_ROOT, GID_OPERATOR, 0640, name);
1009 } else {
1010 pdev = makedev(fd_cdevsw.d_maj, (u << 6) + d);
1011 *dev = make_dev_alias(pdev, name);
1012 }
1013}
1014#endif
1015
948/******************************************************************/
949/*
950 * devices attached to the controller section.
951 */
952static int
953fd_probe(device_t dev)
954{
955 int i;

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

1090 }
1091 return (0);
1092}
1093
1094static int
1095fd_attach(device_t dev)
1096{
1097 struct fd_data *fd;
1016/******************************************************************/
1017/*
1018 * devices attached to the controller section.
1019 */
1020static int
1021fd_probe(device_t dev)
1022{
1023 int i;

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

1158 }
1159 return (0);
1160}
1161
1162static int
1163fd_attach(device_t dev)
1164{
1165 struct fd_data *fd;
1098#if 0
1099 int i;
1100 int mynor;
1101 int typemynor;
1102 int typesize;
1103#endif
1104 static int cdevsw_add_done = 0;
1105
1106 fd = device_get_softc(dev);
1107
1166
1167 fd = device_get_softc(dev);
1168
1169#ifndef DEVFS
1170 {
1171 static int cdevsw_add_done = 0;
1108 if (!cdevsw_add_done) {
1109 cdevsw_add(&fd_cdevsw); /* XXX */
1110 cdevsw_add_done++;
1111 }
1172 if (!cdevsw_add_done) {
1173 cdevsw_add(&fd_cdevsw); /* XXX */
1174 cdevsw_add_done++;
1175 }
1176 }
1177#else
1178 EVENTHANDLER_REGISTER(devfs_clone, fd_clone, 0, 1000);
1179#endif
1112 make_dev(&fd_cdevsw, (fd->fdu << 6),
1180 make_dev(&fd_cdevsw, (fd->fdu << 6),
1113 UID_ROOT, GID_OPERATOR, 0640, "rfd%d", fd->fdu);
1181 UID_ROOT, GID_OPERATOR, 0640, "fd%d", fd->fdu);
1114
1182
1115#if 0
1116 /* Other make_dev() go here. */
1117#endif
1118
1119 /*
1120 * Export the drive to the devstat interface.
1121 */
1122 devstat_add_entry(&fd->device_stats, device_get_name(dev),
1123 device_get_unit(dev), 512, DEVSTAT_NO_ORDERED_TAGS,
1124 DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER,
1125 DEVSTAT_PRIORITY_FD);
1126 return (0);

--- 1274 unchanged lines hidden ---
1183 /*
1184 * Export the drive to the devstat interface.
1185 */
1186 devstat_add_entry(&fd->device_stats, device_get_name(dev),
1187 device_get_unit(dev), 512, DEVSTAT_NO_ORDERED_TAGS,
1188 DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER,
1189 DEVSTAT_PRIORITY_FD);
1190 return (0);

--- 1274 unchanged lines hidden ---