get APM debugging code compiled in. also, redo the way APM debugging
printfs are invoked, making sure they're always compiled in if debugging
is enabled, but printing them only if the appropriate bits in the
'apmdebug' global variable are set.
* clean up function prototypes (alphabetize in each category, get rid
of 'STATIC' and make them always static since kernels shouldn't have
static symbols stripped anyway, and debugging kernels definitely don't),
group global variables together and note that they're used as globals).
* Export the following as option-settable and patchable global variables:
apmdebug flags word that controls which APM debugging
printfs are printed, set with APMDEBUG_VALUE.
apm_enabled boolean that indicates whether or not APM should
ever be configured on the machine. true by
default, false if APM_DISABLE defined when
compiling. this option exists so that users
whose systems crash when APM is enabled can
disable it with a patchable kernel variable, and
therefore don't necessarily have to compile
a custom kernel as often. With this option set,
a check is still done to see if the APM BIOS
exists; this variable should be used to prevent
the kernel from ever attaching to the APM BIOS.
apm_force_64k_segments
boolean that tells segment setup code to always
use segments with 64k length. false by default,
true if APM_FORCE_64K_SEGMENTS defined when
compiling. used to just be a compile-time option.
apm_do_idle boolean that controls whether or not the APM code
will try to signal the BIOS that the system is
idle when in the idle loop. true by default,
false if APM_NO_IDLE defined when compiling.
apm_do_standby boolean that controls whether or not standby
requests are ever attempted. true by default,
false if APM_NO_STANDBY defined when compiling.
used to just be a compile-time option.
apm_v11_enabled boolean that controls whether or not the driver
attempts to use APM spec v1.1 features. If true,
the driver does (it implements v1.1 of the spec),
and if false the driver only uses v1.0 features.
true by default, false if APM_V10_ONLY is defined
when compiling. Really, the driver should be
updated to do APM v1.2 and this option should
either be updated or go the way of the dodo.
used to just be a compile-time option.
apm_bogus_bios (patchable only) controls a few of the APM segment
setup features. (probably should just be a global
and not patchable.)
* make apm_perror print out the full contents of %ax rather than
just the error code, in addition to printing out the string corresponding
to the error code.
* print estimated remaining battery life time as "[<hours>h ]<minutes>m",
which is actually easily understood, rather than as "<hours>:<minutes>
minutes", which is not.
* restructure match and attach so that they work as they should, remove
redundancy, support attaching the APM device but not actually enabling it
so that APM is attached on systems which have it but on which it's broken
in some fatal way.
* add more debugging printfs in the apm control device entry points.
* return EOPNOTSUPP when trying to do a standby ioctl if standbys have
been disabled, rather than returning the less-intuitive ENOTTY.
* rename a few functions for consistency: apmprobe -> apmmatch,
apm_err_translate -> apm_strerror.
* mark a few serious or annoying bogons XXX so people might look at
them later.
* KNF (lots of changes!)
Despite this substantial amount of work, this driver still needs a _lot_ of
work. In particular, the user-land device interface needs to be gutted, and
better support for APM-aware applications and device drivers (i.e. call-backs)
needs to be added (e.g. callback interfaces somewhat like those suggested
by the APM spec).
There are still outstanding known problems with some machines. The true
source of those problems is not currently known, and could be either the APM
BIOSes of the machines in question or this APM driver. However, even if the
problems are caused by APM BIOS bugs, they could be more gracefully worked
around in this driver.
failure. The latter usually would end up being the (nonzero) opcode
placed in %ax before the call, but could conceivably be modified by the
call to be zero. In any case, 0/1 is much nicer than 0/random-nonzero,
as well as being safer.
a global variable (yech, but i'm not out to save the world) which had
the same meaning and ended up being stealthily set in pretty much
the same place.
doing 'if (tag == ...) else if (tag == ...) else panic' rather than
by doing a switch. This makes life easier for people who need
the i386 bus_space_* functions to access spaces other than the normal
memory and I/O spaces, because it allows them to define an i386
bus_space_tag_t as a pointer to a function table, rather than just
an int. (They could define it as an int and cast it to a funtion
table pointer, but I think that's bad karma, and this change doesn't
hurt.)
mark all of 0 -> IOM_BEGIN as used, even though there are some regions
which are left for use by the BIOS (namely, the first 4k page and the
area after biosbasemem*1024 but before IOM_BEGIN). Drivers wishing to
manipulate these areas should map them specially, with _i386_memio_map()
rather than bus_space_map() or i386_memio_map().
disabled even if it's attached. If disabled, ENXIO on open.
(2) in the case where the code32 segment len overflows the I/O hole,
instead of giving up truncate it. (In other words, revert
change (2) in rev 1.21 which i suggested mistakenly.)
(3) map bios data space in the 0->640k range with _i386_memio_map()
rather than with bus_space_map(), so that no accounting checks
are done. The checks which are done to make sure that allocation
in this range is safe are sufficient.
(4) check the return value from _i386_memio_map(), and if it indicates
an error disconnect from the APM BIOS, print an error message,
and return without having marked the device 'enabled'.
functions (which only work on memory and i/o space) to i386_memio_*,
and make bus_space_* in bus.h be #defines which invoke them. This makes
life easier for people who need to define the all of the bus_space functions
so that they work on spaces other than memory and I/O space. Also, add
an _i386_memio_map function which is like i386_memio_map but doesn't do
the extent map checking or allocation. _i386_memio_map and i386_memio_*
are for use only by machine-dependent code.
code for this was in my private tree at one time, and I must have
forgotten to g/c the constant from trap.h). Reported by
enami tsugutomo <enami@but-b.or.jp>, PR #3845.
("filename" must be processed by parsebootfile() first).
Being here:
- remove the special "#ifdef MATTHIAS" mainloop
- make some "booting..." output match reality
- print '\n' and '\b' more controlled
the 'a' partition. Sanity checked by thorpej.
This, incidently, may have been causing user errors in initializing
new disks, as described in (now closed) pr-2729 from Scott Reynolds,
because users typically don't try to edit their c partitions to be
"correct".
now be installed on any partition.
Allow PRIM_LOADSZ to be set in the Makefile.
This together allows to make bootable 720k floppys.
closes PR port-i386/3751
bounce buffer, which breaks installs on 4Meg machines using the new
ramdisk install system. We'll bus_dma the driver and then it should be
fine to put back in to the normal INSTALL kernel.
XMS is recognized and used as temporary buffer for the kernel image.
The processor must still be in real mode at program start, so EMM386
or QEMM are not allowed. W*95 is OK.
Written by Martin Husemann (pr port-i386/3336).
Completely separated from other bootloaders for sanity.
disconnect from the BIOS
2) when text segment as claimed by BIOS is out of sensible range, punt
completely rather than trying to shrink it to fit the ISA hole. Some
BIOSes would crash with the previous behavior. Some won't have a
working APM with the new behavior, but their BIOSes are broken.
Suggested by Chris Demetriou, with very minor tweaks by me.
for user input, or until the driver is ready to handle them itself.
Also, try to turn on power management if the BIOS says it's disabled at
connect time.
- allow whitespace before a command, and if there is only whitespace,
don't print the help message (seeing a help message after just
tapping return can be a shade annoying).