Commit Graph

8265 Commits

Author SHA1 Message Date
perry
108f1637cb add commented out LOCKDEBUG 2009-04-10 23:00:53 +00:00
perry
10604079d9 Check the size of the offered boot.cfg file. Bail out if it is larger
than 32k.

A bootconf file is normally only a few hundred bytes long. If it is
much bigger than expected, we can't load it into an 8086 real mode
segment anyway.

Much more to the point, in the pxeboot case, someone may have
configured their dhcpd to return the filename for the kernel, not
realizing that the filename is now for boot.cfg which didn't used to
be the case. If we try to load the kernel here, thinking it is
boot.cfg by accident, the boot loader will die ignominiously and
without much of an error message, so we don't want to do that.

This needs to be pulled up to 5.0 if 5.0 has all this machinery
-- I'm not sure whether it does.
2009-04-10 19:41:41 +00:00
sborrill
e53eaac0d8 Add missing cpu.h include required by last commit. 2009-04-09 10:56:41 +00:00
dyoung
faec2c4d7c Move elanpar0 and elanpex0 attachment out of the #if NGPIO > 0 block in
elansc_attach().

Let us detach gpio0 at elansc0.

Let us re-attach pci0 at elansc0.

Reduce code duplication between elansc_rescan() and elansc_attach():
call _rescan() from _attach() to attach elanpex0, elanpar0, gpio0, and
pci0.
2009-04-08 23:53:10 +00:00
dyoung
9512fa2997 Remove redundant declaration of mainbus_attach(), as pointed out by
Thomas Klausner.

Do not compile in the local variable "mba" in mainbus_rescan unless
NPNPBIOS > 0 || NACPI > 0 || NIPMI > 0 || NMCA > 0.  This fixes the
build on systems such as Soekris where none of those options apply.
2009-04-08 17:08:02 +00:00
dyoung
b6889a3f64 Let us re-attach acpi0, ipmi0, pnpbios0, and mca0 at mainbus0.
Extract code from mainbus_attach() to create a rescan hook,
mainbus_rescan().  Call mainbus_rescan(, "acpibus"/"ipmibus"/..., ) from
mainbus_attach() in the precise places where we used to attach acpi0,
ipmi0, pnpbios0, and mca0.  This allows, for example, ipmi0 to detach
and re-attach:

# drvctl -d ipmi0
ipmi0: detached
# drvctl -r -a ipmibus mainbus0
ipmi0 at mainbus0
#

Future work will let us detach & re-attach CPUs and the ISA/PCI/EISA
buses at mainbus0.
2009-04-07 22:01:38 +00:00
dyoung
720a7dca79 Add opt_intrdebug.h for the INTRDEBUG option, and #include it here and
there.  Fixes GENERIC/i386 compilation with 'options INTRDEBUG'.
2009-04-07 18:24:23 +00:00
tsutsui
0f22466110 Use #define<tab> consistently. 2009-04-05 00:57:56 +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
ad
95e4ccac55 +__HAVE_UFS2_BOOT 2009-04-04 10:36:08 +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
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
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
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
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
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
rmind
a3e23c67f6 Reduce some differences between i386 and amd64.
Mainly cosmetical changes - no functional changes intended.
2009-03-29 01:10:28 +00:00
rmind
614719fdd8 Add few comments. 2009-03-28 22:46:52 +00:00
rmind
0d4fdf8b96 kvtop: change return type to paddr_t. 2009-03-28 21:34:17 +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
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
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
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
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
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
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
df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
dyoung
69fbb7297e Reactivate native compatibility in GENERIC. 2009-03-17 20:04:39 +00:00
cegger
05d33dc7bf ansify function definitions 2009-03-16 09:32:38 +00:00
cegger
f7d20361b0 ansify function definitions 2009-03-15 15:40:33 +00:00
tsutsui
216a370b45 Make sure to create i386 symlink on more generic targets. 2009-03-15 05:45:32 +00:00
dsl
82357f6d42 ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
2009-03-14 21:04:01 +00:00
dsl
454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
dsl
02cdf4d2c8 Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
2009-03-14 14:45:51 +00:00
abs
f681b265bc Prefer MACHINE_ARCH to MACHINE in some tests 2009-03-12 17:16:58 +00:00
cegger
c920c4baa3 use paddr_t for physical addresses. u_long may not be large enough. 2009-03-11 10:30:52 +00:00
bouyer
f5f016d356 More i386PAE fixes:
- x86_round_page, x86_trunc_page, x86_btop and x86_ptob macros are used with
  physical addresses; cast to paddr_t instead of u_long. Issue pointed out
  by jym@
- machine_to_phys_mapping[] is a long. This is fine as it holds page
  frame numbers (and this fits in a 32bit int as physical addresses are
  only 36bits), but cast to paddr_t before << PAGE_SHIFT
- xen_start_info.store_mfn is a long; cast it to paddr_t before << PAGE_SHIFT.
  should fix issue pointed out by cegger@
2009-03-10 20:05:30 +00:00
ad
4e9e0aa85c printf -> panic so MP panics work correctly 2009-03-08 16:03:31 +00:00
ad
cd6b1c8f08 Make ddb compile and work in userspace. Mostly this is comprised of three
types of changes:

- Add a few new methods to replace stuff like p_find(), CPU_INFO_FOREACH.

- Use db_read_bytes() instead of accessing kernel structures directly,
  and similar changes.

- Add ifdef _KERNEL where the above hasn't been done, and an XXX comment.
2009-03-07 22:02:16 +00:00
joerg
f5b0fec0e0 Remove SHMMAXPGS from all kernel configs. Dynamically compute the
initial limit as 1/4 of the physical memory. Ensure the limit is at
least 1024 pages, the old default on most platforms.
2009-03-06 20:31:46 +00:00
cegger
61b1fbae0d add options COMPAT_50 2009-03-06 10:48:27 +00:00
cegger
1bf78a71a6 add options COMPAT_50 2009-03-06 10:37:42 +00:00
cegger
8e35c3d94f add age(4) and atphy(4) 2009-03-06 09:58:14 +00:00
cegger
23d8015c3f Go independent from Xen2 config files 2009-03-06 09:51:02 +00:00
bouyer
2c02d488fa Add pciback device to XEN3 dom0 kernels 2009-03-05 19:51:49 +00:00
nisimura
ff2a35dca2 comment out NFS_BOOT_BOOTSTATIC. It will be useful when a valid set of
NFS_BOOTSTATICs are specfied.
2009-03-04 07:31:33 +00:00
isaki
01850a5636 Remove duplicated definitions. 2009-03-01 09:23:27 +00:00
dyoung
247a5f8a77 Add isv(4). 2009-02-27 23:37:20 +00:00
jmcneill
8390afe513 PR# port-i386/38936: system can not power down via acpi
Merge change from amd64 machdep.c revision 1.42:

in cpu_reboot(), only halt the other CPUs after we've done the powerdown stuff.
the ACPI code may end up removing some pmap entries, which wants the other
CPUs to still be running to handle TLB invalidations.
2009-02-26 15:07:33 +00:00
jmcneill
7d16528c20 PR# port-i386/40751: power button does not work after halt
PR# kern/37506: Have to hold power button for 5 seconds to turn off Laptop
    after "halt" command.

Transfer the system from ACPI to Legacy mode if RB_HALT is set.
2009-02-26 13:56:46 +00:00
yamt
4b64c2cb3d - rewrite x86 nmi dispatcher so that establish and disesablish are safe
on a running system.
- adapt existing users of the api.  (elan)
- adapt tprof_pmi driver to use the api.
2009-02-24 06:03:54 +00:00
rmind
f7d3fa20ef Add ucas (CAS for user-space address) support for i386 and amd64.
API provides ucas_int() and ucas_ptr() for now.

Reviewed by <ad>.
2009-02-23 20:27:59 +00:00
ahoka
c0dfcdb337 Add a missing opt_multiboot.h into sys/arch/i386/i386/machdep.c.
Also do the missed rename of multiboot_ksyms_init to
multiboot_ksyms_addsyms_elf to compile with MULTIBOOT set.

This caused a minor and a more serious bug in the past:
- dmesg did not contain the information about the loader
- /dev/ksyms did not work when the kernel was booted with a
  multiboot bootloader (grub for example)

Ok by jmcneill, joerg.
2009-02-22 18:05:42 +00:00
jmcneill
2f56ffd259 Adjust for acpi_resource_parse aprint changes, noted by Jukka Salmi 2009-02-21 00:30:37 +00:00
jmcneill
f654d345dd Mark old vesabios/vesafb flags as obsolete, noted by cube 2009-02-19 13:06:49 +00:00
jmcneill
08224a94a7 Remove vesafb, it has been replaced by genfb on x86. 2009-02-19 00:54:08 +00:00
jmcneill
41a1bce5b4 Reorder command line parsing logic; previously the code assumed a string
containing the letter 'x' was a mode string (eg. 640x480), which prevented
the parser from picking up a mode number (eg. 0x101).
2009-02-17 23:17:39 +00:00
jmcneill
c4cff68cbd Fix typo in genfb line 2009-02-16 23:40:14 +00:00
jmcneill
57d51ea339 Add and enable genfb(4), and remove vesafb(4) section. 2009-02-16 22:43:47 +00:00
jmcneill
c6d7607b67 Bootloader modifications for generic framebuffer console support on i386
and amd64 where VESA VBE 2.0+ is available.

* Add helper library and stubs to invoke VBE bioscalls.
* Bump HEAP_START as we were already dangerously close to our limits.
* bootdataseg now allows access > 16MB so in the future we can scribble
  on the framebuffer.
* Pass BTINFO_FRAMEBUFFER parameters to kernel when configured.
* VBE modes are configured with the new 'vesa' command. Usage, when present:
    * vesa {enabled|disabled}
      Enable / disable linear framebuffer, default mode is 640x480x8. May
      be changed in the future to determine mode based on VBE/DDC where
      available.
    * vesa list
      List modes supported by the firmware that meet the following criteria:
	* linear framebuffer
	* packed pixel or direct colour mode
    * vesa {modenum|modestr}
      Enable specific VBE mode. The mode can be specified either as a
      VBE mode number (eg. 0x101) or as a string (eg. 800x600x16).
2009-02-16 22:39:30 +00:00
cube
ec543a2ce5 Convert the recently introduced awk command to retrieve the value of the
option MODULAR to using %MODULAR%.  While it is now possible to only
request the new version in the affected Makefiles, it is made mandatory for
everybody because I just fixed a bug in config(1) that would not make it
fail in the case of a syntax error in the Makefile template.
2009-02-15 01:58:01 +00:00
jmcneill
1ead3177d3 Add genfb(4) 2009-02-14 22:13:22 +00:00
cube
df0059e2e8 Don't set version deep in the source tree if it's older than the one in
conf/files.
2009-02-14 20:22:59 +00:00
apb
6c4fc39a9f Now that "options MODULAR" is handled via defflag, the Makefile
generated by config(1) in the kernel compile directory no longer
contains IDENT=-DMODULAR.  Instead, there's an opt_modular.h file that
might or might not contain "#define MODULAR 1".

Adapt to this by adding an OPT_MODULAR variable to relevant Makefiles,
set via an awk script that parses opt_modular.h.
2009-02-14 16:53:55 +00:00
abs
515e52158b Convert more MACHINE tests to MACHINE_ARCH 2009-02-14 13:50:50 +00:00
apb
0cc72e51ac Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.
2009-02-13 22:41:00 +00:00
bouyer
24584a19d8 Add commented out PCI pass-through support:
#xpci* at xenbus ?                      #Xen3 PCI front end driver
#pci* at xpci ?
2009-02-13 21:18:43 +00:00
bouyer
97f5912f84 Add kernel config file for i386PAE dom0 kernel. 2009-02-13 21:14:46 +00:00
bouyer
40dab4ba52 Prepare for PCI frontend support in Xen3 domUs:
call x86_bus_space_init() and x86_bus_space_mallocok() if we have ISA or PCI
  devices configured; not only for non-Xen or dom0 Xen
On Xen, always call PHYSDEVOP_SET_IOPL on context switch
on amd64, also call PHYSDEVOP_SET_IOPL from x86_64_proc0_tss_ldt_init()
2009-02-13 20:42:24 +00:00
jnemeth
dd808e2b11 PR/40608 - Gao Ya'nan -- typo in comment 2009-02-11 07:24:40 +00:00
mrg
9bd6af36c2 move COMPAT_50 into MONOLITHIC, as pointed out by enami@. 2009-02-07 09:58:10 +00:00
jym
92ae85d18e Changes to MEMORY_RBFLAGS option:
- renamed to MEMORY_DISK_RBFLAGS to better fit the rest of the
MEMORY_DISK options(4)
- change default value to RB_AUTOBOOT instead of RB_SINGLE, and adapt
the config(5) files accordingly
- document this option inside options(4)

See also http://mail-index.netbsd.org/tech-kern/2008/12/25/msg003924.html

Reviewed by abs@ in private mail.
2009-02-06 18:50:26 +00:00
dyoung
758cabb9ef When elansc(4) is detached, restore BIOS settings on the SC520's
programmable interrupt controller (PIC).
2009-02-06 01:40:36 +00:00
dyoung
7d8d7e5e0f So that I can both detach and *re-attach* elanpar0, elanpex0, and
gpio0, let elansc(4) rescan for them.
2009-02-06 01:38:28 +00:00
dyoung
2c4e9d51df Explicitly initialize mem_cluster_cnt to 0 for my peace of mind. 2009-02-05 22:26:53 +00:00
christos
29358e4ac0 don't clear the screen unconditionally. Now controlled by an option.
Thanks enami
2009-01-30 14:09:44 +00:00
ad
12cbb1b52b Enable BUFQ_PRIOCSCAN by default. 2009-01-29 21:48:13 +00:00
christos
e5b8d3235c remove extra variable 2009-01-27 22:00:12 +00:00
christos
decf940784 factor out common reset code. 2009-01-27 21:59:24 +00:00
ad
454c144aec Make previous compile. 2009-01-27 21:13:57 +00:00
christos
55113bafff Attempt to force resets using two more methods:
1. Reset Control register at I/O port 0xcf9
2. Fast A20 and Init register at I/O port 0x92

Requested by ad@
2009-01-27 16:13:13 +00:00
rmind
6d73ddd355 Revert path of modules back to "/stand". 2009-01-24 22:14:44 +00:00
cegger
3334d8c83e add bwi(4) 2009-01-24 15:49:14 +00:00
haad
7c83fa3718 Add dm driver to ALL kernel. 2009-01-24 14:19:04 +00:00
cegger
e7239fcd13 add age(4) and atphy(4).
Requested by cube@
2009-01-24 14:11:07 +00:00
mrg
c6a4afa995 add COMPAT_50 to all the configs with COMPAT_40. 2009-01-24 05:06:05 +00:00
rmind
f0e51651e4 Change path to kernel modules from "/stand" to "/kernel".
Needs to go in before 5.0.  Proposed on <tech-kern>.
2009-01-24 00:29:12 +00:00