Commit Graph

41296 Commits

Author SHA1 Message Date
Hartmut Brandt
50b751a7d4 Make the driver to work with firmware version 4.1.12 (other 4.X.Y should
also do it). Three problems have been encountered:

1. The initialisation command does not work in interrupt mode. Whether
   this is a firmware bug or a feature is not clear. The original Fore
   drivers execute the initialize command always in polling mode, so
   it appears that this behaviour is expected. When we detect a 4.X.Y
   firmware do busy wait on the command status.

2. The command code of the GET_PROM command has changed. This is an
   unofficial command anyway. What was GET_PROM in 3.X.Y is CLEAR_STATS
   in 4.X.Y (although unimplemented in the firmware). We need to
   use the correct code depending on the firmware.

3. The 4.X.Y firmware can set the error flag in the command status
   without also setting the completion flag (as the documenation says).
   Check both variants.

An additional field in the per-card structure fu_ft4 is TRUE when we have
detected a 4.X.Y firmware. Otherwise it is false. The behaviour of the
driver when using a 3.X.Y firmware should be identical to the previous
behaviour.

This change will enable traffic shaping of (at least one) CBR channels.
2003-07-31 14:20:07 +00:00
Andrew Gallatin
251dee13f1 Make this compile on alpha. 2003-07-31 13:36:57 +00:00
Maxim Konovalov
e1bd2f381a o Fix a typo in previous commit. 2003-07-31 10:24:36 +00:00
Julian Elischer
1716a1af0d Have a go at unbreaking the tinderbox by fixing a debug printf.
The other option would be to remove it, but I can imagine it may be useful
for the forseeable future as we fiddle with segments in KSE and thr libraries,
2003-07-31 08:20:24 +00:00
Scott Long
e8d4f10982 Allocate the S/G list in the tag, not on the stack. The enforces the rule
that while many maps can exist and be loaded per tag, bus_dmamap_load() and
friends can only be called on one map at a time from the tag.  This is
enforced via the mutex arguments in the tag.

Fixing this bug means that s/g lists can be arbitrarily long in length, and
also removes an ugly GNU-ism from the code.  No API or ABI change is
incurred.  Similar changes for other platforms is forthcoming.
2003-07-31 05:34:20 +00:00
Marcel Moolenaar
5ba809ff66 In set_mcontext(), store the (user) stack pointer and the thread
pointer in the PCB of the corresponding thread if it's not the
current thread.  This is needed for thr_create() to setup the
newly created thread from the context provided by the application.

This commit finalizes supporting libthr.
2003-07-31 05:27:00 +00:00
Bosko Milekic
b053bc8407 Make sure that when the PV ENTRY zone is created in pmap, that it's
created not only with UMA_ZONE_VM but also with UMA_ZONE_NOFREE.  In
the i386 case in particular, the pmap code would hook a special
page allocation routine that allocated from kernel_map and not kmem_map,
and so when/if the pageout daemon drained the zones, it could actually
push out slabs from the PV ENTRY zone but call UMA's default page_free,
which resulted in pages allocated from kernel_map being freed to
kmem_map; bad.  kmem_free() ignores the return value of the
vm_map_delete and just returns.  I'm not sure what the exact
repercussions could be, but it doesn't look good.

In the PAE case on i386, we also set-up a zone in pmap, so be
conservative for now and make that zone also ZONE_NOFREE and
ZONE_VM.  Do this for the pmap zones for the other archs too,
although in some cases it may not be entirely necessarily.  We'd
rather be safe than sorry at this point.

Perhaps all UMA_ZONE_VM zones should by default be also
UMA_ZONE_NOFREE?

May fix some of silby's crashes on the PV ENTRY zone.
2003-07-31 03:39:51 +00:00
David Xu
dae8d52de5 Enhance i386_set_ldt to allow application to dynamic allocate
or free a LDT entry. The function has following prototype:
  int i386_set_ldt(int start_sel, union descriptor *descs, int num_sels);

Added Features:
o If start_sel is 0, num_sels is 1 and the descriptor pointed to by descs
  is legal, then i386_set_ldt() will allocate a descriptor and return its
  selector numbe

o If num_descs is 1, start_sels is valid, and descs is NULL, then
  i386_set_ldt() will free that descriptor (making it available to be real-
  located again later).

o If num_descs is 0, start_sels is 0 and descs is NULL then, as a special
  case, i386_set_ldt() will free all descriptors.

Reviewed by: julian
2003-07-31 02:11:04 +00:00
Alexander Kabaev
9cd4ad9c8f Bump __FreeBSD_version to indicate GCC 3.3.1-pre import.
Reminded by:	kris
2003-07-31 01:45:35 +00:00
Peter Wemm
aeaead20b8 When ktracing context switches, make sure we record involuntary switches.
Otherwise, when we get a evicted from the cpu, there is no record of it.
This is not a default ktrace flag.
2003-07-31 01:36:24 +00:00
Peter Wemm
ad7a226f9d Deal with 'options KSTACK_PAGES' being a global option. 2003-07-31 01:31:32 +00:00
Peter Wemm
aac6412bcd Cosmetic: fix some disorder of #include "opt_...." files 2003-07-31 01:29:09 +00:00
Peter Wemm
edc367db34 Remove leftover relic of pmap_new_thread() etc. 2003-07-31 01:28:41 +00:00
Peter Wemm
3950c40739 KSTACK_PAGES is a global option. 2003-07-31 01:27:18 +00:00
Peter Wemm
9fb1db7bc8 Cosmetic: fix disorder of opt_kstack_pages.h include. 2003-07-31 01:26:40 +00:00
Peter Wemm
15a7ad60fb Add #include "opt_kstack_pages.h" and "opt_kstack_max_pages.h" to remain
in sync with the backend machdep code.  When cpu_thread_init() does not
have the same idea of KSTACK_PAGES as the thing that created the kstack,
all hell breaks loose.

Bad alc! no cookie! :-)
2003-07-31 01:25:05 +00:00
Marcel Moolenaar
8b04492f2c In cpu_thread_setup(), set md_pcbpaddr to the physical address of
the pcb. We use the physical address for context switching.
While here, fix a nearby style(9) bug.
2003-07-31 01:05:34 +00:00
David Xu
1fc434dc9a Use correct signal when calling sigexit. 2003-07-30 23:11:37 +00:00
Pierre Beyssac
ae9fcf4c66 Remove test in pipe_write() which causes write(2) to return EAGAIN
on a non-blocking pipe in cases where select(2) returns the file
descriptor as ready for write. This in turns causes libc_r, for
one, to busy wait in such cases.

Note: it is a quick performance fix, a more complex fix might be
required in case this turns out to have unexpected side effects.

Reviewed by:	silby
MFC after:	3 days
2003-07-30 22:50:37 +00:00
Scott Long
cc2185305b Enforce -fno-strict-aliasing to override the converse that is implied by
-O2 and -Os.

Reviewed by:	peter
2003-07-30 22:11:36 +00:00
John Baldwin
cb075651f8 Whitespace nit. 2003-07-30 20:59:36 +00:00
John Baldwin
47b722c1af When complaining about a sleeping thread owning a mutex, display the
thread's pid to make debugging easier for people who don't want to have to
use the intended tool for these panics (witness).

Indirectly prodded by:	kris
2003-07-30 20:42:15 +00:00
Bruce Evans
1734c95cec Fixed style bugs in rev.1.94 before MFCing it (for large C asm statements,
use "\n\" instead of "\" at the end of each source line, and don't use
semicolons).  Fixed some older style bugs on the same lines (mainly
English errors in comments).
2003-07-30 20:16:04 +00:00
Andrew Gallatin
4c672cfa18 Make this at least compile on 64 bit platforms. Its been breaking
the alpha tinderbox for far too long.
2003-07-30 20:09:22 +00:00
Bosko Milekic
d56368d779 Plug a race and a leak in UMA.
1) The race has to do with zone destruction.  From the zone destructor we
   would lock the zone, set the working set size to 0, then unlock the zone,
   drain it, and then free the structure.  Within the window following the
   working-set-size set to 0 and unlocking of the zone and the point where
   in zone_drain we re-acquire the zone lock, the uma timer routine could
   have fired off and changed the working set size to something non-zero,
   thereby potentially preventing us from completely freeing slabs before
   destroying the zone (and thus leaking them).

2) The leak has to do with zone destruction as well.  When destroying a
   zone we would take care to free all the buckets cached in the zone, but
   although we would drain the pcpu cache buckets, we would not free them.
   This resulted in leaking a couple of bucket structures (512 bytes each)
   per cpu on SMP during zone destruction.

While I'm here, also silence GCC warnings by turning uma_slab_alloc()
from inline to real function.  It's too big to be an inline.

Reviewed by: JeffR
2003-07-30 18:55:15 +00:00
Alan Cox
93b4c5b707 The introduction of vm object locking has caused witness to reveal
a long-standing mistake in the way a portion of a pipe's KVA is
allocated.  Specifically, kmem_alloc_pageable() is inappropriate
for use in the "direct" case because it allows a preceding vm map entry
and vm object to be extended to support the new KVA allocation.
However, the direct case KVA allocation should not have a backing
vm object.  This is corrected by using kmem_alloc_nofault().

Submitted by:	tegge (with the above explanation by me)
2003-07-30 18:55:04 +00:00
Nate Lawson
a7985e4feb Use ACPI_FLUSH_CPU_CACHE() instead of wbinvd(). Verified .o with md5.
Pointed out by:	Mark Santcroos <marks@ripe.net>
2003-07-30 17:20:33 +00:00
Thomas Moestl
416c84a212 Return 1 from pmap_protect_tte() instead of 0. When used with
tsb_foreach(), 0 signals to terminate the tsb traversal, so when
tsb_foreach() was used in pmap_protect() (which only happens when
the area to be protected is larger than PMAP_TSB_THRESH = 16MB), only
the first tsb entry in the specified range would be protected.

Reported by:	Andrew Belashov <bel@orel.ru>
2003-07-30 16:27:51 +00:00
Nate Lawson
a329ebca91 Add and document the hw.acpi.ec.poll_timeout tunable. 2003-07-30 16:22:53 +00:00
Bosko Milekic
a40fdcb439 When generating the zone stats make sure to handle the master zone
("UMA Zone") carefully, because it does not have pcpu caches allocated
at all.  In the UP case, we did not catch this because one pcpu cache
is always allocated with the zone, but for the MP case, we were getting
bogus stats for this zone.

Tested by: Lukas Ertl <le@univie.ac.at>
2003-07-30 15:22:37 +00:00
Hartmut Brandt
539f18e4a4 Rearrange the vcc structure so that the generic getvcc function
can be used and add per-VC statistics.
2003-07-30 14:20:00 +00:00
Hartmut Brandt
6662c0c12e Rearrange the fields in the vcc table entry to fit to the requirements
of the generic getvcc function and used that function instead of the home
grown.
2003-07-30 11:32:42 +00:00
Hartmut Brandt
223e90573f Generate events when the carrier goes up or down.
Add two sysctl's that allow read-only access to the current
state of the utopia interface and to the carrier state.
2003-07-30 08:35:58 +00:00
Poul-Henning Kamp
7b4bd98ad5 Remove the disabling of buckets workaround.
Thanks to:	jeffr
2003-07-30 07:50:19 +00:00
Marcel Moolenaar
c9085788f6 In get_mcontext(), if we need to clear the return value, clear
FRAME_A3 as well. Otherwise swapcontext() will return -1.
2003-07-30 06:38:35 +00:00
Jeff Roberson
f828e5bedb - Get rid of the ill-conceived uz_cachefree member of uma_zone.
- In sysctl_vm_zone use the per cpu locks to read the current cache
   statistics this makes them more accurate while under heavy load.

Submitted by:	tegge
2003-07-30 05:59:17 +00:00
Jeff Roberson
d11e0ba565 - Check to see if we need a slab prior to allocating one. Failure to do
so not only wastes memory but it can also cause a leak in zones that
   will be destroyed later.  The problem is that the slab allocation code
   places newly created slabs on the partially allocated list because it
   assumes that the caller will actually allocate some memory from it.
   Failure to do so places an otherwise free slab on the partial slab list
   where we wont find it later in zone_drain().

Continuously prodded to fix by:	phk (Thanks)
2003-07-30 05:42:55 +00:00
Peter Wemm
f3d3771beb Detour via (void *) to defeat gcc's strict-aliasing warnings when using
-O2 or -Os (such as 'make release').

This commit brought to you by the warning:
  dereferencing type-punned pointer will break strict-aliasing rules
2003-07-30 00:04:58 +00:00
Poul-Henning Kamp
0c32d97ab5 Temporary workaround: Always disable buckets, there is a bug there
somewhere.

JeffR will look at this as soon as he has time.

OK'ed by:	jeffr
2003-07-29 22:07:10 +00:00
Bruce Evans
f52ecc3346 Restored clearing of the bss, except for putting it in a correct place
with up to date comments.  This fixes booting kernels with boot2
(except for loss of the features provided by loader) and is suitable
for MFC.  Contrary to the old comments, most loaders don't clear the bss.
biosboot lost clearing of the bss in a code crunch in 1997, and boot2
never did it.

kan didn't notice the problem with gcc-3.3 putting variables that are
initialized to 0 in the bss until after committing gcc-3.3 because he
was already using essentially this patch.  Before gcc-3.3, only the
non-critical `bootdev' variable was clobbered by clearing the bss.

MFC after:	3 days
2003-07-29 21:57:01 +00:00
Poul-Henning Kamp
114ebb2f28 Fix a memory leak in CCD's mirror code. 2003-07-29 20:04:06 +00:00
Nate Lawson
dda5f182ae Fix the new DA_OLD_QUIRKS option for normal and module compiles.
Pointed out by: 	bde
2003-07-29 18:08:16 +00:00
Hartmut Brandt
fa6a7ef6e4 Process events from the ATM drivers. Carrier change and PVC change
messages are forwarded as netgraph control messages to the node
that is connected to the manage hook. If that hook is not connected,
the event is lost. Flow control events are converted to netgraph
flow control messages and send along the hook that is connected to
the flow controlled VC. ACR change events are converted to control
messages and sent along the hook for the given VC.
2003-07-29 16:27:23 +00:00
Hajimu UMEMOTO
6a2a90b794 Cleanup useless break.
Submitted by:	JINMEI Tatuya <jinmei@isl.rdc.toshiba.co.jp>
2003-07-29 14:10:13 +00:00
Hartmut Brandt
2df0c5212a Generate events for carrier state, PVC state changes and flow control
changes. Still have to figure out, how to get at the ABR information.
2003-07-29 14:07:19 +00:00
Hartmut Brandt
b6e1558bf4 Remove the rather bogus statistics sysctl and merge it into the
internal driver statistics sysctl.
2003-07-29 14:05:45 +00:00
Hartmut Brandt
07227b05dc Generate events when the interface state or a PVC state changes. 2003-07-29 14:00:59 +00:00
Hartmut Brandt
f345f5e020 The number of prefixes can never be negative so use an u_int for this. 2003-07-29 13:46:43 +00:00
Hartmut Brandt
bfbb5daa0f Use a size_t where a buffer length is meant. 2003-07-29 13:33:14 +00:00
Hartmut Brandt
dd937e32bd Make the ioctl() interface cleaner with regard to types: use size_t
instead of int where the variable has to hold buffer lengths,
use u_int for things like number of network interfaces which
in principle can never be negative.
2003-07-29 13:32:10 +00:00