From 202d71e3bf35c5c58f3c7ce8fc4313bd825e5320 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 6 Jul 2010 23:29:55 +0000 Subject: [PATCH 01/16] A few patches from Ed Maste by way of Kris Moore 1. Change detect-vmware to detect-emulation 2. improve laptop detection 3. better, network descriptions --- usr.sbin/pc-sysinstall/backend-query/Makefile | 2 +- .../backend-query/detect-laptop.sh | 9 ++++---- .../backend-query/detect-nics.sh | 21 +++++++------------ usr.sbin/pc-sysinstall/doc/help-index | 4 ++-- .../pc-sysinstall/pc-sysinstall.8 | 4 ++-- .../pc-sysinstall/pc-sysinstall.sh | 4 ++-- 6 files changed, 19 insertions(+), 25 deletions(-) diff --git a/usr.sbin/pc-sysinstall/backend-query/Makefile b/usr.sbin/pc-sysinstall/backend-query/Makefile index f516f0b662f6..1deed3f66fbf 100644 --- a/usr.sbin/pc-sysinstall/backend-query/Makefile +++ b/usr.sbin/pc-sysinstall/backend-query/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ -FILES= detect-laptop.sh detect-nics.sh detect-vmware.sh disk-info.sh \ +FILES= detect-laptop.sh detect-nics.sh detect-emulation.sh disk-info.sh \ disk-list.sh disk-part.sh enable-net.sh list-config.sh list-components.sh \ list-mirrors.sh list-rsync-backups.sh list-tzones.sh query-langs.sh \ send-logs.sh setup-ssh-keys.sh sys-mem.sh test-live.sh test-netup.sh \ diff --git a/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh b/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh index 0c8c94a6db81..4772c2f5a6b0 100755 --- a/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh +++ b/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh @@ -25,9 +25,8 @@ # # $FreeBSD$ -dmesgLine=`dmesg | grep "acpi_acad0"` -if test "${dmesgLine}" = ""; then - echo "laptop: NO" -else +if devinfo | grep 'acpi_acad0' >/dev/null 2>/dev/null; then echo "laptop: YES" -fi +else + echo "laptop: NO" +fi diff --git a/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh b/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh index 57b5c51618eb..2f7272a6e2dc 100755 --- a/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh +++ b/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh @@ -25,17 +25,12 @@ # # $FreeBSD$ -rm /tmp/netCards 2>/dev/null -touch /tmp/netCards - -config="`ifconfig -l`" - -for i in $config -do - echo "${i}" | grep -e "lo0" -e "^fwe" -e "^fwip" -e "lo1" -e "^plip" -e "^pfsync" -e "^pflog" -e "^tun" >/dev/null 2>/dev/null - if [ "$?" != "0" ] - then - IDENT="<`dmesg | grep ^${i} | grep -v "miibus" | grep '<' | cut -d '<' -f 2 | cut -d '>' -f 1 | head -1`>" - echo "${i}: $IDENT" - fi +for i in $(ifconfig -l); do + case "${i%%[0-9]*}" in + lo|fwe|fwip|plip|pfsync|pflog|tun) + continue + ;; + esac + IDENT=$(dmesg | sed -n "s/^$i: <\(.*\)>.*$/\1/p" | head -1) + echo "${i}: <$IDENT>" done diff --git a/usr.sbin/pc-sysinstall/doc/help-index b/usr.sbin/pc-sysinstall/doc/help-index index 2c7c4cb78c47..bb6cff145f49 100644 --- a/usr.sbin/pc-sysinstall/doc/help-index +++ b/usr.sbin/pc-sysinstall/doc/help-index @@ -22,8 +22,8 @@ System Query Commands detect-laptop Tests to see if this system is a laptop or desktop - detect-vmware - Tests to see if this system is actually a vmware session + detect-emulation + Tests to see if this system is actually running in an emulator such as VirtualBox detect-nics Returns a listing of the detected network cards on this system diff --git a/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8 b/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8 index b6ea6989f7c8..15cece241103 100644 --- a/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8 +++ b/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8 @@ -69,8 +69,8 @@ Returns information about a storage device's size, cylinders, heads, and sectors. .It detect-laptop Tests to see if this system is a laptop or desktop. -.It detect-vmware -Tests to see if this system is a vmware session. +.It detect-emulation +Tests to see if this system is running in an emulator .It detect-nics Returns a listing of the detected network cards on this system. .It list-components diff --git a/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh b/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh index 20254e6fd4cf..48608932372a 100755 --- a/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh +++ b/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh @@ -124,8 +124,8 @@ case $1 in detect-nics) ${QUERYDIR}/detect-nics.sh ;; - # The user is wanting to check if we are in vmware - detect-vmware) ${QUERYDIR}/detect-vmware.sh + # The user is wanting to check if we are in emulation + detect-emulation) ${QUERYDIR}/detect-emulation.sh ;; # The user is wanting to query a disk's information From e330ab14ff1485133e028606b7a386a326aa45c0 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 6 Jul 2010 23:31:52 +0000 Subject: [PATCH 02/16] These files should have been added/deleted in r209751 --- .../{detect-vmware.sh => detect-emulation.sh} | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) rename usr.sbin/pc-sysinstall/backend-query/{detect-vmware.sh => detect-emulation.sh} (88%) diff --git a/usr.sbin/pc-sysinstall/backend-query/detect-vmware.sh b/usr.sbin/pc-sysinstall/backend-query/detect-emulation.sh similarity index 88% rename from usr.sbin/pc-sysinstall/backend-query/detect-vmware.sh rename to usr.sbin/pc-sysinstall/backend-query/detect-emulation.sh index 14a0512515aa..5eefd269fd2e 100755 --- a/usr.sbin/pc-sysinstall/backend-query/detect-vmware.sh +++ b/usr.sbin/pc-sysinstall/backend-query/detect-emulation.sh @@ -25,12 +25,17 @@ # # $FreeBSD$ -pciconf -lv | grep -i vmware >/dev/null 2>/dev/null -if [ "$?" = "0" ] -then - echo "vmware: YES" +case "$(kenv smbios.system.product)" in +VirtualBox) + echo "emulation: VIRTUALBOX" exit 0 -else - echo "vmware: NO" - exit 1 -fi + ;; +VMware*) + echo "emulation: VMWARE" + exit 0 + ;; +*) + echo "emulation: NO" + exit 1 + ;; +esac From 7ec5a4bd2228aff380eeed7e0894958180e6de7c Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 7 Jul 2010 00:03:06 +0000 Subject: [PATCH 03/16] Further simplification. --- usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh b/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh index 4772c2f5a6b0..d23a420c78c1 100755 --- a/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh +++ b/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh @@ -25,7 +25,7 @@ # # $FreeBSD$ -if devinfo | grep 'acpi_acad0' >/dev/null 2>/dev/null; then +if devinfo | grep -q acpi_acad0; then echo "laptop: YES" else echo "laptop: NO" From 6964abef8367c93d1e845633b734d55946d612e4 Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Wed, 7 Jul 2010 06:06:54 +0000 Subject: [PATCH 04/16] When dhclient obtains a lease, it runs dhclient-script and expects it to configure the interface. When the script is complete, dhclient monitors the routing socket and will terminate if its address is deleted or if its interface is removed or brought down. Because the routing socket is already open when dhclient-script is run, dhclient ignores address deletions for 10 seconds after the script was run. If the address that will be obtained is already configured on the interface before dhclient starts, and if dhclient-script takes more than 10 seconds (perhaps due to dhclient-*-hooks latencies), on script completion, dhclient will immediately and silently exit when it sees the RTM_DELADDR routing message resulting from the script reassigning the address to the interface. This change logs dhclient's reason for exiting and also changes the 10 second timeout to be effective from completion of dhclient-script rather than from when it was started. We now ignore RTM_DELADDR and RTM_NEWADDR messages when the message contains no interface address (which should not happen) rather than exiting. Not reviewed by: brooks (timeout) MFC after: 3 weeks --- sbin/dhclient/dhclient.c | 46 ++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index f48466e9f45f..afb6d6364a6c 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -126,7 +126,7 @@ int fork_privchld(int, int); ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) -time_t scripttime; +static time_t scripttime; int findproto(char *cp, int n) @@ -204,7 +204,7 @@ disassoc(void *arg) void routehandler(struct protocol *p) { - char msg[2048]; + char msg[2048], *addr; struct rt_msghdr *rtm; struct if_msghdr *ifm; struct ifa_msghdr *ifam; @@ -224,13 +224,6 @@ routehandler(struct protocol *p) switch (rtm->rtm_type) { case RTM_NEWADDR: - /* - * XXX: If someone other than us adds our address, - * we should assume they are taking over from us, - * delete the lease record, and exit without modifying - * the interface. - */ - break; case RTM_DELADDR: ifam = (struct ifa_msghdr *)rtm; @@ -243,7 +236,7 @@ routehandler(struct protocol *p) sa = get_ifa((char *)(ifam + 1), ifam->ifam_addrs); if (sa == NULL) - goto die; + break; if ((a.len = sizeof(struct in_addr)) > sizeof(a.iabuf)) error("king bula sez: len mismatch"); @@ -255,21 +248,42 @@ routehandler(struct protocol *p) if (addr_eq(a, l->address)) break; - if (l == NULL) /* deleted addr is not the one we set */ + if (l == NULL) /* added/deleted addr is not the one we set */ break; - goto die; + + addr = inet_ntoa(((struct sockaddr_in *)sa)->sin_addr); + if (rtm->rtm_type == RTM_NEWADDR) { + /* + * XXX: If someone other than us adds our address, + * should we assume they are taking over from us, + * delete the lease record, and exit without modifying + * the interface? + */ + warning("My address (%s) was re-added", addr); + } else { + warning("My address (%s) was deleted, dhclient exiting", + addr); + goto die; + } + break; case RTM_IFINFO: ifm = (struct if_msghdr *)rtm; if (ifm->ifm_index != ifi->index) break; - if ((rtm->rtm_flags & RTF_UP) == 0) + if ((rtm->rtm_flags & RTF_UP) == 0) { + warning("Interface %s is down, dhclient exiting", + ifi->name); goto die; + } break; case RTM_IFANNOUNCE: ifan = (struct if_announcemsghdr *)rtm; if (ifan->ifan_what == IFAN_DEPARTURE && - ifan->ifan_index == ifi->index) + ifan->ifan_index == ifi->index) { + warning("Interface %s is gone, dhclient exiting", + ifi->name); goto die; + } break; case RTM_IEEE80211: ifan = (struct if_announcemsghdr *)rtm; @@ -2110,8 +2124,6 @@ script_go(void) struct buf *buf; int ret; - scripttime = time(NULL); - hdr.code = IMSG_SCRIPT_GO; hdr.len = sizeof(struct imsg_hdr); @@ -2132,6 +2144,8 @@ script_go(void) error("received corrupted message"); buf_read(privfd, &ret, sizeof(ret)); + scripttime = time(NULL); + return (ret); } From 52f65779ea1d6e40a4a9b6b259c6da28cdcb1644 Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Wed, 7 Jul 2010 07:09:33 +0000 Subject: [PATCH 05/16] - Add support for the "sec" option to "zfs set sharenfs" Submitted by: Dmitry Morozovsky Approved by: delphij (mentor) MFC after: 3 days --- cddl/compat/opensolaris/misc/fsshare.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cddl/compat/opensolaris/misc/fsshare.c b/cddl/compat/opensolaris/misc/fsshare.c index ca82710a3411..10ed591d5bca 100644 --- a/cddl/compat/opensolaris/misc/fsshare.c +++ b/cddl/compat/opensolaris/misc/fsshare.c @@ -110,11 +110,11 @@ getline(FILE *fd, const char *skip) * * Recognized keywords: * - * ro, maproot, mapall, mask, network, alldirs, public, webnfs, index, quiet + * ro, maproot, mapall, mask, network, sec, alldirs, public, webnfs, index, quiet * */ static const char *known_opts[] = { "ro", "maproot", "mapall", "mask", - "network", "alldirs", "public", "webnfs", "index", "quiet", NULL }; + "network", "sec", "alldirs", "public", "webnfs", "index", "quiet", NULL }; static char * translate_opts(const char *shareopts) { From 054d87d6970a84ddd64f30c888c1dc0a458fa5d9 Mon Sep 17 00:00:00 2001 From: Kevin Lo Date: Wed, 7 Jul 2010 09:23:46 +0000 Subject: [PATCH 06/16] Add the u3g(4) driver. I can't find any reason why it's not here. --- sys/amd64/conf/GENERIC | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index b5a1930dbba9..36ee673dd5d6 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -294,6 +294,7 @@ device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse device urio # Diamond Rio 500 MP3 player # USB Serial devices +device u3g # USB-based 3G modems (Option, Huawei, Sierra) device uark # Technologies ARK3116 based serial adapters device ubsa # Belkin F5U103 and compatible serial adapters device uftdi # For FTDI usb serial adapters From 335a2d00c465d91baba50b12f9b67e6305a90a1e Mon Sep 17 00:00:00 2001 From: Randall Stewart Date: Wed, 7 Jul 2010 11:19:06 +0000 Subject: [PATCH 07/16] If a user calls sctp_sendx() with a NULL sinfo we will crash. Instead we should provide our own temp structure to use internally. MFC after: 1 month --- lib/libc/net/sctp_sys_calls.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/libc/net/sctp_sys_calls.c b/lib/libc/net/sctp_sys_calls.c index 1a20146563fe..fcf4886e493e 100644 --- a/lib/libc/net/sctp_sys_calls.c +++ b/lib/libc/net/sctp_sys_calls.c @@ -724,6 +724,7 @@ sctp_sendx(int sd, const void *msg, size_t msg_len, struct sctp_sndrcvinfo *sinfo, int flags) { + struct sctp_sndrcvinfo __sinfo; ssize_t ret; int i, cnt, *aa, saved_errno; char *buf; @@ -790,6 +791,10 @@ sctp_sendx(int sd, const void *msg, size_t msg_len, return (ret); } continue_send: + if (sinfo == NULL) { + sinfo = &__sinfo; + memset(&__sinfo, 0, sizeof(__sinfo)); + } sinfo->sinfo_assoc_id = sctp_getassocid(sd, addrs); if (sinfo->sinfo_assoc_id == 0) { printf("Huh, can't get associd? TSNH!\n"); From 631cb86f11fe7db2eb5ebb1e512bb6445280b14d Mon Sep 17 00:00:00 2001 From: Attilio Rao Date: Wed, 7 Jul 2010 12:00:11 +0000 Subject: [PATCH 08/16] - Simplify logic in handling ticks wrap-up - Fix a bug where thread may be in sleeping state but the wchan won't be set, leading to an empty container for sleepq_type(). [0] Sponsored by: Sandvine Incorporated [0] Submitted by: Bryan Venteicher MFC after: 3 days X-MFC: 209577 --- sys/kern/kern_clock.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index 5097862a3cd4..c283b6b1e6a7 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -202,8 +202,14 @@ deadlkres(void) FOREACH_PROC_IN_SYSTEM(p) { PROC_LOCK(p); FOREACH_THREAD_IN_PROC(p, td) { + + /* + * Once a thread is found in "interesting" + * state a possible ticks wrap-up needs to be + * checked. + */ thread_lock(td); - if (TD_ON_LOCK(td)) { + if (TD_ON_LOCK(td) && ticks < td->td_blktick) { /* * The thread should be blocked on a @@ -212,11 +218,6 @@ deadlkres(void) */ MPASS(td->td_blocked != NULL); - /* Handle ticks wrap-up. */ - if (ticks < td->td_blktick) { - thread_unlock(td); - continue; - } tticks = ticks - td->td_blktick; thread_unlock(td); if (tticks > blkticks) { @@ -232,13 +233,9 @@ deadlkres(void) panic("%s: possible deadlock detected for %p, blocked for %d ticks\n", __func__, td, tticks); } - } else if (TD_IS_SLEEPING(td)) { - - /* Handle ticks wrap-up. */ - if (ticks < td->td_blktick) { - thread_unlock(td); - continue; - } + } else if (TD_IS_SLEEPING(td) && + TD_ON_SLEEPQ(td) && + ticks < td->td_blktick) { /* * Check if the thread is sleeping on a From 80599de862194ad871995bac061cf9b14becb8f6 Mon Sep 17 00:00:00 2001 From: Rui Paulo Date: Wed, 7 Jul 2010 12:08:58 +0000 Subject: [PATCH 09/16] Fix style issues with the previous commit, namely use-tab-instead-of-space and don't use underscores in macro variables. Pointed out by: bde --- sys/amd64/include/segments.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/amd64/include/segments.h b/sys/amd64/include/segments.h index d0604becb284..282c1aeda153 100644 --- a/sys/amd64/include/segments.h +++ b/sys/amd64/include/segments.h @@ -74,12 +74,12 @@ struct user_segment_descriptor { u_int64_t sd_hibase:8; /* segment base address (msb) */ } __packed; -#define USD_GETBASE(_sd) (((_sd)->sd_lobase) | (_sd)->sd_hibase << 24) -#define USD_SETBASE(_sd, _b) (_sd)->sd_lobase = (_b); \ - (_sd)->sd_hibase = ((_b) >> 24); -#define USD_GETLIMIT(_sd) (((_sd)->sd_lolimit) | (_sd)->sd_hilimit << 16) -#define USD_SETLIMIT(_sd, _l) (_sd)->sd_lolimit = (_l); \ - (_sd)->sd_hilimit = ((_l) >> 16); +#define USD_GETBASE(sd) (((sd)->sd_lobase) | (sd)->sd_hibase << 24) +#define USD_SETBASE(sd, b) (sd)->sd_lobase = (b); \ + (sd)->sd_hibase = ((b) >> 24); +#define USD_GETLIMIT(sd) (((sd)->sd_lolimit) | (sd)->sd_hilimit << 16) +#define USD_SETLIMIT(sd, l) (sd)->sd_lolimit = (l); \ + (sd)->sd_hilimit = ((l) >> 16); /* * System segment descriptors (128 bit wide) From 2544a9be985d7b2b7cdfa78b3c24d09149b2dd10 Mon Sep 17 00:00:00 2001 From: Rebecca Cran Date: Wed, 7 Jul 2010 12:44:19 +0000 Subject: [PATCH 10/16] Increase the default and minimum partition sizes. Bump / to 1GB, /var to 4GB and /tmp to 1GB. A 512MB root partition is now too small to hold two kernels, so to prevent installkernel failing 1GB is a better default. Likewise, applications are storing more data in /var so 4GB is more reasonable on a modern machine. The previous minimum partition sizes were too small to hold a minimal installation, and have been adjusted accordingly. Discussed with: rwatson, simon Approved by: rrs (mentor) MFC after: 1 week --- usr.sbin/sysinstall/label.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c index c5c06ea7cad3..ed7bdf074a0f 100644 --- a/usr.sbin/sysinstall/label.c +++ b/usr.sbin/sysinstall/label.c @@ -62,9 +62,9 @@ * Minimum partition sizes */ #if defined(__ia64__) || defined(__sparc64__) || defined(__amd64__) -#define ROOT_MIN_SIZE 128 +#define ROOT_MIN_SIZE 280 #else -#define ROOT_MIN_SIZE 118 +#define ROOT_MIN_SIZE 180 #endif #define SWAP_MIN_SIZE 32 #define USR_MIN_SIZE 160 @@ -82,10 +82,10 @@ * for this configuration we scale things relative to the NOM vs DEFAULT * sizes. If the disk is larger then /home will get any remaining space. */ -#define ROOT_DEFAULT_SIZE 512 +#define ROOT_DEFAULT_SIZE 1024 #define USR_DEFAULT_SIZE 8192 -#define VAR_DEFAULT_SIZE 1024 -#define TMP_DEFAULT_SIZE 512 +#define VAR_DEFAULT_SIZE 4096 +#define TMP_DEFAULT_SIZE 1024 #define HOME_DEFAULT_SIZE USR_DEFAULT_SIZE /* @@ -93,9 +93,9 @@ * when we have insufficient disk space. If this isn't sufficient we scale * down using the MIN sizes instead. */ -#define ROOT_NOMINAL_SIZE 256 +#define ROOT_NOMINAL_SIZE 512 #define USR_NOMINAL_SIZE 1536 -#define VAR_NOMINAL_SIZE 128 +#define VAR_NOMINAL_SIZE 512 #define TMP_NOMINAL_SIZE 128 #define HOME_NOMINAL_SIZE USR_NOMINAL_SIZE From ac35b90587d49675ccd0722cb7843a31887a230e Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Wed, 7 Jul 2010 15:05:44 +0000 Subject: [PATCH 11/16] Fix the CS line definitions. These bits are for the CS2/CS1 lines rather than CS1/CS0. This has been tested on the Ubiqiti Routerstation Pro board. --- sys/mips/atheros/ar71xxreg.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/mips/atheros/ar71xxreg.h b/sys/mips/atheros/ar71xxreg.h index 6c93e496805b..a87151f62429 100644 --- a/sys/mips/atheros/ar71xxreg.h +++ b/sys/mips/atheros/ar71xxreg.h @@ -151,10 +151,10 @@ #define AR71XX_GPIO_FUNCTION 0x28 #define GPIO_FUNC_STEREO_EN (1 << 17) #define GPIO_FUNC_SLIC_EN (1 << 16) -#define GPIO_FUNC_SPI_CS1_EN (1 << 15) - /* CS1 is shared with GPIO_1 */ -#define GPIO_FUNC_SPI_CS0_EN (1 << 14) - /* CS0 is shared with GPIO_0 */ +#define GPIO_FUNC_SPI_CS2_EN (1 << 15) + /* CS2 is shared with GPIO_1 */ +#define GPIO_FUNC_SPI_CS1_EN (1 << 14) + /* CS1 is shared with GPIO_0 */ #define GPIO_FUNC_SPI_EN (1 << 13) #define GPIO_FUNC_UART_EN (1 << 8) #define GPIO_FUNC_USB_OC_EN (1 << 4) From 832ccb58f4812f279170f79b9010f27fa96d1492 Mon Sep 17 00:00:00 2001 From: Benedict Reuschling Date: Wed, 7 Jul 2010 17:44:09 +0000 Subject: [PATCH 12/16] Fix an error in the EXAMPLES section of getopt(1), which is based on the same fix present in NetBSD. Note: the getopt man page contains more antique information like this. An overhaul of the man page and/or sync with NetBSD would be the right thing to do. But since this is out of the scope of the PR, I'll leave it as it is for now. PR: docs/133118 Submitted by: Oleg A. Mamontov (oleg at mamontov dot net) Discussed with: jilles@ MFC after: 2 weeks --- usr.bin/getopt/getopt.1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/getopt/getopt.1 b/usr.bin/getopt/getopt.1 index 771a2e73645f..eafdce1bc45a 100644 --- a/usr.bin/getopt/getopt.1 +++ b/usr.bin/getopt/getopt.1 @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd April 3, 1999 +.Dd July 7, 2010 .Dt GETOPT 1 .Os .Sh NAME @@ -64,9 +64,9 @@ set \-\- $args # You cannot use the set command with a backquoted getopt directly, # since the exit code from getopt would be shadowed by those of set, # which is zero by definition. -for i +while true; do - case "$i" + case "$1" in \-a|\-b) echo flag $i set; sflags="${i#-}$sflags"; From 58bf34c3275c46ae5a926d8d6bf6d751dc59ccdb Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Wed, 7 Jul 2010 19:06:53 +0000 Subject: [PATCH 13/16] Use the kernel's start address to determine what to map. This allows us to link the kernel at different addresses without needing to build a corresponding loader. --- sys/boot/ia64/common/exec.c | 7 ++++--- sys/boot/ia64/efi/version | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/boot/ia64/common/exec.c b/sys/boot/ia64/common/exec.c index 6b451f24cb35..1a8094f50084 100644 --- a/sys/boot/ia64/common/exec.c +++ b/sys/boot/ia64/common/exec.c @@ -106,11 +106,12 @@ elf64_exec(struct preloaded_file *fp) pte = PTE_PRESENT | PTE_MA_WB | PTE_ACCESSED | PTE_DIRTY | PTE_PL_KERN | PTE_AR_RWX | PTE_ED; + pte |= IA64_RR_MASK(hdr->e_entry) & PTE_PPN_MASK; - __asm __volatile("mov cr.ifa=%0" :: "r"(IA64_RR_BASE(7))); + __asm __volatile("mov cr.ifa=%0" :: "r"(hdr->e_entry)); __asm __volatile("mov cr.itir=%0" :: "r"(28 << 2)); - __asm __volatile("ptr.i %0,%1" :: "r"(IA64_RR_BASE(7)), "r"(28<<2)); - __asm __volatile("ptr.d %0,%1" :: "r"(IA64_RR_BASE(7)), "r"(28<<2)); + __asm __volatile("ptr.i %0,%1" :: "r"(hdr->e_entry), "r"(28<<2)); + __asm __volatile("ptr.d %0,%1" :: "r"(hdr->e_entry), "r"(28<<2)); __asm __volatile("srlz.i;;"); __asm __volatile("itr.i itr[%0]=%1;;" :: "r"(0), "r"(pte)); __asm __volatile("srlz.i;;"); diff --git a/sys/boot/ia64/efi/version b/sys/boot/ia64/efi/version index 148ed4c59805..a31d87dae47b 100644 --- a/sys/boot/ia64/efi/version +++ b/sys/boot/ia64/efi/version @@ -3,6 +3,8 @@ $FreeBSD$ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important. Make sure the current version number is on line 6. +2.2: Create direct mapping based on start address instead of mapping + first 256M. 2.1: Add support for "-dev " argument parsing. 2.0: Provide devices based on the block I/O protocol, rather than the simple file services protocol. Use the FreeBSD file system code From 1a6c2ccd5ec02293f50a1eff26df2f001ec25ae4 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Wed, 7 Jul 2010 19:34:48 +0000 Subject: [PATCH 14/16] Remove pointless BOOTP conditional. --- sys/ia64/ia64/autoconf.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/ia64/ia64/autoconf.c b/sys/ia64/ia64/autoconf.c index cf073c835095..1e09eef6d114 100644 --- a/sys/ia64/ia64/autoconf.c +++ b/sys/ia64/ia64/autoconf.c @@ -26,7 +26,6 @@ * $FreeBSD$ */ -#include "opt_bootp.h" #include "opt_isa.h" #include @@ -53,10 +52,6 @@ SYSINIT(configure2, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL); /* SI_ORDER_MIDDLE is hookable */ SYSINIT(configure3, SI_SUB_CONFIGURE, SI_ORDER_ANY, configure_final, NULL); -#ifdef BOOTP -void bootpc_init(void); -#endif - #ifdef DEV_ISA #include device_t isa_bus_device = 0; From b05f9d9db06d6063a4be4c4051718cd4fc997ee5 Mon Sep 17 00:00:00 2001 From: Randi Harper Date: Wed, 7 Jul 2010 20:06:48 +0000 Subject: [PATCH 15/16] Add further documentation for netDev in install.cfg to reflect the new usage. Approved by: cperciva (mentor) MFC after: 3 days --- usr.sbin/sysinstall/install.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/sysinstall/install.cfg b/usr.sbin/sysinstall/install.cfg index d894f0619aed..ad53f8e0e7a8 100644 --- a/usr.sbin/sysinstall/install.cfg +++ b/usr.sbin/sysinstall/install.cfg @@ -20,6 +20,7 @@ netmask=255.255.255.240 ################################ # Which installation device to use - ftp is pointed directly at my local # machine and the installation device is my WD8013 ethernet interface. +# netDev can be set to ANY or a comma-delimited list of interfaces. _ftpPath=ftp://time.cdrom.com/pub netDev=ed0 mediaSetFTP From 092b5c88c5cf782a28bace8e0a0a05b92c14c489 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Wed, 7 Jul 2010 20:07:33 +0000 Subject: [PATCH 16/16] Add acpi_find_table() -- a convenience function for looking up an ACPI table given the signature. --- sys/ia64/acpica/acpi_machdep.c | 39 ++++++++++++++++++++++++++++++++-- sys/ia64/include/md_var.h | 1 + 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/sys/ia64/acpica/acpi_machdep.c b/sys/ia64/acpica/acpi_machdep.c index e5623fb82260..b7b612fd220e 100644 --- a/sys/ia64/acpica/acpi_machdep.c +++ b/sys/ia64/acpica/acpi_machdep.c @@ -28,11 +28,12 @@ #include #include +#include +#include #include - +#include #include -#include int acpi_machdep_init(device_t dev) @@ -57,3 +58,37 @@ acpi_cpu_c1() { ia64_call_pal_static(PAL_HALT_LIGHT, 0, 0, 0); } + +void * +acpi_find_table(const char *sig) +{ + ACPI_PHYSICAL_ADDRESS rsdp_ptr; + ACPI_TABLE_RSDP *rsdp; + ACPI_TABLE_XSDT *xsdt; + ACPI_TABLE_HEADER *table; + UINT64 addr; + u_int i, count; + + if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0) + return (NULL); + + rsdp = (ACPI_TABLE_RSDP *)IA64_PHYS_TO_RR7(rsdp_ptr); + xsdt = (ACPI_TABLE_XSDT *)IA64_PHYS_TO_RR7(rsdp->XsdtPhysicalAddress); + + count = (UINT64 *)((char *)xsdt + xsdt->Header.Length) - + xsdt->TableOffsetEntry; + + for (i = 0; i < count; i++) { + addr = xsdt->TableOffsetEntry[i]; + table = (ACPI_TABLE_HEADER *)IA64_PHYS_TO_RR7(addr); + + if (strncmp(table->Signature, sig, ACPI_NAME_SIZE) != 0) + continue; + if (ACPI_FAILURE(AcpiTbChecksum((void *)table, table->Length))) + continue; + + return (table); + } + + return (NULL); +} diff --git a/sys/ia64/include/md_var.h b/sys/ia64/include/md_var.h index f64e4c9b8563..82869362b8c5 100644 --- a/sys/ia64/include/md_var.h +++ b/sys/ia64/include/md_var.h @@ -77,6 +77,7 @@ extern uint64_t ia64_lapic_addr; extern long Maxmem; extern u_int busdma_swi_pending; +void *acpi_find_table(const char *sig); void busdma_swi(void); int copyout_regstack(struct thread *, uint64_t *, uint64_t *); void cpu_mp_add(u_int, u_int, u_int);