Commit Graph

49605 Commits

Author SHA1 Message Date
uwe
28794590b6 Register null hooks with pmf(9) for now, which is no worse than before
and allows us to test other things.
2009-04-05 00:56:20 +00:00
tsutsui
47fb91c8ba Remove __HAVE_UFS2_BOOT since it belongs to sysinst for now.
"Feel free to change it" by ad@.
2009-04-05 00:54:21 +00:00
uwe
375ebd8c0b Register null hooks with pmf(9) for now, which is no worse than before
and allows us to test other things.
2009-04-05 00:22:27 +00:00
uwe
c68d2565cb Register with pmf(9), tell it we don't need anything. 2009-04-05 00:17:56 +00:00
uwe
584c995418 Register with pmf(9), tell it we don't need anything. 2009-04-05 00:04:51 +00:00
uwe
e7c8b2e888 Register with pmf(9), tell it we don't need anything. 2009-04-04 23:45:24 +00:00
joerg
ace0f41f53 Restore SpeedStep settings on shutdown. Some BIOSes don't like it, if
SpeedStep is enabled and powerdown fails otherwise. Fixes PR kern/40487.
2009-04-04 23:13:18 +00:00
ad
95e4ccac55 +__HAVE_UFS2_BOOT 2009-04-04 10:36:08 +00:00
ad
c6367674d6 Add fileops::fo_drain(), to be called from fd_close() when there is more
than one active reference to a file descriptor. It should dislodge threads
sleeping while holding a reference to the descriptor. Implemented only for
sockets but should be extended to pipes, fifos, etc.

Fixes the case of a multithreaded process doing something like the
following, which would have hung until the process got a signal.

thr0	accept(fd, ...)
thr1	close(fd)
2009-04-04 10:12:51 +00:00
uebayasi
58141c8949 Include sys/device.h. Fix build. 2009-04-03 15:41:14 +00:00
uebayasi
8e4e2fe06d Include sys/evcnt.h for struct evcnt, not sys/device.h. 2009-04-03 14:47:48 +00:00
tsutsui
ac465a42e7 Remove obsolete LIBSA_USE_MEMCPY and LIBSA_USE_MEMSET.
They were removed from <lib/libsa/stand.h> on December 2007.
2009-04-03 10:38:12 +00:00
uwe
9a25b0cb7f Switch apmdev to use apm(4) structures from dev/apm/apmvar.h.
Add batteryid argument to aa_get_powstat method implementations.
2009-04-03 04:13:17 +00:00
tsutsui
f2ca316138 Don't use relative path from <machine> in #include.
It won't work for symlinks.
2009-04-02 13:00:40 +00:00
enami
09fcc8b316 So that profile kernel runs again,
- Adjust the size of functions used to patch.
- Fix the jump offset of mcount call when patching functions.

Approved by Andrew Doran.
2009-04-02 00:19:02 +00:00
dyoung
0d1ba3e899 During shutdown, detach devices in an orderly fashion.
Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks.  For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown.  Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags.  Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag.  The default for kern.detachall is 0.  SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress.  In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs.  Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.
2009-04-02 00:09:32 +00:00
drochner
23d4af832f sort out what is needed for crash(8) and what not, should fix
recent build errors
2009-04-01 21:15:45 +00:00
tls
d15f48cfe5 Fix probe for VIA C3 and successors -- these are CPU family 6, not 5.
The broken probe was causing the VIA padlock driver to never attach!
Now we can see that its AES appears to be broken -- it makes FAST_IPSEC
ESP not work, on systems where it works fine with cryptosoft.

Rework code to detect and (if necessary) enable VIA crypto and RNG.
Add RNG support to VIA padlock driver.  In the process, have a quick
go at debugging the AES support but no luck thus far.
2009-04-01 03:56:54 +00:00
rmind
f8a1f87074 Sync with recent i386/amd64 source merges - fix Xen builds. 2009-03-31 20:12:19 +00:00
tsutsui
e90ec2adcc Remove extra whitespace added by a dumb tool. 2009-03-31 11:48:15 +00:00
tsutsui
d008724eb5 Switch atari standalone bootloaders to using MI libsa and libkern.
Tested by David Ross on port-atari@. Thanks!
2009-03-31 11:42:07 +00:00
rmind
44170e3c3a Merge i386 and amd64 ipifuncs.c into x86. No functional changes intended.
XXX: fpu #ifdefs are ugly (should be revisited at some point).
2009-03-30 22:28:39 +00:00
rmind
70456c4d9e Merge i386 and amd64 vm_machdep.c into x86. No functional changes intended.
Note: some #ifdefs will be removed with macros.
2009-03-30 22:20:55 +00:00
rmind
74a033c8eb Merge/move core_machdep.c into x86, no difference between i386 and amd64. 2009-03-30 22:13:42 +00:00
dyoung
1f874fb168 Cosmetic: reduce differences from amd64/amd64/vm_machdep.c by deleting
an empty line.
2009-03-30 17:48:22 +00:00
tsutsui
e1a7799d79 #include <sys/types.h>, not <stdbool.h> for userland
in defined(_STANDALONE) case too.
2009-03-30 09:51:37 +00:00
tsutsui
31f477f9fd Remove extra trailing slash in ${S} path. 2009-03-30 09:22:52 +00:00
mrg
dba4444474 delete COMPAT_43 that is now in GENERIC 2009-03-29 17:06:01 +00:00
ad
21caef1598 Unfuck compat some more 2009-03-29 15:45:08 +00:00
ad
09f256f463 Make i386 use banner(). amd64 not converted yet as it seems to trip into
a bug in format_bytes().
2009-03-29 10:58:54 +00:00
tsutsui
ab3ad94358 Remove kernfs and use dmesg(8) on alpha INSTALL kernel. 2009-03-29 10:12:31 +00:00
ad
ead83a47c8 _lwp_setprivate: provide the value to MD code if a hook is present.
This will be used to support TLS. The MD method must match the ELF TLS spec
for that CPU architecture (if there is a spec).

At this time it is only implemented for i386, where it means setting the
per-thread base address for %gs. Please implement this for your platform!
2009-03-29 09:24:52 +00:00
tsutsui
e6bb0dedbf Use <bsd.klinks.mk> to create machine and ${MACHINE_ARCH} symlinks. 2009-03-29 07:19:40 +00:00
rmind
a3e23c67f6 Reduce some differences between i386 and amd64.
Mainly cosmetical changes - no functional changes intended.
2009-03-29 01:10:28 +00:00
mrg
fcc023545e - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes.  this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS.  (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information.  (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897.  it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
2009-03-29 01:02:48 +00:00
rmind
ee70d529c3 Change amd64 fault handler to check instruction pointer for copyin/out et al
functions, like in i386.  Avoids setting pcb_onfault, saves few instructions.
2009-03-28 22:56:19 +00:00
rmind
614719fdd8 Add few comments. 2009-03-28 22:46:52 +00:00
rmind
1ce95d231e x86_64_ipi_halt: unset CPU as running (sync with i386). 2009-03-28 22:03:27 +00:00
rmind
0d4fdf8b96 kvtop: change return type to paddr_t. 2009-03-28 21:34:17 +00:00
rmind
eefc2d042b mmrw: add missing pmap_update(). 2009-03-28 21:23:44 +00:00
rmind
a7fde9e6fa cpu_coredump: pass UIO_SYSSPACE to coredump_write(), not UIO_USERSPACE. 2009-03-28 21:21:29 +00:00
mrg
7e57d1b381 put the max_paddr DEBUG message under DUMP_DEBUG option. 2009-03-28 01:45:17 +00:00
ad
cf4d738d95 Remove -mtune, we'll let the compiler pick a good default (the current
default sucks).
2009-03-27 21:04:35 +00:00
drochner
bf4f01a782 Rearrange TSC inter-CPU synchronization code so that the gory details
are dealt with in x86/tsc.c and callers don't have to care that much.
Also add some comments and make some variables static.
approved by ad (a while ago)
2009-03-27 19:53:19 +00:00
dyoung
a6cfb08d9c If defined(_KERNEL), #include <sys/types.h>, otherwise #include
<stdbool.h>, for the bool definition that we need. intr.h only got the
definition by chance, before.
2009-03-27 16:09:24 +00:00
dyoung
103f0ed593 If defined(_KERNEL), #include <sys/types.h>, otherwise #include
<stdbool.h>, for the bool definition that we need. cpu.h only got the
definition by chance, before.
2009-03-27 16:07:37 +00:00
dyoung
098e562dfd Explicitly #include <sys/device.h> and <sys/evcnt.h>. These files only
got the definitions they needed by chance, before.
2009-03-27 15:47:33 +00:00
macallan
31e90ebd10 add a few more register definitions, needed by the latest crime_drv. 2009-03-26 04:11:58 +00:00
dyoung
3a72540da6 This only got the definition of device_xname() by chance, so explicitly
#include <sys/device.h>.
2009-03-26 00:30:10 +00:00
dyoung
9fd1ce14c3 It is only by accident that these get the definitions they need from
<sys/device.h>, so explicitly #include <sys/device.h>.
2009-03-25 22:56:00 +00:00
dyoung
61cf8013a0 It is only by accident that this gets the definitions it needs from
<sys/evcnt.h>, so explicitly #include <sys/evcnt.h>.
2009-03-25 22:54:56 +00:00
dyoung
f81f62377d It is only by accident that these get definitions they need from
<sys/device.h>, so explicitly #include <sys/device.h>.
2009-03-25 22:53:51 +00:00
cegger
8d8839858d catch up with i386 xen kernels:
enable cgd by default
2009-03-25 06:26:44 +00:00
agc
5e3c351cee Catch up with the changes in i386 GENERIC, and enable cgd by default
in XEN2 and XEN3 kernels.

Xen really requires cgd, and as users are likely to get a domain given
to them without the possibility of recompiling a kernel for
themselves, we need to provide this by default.

As discussed with bouyer@, and with his OK.
2009-03-24 22:42:50 +00:00
martin
bce5c2205a Now that we compile the Atheros HAL from source we pass all the right
flags to the compiler so it obeys the same ABI as the rest of the kernel.
Remove the hacks used to work around the abi differences (using %s7 as
curlwp) intruduced for the binary hal.
2009-03-24 21:36:46 +00:00
tsutsui
8567f2b149 Put back zstty0 and zstty1 lines for onboard zs(4) serial ports
so that they are properly assinged to ttya and ttyb as pre-wscons kernels.
Ok'ed by macallan@.
2009-03-24 12:16:12 +00:00
pooka
20f51bbafd need putter too 2009-03-24 11:53:22 +00:00
pooka
d2478264ae file-system PUFFS 2009-03-24 11:52:21 +00:00
tsutsui
92da7d73c5 Revert kludge in previous.
The warning was triggered by __builtin_memcpy() on vax, and
it has been disabled in libkern.h for _STANDALONE programs.
2009-03-23 13:52:32 +00:00
tsutsui
2a6ed85992 - use -Os to shrink bianries
- remove local shrinked memcpy() from bootxx.c bacause
  now it's identical with __OPTIMIZE_SIZE__ libsa one
  derived from src/common/lib/libc/string/bcopy.c.

Tested netboot from le0 and bootxx + boot from sd0 on SS1+.
2009-03-23 13:47:32 +00:00
ad
dabb2cae17 Set up module_map correctly so that the system does not panic if it
becomes full.
2009-03-22 19:57:11 +00:00
uwe
1ebb57a8c6 Don't bother trying to attach GPIO, AFE and FIR modules for which we
have no drivers.

Standby TIMER that we don't use.  One of the timers is always out of
standby on my Jornada on boot (WinCE uses it), so save some power.

Standby AFE and FIR for which we have no drivers (I don't know if any
hpcsh hardware actually uses them, so they are likely to be in standby
already anyway).
2009-03-22 02:25:11 +00:00
ad
2fc1c0de55 Add 2 event counters:
"x86", "io bitmap copy"
"x86", "ldt sync"
2009-03-21 22:55:08 +00:00
ad
e23c2bc3ad A couple more comments. 2009-03-21 22:17:13 +00:00
ad
b8dea7e04e Add a comment. 2009-03-21 21:42:00 +00:00
ad
3c11640e0d Fix 'boot -z' bogons. 2009-03-21 15:01:56 +00:00
ad
418272808a Correction to previous. 2009-03-21 14:48:02 +00:00
ad
d16d704d62 PR port-i386/40143 Viewing an mpeg transport stream with mplayer causes crash
Fix numerous problems:

1. LDT updates are not atomic.

2. Number of processes running with private LDTs and/or I/O bitmaps
   is not capped. System with high maxprocs can be paniced.

3. LDTR can be leaked over context switch.

4. GDT slot allocations can race, giving the same LDT slot to two procs.

5. Incomplete interrupt/trap frames can be stacked.

6. In some rare cases segment faults are not handled correctly.
2009-03-21 14:41:29 +00:00
uwe
490f3711c0 Interrupt handling changes (revision 1.23) bumped down _IPL_N to 8 for
some reason.  Restore it to correct 16.

HTF did hpcsh work all this time with hd6446x_imask[_IPL_N] indexed
with IPLs 0..15 is a mistery...  Discovered by accidentally triggering
hd64461 timer interrupt that is not enabled and should have been
masked.

_IPL_N used to be *also incorrect* 15 before Andy's change, which
makes one wonder if dumb luck is severly underappreciated.
2009-03-21 06:11:08 +00:00
uwe
1251c9c4c1 Print only the offending masked HD6446x interrupt, not all of the NIRR. 2009-03-21 04:58:32 +00:00
uwe
89c9d74da9 Fix typo in message. 2009-03-21 03:51:41 +00:00
uwe
ba51317c25 Minor cosmetic. 2009-03-21 03:13:30 +00:00
uwe
76c0e81d47 In the current code the even loop is never exited, but it's cleaner to
have explicit kthread_exit at the end of the event thread routine.
2009-03-21 02:23:03 +00:00
uwe
df7998fac1 Move channel attachment to event thread (we already have one, so it's
easier to do it there rather than mess with config_interrupts()).

From kiyohara@.  Discussed with drochner@, who pointed out that pcmcia
drivers are expected to attach with interrupts enabled.
2009-03-21 02:02:39 +00:00
tsutsui
e61fbf18ec Build common standalone MD sources in libsa. 2009-03-20 13:59:49 +00:00
tsutsui
1b7ed0b13a Switch sun68k standalone programs to using MI libsa and libkern.
Bump version.

Tested bootxx + ufsboot on TME (sun2 and sun3) and 3/80 (sun3x).
2009-03-20 11:42:25 +00:00
he
2c9ccd9e54 Correct one more bungled bcopy() -> memcpy() conversion. 2009-03-19 23:09:13 +00:00
he
9cd8fe02fa Correct a few more bungled bcopy() -> memcpy() conversions. 2009-03-19 22:52:16 +00:00
he
521052f60d It seems gcc is unhappy about a literal 0 as a pointer argument
to memcpy().  Work around that by using a local variable instead.
(This looks a bit dubious, but who am I to judge the restrictions
in the standalone environment on the vax -- this should not change
the semantics of what was here before.)
2009-03-19 14:11:20 +00:00
he
009f7e26ee Now that the stand/ code was converted to use memcpy(), the private
implementation of bcopy() needs to become memcpy() as well.  The
simpler local implementation is needed so that the boot code doesn't
overflow the available space.
2009-03-19 14:05:24 +00:00
tsutsui
18014b1a99 Remove bcmp() from MD libsa.
XXX: These ports should be rewritten to use MI libsa for maintainability.
2009-03-19 10:19:33 +00:00
mrg
4df09e915b remove a bunch of special casing to handle improperly set segment
registers.  if we faulted trying to set them, just fall into
"we_re_toast", and arrange for a SEGV to be delivered to the
userland process.  fixes kernel mode faults.

from andrew doran.
2009-03-19 02:59:00 +00:00
he
9df5574fb1 Correct a bzero() -> memset conversion. 2009-03-18 22:13:05 +00:00
dyoung
75c7534526 Remove native compatibility options to stop the config(1) errors
that Juergen Hannken-Illjes reports:

    sys/arch/i386/conf/MONOLITHIC:16: already have options `COMPAT_NOMID'
    sys/arch/i386/conf/MONOLITHIC:17: already have options `COMPAT_09'
    ...
2009-03-18 20:57:45 +00:00
cegger
e2cb85904d bcopy -> memcpy 2009-03-18 17:06:41 +00:00
cegger
c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
cegger
35fb64746b bcmp -> memcmp 2009-03-18 15:14:29 +00:00
tsutsui
83a448a377 Include <string.h> for memcpy(3). 2009-03-18 13:24:38 +00:00
cegger
df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
cegger
20cd1777db ansify function definitions 2009-03-18 07:41:54 +00:00
uwe
7ae7c6b0f8 Turn on display on attachment. Fixes the scenario when serial console
is used and you reboot (using kloader) with screen turned off.
2009-03-18 02:49:34 +00:00
dyoung
69fbb7297e Reactivate native compatibility in GENERIC. 2009-03-17 20:04:39 +00:00
he
6dc3c9a69e Make putchar() conform to the stand.h prototype, so that this builds again. 2009-03-17 19:41:32 +00:00
he
f39d6889ae Due to the way these files are used, ref. libdos/makedoscalls.awk and
libiocs/makeiocscalls.awk, we need a space between the function name
and the parameter list in the declaration.
2009-03-17 18:58:26 +00:00
he
75306d0938 Correct the sense of the test for LIBSA_NO_FS_CLOSE
so that this builds again.
2009-03-17 18:43:43 +00:00
dsl
98ae204731 Add some 'int' into function definitions where the K&R one didn't
specify a type.
2009-03-17 18:19:15 +00:00
he
62db563030 Re-balance parenthesis in a couple of places. 2009-03-17 10:16:55 +00:00
msaitoh
50a765e44b Make it compile without PCI. 2009-03-17 00:51:27 +00:00
he
d44fdcfc47 Introduce LIBSA_NO_DEV_IOCTL, and don't declare ioctl() if it's defined.
Also, don't declare the close() function if LIBSA_NO_DEV_CLOSE is defined.
2009-03-17 00:45:46 +00:00
he
cdd90ae5f0 Introduce LIBSA_NO_DEV_IOCTL. Don't declare the ioctl routine
if it is defined, and don't declare the close routine if
LIBSA_NO_DEV_CLOSE is defined.
2009-03-17 00:35:08 +00:00