totally dynamic.
this is only the devices in i386/isa
I'll do more tomorrow.
they're completely masked by #ifdef JREMOD at this stage...
the eventual aim is that every driver will do a SYSINIT
at startup BEFORE the probes, which will effectively
link it into the devsw tables etc.
If I'd thought about it more I'd have put that in in this set (damn)
The ioconf lines generated by config will also end up in the
device's own scope as well, so ioconf.c will eventually be gutted
the SYSINIT call to the driver will include a phase where the
driver links it's ioconf line into a chain of such. when this phase is done
then the user can modify them with the boot: -c
config menu if he wants, just like now..
config will put the config lines out in the .h file
(e.g. in aha.h will be the addresses for the aha driver to look.)
as I said this is a very small first step..
the aim of THIS set of edits is to not have to edit conf.c at all when
adding a new device.. the tabe will be a simple skeleton..
when this is done, it will allow other changes to be made,
all teh time still having a fully working kernel tree,
but the logical outcome is the complete REMOVAL of the devsw tables.
By the end of this, linked in drivers will be exactly the same as
run-time loaded drivers, except they JUST HAPPEN to already be linked
and present at startup..
the SYSINIT calls will be the equivalent of the "init" call
made to a newly loaded driver in every respect.
For this edit,
each of the files has the following code inserted into it:
obviously, tailored to suit..
----------------------somewhere at the top:
#ifdef JREMOD
#include <sys/conf.h>
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
static void sd_devsw_install();
#endif /*JREMOD */
---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT
#ifdef JREMOD
sd_devsw_install();
#endif /*JREMOD*/
-----------------------at the bottom:
#ifdef JREMOD
struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0 };
struct cdevsw sd_cdevsw =
{ sdopen, sdclose, rawread, rawwrite, /*13*/
sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy };
static sd_devsw_installed = 0;
static void sd_devsw_install()
{
dev_t descript;
if( ! sd_devsw_installed ) {
descript = makedev(CDEV_MAJOR,0);
cdevsw_add(&descript,&sd_cdevsw,NULL);
#if defined(BDEV_MAJOR)
descript = makedev(BDEV_MAJOR,0);
bdevsw_add(&descript,&sd_bdevsw,NULL);
#endif /*BDEV_MAJOR*/
sd_devsw_installed = 1;
}
}
#endif /* JREMOD */
Convert the remaining sysctl stuff to the new way of doing things.
the devconf stuff is the reason for the large number of files.
Cleaned up some compiler warnings while I were there.
floppies must have been random in 2.x since we reintroduced sorting
on b_pblkno on 1995/03/18. Drivers still initialize b_cylin/b_resid
although this is no longer used.
Removed unused, wrong function fdsize(). (Returning 0 means that the
device exists and has size 0, not that the device doesn't exist.
swaponvp() allows for size 0 by stupidly calling the d_psize function
twice if the size isn't 0. setdumpdev() doesn't allow for it.)
Continued removing /* ARGSUSED */ from drivers.
misplaced extern declarations (mostly prototypes of interrupt handlers)
that this exposed. The prototypes should be moved back to the driver
sources when the functions are staticalized.
Added idempotency guards to <machine/conf.h>. "ioconf.h" can't be
included when building LKMs so define a wart in bsd.kmod.mk to help
guard against including it.
to <machine/conf.h>. conf.h was mechanically generated by
`grep ^d_ conf.c >conf.h'. This accounts for part of its ugliness. The
prototypes should be moved back to the driver sources when the functions
are staticalized.
changes to allow devices that don't probe (e.g. /dev/mem)
to create devfs entries
this required giving 'configure' its own SYSINIT entry
so we could duck in just before it with a DEVFS init
and some device inits..
my devfs now looks like:
./misc
./misc/speaker
./misc/mem
./misc/kmem
./misc/null
./misc/zero
./misc/io
./misc/console
./misc/pcaudio
./misc/pcaudioctl
./disks
./disks/rfloppy
./disks/rfloppy/fd0.1440
./disks/rfloppy/fd1.1200
./disks/floppy
./disks/floppy/fd0.1440
./disks/floppy/fd1.1200
also some sligt cleanups.. DEVFS needs a lot of work
but I'm getting back to it..
The ``flags 1'' in the fdc line is now only needed for owners of an
Insight tape (perhaps there aren't any? Mine is disfunctional). All
other probes are safe wrt. to the motor-control line of floppy disk
drives. Document the flag in LINT finally.
For those where it was easy, drivers were also fixed to call
dev_attach() during probe rather than attach (in keeping with the
new design articulated in a mail message five months ago). For
a few that were really easy, correct state tracking was added as well.
The `fd' driver was fixed to correctly fill in the description.
The CPU identify code was fixed to attach a `cpu' device. The code
was also massively reordered to fill in cpu_model with somethingremotely
resembling what identifycpu() prints out. A few bytes saved by using
%b to format the features list rather than lots of ifs.
Report floppy/tape units on seperate lines as fdX:/ftX: to correct lots of
ways the current scheme failed to end the output with \n.
Add controller and/or drive designator to the fron of several messages
that come from this drive. [It's not fun to track down driver messages
using grep over the source tree.]
Reviewed by: joerg
protected drive at open() time has been *totally bogus*! The guy who
submitted it didn't understand all the implications of calling
set_motor(), and the `who' who included the patch into the tree did it
blindly... Pleeeeze, don't commit code to this driver unless you are
really going to understand what it does! This one caused me to pull
out even more hears, and those who know me do know that i ain't got
too many o'them. :-)
now marked busy as long as it's being in non-reset state, and the
drives are busy as long as at least one instance is open.
Also reformat everything to fit into 80 columns again.
Changed my mind wrt. error reporting for a write-protected drive and
an open() with write intent; ENXIO has been too weird, now return EIO.
Some portions of the code need to be rewritten to use tprintf()
instead of simple printf()'s, so the messages will also appear on the
session terminal, however.
floppy driver (or in the hardware?). It turned out to be caused by
spurious interrupts, right after an FDC reset.
Also major cleanup in the low-level structure, there are now functions
performing error-checks for the FDC I/O.
Submitted by: (mostly) Peter Dufault <dufault@FreeBSD.org>
Now floppy tape support is *disabled* unless you specifically
request otherwise. Poul wanted it this way, and I guess I'm not going to argue
though it may seem counter-intuitive. We can always change it back, later.
flags & 0x1. Somebody should build a kernel with this and see if
the floppy-tape damaged people can turn it off properly with userconfig.
I can't reproduce the original problem here.
floppies now. I'm not sure why, but things hang when it gets to the
`changing root to fd0c' part. Without your latest commit, everything works
fine. Maybe you can figure out what you broke after ALPHA! :)
. avoid resetting the FDC every time the last motor is going off;
instead, give it a 60-second period for possible later reactivation.
This prevents us from needing to recalibrate the FDC too often,
but still allows for an ``automagic error recovery', just in case the
controller is absolutely stuck. (Simply wait for 60 seconds, and
try it again.)
. made the floppy head settle time after a seek a constant
that might be overridden by a config option. (Well, actually the
divisor of the settle time). Pepople often reported problems with
their floppies, so i need a simply mechanism that allows them
to play with that value. (I personally cannot find any problem
on *my* drives.)
. implement the FD_DEBUG ioctl command, in case the driver
is compiled with DEBUG turned on.
. removed a bogus parameter from a printf; the remaining warnings
from gcc -Wall seem to be warnings about the %b format gcc cannot
understand
. rearrange Garett's code to fit better in the existing structure
of #define/type/function ordering.
. make everything fit into 79 columns again.
and all SCSI devices (except that it's not done quite the way I want). New
information added includes:
- A text description of the device
- A ``state''---unknown, unconfigured, idle, or busy
- A generic parent device (with support in the m.i. code)
- An interrupt mask type field (which will hopefully go away) so that
. ``doconfig'' can be written
This requires a new version of the `lsdev' program as well (next commit).
so i hope i've finally removed all the occasions where the driver
got stuck when there's no floppy in the drive.
Also attemmpting to omit the error mesage for ``recalib failed''
for the first time, since people tend to be confused about this.
when the drive had been left on a cylinder > 67 after kernel boot. The
most common case for this is booting a kernel that is located on
the inner cylinders of a floppy.
Also removed all occurences of spinwait(), replaced by DELAY.
Nuked a return line saying nothing, this might make Bruce happy 8^)
Submitted by: partially by Bruce Evans
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
Added a missing #ifdef INET wrapper in lpt.c
Main change:
Removed the timeout_func_t casts from timeout calls and
correctly defined the timeout routines to conform to
the new format.
lpt.c doesn't have this change.
Reviewed by:
Submitted by:
``changes'' are actually not changes at all, but CVS sometimes has trouble
telling the difference.
This also includes support for second-directory compiles. This is not
quite complete yet, as `config' doesn't yet do the right thing. You can
still make it work trivially, however, by doing the following:
rm /sys/compile
mkdir /usr/obj/sys/compile
ln -s M-. /sys/compile
cd /sys/i386/conf
config MYKERNEL
cd ../../compile/MYKERNEL
ln -s /sys @
rm machine
ln -s @/i386/include machine
make depend
make
1) check va before clearing the page clean flag. Not doing so was
causing the vnode pager error 5 messages when paging from
NFS. (pmap.c)
2) put back interrupt protection in idle_loop. Bruce didn't think
it was necessary, John insists that it is (and I agree). (swtch.s)
3) various improvements to the clustering code (vm_machdep.c). It's
now enabled/used by default.
4) bad disk blocks are now handled properly when doing clustered IOs.
(wd.c, vm_machdep.c)
5) bogus bad block handling fixed in wd.c.
6) algorithm improvements to the pageout/pagescan daemons. It's amazing
how well 4MB machines work now.
Subject: Re: Bugs with floppy drives
Date: Tue, 8 Mar 94 9:11:54 CST
The transfer speed was only set in the retry after error, not when
switching drives.