Commit Graph

99922 Commits

Author SHA1 Message Date
tsutsui
e54edb5bbb Include <sys/evcnt.h> instead of <sys/device.h> for struct evcnt
to avoid recursive dependency.
2009-04-10 13:29:30 +00:00
mlelstv
485e52e2b3 attach and detach do not mix.
Create a new detach function that calls the parent function after
dealing with the private instance counter.
2009-04-10 10:18:50 +00:00
yamt
63d0089e0e - tmpfs_dir_lookup: simplify.
- add some assertions.
2009-04-10 03:40:05 +00:00
sborrill
e53eaac0d8 Add missing cpu.h include required by last commit. 2009-04-09 10:56:41 +00:00
tsutsui
773d1cf3d7 Include <sys/evcnt.h> instead of <sys/device.h> for struct evcnt
to avoid recursive dependency (though news68k has not been switched
to using intr evcnt yet).
2009-04-09 10:48:22 +00:00
tsutsui
997f95acb2 Include <sys/evcnt.h> instead of <sys/device.h> for struct evcnt.
<sys/device.h> now requires <sys/mutex.h> for struct device_lock, and
<machine/mutex.h> requires <machine/intr.h> for ipl_cookie_t, so
including <sys/device.h> from <machine/intr.h> causes recursive dependency.
2009-04-09 10:29:09 +00:00
pooka
6d35065877 * create only one vnode per inode
* add locking
2009-04-09 09:56:30 +00:00
pooka
42ca2fba4f VOP_CLOSE in error branches 2009-04-09 07:55:55 +00:00
yamt
bdeb01233f 0 -> NULL 2009-04-09 00:57:15 +00:00
yamt
e29a551d79 remove an unnecessary cast. 2009-04-09 00:44:32 +00:00
yamt
a227a1194c sonewconn: add an assertion. 2009-04-09 00:43:38 +00:00
yamt
2c68552273 0 -> NULL where appropriate 2009-04-09 00:37:32 +00:00
yamt
fbdf448a6a comments 2009-04-09 00:34:44 +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
ad
48320d4cd3 soo_ioctl:
- cosmetic change after merge of socket locking patch.
- add a comment.
2009-04-08 21:02:09 +00:00
ad
9635fa6829 Patch out soo_drain until I fix it to work correctly. 2009-04-08 20:58:40 +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
joerg
892f4bbba1 sprintf -> snprintf 2009-04-08 12:39:27 +00:00
dyoung
222f7adf37 Refactor slightly to create acpi_rescan(), a hook for rescanning the
devices that attach at acpi(4).

Begin deriving an acpi(4) device-detachment hook, acpi_detach(), from
acpi_attach().  The code between #if 0 and #endif still needs to be
turned to the opposite calls (enables to disables, maps to unmaps,
attaches to detaches), which should be run in the opposite order.
Somebody with deep ACPI knowledge can probably finish this off without
too much trouble.
2009-04-08 00:23:30 +00:00
dyoung
5b0576e7eb Add acpitimer_detach() to eventually support acpi(4) detachment. 2009-04-08 00:15:45 +00:00
dyoung
99084a32b0 Decrease midi_pcppi_attached when midi at pcppi detaches. 2009-04-08 00:12:27 +00:00
dyoung
1de2a73134 Make pcppi(4) detach the "speaker" from attimer(4), so that the
corresponding attimer(4) resource is not perpetually busy: now it
is possible to detach and to reattach pcppi(4).  Make attimer(4)'s
device-detachment hook return EBUSY if pcppi(4) is still attached, so
that pcppi(4) cannot end up with a dangling pointer to attimer(4).
2009-04-07 22:30:09 +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
3afac3e189 Fix spelling: mak -> make. 2009-04-07 21:49:36 +00:00
dyoung
00644496f7 Fix spelling: indrect -> indirect. 2009-04-07 21:48:46 +00:00
dyoung
20d48b47c0 When ipmi0 detaches, free all of the ipmi_sensor's on the (global!)
ipmi_sensor_list.
2009-04-07 21:47:58 +00:00
dyoung
deeb71246e In ipmi_detach(), don't sysmon_envsys_destroy(), but just _unregister():
_unregister() calls _destroy().
2009-04-07 21:00:30 +00:00
msaitoh
eb993d20f8 Reload sc_ctrl in wm_reset().
Add an ICH10 entry.

Remove some obsolete comments.
2009-04-07 18:42:30 +00:00
msaitoh
e1c695ebf8 regen 2009-04-07 18:41:06 +00:00
msaitoh
0712fe9fe0 add 82801J_D_BM_LF (ICH10) 2009-04-07 18:40:39 +00:00
pooka
291176ecc3 Make it possible to use VCHR devices again. 2009-04-07 18:35:49 +00:00
dyoung
3098a4fbed Detach atapibus(4), scsibus(4), cd(4), and sd(4) during shutdown.
Destroy sd->sc_callout in sddetach().  Delete some dead code in
cddetach().
2009-04-07 18:35:17 +00:00
pooka
47c972421f Fix typo that slipped in a while ago. Fixes non-file mounts. 2009-04-07 18:34:18 +00:00
dyoung
18789e2def Detach midi at pcppi during shutdown. Sprinkle static. 2009-04-07 18:31:12 +00:00
dyoung
b429c26fd3 Detach ehci(4) and uhci(4) at shutdown. 2009-04-07 18:25:26 +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
msaitoh
c52bc69c89 Fix about TBI mode. This fix doesn't influence MII mode.
- Fix SWDPIN(1)'s polarity on some chips.
 - Fix flow control stuff (includes PR#32009).
 - Stop RXCFG storm. It ocours easily.
 - And more fix about autonego.

Tested on PRO/1000F, PRO/1000XF and PRO/1000 MF.
2009-04-07 18:23:37 +00:00
msaitoh
0855c70d27 Fix about TBI mode. This fix doesn't influence MII mode.
- Fix panic in mediachange.
 - Fix SWDPIN(1)'s polarity on some chips.
 - Fix flow control stuff (includes PR#32009).
 - Stop RXCFG storm. It ocours easily.
 - And more fix about autonego.

Tested on PRO/1000F, PRO/1000XF and PRO/1000 MF.
2009-04-07 18:23:36 +00:00
dyoung
0873e7f203 Cosmetic: join lines. 2009-04-07 18:16:28 +00:00
dyoung
227c03169a Detach uhub(4) and usb(4) at shutdown. 2009-04-07 18:15:45 +00:00
dyoung
2e264f4086 Destroy a scsipi_xfer's callout before putting it back into the pool. 2009-04-07 18:10:45 +00:00
dyoung
f26cbc49c7 Destroy sc->bnx_timeout in bnx_detach(). 2009-04-07 18:07:10 +00:00
dyoung
63a5e91969 Detach brgphy(4) at shutdown. 2009-04-07 18:05:54 +00:00
dyoung
03c2f978e8 In mii_phy_detach(), destroy the NWay callout. 2009-04-07 18:05:02 +00:00
dyoung
336480339e Cosmetic: remove some dead code. 2009-04-07 18:02:04 +00:00
dyoung
29e95e3d5f Cosmetic: flag a potential problem in ata_channel_attach():
it initializes a callout that does not appear to be destroyed
anywhere. Every callout_init() should ordinarily be matched by a
callout_destroy().
2009-04-07 18:01:20 +00:00
dyoung
1fb1e79dd5 During shutdown, detach attimer at acpi. 2009-04-07 17:59:18 +00:00
dyoung
2df4d68fc5 Declare mididetach() for use by midi0 at pcppi0. 2009-04-07 17:55:55 +00:00
dyoung
6a72962b6c Cosmetic: in a debug statement, use "%s", __func__ instead of a
misspelling of the detach routine's name.
2009-04-07 17:54:58 +00:00
dyoung
f346073f7d Add a device-detachment hook for ipmi(4). 2009-04-07 17:53:45 +00:00
dyoung
ead00d401c Detach pchb(4) instances at shutdown. 2009-04-07 17:52:36 +00:00
dyoung
1a38ae4257 Detach sysbeep0 at shutdown. 2009-04-07 17:51:46 +00:00
stacktic
ea41759011 Add Realtek ALC663 and treat like ALC662 (ok pooka@) 2009-04-07 14:47:53 +00:00
tsutsui
3d4412216c Explicitly pass a specific buffer length to format_bytes() to
make it print memory sizes in humanized readable digits.
2009-04-07 10:49:54 +00:00
haad
ba7fcfeeb5 Use functions from disk(9) framework. Initialize disk/disklabel during
dm_device_create_ioctl, before calling dmgetdisklabel.
Use disk_busy/disk_unbusy in dmstrategy to display LVM LV's in iostat
output.
2009-04-06 22:58:10 +00:00
haad
57fb98e3bf Fix build on amd64. Patch sent by dieter roelants. 2009-04-06 22:48:26 +00:00
dyoung
ac5f968c78 Fix spelling. 2009-04-06 21:22:47 +00:00
pooka
e9d1ffe915 compile in snapshot code 2009-04-06 20:46:44 +00:00
pooka
eafbd6f42b let drivers define DPRINTF 2009-04-06 20:41:29 +00:00
pooka
3099e2e65e In case using mmio, use windowing instead of trying to map the
entire image.

Benefits:
  * the whole image does not need to fit into VA
  * a core dump is not of gargantuan proportions

Performance is pretty close to one whopping mmap.  I'll finetune
the parameters later, although the current ones seem pretty good
in initial testing.
2009-04-06 20:40:33 +00:00
mkirby
ff12b9febc Add a Czech (QWERTY) keyboard layout, and teach wscons about latin 2 characters.
Original code from Lubomir Kundrak, adapted to current and cleaned up by me.

Fixes PR kern/16216

ok agc@ jdc@
2009-04-06 17:32:09 +00:00
pooka
556e6e2b6b Fix reference leak in fix for PR kern/40948.
Pointed out by David Holland.
2009-04-06 14:09:57 +00:00
tsutsui
0f492f906e assym.fth.h also requires sparc symlink. Fix build without DESTDIR. 2009-04-06 12:43:26 +00:00
dholland
c9388f6666 Fix broken build from missing comma. (HI CHRISTOS!!) 2009-04-05 21:19:37 +00:00
christos
568f8242aa PR/41144: ntpd dies when syncing, use octal format to avoid \xcCLOCK to be
parsed as \xcc
2009-04-05 19:59:26 +00:00
bouyer
f8059f7e67 m_split0(): If the newly allocated mbuf holds only the header,
don't forget to set m_len to 0. Otherwise whatever will compute the size
of this chain (including s_split() itself if called again on this chain)
will get it wrong, leading to various issues.

Bug exposed by the NFS server code with linux clients using TCP mounts.
2009-04-05 16:31:21 +00:00
pooka
f505490c8d Invariants should be tested for with KASSERT instead of semi-pretending
that them not holding is an acceptable error condition.
2009-04-05 15:10:41 +00:00
lukem
2b2f4703f2 fix sign-compare issues 2009-04-05 11:48:02 +00:00
cegger
56ce1b94f8 buildfix: include <sys/device.h> for device_t 2009-04-05 09:56:16 +00:00
cegger
b61989a8ff buildfix: include <sys/selinfo.h> for struct selinfo. 2009-04-05 08:33:04 +00:00
uwe
6a2ffc8f1b Provide pmf(9) hooks that do what dopowerhooks(9) hook does.
XXX: Do NOT call pmf_class_network_register() yet, b/c db8320.c
doesn't provide if_stop method!
2009-04-05 03:37:07 +00:00
uwe
4e37bb5a9c Register with pmf(9), tell it we don't need anything. 2009-04-05 02:29:40 +00:00
uwe
c7b2923b5e Register null hooks with pmf(9) for now, which is no worse than before
and allows us to test other things.  Power management is still done
via CONFIG_HOOK_POWERCONTROL_LCD.
2009-04-05 02:23:00 +00:00
uwe
620a6f25ea Register with pmf(9), tell it we don't need anything. 2009-04-05 02:18:59 +00:00
uwe
b22b1f73c6 Register with pmf(9), tell it we don't need anything. 2009-04-05 02:17:18 +00:00
uwe
fd239c627a Register with pmf(9). Thus we register with both dopowerhooks(9) and
pmf(9), but they are mutually exclusive (apm(4) vs apmdev(4)).

Express pmf(9) hooks in terms of dopowerhooks(9) hook - the reverse
would be more natural, but pmf hook signature is hidden behind
PMF_FN_ARGS/PMF_FN_CALL, so just go the least intrusive way for now.
2009-04-05 02:14:41 +00:00
uwe
2ec6410a85 Register with pmf(9), tell it we don't need anything. 2009-04-05 02:04:40 +00:00
uwe
12a9718711 Split device_t and softc. 2009-04-05 01:48:47 +00:00
tsutsui
0f22466110 Use #define<tab> consistently. 2009-04-05 00:57:56 +00:00
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
fe0f5148ae Register with pmf(9), tell it we don't need anything.
btnmgr(4) is just a hub for other devices to plug into with
config_hook(9), there is no real hardware to manage.
2009-04-05 00:34:42 +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
ddf65d893c Update the big comment block. 2009-04-04 22:34:03 +00:00
joerg
3cb902383f Allow querying for root devices in the tree by specifying an empty
device name. Ensure that l_devname is NUL-terminated and fail otherwise.
OK cube@
2009-04-04 21:49:05 +00:00
bouyer
0c046062f0 Fix another typo 2009-04-04 15:53:49 +00:00
bouyer
11abca258d Fix a comment, and make it build. 2009-04-04 15:47:28 +00:00
bouyer
7f8c56170f Fixes from Masao Uebayashi 2009-04-04 15:31:47 +00:00
ad
95e4ccac55 +__HAVE_UFS2_BOOT 2009-04-04 10:36:08 +00:00
ad
2f5f36b538 Turn up the volume on the warning message a bit. 2009-04-04 10:33:59 +00:00
ad
4c75d20cd4 Turn up the volume on the warning message a bit and note that unionfs can
corrupt the underlying file system. This is an old problem but is now
much easier to trigger because VFS has gone fully multithreaded.
2009-04-04 10:32:49 +00:00
ad
bf1b2693f2 5.99.10 struct fileops changed for f_drain. I have added a couple of spares. 2009-04-04 10:13:30 +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
bouyer
1fd1b49685 Fix for if_start() and pfil_hook() being called from hardware interrupt
context (reported on various mailing-lists, and part of PR kern/41114,
causing panic in pf(4) and possibly ipf(4) when BRIDGE_IPF is used).
Defer bridge_forward() to a software interrupt; bridge_input() enqueues
mbufs to ifp->if_snd which is handled in bridge_forward().
2009-04-04 10:00:23 +00:00
ad
481ff5ace4 Fix problems with ccd:
- Pending async I/O was tossed on unconfigure (should not happen, but..)
- It could exhaust memory under heavy I/O load.
- If memory allocation failed, disk transfers could stall.
- v_numoutput was updated without v_interlock held.

Additionally:

- Make it MPSAFE.
- Use kmem_alloc().
2009-04-04 08:29:39 +00:00
ad
4307e10df2 Add disk_isbusy(), iostat_isbusy(). 2009-04-04 07:30:09 +00:00
dyoung
211e21b653 Stop dereferencing a dangling device_t pointer and crashing: skip the
drives flagged DRIVE_ATAPI in atabus_activate(,DVACT_DEACTIVATE) just as
we skip them in atabus_detach() and in atabus_childdetched().

Make atabus_detach() parallel attachment more closely by calling
config_detach() on the child chp->ata_drives[i] instead of on
chp->ch_drive[i].drv_softc.  Assert that ata_drives[i] and
ch_drive[i].drv_softc are equal, and set them both to NULL in
atabus_childdetached().
2009-04-03 21:31:08 +00:00
ad
117500b9b2 workqueue_finiqueue: our stack could be swapped out while enqueued to
a worker thread.
2009-04-03 19:34:19 +00:00
sborrill
5547ed1734 Switch various printfs from %ld and %d to PRIu64, etc. to be more consistent
about types (for instance uint32_t was being printed with %d).
2009-04-03 16:23:41 +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
pooka
bb78ae5d1b Fix yet another recent crashy bug in tmpfs rename: since the source
dirent is no longer cached in lookup and we do the lookup ourselves
in rename, we are most definitely not allowed to assert that it
matches the source vnode passed as an argument.  In case the source
node does not exist or has been replaced, punt with ENOENT.

Also, nuke some misleading prehistoric comments which haven't been
valid in over a year.

Fixes PR kern/41128 by Nicolas Joly
2009-04-03 14:47:40 +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
30f9f983a3 Use dev/apm/files.apm for APM options in opt_apm.h.
Now both apm and apmdev files.apm can be included so you can switch
from apmdev0 to apm0 at hpcapm0 in your kernel config easily.
2009-04-03 05:01:09 +00:00
uwe
82442fe367 Treat OAPM_IOC_GETPOWER as APM_IOC_GETPOWER - from apmdev(4). 2009-04-03 04:25:40 +00:00
uwe
c03d662b39 Config glue for attaching apm at apmdevif.
Unfortunately dev/apm/files.apm and dev/hpc/apm/files.apm cannot be
included both at the same time (they define same options and config(1)
complains), so you need to comment out old code and uncomment new code
to be able to replace "apmdev0 at hpcapm0" with "apm0 at hpcapm0" in
your kernel config.
2009-04-03 04:21:51 +00:00
uwe
ea06597b80 Attachment glue to attach apm0 at hpcapm0.
Tested on Jornada 690.
2009-04-03 04:17:03 +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
uwe
7cbde2c0d5 Further reduce diffs to dev/apm/apm.c.
Bring over remaining bits of logic not picked up in the first round.
Main semantic difference between the two that ramins is now basically
powerhooks vs. pmf.

Cosmetics to reduce diff noise: split apmattach into apmdevattach and
apm_attach, where the latter matches its counterpart in the real
apm.c.  Change local macros names from APMDEV* to APM*

Now that apmdev.c is demonstrably congruent to apm.c it should be
easier to switch hpc* and zaurus ports to apm.c from apmdev.c.
apmdev.c is one of the only two remaining drivers that call
dopowerhooks(9), the other one being arch/arm/xscale/pxa2x0_apm.c.

Ideally I would prefer for them to be interchangeable to smooth the
transition (in pmf world order *all* devices must have pmf hooks
registered), but they are attached differently - apmdev is separate
from its backend device (like hpcapm), while apm.c backends are
attachment glue, not separate devices.
2009-04-03 02:08:38 +00:00
dyoung
8f20e30696 Fix SIOCSIFFLAGS. Mark as safe to detach at shutdown. 2009-04-03 00:14:42 +00:00
dyoung
e5320b0a17 Take out a noisy debug statement that slipped in with device-detachment
at shutdown.
2009-04-02 22:19:48 +00:00
christos
af069eb3c7 Centralize the ROUNDUP and ADVANCE macro in a header file, give them an
RT_ prefix and use them appropriately, instead of making copies. Make
pppd use the RT_ROUNDUP macro; fixes proxyarp setting on 64 bit hosts.

XXX: All this should be pulled up to 5.0
2009-04-02 21:02:06 +00:00
ad
bbb900dedf banner: fix a minor bug. 2009-04-02 19:43:11 +00:00
drochner
eb4f9278bc In humanize_number(), avoid an integer overflow if the buffer
provided is "too large" (log10(2^64) = 19).
(It can still overflow if the input value is close to 2^64 but I don't
consider this a problem.)
fixes nonsense displayed as "total memory" on boot
2009-04-02 17:25:24 +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
pooka
095a7dd3b6 Release tdvp in an appropriate VOP_RENAME error branch to avoid
panic described in PR kern/40948.

As usual, all the error branches in rename live based on an unholy
amalgamation of prayer and the blood of cute, furry and tasty
quadrupeds, so I won't even attempt to audit the rest.

And this wapbl rename really really needs to be merged with the
standard rename.  That should be a fun PhD thesis topic ....
2009-04-02 11:33:04 +00:00
dyoung
30156f20e6 Cosmetic changes, only, to clarify and to save a couple of lines: return
a constant, 0, instead of returning ret when it is always 0.  Wait to
initialize ret until we really need to.
2009-04-02 01:06:49 +00:00
dyoung
b783d8bd8c Add the WEP capability to our net80211 capability flags, since we do
sort of support hardware WEP.  Only change the WEP key index in a Tx
descriptor from 0 if the type of our transmit key is _WEP, not _TKIP:
i.e., only if we're really doing WEP crypto in the hardware.

Ignore a watchdog timeout on any Tx ring if we can collect some packets
from that ring.  Restart both the receiver and the transmitter when a
watchdog timeout occurs instead of restarting only the transmitter.
2009-04-02 00:57:20 +00:00
dyoung
726f95dae4 I find myself making a lot of changes in this code to keep it compiling
and (let us hope) working in the 21st century, so I have put it through
unifdef -D__NetBSD__ -U__FreeBSD__ so that it is less of a chore to read
and to maintain.
2009-04-02 00:39:37 +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
darran
49d3640ae0 Also inherit the parent's TCP segmentation offload capability.
Note the vlan interface does not see updates to the parents capabilities
so if, for example, TSO is on in both, then turned off in the parent it
will remain on in the vlan interface.
2009-04-01 22:56:59 +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
christos
802d07dbca cast segsz to int. 2009-04-01 21:15:23 +00:00
perry
0e8e3df5ff More reproducible build fixes:
1) invoke objcopy with --preserve-dates or it will update all the
   dates in the .a file to the present date.
2) add an invocation of ar-as-ranlib or the object file index ends up
   with the date in it. (it might also end up with an incorrect
   index.)
2009-04-01 17:51:12 +00:00
pooka
c675da1b5a Be less verbose. (something like rump_dmesg with optional QUIET
would be nice, but needs work)
2009-04-01 14:37:00 +00:00
reinoud
42726265fe Implement MMC_TRACKINFO_DATA and MMC_TRACKINFO_AUDIO detection for cdrom and
dvdrom devices. These two compatibility codes were forgotten when those were
introduced.
2009-04-01 12:19:04 +00:00
lukem
e8c7343395 fix sign-compare issue 2009-04-01 10:17:04 +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
dogcow
36ffab86d9 fix what looks like a mechanical stuffup in the timeval -> timespec conversion. 2009-04-01 03:06:06 +00:00
rmind
f8a1f87074 Sync with recent i386/amd64 source merges - fix Xen builds. 2009-03-31 20:12:19 +00:00
dyoung
d0947ed2de Also look for sources in sys/arch/x86/x86/ if MACHINE_ARCH is i386 or
x86_64.
2009-03-31 18:41:40 +00:00
drochner
0785c6f16e avoid tsleep also during shutdown (and in particular ACPI poweroff),
should fix PR kern/39141 by Takahiro Kambe and PR port-i386/41110
by Reinoud Zandijk
2009-03-31 17:17:47 +00:00
reinoud
49f0ea0bd0 KGDB does no longer refers to ddb/db_access. Fixes compilation problems of KGDB
kernels.
2009-03-31 15:50:45 +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
darran
d4dd9a671a Missed a small but important change to enable hardware VLAN support. 2009-03-31 06:58:55 +00:00
cegger
456f7ba595 buildfix: NEW_VMCMD(2 -> NEW_VMCMD2( 2009-03-31 06:03:31 +00:00
darran
0b4bf6c76b Enable the vlan code that thorpej@NetBSD.org added, and fix a bug where
the vlan tag was read from the rx descriptor after it was reinitialized
(and hence was always 0).  Hardware vlan support looks good tested
between two vmware clients.
With support from tls@NetBSD.org.
2009-03-31 04:16:57 +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
christos
b5c4aec40f fix erroneously deleted assignment. 2009-03-30 22:22:44 +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
yamt
197e2d1b30 ARRAY_PRINT: 0 is a valid index. 2009-03-30 16:38:05 +00:00
yamt
cccbca027b g/c uvm_aiobuf_pool. 2009-03-30 16:36:36 +00:00
perry
92ec9dc66a Add a MKREPRO variable (defaults to "no") that invokes newvers.sh with
the -r flag if it is set to "yes", resulting in a reproducible kernel build.
2009-03-30 16:34:19 +00:00
perry
b30c3a7aac Add a -r option that produces a version string without the time or kernel
build number in it. This will be used for reproducible builds.
2009-03-30 16:29:55 +00:00
christos
a329e3090a we want microuptime too. 2009-03-30 12:47:49 +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
uwe
1cfa6cdc4e Split device_t and softc, use aprint_*, rename/reformat stuff to
minimize diffs to dev/apm/apm.c (even at the cost of uglification).

Tested on Jornada 690 (hpcsh).
2009-03-30 06:22:25 +00:00
uwe
e4d63225a1 Fix battery_state vs. battery_flags confusion.
Fill all fields of struct apm_power_info in hpcapm_get_powstat.
2009-03-30 06:17:39 +00:00
christos
e556421085 need getnanouptime not getmicrouptime 2009-03-30 02:01:09 +00:00
mrg
64b0361105 apply from sys/dev:
revision 1.17
date: 2009/03/29 19:50:17;  author: mrg;  state: Exp;  lines: +7 -7
drm_addmap():
- for _DRM_CONSISTENT mappings, keep the handle.
- use DRM_HANDLE_NEEDS_MASK()

drm_mapbufs():
- use DRM_HANDLE_NEEDS_MASK()

drm_mmap():
- use DRM_HANDLE_NEEDS_MASK()
- for _DRM_SCATTER_GATHER and _DRM_SHM, use vtophys() on the
  adjusted offset. XXX

this is gets radeon working on amd64 with an older PCI 9250 card.

XXX: need to excise vtophys() usage.
XXX: need to finish porting these fixes to external.


yay!  this takes care of one of the XXX's.  still not quite working.
2009-03-30 01:51:40 +00:00
mrg
f70233658c XXX: drm_close_pid() went away, and the hack i tried to avoid it
XXX: ended up looping forever.  replace it with a hack that doesn't
XXX: hang the system.
2009-03-30 01:48:31 +00:00
mrg
d28a4dfebd - set dev->device to the device_t
- fix a DEBUG message
- apply from sys/dev:
revision 1.20
date: 2009/01/18 10:04:35;  author: mrg;  state: Exp;  lines: +6 -2
Don't attempt to unload a DRM device that's in use.  (Note:
Unloading doesn't work right in any case -- it doesn't clean up the
sysctl tree, among other things.  This code needs Work, but at least
this prevents it crashing randomly due to autounload while X is
running.)  Also, fix the dependency list for radeondrm.

contributed anonymously.
2009-03-30 01:47:36 +00:00
mrg
881136fdf4 apply from sys/dev:
revision 1.11
date: 2009/03/29 19:50:17;  author: mrg;  state: Exp;  lines: +9 -6
drm_addmap():
- for _DRM_CONSISTENT mappings, keep the handle.
- use DRM_HANDLE_NEEDS_MASK()

drm_mapbufs():
- use DRM_HANDLE_NEEDS_MASK()

drm_mmap():
- use DRM_HANDLE_NEEDS_MASK()
- for _DRM_SCATTER_GATHER and _DRM_SHM, use vtophys() on the
  adjusted offset. XXX

this is gets radeon working on amd64 with an older PCI 9250 card.

XXX: need to excise vtophys() usage.
XXX: need to finish porting these fixes to external.



however, this doesn't get radeon working on amd64 here :(
2009-03-30 01:45:41 +00:00
mrg
65df1447f7 - apply from sys/dev:
revision 1.14
date: 2009/03/29 19:39:10;  author: mrg;  state: Exp;  lines: +4 -3
include the size in a falled allocation message.

- use BUS_DMA_ALLOCNOW in bus_dmamap_create() call

- remove a redundant check for NULL
2009-03-30 01:44:41 +00:00
mrg
db9cd6b98c - apply from sys/dev:
revision 1.33
date: 2009/03/29 17:00:50;  author: mrg;  state: Exp;  lines: +12 -4
add a comment explaining DRM_NETBSD_ADDR2HANDLE/DRM_NETBSD_HANDLE2ADDR:

 * This hack strips the top bit from amd64 addresses, which avoid
 * udv_attach() returning NULL for "negative" offset.
 * A better hack would be to encode the offset of some kernel data
 * structure..

add a new DRM_HANDLE_NEEDS_MASK macro to check whether the above need to
be applied for various mapping types (_DRM_SHM and _DRM_SCATTER_GATHER.)


also:
- use IPL_VM for now
- use a lot of bus_space
- struct drm_device now has a pointer to the device_t
2009-03-30 01:42:20 +00:00
mrg
4d27c3c2b1 apply from sys/dev:
revision 1.12
date: 2009/03/29 19:37:25;  author: mrg;  state: Exp;  lines: +9 -3
XXX:  for now, add the DRM_NETBSD_HANDLE2ADDR() hack in a few places.
update a debug message.
2009-03-30 01:38:21 +00:00
christos
e475692a7c one more timeval -> timespec line 2009-03-30 00:31:59 +00:00
mrg
3d4337fb88 fix a device_t-ification. 2009-03-29 23:46:34 +00:00
christos
9d8b358050 Catch up with kernel changes 2009-03-29 20:59:17 +00:00
mrg
ac009d4632 drm_addmap():
- for _DRM_CONSISTENT mappings, keep the handle.
- use DRM_HANDLE_NEEDS_MASK()

drm_mapbufs():
- use DRM_HANDLE_NEEDS_MASK()

drm_mmap():
- use DRM_HANDLE_NEEDS_MASK()
- for _DRM_SCATTER_GATHER and _DRM_SHM, use vtophys() on the
  adjusted offset. XXX


this is gets radeon working on amd64 with an older PCI 9250 card.

XXX: need to excise vtophys() usage.
XXX: need to finish porting these fixes to external.
2009-03-29 19:50:17 +00:00
mrg
7216702ebd add a radeon-x1550 (works as well as other rv5xx i guess.) 2009-03-29 19:39:50 +00:00
mrg
44475ef083 include the size in a falled allocation message. 2009-03-29 19:39:10 +00:00
mrg
4d1ad63f2e XXX: for now, add the DRM_NETBSD_HANDLE2ADDR() hack in a few places.
update a debug message.
2009-03-29 19:37:25 +00:00
christos
2b1b4bc6ef Move the internal poll/select related API's to use timespec instead
of timeval (rides the uvm bump).
2009-03-29 19:21:19 +00:00
pooka
7e97c7f98e include subr_evcnt 2009-03-29 18:22:08 +00:00
pooka
ad23953a5a protect allevents list with a mutex 2009-03-29 18:21:06 +00:00
christos
6e1db6cea1 - use itimespecfix to detect invalid timespecs
- use tstohz instead of mstohz to prevent overflow.
2009-03-29 17:54:12 +00:00
mrg
dba4444474 delete COMPAT_43 that is now in GENERIC 2009-03-29 17:06:01 +00:00
mrg
b9bbc2157f add a comment explaining DRM_NETBSD_ADDR2HANDLE/DRM_NETBSD_HANDLE2ADDR:
* This hack strips the top bit from amd64 addresses, which avoid
 * udv_attach() returning NULL for "negative" offset.
 * A better hack would be to encode the offset of some kernel data
 * structure..

add a new DRM_HANDLE_NEEDS_MASK macro to check whether the above need to
be applied for various mapping types (_DRM_SHM and _DRM_SCATTER_GATHER.)
2009-03-29 17:00:50 +00:00
christos
94f59b4d43 PR/41094: Matteo Beccati: sigtimedwait returns EAGAIN instead of EINVAL if
timeout is invalid
2009-03-29 16:23:23 +00:00
msaitoh
60500a38d2 Add workaround for 82543GC.
We need to force speed and duplex on the MAC equal to what the PHY
speed and duplex configuration is. Fixes PR#36430.
2009-03-29 16:22:17 +00:00
ad
21caef1598 Unfuck compat some more 2009-03-29 15:45:08 +00:00
ad
5d4e966fd0 Remove debug code from previous. 2009-03-29 15:23:54 +00:00
pooka
c56f6fd76f remove entries which are done 2009-03-29 14:56:00 +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
f07d0eaa2d Add a cental banner() function to print the copyright and version info. 2009-03-29 10:58:28 +00:00
ad
f51a17bccf kernel memory guard for DEBUG kernels, proposed on tech-kern.
See kmem_alloc(9) for details.
2009-03-29 10:51:53 +00:00
ad
393ca6e076 fsync:
- atime updates were not being synced.

ffs_sync:

- In some cases the sync vnode was acting like now dead /usr/sbin/update.
  It was examining vnodes that it should have ignored.

- It would find dirty inodes and try to flush them. Often ffs_fsync()
  cheerfully ignored the flush request due to the fsync bug. Such inodes
  remained dirty and were repeatedly re-examined by the syncer until
  vnode reclaim or system shutdown.

- We were marking our place in the per-mount vnode list even though in
  most cases there was not flush to perform. While not a bug, this wasted
  CPU cycles because a TAILQ_NEXT would have sufficed.
2009-03-29 10:29:00 +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
pooka
2e346580a4 regen 2009-03-29 07:56:56 +00:00
pooka
2941a7af6e Include some headers to make rump_syscalls.h self-contained.
(not strictly correct wrt portability, but there are bigger fish
to saltgrill in that area)
2009-03-29 07:56:19 +00:00
tsutsui
2273829d51 Don't assume all RX packets have VLAN headers even if vlanif is configured.
Instead, always check ether_type and use appropriate offsets to adjust
the hardware RX sum value.

XXX: vlan(4) doesn't seem to use csum_data and csum_flags in mbufs anyway.
2009-03-29 07:33:52 +00:00
tsutsui
768601d6e6 Get width, height, and linebytes values from prom_getpropint(). 2009-03-29 07:24:56 +00:00
tsutsui
e6bb0dedbf Use <bsd.klinks.mk> to create machine and ${MACHINE_ARCH} symlinks. 2009-03-29 07:19:40 +00:00
dholland
3781289e95 Merge patch from PR 12605, which tidies up allocation of transmit DMA maps.
Generalize it to also tidy up allocation of receive DMA maps. And change a
few of the symbol names involved to (1) make sure all uses have been fixed
and (2) make it clearer what's actually going on.

Previously the driver was using DMA maps off the free list without fully
allocating them, apparently in order to save two or three lines releasing
them on error paths. According to the submitter of the PR (H.Saito) this
was causing it to reuse a map already in use when under load, resulting
in panics.

I'm not sure if that ought to have been possible or if it reflected an
interrupt handling bug somewhere else, but the change is an improvement
regardless, so we'll go with it.

Compile-tested only, but I've crosschecked the diffs and all that and it's
a pretty noninvasive change.

(Is anyone actually using this driver rather than tlp?)
2009-03-29 05:26:43 +00:00
rmind
be5c9950c6 kpsignal2: do not start process (when it is stopped) for all termination
signals (i.e. SA_KILL), just if SIGKILL (or SIGCONT).  Improve comments.

Make some functions static, remove unused sigrealloc() prototype.

Fixes PR/39814.  Similar patch reviewed by <ad>.
2009-03-29 05:02:46 +00:00
rmind
6b0e9f0301 fownsignal: pre-check for zero pgid, avoids locking of proc_lock. 2009-03-29 04:40:01 +00:00
mrg
49be05cbf6 5.99.9: struct vmspace grew a new member. 2009-03-29 01:12:22 +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