]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
12 years agoRemove some files not used by the FreeBSD kernel which have been adding quite
jmallett [Tue, 13 Mar 2012 06:48:26 +0000 (06:48 +0000)]
Remove some files not used by the FreeBSD kernel which have been adding quite
a bit of bloat to the kernel source tree's size.

12 years agoFix link status handling on if_arge upon system boot to allow bootp/NFS to
adrian [Tue, 13 Mar 2012 06:28:52 +0000 (06:28 +0000)]
Fix link status handling on if_arge upon system boot to allow bootp/NFS to
function.

From the submitter:

This patch fixes an issue I encountered using an NFS root with an
ar71xx-based MikroTik RouterBoard 450G on -current where the kernel fails
to contact a DHCP/BOOTP server via if_arge when it otherwise should be able
to.  This may be the same issue that Monthadar Al Jaberi reported against
an RSPRO on 6 March, as the signature is the same:

%%%

DHCP/BOOTP timeout for server 255.255.255.255
DHCP/BOOTP timeout for server 255.255.255.255
DHCP/BOOTP timeout for server 255.255.255.255
.
.
.
DHCP/BOOTP timeout for server 255.255.255.255
DHCP/BOOTP timeout for server 255.255.255.255
arge0: initialization failed: no memory for rx buffers
DHCP/BOOTP timeout for server 255.255.255.255
arge0: initialization failed: no memory for rx buffers

%%%

The primary issue that I found is that the DHCP/BOOTP message that
bootpc_call() is sending never makes it onto the wire, which I believe is
due to the following:

- Last December, a change was made to the ifioctl that bootpc_call() uses
to adjust the netmask around the sosend().

- The new ioctl (SIOCAIFADDR) performs an if_init when invoked, whereas the
old one (SIOCSIFNETMASK) did not.

- if_arge maintains its own sense of link state in sc->arge_link_status.

- On a single-phy interface, sc->arge_link_status is initialized to 0 in
arge_init_locked().

- sc->arge_link_status remains 0 until a phy state change notification
causes arge_link_task to run, notice the link is up, and set it to 1.

- The inits caused by the ifioctls in bootpc_call are reinitializing the
interface, but not the phy, so sc->arge_link_status goes to 0 and remains
there.

- arge_start_locked() always sees sc->arge_link_status == 0 and returns
without queuing anything.

The attached patch changes arge_init_locked() such that in the single-phy
case, instead of initializing sc->arge_link_status to 0, it runs
arge_link_task() to set it according to the current phy state.  This change
has allowed my setup to mount an NFS root successfully.

Submitted by: Patrick Kelsey <kelsey@ieee.org>
Reviewed by: juli

12 years agoDon't build kernel.tramp on Octeon. Probably building it should be opt-in
jmallett [Tue, 13 Mar 2012 06:22:49 +0000 (06:22 +0000)]
Don't build kernel.tramp on Octeon.  Probably building it should be opt-in
not opt-out, but I don't know enough about which ports need it to get the
defaults right.

12 years agoCorrectly (I hope) deallocate the if_arge RX buffer ring on arge_stop().
adrian [Tue, 13 Mar 2012 06:15:20 +0000 (06:15 +0000)]
Correctly (I hope) deallocate the if_arge RX buffer ring on arge_stop().

I had some interesting hangs until I realised I should try flushing the
DDR FIFO register and lo and behold, hangs stopped occuring.

I've put in a few DDR flushes here and there in case people decide to
reuse some of these functions.  It's very very likely they're almost
all superflous.

To test:

* Connect to a network with a _lot_ of broadcast traffic
* Do this:
  # while true; do ifconfig arge0 down; ifconfig arge0 up; done

This fixes the mbuf exhaustion that has been reported when the interface
state flaps up/down.

12 years agoFix crunchide on MIPS with other than the O32 ABI.
jmallett [Tue, 13 Mar 2012 05:21:14 +0000 (05:21 +0000)]
Fix crunchide on MIPS with other than the O32 ABI.

12 years agoNote two shortcomings of GDB on MIPS that should be addressed.
jmallett [Tue, 13 Mar 2012 04:50:41 +0000 (04:50 +0000)]
Note two shortcomings of GDB on MIPS that should be addressed.

12 years agosysinstall was removed from usr.sbin/Makefile in r225937. Because per-arch
jmallett [Tue, 13 Mar 2012 00:45:27 +0000 (00:45 +0000)]
sysinstall was removed from usr.sbin/Makefile in r225937.  Because per-arch
Makefiles were split out in this directory and others in userland, it makes it
quite easy to miss per-arch conditionals when changing something generally.

12 years agoAdd a kernel-toolchains target like the toolchains target, but building only
jmallett [Tue, 13 Mar 2012 00:38:49 +0000 (00:38 +0000)]
Add a kernel-toolchains target like the toolchains target, but building only
the parts of the toolchain necessary to build kernels.

12 years agoUse gpart "-a" flag to 4k alignment.
jpaetzel [Mon, 12 Mar 2012 21:41:29 +0000 (21:41 +0000)]
Use gpart "-a" flag to 4k alignment.

Submitted by: kris
Obtained from: PC-BSD

12 years agoAdd the ability to use a varity of ZFS dataset options.
jpaetzel [Mon, 12 Mar 2012 21:32:43 +0000 (21:32 +0000)]
Add the ability to use a varity of ZFS dataset options.
While here fix a bug causing zpools with /tmp mount-points to fail

Submitted by: kris
Obtained from: PC-BSD

12 years agoImprove ZFS exporting functionality, only export pools which are on a
jpaetzel [Mon, 12 Mar 2012 21:28:54 +0000 (21:28 +0000)]
Improve ZFS exporting functionality, only export pools which are on a
specific device we happen to be writing to. This fixes an issue when
running pc-sysinstall on a running system which needs ZFS and the main
disk gets exported.

Submitted by: kris
Obtained from: PC-BSD

12 years agoRemove TARGET_BIG_ENDIAN which should have been removed previously.
jmallett [Mon, 12 Mar 2012 21:26:09 +0000 (21:26 +0000)]
Remove TARGET_BIG_ENDIAN which should have been removed previously.

12 years agoo) Use ABI, not ISA_* options, to determine whether to compile bits if libkern
jmallett [Mon, 12 Mar 2012 21:25:32 +0000 (21:25 +0000)]
o) Use ABI, not ISA_* options, to determine whether to compile bits if libkern
   required for the ABI the kernel is being built for.
   XXX This is implemented in a kind-of nasty way that involves including source
       files, but it's still an improvement.
o) Retire ISA_* options since they're unused and were always wrong.

12 years agoCheck for intel RAID devices
jpaetzel [Mon, 12 Mar 2012 21:24:40 +0000 (21:24 +0000)]
Check for intel RAID devices

Submitted by: kris
Obtained from: PC-BSD

12 years agoPull in r145194 from upstream clang trunk:
dim [Mon, 12 Mar 2012 21:07:22 +0000 (21:07 +0000)]
Pull in r145194 from upstream clang trunk:

  Make our handling of MMX x SSE closer to what gcc does:

  * Enabling sse enables mmx.
  * Disabling (-mno-mmx) mmx, doesn't disable sse (we got this right already).
  * The order in not important. -msse -mno-mmx is the same as -mno-mmx -msse.

Some configure scripts depend on this.

PR: i386/165968
MFC after: 3 days

12 years agoUse PTR_SUBU instead of subu (missed this one)
gonzo [Mon, 12 Mar 2012 20:59:18 +0000 (20:59 +0000)]
Use PTR_SUBU instead of subu (missed this one)

12 years agoUse PTR_(ADD|SUB)U macrosses instead of hardcoded addu/subu
gonzo [Mon, 12 Mar 2012 20:58:09 +0000 (20:58 +0000)]
Use PTR_(ADD|SUB)U macrosses instead of hardcoded addu/subu

Spotted by: juli

12 years agoFix a couple of bugs saving network config.
jpaetzel [Mon, 12 Mar 2012 20:44:44 +0000 (20:44 +0000)]
Fix a couple of bugs saving network config.
Don't duplicate wlans_ lines.
Enable ipv6 on wireless devices correctly.

Submitted by: kris
Obtained from: PC-BSD

12 years agoMake sure when creating new MBR partition it is set to active by default.
jpaetzel [Mon, 12 Mar 2012 20:41:36 +0000 (20:41 +0000)]
Make sure when creating new MBR partition it is set to active by default.

Submitted by: kris
Obtained from: PC-BSD

12 years agoConfiguration changes/updates!
adrian [Mon, 12 Mar 2012 20:32:23 +0000 (20:32 +0000)]
Configuration changes/updates!

* enable ALQ and net80211/ath ALQ logging by default, to make it possible
  to get debug register traces.
* Update some comments
* Enable HWPMC for testing.

12 years agoRemove a stale comment.
scottl [Mon, 12 Mar 2012 20:31:58 +0000 (20:31 +0000)]
Remove a stale comment.

Submitted by: jimharris

12 years ago- Although we pass first 4 arguments in registers, function callinf ABI requires
gonzo [Mon, 12 Mar 2012 20:24:59 +0000 (20:24 +0000)]
- Although we pass first 4 arguments in registers, function callinf ABI requires
   space to be reserved for them in stack. _rtld() prologue saves a1 and a2 in
   this space.

- Whitespace cleanup while I'm at it

12 years agoFinal pass at having devices use their bus parent for dma tags. The
scottl [Mon, 12 Mar 2012 19:29:35 +0000 (19:29 +0000)]
Final pass at having devices use their bus parent for dma tags.  The
remaining drivers that haven't been converted have various problems or
complexities that will be dealt with later.  This list includes:

hptrr, hptmv, hpt27xx - device aggregation across multiple parents
drm - want to talk to the maintainer first
tsec, sec - Openfirmware devices, not sure if changes are warranted
fatm - Done except for unused testing code
usb - want to talk to the maintainer first
ce, cp, ctau, cx - Significant driver changes needed to convey parent info

There are also devices tucked into architecture subtrees that I'll leave
for the respective maintainers to deal with.

12 years agoRemove comments about creating DMA tags as children of the DMA tags of their
jmallett [Mon, 12 Mar 2012 19:29:32 +0000 (19:29 +0000)]
Remove comments about creating DMA tags as children of the DMA tags of their
parent bus where the code has now been modified to do so.

Reviewed by: scottl

12 years agoUse 64-bit bus space constants on 64-bit kernels.
jmallett [Mon, 12 Mar 2012 18:56:16 +0000 (18:56 +0000)]
Use 64-bit bus space constants on 64-bit kernels.

12 years agoFix a bug running the autoinstall functionality.
jpaetzel [Mon, 12 Mar 2012 18:50:37 +0000 (18:50 +0000)]
Fix a bug running the autoinstall functionality.

Submitted by: kris
Obtained from: PC-BSD

12 years agoMore conversions of drivers to use the PCI parent DMA tag.
scottl [Mon, 12 Mar 2012 18:15:08 +0000 (18:15 +0000)]
More conversions of drivers to use the PCI parent DMA tag.

12 years agoRemove more unused stuff, primarily a set of (unused, thankfully) PIO
jmallett [Mon, 12 Mar 2012 18:10:01 +0000 (18:10 +0000)]
Remove more unused stuff, primarily a set of (unused, thankfully) PIO
functions.

Adjust nearby style of one assembly function END().

12 years agoThis header file no longer exists when doing cross builds, so remove it.
adrian [Mon, 12 Mar 2012 17:25:35 +0000 (17:25 +0000)]
This header file no longer exists when doing cross builds, so remove it.

mips24k hwpmc now compiles again.

12 years agoFix VNET build broken by r232865.
melifaro [Mon, 12 Mar 2012 15:41:36 +0000 (15:41 +0000)]
Fix VNET build broken by r232865.
Temporary remove the ability to assign different number of tables per VNET instance.

12 years agoThis fixes PR 165210. Basically we just
rrs [Mon, 12 Mar 2012 15:05:17 +0000 (15:05 +0000)]
This fixes PR 165210. Basically we just
add in the netgraph interface to the list of
acceptable interfaces. A todo at the next
IETF code blitz, though is we need to review
why we screen interfaces, there was a reason ;-).

PR: 165210
MFC after: 1 week

12 years ago- Add ipfw eXtended tables permitting radix to be used for any kind of keys.
melifaro [Mon, 12 Mar 2012 14:07:57 +0000 (14:07 +0000)]
- Add ipfw eXtended tables permitting radix to be used for any kind of keys.
- Add support for IPv6 and interface extended tables
- Make number of tables to be loader tunable in range 0..65534.
- Use IP_FW3 opcode for all new extended table cmds

No ABI changes are introduced. Old userland will see valid tables for
IPv4 tables and no entries otherwise. Flush works for any table.

IP_FW3 socket option is used to encapsulate all new opcodes:
 /* IP_FW3 header/opcodes */
 typedef struct _ip_fw3_opheader {
        uint16_t opcode;        /* Operation opcode */
        uint16_t reserved[3];   /* Align to 64-bit boundary */
 } ip_fw3_opheader;

New opcodes added:
 IP_FW_TABLE_XADD, IP_FW_TABLE_XDEL, IP_FW_TABLE_XGETSIZE, IP_FW_TABLE_XLIST

ipfw(8) table argument parsing behavior is changed:
 'ipfw table 999 add host' now assumes 'host' to be interface name instead of
 hostname.

New tunable:
 net.inet.ip.fw.tables_max controls number of table supported by ipfw in given
 VNET instance. 128 is still the default value.

New syntax:
ipfw add skipto tablearg ip from any to any via table(42) in
ipfw add skipto tablearg ip from any to any via table(4242) out

This is a bit hackish, special interface name '\1' is used to signal interface
table number is passed in p.glob field.

Sponsored by Yandex LLC

Reviewed by:    ae
Approved by:    ae (mentor)

MFC after:      4 weeks

12 years agoRtld on diet part 2:
kib [Mon, 12 Mar 2012 12:16:08 +0000 (12:16 +0000)]
Rtld on diet part 2:

Do not use stdio for libmap.conf read.  Directly map the file and
parse lines from the mappings.

Reviewed by: kan
MFC after: 3 weeks

12 years agoRtld on diet part 1:
kib [Mon, 12 Mar 2012 12:15:47 +0000 (12:15 +0000)]
Rtld on diet part 1:

Provide rtld-private implementations of __stack_chk_guard,
__stack_chk_fail() and __chk_fail() symbols, to be used by functions
linked from libc_pic.a.  This avoids use of libc stack_protector.c,
which pulls in syslog(3) and stdio as dependency.

Also, do initialize rtld-private copy __stack_chk_guard, previously
libc-provided one was not initialized, since we do not call rtld
object _init() methods.

Reviewed by: kan
MFC after: 3 weeks

12 years agoAllways call fdrop().
pho [Mon, 12 Mar 2012 11:56:57 +0000 (11:56 +0000)]
Allways call fdrop().

12 years agoAmend r232857, now dropping the casts entirely, as they were not
dim [Mon, 12 Mar 2012 11:22:23 +0000 (11:22 +0000)]
Amend r232857, now dropping the casts entirely, as they were not
necessary at all.

Submitted by: stefanf

12 years agoAfter r232548, clang complains about the apparent '=-' operator (a
dim [Mon, 12 Mar 2012 11:15:44 +0000 (11:15 +0000)]
After r232548, clang complains about the apparent '=-' operator (a
left-over from ancient C times, and a frequent typo) in growfs.c:

sbin/growfs/growfs.c:1550:8: error: use of unary operator that may be intended as compound assignment (-=) [-Werror]
        blkno =- 1;
              ^~

Use 'blkno = -1' instead, to silence the error.

12 years agoFix the following warning/error with clang:
dim [Mon, 12 Mar 2012 11:04:48 +0000 (11:04 +0000)]
Fix the following warning/error with clang:

libexec/rtld-elf/rtld.c:1898:22: error: comparison between pointer and integer ('Elf_Addr *' (aka 'unsigned int *') and 'Elf_Addr' (aka 'unsigned int')) [-Werror]
    if (preinit_addr == (Elf_Addr)NULL)
        ~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
libexec/rtld-elf/rtld.c:2039:16: error: comparison between pointer and integer ('Elf_Addr *' (aka 'unsigned int *') and 'Elf_Addr' (aka 'unsigned int')) [-Werror]
        if (init_addr != (Elf_Addr)NULL) {
            ~~~~~~~~~ ^  ~~~~~~~~~~~~~~

Reviewed by: kib

12 years agoWhen iterating over the dso program headers, the object is not initialized
kib [Mon, 12 Mar 2012 10:36:03 +0000 (10:36 +0000)]
When iterating over the dso program headers, the object is not initialized
yet, and object segments are not yet mapped.  Only parse the notes that
appear in the first page of the dso (as it should be anyway), and use
the preloaded page content.

Reported and tested by: stass
MFC after: 20 days

12 years agoRemove more unused code and declarations, and add dire warnings to the 64-bit
jmallett [Mon, 12 Mar 2012 08:13:04 +0000 (08:13 +0000)]
Remove more unused code and declarations, and add dire warnings to the 64-bit
atomic ops used by 32-bit kernels.

12 years agoConvert a number of drivers to obtaining their parent DMA tag from their
scottl [Mon, 12 Mar 2012 08:03:51 +0000 (08:03 +0000)]
Convert a number of drivers to obtaining their parent DMA tag from their
PCI device attachment.

12 years agoRemove platform APIs which are not used by any code and which had only stub
jmallett [Mon, 12 Mar 2012 07:34:15 +0000 (07:34 +0000)]
Remove platform APIs which are not used by any code and which had only stub
implementations or no implementation on all platforms.

Some of these functions might be good ideas, but their semantics were unclear
given the lack of implementation, and an unlucky porter could be fooled into
trying to implement them or, worse, being baffled when something like
platform_trap_enter() failed to be called.

12 years agoTune cpuset macros to optimize cases when CPU_SETSIZE fits into single
mav [Mon, 12 Mar 2012 07:02:16 +0000 (07:02 +0000)]
Tune cpuset macros to optimize cases when CPU_SETSIZE fits into single
machine word. For example, it turns CPU_SET() into expected shift and OR,
removing two extra shifts and additional index on memory access.

Generated code checked for kernel (optimized) and user-level (unoptimized)
cases with GCC and CLANG.

Reviewed by: attilio
MFC after: 2 weeks

12 years agoSimplify the error checking in one branch of trap_pfault() and update
alc [Mon, 12 Mar 2012 05:28:02 +0000 (05:28 +0000)]
Simplify the error checking in one branch of trap_pfault() and update
the nearby comment.

Correct the style of two return statements in trap_pfault().

Merge a comment from amd64's trap_pfault().

12 years agoMake if_ierrors updated whenever any of the following counters are
yongari [Mon, 12 Mar 2012 03:47:30 +0000 (03:47 +0000)]
Make if_ierrors updated whenever any of the following counters are
updated.
 o Number of times NIC ran out of RX buffer descriptors
 o Number of inbound packet errors
 o Number of inbound packets that were chosen to be discarded
Previously only the discarded packet counter was used to update
if_ierrors.  This change fixes wrong if_ierrors counter on
BCM570[0-4] controllers.  For BCM5705 and later controllers bge(4)
already correctly counted it.

Reported by: Eugene Grosbein <egrosbein <> rdtc dot ru>

12 years agoShow PCI bus speed and width as well as running mode of PCI-X
yongari [Mon, 12 Mar 2012 02:42:47 +0000 (02:42 +0000)]
Show PCI bus speed and width as well as running mode of PCI-X
device in device attach.  This would help to narrow down issue to a
specific controller and operating mode of the controller.
While I'm here rename BGE_MISCCFG_BOARD_ID with
BGE_MISCCFG_BOARD_ID_MASK.

12 years agoAdd workaround for PCI-X BCM5704 controller that live behind
yongari [Mon, 12 Mar 2012 02:09:47 +0000 (02:09 +0000)]
Add workaround for PCI-X BCM5704 controller that live behind
AMD-8131 PCI-X bridge.  The bridge seems to reorder write access to
mailbox registers such that it caused watchdog timeouts by
out-of-order TX completions.

Tested by: Michael L. Squires <mikes <> siralan dot org >
Reviewed by: jhb

12 years ago- Rename apb_intr to apb_filter since it's a filter handler
gonzo [Mon, 12 Mar 2012 01:23:09 +0000 (01:23 +0000)]
- Rename apb_intr to apb_filter since it's a filter handler
- Pass interrupt trapframe for handlers dow the chain
- Add PMC interrupt handler
    PMC interrupt is a special case, so we want handle it as soon as possible
    with minimum overhead. So we handle it apb filter routine.

12 years agoImplement pmc_save_user_callchain and pmc_save_kernel_callchain for MIPS
gonzo [Mon, 12 Mar 2012 01:19:41 +0000 (01:19 +0000)]
Implement pmc_save_user_callchain and pmc_save_kernel_callchain for MIPS

12 years agoBegin modifying the PB92 config file to actually generate a flashable,
adrian [Mon, 12 Mar 2012 01:15:58 +0000 (01:15 +0000)]
Begin modifying the PB92 config file to actually generate a flashable,
bootable image.

The kernel has to fit inside an 896KiB area in a 4MB SPI flash.
So a bunch of stuff can't be included (and more is to come), including
(unfortunately) IPv6.

TODO:

* GPIO modules need to be created
* Shrink the image a bit more by removing some of the CAM layer debugging
  strings.

12 years agoRemove extraneous log message
emaste [Mon, 12 Mar 2012 01:06:29 +0000 (01:06 +0000)]
Remove extraneous log message

When ntp switched between PLL and FLL mode it produced a log message
"kernel time sync status change %04x".  This issue is reported in ntp
bug 452[1] which claims that this behaviour is normal and the log
message isn't necessary.  I'm not sure exactly when it was removed, but
it's gone in the latest ntp release (4.2.6p5).

[1] http://bugs.ntp.org/show_bug.cgi?id=452

Approved by:    roberto

12 years agoSimplify the error checking in one branch of trap_pfault() and update
alc [Mon, 12 Mar 2012 00:47:13 +0000 (00:47 +0000)]
Simplify the error checking in one branch of trap_pfault() and update
the nearby comment.

Add missing whitespace to a return statement in trap_pfault().

Submitted by: kib [2]

12 years agoFix whitespace.
ed [Sun, 11 Mar 2012 22:30:06 +0000 (22:30 +0000)]
Fix whitespace.

MFC after: 1 week

12 years agoWe've supported 64-bit PTEs for some time.
jmallett [Sun, 11 Mar 2012 22:17:01 +0000 (22:17 +0000)]
We've supported 64-bit PTEs for some time.

12 years agosh: Add a test for variables with underscores in arithmetic.
jilles [Sun, 11 Mar 2012 22:12:05 +0000 (22:12 +0000)]
sh: Add a test for variables with underscores in arithmetic.

Things like $((_x+1)) are broken in stable/8 sh but work in stable/9 and
head.

12 years agoRemove superfluous brackets.
kib [Sun, 11 Mar 2012 21:25:42 +0000 (21:25 +0000)]
Remove superfluous brackets.

Submitted by: alc
MFC after: 2 weeks

12 years agoDo schedule delayed writes for async mounts.
kib [Sun, 11 Mar 2012 20:26:19 +0000 (20:26 +0000)]
Do schedule delayed writes for async mounts.
While there, make some style adjustments, like missed () around
return values.

Submitted by: bde
Reviewed by: mckusick
Tested by: pho
MFC after: 2 weeks

12 years agoDo not fall back to slow synchronous i/o when low on memory or buffers.
kib [Sun, 11 Mar 2012 20:23:46 +0000 (20:23 +0000)]
Do not fall back to slow synchronous i/o when low on memory or buffers.
The bawrite() schedules the write to happen immediately, and its use
frees the current thread to do more cleanups.

Submitted by: bde
Reviewed by: mckusick
Tested by: pho
MFC after: 2 weeks

12 years agoIn ffs_syncvnode(), pass boolean false as second argument of ffs_update().
kib [Sun, 11 Mar 2012 20:18:14 +0000 (20:18 +0000)]
In ffs_syncvnode(), pass boolean false as second argument of ffs_update().
Synchronous inode block update is not needed for MNT_LAZY callers (syncer),
and since waitfor values are not zero, code did unneccessary synchronous
update.

Submitted by: bde
Reviewed by: mckusick
Tested by: pho
MFC after: 2 weeks

12 years agoRemove not needed ARGSUSED lint command.
kib [Sun, 11 Mar 2012 20:15:12 +0000 (20:15 +0000)]
Remove not needed ARGSUSED lint command.

Submitted by: bde
MFC after: 3 days

12 years agoStop calling _init/_fini methods from crt1 for dynamic binaries. Do
kib [Sun, 11 Mar 2012 20:04:09 +0000 (20:04 +0000)]
Stop calling _init/_fini methods from crt1 for dynamic binaries.  Do
call preinit, init and fini arrays methods from crt1 for static binaries.

Mark new crt1 with FreeBSD-specific ELF note.

Move some common crt1 code into new MI file ignore_init.c, to reduce
duplication.  Also, conservatively adjust nearby sources for style.

Reviewed by: kan
Tested by: andrew (arm), flo (sparc64)
MFC after: 3 weeks

12 years agoAdd support for preinit, init and fini arrays. Some ABIs, in
kib [Sun, 11 Mar 2012 20:03:09 +0000 (20:03 +0000)]
Add support for preinit, init and fini arrays.  Some ABIs, in
particular on ARM, do require working init arrays.

Traditional FreeBSD crt1 calls _init and _fini of the binary, instead
of allowing runtime linker to arrange the calls.  This was probably
done to have the same crt code serve both statically and dynamically
linked binaries.  Since ABI mandates that first is called preinit
array functions, then init, and then init array functions, the init
have to be called from rtld now.

To provide binary compatibility to old FreeBSD crt1, which calls _init
itself, rtld only calls intializers and finalizers for main binary if
binary has a note indicating that new crt was used for linking.  Add
parsing of ELF notes to rtld, and cache p_osrel value since we parsed
it anyway.

The patch is inspired by init_array support for DragonflyBSD, written
by John Marino.

Reviewed by: kan
Tested by: andrew (arm, previous version), flo (sparc64, previous version)
MFC after: 3 weeks

12 years agoAdd a header with definitions useful for constructing ELF notes.
kib [Sun, 11 Mar 2012 19:56:58 +0000 (19:56 +0000)]
Add a header with definitions useful for constructing ELF notes.

Reviewed by: kan
MFC after:   3 weeks

12 years agoELF image can have several PT_NOTE program headers. Look for the ELF
kib [Sun, 11 Mar 2012 19:38:49 +0000 (19:38 +0000)]
ELF image can have several PT_NOTE program headers.  Look for the ELF
brand note in each header, instead of using only first one.

Reviewed by: kan
Tested by: andrew (arm), flo (sparc64)
MFC after: 3 weeks

12 years agoUpgrade the netgraph vlan node to support 802.1q, encapsulation type,
adrian [Sun, 11 Mar 2012 19:08:56 +0000 (19:08 +0000)]
Upgrade the netgraph vlan node to support 802.1q, encapsulation type,
PCP and CFI fields.

* Ethernet_type for VLAN encapsulation is tunable, default is 0x8100;
* PCP (Priority code point) and CFI (canonical format indicator) is
  tunable per VID;
* Tunable encapsulation to support 802.1q
* Encapsulation/Decapsulation code improvements

New messages have been added for this netgraph node to support the
new features.

However, the legacy "vlan" id is still supported and compiled in by
default.  It can be disabled in a future release.

TODO:

* Documentation
* Examples

PR: kern/161908
Submitted by: Ivan <rozhuk.im@gmail.com>

12 years ago- remove an extra parenthesis in a closing brace;
luigi [Sun, 11 Mar 2012 17:35:12 +0000 (17:35 +0000)]
- remove an extra parenthesis in a closing brace;
- add the macro NETMAP_RING_FIRST_RESERVED() which returns
  the index of the first non-released buffer in the ring
  (this is useful for code that retains buffers for some time
  instead of processing them immediately)

12 years agoUpdate comment.
kib [Sun, 11 Mar 2012 15:58:27 +0000 (15:58 +0000)]
Update comment.

Submitted by: gianni

12 years agoFix a bug introduced in r223938; on big-endian machines coping a 32-bit
marius [Sun, 11 Mar 2012 13:39:19 +0000 (13:39 +0000)]
Fix a bug introduced in r223938; on big-endian machines coping a 32-bit
quantum bytewise to the address of a 64-bit variable results in writing
to the "wrong" 32-bit half so adjust the address accordingly. This fix
is implemented in a hackish way for two reasons:
o in order to be able to get it into 8.3 with zero impact on the little-
  endian architectures where this bug has no effect and
o to avoid blowing the x86 boot2 out of the water again when compiling
  it with clang, which all sane versions of this fix tested do.
This change fixes booting from UFS1 file systems on big-endian machines.

MFC after: 3 days

12 years agoRemove fifo.h. The only used function declaration from the header is
kib [Sun, 11 Mar 2012 12:19:58 +0000 (12:19 +0000)]
Remove fifo.h. The only used function declaration from the header is
migrated to sys/vnode.h.

Submitted by: gianni

12 years agoReenable -Winline on MIPS now that we're not compiling Cavium's error
jmallett [Sun, 11 Mar 2012 08:12:30 +0000 (08:12 +0000)]
Reenable -Winline on MIPS now that we're not compiling Cavium's error
decoding stuff, which is impossibly-huge.

12 years agoDisable the Simple Executive's error decoding/reporting code.
jmallett [Sun, 11 Mar 2012 06:55:17 +0000 (06:55 +0000)]
Disable the Simple Executive's error decoding/reporting code.

12 years agoDo not try to use libfdt in FreeBSD.
jmallett [Sun, 11 Mar 2012 06:49:31 +0000 (06:49 +0000)]
Do not try to use libfdt in FreeBSD.

12 years agoRemove files not needed by FreeBSD.
jmallett [Sun, 11 Mar 2012 06:18:38 +0000 (06:18 +0000)]
Remove files not needed by FreeBSD.

12 years agoMerge the Cavium Octeon SDK 2.3.0 Simple Executive code and update FreeBSD to
jmallett [Sun, 11 Mar 2012 06:17:49 +0000 (06:17 +0000)]
Merge the Cavium Octeon SDK 2.3.0 Simple Executive code and update FreeBSD to
make use of it where possible.

This primarily brings in support for newer hardware, and FreeBSD is not yet
able to support the abundance of IRQs on new hardware and many features in the
Ethernet driver.

Because of the changes to IRQs in the Simple Executive, we have to maintain our
own list of Octeon IRQs now, which probably can be pared-down and be specific
to the CIU interrupt unit soon, and when other interrupt mechanisms are added
they can maintain their own definitions.

Remove unmasking of interrupts from within the UART device now that the
function used is no longer present in the Simple Executive.  The unmasking
seems to have been gratuitous as this is more properly handled by the buses
above the UART device, and seems to work on that basis.

12 years agoDisable -Winline on MIPS in preparation for the import of the latest version
jmallett [Sun, 11 Mar 2012 06:11:31 +0000 (06:11 +0000)]
Disable -Winline on MIPS in preparation for the import of the latest version
of the Cavium Simple Executive, which violates large function growth rules
in such a way that simply increasing the large function growth parameter is
insufficient.

12 years agoImport Cavium Octeon SDK 2.3.0 Simple Executive from cnusers.org.
jmallett [Sun, 11 Mar 2012 04:14:00 +0000 (04:14 +0000)]
Import Cavium Octeon SDK 2.3.0 Simple Executive from cnusers.org.

12 years agoStop some of the output from wrapping at 80 characters.
adrian [Sun, 11 Mar 2012 02:00:59 +0000 (02:00 +0000)]
Stop some of the output from wrapping at 80 characters.

12 years agoFix promiscuous mode with if_octm:
jmallett [Sun, 11 Mar 2012 00:34:14 +0000 (00:34 +0000)]
Fix promiscuous mode with if_octm:
o) The MAC set must occur before the multicast list is set up as the former
   will enable the CAM unconditionally, while promiscuous mode disables it,
   so if promiscuous mode is to be set this must occur after the MAC is
   programmed.
o) The multicast list must be set up unconditionally as even if flags have
   not changed, if the interface has gone through a reinitialization, the
   state of the CAM as changed by the MAC initialization could be incorrect.
o) Call octm_init when flags change, even if the interface is already running.

12 years agoRemove some headers not used by kernel or world and which are not present in
jmallett [Sat, 10 Mar 2012 23:27:03 +0000 (23:27 +0000)]
Remove some headers not used by kernel or world and which are not present in
other ports.

12 years agoregen
netchild [Sat, 10 Mar 2012 23:11:21 +0000 (23:11 +0000)]
regen

12 years ago- add comments to syscalls.master and linux(32)_dummy about which linux
netchild [Sat, 10 Mar 2012 23:10:18 +0000 (23:10 +0000)]
- add comments to syscalls.master and linux(32)_dummy about which linux
  kernel version introduced the sysctl (based upon a linux man-page)
- add comments to sscalls.master regarding some names of sysctls which are
  different than the linux-names (based upon the linux unistd.h)
- add some dummy sysctls
- name an unimplemented sysctl

MFC after: 1 month

12 years agoServerWorks HT1000 HPET reported to have problems with IRQs >= 16.
mav [Sat, 10 Mar 2012 21:08:07 +0000 (21:08 +0000)]
ServerWorks HT1000 HPET reported to have problems with IRQs >= 16.
Lower (ISA) IRQs are working, but allowed mask is not set correctly.
Block both by default to allow HP BL465c G6 blade system to boot.

Reported by: Attila Nagy <bra@fsn.hu>
MFC after: 1 week

12 years agoStick the if_drv_flags access (check and modify) behind the ifq lock.
adrian [Sat, 10 Mar 2012 20:09:02 +0000 (20:09 +0000)]
Stick the if_drv_flags access (check and modify) behind the ifq lock.

Although access to the flags to check/set OACTIVE is racy due to how
the default if_start() function works, this should remove any races
with read/modify/write between threads.

12 years agoFix a panic introduced in a previous commit - non-beaconing modes (eg STA)
adrian [Sat, 10 Mar 2012 19:58:23 +0000 (19:58 +0000)]
Fix a panic introduced in a previous commit - non-beaconing modes (eg STA)
don't setup the avp mcast queue.

This is a bit annoying though - it turns out the mcast queue isn't
initialised for STA mode but it's then touched to see whether anything
is in it.  That should be fixed in a subsequent commit.

Noticed by: gperez@entel.upc.edu
PR: kern/165895

12 years agoRevert r175376 and tune cpufreq(4) frequency comparison logic instead.
mav [Sat, 10 Mar 2012 18:56:16 +0000 (18:56 +0000)]
Revert r175376 and tune cpufreq(4) frequency comparison logic instead.
Instead of using 25MHz equality threshold, look for the nearest value when
handling dev.cpu.0.freq sysctl and for exact match when it is expected.

ACPI may report extra level with frequency 1MHz above the nominal to
control Intel Turbo Boost operation. It is not a bug, but feature:
dev.cpu.0.freq_levels: 2934/106000 2933/95000 2800/82000 ...
In this case value 2933 means 2.93GHz, but 2934 means 3.2-3.6GHz.

I've found that my Core i7-870 based system has Intel Turbo Boost disabled
by default and without this change it was absolutely invisible and hard
to control.

MFC after: 2 weeks

12 years agoFix reversed logic in previous commit that broke build and earned me quite the
jmallett [Sat, 10 Mar 2012 18:35:38 +0000 (18:35 +0000)]
Fix reversed logic in previous commit that broke build and earned me quite the
pointy hat.

Submitted by: bz

12 years agoFix wrong asresp frame parsing in iwi_checkforqos().
iwasaki [Sat, 10 Mar 2012 17:08:57 +0000 (17:08 +0000)]
Fix wrong asresp frame parsing in iwi_checkforqos().

After 8.0-RELEASE, iwi(4) doesn't send any data frames in infrastructure
mode.

Bacause of the condition `while (frm < efrm)', IEEE80211_VERIFY_LENGTH()
was checking item length beyond the ieee80211_frame region, and returned
from iwi_checkforqos() without setting flags, capinfo and associd.

In infrastructure mode associd is required, so this problem causes
discarding mbuf in ieee80211_start().

PR: kern/165819
Tested/Reviewed/Supported by: bschmidt and adrian
MFC after: 1 week

12 years agoMFi386: revisions 232570 and 232754
nyan [Sat, 10 Mar 2012 15:08:37 +0000 (15:08 +0000)]
MFi386: revisions 232570 and 232754

  Fix boot2 to handle boot config files that only contain a custom path to
  a loader or kernel.

12 years agoIdle ticks optimization:
mav [Sat, 10 Mar 2012 14:57:21 +0000 (14:57 +0000)]
Idle ticks optimization:
 - Pass number of events to the statclock() and profclock() functions
   same as to hardclock() before to not call them many times in a loop.
 - Rename them into statclock_cnt() and profclock_cnt().
 - Turn statclock() and profclock() into compatibility wrappers,
   still needed for arm.
 - Rename hardclock_anycpu() into hardclock_cnt() for unification.

MFC after: 1 week

12 years agoRemove useless thread_{lock,unlock}() in raccd.
trasz [Sat, 10 Mar 2012 14:38:49 +0000 (14:38 +0000)]
Remove useless thread_{lock,unlock}() in raccd.

12 years agoPerform even more style changes.
ed [Sat, 10 Mar 2012 14:38:34 +0000 (14:38 +0000)]
Perform even more style changes.

- Remove unneeded whitespace for function calls.
- Add empty line at the top of functions without local variables.
- Change while (1) to for (;;).

MFC after: 1 week

12 years agoFix whitespace.
ed [Sat, 10 Mar 2012 14:35:09 +0000 (14:35 +0000)]
Fix whitespace.

MFC after: 1 week

12 years agoMove determination of socket buffer sizes from startup to the first time a
gavin [Sat, 10 Mar 2012 11:25:53 +0000 (11:25 +0000)]
Move determination of socket buffer sizes from startup to the first time a
socket is used.  The previous code structure assumed that AF_INET sockets
were always available, which is an invalid assumption on IPv6-only systems.

This merges the fololowing revisions from NetBSD:
src/usr.bin/ftp/main.c 1.120
src/usr.bin/ftp/util.c 1.156

PR: bin/162661
Tested by: bz
Obtained from: NetBSD
MFC after: 1 week

12 years agoCross-reference sigqueue(2) and kill(2).
trasz [Sat, 10 Mar 2012 10:54:52 +0000 (10:54 +0000)]
Cross-reference sigqueue(2) and kill(2).

12 years agoOptimize tls_get_addr_common(). The change provides around 30% speedup
kib [Sat, 10 Mar 2012 08:49:44 +0000 (08:49 +0000)]
Optimize tls_get_addr_common(). The change provides around 30% speedup
for TLS microbenchmark using global-dynamic TLS model on amd64 (which is
default for PIC dso objects).

Split the slow path into tls_get_addr_slow(), for which inlining is
disabled. This prevents the registers spill on tls_get_addr_common()
entry.

Provide static branch hint to the compiler, indicating that slow path
is not likely to be taken.

While there, do some minimal style adjustments.

Reported and tested by: davidxu
MFC after: 1 week

12 years agoAdd brackets around bare '-1' used as the macro body.
kib [Sat, 10 Mar 2012 08:48:52 +0000 (08:48 +0000)]
Add brackets around bare '-1' used as the macro body.

Noted by: bde
MFC after: 1 week

12 years agoUse ABI to determine bus_addr_t for cnMIPS.
jmallett [Sat, 10 Mar 2012 07:54:41 +0000 (07:54 +0000)]
Use ABI to determine bus_addr_t for cnMIPS.

12 years agoo) Remove some CPU_CNMIPS-related magical thinking about the status register's
jmallett [Sat, 10 Mar 2012 06:54:37 +0000 (06:54 +0000)]
o) Remove some CPU_CNMIPS-related magical thinking about the status register's
   contents for user programs.
o) Conditionalize the installation of an XTLB handler on ABI, not CPU family.

12 years agoGet rid of mainbus.c. The version in nexus.c is being used and is
jmallett [Sat, 10 Mar 2012 06:45:21 +0000 (06:45 +0000)]
Get rid of mainbus.c.  The version in nexus.c is being used and is
perfectly-sufficient and equally-crufty.

12 years agoDon't truncate physical addresses to 32-bits.
jmallett [Sat, 10 Mar 2012 06:43:41 +0000 (06:43 +0000)]
Don't truncate physical addresses to 32-bits.