diff options
author | attilio <attilio@FreeBSD.org> | 2011-05-06 22:45:33 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2011-05-06 22:45:33 +0000 |
commit | a0b51ba62fa86f5faf7bbd81e0b91ba497fec05a (patch) | |
tree | b6f763bb2e3a9eaf32a3ee9adca98cc9e867998c | |
parent | 8534b0c2951283889da00ca8a244058185638240 (diff) | |
download | FreeBSD-src-a0b51ba62fa86f5faf7bbd81e0b91ba497fec05a.zip FreeBSD-src-a0b51ba62fa86f5faf7bbd81e0b91ba497fec05a.tar.gz |
MFC
66 files changed, 909 insertions, 1114 deletions
diff --git a/bin/sh/mksyntax.c b/bin/sh/mksyntax.c index 6bd1390..9aa7450 100644 --- a/bin/sh/mksyntax.c +++ b/bin/sh/mksyntax.c @@ -64,6 +64,7 @@ struct synclass synclass[] = { { "CWORD", "character is nothing special" }, { "CNL", "newline character" }, { "CBACK", "a backslash character" }, + { "CSBACK", "a backslash character in single quotes" }, { "CSQUOTE", "single quote" }, { "CDQUOTE", "double quote" }, { "CENDQUOTE", "a terminating quote" }, @@ -224,6 +225,7 @@ main(int argc __unused, char **argv __unused) init(); fputs("\n/* syntax table used when in single quotes */\n", cfile); add("\n", "CNL"); + add("\\", "CSBACK"); add("'", "CENDQUOTE"); /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */ add("!*?[=~:/-", "CCTL"); diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 43822f9..5133d67 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -1127,6 +1127,127 @@ done: /* + * Called to parse a backslash escape sequence inside $'...'. + * The backslash has already been read. + */ +static char * +readcstyleesc(char *out) +{ + int c, v, i, n; + + c = pgetc(); + switch (c) { + case '\0': + synerror("Unterminated quoted string"); + case '\n': + plinno++; + if (doprompt) + setprompt(2); + else + setprompt(0); + return out; + case '\\': + case '\'': + case '"': + v = c; + break; + case 'a': v = '\a'; break; + case 'b': v = '\b'; break; + case 'e': v = '\033'; break; + case 'f': v = '\f'; break; + case 'n': v = '\n'; break; + case 'r': v = '\r'; break; + case 't': v = '\t'; break; + case 'v': v = '\v'; break; + case 'x': + v = 0; + for (;;) { + c = pgetc(); + if (c >= '0' && c <= '9') + v = (v << 4) + c - '0'; + else if (c >= 'A' && c <= 'F') + v = (v << 4) + c - 'A' + 10; + else if (c >= 'a' && c <= 'f') + v = (v << 4) + c - 'a' + 10; + else + break; + } + pungetc(); + break; + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + v = c - '0'; + c = pgetc(); + if (c >= '0' && c <= '7') { + v <<= 3; + v += c - '0'; + c = pgetc(); + if (c >= '0' && c <= '7') { + v <<= 3; + v += c - '0'; + } else + pungetc(); + } else + pungetc(); + break; + case 'c': + c = pgetc(); + if (c < 0x3f || c > 0x7a || c == 0x60) + synerror("Bad escape sequence"); + if (c == '\\' && pgetc() != '\\') + synerror("Bad escape sequence"); + if (c == '?') + v = 127; + else + v = c & 0x1f; + break; + case 'u': + case 'U': + n = c == 'U' ? 8 : 4; + v = 0; + for (i = 0; i < n; i++) { + c = pgetc(); + if (c >= '0' && c <= '9') + v = (v << 4) + c - '0'; + else if (c >= 'A' && c <= 'F') + v = (v << 4) + c - 'A' + 10; + else if (c >= 'a' && c <= 'f') + v = (v << 4) + c - 'a' + 10; + else + synerror("Bad escape sequence"); + } + if (v == 0 || (v >= 0xd800 && v <= 0xdfff)) + synerror("Bad escape sequence"); + /* We really need iconv here. */ + if (v > 127) + v = '?'; + break; + default: + synerror("Bad escape sequence"); + } + v = (char)v; + /* + * We can't handle NUL bytes. + * POSIX says we should skip till the closing quote. + */ + if (v == '\0') { + while ((c = pgetc()) != '\'') { + if (c == '\\') + c = pgetc(); + if (c == PEOF) + synerror("Unterminated quoted string"); + } + pungetc(); + return out; + } + if (SQSYNTAX[v] == CCTL) + USTPUTC(CTLESC, out); + USTPUTC(v, out); + return out; +} + + +/* * If eofmark is NULL, read a word or a redirection symbol. If eofmark * is not NULL, read a here document. In the latter case, eofmark is the * word which marks the end of the document and striptabs is true if @@ -1158,6 +1279,7 @@ readtoken1(int firstc, char const *initialsyntax, char *eofmark, int striptabs) struct tokenstate state_static[MAXNEST_static]; int maxnest = MAXNEST_static; struct tokenstate *state = state_static; + int sqiscstyle = 0; startlinno = plinno; quotef = 0; @@ -1188,6 +1310,12 @@ readtoken1(int firstc, char const *initialsyntax, char *eofmark, int striptabs) setprompt(0); c = pgetc(); goto loop; /* continue outer loop */ + case CSBACK: + if (sqiscstyle) { + out = readcstyleesc(out); + break; + } + /* FALLTHROUGH */ case CWORD: USTPUTC(c, out); break; @@ -1232,6 +1360,7 @@ readtoken1(int firstc, char const *initialsyntax, char *eofmark, int striptabs) case CSQUOTE: USTPUTC(CTLQUOTEMARK, out); state[level].syntax = SQSYNTAX; + sqiscstyle = 0; break; case CDQUOTE: USTPUTC(CTLQUOTEMARK, out); @@ -1450,11 +1579,7 @@ parsesub: { int c1; c = pgetc(); - if (c != '(' && c != '{' && (is_eof(c) || !is_name(c)) && - !is_special(c)) { - USTPUTC('$', out); - pungetc(); - } else if (c == '(') { /* $(command) or $((arith)) */ + if (c == '(') { /* $(command) or $((arith)) */ if (pgetc() == '(') { PARSEARITH(); } else { @@ -1465,7 +1590,7 @@ parsesub: { state[level].syntax == DQSYNTAX || state[level].syntax == ARISYNTAX); } - } else { + } else if (c == '{' || is_name(c) || is_special(c)) { USTPUTC(CTLVAR, out); typeloc = out - stackblock(); USTPUTC(VSNORMAL, out); @@ -1612,6 +1737,14 @@ varname: newvarnest++; } } + } else if (c == '\'' && state[level].syntax == BASESYNTAX) { + /* $'cstylequotes' */ + USTPUTC(CTLQUOTEMARK, out); + state[level].syntax = SQSYNTAX; + sqiscstyle = 1; + } else { + USTPUTC('$', out); + pungetc(); } goto parsesub_return; } diff --git a/bin/sh/parser.h b/bin/sh/parser.h index 64ec97f..dfbda86 100644 --- a/bin/sh/parser.h +++ b/bin/sh/parser.h @@ -34,16 +34,16 @@ */ /* control characters in argument strings */ -#define CTLESC '\201' -#define CTLVAR '\202' -#define CTLENDVAR '\203' -#define CTLBACKQ '\204' +#define CTLESC '\300' +#define CTLVAR '\301' +#define CTLENDVAR '\371' +#define CTLBACKQ '\372' #define CTLQUOTE 01 /* ored with CTLBACKQ code if in quotes */ /* CTLBACKQ | CTLQUOTE == '\205' */ -#define CTLARI '\206' -#define CTLENDARI '\207' -#define CTLQUOTEMARK '\210' -#define CTLQUOTEEND '\211' /* only for ${v+-...} */ +#define CTLARI '\374' +#define CTLENDARI '\375' +#define CTLQUOTEMARK '\376' +#define CTLQUOTEEND '\377' /* only for ${v+-...} */ /* variable substitution byte (follows CTLVAR) */ #define VSTYPE 0x0f /* type of variable substitution */ diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index e9f34fb..e240d7d 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd March 20, 2011 +.Dd May 5, 2011 .Dt SH 1 .Os .Sh NAME @@ -396,13 +396,82 @@ Quoting is used to remove the special meaning of certain characters or words to the shell, such as operators, whitespace, keywords, or alias names. .Pp -There are three types of quoting: matched single quotes, +There are four types of quoting: matched single quotes, +dollar-single quotes, matched double quotes, and backslash. .Bl -tag -width indent .It Single Quotes Enclosing characters in single quotes preserves the literal meaning of all the characters (except single quotes, making it impossible to put single-quotes in a single-quoted string). +.It Dollar-Single Quotes +Enclosing characters between +.Li $' +and +.Li ' +preserves the literal meaning of all characters +except backslashes and single quotes. +A backslash introduces a C-style escape sequence: +.Bl -tag -width xUnnnnnnnn +.It \ea +Alert (ring the terminal bell) +.It \eb +Backspace +.It \ec Ns Ar c +The control character denoted by +.Li ^ Ns Ar c +in +.Xr stty 1 . +If +.Ar c +is a backslash, it must be doubled. +.It \ee +The ESC character +.Tn ( ASCII +0x1b) +.It \ef +Formfeed +.It \en +Newline +.It \er +Carriage return +.It \et +Horizontal tab +.It \ev +Vertical tab +.It \e\e +Literal backslash +.It \e\&' +Literal single-quote +.It \e\&" +Literal double-quote +.It \e Ns Ar nnn +The byte whose octal value is +.Ar nnn +(one to three digits) +.It \ex Ns Ar nn +The byte whose hexadecimal value is +.Ar nn +(one or more digits only the last two of which are used) +.It \eu Ns Ar nnnn +The Unicode code point +.Ar nnnn +(four hexadecimal digits) +.It \eU Ns Ar nnnnnnnn +The Unicode code point +.Ar nnnnnnnn +(eight hexadecimal digits) +.El +.Pp +The sequences for Unicode code points currently only provide useful results +for values below 128. +They reject code point 0 and UTF-16 surrogates. +.Pp +If an escape sequence would produce a byte with value 0, +that byte and the rest of the string until the matching single-quote +are ignored. +.Pp +Any other string starting with a backslash is an error. .It Double Quotes Enclosing characters within double quotes preserves the literal meaning of all characters except dollar sign diff --git a/contrib/llvm/lib/Support/Unix/Host.inc b/contrib/llvm/lib/Support/Unix/Host.inc index 8cbec8c..9c75230 100644 --- a/contrib/llvm/lib/Support/Unix/Host.inc +++ b/contrib/llvm/lib/Support/Unix/Host.inc @@ -35,6 +35,9 @@ static std::string getOSVersion() { } std::string sys::getHostTriple() { +#ifdef __FreeBSD__ + return LLVM_HOSTTRIPLE; +#else // FIXME: Derive directly instead of relying on the autoconf generated // variable. @@ -91,4 +94,5 @@ std::string sys::getHostTriple() { } return Triple; +#endif } diff --git a/contrib/one-true-awk/FIXES b/contrib/one-true-awk/FIXES index 36ef237..e6edc53 100644 --- a/contrib/one-true-awk/FIXES +++ b/contrib/one-true-awk/FIXES @@ -25,6 +25,11 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +May 6, 2011: + added #ifdef for isblank. + now allows -ffoo as well as -f foo arguments. + (thanks, ruslan) + May 1, 2011: after advice from todd miller, kevin lo, ruslan ermilov, and arnold robbins, changed srand() to return the previous diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index 27a49e4..b40a39d 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -25,7 +25,7 @@ THIS SOFTWARE. #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -const char *version = "version 20110501 (FreeBSD)"; +const char *version = "version 20110506 (FreeBSD)"; #define DEBUG #include <stdio.h> @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) safe = 1; break; case 'f': /* next argument is program filename */ - if (argv[1][2] != 0) { /* arg is -fsomething */ + if (argv[1][2] != 0) { /* arg is -fsomething */ if (npfile >= MAX_PFILE - 1) FATAL("too many -f options"); pfile[npfile++] = &argv[1][2]; diff --git a/contrib/one-true-awk/proctab.c b/contrib/one-true-awk/proctab.c deleted file mode 100644 index e4eddfd..0000000 --- a/contrib/one-true-awk/proctab.c +++ /dev/null @@ -1,207 +0,0 @@ -#include <stdio.h> -#include "awk.h" -#include "ytab.h" - -static char *printname[93] = { - (char *) "FIRSTTOKEN", /* 258 */ - (char *) "PROGRAM", /* 259 */ - (char *) "PASTAT", /* 260 */ - (char *) "PASTAT2", /* 261 */ - (char *) "XBEGIN", /* 262 */ - (char *) "XEND", /* 263 */ - (char *) "NL", /* 264 */ - (char *) "ARRAY", /* 265 */ - (char *) "MATCH", /* 266 */ - (char *) "NOTMATCH", /* 267 */ - (char *) "MATCHOP", /* 268 */ - (char *) "FINAL", /* 269 */ - (char *) "DOT", /* 270 */ - (char *) "ALL", /* 271 */ - (char *) "CCL", /* 272 */ - (char *) "NCCL", /* 273 */ - (char *) "CHAR", /* 274 */ - (char *) "OR", /* 275 */ - (char *) "STAR", /* 276 */ - (char *) "QUEST", /* 277 */ - (char *) "PLUS", /* 278 */ - (char *) "EMPTYRE", /* 279 */ - (char *) "AND", /* 280 */ - (char *) "BOR", /* 281 */ - (char *) "APPEND", /* 282 */ - (char *) "EQ", /* 283 */ - (char *) "GE", /* 284 */ - (char *) "GT", /* 285 */ - (char *) "LE", /* 286 */ - (char *) "LT", /* 287 */ - (char *) "NE", /* 288 */ - (char *) "IN", /* 289 */ - (char *) "ARG", /* 290 */ - (char *) "BLTIN", /* 291 */ - (char *) "BREAK", /* 292 */ - (char *) "CLOSE", /* 293 */ - (char *) "CONTINUE", /* 294 */ - (char *) "DELETE", /* 295 */ - (char *) "DO", /* 296 */ - (char *) "EXIT", /* 297 */ - (char *) "FOR", /* 298 */ - (char *) "FUNC", /* 299 */ - (char *) "SUB", /* 300 */ - (char *) "GSUB", /* 301 */ - (char *) "IF", /* 302 */ - (char *) "INDEX", /* 303 */ - (char *) "LSUBSTR", /* 304 */ - (char *) "MATCHFCN", /* 305 */ - (char *) "NEXT", /* 306 */ - (char *) "NEXTFILE", /* 307 */ - (char *) "ADD", /* 308 */ - (char *) "MINUS", /* 309 */ - (char *) "MULT", /* 310 */ - (char *) "DIVIDE", /* 311 */ - (char *) "MOD", /* 312 */ - (char *) "ASSIGN", /* 313 */ - (char *) "ASGNOP", /* 314 */ - (char *) "ADDEQ", /* 315 */ - (char *) "SUBEQ", /* 316 */ - (char *) "MULTEQ", /* 317 */ - (char *) "DIVEQ", /* 318 */ - (char *) "MODEQ", /* 319 */ - (char *) "POWEQ", /* 320 */ - (char *) "PRINT", /* 321 */ - (char *) "PRINTF", /* 322 */ - (char *) "SPRINTF", /* 323 */ - (char *) "ELSE", /* 324 */ - (char *) "INTEST", /* 325 */ - (char *) "CONDEXPR", /* 326 */ - (char *) "POSTINCR", /* 327 */ - (char *) "PREINCR", /* 328 */ - (char *) "POSTDECR", /* 329 */ - (char *) "PREDECR", /* 330 */ - (char *) "VAR", /* 331 */ - (char *) "IVAR", /* 332 */ - (char *) "VARNF", /* 333 */ - (char *) "CALL", /* 334 */ - (char *) "NUMBER", /* 335 */ - (char *) "STRING", /* 336 */ - (char *) "REGEXPR", /* 337 */ - (char *) "GETLINE", /* 338 */ - (char *) "SUBSTR", /* 339 */ - (char *) "SPLIT", /* 340 */ - (char *) "RETURN", /* 341 */ - (char *) "WHILE", /* 342 */ - (char *) "CAT", /* 343 */ - (char *) "UMINUS", /* 344 */ - (char *) "NOT", /* 345 */ - (char *) "POWER", /* 346 */ - (char *) "INCR", /* 347 */ - (char *) "DECR", /* 348 */ - (char *) "INDIRECT", /* 349 */ - (char *) "LASTTOKEN", /* 350 */ -}; - - -Cell *(*proctab[93])(Node **, int) = { - nullproc, /* FIRSTTOKEN */ - program, /* PROGRAM */ - pastat, /* PASTAT */ - dopa2, /* PASTAT2 */ - nullproc, /* XBEGIN */ - nullproc, /* XEND */ - nullproc, /* NL */ - array, /* ARRAY */ - matchop, /* MATCH */ - matchop, /* NOTMATCH */ - nullproc, /* MATCHOP */ - nullproc, /* FINAL */ - nullproc, /* DOT */ - nullproc, /* ALL */ - nullproc, /* CCL */ - nullproc, /* NCCL */ - nullproc, /* CHAR */ - nullproc, /* OR */ - nullproc, /* STAR */ - nullproc, /* QUEST */ - nullproc, /* PLUS */ - nullproc, /* EMPTYRE */ - boolop, /* AND */ - boolop, /* BOR */ - nullproc, /* APPEND */ - relop, /* EQ */ - relop, /* GE */ - relop, /* GT */ - relop, /* LE */ - relop, /* LT */ - relop, /* NE */ - instat, /* IN */ - arg, /* ARG */ - bltin, /* BLTIN */ - jump, /* BREAK */ - closefile, /* CLOSE */ - jump, /* CONTINUE */ - awkdelete, /* DELETE */ - dostat, /* DO */ - jump, /* EXIT */ - forstat, /* FOR */ - nullproc, /* FUNC */ - sub, /* SUB */ - gsub, /* GSUB */ - ifstat, /* IF */ - sindex, /* INDEX */ - nullproc, /* LSUBSTR */ - matchop, /* MATCHFCN */ - jump, /* NEXT */ - jump, /* NEXTFILE */ - arith, /* ADD */ - arith, /* MINUS */ - arith, /* MULT */ - arith, /* DIVIDE */ - arith, /* MOD */ - assign, /* ASSIGN */ - nullproc, /* ASGNOP */ - assign, /* ADDEQ */ - assign, /* SUBEQ */ - assign, /* MULTEQ */ - assign, /* DIVEQ */ - assign, /* MODEQ */ - assign, /* POWEQ */ - printstat, /* PRINT */ - awkprintf, /* PRINTF */ - awksprintf, /* SPRINTF */ - nullproc, /* ELSE */ - intest, /* INTEST */ - condexpr, /* CONDEXPR */ - incrdecr, /* POSTINCR */ - incrdecr, /* PREINCR */ - incrdecr, /* POSTDECR */ - incrdecr, /* PREDECR */ - nullproc, /* VAR */ - nullproc, /* IVAR */ - getnf, /* VARNF */ - call, /* CALL */ - nullproc, /* NUMBER */ - nullproc, /* STRING */ - nullproc, /* REGEXPR */ - awkgetline, /* GETLINE */ - substr, /* SUBSTR */ - split, /* SPLIT */ - jump, /* RETURN */ - whilestat, /* WHILE */ - cat, /* CAT */ - arith, /* UMINUS */ - boolop, /* NOT */ - arith, /* POWER */ - nullproc, /* INCR */ - nullproc, /* DECR */ - indirect, /* INDIRECT */ - nullproc, /* LASTTOKEN */ -}; - -char *tokname(int n) -{ - static char buf[100]; - - if (n < FIRSTTOKEN || n > LASTTOKEN) { - sprintf(buf, "token %d", n); - return buf; - } - return printname[n-FIRSTTOKEN]; -} diff --git a/lib/libc/net/sctp_sys_calls.c b/lib/libc/net/sctp_sys_calls.c index fcf4886..0921669 100644 --- a/lib/libc/net/sctp_sys_calls.c +++ b/lib/libc/net/sctp_sys_calls.c @@ -1,33 +1,35 @@ -/* $KAME: sctp_sys_calls.c,v 1.9 2004/08/17 06:08:53 itojun Exp $ */ - -/* - * Copyright (C) 2002-2007 Cisco Systems Inc, - * All rights reserved. +/*- + * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * modification, are permitted provided that the following conditions are met: + * + * a) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * b) Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * + * c) Neither the name of Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. */ + #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <stdio.h> @@ -58,7 +60,6 @@ __FBSDID("$FreeBSD$"); #define SCTP_CONTROL_VEC_SIZE_SND 8192 #define SCTP_CONTROL_VEC_SIZE_RCV 16384 #define SCTP_STACK_BUF_SIZE 2048 -#define SCTP_SMALL_IOVEC_SIZE 2 #ifdef SCTP_DEBUG_PRINT_ADDRESS @@ -398,6 +399,9 @@ sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t * size) case SCTP_LOCAL_AUTH_CHUNKS: ((struct sctp_authchunks *)arg)->gauth_assoc_id = id; break; + case SCTP_TIMEOUTS: + ((struct sctp_timeouts *)arg)->stimo_assoc_id = id; + break; default: break; } @@ -551,11 +555,10 @@ sctp_sendmsg(int s, return (syscall(SYS_sctp_generic_sendmsg, s, data, len, to, tolen, &sinfo, 0)); #else - ssize_t sz; struct msghdr msg; struct sctp_sndrcvinfo *s_info; - struct iovec iov[SCTP_SMALL_IOVEC_SIZE]; + struct iovec iov; char controlVector[SCTP_CONTROL_VEC_SIZE_RCV]; struct cmsghdr *cmsg; struct sockaddr *who = NULL; @@ -564,20 +567,8 @@ sctp_sendmsg(int s, struct sockaddr_in6 in6; } addr; -/* - fprintf(io, "sctp_sendmsg(sd:%d, data:%x, len:%d, to:%x, tolen:%d, ppid:%x, flags:%x str:%d ttl:%d ctx:%x\n", - s, - (u_int)data, - (int)len, - (u_int)to, - (int)tolen, - ppid, flags, - (int)stream_no, - (int)timetolive, - (u_int)context); - fflush(io); -*/ - if ((tolen > 0) && ((to == NULL) || (tolen < sizeof(struct sockaddr)))) { + if ((tolen > 0) && + ((to == NULL) || (tolen < sizeof(struct sockaddr)))) { errno = EINVAL; return -1; } @@ -587,7 +578,8 @@ sctp_sendmsg(int s, errno = EINVAL; return -1; } - if ((to->sa_len > 0) && (to->sa_len != sizeof(struct sockaddr_in))) { + if ((to->sa_len > 0) && + (to->sa_len != sizeof(struct sockaddr_in))) { errno = EINVAL; return -1; } @@ -598,7 +590,8 @@ sctp_sendmsg(int s, errno = EINVAL; return -1; } - if ((to->sa_len > 0) && (to->sa_len != sizeof(struct sockaddr_in6))) { + if ((to->sa_len > 0) && + (to->sa_len != sizeof(struct sockaddr_in6))) { errno = EINVAL; return -1; } @@ -610,10 +603,8 @@ sctp_sendmsg(int s, } who = (struct sockaddr *)&addr; } - iov[0].iov_base = (char *)data; - iov[0].iov_len = len; - iov[1].iov_base = NULL; - iov[1].iov_len = 0; + iov.iov_base = (char *)data; + iov.iov_len = len; if (who) { msg.msg_name = (caddr_t)who; @@ -622,7 +613,7 @@ sctp_sendmsg(int s, msg.msg_name = (caddr_t)NULL; msg.msg_namelen = 0; } - msg.msg_iov = iov; + msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = (caddr_t)controlVector; @@ -681,7 +672,7 @@ sctp_send(int sd, const void *data, size_t len, #else ssize_t sz; struct msghdr msg; - struct iovec iov[SCTP_SMALL_IOVEC_SIZE]; + struct iovec iov; struct sctp_sndrcvinfo *s_info; char controlVector[SCTP_CONTROL_VEC_SIZE_SND]; struct cmsghdr *cmsg; @@ -690,14 +681,12 @@ sctp_send(int sd, const void *data, size_t len, errno = EINVAL; return (-1); } - iov[0].iov_base = (char *)data; - iov[0].iov_len = len; - iov[1].iov_base = NULL; - iov[1].iov_len = 0; + iov.iov_base = (char *)data; + iov.iov_len = len; msg.msg_name = 0; msg.msg_namelen = 0; - msg.msg_iov = iov; + msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = (caddr_t)controlVector; @@ -736,7 +725,7 @@ sctp_sendx(int sd, const void *msg, size_t msg_len, return (-1); } #ifdef SYS_sctp_generic_sendmsg - if (addrcnt < SCTP_SMALL_IOVEC_SIZE) { + if (addrcnt == 1) { socklen_t l; /* @@ -846,18 +835,18 @@ sctp_recvmsg(int s, int *msg_flags) { #ifdef SYS_sctp_generic_recvmsg - struct iovec iov[SCTP_SMALL_IOVEC_SIZE]; + struct iovec iov; - iov[0].iov_base = dbuf; - iov[0].iov_len = len; + iov.iov_base = dbuf; + iov.iov_len = len; return (syscall(SYS_sctp_generic_recvmsg, s, - iov, 1, from, fromlen, sinfo, msg_flags)); + &iov, 1, from, fromlen, sinfo, msg_flags)); #else struct sctp_sndrcvinfo *s_info; ssize_t sz; int sinfo_found = 0; struct msghdr msg; - struct iovec iov[SCTP_SMALL_IOVEC_SIZE]; + struct iovec iov; char controlVector[SCTP_CONTROL_VEC_SIZE_RCV]; struct cmsghdr *cmsg; @@ -866,30 +855,28 @@ sctp_recvmsg(int s, return (-1); } msg.msg_flags = 0; - iov[0].iov_base = dbuf; - iov[0].iov_len = len; - iov[1].iov_base = NULL; - iov[1].iov_len = 0; + iov.iov_base = dbuf; + iov.iov_len = len; msg.msg_name = (caddr_t)from; if (fromlen == NULL) msg.msg_namelen = 0; else msg.msg_namelen = *fromlen; - msg.msg_iov = iov; + msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = (caddr_t)controlVector; msg.msg_controllen = sizeof(controlVector); errno = 0; sz = recvmsg(s, &msg, *msg_flags); - if (sz <= 0) + *msg_flags = msg.msg_flags; + if (sz <= 0) { return (sz); - + } s_info = NULL; len = sz; - *msg_flags = msg.msg_flags; - if (sinfo) + if (sinfo) { sinfo->sinfo_assoc_id = 0; - + } if ((msg.msg_controllen) && sinfo) { /* * parse through and see if we find the sctp_sndrcvinfo (if @@ -940,7 +927,7 @@ int sctp_peeloff(int sd, sctp_assoc_t assoc_id) { struct sctp_peeloff_opt peeloff; - int error; + int result; socklen_t optlen; /* set in the socket option params */ @@ -948,10 +935,9 @@ sctp_peeloff(int sd, sctp_assoc_t assoc_id) peeloff.s = sd; peeloff.assoc_id = assoc_id; optlen = sizeof(peeloff); - error = getsockopt(sd, IPPROTO_SCTP, SCTP_PEELOFF, (void *)&peeloff, - &optlen); - if (error) { - errno = error; + result = getsockopt(sd, IPPROTO_SCTP, SCTP_PEELOFF, (void *)&peeloff, &optlen); + + if (result < 0) { return (-1); } else { return (peeloff.new_sd); @@ -984,4 +970,3 @@ sctp_peeloff(int sd, sctp_assoc_t assoc_id) #undef SCTP_CONTROL_VEC_SIZE_SND #undef SCTP_CONTROL_VEC_SIZE_RCV #undef SCTP_STACK_BUF_SIZE -#undef SCTP_SMALL_IOVEC_SIZE diff --git a/lib/libutil/libutil.h b/lib/libutil/libutil.h index 5dca37c..f39e4f5 100644 --- a/lib/libutil/libutil.h +++ b/lib/libutil/libutil.h @@ -41,22 +41,13 @@ #include <sys/cdefs.h> #include <sys/_types.h> +#include <sys/_stdint.h> #ifndef _GID_T_DECLARED typedef __gid_t gid_t; #define _GID_T_DECLARED #endif -#ifndef _INT64_T_DECLARED -typedef __int64_t int64_t; -#define _INT64_T_DECLARED -#endif - -#ifndef _UINT64_T_DECLARED -typedef __uint64_t uint64_t; -#define _UINT64_T_DECLARED -#endif - #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED diff --git a/release/amd64/mkisoimages.sh b/release/amd64/mkisoimages.sh index 384f44f..74a34a9 100644 --- a/release/amd64/mkisoimages.sh +++ b/release/amd64/mkisoimages.sh @@ -23,7 +23,6 @@ # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. -publisher="The FreeBSD Project. http://www.freebsd.org/" if [ "x$1" = "x-b" ]; then # This is highly x86-centric and will be used directly below. bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot" diff --git a/release/generate-release.sh b/release/generate-release.sh index e29aabb..62d0528 100755 --- a/release/generate-release.sh +++ b/release/generate-release.sh @@ -21,7 +21,9 @@ # mkdir -p $2/usr/src -svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src || exit 1 +set -e # Everything must succeed + +svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src if [ ! -z $CVSUP_HOST ]; then cat > $2/docports-supfile << EOF *default host=$CVSUP_HOST @@ -35,32 +37,33 @@ if [ ! -z $CVSUP_HOST ]; then EOF elif [ ! -z $CVSROOT ]; then cd $2/usr - cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} ports || exit 1 - cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} doc || exit 1 + cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} ports + cvs -R ${CVSARGS} -d ${CVSROOT} co -P -r ${CVS_TAG:-HEAD} doc fi cd $2/usr/src -make $MAKE_FLAGS buildworld || exit 1 -make installworld distribution DESTDIR=$2 || exit 1 +make $MAKE_FLAGS buildworld +make installworld distribution DESTDIR=$2 mount -t devfs devfs $2/dev +trap "umount $2/dev" EXIT # Clean up devfs mount on exit if [ ! -z $CVSUP_HOST ]; then cp /etc/resolv.conf $2/etc/resolv.conf # Checkout ports and doc trees - chroot $2 /usr/bin/csup /docports-supfile || exit 1 + chroot $2 /usr/bin/csup /docports-supfile fi if [ -d $2/usr/doc ]; then cp /etc/resolv.conf $2/etc/resolv.conf # Build ports to build the docs, then build the docs - chroot $2 /bin/sh -c 'pkg_add -r docproj || (cd /usr/ports/textproc/docproj && make install clean BATCH=yes WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes)' || exit 1 - chroot $2 /bin/sh -c "cd /usr/doc && make $MAKE_FLAGS 'FORMATS=html html-split txt' URLS_ABSOLUTE=YES" || exit 1 + chroot $2 /bin/sh -c 'pkg_add -r docproj || (cd /usr/ports/textproc/docproj && make install clean BATCH=yes WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes)' + chroot $2 make -C /usr/doc $MAKE_FLAGS 'FORMATS=html html-split txt' URLS_ABSOLUTE=YES fi -chroot $2 /bin/sh -c "cd /usr/src && make $MAKE_FLAGS buildworld buildkernel" || exit 1 -chroot $2 /bin/sh -c "cd /usr/src/release && make obj" || exit 1 -chroot $2 /bin/sh -c "cd /usr/src/release && make release" || exit 1 -chroot $2 /bin/sh -c "cd /usr/src/release && make install DESTDIR=/R" || exit 1 +chroot $2 make -C /usr/src $MAKE_FLAGS buildworld buildkernel +chroot $2 make -C /usr/src/release obj +chroot $2 make -C /usr/src/release release +chroot $2 make -C /usr/src/release install DESTDIR=/R diff --git a/release/i386/mkisoimages.sh b/release/i386/mkisoimages.sh index 384f44f..74a34a9 100644 --- a/release/i386/mkisoimages.sh +++ b/release/i386/mkisoimages.sh @@ -23,7 +23,6 @@ # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. -publisher="The FreeBSD Project. http://www.freebsd.org/" if [ "x$1" = "x-b" ]; then # This is highly x86-centric and will be used directly below. bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot" diff --git a/release/ia64/mkisoimages.sh b/release/ia64/mkisoimages.sh index edb4bc3..33ba192 100644 --- a/release/ia64/mkisoimages.sh +++ b/release/ia64/mkisoimages.sh @@ -41,27 +41,6 @@ LABEL=$1; shift NAME=$1; shift BASE=$1; shift -MKISOFS=mkisofs -MKISOFS_PKG=cdrtools -MKISOFS_PORT=/usr/ports/sysutils/${MKISOFS_PKG} - -if ! which ${MKISOFS} > /dev/null; then - echo -n "${MKISOFS}(8) does not exist: " - if [ -f ${MKISOFS_PORT}/Makefile ]; then - echo building the port... - if ! (cd ${MKISOFS_PORT} && make install BATCH=yes && make clean); then - echo "error: cannot build ${MKISOFS}(8). Bailing out..." - exit 2 - fi - else - echo fetching the package... - if ! pkg_add -r ${MKISOFS_PKG}; then - echo "error: cannot fetch ${MKISOFS}(8). Bailing out..." - exit 2 - fi - fi -fi - EFIPART=efipart.sys # To create a bootable CD under EFI, the boot image should be an EFI @@ -84,15 +63,13 @@ if [ $bootable = yes ]; then mv $MNT/boot/loader.efi $MNT/efi/boot/bootia64.efi umount $MNT mdconfig -d -u $md - BOOTOPTS="-b $EFIPART -no-emul-boot" + BOOTOPTS="-b bootimage=i386;$EFIPART -o no-emul-boot" else BOOTOPTS="" fi -publisher="The FreeBSD Project. http://www.freebsd.org/" - echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab -$MKISOFS $BOOTOPTS -r -J -V $LABEL -publisher "$publisher" -o $NAME $BASE $* +makefs -t cd9660 $BOOTOPTS -o rockridge -o label=$LABEL $NAME $BASE $* rm -f $BASE/$EFIPART rm $1/etc/fstab exit 0 diff --git a/release/pc98/mkisoimages.sh b/release/pc98/mkisoimages.sh index 45b4c7c..313641b 100644 --- a/release/pc98/mkisoimages.sh +++ b/release/pc98/mkisoimages.sh @@ -23,7 +23,6 @@ # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. -publisher="The FreeBSD Project. http://www.freebsd.org/" if [ "x$1" = "x-b" ]; then # This is highly x86-centric and will be used directly below. bootable="-o generic-bootimage=$4/boot/cdboot" diff --git a/release/powerpc/mkisoimages.sh b/release/powerpc/mkisoimages.sh index 52c3b08..5c4b0df 100644 --- a/release/powerpc/mkisoimages.sh +++ b/release/powerpc/mkisoimages.sh @@ -23,13 +23,11 @@ # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. -publisher="The FreeBSD Project. http://www.freebsd.org/" if [ "x$1" = "x-b" ]; then uudecode -o /tmp/hfs-boot-block.bz2 `dirname $0`/hfs-boot.bz2.uu bzip2 -d /tmp/hfs-boot-block.bz2 OFFSET=$(hd /tmp/hfs-boot-block | grep 'Loader START' | cut -f 1 -d ' ') OFFSET=0x$(echo 0x$OFFSET | awk '{printf("%x\n",$1/512);}') - echo dd if=$4/boot/loader of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc dd if=$4/boot/loader of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc bootable="-o bootimage=macppc;/tmp/hfs-boot-block -o no-emul-boot" diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 1a5514f..f71da84 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -134,6 +134,7 @@ MAN= aac.4 \ geom.4 \ geom_fox.4 \ geom_linux_lvm.4 \ + geom_map.4 \ geom_uzip.4 \ gif.4 \ gpib.4 \ diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 8385c50..50edf73 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -781,6 +781,7 @@ MLINKS+=make_dev.9 destroy_dev.9 \ make_dev.9 destroy_dev_sched_cb.9 \ make_dev.9 dev_depends.9 \ make_dev.9 make_dev_alias.9 \ + make_dev.9 make_dev_alias_p.9 \ make_dev.9 make_dev_cred.9 \ make_dev.9 make_dev_credf.9 \ make_dev.9 make_dev_p.9 diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 57e91a8..9e20f95 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -177,11 +177,34 @@ mem_range_AP_init(void) static void topo_probe_amd(void) { + int core_id_bits; + int id; /* AMD processors do not support HTT. */ - cpu_cores = (amd_feature2 & AMDID2_CMP) != 0 ? - (cpu_procinfo2 & AMDID_CMP_CORES) + 1 : 1; cpu_logical = 1; + + if ((amd_feature2 & AMDID2_CMP) == 0) { + cpu_cores = 1; + return; + } + + core_id_bits = (cpu_procinfo2 & AMDID_COREID_SIZE) >> + AMDID_COREID_SIZE_SHIFT; + if (core_id_bits == 0) { + cpu_cores = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; + return; + } + + /* Fam 10h and newer should get here. */ + for (id = 0; id <= MAX_APIC_ID; id++) { + /* Check logical CPU availability. */ + if (!cpu_info[id].cpu_present || cpu_info[id].cpu_disabled) + continue; + /* Check if logical CPU has the same package ID. */ + if ((id >> core_id_bits) != (boot_cpu_id >> core_id_bits)) + continue; + cpu_cores++; + } } /* diff --git a/sys/amd64/include/specialreg.h b/sys/amd64/include/specialreg.h index 9428dd9..ac52063 100644 --- a/sys/amd64/include/specialreg.h +++ b/sys/amd64/include/specialreg.h @@ -228,6 +228,8 @@ * AMD extended function 8000_0008h ecx info */ #define AMDID_CMP_CORES 0x000000ff +#define AMDID_COREID_SIZE 0x0000f000 +#define AMDID_COREID_SIZE_SHIFT 12 /* * CPUID manufacturers identifiers diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile index 6dc27d2..9568c1c1 100644 --- a/sys/boot/i386/boot2/Makefile +++ b/sys/boot/i386/boot2/Makefile @@ -43,7 +43,8 @@ CFLAGS= -Os \ -Winline --param max-inline-insns-single=100 .if ${CC:T:Mclang} == "clang" -CFLAGS+= -mllvm -stack-alignment=8 -mllvm -inline-threshold=3 +CFLAGS+= -mllvm -stack-alignment=8 -mllvm -inline-threshold=3 \ + -mllvm -enable-load-pre=false # XXX: clang integrated-as doesn't grok .codeNN directives yet CFLAGS+= ${.IMPSRC:T:Mboot1.S:C/^.+$/-no-integrated-as/} .endif diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c index b4d0652..f26bf3b 100644 --- a/sys/dev/ahci/ahci.c +++ b/sys/dev/ahci/ahci.c @@ -184,6 +184,7 @@ static struct { {0x91201b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS|AHCI_Q_NOBSYRES}, {0x91231b4b, 0x11, "Marvell 88SE912x", AHCI_Q_NOBSYRES}, {0x91231b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS|AHCI_Q_SATA2|AHCI_Q_NOBSYRES}, + {0x91821b4b, 0x00, "Marvell 88SE9182", AHCI_Q_NOBSYRES}, {0x06201103, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES}, {0x06201b4b, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES}, {0x06221103, 0x00, "HighPoint RocketRAID 622", AHCI_Q_NOBSYRES}, diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416.h b/sys/dev/ath/ath_hal/ar5416/ar5416.h index 38a346e..3738aaf 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416.h +++ b/sys/dev/ath/ath_hal/ar5416/ar5416.h @@ -199,6 +199,7 @@ extern HAL_STATUS ar5416GetCapability(struct ath_hal *ah, extern HAL_BOOL ar5416GetDiagState(struct ath_hal *ah, int request, const void *args, uint32_t argsize, void **result, uint32_t *resultsize); +extern HAL_BOOL ar5416SetRifsDelay(struct ath_hal *ah, HAL_BOOL enable); extern HAL_BOOL ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip); diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c b/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c index aa31824..087bf92 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c @@ -368,6 +368,25 @@ typedef struct { uint8_t qcu_complete_state; } hal_mac_hang_check_t; +HAL_BOOL +ar5416SetRifsDelay(struct ath_hal *ah, HAL_BOOL enable) +{ + uint32_t val; + + /* Only support disabling RIFS delay for now */ + HALASSERT(enable == AH_FALSE); + + if (enable == AH_TRUE) + return AH_FALSE; + + /* Change RIFS init delay to 0 */ + val = OS_REG_READ(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS); + val &= ~AR_PHY_RIFS_INIT_DELAY; + OS_REG_WRITE(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS, val); + + return AH_TRUE; +} + static HAL_BOOL ar5416CompareDbgHang(struct ath_hal *ah, const mac_dbg_regs_t *regs, const hal_mac_hang_check_t *check) diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c index 4917caa..12f30f1 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c @@ -2520,11 +2520,8 @@ ar5416OverrideIni(struct ath_hal *ah, const struct ieee80211_channel *chan) * Disable RIFS search on some chips to avoid baseband * hang issues. */ - if (AR_SREV_HOWL(ah) || AR_SREV_SOWL(ah)) { - val = OS_REG_READ(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS); - val &= ~AR_PHY_RIFS_INIT_DELAY; - OS_REG_WRITE(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS, val); - } + if (AR_SREV_HOWL(ah) || AR_SREV_SOWL(ah)) + (void) ar5416SetRifsDelay(ah, AH_FALSE); } struct ini { diff --git a/sys/dev/bm/if_bm.c b/sys/dev/bm/if_bm.c index ded2b42..481d7cb 100644 --- a/sys/dev/bm/if_bm.c +++ b/sys/dev/bm/if_bm.c @@ -558,6 +558,7 @@ bm_attach(device_t dev) } /* alloc interrupt */ + bm_disable_interrupts(sc); sc->sc_txdmairqid = BM_TXDMA_INTERRUPT; sc->sc_txdmairq = bus_alloc_resource_any(dev, SYS_RES_IRQ, @@ -591,9 +592,6 @@ bm_attach(device_t dev) eaddr = sc->sc_enaddr; OF_getprop(node, "local-mac-address", eaddr, ETHER_ADDR_LEN); - /* reset the adapter */ - bm_chip_setup(sc); - /* * Setup MII * On Apple BMAC controllers, we end up in a weird state of @@ -608,6 +606,9 @@ bm_attach(device_t dev) return (error); } + /* reset the adapter */ + bm_chip_setup(sc); + sc->sc_mii = device_get_softc(sc->sc_miibus); if_initname(ifp, device_get_name(sc->sc_dev), @@ -1129,31 +1130,26 @@ bm_chip_setup(struct bm_softc *sc) { uint16_t reg; uint16_t *eaddr_sect; - char path[128]; - ihandle_t bmac_ih; + struct mii_data *mii; + struct mii_softc *miisc; eaddr_sect = (uint16_t *)(sc->sc_enaddr); + dbdma_stop(sc->sc_txdma); + dbdma_stop(sc->sc_rxdma); - /* - * Enable BMAC cell by opening and closing its OF node. This enables - * the cell in macio as a side effect. We should probably directly - * twiddle the FCR bits, but we lack a good interface for this at the - * present time. - */ - - OF_package_to_path(ofw_bus_get_node(sc->sc_dev), path, sizeof(path)); - bmac_ih = OF_open(path); - if (bmac_ih == -1) { - device_printf(sc->sc_dev, - "Enabling BMAC cell failed! Hoping it's already active.\n"); - } else { - OF_close(bmac_ih); + /* Reset MII */ + mii = device_get_softc(sc->sc_miibus); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) { + PHY_RESET(miisc); + PHY_WRITE(miisc, MII_BMCR, PHY_READ(miisc, MII_BMCR) & + ~BMCR_ISO); } /* Reset chip */ CSR_WRITE_2(sc, BM_RX_RESET, 0x0000); CSR_WRITE_2(sc, BM_TX_RESET, 0x0001); do { + DELAY(10); reg = CSR_READ_2(sc, BM_TX_RESET); } while (reg & 0x0001); diff --git a/sys/dev/coretemp/coretemp.c b/sys/dev/coretemp/coretemp.c index 777a591..411b9ee 100644 --- a/sys/dev/coretemp/coretemp.c +++ b/sys/dev/coretemp/coretemp.c @@ -197,6 +197,15 @@ coretemp_attach(device_t dev) default: /* Unknown stepping */ break; } + } else if (cpu_model == 0x1c) { + switch (cpu_stepping) { + case 0xa: /* 45nm Atom D400, N400 and D500 series */ + sc->sc_tjmax = 100; + break; + default: + sc->sc_tjmax = 90; + break; + } } else { /* * Attempt to get Tj(max) from MSR IA32_TEMPERATURE_TARGET. diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 9037318..929f31b 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -415,7 +415,7 @@ t4_attach(device_t dev) /* These are total (sum of all ports) limits for a bus driver */ rc = -t4_cfg_pfvf(sc, sc->mbox, sc->pf, 0, - 64, /* max # of egress queues */ + 128, /* max # of egress queues */ 64, /* max # of egress Ethernet or control queues */ 64, /* max # of ingress queues with fl/interrupt */ 0, /* max # of ingress queues without interrupt */ diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index fb6ed67..156f8b2 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -3901,7 +3901,7 @@ em_setup_receive_ring(struct rx_ring *rxr) struct adapter *adapter = rxr->adapter; struct em_buffer *rxbuf; bus_dma_segment_t seg[1]; - int i, j, nsegs, error; + int i, j, nsegs, error = 0; /* Clear the ring contents */ @@ -3919,7 +3919,7 @@ em_setup_receive_ring(struct rx_ring *rxr) if (++j == adapter->num_rx_desc) j = 0; - while(j != rxr->next_to_check) { + while (j != rxr->next_to_check) { rxbuf = &rxr->rx_buffers[i]; rxbuf->m_head = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); diff --git a/sys/dev/xl/if_xl.c b/sys/dev/xl/if_xl.c index 1db6ece..004b511 100644 --- a/sys/dev/xl/if_xl.c +++ b/sys/dev/xl/if_xl.c @@ -263,10 +263,11 @@ static void xl_mii_send(struct xl_softc *, u_int32_t, int); static int xl_mii_readreg(struct xl_softc *, struct xl_mii_frame *); static int xl_mii_writereg(struct xl_softc *, struct xl_mii_frame *); +static void xl_rxfilter(struct xl_softc *); +static void xl_rxfilter_90x(struct xl_softc *); +static void xl_rxfilter_90xB(struct xl_softc *); static void xl_setcfg(struct xl_softc *); static void xl_setmode(struct xl_softc *, int); -static void xl_setmulti(struct xl_softc *); -static void xl_setmulti_hash(struct xl_softc *); static void xl_reset(struct xl_softc *); static int xl_list_rx_init(struct xl_softc *); static int xl_list_tx_init(struct xl_softc *); @@ -701,101 +702,133 @@ xl_read_eeprom(struct xl_softc *sc, caddr_t dest, int off, int cnt, int swap) return (err ? 1 : 0); } +static void +xl_rxfilter(struct xl_softc *sc) +{ + + if (sc->xl_type == XL_TYPE_905B) + xl_rxfilter_90xB(sc); + else + xl_rxfilter_90x(sc); +} + /* * NICs older than the 3c905B have only one multicast option, which * is to enable reception of all multicast frames. */ static void -xl_setmulti(struct xl_softc *sc) +xl_rxfilter_90x(struct xl_softc *sc) { - struct ifnet *ifp = sc->xl_ifp; + struct ifnet *ifp; struct ifmultiaddr *ifma; u_int8_t rxfilt; - int mcnt = 0; XL_LOCK_ASSERT(sc); + ifp = sc->xl_ifp; + XL_SEL_WIN(5); rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER); + rxfilt &= ~(XL_RXFILTER_ALLFRAMES | XL_RXFILTER_ALLMULTI | + XL_RXFILTER_BROADCAST | XL_RXFILTER_INDIVIDUAL); - if (ifp->if_flags & IFF_ALLMULTI) { - rxfilt |= XL_RXFILTER_ALLMULTI; - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); - return; - } - - if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) - mcnt++; - if_maddr_runlock(ifp); + /* Set the individual bit to receive frames for this host only. */ + rxfilt |= XL_RXFILTER_INDIVIDUAL; + /* Set capture broadcast bit to capture broadcast frames. */ + if (ifp->if_flags & IFF_BROADCAST) + rxfilt |= XL_RXFILTER_BROADCAST; - if (mcnt) - rxfilt |= XL_RXFILTER_ALLMULTI; - else - rxfilt &= ~XL_RXFILTER_ALLMULTI; + /* If we want promiscuous mode, set the allframes bit. */ + if (ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) { + if (ifp->if_flags & IFF_PROMISC) + rxfilt |= XL_RXFILTER_ALLFRAMES; + if (ifp->if_flags & IFF_ALLMULTI) + rxfilt |= XL_RXFILTER_ALLMULTI; + } else { + if_maddr_rlock(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + rxfilt |= XL_RXFILTER_ALLMULTI; + break; + } + if_maddr_runlock(ifp); + } - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); + CSR_WRITE_2(sc, XL_COMMAND, rxfilt | XL_CMD_RX_SET_FILT); + XL_SEL_WIN(7); } /* * 3c905B adapters have a hash filter that we can program. */ static void -xl_setmulti_hash(struct xl_softc *sc) +xl_rxfilter_90xB(struct xl_softc *sc) { - struct ifnet *ifp = sc->xl_ifp; - int h = 0, i; + struct ifnet *ifp; struct ifmultiaddr *ifma; + int i, mcnt; + u_int16_t h; u_int8_t rxfilt; - int mcnt = 0; XL_LOCK_ASSERT(sc); + ifp = sc->xl_ifp; + XL_SEL_WIN(5); rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER); + rxfilt &= ~(XL_RXFILTER_ALLFRAMES | XL_RXFILTER_ALLMULTI | + XL_RXFILTER_BROADCAST | XL_RXFILTER_INDIVIDUAL | + XL_RXFILTER_MULTIHASH); - if (ifp->if_flags & IFF_ALLMULTI) { - rxfilt |= XL_RXFILTER_ALLMULTI; - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); - return; - } else - rxfilt &= ~XL_RXFILTER_ALLMULTI; - - /* first, zot all the existing hash bits */ - for (i = 0; i < XL_HASHFILT_SIZE; i++) - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_HASH|i); + /* Set the individual bit to receive frames for this host only. */ + rxfilt |= XL_RXFILTER_INDIVIDUAL; + /* Set capture broadcast bit to capture broadcast frames. */ + if (ifp->if_flags & IFF_BROADCAST) + rxfilt |= XL_RXFILTER_BROADCAST; - /* now program new ones */ - if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - /* - * Note: the 3c905B currently only supports a 64-bit hash - * table, which means we really only need 6 bits, but the - * manual indicates that future chip revisions will have a - * 256-bit hash table, hence the routine is set up to - * calculate 8 bits of position info in case we need it some - * day. - * Note II, The Sequel: _CURRENT_ versions of the 3c905B have - * a 256 bit hash table. This means we have to use all 8 bits - * regardless. On older cards, the upper 2 bits will be - * ignored. Grrrr.... - */ - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) & 0xFF; - CSR_WRITE_2(sc, XL_COMMAND, - h | XL_CMD_RX_SET_HASH | XL_HASH_SET); - mcnt++; + /* If we want promiscuous mode, set the allframes bit. */ + if (ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) { + if (ifp->if_flags & IFF_PROMISC) + rxfilt |= XL_RXFILTER_ALLFRAMES; + if (ifp->if_flags & IFF_ALLMULTI) + rxfilt |= XL_RXFILTER_ALLMULTI; + } else { + /* First, zot all the existing hash bits. */ + for (i = 0; i < XL_HASHFILT_SIZE; i++) + CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_HASH | i); + + /* Now program new ones. */ + mcnt = 0; + if_maddr_rlock(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + /* + * Note: the 3c905B currently only supports a 64-bit + * hash table, which means we really only need 6 bits, + * but the manual indicates that future chip revisions + * will have a 256-bit hash table, hence the routine + * is set up to calculate 8 bits of position info in + * case we need it some day. + * Note II, The Sequel: _CURRENT_ versions of the + * 3c905B have a 256 bit hash table. This means we have + * to use all 8 bits regardless. On older cards, the + * upper 2 bits will be ignored. Grrrr.... + */ + h = ether_crc32_be(LLADDR((struct sockaddr_dl *) + ifma->ifma_addr), ETHER_ADDR_LEN) & 0xFF; + CSR_WRITE_2(sc, XL_COMMAND, + h | XL_CMD_RX_SET_HASH | XL_HASH_SET); + mcnt++; + } + if_maddr_runlock(ifp); + if (mcnt > 0) + rxfilt |= XL_RXFILTER_MULTIHASH; } - if_maddr_runlock(ifp); - - if (mcnt) - rxfilt |= XL_RXFILTER_MULTIHASH; - else - rxfilt &= ~XL_RXFILTER_MULTIHASH; CSR_WRITE_2(sc, XL_COMMAND, rxfilt | XL_CMD_RX_SET_FILT); + XL_SEL_WIN(7); } static void @@ -2485,8 +2518,7 @@ xl_encap(struct xl_softc *sc, struct xl_chain *c, struct mbuf **m_head) htole32(sc->xl_cdata.xl_tx_segs[i].ds_len); total_len += sc->xl_cdata.xl_tx_segs[i].ds_len; } - c->xl_ptr->xl_frag[nseg - 1].xl_len = - htole32(sc->xl_cdata.xl_tx_segs[nseg - 1].ds_len | XL_LAST_FRAG); + c->xl_ptr->xl_frag[nseg - 1].xl_len |= htole32(XL_LAST_FRAG); c->xl_ptr->xl_status = htole32(total_len); c->xl_ptr->xl_next = 0; @@ -2611,8 +2643,7 @@ xl_start_locked(struct ifnet *ifp) * get an interrupt once for the whole chain rather than * once for each packet. */ - cur_tx->xl_ptr->xl_status = htole32(le32toh(cur_tx->xl_ptr->xl_status) | - XL_TXSTAT_DL_INTR); + cur_tx->xl_ptr->xl_status |= htole32(XL_TXSTAT_DL_INTR); bus_dmamap_sync(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap, BUS_DMASYNC_PREWRITE); @@ -2628,8 +2659,8 @@ xl_start_locked(struct ifnet *ifp) sc->xl_cdata.xl_tx_tail->xl_ptr->xl_next = htole32(start_tx->xl_phys); status = sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status; - sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status = - htole32(le32toh(status) & ~XL_TXSTAT_DL_INTR); + sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status &= + htole32(~XL_TXSTAT_DL_INTR); sc->xl_cdata.xl_tx_tail = cur_tx; } else { sc->xl_cdata.xl_tx_head = start_tx; @@ -2733,8 +2764,7 @@ xl_start_90xB_locked(struct ifnet *ifp) * get an interrupt once for the whole chain rather than * once for each packet. */ - cur_tx->xl_ptr->xl_status = htole32(le32toh(cur_tx->xl_ptr->xl_status) | - XL_TXSTAT_DL_INTR); + cur_tx->xl_ptr->xl_status |= htole32(XL_TXSTAT_DL_INTR); bus_dmamap_sync(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap, BUS_DMASYNC_PREWRITE); @@ -2763,7 +2793,6 @@ xl_init_locked(struct xl_softc *sc) { struct ifnet *ifp = sc->xl_ifp; int error, i; - u_int16_t rxfilt = 0; struct mii_data *mii = NULL; XL_LOCK_ASSERT(sc); @@ -2862,39 +2891,7 @@ xl_init_locked(struct xl_softc *sc) } /* Set RX filter bits. */ - XL_SEL_WIN(5); - rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER); - - /* Set the individual bit to receive frames for this host only. */ - rxfilt |= XL_RXFILTER_INDIVIDUAL; - - /* If we want promiscuous mode, set the allframes bit. */ - if (ifp->if_flags & IFF_PROMISC) { - rxfilt |= XL_RXFILTER_ALLFRAMES; - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); - } else { - rxfilt &= ~XL_RXFILTER_ALLFRAMES; - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); - } - - /* - * Set capture broadcast bit to capture broadcast frames. - */ - if (ifp->if_flags & IFF_BROADCAST) { - rxfilt |= XL_RXFILTER_BROADCAST; - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); - } else { - rxfilt &= ~XL_RXFILTER_BROADCAST; - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); - } - - /* - * Program the multicast filter, if necessary. - */ - if (sc->xl_type == XL_TYPE_905B) - xl_setmulti_hash(sc); - else - xl_setmulti(sc); + xl_rxfilter(sc); /* * Load the address of the RX list. We have to @@ -3123,30 +3120,16 @@ xl_ioctl(struct ifnet *ifp, u_long command, caddr_t data) struct ifreq *ifr = (struct ifreq *) data; int error = 0, mask; struct mii_data *mii = NULL; - u_int8_t rxfilt; switch (command) { case SIOCSIFFLAGS: XL_LOCK(sc); - - XL_SEL_WIN(5); - rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING && - ifp->if_flags & IFF_PROMISC && - !(sc->xl_if_flags & IFF_PROMISC)) { - rxfilt |= XL_RXFILTER_ALLFRAMES; - CSR_WRITE_2(sc, XL_COMMAND, - XL_CMD_RX_SET_FILT|rxfilt); - XL_SEL_WIN(7); - } else if (ifp->if_drv_flags & IFF_DRV_RUNNING && - !(ifp->if_flags & IFF_PROMISC) && - sc->xl_if_flags & IFF_PROMISC) { - rxfilt &= ~XL_RXFILTER_ALLFRAMES; - CSR_WRITE_2(sc, XL_COMMAND, - XL_CMD_RX_SET_FILT|rxfilt); - XL_SEL_WIN(7); - } else + (ifp->if_flags ^ sc->xl_if_flags) & + (IFF_PROMISC | IFF_ALLMULTI)) + xl_rxfilter(sc); + else xl_init_locked(sc); } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) @@ -3154,18 +3137,14 @@ xl_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->xl_if_flags = ifp->if_flags; XL_UNLOCK(sc); - error = 0; break; case SIOCADDMULTI: case SIOCDELMULTI: /* XXX Downcall from if_addmulti() possibly with locks held. */ XL_LOCK(sc); - if (sc->xl_type == XL_TYPE_905B) - xl_setmulti_hash(sc); - else - xl_setmulti(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + xl_rxfilter(sc); XL_UNLOCK(sc); - error = 0; break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: diff --git a/sys/fs/nfs/nfs.h b/sys/fs/nfs/nfs.h index 0bf0f74..c8bb0d6 100644 --- a/sys/fs/nfs/nfs.h +++ b/sys/fs/nfs/nfs.h @@ -39,7 +39,7 @@ */ #define NFS_MAXIOVEC 34 -#define NFS_TICKINTVL 10 /* Desired time for a tick (msec) */ +#define NFS_TICKINTVL 500 /* Desired time for a tick (msec) */ #define NFS_HZ (hz / nfscl_ticks) /* Ticks/sec */ #define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */ #define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */ diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 8b4fc6a..b11160b 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -1224,7 +1224,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, if ((argp->flags & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 0) nmp->nm_maxfilesize = 0xffffffffLL; else - nmp->nm_maxfilesize = (u_int64_t)0x80000000 * DEV_BSIZE - 1; + nmp->nm_maxfilesize = OFF_MAX; nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 90e7d4f..9ea077d 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -1280,8 +1280,23 @@ nfsvno_fsync(struct vnode *vp, u_int64_t off, int cnt, struct ucred *cred, int nfsvno_statfs(struct vnode *vp, struct statfs *sf) { + int error; - return (VFS_STATFS(vp->v_mount, sf)); + error = VFS_STATFS(vp->v_mount, sf); + if (error == 0) { + /* + * Since NFS handles these values as unsigned on the + * wire, there is no way to represent negative values, + * so set them to 0. Without this, they will appear + * to be very large positive values for clients like + * Solaris10. + */ + if (sf->f_bavail < 0) + sf->f_bavail = 0; + if (sf->f_ffree < 0) + sf->f_ffree = 0; + } + return (error); } /* diff --git a/sys/geom/geom_map.c b/sys/geom/geom_map.c index 5acaefb..7f1b240 100644 --- a/sys/geom/geom_map.c +++ b/sys/geom/geom_map.c @@ -43,81 +43,73 @@ __FBSDID("$FreeBSD$"); #include <sys/bio.h> #include <sys/lock.h> #include <sys/mutex.h> - #include <sys/sbuf.h> + #include <geom/geom.h> #include <geom/geom_slice.h> -#define MAP_CLASS_NAME "MAP" - -struct map_desc { - uint8_t name [16]; /* null-terminated name */ - uint32_t offset; /* offset in flash */ - uint32_t addr; /* address in memory */ - uint32_t size; /* image size in bytes */ - uint32_t entry; /* offset in image for entry point */ - uint32_t dsize; /* data size in bytes */ -}; - +#define MAP_CLASS_NAME "MAP" #define MAP_MAXSLICE 64 +#define MAP_MAX_MARKER_LEN 64 struct g_map_softc { - uint32_t entry [MAP_MAXSLICE]; - uint32_t dsize [MAP_MAXSLICE]; - uint8_t readonly[MAP_MAXSLICE]; - g_access_t *parent_access; + off_t offset[MAP_MAXSLICE]; /* offset in flash */ + off_t size[MAP_MAXSLICE]; /* image size in bytes */ + off_t entry[MAP_MAXSLICE]; + off_t dsize[MAP_MAXSLICE]; + uint8_t readonly[MAP_MAXSLICE]; + g_access_t *parent_access; }; static int -g_map_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread *td) -{ - return (ENOIOCTL); -} - -static int g_map_access(struct g_provider *pp, int dread, int dwrite, int dexcl) { - struct g_geom *gp = pp->geom; - struct g_slicer *gsp = gp->softc; - struct g_map_softc *sc = gsp->softc; + struct g_geom *gp; + struct g_slicer *gsp; + struct g_map_softc *sc; + + gp = pp->geom; + gsp = gp->softc; + sc = gsp->softc; if (dwrite > 0 && sc->readonly[pp->index]) return (EPERM); + return (sc->parent_access(pp, dread, dwrite, dexcl)); - /* - * no (sc->parent_access(pp, dread, dwrite, dexcl));, - * We need to have way for update flash - */ } static int g_map_start(struct bio *bp) { struct g_provider *pp; - struct g_geom *gp; + struct g_geom *gp; struct g_map_softc *sc; struct g_slicer *gsp; - int idx; + int idx; pp = bp->bio_to; idx = pp->index; gp = pp->geom; gsp = gp->softc; sc = gsp->softc; + if (bp->bio_cmd == BIO_GETATTR) { if (g_handleattr_int(bp, MAP_CLASS_NAME "::entry", - sc->entry[idx])) + sc->entry[idx])) { return (1); + } if (g_handleattr_int(bp, MAP_CLASS_NAME "::dsize", - sc->dsize[idx])) + sc->dsize[idx])) { return (1); + } } + return (0); } static void g_map_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, - struct g_consumer *cp __unused, struct g_provider *pp) + struct g_consumer *cp __unused, struct g_provider *pp) { struct g_map_softc *sc; struct g_slicer *gsp; @@ -127,45 +119,237 @@ g_map_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, g_slice_dumpconf(sb, indent, gp, cp, pp); if (pp != NULL) { if (indent == NULL) { - sbuf_printf(sb, " entry %d", sc->entry[pp->index]); - sbuf_printf(sb, " dsize %d", sc->dsize[pp->index]); + sbuf_printf(sb, " entry %lld", sc->entry[pp->index]); + sbuf_printf(sb, " dsize %lld", sc->dsize[pp->index]); } else { - sbuf_printf(sb, "%s<entry>%d</entry>\n", indent, - sc->entry[pp->index]); - sbuf_printf(sb, "%s<dsize>%d</dsize>\n", indent, - sc->dsize[pp->index]); + sbuf_printf(sb, "%s<entry>%lld</entry>\n", indent, + sc->entry[pp->index]); + sbuf_printf(sb, "%s<dsize>%lld</dsize>\n", indent, + sc->dsize[pp->index]); } } } -#include <sys/ctype.h> +static int +find_marker(struct g_consumer *cp, const char *line, off_t *offset) +{ + off_t search_start, search_offset, search_step; + size_t sectorsize; + uint8_t *buf; + char *op, key[MAP_MAX_MARKER_LEN], search_key[MAP_MAX_MARKER_LEN]; + int ret, c; + + /* Try convert to numeric first */ + *offset = strtouq(line, &op, 0); + if (*op == '\0') + return (0); + + bzero(search_key, MAP_MAX_MARKER_LEN); + sectorsize = cp->provider->sectorsize; + + ret = sscanf(line, "search:%qi:%qi:%63c", + &search_start, &search_step, search_key); + if (ret < 3) + return (1); + + if (bootverbose) { + printf("MAP: search key \"%s\" from 0x%llx, step 0x%llx\n", + search_key, search_start, search_step); + } + + /* error if search_key is empty */ + if (strlen(search_key) < 1) + return (1); + + /* sscanf successful, and we start marker search */ + for (search_offset = search_start; + search_offset < cp->provider->mediasize; + search_offset += search_step) { + + g_topology_unlock(); + buf = g_read_data(cp, rounddown(search_offset, sectorsize), + roundup(strlen(search_key), sectorsize), NULL); + g_topology_lock(); + + /* Wildcard, replace '.' with byte from data */ + /* TODO: add support wildcard escape '\.' */ + + strncpy(key, search_key, MAP_MAX_MARKER_LEN); + + for (c = 0; c < MAP_MAX_MARKER_LEN && key[c]; c++) { + if (key[c] == '.') { + key[c] = ((char *)(buf + + (search_offset % sectorsize)))[c]; + } + } + + if (buf != NULL && strncmp(buf + search_offset % sectorsize, + key, strlen(search_key)) == 0) { + g_free(buf); + /* Marker found, so return their offset */ + *offset = search_offset; + return (0); + } + g_free(buf); + } + + /* Marker not found */ + return (1); +} + +static int +g_map_parse_part(struct g_class *mp, struct g_provider *pp, + struct g_consumer *cp, struct g_geom *gp, struct g_map_softc *sc, int i) +{ + const char *value, *name; + char *op; + off_t start, end, offset, size, dsize; + int readonly, ret; + + /* hint.map.0.at="cfid0" - bind to cfid0 media */ + if (resource_string_value("map", i, "at", &value) != 0) + return (1); + + /* Check if this correct provider */ + if (strcmp(pp->name, value) != 0) + return (1); + + /* + * hint.map.0.name="uboot" - name of partition, will be available + * as "/dev/map/uboot" + */ + if (resource_string_value("map", i, "name", &name) != 0) { + if (bootverbose) + printf("MAP: hint.map.%d has no name\n", i); + return (1); + } + + /* + * hint.map.0.start="0x00010000" - partition start at 0x00010000 + * or hint.map.0.start="search:0x00010000:0x200:marker text" - + * search for text "marker text", begin at 0x10000, step 0x200 + * until we found marker or end of media reached + */ + if (resource_string_value("map", i, "start", &value) != 0) { + if (bootverbose) + printf("MAP: \"%s\" has no start value\n", name); + return (1); + } + if (find_marker(cp, value, &start) != 0) { + if (bootverbose) { + printf("MAP: \"%s\" can't parse/use start value\n", + name); + } + return (1); + } + + /* like "start" */ + if (resource_string_value("map", i, "end", &value) != 0) { + if (bootverbose) + printf("MAP: \"%s\" has no end value\n", name); + return (1); + } + if (find_marker(cp, value, &end) != 0) { + if (bootverbose) { + printf("MAP: \"%s\" can't parse/use start value\n", + name); + } + return (1); + } + /* variable readonly optional, disable write access */ + if (resource_int_value("map", i, "readonly", &readonly) != 0) + readonly = 0; + + /* offset of partition data, from partition begin */ + if (resource_string_value("map", i, "offset", &value) == 0) { + offset = strtouq(value, &op, 0); + if (*op != '\0') { + if (bootverbose) { + printf("MAP: \"%s\" can't parse offset\n", + name); + } + return (1); + } + } else { + offset = 0; + } + + /* partition data size */ + if (resource_string_value("map", i, "dsize", &value) == 0) { + dsize = strtouq(value, &op, 0); + if (*op != '\0') { + if (bootverbose) { + printf("MAP: \"%s\" can't parse dsize\n", + name); + } + return (1); + } + } else { + dsize = 0; + } + + size = end - start; + if (dsize == 0) + dsize = size - offset; + + /* end is 0 or size is 0, No MAP - so next */ + if (end < start) { + if (bootverbose) { + printf("MAP: \"%s\", \"end\" less than " + "\"start\"\n", name); + } + return (1); + } + + if (offset + dsize > size) { + if (bootverbose) { + printf("MAP: \"%s\", \"dsize\" bigger than " + "partition - offset\n", name); + } + return (1); + } + + ret = g_slice_config(gp, i, G_SLICE_CONFIG_SET, start + offset, + dsize, cp->provider->sectorsize, "map/%s", name); + if (ret != 0) { + if (bootverbose) { + printf("MAP: g_slice_config returns %d for \"%s\"\n", + ret, name); + } + return (1); + } + + if (bootverbose) { + printf("MAP: %llxx%llx, data=%llxx%llx " + "\"/dev/map/%s\"\n", + start, size, offset, dsize, name); + } + + sc->offset[i] = start; + sc->size[i] = size; + sc->entry[i] = offset; + sc->dsize[i] = dsize; + sc->readonly[i] = readonly ? 1 : 0; + + return (0); +} static struct g_geom * -g_map_taste(struct g_class *mp, struct g_provider *pp, int insist) +g_map_taste(struct g_class *mp, struct g_provider *pp, int insist __unused) { - struct g_geom *gp; - struct g_consumer *cp; struct g_map_softc *sc; - int error , sectorsize, i, ret; - struct map_desc *head; - u_int32_t start = 0, end = 0, size = 0, off, readonly; - const char *name; - const char *at; - const char *search; - int search_start = 0, search_end = 0; - u_char *buf; - uint32_t offmask; - u_int blksize;/* NB: flash block size stored as stripesize */ - off_t offset; + struct g_consumer *cp; + struct g_geom *gp; + int i; g_trace(G_T_TOPOLOGY, "map_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); - if (!strcmp(pp->geom->class->name, MAP_CLASS_NAME)) + if (strcmp(pp->geom->class->name, MAP_CLASS_NAME) == 0) return (NULL); gp = g_slice_new(mp, MAP_MAXSLICE, pp, &cp, &sc, sizeof(*sc), - g_map_start); + g_map_start); if (gp == NULL) return (NULL); @@ -173,160 +357,14 @@ g_map_taste(struct g_class *mp, struct g_provider *pp, int insist) sc->parent_access = gp->access; gp->access = g_map_access; - sectorsize = cp->provider->sectorsize; - blksize = cp->provider->stripesize; - if (powerof2(cp->provider->mediasize)) - offmask = cp->provider->mediasize - 1; - else - offmask = 0xffffffff; /* XXX */ - - g_topology_unlock(); - head = NULL; - offset = cp->provider->mediasize - blksize; - g_topology_lock(); - - for (i = 0; i < MAP_MAXSLICE; i++) { - search_start = search_end = start = end = off = readonly = 0; - - ret = resource_string_value("map", i, "at", &at); - if (ret) - continue; - - /* Check if my provider */ - if (strncmp(pp->name, at, strlen(at))) - continue; - - ret = resource_string_value("map", i, "start", &search); - - if (!ret && strncmp(search, "search", 6) == 0) { - uint32_t search_offset, search_start = 0; - uint32_t search_step = 0; - const char *search_key; - char key[255]; - int c; - - ret = resource_int_value("map", i, "searchstart", - &search_start); - ret = resource_int_value("map", i, "searchstep", - &search_step); - if (ret) - search_step = 0x10000U; - ret = resource_string_value("map", i, "searchkey", &search_key); - if (ret) - continue; - - printf("GEOM_MAP: searchkey=\"%s\"\n", search_key); - for (search_offset = search_start; - search_offset < cp->provider->mediasize && start == 0; - search_offset += search_step) { - buf = g_read_data(cp, - rounddown(search_offset, sectorsize), - roundup(strlen(search_key), sectorsize), - NULL); - - /* Wildcard, replace '.' with byte from data */ - strncpy(key, search_key, 255); - for (c = 0; c < 255 && key[c]; c++) - if (key[c] == '.') - key[c] = ((char *)(buf + search_offset % sectorsize))[c]; - - if (buf != NULL && strncmp( - buf + search_offset % sectorsize, - key, strlen(search_key)) == 0) - start = search_offset; - g_free(buf); - } - if (!start) - continue; - } else { - ret = resource_int_value("map", i, "start", &start); - if (ret) - continue; - } + for (i = 0; i < MAP_MAXSLICE; i++) + g_map_parse_part(mp, pp, cp, gp, sc, i); - ret = resource_string_value("map", i, "end", &search); - - if (!ret && strncmp(search, "search", 6) == 0) { - uint32_t search_offset, search_start = 0, search_step = 0; - const char *search_key; - char key[255]; - int c; - - ret = resource_int_value("map", i, "searchstart", &search_start); - ret = resource_int_value("map", i, "searchstep", &search_step); - if (ret) - search_step = 0x10000U; - ret = resource_string_value("map", i, "searchkey", &search_key); - if (ret) - continue; - - for (search_offset = search_start; - search_offset < cp->provider->mediasize && end == 0; - search_offset += search_step) { - buf = g_read_data(cp, - rounddown(search_offset, sectorsize), - roundup(strlen(search_key), sectorsize), - NULL); - - /* Wildcard, replace '.' with byte from data */ - strncpy(key, search_key, 255); - for (c = 0; c < 255 && key[c]; c++) - if (key[c] == '.') - key[c] = ((char *)(buf + search_offset % sectorsize))[c]; - - if (buf != NULL && strncmp( - buf + search_offset % sectorsize, - key, strlen(search_key)) == 0) - end = search_offset; - g_free(buf); - } - if (!end) - continue; - } else { - ret = resource_int_value("map", i, "end", &end); - if (ret) - continue; - } - size = end - start; - - /* end is 0 or size is 0, No MAP - so next */ - if (end == 0 || size == 0) - continue; - ret = resource_int_value("map", i, "offset", &off); - ret = resource_int_value("map", i, "readonly", &readonly); - ret = resource_string_value("map", i, "name", &name); - /* No name or error read name */ - if (ret) - continue; - - if (off > size) - printf("%s: off(%d) > size(%d) for \"%s\"\n", - __func__, off, size, name); - - error = g_slice_config(gp, i, G_SLICE_CONFIG_SET, start + off, - size - off, sectorsize, "map/%s", name); - printf("MAP: %08x-%08x, offset=%08x \"map/%s\"\n", - (uint32_t) start, - (uint32_t) size, - (uint32_t) off, - name - ); - - if (error) - printf("%s g_slice_config returns %d for \"%s\"\n", - __func__, error, name); - - sc->entry[i] = off; - sc->dsize[i] = size - off; - sc->readonly[i] = readonly ? 1 : 0; - } - - - if (i == 0) - return (NULL); g_access(cp, -1, 0, 0); if (LIST_EMPTY(&gp->provider)) { + if (bootverbose) + printf("MAP: No valid partition found at %s\n", pp->name); g_slice_spoiled(cp); return (NULL); } @@ -336,7 +374,7 @@ g_map_taste(struct g_class *mp, struct g_provider *pp, int insist) static void g_map_config(struct gctl_req *req, struct g_class *mp, const char *verb) { - struct g_geom *gp; + struct g_geom *gp; g_topology_assert(); gp = gctl_get_geom(req, mp, "geom"); @@ -351,6 +389,5 @@ static struct g_class g_map_class = { .taste = g_map_taste, .dumpconf = g_map_dumpconf, .ctlreq = g_map_config, - .ioctl = g_map_ioctl, }; DECLARE_GEOM_CLASS(g_map_class, g_map); diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index dfe6434..966e46e 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -224,11 +224,34 @@ mem_range_AP_init(void) static void topo_probe_amd(void) { + int core_id_bits; + int id; /* AMD processors do not support HTT. */ - cpu_cores = (amd_feature2 & AMDID2_CMP) != 0 ? - (cpu_procinfo2 & AMDID_CMP_CORES) + 1 : 1; cpu_logical = 1; + + if ((amd_feature2 & AMDID2_CMP) == 0) { + cpu_cores = 1; + return; + } + + core_id_bits = (cpu_procinfo2 & AMDID_COREID_SIZE) >> + AMDID_COREID_SIZE_SHIFT; + if (core_id_bits == 0) { + cpu_cores = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; + return; + } + + /* Fam 10h and newer should get here. */ + for (id = 0; id <= MAX_APIC_ID; id++) { + /* Check logical CPU availability. */ + if (!cpu_info[id].cpu_present || cpu_info[id].cpu_disabled) + continue; + /* Check if logical CPU has the same package ID. */ + if ((id >> core_id_bits) != (boot_cpu_id >> core_id_bits)) + continue; + cpu_cores++; + } } /* diff --git a/sys/i386/include/specialreg.h b/sys/i386/include/specialreg.h index cfb205f..adccaf4 100644 --- a/sys/i386/include/specialreg.h +++ b/sys/i386/include/specialreg.h @@ -227,6 +227,8 @@ * AMD extended function 8000_0008h ecx info */ #define AMDID_CMP_CORES 0x000000ff +#define AMDID_COREID_SIZE 0x0000f000 +#define AMDID_COREID_SIZE_SHIFT 12 /* * CPUID manufacturers identifiers diff --git a/sys/ia64/isa/isa.c b/sys/ia64/isa/isa.c index 6467237..cdb93cc 100644 --- a/sys/ia64/isa/isa.c +++ b/sys/ia64/isa/isa.c @@ -135,25 +135,3 @@ isa_release_resource(device_t bus, device_t child, int type, int rid, struct resource_list *rl = &idev->id_resources; return resource_list_release(rl, bus, child, type, rid, r); } - -/* - * We can't use the bus_generic_* versions of these methods because those - * methods always pass the bus param as the requesting device, and we need - * to pass the child (the i386 nexus knows about this and is prepared to - * deal). - */ -int -isa_setup_intr(device_t bus, device_t child, struct resource *r, int flags, - driver_filter_t filter, void (*ihand)(void *), void *arg, - void **cookiep) -{ - return (BUS_SETUP_INTR(device_get_parent(bus), child, r, flags, - filter, ihand, arg, cookiep)); -} - -int -isa_teardown_intr(device_t bus, device_t child, struct resource *r, - void *cookie) -{ - return (BUS_TEARDOWN_INTR(device_get_parent(bus), child, r, cookie)); -} diff --git a/sys/isa/isa_common.c b/sys/isa/isa_common.c index 1d1a13a..9e10320 100644 --- a/sys/isa/isa_common.c +++ b/sys/isa/isa_common.c @@ -1071,8 +1071,8 @@ static device_method_t isa_methods[] = { DEVMETHOD(bus_write_ivar, isa_write_ivar), DEVMETHOD(bus_child_detached, isa_child_detached), DEVMETHOD(bus_driver_added, isa_driver_added), - DEVMETHOD(bus_setup_intr, isa_setup_intr), - DEVMETHOD(bus_teardown_intr, isa_teardown_intr), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_get_resource_list,isa_get_resource_list), DEVMETHOD(bus_alloc_resource, isa_alloc_resource), diff --git a/sys/isa/isa_common.h b/sys/isa/isa_common.h index 340ad17..a6702f4 100644 --- a/sys/isa/isa_common.h +++ b/sys/isa/isa_common.h @@ -73,11 +73,5 @@ extern struct resource *isa_alloc_resource(device_t bus, device_t child, extern int isa_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r); -extern int isa_setup_intr(device_t bus, device_t child, struct resource *r, - int flags, driver_filter_t *filter, void (*ihand)(void *), void *arg, - void **cookiep); -extern int isa_teardown_intr(device_t bus, device_t child, struct resource *r, - void *cookie); - extern driver_t isa_driver; extern devclass_t isa_devclass; diff --git a/sys/mips/atheros/ar71xx_gpio.c b/sys/mips/atheros/ar71xx_gpio.c index 866c72b..09b4d50 100644 --- a/sys/mips/atheros/ar71xx_gpio.c +++ b/sys/mips/atheros/ar71xx_gpio.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <machine/resource.h> #include <mips/atheros/ar71xxreg.h> +#include <mips/atheros/ar71xx_setup.h> #include <mips/atheros/ar71xx_gpiovar.h> #include "gpio_if.h" @@ -144,7 +145,19 @@ static int ar71xx_gpio_pin_max(device_t dev, int *maxpin) { - *maxpin = AR71XX_GPIO_PINS - 1; + switch (ar71xx_soc) { + case AR71XX_SOC_AR9130: + case AR71XX_SOC_AR9132: + *maxpin = AR91XX_GPIO_PINS - 1; + break; + case AR71XX_SOC_AR7240: + case AR71XX_SOC_AR7241: + case AR71XX_SOC_AR7242: + *maxpin = AR724X_GPIO_PINS - 1; + break; + default: + *maxpin = AR71XX_GPIO_PINS - 1; + } return (0); } diff --git a/sys/mips/atheros/ar71xx_gpiovar.h b/sys/mips/atheros/ar71xx_gpiovar.h index a9ed7e0..3489f5a 100644 --- a/sys/mips/atheros/ar71xx_gpiovar.h +++ b/sys/mips/atheros/ar71xx_gpiovar.h @@ -52,6 +52,8 @@ GPIO_WRITE(sc, reg, GPIO_READ(sc, (reg)) & ~(bits)) #define AR71XX_GPIO_PINS 12 +#define AR724X_GPIO_PINS 18 +#define AR91XX_GPIO_PINS 22 struct ar71xx_gpio_softc { device_t dev; diff --git a/sys/mips/atheros/ar724xreg.h b/sys/mips/atheros/ar724xreg.h index eaceb1d..73e20af 100644 --- a/sys/mips/atheros/ar724xreg.h +++ b/sys/mips/atheros/ar724xreg.h @@ -105,6 +105,4 @@ #define AR724X_GPIO_FUNC_UART_EN (1 >> 1) #define AR724X_GPIO_FUNC_JTAG_DISABLE (1 >> 0) -#define AR724X_GPIO_COUNT 18 - #endif diff --git a/sys/mips/atheros/ar91xxreg.h b/sys/mips/atheros/ar91xxreg.h index 729d9ff..2dfaeb5 100644 --- a/sys/mips/atheros/ar91xxreg.h +++ b/sys/mips/atheros/ar91xxreg.h @@ -81,6 +81,4 @@ #define AR91XX_GPIO_FUNC_UART_EN (1 << 8) #define AR91XX_GPIO_FUNC_USB_CLK_EN (1 << 4) -#define AR91XX_GPIO_COUNT 22 - #endif diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 7c01ebe..4e727d9 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -228,8 +228,8 @@ tunclone(void *arg, struct ucred *cred, char *name, int namelen, i = clone_create(&tunclones, &tun_cdevsw, &u, dev, 0); if (i) { if (append_unit) { - namelen = snprintf(devname, sizeof(devname), "%s%d", name, - u); + namelen = snprintf(devname, sizeof(devname), "%s%d", + name, u); name = devname; } /* No preexisting struct cdev *, create one */ @@ -577,11 +577,8 @@ tunifioctl(struct ifnet *ifp, u_long cmd, caddr_t data) * tunoutput - queue packets from higher level ready to put out. */ static int -tunoutput( - struct ifnet *ifp, - struct mbuf *m0, - struct sockaddr *dst, - struct route *ro) +tunoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, + struct route *ro) { struct tun_softc *tp = ifp->if_softc; u_short cached_tun_flags; @@ -661,10 +658,8 @@ tunoutput( } error = (ifp->if_transmit)(ifp, m0); - if (error) { - ifp->if_collisions++; + if (error) return (ENOBUFS); - } ifp->if_opackets++; return (0); } @@ -673,7 +668,8 @@ tunoutput( * the cdevsw interface is now pretty minimal. */ static int -tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) +tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, + struct thread *td) { int error; struct tun_softc *tp = dev->si_drv1; @@ -995,7 +991,7 @@ tunkqfilter(struct cdev *dev, struct knote *kn) ifp->if_xname, dev2unit(dev)); kn->kn_fop = &tun_write_filterops; break; - + default: TUNDEBUG(ifp, "%s kqfilter: invalid filter, minor = %#x\n", ifp->if_xname, dev2unit(dev)); diff --git a/sys/netinet/ipfw/ip_dn_glue.c b/sys/netinet/ipfw/ip_dn_glue.c index 3f968df..9fc6b23 100644 --- a/sys/netinet/ipfw/ip_dn_glue.c +++ b/sys/netinet/ipfw/ip_dn_glue.c @@ -624,7 +624,7 @@ dn_c_copy_pipe(struct dn_schk *s, struct copy_args *a, int nq) /* These 4 field are the same in pipe7 and pipe8 */ pipe7->next.sle_next = (struct dn_pipe7 *)DN_IS_PIPE; pipe7->bandwidth = l->bandwidth; - pipe7->delay = l->delay; + pipe7->delay = l->delay * 1000 / hz; pipe7->pipe_nr = l->link_nr - DN_MAX_ID; if (!is7) { diff --git a/sys/netinet/ipfw/ip_dummynet.c b/sys/netinet/ipfw/ip_dummynet.c index d44fd10..ba6e892 100644 --- a/sys/netinet/ipfw/ip_dummynet.c +++ b/sys/netinet/ipfw/ip_dummynet.c @@ -808,6 +808,7 @@ copy_obj(char **start, char *end, void *_o, const char *msg, int i) /* Adjust burst parameter for link */ struct dn_link *l = (struct dn_link *)*start; l->burst = div64(l->burst, 8 * hz); + l->delay = l->delay * 1000 / hz; } else if (o->type == DN_SCH) { /* Set id->id to the number of instances */ struct dn_schk *s = _o; diff --git a/sys/netinet/sctp_auth.h b/sys/netinet/sctp_auth.h index 653620d..9406ce8 100644 --- a/sys/netinet/sctp_auth.h +++ b/sys/netinet/sctp_auth.h @@ -89,7 +89,7 @@ typedef struct sctp_hmaclist { } sctp_hmaclist_t; /* authentication info */ -typedef struct sctp_authinfo { +typedef struct sctp_authinformation { sctp_key_t *random; /* local random key (concatenated) */ uint32_t random_len; /* local random number length for param */ sctp_key_t *peer_random;/* peer's random key (concatenated) */ @@ -98,7 +98,7 @@ typedef struct sctp_authinfo { uint16_t active_keyid; /* active send keyid */ uint16_t assoc_keyid; /* current send keyid (cached) */ uint16_t recv_keyid; /* last recv keyid (cached) */ -} sctp_authinfo_t; +} sctp_authinfo_t; diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index 047df94..9a777c8 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #include <nfsclient/nfs.h> #include <nfsclient/nfsmount.h> #include <nfsclient/nfsnode.h> -#include <nfsclient/nfs_kdtrace.h> +#include <nfs/nfs_kdtrace.h> static struct buf *nfs_getcacheblk(struct vnode *vp, daddr_t bn, int size, struct thread *td); diff --git a/sys/nfsclient/nfs_kdtrace.c b/sys/nfsclient/nfs_kdtrace.c index 3a478e0..429dbc3 100644 --- a/sys/nfsclient/nfs_kdtrace.c +++ b/sys/nfsclient/nfs_kdtrace.c @@ -539,4 +539,4 @@ DEV_MODULE(dtnfsclient, dtnfsclient_modevent, NULL); MODULE_VERSION(dtnfsclient, 1); MODULE_DEPEND(dtnfsclient, dtrace, 1, 1, 1); MODULE_DEPEND(dtnfsclient, opensolaris, 1, 1, 1); -MODULE_DEPEND(dtnfsclient, nfs, 1, 1, 1); +MODULE_DEPEND(dtnfsclient, oldnfs, 1, 1, 1); diff --git a/sys/nfsclient/nfs_kdtrace.h b/sys/nfsclient/nfs_kdtrace.h deleted file mode 100644 index d29aa68..0000000 --- a/sys/nfsclient/nfs_kdtrace.h +++ /dev/null @@ -1,120 +0,0 @@ -/*- - * Copyright (c) 2009 Robert N. M. Watson - * All rights reserved. - * - * This software was developed at the University of Cambridge Computer - * Laboratory with support from a grant from Google, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _NFSCLIENT_NFS_KDTRACE_H_ -#define _NFSCLIENT_NFS_KDTRACE_H_ - -#ifdef KDTRACE_HOOKS -#include <sys/dtrace_bsd.h> - -/* - * Definitions for NFS access cache probes. - */ -extern uint32_t nfsclient_accesscache_flush_done_id; -extern uint32_t nfsclient_accesscache_get_hit_id; -extern uint32_t nfsclient_accesscache_get_miss_id; -extern uint32_t nfsclient_accesscache_load_done_id; - -#define KDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp) do { \ - if (dtrace_nfsclient_accesscache_flush_done_probe != NULL) \ - (dtrace_nfsclient_accesscache_flush_done_probe)( \ - nfsclient_accesscache_flush_done_id, (vp)); \ -} while (0) - -#define KDTRACE_NFS_ACCESSCACHE_GET_HIT(vp, uid, mode) do { \ - if (dtrace_nfsclient_accesscache_get_hit_probe != NULL) \ - (dtrace_nfsclient_accesscache_get_hit_probe)( \ - nfsclient_accesscache_get_hit_id, (vp), (uid), \ - (mode)); \ -} while (0) - -#define KDTRACE_NFS_ACCESSCACHE_GET_MISS(vp, uid, mode) do { \ - if (dtrace_nfsclient_accesscache_get_miss_probe != NULL) \ - (dtrace_nfsclient_accesscache_get_miss_probe)( \ - nfsclient_accesscache_get_miss_id, (vp), (uid), \ - (mode)); \ -} while (0) - -#define KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, uid, rmode, error) do { \ - if (dtrace_nfsclient_accesscache_load_done_probe != NULL) \ - (dtrace_nfsclient_accesscache_load_done_probe)( \ - nfsclient_accesscache_load_done_id, (vp), (uid), \ - (rmode), (error)); \ -} while (0) - -/* - * Definitions for NFS attribute cache probes. - */ -extern uint32_t nfsclient_attrcache_flush_done_id; -extern uint32_t nfsclient_attrcache_get_hit_id; -extern uint32_t nfsclient_attrcache_get_miss_id; -extern uint32_t nfsclient_attrcache_load_done_id; - -#define KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp) do { \ - if (dtrace_nfsclient_attrcache_flush_done_probe != NULL) \ - (dtrace_nfsclient_attrcache_flush_done_probe)( \ - nfsclient_attrcache_flush_done_id, (vp)); \ -} while (0) - -#define KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap) do { \ - if (dtrace_nfsclient_attrcache_get_hit_probe != NULL) \ - (dtrace_nfsclient_attrcache_get_hit_probe)( \ - nfsclient_attrcache_get_hit_id, (vp), (vap)); \ -} while (0) - -#define KDTRACE_NFS_ATTRCACHE_GET_MISS(vp) do { \ - if (dtrace_nfsclient_attrcache_get_miss_probe != NULL) \ - (dtrace_nfsclient_attrcache_get_miss_probe)( \ - nfsclient_attrcache_get_miss_id, (vp)); \ -} while (0) - -#define KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error) do { \ - if (dtrace_nfsclient_attrcache_load_done_probe != NULL) \ - (dtrace_nfsclient_attrcache_load_done_probe)( \ - nfsclient_attrcache_load_done_id, (vp), (vap), \ - (error)); \ -} while (0) - -#else /* !KDTRACE_HOOKS */ - -#define KDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp) -#define KDTRACE_NFS_ACCESSCACHE_GET_HIT(vp, uid, mode) -#define KDTRACE_NFS_ACCESSCACHE_GET_MISS(vp, uid, mode) -#define KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, uid, rmode, error) - -#define KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp) -#define KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap) -#define KDTRACE_NFS_ATTRCACHE_GET_MISS(vp) -#define KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error) - -#endif /* KDTRACE_HOOKS */ - -#endif /* !_NFSCLIENT_NFS_KDTRACE_H_ */ diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c index e1ecd19..fe4f5cc 100644 --- a/sys/nfsclient/nfs_subs.c +++ b/sys/nfsclient/nfs_subs.c @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); #include <nfs/nfsproto.h> #include <nfsclient/nfs.h> #include <nfsclient/nfsnode.h> -#include <nfsclient/nfs_kdtrace.h> +#include <nfs/nfs_kdtrace.h> #include <nfs/xdr_subs.h> #include <nfsclient/nfsm_subs.h> #include <nfsclient/nfsmount.h> diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 33506a4..fb3a746 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$"); #include <nfsclient/nfs.h> #include <nfsclient/nfsnode.h> #include <nfsclient/nfsmount.h> -#include <nfsclient/nfs_kdtrace.h> +#include <nfs/nfs_kdtrace.h> #include <nfs/nfs_lock.h> #include <nfs/xdr_subs.h> #include <nfsclient/nfsm_subs.h> diff --git a/sys/powerpc/conf/GENERIC b/sys/powerpc/conf/GENERIC index 2459988..d221a97 100644 --- a/sys/powerpc/conf/GENERIC +++ b/sys/powerpc/conf/GENERIC @@ -77,7 +77,7 @@ options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # To make an SMP kernel, the next line is needed -#options SMP # Symmetric MultiProcessor Kernel +options SMP # Symmetric MultiProcessor Kernel # CPU frequency control device cpufreq diff --git a/sys/powerpc/mpc85xx/isa.c b/sys/powerpc/mpc85xx/isa.c index a1715ef..1020e77 100644 --- a/sys/powerpc/mpc85xx/isa.c +++ b/sys/powerpc/mpc85xx/isa.c @@ -82,20 +82,3 @@ isa_release_resource(device_t bus, device_t child, int type, int rid, return (resource_list_release(rl, bus, child, type, rid, r)); } - -int -isa_setup_intr(device_t bus, device_t child, struct resource *r, int flags, - driver_filter_t filter, void (*ihand)(void *), void *arg, void **cookiep) -{ - - return (BUS_SETUP_INTR(device_get_parent(bus), child, r, flags, - filter, ihand, arg, cookiep)); -} - -int -isa_teardown_intr(device_t bus, device_t child, struct resource *r, - void *cookie) -{ - - return (BUS_TEARDOWN_INTR(device_get_parent(bus), child, r, cookie)); -} diff --git a/sys/powerpc/powermac/macio.c b/sys/powerpc/powermac/macio.c index 5ca0089..7b38060 100644 --- a/sys/powerpc/powermac/macio.c +++ b/sys/powerpc/powermac/macio.c @@ -65,6 +65,10 @@ struct macio_softc { vm_offset_t sc_base; vm_offset_t sc_size; struct rman sc_mem_rman; + + /* FCR registers */ + int sc_memrid; + struct resource *sc_memr; }; static MALLOC_DEFINE(M_MACIO, "macio", "macio device information"); @@ -296,6 +300,10 @@ macio_attach(device_t dev) sc->sc_base = reg[2]; sc->sc_size = MACIO_REG_SIZE; + sc->sc_memrid = PCIR_BAR(0); + sc->sc_memr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->sc_memrid, RF_ACTIVE); + sc->sc_mem_rman.rm_type = RMAN_ARRAY; sc->sc_mem_rman.rm_descr = "MacIO Device Memory"; error = rman_init(&sc->sc_mem_rman); @@ -347,6 +355,29 @@ macio_attach(device_t dev) continue; } device_set_ivars(cdev, dinfo); + + /* Set FCRs to enable some devices */ + if (sc->sc_memr == NULL) + continue; + + if (strcmp(ofw_bus_get_name(cdev), "bmac") == 0 || + strcmp(ofw_bus_get_compat(cdev), "bmac+") == 0) { + uint32_t fcr; + + fcr = bus_read_4(sc->sc_memr, HEATHROW_FCR); + + fcr |= FCR_ENET_ENABLE & ~FCR_ENET_RESET; + bus_write_4(sc->sc_memr, HEATHROW_FCR, fcr); + DELAY(50000); + fcr |= FCR_ENET_RESET; + bus_write_4(sc->sc_memr, HEATHROW_FCR, fcr); + DELAY(50000); + fcr &= ~FCR_ENET_RESET; + bus_write_4(sc->sc_memr, HEATHROW_FCR, fcr); + DELAY(50000); + + bus_write_4(sc->sc_memr, HEATHROW_FCR, fcr); + } } return (bus_generic_attach(dev)); diff --git a/sys/powerpc/powermac/maciovar.h b/sys/powerpc/powermac/maciovar.h index c1ff391..ea0a029 100644 --- a/sys/powerpc/powermac/maciovar.h +++ b/sys/powerpc/powermac/maciovar.h @@ -38,6 +38,16 @@ #define MACIO_REG_SIZE 0x7ffff /* + * Feature Control Registers (FCR) + */ +#define HEATHROW_FCR 0x38 +#define KEYLARGO_FCR0 0x38 +#define KEYLARGO_FCR1 0x3c + +#define FCR_ENET_ENABLE 0x60000000 +#define FCR_ENET_RESET 0x80000000 + +/* * Format of a macio reg property entry. */ struct macio_reg { diff --git a/sys/sparc64/isa/isa.c b/sys/sparc64/isa/isa.c index 9159cda..6e22133 100644 --- a/sys/sparc64/isa/isa.c +++ b/sys/sparc64/isa/isa.c @@ -359,26 +359,3 @@ isa_release_resource(device_t bus, device_t child, int type, int rid, return (bus_generic_rl_release_resource(bus, child, type, rid, res)); } - -int -isa_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, - driver_filter_t *filter, driver_intr_t *intr, void *arg, void **cookiep) -{ - - /* - * Just pass through. This is going to be handled by either - * one of the parent PCI buses or the nexus device. - * The interrupt had been routed before it was added to the - * resource list of the child. - */ - return (bus_generic_setup_intr(dev, child, irq, flags, filter, intr, - arg, cookiep)); -} - -int -isa_teardown_intr(device_t dev, device_t child, struct resource *irq, - void *cookie) -{ - - return (bus_generic_teardown_intr(dev, child, irq, cookie)); -} diff --git a/sys/sys/stdint.h b/sys/sys/stdint.h index 27f6dae..d5d92a5 100644 --- a/sys/sys/stdint.h +++ b/sys/sys/stdint.h @@ -33,46 +33,7 @@ #include <sys/_types.h> #include <machine/_stdint.h> - -#ifndef _INT8_T_DECLARED -typedef __int8_t int8_t; -#define _INT8_T_DECLARED -#endif - -#ifndef _INT16_T_DECLARED -typedef __int16_t int16_t; -#define _INT16_T_DECLARED -#endif - -#ifndef _INT32_T_DECLARED -typedef __int32_t int32_t; -#define _INT32_T_DECLARED -#endif - -#ifndef _INT64_T_DECLARED -typedef __int64_t int64_t; -#define _INT64_T_DECLARED -#endif - -#ifndef _UINT8_T_DECLARED -typedef __uint8_t uint8_t; -#define _UINT8_T_DECLARED -#endif - -#ifndef _UINT16_T_DECLARED -typedef __uint16_t uint16_t; -#define _UINT16_T_DECLARED -#endif - -#ifndef _UINT32_T_DECLARED -typedef __uint32_t uint32_t; -#define _UINT32_T_DECLARED -#endif - -#ifndef _UINT64_T_DECLARED -typedef __uint64_t uint64_t; -#define _UINT64_T_DECLARED -#endif +#include <sys/_stdint.h> typedef __int_least8_t int_least8_t; typedef __int_least16_t int_least16_t; @@ -94,13 +55,13 @@ typedef __uint_fast16_t uint_fast16_t; typedef __uint_fast32_t uint_fast32_t; typedef __uint_fast64_t uint_fast64_t; +#ifndef _INTMAX_T_DECLARED typedef __intmax_t intmax_t; +#define _INTMAX_T_DECLARED +#endif +#ifndef _UINTMAX_T_DECLARED typedef __uintmax_t uintmax_t; - -#ifndef _INTPTR_T_DECLARED -typedef __intptr_t intptr_t; -typedef __uintptr_t uintptr_t; -#define _INTPTR_T_DECLARED +#define _UINTMAX_T_DECLARED #endif #endif /* !_SYS_STDINT_H_ */ diff --git a/sys/sys/types.h b/sys/sys/types.h index 5cc005d..cb513af 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -60,51 +60,7 @@ typedef unsigned int uint; /* Sys V compatibility */ /* * XXX POSIX sized integrals that should appear only in <sys/stdint.h>. */ -#ifndef _INT8_T_DECLARED -typedef __int8_t int8_t; -#define _INT8_T_DECLARED -#endif - -#ifndef _INT16_T_DECLARED -typedef __int16_t int16_t; -#define _INT16_T_DECLARED -#endif - -#ifndef _INT32_T_DECLARED -typedef __int32_t int32_t; -#define _INT32_T_DECLARED -#endif - -#ifndef _INT64_T_DECLARED -typedef __int64_t int64_t; -#define _INT64_T_DECLARED -#endif - -#ifndef _UINT8_T_DECLARED -typedef __uint8_t uint8_t; -#define _UINT8_T_DECLARED -#endif - -#ifndef _UINT16_T_DECLARED -typedef __uint16_t uint16_t; -#define _UINT16_T_DECLARED -#endif - -#ifndef _UINT32_T_DECLARED -typedef __uint32_t uint32_t; -#define _UINT32_T_DECLARED -#endif - -#ifndef _UINT64_T_DECLARED -typedef __uint64_t uint64_t; -#define _UINT64_T_DECLARED -#endif - -#ifndef _INTPTR_T_DECLARED -typedef __intptr_t intptr_t; -typedef __uintptr_t uintptr_t; -#define _INTPTR_T_DECLARED -#endif +#include <sys/_stdint.h> typedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */ typedef __uint16_t u_int16_t; diff --git a/sys/x86/isa/isa.c b/sys/x86/isa/isa.c index 7b2982a..1a57137 100644 --- a/sys/x86/isa/isa.c +++ b/sys/x86/isa/isa.c @@ -238,28 +238,6 @@ isa_release_resource(device_t bus, device_t child, int type, int rid, } /* - * We can't use the bus_generic_* versions of these methods because those - * methods always pass the bus param as the requesting device, and we need - * to pass the child (the i386 nexus knows about this and is prepared to - * deal). - */ -int -isa_setup_intr(device_t bus, device_t child, struct resource *r, int flags, - driver_filter_t *filter, void (*ihand)(void *), void *arg, - void **cookiep) -{ - return (BUS_SETUP_INTR(device_get_parent(bus), child, r, flags, - filter, ihand, arg, cookiep)); -} - -int -isa_teardown_intr(device_t bus, device_t child, struct resource *r, - void *cookie) -{ - return (BUS_TEARDOWN_INTR(device_get_parent(bus), child, r, cookie)); -} - -/* * On this platform, isa can also attach to the legacy bus. */ DRIVER_MODULE(isa, legacy, isa_driver, isa_devclass, 0, 0); diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index e81d2fe..dfef3a7 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -159,9 +159,8 @@ static struct eventtimer lapic_et; static void lapic_enable(void); static void lapic_resume(struct pic *pic); -static void lapic_timer_enable_intr(void); -static void lapic_timer_oneshot(u_int count); -static void lapic_timer_periodic(u_int count); +static void lapic_timer_oneshot(u_int count, int enable_int); +static void lapic_timer_periodic(u_int count, int enable_int); static void lapic_timer_stop(void); static void lapic_timer_set_divisor(u_int divisor); static uint32_t lvt_mode(struct lapic *la, u_int pin, uint32_t value); @@ -379,13 +378,11 @@ lapic_setup(int boot) if (la->la_timer_mode != 0) { KASSERT(la->la_timer_period != 0, ("lapic%u: zero divisor", lapic_id())); - lapic_timer_stop(); lapic_timer_set_divisor(lapic_timer_divisor); - lapic_timer_enable_intr(); if (la->la_timer_mode == 1) - lapic_timer_periodic(la->la_timer_period); + lapic_timer_periodic(la->la_timer_period, 1); else - lapic_timer_oneshot(la->la_timer_period); + lapic_timer_oneshot(la->la_timer_period, 1); } /* Program error LVT and clear any existing errors. */ @@ -496,7 +493,7 @@ lapic_et_start(struct eventtimer *et, /* Try to calibrate the local APIC timer. */ do { lapic_timer_set_divisor(lapic_timer_divisor); - lapic_timer_oneshot(APIC_TIMER_MAX_COUNT); + lapic_timer_oneshot(APIC_TIMER_MAX_COUNT, 0); DELAY(1000000); value = APIC_TIMER_MAX_COUNT - lapic->ccr_timer; if (value != APIC_TIMER_MAX_COUNT) @@ -516,9 +513,7 @@ lapic_et_start(struct eventtimer *et, et->et_max_period.frac = ((0xfffffffeLLU << 32) / et->et_frequency) << 32; } - lapic_timer_stop(); lapic_timer_set_divisor(lapic_timer_divisor); - lapic_timer_enable_intr(); la = &lapics[lapic_id()]; if (period != NULL) { la->la_timer_mode = 1; @@ -526,14 +521,14 @@ lapic_et_start(struct eventtimer *et, (et->et_frequency * (period->frac >> 32)) >> 32; if (period->sec != 0) la->la_timer_period += et->et_frequency * period->sec; - lapic_timer_periodic(la->la_timer_period); + lapic_timer_periodic(la->la_timer_period, 1); } else { la->la_timer_mode = 2; la->la_timer_period = (et->et_frequency * (first->frac >> 32)) >> 32; if (first->sec != 0) la->la_timer_period += et->et_frequency * first->sec; - lapic_timer_oneshot(la->la_timer_period); + lapic_timer_oneshot(la->la_timer_period, 1); } return (0); } @@ -838,25 +833,29 @@ lapic_timer_set_divisor(u_int divisor) } static void -lapic_timer_oneshot(u_int count) +lapic_timer_oneshot(u_int count, int enable_int) { u_int32_t value; value = lapic->lvt_timer; value &= ~APIC_LVTT_TM; value |= APIC_LVTT_TM_ONE_SHOT; + if (enable_int) + value &= ~APIC_LVT_M; lapic->lvt_timer = value; lapic->icr_timer = count; } static void -lapic_timer_periodic(u_int count) +lapic_timer_periodic(u_int count, int enable_int) { u_int32_t value; value = lapic->lvt_timer; value &= ~APIC_LVTT_TM; value |= APIC_LVTT_TM_PERIODIC; + if (enable_int) + value &= ~APIC_LVT_M; lapic->lvt_timer = value; lapic->icr_timer = count; } @@ -870,17 +869,6 @@ lapic_timer_stop(void) value &= ~APIC_LVTT_TM; value |= APIC_LVT_M; lapic->lvt_timer = value; - lapic->icr_timer = 0; -} - -static void -lapic_timer_enable_intr(void) -{ - u_int32_t value; - - value = lapic->lvt_timer; - value &= ~APIC_LVT_M; - lapic->lvt_timer = value; } void diff --git a/tools/build/options/WITHOUT_ACCT b/tools/build/options/WITHOUT_ACCT index 537ee96..4538ee7 100644 --- a/tools/build/options/WITHOUT_ACCT +++ b/tools/build/options/WITHOUT_ACCT @@ -1,5 +1,5 @@ .\" $FreeBSD$ Set to not build process accounting tools such as -.Xr ac 8 +.Xr ac 8 and .Xr accton 8 . diff --git a/tools/build/options/WITHOUT_FDT b/tools/build/options/WITHOUT_FDT index 8f32d85..d3ade05 100644 --- a/tools/build/options/WITHOUT_FDT +++ b/tools/build/options/WITHOUT_FDT @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build Flattened Device Tree support as part of the base system. This -includes the device tree compiler (dtc) and libfdt support library. +Set to not build Flattened Device Tree support as part of the base system. +This includes the device tree compiler (dtc) and libfdt support library. diff --git a/tools/build/options/WITHOUT_FLOPPY b/tools/build/options/WITHOUT_FLOPPY index 1e478d2..ea78d28 100644 --- a/tools/build/options/WITHOUT_FLOPPY +++ b/tools/build/options/WITHOUT_FLOPPY @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build or install programs +Set to not build or install programs for operating floppy disk driver. diff --git a/tools/build/options/WITH_GPIO b/tools/build/options/WITH_GPIO deleted file mode 100644 index a8ee399..0000000 --- a/tools/build/options/WITH_GPIO +++ /dev/null @@ -1,2 +0,0 @@ -.\" $FreeBSD$ -Set to build gpioctl(8) as part of the base system. diff --git a/usr.sbin/makefs/cd9660/cd9660_eltorito.c b/usr.sbin/makefs/cd9660/cd9660_eltorito.c index fef2fda..09aa3a5 100644 --- a/usr.sbin/makefs/cd9660/cd9660_eltorito.c +++ b/usr.sbin/makefs/cd9660/cd9660_eltorito.c @@ -528,25 +528,6 @@ cd9660_write_apm_partition_entry(FILE *fd, int index, int total_partitions, fseek(fd, 32 - strlen(part_name) - 1, SEEK_CUR); fwrite(part_type, strlen(part_type) + 1, 1, fd); - if (sector_size > 512) { - /* - * Some old broken software looks at 512-byte boundaries for - * partition table entries instead of sector boundaries. We - * can fit 3 entries into the first 2048-byte block, so use - * that to humor old code. - */ - - int n_512_parts = (sector_size / 512) - 1; - if (n_512_parts > total_partitions) - n_512_parts = total_partitions; - - if (index < n_512_parts) - cd9660_write_apm_partition_entry(fd, index, n_512_parts, - sector_start * (sector_size / 512), - nsectors * (sector_size / 512), 512, part_name, - part_type); - } - return 0; } @@ -601,23 +582,30 @@ cd9660_write_boot(FILE *fd) fseek(fd, 0, SEEK_SET); apm16 = htons(0x4552); fwrite(&apm16, sizeof(apm16), 1, fd); - apm16 = htons(diskStructure.sectorSize); + /* Device block size */ + apm16 = htons(512); fwrite(&apm16, sizeof(apm16), 1, fd); - apm32 = htonl(diskStructure.totalSectors); + /* Device block count */ + apm32 = htonl(diskStructure.totalSectors * + (diskStructure.sectorSize / 512)); fwrite(&apm32, sizeof(apm32), 1, fd); + /* Device type/id */ + apm16 = htons(1); + fwrite(&apm16, sizeof(apm16), 1, fd); + fwrite(&apm16, sizeof(apm16), 1, fd); /* Count total needed entries */ total_parts = 2 + apm_partitions; /* Self + ISO9660 */ /* Write self-descriptor */ - cd9660_write_apm_partition_entry(fd, 0, - total_parts, 1, total_parts, diskStructure.sectorSize, - "Apple", "Apple_partition_map"); + cd9660_write_apm_partition_entry(fd, 0, total_parts, 1, + total_parts, 512, "Apple", "Apple_partition_map"); /* Write ISO9660 descriptor, enclosing the whole disk */ - cd9660_write_apm_partition_entry(fd, 1, - total_parts, 0, diskStructure.totalSectors, - diskStructure.sectorSize, "", "CD_ROM_Mode_1"); + cd9660_write_apm_partition_entry(fd, 1, total_parts, 0, + diskStructure.totalSectors * + (diskStructure.sectorSize / 512), 512, "ISO9660", + "CD_ROM_Mode_1"); /* Write all partition entries */ apm_partitions = 0; @@ -627,8 +615,9 @@ cd9660_write_boot(FILE *fd) cd9660_write_apm_partition_entry(fd, 2 + apm_partitions++, total_parts, - t->sector, t->num_sectors, diskStructure.sectorSize, - "CD Boot", "Apple_Bootstrap"); + t->sector * (diskStructure.sectorSize / 512), + t->num_sectors * (diskStructure.sectorSize / 512), + 512, "CD Boot", "Apple_Bootstrap"); } } |