fdc.c (64880) | fdc.c (65374) |
---|---|
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 64880 2000-08-20 21:34:39Z phk $ | 50 * $FreeBSD: head/sys/dev/fdc/fdc.c 65374 2000-09-02 19:17:34Z phk $ |
51 * 52 */ 53 54#include "opt_fdc.h" | 51 * 52 */ 53 54#include "opt_fdc.h" |
55#include "opt_devfs.h" | |
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 | 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 |
87#ifdef DEVFS 88#include <sys/ctype.h> 89#include <sys/eventhandler.h> 90#include <fs/devfs/devfs.h> 91#endif 92 | |
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 | 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 |
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 }, --- 24 unchanged lines hidden (view full) --- 988 dev_t *dev; 989{ 990 int u, d, i; 991 char *n; 992 dev_t pdev; 993 994 if (*dev != NODEV) 995 return; | 948static void fd_clone __P((void *arg, char *name, int namelen, dev_t *dev)); 949 950static struct { 951 char *match; 952 int minor; 953 int link; 954} fd_suffix[] = { 955 { "a", 0, 1 }, --- 24 unchanged lines hidden (view full) --- 980 dev_t *dev; 981{ 982 int u, d, i; 983 char *n; 984 dev_t pdev; 985 986 if (*dev != NODEV) 987 return; |
996 if (devfs_stdclone(name, &n, "fd", &u) != 2) | 988 if (dev_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} | 989 return; 990 for (i = 0; ; i++) { 991 if (fd_suffix[i].match == NULL) 992 return; 993 if (strcmp(n, fd_suffix[i].match)) 994 continue; 995 d = fd_suffix[i].minor; 996 break; 997 } 998 if (fd_suffix[i].link == 0) { 999 *dev = make_dev(&fd_cdevsw, (u << 6) + d, 1000 UID_ROOT, GID_OPERATOR, 0640, name); 1001 } else { 1002 pdev = makedev(fd_cdevsw.d_maj, (u << 6) + d); 1003 *dev = make_dev_alias(pdev, name); 1004 } 1005} |
1014#endif | |
1015 1016/******************************************************************/ 1017/* 1018 * devices attached to the controller section. 1019 */ 1020static int 1021fd_probe(device_t dev) 1022{ --- 135 unchanged lines hidden (view full) --- 1158 } 1159 return (0); 1160} 1161 1162static int 1163fd_attach(device_t dev) 1164{ 1165 struct fd_data *fd; | 1006 1007/******************************************************************/ 1008/* 1009 * devices attached to the controller section. 1010 */ 1011static int 1012fd_probe(device_t dev) 1013{ --- 135 unchanged lines hidden (view full) --- 1149 } 1150 return (0); 1151} 1152 1153static int 1154fd_attach(device_t dev) 1155{ 1156 struct fd_data *fd; |
1157 static int cdevsw_add_done = 0; |
|
1166 1167 fd = device_get_softc(dev); 1168 | 1158 1159 fd = device_get_softc(dev); 1160 |
1169#ifndef DEVFS 1170 { 1171 static int cdevsw_add_done = 0; | |
1172 if (!cdevsw_add_done) { | 1161 if (!cdevsw_add_done) { |
1173 cdevsw_add(&fd_cdevsw); /* XXX */ 1174 cdevsw_add_done++; | 1162 cdevsw_add(&fd_cdevsw); /* XXX */ 1163 cdevsw_add_done++; |
1175 } | 1164 } |
1176 } 1177#else 1178 EVENTHANDLER_REGISTER(devfs_clone, fd_clone, 0, 1000); 1179#endif | 1165 EVENTHANDLER_REGISTER(dev_clone, fd_clone, 0, 1000); |
1180 make_dev(&fd_cdevsw, (fd->fdu << 6), 1181 UID_ROOT, GID_OPERATOR, 0640, "fd%d", fd->fdu); 1182 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, --- 1277 unchanged lines hidden --- | 1166 make_dev(&fd_cdevsw, (fd->fdu << 6), 1167 UID_ROOT, GID_OPERATOR, 0640, "fd%d", fd->fdu); 1168 1169 /* 1170 * Export the drive to the devstat interface. 1171 */ 1172 devstat_add_entry(&fd->device_stats, device_get_name(dev), 1173 device_get_unit(dev), 512, DEVSTAT_NO_ORDERED_TAGS, --- 1277 unchanged lines hidden --- |