MFhead @ r305170
This commit is contained in:
commit
f8fd1a95d9
9
Makefile
9
Makefile
@ -109,7 +109,8 @@
|
||||
|
||||
# Note: we use this awkward construct to be compatible with FreeBSD's
|
||||
# old make used in 10.0 and 9.2 and earlier.
|
||||
.if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && !make(showconfig)
|
||||
.if defined(MK_DIRDEPS_BUILD) && ${MK_DIRDEPS_BUILD} == "yes" && \
|
||||
!make(showconfig) && !make(print-dir)
|
||||
# targets/Makefile plays the role of top-level
|
||||
.include "targets/Makefile"
|
||||
.else
|
||||
@ -132,7 +133,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
|
||||
xdev-links native-xtools stageworld stagekernel stage-packages \
|
||||
create-world-packages create-kernel-packages create-packages \
|
||||
packages installconfig real-packages sign-packages package-pkg \
|
||||
test-system-compiler
|
||||
print-dir test-system-compiler
|
||||
|
||||
# XXX: r156740: This can't work since bsd.subdir.mk is not included ever.
|
||||
# It will only work for SUBDIR_TARGETS in make.conf.
|
||||
@ -257,6 +258,10 @@ _TARGET_ARCH= ${XDEV_ARCH}
|
||||
_TARGET?= ${MACHINE}
|
||||
_TARGET_ARCH?= ${MACHINE_ARCH}
|
||||
|
||||
.if make(print-dir)
|
||||
.SILENT:
|
||||
.endif
|
||||
|
||||
#
|
||||
# Make sure we have an up-to-date make(1). Only world and buildworld
|
||||
# should do this as those are the initial targets used for upgrades.
|
||||
|
@ -166,6 +166,9 @@ main(int argc, char *argv[])
|
||||
hflag = 0;
|
||||
break;
|
||||
case 'l':
|
||||
/* Ignore duplicate -l */
|
||||
if (lflag)
|
||||
break;
|
||||
if (vfslist != NULL)
|
||||
xo_errx(1, "-l and -t are mutually exclusive.");
|
||||
vfslist = makevfslist(makenetvfslist());
|
||||
|
@ -644,11 +644,8 @@ ctf_type_compat(ctf_file_t *lfp, ctf_id_t ltype,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the type and offset for a given member of a STRUCT or UNION.
|
||||
*/
|
||||
int
|
||||
ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
|
||||
static int
|
||||
_ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name, ulong_t off,
|
||||
ctf_membinfo_t *mip)
|
||||
{
|
||||
ctf_file_t *ofp = fp;
|
||||
@ -673,9 +670,13 @@ ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
|
||||
((uintptr_t)tp + increment);
|
||||
|
||||
for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, mp++) {
|
||||
if (mp->ctm_name == 0 &&
|
||||
_ctf_member_info(fp, mp->ctm_type, name,
|
||||
mp->ctm_offset + off, mip) == 0)
|
||||
return (0);
|
||||
if (strcmp(ctf_strptr(fp, mp->ctm_name), name) == 0) {
|
||||
mip->ctm_type = mp->ctm_type;
|
||||
mip->ctm_offset = mp->ctm_offset;
|
||||
mip->ctm_offset = mp->ctm_offset + off;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@ -684,9 +685,14 @@ ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
|
||||
((uintptr_t)tp + increment);
|
||||
|
||||
for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, lmp++) {
|
||||
if (lmp->ctlm_name == 0 &&
|
||||
_ctf_member_info(fp, lmp->ctlm_name, name,
|
||||
(ulong_t)CTF_LMEM_OFFSET(lmp) + off, mip) == 0)
|
||||
return (0);
|
||||
if (strcmp(ctf_strptr(fp, lmp->ctlm_name), name) == 0) {
|
||||
mip->ctm_type = lmp->ctlm_type;
|
||||
mip->ctm_offset = (ulong_t)CTF_LMEM_OFFSET(lmp);
|
||||
mip->ctm_offset =
|
||||
(ulong_t)CTF_LMEM_OFFSET(lmp) + off;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@ -695,6 +701,17 @@ ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
|
||||
return (ctf_set_errno(ofp, ECTF_NOMEMBNAM));
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the type and offset for a given member of a STRUCT or UNION.
|
||||
*/
|
||||
int
|
||||
ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
|
||||
ctf_membinfo_t *mip)
|
||||
{
|
||||
|
||||
return (_ctf_member_info(fp, type, name, 0, mip));
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the array type, index, and size information for the specified ARRAY.
|
||||
*/
|
||||
|
@ -13,7 +13,9 @@ DIRDEPS = \
|
||||
lib/libcompiler_rt \
|
||||
lib/libcxxrt \
|
||||
lib/libelf \
|
||||
lib/libkvm \
|
||||
lib/libproc \
|
||||
lib/libprocstat \
|
||||
lib/librtld_db \
|
||||
lib/libthr \
|
||||
lib/libutil \
|
||||
|
@ -13,7 +13,9 @@ DIRDEPS = \
|
||||
lib/libcompiler_rt \
|
||||
lib/libcxxrt \
|
||||
lib/libelf \
|
||||
lib/libkvm \
|
||||
lib/libproc \
|
||||
lib/libprocstat \
|
||||
lib/librt \
|
||||
lib/librtld_db \
|
||||
lib/libthr \
|
||||
|
@ -13,7 +13,9 @@ DIRDEPS = \
|
||||
lib/libcompiler_rt \
|
||||
lib/libcxxrt \
|
||||
lib/libelf \
|
||||
lib/libkvm \
|
||||
lib/libproc \
|
||||
lib/libprocstat \
|
||||
lib/librtld_db \
|
||||
lib/libthr \
|
||||
lib/libutil \
|
||||
|
35
cddl/usr.sbin/zfsd/Makefile.depend
Normal file
35
cddl/usr.sbin/zfsd/Makefile.depend
Normal file
@ -0,0 +1,35 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
cddl/lib/libavl \
|
||||
cddl/lib/libnvpair \
|
||||
cddl/lib/libumem \
|
||||
cddl/lib/libuutil \
|
||||
cddl/lib/libzfs \
|
||||
cddl/lib/libzfs_core \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libc++ \
|
||||
lib/libcompiler_rt \
|
||||
lib/libcxxrt \
|
||||
lib/libdevdctl \
|
||||
lib/libexpat \
|
||||
lib/libgeom \
|
||||
lib/libmd \
|
||||
lib/libsbuf \
|
||||
lib/libthr \
|
||||
lib/libutil \
|
||||
lib/libz \
|
||||
lib/msun \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: elfdefinitions.h 3455 2016-05-09 13:47:29Z emaste $
|
||||
* $Id: elfdefinitions.h 3485 2016-08-18 13:38:52Z emaste $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -2091,7 +2091,10 @@ _ELF_DEFINE_RELOC(R_RISCV_GNU_VTINHERIT, 41) \
|
||||
_ELF_DEFINE_RELOC(R_RISCV_GNU_VTENTRY, 42) \
|
||||
_ELF_DEFINE_RELOC(R_RISCV_ALIGN, 43) \
|
||||
_ELF_DEFINE_RELOC(R_RISCV_RVC_BRANCH, 44) \
|
||||
_ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45)
|
||||
_ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45) \
|
||||
_ELF_DEFINE_RELOC(R_RISCV_RVC_LUI, 46) \
|
||||
_ELF_DEFINE_RELOC(R_RISCV_GPREL_I, 47) \
|
||||
_ELF_DEFINE_RELOC(R_RISCV_GPREL_S, 48)
|
||||
|
||||
#define _ELF_DEFINE_SPARC_RELOCATIONS() \
|
||||
_ELF_DEFINE_RELOC(R_SPARC_NONE, 0) \
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#include "elfcopy.h"
|
||||
|
||||
ELFTC_VCSID("$Id: archive.c 3287 2015-12-31 16:58:48Z emaste $");
|
||||
ELFTC_VCSID("$Id: archive.c 3490 2016-08-31 00:12:22Z emaste $");
|
||||
|
||||
#define _ARMAG_LEN 8 /* length of ar magic string */
|
||||
#define _ARHDR_LEN 60 /* length of ar header */
|
||||
@ -440,6 +440,7 @@ ac_write_objs(struct elfcopy *ecp, int ofd)
|
||||
struct archive *a;
|
||||
struct archive_entry *entry;
|
||||
struct ar_obj *obj;
|
||||
time_t timestamp;
|
||||
int nr;
|
||||
|
||||
if ((a = archive_write_new()) == NULL)
|
||||
@ -450,7 +451,9 @@ ac_write_objs(struct elfcopy *ecp, int ofd)
|
||||
/* Write the archive symbol table, even if it's empty. */
|
||||
entry = archive_entry_new();
|
||||
archive_entry_copy_pathname(entry, "/");
|
||||
archive_entry_set_mtime(entry, time(NULL), 0);
|
||||
if (elftc_timestamp(×tamp) != 0)
|
||||
err(EXIT_FAILURE, "elftc_timestamp");
|
||||
archive_entry_set_mtime(entry, timestamp, 0);
|
||||
archive_entry_set_size(entry, (ecp->s_cnt + 1) * sizeof(uint32_t) +
|
||||
ecp->s_sn_sz);
|
||||
AC(archive_write_header(a, entry));
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include "elfcopy.h"
|
||||
|
||||
ELFTC_VCSID("$Id: ascii.c 3446 2016-05-03 01:31:17Z emaste $");
|
||||
ELFTC_VCSID("$Id: ascii.c 3487 2016-08-24 18:12:08Z emaste $");
|
||||
|
||||
static void append_data(struct section *s, const void *buf, size_t sz);
|
||||
static char hex_digit(uint8_t n);
|
||||
@ -251,7 +251,7 @@ create_elf_from_srec(struct elfcopy *ecp, int ifd)
|
||||
sec_index = 1;
|
||||
sec_addr = entry = 0;
|
||||
while (fgets(line, _LINE_BUFSZ, ifp) != NULL) {
|
||||
sz = 0; /* Silence GCC 5.3 uninitialized variable warning */
|
||||
sz = 0;
|
||||
if (line[0] == '\r' || line[0] == '\n')
|
||||
continue;
|
||||
if (line[0] == '$' && line[1] == '$') {
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include "elfcopy.h"
|
||||
|
||||
ELFTC_VCSID("$Id: pe.c 3477 2016-05-25 20:00:42Z kaiwang27 $");
|
||||
ELFTC_VCSID("$Id: pe.c 3490 2016-08-31 00:12:22Z emaste $");
|
||||
|
||||
/* Convert ELF object to Portable Executable (PE). */
|
||||
void
|
||||
@ -54,6 +54,7 @@ create_pe(struct elfcopy *ecp, int ifd, int ofd)
|
||||
PE_Buffer *pb;
|
||||
const char *name;
|
||||
size_t indx;
|
||||
time_t timestamp;
|
||||
int elferr;
|
||||
|
||||
if (ecp->otf == ETF_EFI || ecp->oem == EM_X86_64)
|
||||
@ -89,7 +90,9 @@ create_pe(struct elfcopy *ecp, int ifd, int ofd)
|
||||
pch.ch_machine = IMAGE_FILE_MACHINE_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
pch.ch_timestamp = (uint32_t) time(NULL);
|
||||
if (elftc_timestamp(×tamp) != 0)
|
||||
err(EXIT_FAILURE, "elftc_timestamp");
|
||||
pch.ch_timestamp = (uint32_t) timestamp;
|
||||
if (pe_update_coff_header(pe, &pch) < 0)
|
||||
err(EXIT_FAILURE, "pe_update_coff_header() failed");
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
#include "_elftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: elfdump.c 3474 2016-05-17 20:44:53Z emaste $");
|
||||
ELFTC_VCSID("$Id: elfdump.c 3482 2016-08-02 18:47:00Z emaste $");
|
||||
|
||||
#if defined(ELFTC_NEED_ELF_NOTE_DEFINITION)
|
||||
#include "native-elf-format.h"
|
||||
@ -332,6 +332,8 @@ static const char *ei_abis[256] = {
|
||||
"ELFOSABI_IRIX", "ELFOSABI_FREEBSD", "ELFOSABI_TRU64",
|
||||
"ELFOSABI_MODESTO", "ELFOSABI_OPENBSD",
|
||||
[17] = "ELFOSABI_CLOUDABI",
|
||||
[64] = "ELFOSABI_ARM_AEABI",
|
||||
[97] = "ELFOSABI_ARM",
|
||||
[255] = "ELFOSABI_STANDALONE"
|
||||
};
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\" out of the use of this software, even if advised of the possibility of
|
||||
.\" such damage.
|
||||
.\"
|
||||
.\" $Id: elf_flagdata.3 2884 2013-01-11 02:03:46Z jkoshy $
|
||||
.\" $Id: elf_flagdata.3 3479 2016-06-25 20:44:33Z jkoshy $
|
||||
.\"
|
||||
.Dd December 3, 2011
|
||||
.Os
|
||||
@ -208,16 +208,13 @@ was called without a program header being allocated.
|
||||
.Xr elf 3 ,
|
||||
.Xr elf32_newehdr 3 ,
|
||||
.Xr elf32_newphdr 3 ,
|
||||
.Xr elf32_newshdr 3 ,
|
||||
.Xr elf64_newehdr 3 ,
|
||||
.Xr elf64_newphdr 3 ,
|
||||
.Xr elf64_newshdr 3 ,
|
||||
.Xr elf_newdata 3 ,
|
||||
.Xr elf_update 3 ,
|
||||
.Xr gelf 3 ,
|
||||
.Xr gelf_newehdr 3 ,
|
||||
.Xr gelf_newphdr 3 ,
|
||||
.Xr gelf_newshdr 3 ,
|
||||
.Xr gelf_update_dyn 3 ,
|
||||
.Xr gelf_update_move 3 ,
|
||||
.Xr gelf_update_rel 3 ,
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile 3418 2016-02-19 20:04:42Z emaste $
|
||||
# $Id: Makefile 3489 2016-08-31 00:12:15Z emaste $
|
||||
|
||||
TOP= ${.CURDIR}/..
|
||||
|
||||
@ -10,6 +10,7 @@ SRCS= elftc_bfdtarget.c \
|
||||
elftc_reloc_type_str.c \
|
||||
elftc_set_timestamps.c \
|
||||
elftc_string_table.c \
|
||||
elftc_timestamp.c \
|
||||
elftc_version.c \
|
||||
libelftc_bfdtarget.c \
|
||||
libelftc_dem_arm.c \
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\" out of the use of this software, even if advised of the possibility of
|
||||
.\" such damage.
|
||||
.\"
|
||||
.\" $Id: elftc_bfd_find_target.3 3348 2016-01-18 14:18:50Z emaste $
|
||||
.\" $Id: elftc_bfd_find_target.3 3488 2016-08-24 18:15:57Z emaste $
|
||||
.\"
|
||||
.Dd November 30, 2011
|
||||
.Os
|
||||
|
@ -545,6 +545,9 @@ elftc_reloc_type_str(unsigned int mach, unsigned int type)
|
||||
case 43: return "R_RISCV_ALIGN";
|
||||
case 44: return "R_RISCV_RVC_BRANCH";
|
||||
case 45: return "R_RISCV_RVC_JUMP";
|
||||
case 46: return "R_RISCV_RVC_LUI";
|
||||
case 47: return "R_RISCV_GPREL_I";
|
||||
case 48: return "R_RISCV_GPREL_S";
|
||||
}
|
||||
break;
|
||||
case EM_SPARC:
|
||||
|
79
contrib/elftoolchain/libelftc/elftc_timestamp.3
Normal file
79
contrib/elftoolchain/libelftc/elftc_timestamp.3
Normal file
@ -0,0 +1,79 @@
|
||||
.\" Copyright (c) 2016 The FreeBSD Foundation. All rights reserved.
|
||||
.\"
|
||||
.\" This documentation was written by Ed Maste under sponsorship of
|
||||
.\" the FreeBSD Foundation.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.\"
|
||||
.Dd August 24, 2016
|
||||
.Os
|
||||
.Dt ELFTC_TIMESTAMP 3
|
||||
.Sh NAME
|
||||
.Nm elftc_timestamp
|
||||
.Nd return the current or environment-provided timestamp
|
||||
.Sh LIBRARY
|
||||
.Lb libelftc
|
||||
.Sh SYNOPSIS
|
||||
.In libelftc.h
|
||||
.Ft int
|
||||
.Fo elftc_timestamp
|
||||
.Fa "time_t *timestamp"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn elftc_timestamp
|
||||
function returns a timestamp supplied by the
|
||||
.Ev SOURCE_DATE_EPOCH
|
||||
environment variable, or the current time provided by
|
||||
.Xr time 3
|
||||
if the environment variable is not set.
|
||||
.Pp
|
||||
The
|
||||
.Ar timestamp
|
||||
argument specifies a pointer to the location where the timestamp will be
|
||||
stored.
|
||||
.Sh RETURN VALUE
|
||||
Function
|
||||
.Fn elftc_timestamp
|
||||
returns 0 on success, and -1 in the event of an error.
|
||||
.Sh ERRORS
|
||||
The
|
||||
.Fn elftc_timestamp
|
||||
function may fail with the following errors:
|
||||
.Bl -tag -width ".Bq Er ERANGE"
|
||||
.It Bq Er EINVAL
|
||||
.Ev SOURCE_DATE_EPOCH
|
||||
contains invalid characters.
|
||||
.It Bq Er ERANGE
|
||||
.Ev SOURCE_DATE_EPOCH
|
||||
specifies a negative value or a value that cannot be stored in a
|
||||
time_t.
|
||||
.El
|
||||
The
|
||||
.Fn elftc_timestamp
|
||||
function may also fail for any of the reasons described in
|
||||
.Xr strtoll 3 .
|
||||
.Sh SEE ALSO
|
||||
.Xr strtoll 3 ,
|
||||
.Xr time 3
|
55
contrib/elftoolchain/libelftc/elftc_timestamp.c
Normal file
55
contrib/elftoolchain/libelftc/elftc_timestamp.c
Normal file
@ -0,0 +1,55 @@
|
||||
/*-
|
||||
* Copyright (c) 2016 The FreeBSD Foundation
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by Ed Maste under sponsorship
|
||||
* of the FreeBSD Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <libelftc.h>
|
||||
|
||||
int
|
||||
elftc_timestamp(time_t *timestamp)
|
||||
{
|
||||
long long source_date_epoch;
|
||||
char *env, *eptr;
|
||||
|
||||
if ((env = getenv("SOURCE_DATE_EPOCH")) != NULL) {
|
||||
errno = 0;
|
||||
source_date_epoch = strtoll(env, &eptr, 10);
|
||||
if (*eptr != '\0')
|
||||
errno = EINVAL;
|
||||
if (source_date_epoch < 0)
|
||||
errno = ERANGE;
|
||||
if (errno != 0)
|
||||
return (-1);
|
||||
*timestamp = source_date_epoch;
|
||||
return (0);
|
||||
}
|
||||
*timestamp = time(NULL);
|
||||
return (0);
|
||||
}
|
@ -24,7 +24,7 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: users/kaiwang27/elftc/libelftc.h 392 2009-05-31 19:17:46Z kaiwang27 $
|
||||
* $Id: libelftc.h 3418 2016-02-19 20:04:42Z emaste $
|
||||
* $Id: libelftc.h 3489 2016-08-31 00:12:15Z emaste $
|
||||
*/
|
||||
|
||||
#ifndef _LIBELFTC_H_
|
||||
@ -91,6 +91,7 @@ int elftc_string_table_remove(Elftc_String_Table *_table,
|
||||
const char *_string);
|
||||
const char *elftc_string_table_to_string(Elftc_String_Table *_table,
|
||||
size_t offset);
|
||||
int elftc_timestamp(time_t *_timestamp);
|
||||
const char *elftc_version(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "_libelftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3309 2016-01-10 09:10:51Z kaiwang27 $");
|
||||
ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3488 2016-08-24 18:15:57Z emaste $");
|
||||
|
||||
struct _Elftc_Bfd_Target _libelftc_targets[] = {
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include "_libelftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3447 2016-05-03 13:32:23Z emaste $");
|
||||
ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3480 2016-07-24 23:38:41Z emaste $");
|
||||
|
||||
/**
|
||||
* @file cpp_demangle.c
|
||||
|
@ -22,7 +22,7 @@
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Id: readelf.1 3219 2015-05-24 23:42:34Z kaiwang27 $
|
||||
.\" $Id: readelf.1 3486 2016-08-22 14:10:05Z emaste $
|
||||
.\"
|
||||
.Dd September 13, 2012
|
||||
.Os
|
||||
@ -43,12 +43,12 @@
|
||||
.Op Fl p Ar section | Fl -string-dump Ns = Ns Ar section
|
||||
.Op Fl r | Fl -relocs
|
||||
.Op Fl t | Fl -section-details
|
||||
.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
|
||||
.Op Fl v | Fl -version
|
||||
.Oo
|
||||
.Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc |
|
||||
.Fl -debug-dump Ns Op Ns = Ns Ar long-option-name , Ns ...
|
||||
.Oc
|
||||
.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
|
||||
.Op Fl A | Fl -arch-specific
|
||||
.Op Fl D | Fl -use-dynamic
|
||||
.Op Fl H | Fl -help
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
#include "_elftc.h"
|
||||
|
||||
ELFTC_VCSID("$Id: readelf.c 3469 2016-05-15 23:16:09Z emaste $");
|
||||
ELFTC_VCSID("$Id: readelf.c 3484 2016-08-03 13:36:49Z emaste $");
|
||||
|
||||
/* Backwards compatability for older FreeBSD releases. */
|
||||
#ifndef STB_GNU_UNIQUE
|
||||
@ -440,6 +440,7 @@ elf_osabi(unsigned int abi)
|
||||
case ELFOSABI_OPENVMS: return "OpenVMS";
|
||||
case ELFOSABI_NSK: return "NSK";
|
||||
case ELFOSABI_CLOUDABI: return "CloudABI";
|
||||
case ELFOSABI_ARM_AEABI: return "ARM EABI";
|
||||
case ELFOSABI_ARM: return "ARM";
|
||||
case ELFOSABI_STANDALONE: return "StandAlone";
|
||||
default:
|
||||
@ -2787,6 +2788,8 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
|
||||
const char *symname;
|
||||
uint64_t symval;
|
||||
int i, len;
|
||||
uint32_t type;
|
||||
uint8_t type2, type3;
|
||||
|
||||
if (s->link >= re->shnum)
|
||||
return;
|
||||
@ -2796,8 +2799,8 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
|
||||
elftc_reloc_type_str(re->ehdr.e_machine, \
|
||||
ELF32_R_TYPE(r.r_info)), (uintmax_t)symval, symname
|
||||
#define REL_CT64 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \
|
||||
elftc_reloc_type_str(re->ehdr.e_machine, \
|
||||
ELF64_R_TYPE(r.r_info)), (uintmax_t)symval, symname
|
||||
elftc_reloc_type_str(re->ehdr.e_machine, type), \
|
||||
(uintmax_t)symval, symname
|
||||
|
||||
printf("\nRelocation section (%s):\n", s->name);
|
||||
if (re->ec == ELFCLASS32)
|
||||
@ -2823,12 +2826,37 @@ dump_rel(struct readelf *re, struct section *s, Elf_Data *d)
|
||||
ELF64_R_TYPE(r.r_info));
|
||||
printf("%8.8jx %8.8jx %-19.19s %8.8jx %s\n", REL_CT32);
|
||||
} else {
|
||||
type = ELF64_R_TYPE(r.r_info);
|
||||
if (re->ehdr.e_machine == EM_MIPS) {
|
||||
type2 = (type >> 8) & 0xFF;
|
||||
type3 = (type >> 16) & 0xFF;
|
||||
type = type & 0xFF;
|
||||
} else {
|
||||
type2 = type3 = 0;
|
||||
}
|
||||
if (re->options & RE_WW)
|
||||
printf("%16.16jx %16.16jx %-24.24s"
|
||||
" %16.16jx %s\n", REL_CT64);
|
||||
else
|
||||
printf("%12.12jx %12.12jx %-19.19s"
|
||||
" %16.16jx %s\n", REL_CT64);
|
||||
if (re->ehdr.e_machine == EM_MIPS) {
|
||||
if (re->options & RE_WW) {
|
||||
printf("%32s: %s\n", "Type2",
|
||||
elftc_reloc_type_str(EM_MIPS,
|
||||
type2));
|
||||
printf("%32s: %s\n", "Type3",
|
||||
elftc_reloc_type_str(EM_MIPS,
|
||||
type3));
|
||||
} else {
|
||||
printf("%24s: %s\n", "Type2",
|
||||
elftc_reloc_type_str(EM_MIPS,
|
||||
type2));
|
||||
printf("%24s: %s\n", "Type3",
|
||||
elftc_reloc_type_str(EM_MIPS,
|
||||
type3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2843,6 +2871,8 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
|
||||
const char *symname;
|
||||
uint64_t symval;
|
||||
int i, len;
|
||||
uint32_t type;
|
||||
uint8_t type2, type3;
|
||||
|
||||
if (s->link >= re->shnum)
|
||||
return;
|
||||
@ -2853,8 +2883,8 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
|
||||
elftc_reloc_type_str(re->ehdr.e_machine, \
|
||||
ELF32_R_TYPE(r.r_info)), (uintmax_t)symval, symname
|
||||
#define RELA_CT64 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \
|
||||
elftc_reloc_type_str(re->ehdr.e_machine, \
|
||||
ELF64_R_TYPE(r.r_info)), (uintmax_t)symval, symname
|
||||
elftc_reloc_type_str(re->ehdr.e_machine, type), \
|
||||
(uintmax_t)symval, symname
|
||||
|
||||
printf("\nRelocation section with addend (%s):\n", s->name);
|
||||
if (re->ec == ELFCLASS32)
|
||||
@ -2881,6 +2911,14 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
|
||||
printf("%8.8jx %8.8jx %-19.19s %8.8jx %s", RELA_CT32);
|
||||
printf(" + %x\n", (uint32_t) r.r_addend);
|
||||
} else {
|
||||
type = ELF64_R_TYPE(r.r_info);
|
||||
if (re->ehdr.e_machine == EM_MIPS) {
|
||||
type2 = (type >> 8) & 0xFF;
|
||||
type3 = (type >> 16) & 0xFF;
|
||||
type = type & 0xFF;
|
||||
} else {
|
||||
type2 = type3 = 0;
|
||||
}
|
||||
if (re->options & RE_WW)
|
||||
printf("%16.16jx %16.16jx %-24.24s"
|
||||
" %16.16jx %s", RELA_CT64);
|
||||
@ -2888,6 +2926,23 @@ dump_rela(struct readelf *re, struct section *s, Elf_Data *d)
|
||||
printf("%12.12jx %12.12jx %-19.19s"
|
||||
" %16.16jx %s", RELA_CT64);
|
||||
printf(" + %jx\n", (uintmax_t) r.r_addend);
|
||||
if (re->ehdr.e_machine == EM_MIPS) {
|
||||
if (re->options & RE_WW) {
|
||||
printf("%32s: %s\n", "Type2",
|
||||
elftc_reloc_type_str(EM_MIPS,
|
||||
type2));
|
||||
printf("%32s: %s\n", "Type3",
|
||||
elftc_reloc_type_str(EM_MIPS,
|
||||
type3));
|
||||
} else {
|
||||
printf("%24s: %s\n", "Type2",
|
||||
elftc_reloc_type_str(EM_MIPS,
|
||||
type2));
|
||||
printf("%24s: %s\n", "Type3",
|
||||
elftc_reloc_type_str(EM_MIPS,
|
||||
type3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
134
contrib/gcc/config/i386/cpuid.h
Normal file
134
contrib/gcc/config/i386/cpuid.h
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* In addition to the permissions in the GNU General Public License, the
|
||||
* Free Software Foundation gives you unlimited permission to link the
|
||||
* compiled version of this file with other programs, and to distribute
|
||||
* those programs without any restriction coming from the use of this
|
||||
* file. (The General Public License restrictions do apply in other
|
||||
* respects; for example, they cover modification of the file, and
|
||||
* distribution when not linked into another program.)
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* As a special exception, if you link this library with files
|
||||
* compiled with GCC to produce an executable, this does not cause
|
||||
* the resulting executable to be covered by the GNU General Public License.
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*/
|
||||
|
||||
/* %ecx */
|
||||
#define bit_SSE3 (1 << 0)
|
||||
#define bit_SSSE3 (1 << 9)
|
||||
#define bit_CMPXCHG16B (1 << 13)
|
||||
#define bit_SSE4_1 (1 << 19)
|
||||
#define bit_SSE4_2 (1 << 20)
|
||||
#define bit_POPCNT (1 << 23)
|
||||
|
||||
/* %edx */
|
||||
#define bit_CMPXCHG8B (1 << 8)
|
||||
#define bit_CMOV (1 << 15)
|
||||
#define bit_MMX (1 << 23)
|
||||
#define bit_FXSAVE (1 << 24)
|
||||
#define bit_SSE (1 << 25)
|
||||
#define bit_SSE2 (1 << 26)
|
||||
|
||||
/* Extended Features */
|
||||
/* %ecx */
|
||||
#define bit_LAHF_LM (1 << 0)
|
||||
#define bit_SSE4a (1 << 6)
|
||||
#define bit_SSE5 (1 << 11)
|
||||
|
||||
/* %edx */
|
||||
#define bit_LM (1 << 29)
|
||||
#define bit_3DNOWP (1 << 30)
|
||||
#define bit_3DNOW (1 << 31)
|
||||
|
||||
|
||||
#if defined(__i386__) && defined(__PIC__)
|
||||
/* %ebx may be the PIC register. */
|
||||
#define __cpuid(level, a, b, c, d) \
|
||||
__asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \
|
||||
"cpuid\n\t" \
|
||||
"xchg{l}\t{%%}ebx, %1\n\t" \
|
||||
: "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
|
||||
: "0" (level))
|
||||
#else
|
||||
#define __cpuid(level, a, b, c, d) \
|
||||
__asm__ ("cpuid\n\t" \
|
||||
: "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
|
||||
: "0" (level))
|
||||
#endif
|
||||
|
||||
/* Return highest supported input value for cpuid instruction. ext can
|
||||
be either 0x0 or 0x8000000 to return highest supported value for
|
||||
basic or extended cpuid information. Function returns 0 if cpuid
|
||||
is not supported or whatever cpuid returns in eax register. If sig
|
||||
pointer is non-null, then first four bytes of the signature
|
||||
(as found in ebx register) are returned in location pointed by sig. */
|
||||
|
||||
static __inline unsigned int
|
||||
__get_cpuid_max (unsigned int __ext, unsigned int *__sig)
|
||||
{
|
||||
unsigned int __eax, __ebx, __ecx, __edx;
|
||||
|
||||
#ifndef __x86_64__
|
||||
/* See if we can use cpuid. On AMD64 we always can. */
|
||||
__asm__ ("pushf{l|d}\n\t"
|
||||
"pushf{l|d}\n\t"
|
||||
"pop{l}\t%0\n\t"
|
||||
"mov{l}\t{%0, %1|%1, %0}\n\t"
|
||||
"xor{l}\t{%2, %0|%0, %2}\n\t"
|
||||
"push{l}\t%0\n\t"
|
||||
"popf{l|d}\n\t"
|
||||
"pushf{l|d}\n\t"
|
||||
"pop{l}\t%0\n\t"
|
||||
"popf{l|d}\n\t"
|
||||
: "=&r" (__eax), "=&r" (__ebx)
|
||||
: "i" (0x00200000));
|
||||
|
||||
if (!((__eax ^ __ebx) & 0x00200000))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
/* Host supports cpuid. Return highest supported cpuid input value. */
|
||||
__cpuid (__ext, __eax, __ebx, __ecx, __edx);
|
||||
|
||||
if (__sig)
|
||||
*__sig = __ebx;
|
||||
|
||||
return __eax;
|
||||
}
|
||||
|
||||
/* Return cpuid data for requested cpuid level, as found in returned
|
||||
eax, ebx, ecx and edx registers. The function checks if cpuid is
|
||||
supported and returns 1 for valid cpuid information or 0 for
|
||||
unsupported cpuid level. All pointers are required to be non-null. */
|
||||
|
||||
static __inline int
|
||||
__get_cpuid (unsigned int __level,
|
||||
unsigned int *__eax, unsigned int *__ebx,
|
||||
unsigned int *__ecx, unsigned int *__edx)
|
||||
{
|
||||
unsigned int __ext = __level & 0x80000000;
|
||||
|
||||
if (__get_cpuid_max (__ext, 0) < __level)
|
||||
return 0;
|
||||
|
||||
__cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
|
||||
return 1;
|
||||
}
|
@ -1912,6 +1912,13 @@ underscores.
|
||||
|
||||
@table @code
|
||||
|
||||
@item __COUNTER__
|
||||
This macro expands to sequential integral values starting from 0. In
|
||||
conjuction with the @code{##} operator, this provides a convenient means to
|
||||
generate unique identifiers. Care must be taken to ensure that
|
||||
@code{__COUNTER__} is not expanded prior to inclusion of precompiled headers
|
||||
which use it. Otherwise, the precompiled headers will not be used.
|
||||
|
||||
@item __GNUC__
|
||||
@itemx __GNUC_MINOR__
|
||||
@itemx __GNUC_PATCHLEVEL__
|
||||
|
@ -12,6 +12,17 @@
|
||||
PR preprocessor/14331
|
||||
* lex.c (_cpp_get_fresh_line): Don't warn if no newline at EOF.
|
||||
|
||||
2007-05-24 Ollie Wild <aaw@google.com> (r125041)
|
||||
|
||||
* macro.c (_cpp_builtin_macro_text): Handle BT_COUNTER.
|
||||
* pch.c (cpp_write_pch_deps): Save __COUNTER__ state.
|
||||
(cpp_write_pch_state): Save __COUNTER__ state.
|
||||
(cpp_valid_state): Check valid __COUNTER__ state.
|
||||
(cpp_read_state): Read new __COUNTER__ state.
|
||||
* include/cpplib.h (enum builtin_type): Add BT_COUNTER enumerator.
|
||||
* init.c (builtin_array): Add __COUNTER__/BT_COUNTER.
|
||||
* internal.h (struct cpp_reader): Add counter member.
|
||||
|
||||
2007-05-21 Ian Lance Taylor <iant@google.com> (r124929)
|
||||
|
||||
* internal.h (struct cpp_reader): Add new fields:
|
||||
|
@ -458,7 +458,8 @@ struct cpp_reader
|
||||
of precompiled headers. */
|
||||
struct cpp_savedstate *savedstate;
|
||||
|
||||
unsigned int nextcounter;
|
||||
/* Next value of __COUNTER__ macro. */
|
||||
unsigned int counter;
|
||||
};
|
||||
|
||||
/* Character classes. Based on the more primitive macros in safe-ctype.h.
|
||||
|
@ -268,7 +268,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
|
||||
if (CPP_OPTION (pfile, directives_only) && pfile->state.in_directive)
|
||||
cpp_error (pfile, CPP_DL_ERROR,
|
||||
"__COUNTER__ expanded inside directive with -fdirectives-only");
|
||||
number = pfile->nextcounter++;
|
||||
number = pfile->counter++;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -337,6 +337,14 @@ cpp_write_pch_deps (cpp_reader *r, FILE *f)
|
||||
/* Free the saved state. */
|
||||
free (ss);
|
||||
r->savedstate = NULL;
|
||||
|
||||
/* Save the next value of __COUNTER__. */
|
||||
if (fwrite (&r->counter, sizeof (r->counter), 1, f) != 1)
|
||||
{
|
||||
cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -361,6 +369,15 @@ cpp_write_pch_state (cpp_reader *r, FILE *f)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Save the next __COUNTER__ value. When we include a precompiled header,
|
||||
we need to start at the offset we would have if the header had been
|
||||
included normally. */
|
||||
if (fwrite (&r->counter, sizeof (r->counter), 1, f) != 1)
|
||||
{
|
||||
cpp_errno (r, CPP_DL_ERROR, "while writing precompiled header");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -423,6 +440,7 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
|
||||
struct ht_node_list nl = { 0, 0, 0 };
|
||||
unsigned char *first, *last;
|
||||
unsigned int i;
|
||||
unsigned int counter;
|
||||
|
||||
/* Read in the list of identifiers that must be defined
|
||||
Check that they are defined in the same way. */
|
||||
@ -524,7 +542,23 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
|
||||
}
|
||||
|
||||
free(nl.defs);
|
||||
nl.defs = NULL;
|
||||
free (undeftab);
|
||||
undeftab = NULL;
|
||||
|
||||
/* Read in the next value of __COUNTER__.
|
||||
Check that (a) __COUNTER__ was not used in the pch or (b) __COUNTER__
|
||||
has not been used in this translation unit. */
|
||||
if (read (fd, &counter, sizeof (counter)) != sizeof (counter))
|
||||
goto error;
|
||||
if (counter && r->counter)
|
||||
{
|
||||
if (CPP_OPTION (r, warn_invalid_pch))
|
||||
cpp_error (r, CPP_DL_WARNING_SYSHDR,
|
||||
"%s: not used because `__COUNTER__' is invalid",
|
||||
name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* We win! */
|
||||
return 0;
|
||||
@ -631,6 +665,7 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
|
||||
{
|
||||
size_t i;
|
||||
struct lexer_state old_state;
|
||||
unsigned int counter;
|
||||
|
||||
/* Restore spec_nodes, which will be full of references to the old
|
||||
hashtable entries and so will now be invalid. */
|
||||
@ -690,6 +725,12 @@ cpp_read_state (cpp_reader *r, const char *name, FILE *f,
|
||||
if (! _cpp_read_file_entries (r, f))
|
||||
goto error;
|
||||
|
||||
if (fread (&counter, sizeof (counter), 1, f) != 1)
|
||||
goto error;
|
||||
|
||||
if (!r->counter)
|
||||
r->counter = counter;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
|
@ -164,7 +164,7 @@ genkeys(char *public, char *secret)
|
||||
MINT *pk = mp_itom(0);
|
||||
MINT *sk = mp_itom(0);
|
||||
MINT *tmp;
|
||||
MINT *base = mp_itom(BASE);
|
||||
MINT *base = mp_itom((short)BASE);
|
||||
MINT *root = mp_itom(PROOT);
|
||||
MINT *modulus = mp_xtom(HEXMODULUS);
|
||||
short r;
|
||||
|
@ -112,7 +112,7 @@ static int send_tncmd(void (*)(int, int), const char *, char *);
|
||||
static int setmod(int);
|
||||
static int clearmode(int);
|
||||
static int modehelp(void);
|
||||
static int sourceroute(struct addrinfo *, char *, char **, int *, int *, int *);
|
||||
static int sourceroute(struct addrinfo *, char *, unsigned char **, int *, int *, int *);
|
||||
|
||||
typedef struct {
|
||||
const char *name; /* command name */
|
||||
@ -2171,7 +2171,7 @@ switch_af(struct addrinfo **aip)
|
||||
int
|
||||
tn(int argc, char *argv[])
|
||||
{
|
||||
char *srp = 0;
|
||||
unsigned char *srp = 0;
|
||||
int proto, opt;
|
||||
int srlen;
|
||||
int srcroute = 0, result;
|
||||
@ -2844,10 +2844,10 @@ cmdrc(char *m1, char *m2)
|
||||
* setsockopt, as socket protocol family.
|
||||
*/
|
||||
static int
|
||||
sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int *protop, int *optp)
|
||||
sourceroute(struct addrinfo *ai, char *arg, unsigned char **cpp, int *lenp, int *protop, int *optp)
|
||||
{
|
||||
static char buf[1024 + ALIGNBYTES]; /*XXX*/
|
||||
char *cp, *cp2, *lsrp, *ep;
|
||||
unsigned char *cp, *cp2, *lsrp, *ep;
|
||||
struct sockaddr_in *_sin;
|
||||
#ifdef INET6
|
||||
struct sockaddr_in6 *sin6;
|
||||
|
@ -2050,7 +2050,7 @@ abort_squared(int dummy)
|
||||
void
|
||||
abort_remote(FILE *din)
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
unsigned char buf[BUFSIZ];
|
||||
int nfnd;
|
||||
|
||||
if (cout == NULL) {
|
||||
|
@ -98,6 +98,7 @@
|
||||
#include "ssh-gss.h"
|
||||
#endif
|
||||
#include "monitor_wrap.h"
|
||||
#include "blacklist_client.h"
|
||||
|
||||
extern ServerOptions options;
|
||||
extern Buffer loginmsg;
|
||||
@ -794,6 +795,7 @@ sshpam_query(void *ctx, char **name, char **info,
|
||||
free(msg);
|
||||
return (0);
|
||||
}
|
||||
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
|
||||
error("PAM: %s for %s%.100s from %.100s", msg,
|
||||
sshpam_authctxt->valid ? "" : "illegal user ",
|
||||
sshpam_authctxt->user,
|
||||
|
@ -75,6 +75,7 @@ __RCSID("$FreeBSD$");
|
||||
#include "authfile.h"
|
||||
#include "ssherr.h"
|
||||
#include "compat.h"
|
||||
#include "blacklist_client.h"
|
||||
|
||||
/* import */
|
||||
extern ServerOptions options;
|
||||
@ -292,8 +293,11 @@ auth_log(Authctxt *authctxt, int authenticated, int partial,
|
||||
authmsg = "Postponed";
|
||||
else if (partial)
|
||||
authmsg = "Partial";
|
||||
else
|
||||
else {
|
||||
authmsg = authenticated ? "Accepted" : "Failed";
|
||||
BLACKLIST_NOTIFY(authenticated ?
|
||||
BLACKLIST_AUTH_OK : BLACKLIST_AUTH_FAIL);
|
||||
}
|
||||
|
||||
authlog("%s %s%s%s for %s%.100s from %.200s port %d %s%s%s",
|
||||
authmsg,
|
||||
@ -640,6 +644,7 @@ getpwnamallow(const char *user)
|
||||
}
|
||||
#endif
|
||||
if (pw == NULL) {
|
||||
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
|
||||
logit("Invalid user %.100s from %.100s",
|
||||
user, get_remote_ipaddr());
|
||||
#ifdef CUSTOM_FAILED_LOGIN
|
||||
|
@ -43,6 +43,7 @@
|
||||
#endif
|
||||
#include "monitor_wrap.h"
|
||||
#include "buffer.h"
|
||||
#include "blacklist_client.h"
|
||||
|
||||
/* import */
|
||||
extern ServerOptions options;
|
||||
@ -337,6 +338,7 @@ do_authloop(Authctxt *authctxt)
|
||||
char *msg;
|
||||
size_t len;
|
||||
|
||||
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
|
||||
error("Access denied for user %s by PAM account "
|
||||
"configuration", authctxt->user);
|
||||
len = buffer_len(&loginmsg);
|
||||
@ -404,6 +406,7 @@ do_authentication(Authctxt *authctxt)
|
||||
else {
|
||||
debug("do_authentication: invalid user %s", user);
|
||||
authctxt->pw = fakepw();
|
||||
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
|
||||
}
|
||||
|
||||
/* Configuration may have changed as a result of Match */
|
||||
|
@ -52,6 +52,7 @@ __RCSID("$FreeBSD$");
|
||||
#include "pathnames.h"
|
||||
#include "buffer.h"
|
||||
#include "canohost.h"
|
||||
#include "blacklist_client.h"
|
||||
|
||||
#ifdef GSSAPI
|
||||
#include "ssh-gss.h"
|
||||
@ -248,6 +249,7 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt)
|
||||
} else {
|
||||
logit("input_userauth_request: invalid user %s", user);
|
||||
authctxt->pw = fakepw();
|
||||
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
|
||||
#ifdef SSH_AUDIT_EVENTS
|
||||
PRIVSEP(audit_event(SSH_INVALID_USER));
|
||||
#endif
|
||||
|
97
crypto/openssh/blacklist.c
Normal file
97
crypto/openssh/blacklist.c
Normal file
@ -0,0 +1,97 @@
|
||||
/*-
|
||||
* Copyright (c) 2015 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 2016 The FreeBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions of this software were developed by Kurt Lidl
|
||||
* under sponsorship from the FreeBSD Foundation.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 "includes.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ssh.h"
|
||||
#include "packet.h"
|
||||
#include "log.h"
|
||||
#include "misc.h"
|
||||
#include "servconf.h"
|
||||
#include "blacklist_client.h"
|
||||
#include <blacklist.h>
|
||||
|
||||
static struct blacklist *blstate = NULL;
|
||||
|
||||
/* import */
|
||||
extern ServerOptions options;
|
||||
|
||||
/* internal definition from bl.h */
|
||||
struct blacklist *bl_create(bool, char *, void (*)(int, const char *, va_list));
|
||||
|
||||
/* impedence match vsyslog() to sshd's internal logging levels */
|
||||
void
|
||||
im_log(int priority, const char *message, va_list args)
|
||||
{
|
||||
LogLevel imlevel;
|
||||
|
||||
switch (priority) {
|
||||
case LOG_ERR:
|
||||
imlevel = SYSLOG_LEVEL_ERROR;
|
||||
break;
|
||||
case LOG_DEBUG:
|
||||
imlevel = SYSLOG_LEVEL_DEBUG1;
|
||||
break;
|
||||
case LOG_INFO:
|
||||
imlevel = SYSLOG_LEVEL_INFO;
|
||||
break;
|
||||
default:
|
||||
imlevel = SYSLOG_LEVEL_DEBUG2;
|
||||
}
|
||||
do_log(imlevel, message, args);
|
||||
}
|
||||
|
||||
void
|
||||
blacklist_init(void)
|
||||
{
|
||||
|
||||
if (options.use_blacklist)
|
||||
blstate = bl_create(false, NULL, im_log);
|
||||
}
|
||||
|
||||
void
|
||||
blacklist_notify(int action)
|
||||
{
|
||||
|
||||
if (blstate != NULL && packet_connection_is_on_socket())
|
||||
(void)blacklist_r(blstate, action,
|
||||
packet_get_connection_in(), "ssh");
|
||||
}
|
57
crypto/openssh/blacklist_client.h
Normal file
57
crypto/openssh/blacklist_client.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*-
|
||||
* Copyright (c) 2015 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 2016 The FreeBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Portions of this software were developed by Kurt Lidl
|
||||
* under sponsorship from the FreeBSD Foundation.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
|
||||
#ifndef BLACKLIST_CLIENT_H
|
||||
#define BLACKLIST_CLIENT_H
|
||||
|
||||
enum {
|
||||
BLACKLIST_AUTH_OK = 0,
|
||||
BLACKLIST_AUTH_FAIL
|
||||
};
|
||||
|
||||
#ifdef USE_BLACKLIST
|
||||
void blacklist_init(void);
|
||||
void blacklist_notify(int);
|
||||
|
||||
#define BLACKLIST_INIT() blacklist_init()
|
||||
#define BLACKLIST_NOTIFY(x) blacklist_notify(x)
|
||||
|
||||
#else
|
||||
|
||||
#define BLACKLIST_INIT()
|
||||
#define BLACKLIST_NOTIFY(x)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* BLACKLIST_CLIENT_H */
|
@ -86,6 +86,7 @@ __RCSID("$FreeBSD$");
|
||||
#include "packet.h"
|
||||
#include "ssherr.h"
|
||||
#include "sshbuf.h"
|
||||
#include "blacklist_client.h"
|
||||
|
||||
#ifdef PACKET_DEBUG
|
||||
#define DBG(x) x
|
||||
@ -2071,6 +2072,7 @@ sshpkt_fatal(struct ssh *ssh, const char *tag, int r)
|
||||
case SSH_ERR_NO_KEX_ALG_MATCH:
|
||||
case SSH_ERR_NO_HOSTKEY_ALG_MATCH:
|
||||
if (ssh && ssh->kex && ssh->kex->failed_choice) {
|
||||
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
|
||||
fatal("Unable to negotiate with %.200s port %d: %s. "
|
||||
"Their offer: %s", ssh_remote_ipaddr(ssh),
|
||||
ssh_remote_port(ssh), ssh_err(r),
|
||||
|
@ -172,6 +172,7 @@ initialize_server_options(ServerOptions *options)
|
||||
options->ip_qos_bulk = -1;
|
||||
options->version_addendum = NULL;
|
||||
options->fingerprint_hash = -1;
|
||||
options->use_blacklist = -1;
|
||||
}
|
||||
|
||||
/* Returns 1 if a string option is unset or set to "none" or 0 otherwise. */
|
||||
@ -360,6 +361,8 @@ fill_default_server_options(ServerOptions *options)
|
||||
options->fwd_opts.streamlocal_bind_unlink = 0;
|
||||
if (options->fingerprint_hash == -1)
|
||||
options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
|
||||
if (options->use_blacklist == -1)
|
||||
options->use_blacklist = 0;
|
||||
|
||||
assemble_algorithms(options);
|
||||
|
||||
@ -437,6 +440,7 @@ typedef enum {
|
||||
sAuthenticationMethods, sHostKeyAgent, sPermitUserRC,
|
||||
sStreamLocalBindMask, sStreamLocalBindUnlink,
|
||||
sAllowStreamLocalForwarding, sFingerprintHash,
|
||||
sUseBlacklist,
|
||||
sDeprecated, sUnsupported
|
||||
} ServerOpCodes;
|
||||
|
||||
@ -579,6 +583,7 @@ static struct {
|
||||
{ "streamlocalbindunlink", sStreamLocalBindUnlink, SSHCFG_ALL },
|
||||
{ "allowstreamlocalforwarding", sAllowStreamLocalForwarding, SSHCFG_ALL },
|
||||
{ "fingerprinthash", sFingerprintHash, SSHCFG_GLOBAL },
|
||||
{ "useblacklist", sUseBlacklist, SSHCFG_GLOBAL },
|
||||
{ "noneenabled", sUnsupported, SSHCFG_ALL },
|
||||
{ "hpndisabled", sDeprecated, SSHCFG_ALL },
|
||||
{ "hpnbuffersize", sDeprecated, SSHCFG_ALL },
|
||||
@ -1861,6 +1866,10 @@ process_server_config_line(ServerOptions *options, char *line,
|
||||
options->fingerprint_hash = value;
|
||||
break;
|
||||
|
||||
case sUseBlacklist:
|
||||
intptr = &options->use_blacklist;
|
||||
goto parse_flag;
|
||||
|
||||
case sDeprecated:
|
||||
logit("%s line %d: Deprecated option %s",
|
||||
filename, linenum, arg);
|
||||
@ -2304,6 +2313,7 @@ dump_config(ServerOptions *o)
|
||||
dump_cfg_fmtint(sAllowStreamLocalForwarding, o->allow_streamlocal_forwarding);
|
||||
dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep);
|
||||
dump_cfg_fmtint(sFingerprintHash, o->fingerprint_hash);
|
||||
dump_cfg_fmtint(sUseBlacklist, o->use_blacklist);
|
||||
|
||||
/* string arguments */
|
||||
dump_cfg_string(sPidFile, o->pid_file);
|
||||
|
@ -195,6 +195,7 @@ typedef struct {
|
||||
char *auth_methods[MAX_AUTH_METHODS];
|
||||
|
||||
int fingerprint_hash;
|
||||
int use_blacklist;
|
||||
} ServerOptions;
|
||||
|
||||
/* Information about the incoming connection as used by Match */
|
||||
|
@ -135,6 +135,7 @@ __RCSID("$FreeBSD$");
|
||||
#include "ssh-sandbox.h"
|
||||
#include "version.h"
|
||||
#include "ssherr.h"
|
||||
#include "blacklist_client.h"
|
||||
|
||||
#ifdef LIBWRAP
|
||||
#include <tcpd.h>
|
||||
@ -388,6 +389,8 @@ grace_alarm_handler(int sig)
|
||||
kill(0, SIGTERM);
|
||||
}
|
||||
|
||||
BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL);
|
||||
|
||||
/* Log error and exit. */
|
||||
sigdie("Timeout before authentication for %s", get_remote_ipaddr());
|
||||
}
|
||||
@ -2251,6 +2254,8 @@ main(int ac, char **av)
|
||||
buffer_init(&loginmsg);
|
||||
auth_debug_reset();
|
||||
|
||||
BLACKLIST_INIT();
|
||||
|
||||
if (use_privsep) {
|
||||
if (privsep_preauth(authctxt) == 1)
|
||||
goto authenticated;
|
||||
|
@ -120,6 +120,7 @@
|
||||
#MaxStartups 10:30:100
|
||||
#PermitTunnel no
|
||||
#ChrootDirectory none
|
||||
#UseBlacklist no
|
||||
#VersionAddendum FreeBSD-20160310
|
||||
|
||||
# no default banner path
|
||||
|
@ -1537,6 +1537,15 @@ for authentication using
|
||||
.Cm TrustedUserCAKeys .
|
||||
For more details on certificates, see the CERTIFICATES section in
|
||||
.Xr ssh-keygen 1 .
|
||||
.It Cm UseBlacklist
|
||||
Specifies whether
|
||||
.Xr sshd 8
|
||||
attempts to send authentication success and failure messages
|
||||
to the
|
||||
.Xr blacklistd 8
|
||||
daemon.
|
||||
The default is
|
||||
.Dq no .
|
||||
.It Cm UseDNS
|
||||
Specifies whether
|
||||
.Xr sshd 8
|
||||
|
@ -95,6 +95,10 @@ CXXFLAGS+= -std=c++11
|
||||
.endif
|
||||
CXXFLAGS+= -fno-rtti
|
||||
STATIC_CXXFLAGS+= -fvisibility=hidden -fPIC
|
||||
.if ${MK_DIRDEPS_BUILD} == "yes"
|
||||
# Avoid dependency on lib/libc++
|
||||
CFLAGS+= -I${SRCTOP}/contrib/libc++/include
|
||||
.endif
|
||||
|
||||
.else # MK_LLVM_LIBUNWIND
|
||||
|
||||
|
@ -28,6 +28,18 @@
|
||||
.include <src.opts.mk>
|
||||
.include <bsd.init.mk>
|
||||
|
||||
# Store the toolchain executable in ATF_BUILD_{CC,CPP,CXX} to ensure other
|
||||
# values -- like -target, -B ..., etc -- don't get leaked into the tests.
|
||||
#
|
||||
# Be sure to omit ${CCACHE_BIN} (if specified) from the variable as it gets
|
||||
# automatically appended to the variables in bsd.compiler.mk when
|
||||
# ${MK_CCACHE_BUILD} != no.
|
||||
ATF_BUILD_CC:= ${CC:N${CCACHE_BIN}:[1]}
|
||||
ATF_BUILD_CPP:= ${CPP:N${CCACHE_BIN}:[1]}
|
||||
ATF_BUILD_CXX:= ${CXX:N${CCACHE_BIN}:[1]}
|
||||
|
||||
# Only capture defines, includes, linker flags, optimization levels, warnings
|
||||
# and preprocessor flags when building ATF_BUILD_{C,CPP,CXX}FLAGS.
|
||||
ATF_BUILD_CFLAGS:= ${CFLAGS:M-[DILOWf]*}
|
||||
ATF_BUILD_CPPFLAGS:= ${CPPFLAGS:M-[DILOWf]*}
|
||||
ATF_BUILD_CXXFLAGS:= ${CXXFLAGS:M-[DILOWf]*}
|
||||
@ -41,11 +53,11 @@ ATF= ${SRCTOP}/contrib/atf
|
||||
.PATH: ${ATF}/atf-c
|
||||
.PATH: ${ATF}/atf-c/detail
|
||||
|
||||
CFLAGS+= -DATF_BUILD_CC='"${CC}"'
|
||||
CFLAGS+= -DATF_BUILD_CC='"${ATF_BUILD_CC}"'
|
||||
CFLAGS+= -DATF_BUILD_CFLAGS='"${ATF_BUILD_CFLAGS}"'
|
||||
CFLAGS+= -DATF_BUILD_CPP='"${CPP}"'
|
||||
CFLAGS+= -DATF_BUILD_CPP='"${ATF_BUILD_CPP}"'
|
||||
CFLAGS+= -DATF_BUILD_CPPFLAGS='"${ATF_BUILD_CPPFLAGS}"'
|
||||
CFLAGS+= -DATF_BUILD_CXX='"${CXX}"'
|
||||
CFLAGS+= -DATF_BUILD_CXX='"${ATF_BUILD_CXX}"'
|
||||
CFLAGS+= -DATF_BUILD_CXXFLAGS='"${ATF_BUILD_CXXFLAGS}"'
|
||||
CFLAGS+= -I${ATF}
|
||||
CFLAGS+= -I${.CURDIR}
|
||||
|
@ -6,6 +6,7 @@ DIRDEPS = \
|
||||
include/xlocale \
|
||||
lib/libc++ \
|
||||
lib/msun \
|
||||
usr.bin/clang/clang-tblgen.host \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
@ -6,6 +6,7 @@ DIRDEPS = \
|
||||
include/xlocale \
|
||||
lib/libc++ \
|
||||
lib/msun \
|
||||
usr.bin/clang/clang-tblgen.host \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" @(#)directory.3 8.1 (Berkeley) 6/4/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd February 19, 2016
|
||||
.Dd August 31, 2016
|
||||
.Dt DIRECTORY 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -68,6 +68,15 @@
|
||||
.Ft int
|
||||
.Fn dirfd "DIR *dirp"
|
||||
.Sh DESCRIPTION
|
||||
.Bf -symbolic
|
||||
The
|
||||
.Fn readdir_r
|
||||
interface is deprecated
|
||||
because it cannot be used correctly unless
|
||||
.Brq Va NAME_MAX
|
||||
is a fixed value.
|
||||
.Ef
|
||||
.Pp
|
||||
The
|
||||
.Fn opendir
|
||||
function
|
||||
@ -122,7 +131,13 @@ The
|
||||
.Fn readdir
|
||||
function
|
||||
returns a pointer to the next directory entry.
|
||||
It returns
|
||||
The directory entry remains valid until the next call to
|
||||
.Fn readdir
|
||||
or
|
||||
.Fn closedir
|
||||
on the same
|
||||
.Em directory stream .
|
||||
The function returns
|
||||
.Dv NULL
|
||||
upon reaching the end of the directory or on error.
|
||||
In the event of an error,
|
||||
@ -139,6 +154,13 @@ provides the same functionality as
|
||||
but the caller must provide a directory
|
||||
.Fa entry
|
||||
buffer to store the results in.
|
||||
The buffer must be large enough for a
|
||||
.Vt struct dirent
|
||||
with a
|
||||
.Va d_name
|
||||
array with
|
||||
.Brq Va NAME_MAX
|
||||
+ 1 elements.
|
||||
If the read succeeds,
|
||||
.Fa result
|
||||
is pointed at the
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" @(#)kvm_getvfsbyname.3 8.3 (Berkeley) 5/4/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 5, 2007
|
||||
.Dd August 30, 2016
|
||||
.Dt GETVFSBYNAME 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -97,11 +97,6 @@ sysctl is set to
|
||||
.Sh ERRORS
|
||||
The following errors may be reported:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EFAULT
|
||||
The
|
||||
.Fa vfc
|
||||
argument
|
||||
points to an invalid address.
|
||||
.It Bq Er ENOENT
|
||||
The
|
||||
.Fa name
|
||||
|
@ -949,7 +949,7 @@ matchlen(struct sockaddr *src, struct sockaddr *dst)
|
||||
|
||||
while (s < lim)
|
||||
if ((r = (*d++ ^ *s++)) != 0) {
|
||||
while (r < addrlen * 8) {
|
||||
while ((r & 0x80) == 0) {
|
||||
match++;
|
||||
r <<= 1;
|
||||
}
|
||||
|
@ -185,6 +185,7 @@ struct hp_order {
|
||||
#define aio_sa aio_un.aiou_sa
|
||||
int aio_matchlen;
|
||||
char *aio_h_addr;
|
||||
int aio_initial_sequence;
|
||||
};
|
||||
|
||||
static struct hostent *_hpcopy(struct hostent *, int *);
|
||||
@ -711,6 +712,7 @@ _hpreorder(struct hostent *hp)
|
||||
aio[i].aio_dstscope = gai_addr2scopetype(sa);
|
||||
aio[i].aio_dstpolicy = match_addrselectpolicy(sa, &policyhead);
|
||||
set_source(&aio[i], &policyhead);
|
||||
aio[i].aio_initial_sequence = i;
|
||||
}
|
||||
|
||||
/* perform sorting. */
|
||||
@ -928,7 +930,7 @@ matchlen(struct sockaddr *src, struct sockaddr *dst)
|
||||
|
||||
while (s < lim)
|
||||
if ((r = (*d++ ^ *s++)) != 0) {
|
||||
while (r < addrlen * 8) {
|
||||
while ((r & 0x80) == 0) {
|
||||
match++;
|
||||
r <<= 1;
|
||||
}
|
||||
@ -1045,6 +1047,23 @@ comp_dst(const void *arg1, const void *arg2)
|
||||
}
|
||||
|
||||
/* Rule 10: Otherwise, leave the order unchanged. */
|
||||
|
||||
/*
|
||||
* Note that qsort is unstable; so, we can't return zero and
|
||||
* expect the order to be unchanged.
|
||||
* That also means we can't depend on the current position of
|
||||
* dst2 being after dst1. We must enforce the initial order
|
||||
* with an explicit compare on the original position.
|
||||
* The qsort specification requires that "When the same objects
|
||||
* (consisting of width bytes, irrespective of their current
|
||||
* positions in the array) are passed more than once to the
|
||||
* comparison function, the results shall be consistent with one
|
||||
* another."
|
||||
* In other words, If A < B, then we must also return B > A.
|
||||
*/
|
||||
if (dst2->aio_initial_sequence < dst1->aio_initial_sequence)
|
||||
return(1);
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,10 @@ DIRDEPS = \
|
||||
lib/atf/libatf-c++ \
|
||||
lib/libc \
|
||||
lib/libc++ \
|
||||
lib/libthr \
|
||||
lib/libcompiler_rt \
|
||||
lib/libcxxrt \
|
||||
lib/libnetbsd \
|
||||
lib/libthr \
|
||||
lib/libutil \
|
||||
lib/msun \
|
||||
|
||||
|
@ -16,6 +16,7 @@ SRCS= elftc_bfdtarget.c \
|
||||
elftc_reloc_type_str.c \
|
||||
elftc_set_timestamps.c \
|
||||
elftc_string_table.c \
|
||||
elftc_timestamp.c \
|
||||
elftc_version.c \
|
||||
libelftc_bfdtarget.c \
|
||||
libelftc_dem_arm.c \
|
||||
|
@ -6,5 +6,5 @@
|
||||
const char *
|
||||
elftc_version(void)
|
||||
{
|
||||
return "elftoolchain r3477M";
|
||||
return "elftoolchain r3490M";
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ DIRDEPS = \
|
||||
lib/libcompiler_rt \
|
||||
lib/libcxxrt \
|
||||
lib/libelf \
|
||||
lib/libprocstat \
|
||||
lib/librtld_db \
|
||||
lib/libutil \
|
||||
|
||||
|
@ -13,7 +13,9 @@ DIRDEPS = \
|
||||
lib/libcompiler_rt \
|
||||
lib/libcxxrt \
|
||||
lib/libelf \
|
||||
lib/libkvm \
|
||||
lib/libproc \
|
||||
lib/libprocstat \
|
||||
lib/librtld_db \
|
||||
lib/libutil \
|
||||
lib/libz \
|
||||
|
@ -10,6 +10,7 @@ DIRDEPS = \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libelf \
|
||||
lib/libprocstat \
|
||||
lib/libutil \
|
||||
|
||||
|
||||
|
@ -411,6 +411,10 @@ vend_rfc1048(cp, len)
|
||||
bcopy(cp, &dhcp_serverip.s_addr,
|
||||
sizeof(dhcp_serverip.s_addr));
|
||||
}
|
||||
if (tag == TAG_TFTP_SERVER) {
|
||||
bcopy(cp, &tftpip.s_addr,
|
||||
sizeof(tftpip.s_addr));
|
||||
}
|
||||
#endif
|
||||
cp += size;
|
||||
}
|
||||
|
@ -106,6 +106,7 @@ struct bootp {
|
||||
#define TAG_T2 ((unsigned char) 59)
|
||||
#define TAG_CLASSID ((unsigned char) 60)
|
||||
#define TAG_CLIENTID ((unsigned char) 61)
|
||||
#define TAG_TFTP_SERVER ((unsigned char) 150)
|
||||
#endif
|
||||
|
||||
#define TAG_END ((unsigned char) 255)
|
||||
|
@ -25,12 +25,14 @@ char hostname[FNAME_SIZE]; /* our hostname */
|
||||
int hostnamelen;
|
||||
char domainname[FNAME_SIZE]; /* our DNS domain */
|
||||
int domainnamelen;
|
||||
int netproto = NET_NONE; /* Network prototol */
|
||||
char ifname[IFNAME_SIZE]; /* name of interface (e.g. "le0") */
|
||||
struct in_addr myip; /* my ip address */
|
||||
struct in_addr nameip; /* DNS server ip address */
|
||||
struct in_addr rootip; /* root ip address */
|
||||
struct in_addr swapip; /* swap ip address */
|
||||
struct in_addr gateip; /* gateway ip address */
|
||||
struct in_addr tftpip; /* TFTP ip address */
|
||||
n_long netmask = 0xffffff00; /* subnet or net mask */
|
||||
u_int intf_mtu; /* interface mtu from bootp/dhcp */
|
||||
int errno; /* our old friend */
|
||||
|
@ -36,6 +36,8 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _STAND_NET_H
|
||||
#define _STAND_NET_H
|
||||
#ifndef _KERNEL /* XXX - see <netinet/in.h> */
|
||||
#undef __IPADDR
|
||||
#define __IPADDR(x) htonl((u_int32_t)(x))
|
||||
@ -45,6 +47,12 @@
|
||||
|
||||
#define BA { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }
|
||||
|
||||
enum net_proto {
|
||||
NET_NONE,
|
||||
NET_NFS,
|
||||
NET_TFTP
|
||||
};
|
||||
|
||||
/* Returns true if n_long's on the same net */
|
||||
#define SAMENET(a1, a2, m) ((a1.s_addr & m) == (a2.s_addr & m))
|
||||
|
||||
@ -74,6 +82,7 @@ extern char hostname[FNAME_SIZE];
|
||||
extern int hostnamelen;
|
||||
extern char domainname[FNAME_SIZE];
|
||||
extern int domainnamelen;
|
||||
extern int netproto;
|
||||
extern char ifname[IFNAME_SIZE];
|
||||
|
||||
/* All of these are in network order. */
|
||||
@ -82,6 +91,7 @@ extern struct in_addr rootip;
|
||||
extern struct in_addr swapip;
|
||||
extern struct in_addr gateip;
|
||||
extern struct in_addr nameip;
|
||||
extern struct in_addr tftpip;
|
||||
extern n_long netmask;
|
||||
extern u_int intf_mtu;
|
||||
|
||||
@ -120,3 +130,4 @@ n_long inet_addr(char *);
|
||||
|
||||
/* Machine-dependent functions: */
|
||||
time_t getsecs(void);
|
||||
#endif
|
||||
|
@ -458,6 +458,9 @@ nfs_open(const char *upath, struct open_file *f)
|
||||
int error;
|
||||
char *path;
|
||||
|
||||
if (netproto != NET_NFS)
|
||||
return (EINVAL);
|
||||
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath);
|
||||
@ -1100,6 +1103,9 @@ nfs_open(const char *upath, struct open_file *f)
|
||||
int error;
|
||||
char *path;
|
||||
|
||||
if (netproto != NET_NFS)
|
||||
return (EINVAL);
|
||||
|
||||
#ifdef NFS_DEBUG
|
||||
if (debug)
|
||||
printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath);
|
||||
|
@ -200,7 +200,7 @@ recvtftp(struct tftp_handle *h, void *pkt, ssize_t len, time_t tleft,
|
||||
case DATA: {
|
||||
int got;
|
||||
|
||||
if (htons(t->th_block) != d->xid) {
|
||||
if (htons(t->th_block) != (u_short) d->xid) {
|
||||
/*
|
||||
* Expected block?
|
||||
*/
|
||||
@ -402,6 +402,9 @@ tftp_open(const char *path, struct open_file *f)
|
||||
size_t pathsize;
|
||||
const char *extraslash;
|
||||
|
||||
if (netproto != NET_TFTP)
|
||||
return (EINVAL);
|
||||
|
||||
if (strcmp(f->f_dev->dv_name, "net") != 0) {
|
||||
#ifdef __i386__
|
||||
if (strcmp(f->f_dev->dv_name, "pxe") != 0)
|
||||
@ -560,7 +563,7 @@ tftp_stat(struct open_file *f, struct stat *sb)
|
||||
sb->st_nlink = 1;
|
||||
sb->st_uid = 0;
|
||||
sb->st_gid = 0;
|
||||
sb->st_size = -1;
|
||||
sb->st_size = (off_t) tftpfile->tftp_tsize;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -731,6 +734,8 @@ tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len)
|
||||
} else if (strcasecmp(tftp_options[i], "tsize") == 0) {
|
||||
if (i + 1 < option_idx)
|
||||
tsize = strtol(tftp_options[i + 1], (char **)NULL, 10);
|
||||
if (tsize != 0)
|
||||
h->tftp_tsize = tsize;
|
||||
} else {
|
||||
/* Do not allow any options we did not expect to be ACKed. */
|
||||
printf("unexpected tftp option '%s'\n", tftp_options[i]);
|
||||
|
18
libexec/rtld-elf/tests/libpythagoras/Makefile.depend
Normal file
18
libexec/rtld-elf/tests/libpythagoras/Makefile.depend
Normal file
@ -0,0 +1,18 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/msun \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
18
libexec/rtld-elf/tests/target/Makefile.depend
Normal file
18
libexec/rtld-elf/tests/target/Makefile.depend
Normal file
@ -0,0 +1,18 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
libexec/rtld-elf/tests/libpythagoras \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -313,15 +313,8 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op)
|
||||
bpb.bpbHiddenSecs = o.hidden_sectors;
|
||||
if (!(o.floppy || (o.drive_heads && o.sectors_per_track &&
|
||||
o.bytes_per_sector && o.size && o.hidden_sectors_set))) {
|
||||
off_t delta;
|
||||
getdiskinfo(fd, fname, dtype, o.hidden_sectors_set, &bpb);
|
||||
bpb.bpbHugeSectors -= (o.offset / bpb.bpbBytesPerSec);
|
||||
delta = bpb.bpbHugeSectors % bpb.bpbSecPerTrack;
|
||||
if (delta != 0) {
|
||||
warnx("trim %d sectors to adjust to a multiple of %d",
|
||||
(int)delta, bpb.bpbSecPerTrack);
|
||||
bpb.bpbHugeSectors -= delta;
|
||||
}
|
||||
if (bpb.bpbSecPerClust == 0) { /* set defaults */
|
||||
if (bpb.bpbHugeSectors <= 6000) /* about 3MB -> 512 bytes */
|
||||
bpb.bpbSecPerClust = 1;
|
||||
@ -563,7 +556,7 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op)
|
||||
bpb.bpbMedia = !bpb.bpbHiddenSecs ? 0xf0 : 0xf8;
|
||||
if (fat == 32)
|
||||
bpb.bpbRootClust = RESFTE;
|
||||
if (bpb.bpbHiddenSecs + bpb.bpbHugeSectors <= MAXU16) {
|
||||
if (bpb.bpbHugeSectors <= MAXU16) {
|
||||
bpb.bpbSectors = bpb.bpbHugeSectors;
|
||||
bpb.bpbHugeSectors = 0;
|
||||
}
|
||||
|
@ -9,8 +9,6 @@ DIRDEPS = \
|
||||
include/gssapi \
|
||||
include/rpc \
|
||||
include/xlocale \
|
||||
kerberos5/lib/libasn1 \
|
||||
kerberos5/lib/libkrb5 \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
@ -40,6 +40,13 @@ CFLAGS+= -DUSE_BSM_AUDIT -DHAVE_GETAUDIT_ADDR
|
||||
LIBADD+= bsm
|
||||
.endif
|
||||
|
||||
.if ${MK_BLACKLIST_SUPPORT} != "no"
|
||||
CFLAGS+= -DUSE_BLACKLIST -I${SRCTOP}/contrib/blacklist/include
|
||||
SRCS+= blacklist.c
|
||||
LIBADD+= blacklist
|
||||
LDFLAGS+=-L${LIBBLACKLISTDIR}
|
||||
.endif
|
||||
|
||||
.if ${MK_KERBEROS_SUPPORT} != "no"
|
||||
CFLAGS+= -include krb5_config.h
|
||||
SRCS+= krb5_config.h
|
||||
|
@ -17,6 +17,7 @@ DIRDEPS = \
|
||||
kerberos5/lib/libroken \
|
||||
kerberos5/lib/libwind \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libblacklist \
|
||||
lib/libbsm \
|
||||
lib/libc \
|
||||
lib/libcom_err \
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd February 29, 2016
|
||||
.Dd August 30, 2016
|
||||
.Dt MBUF 9
|
||||
.Os
|
||||
.\"
|
||||
@ -255,7 +255,7 @@ The available external buffer types are defined as follows:
|
||||
#define EXT_JUMBO9 4 /* jumbo cluster 9216 bytes */
|
||||
#define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */
|
||||
#define EXT_PACKET 6 /* mbuf+cluster from packet zone */
|
||||
#define EXT_MBUF 7 /* external mbuf reference (M_IOVEC) */
|
||||
#define EXT_MBUF 7 /* external mbuf reference */
|
||||
#define EXT_NET_DRV 252 /* custom ext_buf provided by net driver(s) */
|
||||
#define EXT_MOD_TYPE 253 /* custom module's ext_buf type */
|
||||
#define EXT_DISPOSABLE 254 /* can throw this buffer away w/page flipping */
|
||||
|
@ -82,9 +82,9 @@ _meta_filemon= 1
|
||||
# since it will track dependencies itself. OBJS_DEPEND_GUESS is still used.
|
||||
.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
|
||||
${.TARGETS:M*install*} == ${.TARGETS} || \
|
||||
make(analyze) || defined(_meta_filemon)
|
||||
make(analyze) || defined(_meta_filemon) || make(print-dir)
|
||||
_SKIP_READ_DEPEND= 1
|
||||
.if ${MK_DIRDEPS_BUILD} == "no"
|
||||
.if ${MK_DIRDEPS_BUILD} == "no" || make(analyze) || make(print-dir)
|
||||
.MAKE.DEPENDFILE= /dev/null
|
||||
.endif
|
||||
.endif
|
||||
@ -198,7 +198,7 @@ CFLAGS+= ${DEPEND_CFLAGS}
|
||||
.endif # !defined(_meta_filemon)
|
||||
.endif # defined(SRCS)
|
||||
|
||||
.if ${MK_DIRDEPS_BUILD} == "yes"
|
||||
.if ${MK_DIRDEPS_BUILD} == "yes" && !make(analyze) && !make(print-dir)
|
||||
# Prevent meta.autodep.mk from tracking "local dependencies".
|
||||
.depend:
|
||||
.include <meta.autodep.mk>
|
||||
|
@ -31,7 +31,7 @@ _SKIP_BUILD = not building at level 0
|
||||
.if ${MK_META_MODE} == "yes"
|
||||
.if !exists(/dev/filemon) && \
|
||||
${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_FILEMON) && \
|
||||
!make(showconfig) && ${.MAKEFLAGS:M-V} == ""
|
||||
!make(showconfig) && !make(print-dir) && ${.MAKEFLAGS:M-V} == ""
|
||||
.warning The filemon module (/dev/filemon) is not loaded.
|
||||
.warning META_MODE is less useful for incremental builds without filemon.
|
||||
.warning 'kldload filemon' or pass -DNO_FILEMON to suppress this warning.
|
||||
|
@ -51,6 +51,30 @@ CANONICALOBJDIR= ${.OBJDIR}
|
||||
# but this makefile does not want it!
|
||||
.OBJDIR: ${.CURDIR}
|
||||
.endif
|
||||
# Handle special case where SRCS is full-pathed and requires
|
||||
# nested objdirs. This duplicates some auto.obj.mk logic.
|
||||
.if (!empty(SRCS:M*/*) || !empty(DPSRCS:M*/*)) && \
|
||||
(${.TARGETS} == "" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} != "")
|
||||
_wantdirs= ${SRCS:M*/*:H} ${DPSRCS:M*/*:H}
|
||||
.if !empty(_wantdirs)
|
||||
_wantdirs:= ${_wantdirs:O:u}
|
||||
_needdirs=
|
||||
.for _dir in ${_wantdirs}
|
||||
.if !exists(${.OBJDIR}/${_dir}/)
|
||||
_needdirs+= ${_dir}
|
||||
.endif
|
||||
.endfor
|
||||
.endif
|
||||
.if !empty(_needdirs)
|
||||
#_mkneededdirs!= umask ${OBJDIR_UMASK:U002}; ${Mkdirs} ${_needdirs}
|
||||
__objdir_made != umask ${OBJDIR_UMASK:U002}; ${Mkdirs}; \
|
||||
for dir in ${_needdirs}; do \
|
||||
dir=${.OBJDIR}/$${dir}; \
|
||||
${ECHO_TRACE} "[Creating nested objdir $${dir}...]" >&2; \
|
||||
Mkdirs $${dir}; \
|
||||
done
|
||||
.endif
|
||||
.endif # !empty(SRCS:M*/*) || !empty(DPSRCS:M*/*)
|
||||
.elif defined(MAKEOBJDIRPREFIX)
|
||||
CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
|
||||
.elif defined(MAKEOBJDIR) && ${MAKEOBJDIR:M/*} != ""
|
||||
|
@ -42,15 +42,15 @@ SUBDIR_TARGETS+= \
|
||||
all all-man analyze buildconfig buildfiles buildincludes \
|
||||
checkdpadd clean cleandepend cleandir cleanilinks \
|
||||
cleanobj depend distribute files includes installconfig \
|
||||
installfiles installincludes realinstall lint maninstall \
|
||||
manlint obj objlink tags \
|
||||
installfiles installincludes print-dir realinstall lint \
|
||||
maninstall manlint obj objlink tags \
|
||||
|
||||
# Described above.
|
||||
STANDALONE_SUBDIR_TARGETS+= \
|
||||
all-man buildconfig buildfiles buildincludes check checkdpadd \
|
||||
clean cleandepend cleandir cleanilinks cleanobj files includes \
|
||||
installconfig installincludes installfiles maninstall manlint \
|
||||
obj objlink \
|
||||
installconfig installincludes installfiles print-dir \
|
||||
maninstall manlint obj objlink
|
||||
|
||||
# It is safe to install in parallel when staging.
|
||||
.if defined(NO_ROOT)
|
||||
@ -59,6 +59,16 @@ STANDALONE_SUBDIR_TARGETS+= realinstall
|
||||
|
||||
.include <bsd.init.mk>
|
||||
|
||||
.if make(print-dir)
|
||||
NEED_SUBDIR= 1
|
||||
ECHODIR= :
|
||||
.SILENT:
|
||||
.if ${RELDIR:U.} != "."
|
||||
print-dir: .PHONY
|
||||
@echo ${RELDIR}
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if !defined(NEED_SUBDIR)
|
||||
.if ${.MAKE.LEVEL} == 0 && ${MK_DIRDEPS_BUILD} == "yes" && !empty(SUBDIR) && !(make(clean*) || make(destroy*))
|
||||
.include <meta.subdir.mk>
|
||||
|
@ -214,7 +214,8 @@ CSU_DIR := ${CSU_DIR.${MACHINE_ARCH}}
|
||||
.if !empty(TIME_STAMP)
|
||||
TRACER= ${TIME_STAMP} ${:U}
|
||||
.endif
|
||||
.if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH)
|
||||
.if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH) && \
|
||||
!make(print-dir)
|
||||
WITH_META_STATS= t
|
||||
.endif
|
||||
|
||||
|
@ -97,7 +97,7 @@ META_MODE?= normal
|
||||
# This needs to be done early - before .PATH is computed
|
||||
# Don't do this for 'make showconfig' as it enables all options where meta mode
|
||||
# is not expected.
|
||||
.if !make(showconfig)
|
||||
.if !make(showconfig) && !make(print-dir)
|
||||
.sinclude <auto.obj.mk>
|
||||
.endif
|
||||
.endif
|
||||
|
@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/gpio.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/ofw_bus_subr.h>
|
||||
@ -53,25 +54,89 @@ __FBSDID("$FreeBSD$");
|
||||
#include "phy_if.h"
|
||||
|
||||
#define USBPHY_NPHYS 4
|
||||
#define USBPHY_NRES USBPHY_NPHYS
|
||||
|
||||
enum awusbphy_type {
|
||||
AWUSBPHY_TYPE_A10 = 1,
|
||||
AWUSBPHY_TYPE_A13,
|
||||
AWUSBPHY_TYPE_A20,
|
||||
AWUSBPHY_TYPE_A31,
|
||||
AWUSBPHY_TYPE_A83T,
|
||||
AWUSBPHY_TYPE_H3,
|
||||
AWUSBPHY_TYPE_A64
|
||||
};
|
||||
|
||||
static struct ofw_compat_data compat_data[] = {
|
||||
{ "allwinner,sun4i-a10-usb-phy", 1 },
|
||||
{ "allwinner,sun5i-a13-usb-phy", 1 },
|
||||
{ "allwinner,sun6i-a31-usb-phy", 1 },
|
||||
{ "allwinner,sun7i-a20-usb-phy", 1 },
|
||||
{ "allwinner,sun8i-a83t-usb-phy", 1 },
|
||||
{ "allwinner,sun8i-h3-usb-phy", 1 },
|
||||
{ "allwinner,sun4i-a10-usb-phy", AWUSBPHY_TYPE_A10 },
|
||||
{ "allwinner,sun5i-a13-usb-phy", AWUSBPHY_TYPE_A13 },
|
||||
{ "allwinner,sun6i-a31-usb-phy", AWUSBPHY_TYPE_A31 },
|
||||
{ "allwinner,sun7i-a20-usb-phy", AWUSBPHY_TYPE_A20 },
|
||||
{ "allwinner,sun8i-a83t-usb-phy", AWUSBPHY_TYPE_A83T },
|
||||
{ "allwinner,sun8i-h3-usb-phy", AWUSBPHY_TYPE_H3 },
|
||||
{ "allwinner,sun50i-a64-usb-phy", AWUSBPHY_TYPE_A64 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
struct awusbphy_softc {
|
||||
struct resource * res[USBPHY_NRES];
|
||||
regulator_t reg[USBPHY_NPHYS];
|
||||
gpio_pin_t id_det_pin;
|
||||
int id_det_valid;
|
||||
gpio_pin_t vbus_det_pin;
|
||||
int vbus_det_valid;
|
||||
enum awusbphy_type phy_type;
|
||||
};
|
||||
|
||||
static struct resource_spec awusbphy_spec[] = {
|
||||
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
|
||||
{ SYS_RES_MEMORY, 1, RF_ACTIVE },
|
||||
{ SYS_RES_MEMORY, 2, RF_ACTIVE | RF_OPTIONAL },
|
||||
{ SYS_RES_MEMORY, 3, RF_ACTIVE | RF_OPTIONAL },
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
#define RD4(sc, i, o) bus_read_4((sc)->res[(i)], (o))
|
||||
#define WR4(sc, i, o, v) bus_write_4((sc)->res[(i)], (o), (v))
|
||||
#define CLR4(sc, i, o, m) WR4(sc, i, o, RD4(sc, i, o) & ~(m))
|
||||
#define SET4(sc, i, o, m) WR4(sc, i, o, RD4(sc, i, o) | (m))
|
||||
|
||||
#define OTG_PHY_CFG 0x20
|
||||
#define OTG_PHY_ROUTE_OTG (1 << 0)
|
||||
#define PMU_IRQ_ENABLE 0x00
|
||||
#define PMU_AHB_INCR8 (1 << 10)
|
||||
#define PMU_AHB_INCR4 (1 << 9)
|
||||
#define PMU_AHB_INCRX_ALIGN (1 << 8)
|
||||
#define PMU_ULPI_BYPASS (1 << 0)
|
||||
#define PMU_UNK_H3 0x10
|
||||
#define PMU_UNK_H3_CLR 0x2
|
||||
|
||||
static void
|
||||
awusbphy_configure(device_t dev, int phyno)
|
||||
{
|
||||
struct awusbphy_softc *sc;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
if (sc->res[phyno] == NULL)
|
||||
return;
|
||||
|
||||
if (sc->phy_type == AWUSBPHY_TYPE_A64) {
|
||||
CLR4(sc, phyno, PMU_UNK_H3, PMU_UNK_H3_CLR);
|
||||
|
||||
/* EHCI0 and OTG share a PHY */
|
||||
if (phyno == 0)
|
||||
SET4(sc, 0, OTG_PHY_CFG, OTG_PHY_ROUTE_OTG);
|
||||
else if (phyno == 1)
|
||||
CLR4(sc, 0, OTG_PHY_CFG, OTG_PHY_ROUTE_OTG);
|
||||
}
|
||||
|
||||
if (phyno > 0) {
|
||||
/* Enable passby */
|
||||
SET4(sc, phyno, PMU_IRQ_ENABLE, PMU_ULPI_BYPASS |
|
||||
PMU_AHB_INCR8 | PMU_AHB_INCR4 | PMU_AHB_INCRX_ALIGN);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
awusbphy_init(device_t dev)
|
||||
{
|
||||
@ -86,6 +151,8 @@ awusbphy_init(device_t dev)
|
||||
sc = device_get_softc(dev);
|
||||
node = ofw_bus_get_node(dev);
|
||||
|
||||
sc->phy_type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
|
||||
|
||||
/* Enable clocks */
|
||||
for (off = 0; clk_get_by_ofw_index(dev, 0, off, &clk) == 0; off++) {
|
||||
error = clk_enable(clk);
|
||||
@ -123,6 +190,10 @@ awusbphy_init(device_t dev)
|
||||
if (error == 0)
|
||||
sc->vbus_det_valid = 1;
|
||||
|
||||
/* Allocate resources */
|
||||
if (bus_alloc_resources(dev, awusbphy_spec, sc->res) != 0)
|
||||
device_printf(dev, "couldn't allocate resources\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -159,6 +230,9 @@ awusbphy_phy_enable(device_t dev, intptr_t phy, bool enable)
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
/* Configure PHY */
|
||||
awusbphy_configure(dev, phy);
|
||||
|
||||
/* Regulators are optional. If not found, return success. */
|
||||
reg = sc->reg[phy];
|
||||
if (reg == NULL)
|
||||
|
@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/watchdog.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
@ -54,6 +55,7 @@ __FBSDID("$FreeBSD$");
|
||||
#define A10_WDOG_CTRL 0x00
|
||||
#define A31_WDOG_CTRL 0x10
|
||||
#define WDOG_CTRL_RESTART (1 << 0)
|
||||
#define A31_WDOG_CTRL_KEY (0xa57 << 1)
|
||||
#define A10_WDOG_MODE 0x04
|
||||
#define A31_WDOG_MODE 0x18
|
||||
#define A10_WDOG_MODE_INTVL_SHIFT 3
|
||||
@ -92,6 +94,7 @@ struct aw_wdog_softc {
|
||||
struct resource * res;
|
||||
struct mtx mtx;
|
||||
uint8_t wdog_ctrl;
|
||||
uint32_t wdog_ctrl_key;
|
||||
uint8_t wdog_mode;
|
||||
uint8_t wdog_mode_intvl_shift;
|
||||
uint8_t wdog_mode_en;
|
||||
@ -108,7 +111,8 @@ static struct ofw_compat_data compat_data[] = {
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
static void aw_wdog_watchdog_fn(void *private, u_int cmd, int *error);
|
||||
static void aw_wdog_watchdog_fn(void *, u_int, int *);
|
||||
static void aw_wdog_shutdown_fn(void *, int);
|
||||
|
||||
static int
|
||||
aw_wdog_probe(device_t dev)
|
||||
@ -160,6 +164,7 @@ aw_wdog_attach(device_t dev)
|
||||
break;
|
||||
case A31_WATCHDOG:
|
||||
sc->wdog_ctrl = A31_WDOG_CTRL;
|
||||
sc->wdog_ctrl_key = A31_WDOG_CTRL_KEY;
|
||||
sc->wdog_mode = A31_WDOG_MODE;
|
||||
sc->wdog_mode_intvl_shift = A31_WDOG_MODE_INTVL_SHIFT;
|
||||
sc->wdog_mode_en = WDOG_MODE_EN;
|
||||
@ -173,6 +178,9 @@ aw_wdog_attach(device_t dev)
|
||||
|
||||
mtx_init(&sc->mtx, "AW Watchdog", "aw_wdog", MTX_DEF);
|
||||
EVENTHANDLER_REGISTER(watchdog_list, aw_wdog_watchdog_fn, sc, 0);
|
||||
EVENTHANDLER_REGISTER(shutdown_final, aw_wdog_shutdown_fn, sc,
|
||||
SHUTDOWN_PRI_LAST - 1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -198,7 +206,8 @@ aw_wdog_watchdog_fn(void *private, u_int cmd, int *error)
|
||||
WRITE(sc, sc->wdog_mode,
|
||||
(wd_intervals[i].value << sc->wdog_mode_intvl_shift) |
|
||||
sc->wdog_mode_en);
|
||||
WRITE(sc, sc->wdog_ctrl, WDOG_CTRL_RESTART);
|
||||
WRITE(sc, sc->wdog_ctrl,
|
||||
WDOG_CTRL_RESTART | sc->wdog_ctrl_key);
|
||||
if (sc->wdog_config)
|
||||
WRITE(sc, sc->wdog_config,
|
||||
sc->wdog_config_value);
|
||||
@ -222,6 +231,13 @@ aw_wdog_watchdog_fn(void *private, u_int cmd, int *error)
|
||||
mtx_unlock(&sc->mtx);
|
||||
}
|
||||
|
||||
static void
|
||||
aw_wdog_shutdown_fn(void *private, int howto)
|
||||
{
|
||||
if ((howto & (RB_POWEROFF|RB_HALT)) == 0)
|
||||
aw_wdog_watchdog_reset();
|
||||
}
|
||||
|
||||
void
|
||||
aw_wdog_watchdog_reset()
|
||||
{
|
||||
@ -237,6 +253,8 @@ aw_wdog_watchdog_reset()
|
||||
if (aw_wdog_sc->wdog_config)
|
||||
WRITE(aw_wdog_sc, aw_wdog_sc->wdog_config,
|
||||
aw_wdog_sc->wdog_config_value);
|
||||
WRITE(aw_wdog_sc, aw_wdog_sc->wdog_ctrl,
|
||||
WDOG_CTRL_RESTART | aw_wdog_sc->wdog_ctrl_key);
|
||||
while(1)
|
||||
;
|
||||
|
||||
|
@ -364,8 +364,6 @@ ENTRY(xscalec3_setttb)
|
||||
|
||||
#ifdef CACHE_CLEAN_BLOCK_INTR
|
||||
msr cpsr_fsxc, r3
|
||||
#else
|
||||
str r2, [r3]
|
||||
#endif
|
||||
RET
|
||||
END(xscalec3_setttb)
|
||||
|
@ -195,6 +195,16 @@ Lunmapped:
|
||||
ldr r2, =(KERNVIRTADDR)
|
||||
mov r3, #64
|
||||
bl build_pagetables
|
||||
#if defined(PHYSADDR) && (KERNVIRTADDR != KERNBASE)
|
||||
/*
|
||||
* If the kernel wasn't loaded at the beginning of the ram, map the memory
|
||||
* before the kernel too, as some ports use that for pagetables, stack, etc...
|
||||
*/
|
||||
ldr r1, =PHYSADDR
|
||||
ldr r2, =KERNBASE
|
||||
ldr r3, =((KERNVIRTADDR - KERNBASE) / L1_S_SIZE)
|
||||
bl build_pagetables
|
||||
#endif
|
||||
|
||||
/* Create a device mapping for early_printf if specified. */
|
||||
#if defined(SOCDEV_PA) && defined(SOCDEV_VA)
|
||||
|
@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include "am335x_scm.h"
|
||||
|
||||
#define CM_PER 0
|
||||
#define CM_PER_L4LS_CLKSTCTRL (CM_PER + 0x000)
|
||||
#define CM_PER_L3S_CLKSTCTRL (CM_PER + 0x004)
|
||||
@ -619,10 +621,9 @@ am335x_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq)
|
||||
{
|
||||
uint32_t ctrl_status;
|
||||
|
||||
/* Read the input clock freq from the control module */
|
||||
/* control_status reg (0x40) */
|
||||
if (ti_scm_reg_read_4(0x40, &ctrl_status))
|
||||
return ENXIO;
|
||||
/* Read the input clock freq from the control module. */
|
||||
if (ti_scm_reg_read_4(SCM_CTRL_STATUS, &ctrl_status))
|
||||
return (ENXIO);
|
||||
|
||||
switch ((ctrl_status>>22) & 0x3) {
|
||||
case 0x0:
|
||||
|
169
sys/arm/ti/am335x/am335x_scm.c
Normal file
169
sys/arm/ti/am335x/am335x_scm.c
Normal file
@ -0,0 +1,169 @@
|
||||
/*-
|
||||
* Copyright (c) 2016 Rubicon Communications, LLC (Netgate)
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <arm/ti/am335x/am335x_scm.h>
|
||||
#include <arm/ti/ti_cpuid.h>
|
||||
#include <arm/ti/ti_scm.h>
|
||||
|
||||
#define TZ_ZEROC 2731
|
||||
|
||||
struct am335x_scm_softc {
|
||||
int sc_last_temp;
|
||||
struct sysctl_oid *sc_temp_oid;
|
||||
};
|
||||
|
||||
static int
|
||||
am335x_scm_temp_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
device_t dev;
|
||||
int i, temp;
|
||||
struct am335x_scm_softc *sc;
|
||||
uint32_t reg;
|
||||
|
||||
dev = (device_t)arg1;
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
/* Read the temperature and convert to Kelvin. */
|
||||
for(i = 50; i > 0; i--) {
|
||||
ti_scm_reg_read_4(SCM_BGAP_CTRL, ®);
|
||||
if ((reg & SCM_BGAP_EOCZ) == 0)
|
||||
break;
|
||||
DELAY(50);
|
||||
}
|
||||
if ((reg & SCM_BGAP_EOCZ) == 0) {
|
||||
sc->sc_last_temp =
|
||||
(reg >> SCM_BGAP_TEMP_SHIFT) & SCM_BGAP_TEMP_MASK;
|
||||
sc->sc_last_temp *= 10;
|
||||
}
|
||||
temp = sc->sc_last_temp + TZ_ZEROC;
|
||||
|
||||
return (sysctl_handle_int(oidp, &temp, 0, req));
|
||||
}
|
||||
|
||||
static void
|
||||
am335x_scm_identify(driver_t *driver, device_t parent)
|
||||
{
|
||||
device_t child;
|
||||
|
||||
/* AM335x only. */
|
||||
if (ti_chip() != CHIP_AM335X)
|
||||
return;
|
||||
|
||||
/* Make sure we attach only once. */
|
||||
if (device_find_child(parent, "am335x_scm", -1) != NULL)
|
||||
return;
|
||||
|
||||
child = device_add_child(parent, "am335x_scm", -1);
|
||||
if (child == NULL)
|
||||
device_printf(parent, "cannot add ti_scm child\n");
|
||||
}
|
||||
|
||||
static int
|
||||
am335x_scm_probe(device_t dev)
|
||||
{
|
||||
|
||||
device_set_desc(dev, "AM335x Control Module Extension");
|
||||
|
||||
return (BUS_PROBE_DEFAULT);
|
||||
}
|
||||
|
||||
static int
|
||||
am335x_scm_attach(device_t dev)
|
||||
{
|
||||
struct am335x_scm_softc *sc;
|
||||
struct sysctl_ctx_list *ctx;
|
||||
struct sysctl_oid_list *tree;
|
||||
uint32_t reg;
|
||||
|
||||
/* Set ADC to continous mode, clear output reset. */
|
||||
reg = SCM_BGAP_CLRZ | SCM_BGAP_CONTCONV;
|
||||
ti_scm_reg_write_4(SCM_BGAP_CTRL, reg);
|
||||
/* Flush write. */
|
||||
ti_scm_reg_read_4(SCM_BGAP_CTRL, ®);
|
||||
/* Start the ADC conversion. */
|
||||
reg = SCM_BGAP_CLRZ | SCM_BGAP_CONTCONV | SCM_BGAP_SOC;
|
||||
ti_scm_reg_write_4(SCM_BGAP_CTRL, reg);
|
||||
|
||||
/* Temperature sysctl. */
|
||||
sc = device_get_softc(dev);
|
||||
ctx = device_get_sysctl_ctx(dev);
|
||||
tree = SYSCTL_CHILDREN(device_get_sysctl_tree(dev));
|
||||
sc->sc_temp_oid = SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
|
||||
"temperature", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
|
||||
dev, 0, am335x_scm_temp_sysctl, "IK", "Current temperature");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
am335x_scm_detach(device_t dev)
|
||||
{
|
||||
struct am335x_scm_softc *sc;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
/* Remove temperature sysctl. */
|
||||
if (sc->sc_temp_oid != NULL)
|
||||
sysctl_remove_oid(sc->sc_temp_oid, 1, 0);
|
||||
|
||||
/* Stop the bandgap ADC. */
|
||||
ti_scm_reg_write_4(SCM_BGAP_CTRL, SCM_BGAP_BGOFF);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static device_method_t am335x_scm_methods[] = {
|
||||
DEVMETHOD(device_identify, am335x_scm_identify),
|
||||
DEVMETHOD(device_probe, am335x_scm_probe),
|
||||
DEVMETHOD(device_attach, am335x_scm_attach),
|
||||
DEVMETHOD(device_detach, am335x_scm_detach),
|
||||
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t am335x_scm_driver = {
|
||||
"am335x_scm",
|
||||
am335x_scm_methods,
|
||||
sizeof(struct am335x_scm_softc),
|
||||
};
|
||||
|
||||
static devclass_t am335x_scm_devclass;
|
||||
|
||||
DRIVER_MODULE(am335x_scm, ti_scm, am335x_scm_driver, am335x_scm_devclass, 0, 0);
|
||||
MODULE_VERSION(am335x_scm, 1);
|
||||
MODULE_DEPEND(am335x_scm, ti_scm, 1, 1, 1);
|
@ -29,6 +29,15 @@
|
||||
#define __AM335X_SCM_H__
|
||||
|
||||
/* AM335x-specific registers for control module (scm) */
|
||||
#define SCM_CTRL_STATUS 0x40
|
||||
#define SCM_BGAP_CTRL 0x448
|
||||
#define SCM_BGAP_TEMP_MASK 0xff
|
||||
#define SCM_BGAP_TEMP_SHIFT 8
|
||||
#define SCM_BGAP_BGOFF (1 << 6)
|
||||
#define SCM_BGAP_SOC (1 << 4)
|
||||
#define SCM_BGAP_CLRZ (1 << 3)
|
||||
#define SCM_BGAP_CONTCONV (1 << 2)
|
||||
#define SCM_BGAP_EOCZ (1 << 1)
|
||||
#define SCM_USB_CTRL0 0x620
|
||||
#define SCM_USB_STS0 0x624
|
||||
#define SCM_USB_CTRL1 0x628
|
||||
|
@ -13,6 +13,7 @@ arm/ti/am335x/am335x_pwmss.c standard
|
||||
arm/ti/am335x/am335x_ehrpwm.c standard
|
||||
arm/ti/am335x/am335x_ecap.c standard
|
||||
arm/ti/am335x/am335x_rtc.c optional am335x_rtc
|
||||
arm/ti/am335x/am335x_scm.c standard
|
||||
arm/ti/am335x/am335x_scm_padconf.c standard
|
||||
arm/ti/am335x/am335x_usbss.c optional musb fdt
|
||||
arm/ti/am335x/am335x_musb.c optional musb fdt
|
||||
|
@ -1019,14 +1019,14 @@ cpswp_attach(device_t dev)
|
||||
IFQ_SET_READY(&ifp->if_snd);
|
||||
|
||||
/* Get high part of MAC address from control module (mac_id[0|1]_hi) */
|
||||
ti_scm_reg_read_4(0x634 + sc->unit * 8, ®);
|
||||
ti_scm_reg_read_4(CPSW_MAC_ID0_HI + sc->unit * 8, ®);
|
||||
mac_addr[0] = reg & 0xFF;
|
||||
mac_addr[1] = (reg >> 8) & 0xFF;
|
||||
mac_addr[2] = (reg >> 16) & 0xFF;
|
||||
mac_addr[3] = (reg >> 24) & 0xFF;
|
||||
|
||||
/* Get low part of MAC address from control module (mac_id[0|1]_lo) */
|
||||
ti_scm_reg_read_4(0x630 + sc->unit * 8, ®);
|
||||
ti_scm_reg_read_4(CPSW_MAC_ID0_LO + sc->unit * 8, ®);
|
||||
mac_addr[4] = reg & 0xFF;
|
||||
mac_addr[5] = (reg >> 8) & 0xFF;
|
||||
|
||||
|
@ -46,6 +46,9 @@
|
||||
#define CPSW_PORT_P_SA_LO(p) (CPSW_PORT_OFFSET + 0x120 + ((p-1) * 0x100))
|
||||
#define CPSW_PORT_P_SA_HI(p) (CPSW_PORT_OFFSET + 0x124 + ((p-1) * 0x100))
|
||||
|
||||
#define CPSW_MAC_ID0_LO 0x0630
|
||||
#define CPSW_MAC_ID0_HI 0x0634
|
||||
|
||||
#define CPSW_CPDMA_OFFSET 0x0800
|
||||
#define CPSW_CPDMA_TX_CONTROL (CPSW_CPDMA_OFFSET + 0x04)
|
||||
#define CPSW_CPDMA_TX_TEARDOWN (CPSW_CPDMA_OFFSET + 0x08)
|
||||
|
@ -131,7 +131,10 @@ ti_scm_attach(device_t dev)
|
||||
|
||||
ti_scm_sc = sc;
|
||||
|
||||
return (0);
|
||||
/* Attach platform extensions, if any. */
|
||||
bus_generic_probe(dev);
|
||||
|
||||
return (bus_generic_attach(dev));
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -286,7 +286,7 @@ initarm(struct arm_boot_params *abp)
|
||||
cpu_setup();
|
||||
|
||||
i80321_calibrate_delay();
|
||||
i81342_sdram_bounds(obio_bs_tag, IOP34X_VADDR, &memstart, &memsize);
|
||||
i81342_sdram_bounds(arm_base_bs_tag, IOP34X_VADDR, &memstart, &memsize);
|
||||
physmem = memsize / PAGE_SIZE;
|
||||
cninit();
|
||||
/* Set stack for exception handlers */
|
||||
|
@ -56,8 +56,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <arm/xscale/i8134x/i81342reg.h>
|
||||
#include <arm/xscale/i8134x/obiovar.h>
|
||||
|
||||
bus_space_tag_t obio_bs_tag;
|
||||
|
||||
static int
|
||||
obio_probe(device_t dev)
|
||||
{
|
||||
@ -69,8 +67,7 @@ obio_attach(device_t dev)
|
||||
{
|
||||
struct obio_softc *sc = device_get_softc(dev);
|
||||
|
||||
obio_bs_tag = arm_base_bs_tag;
|
||||
sc->oba_st = obio_bs_tag;
|
||||
sc->oba_st = arm_base_bs_tag;
|
||||
sc->oba_rman.rm_type = RMAN_ARRAY;
|
||||
sc->oba_rman.rm_descr = "OBIO I/O";
|
||||
if (rman_init(&sc->oba_rman) != 0 ||
|
||||
|
@ -50,6 +50,5 @@ struct obio_softc {
|
||||
struct rman oba_irq_rman;
|
||||
|
||||
};
|
||||
extern bus_space_tag_t obio_bs_tag;
|
||||
|
||||
#endif /* _IQ80321_OBIOVAR_H_ */
|
||||
|
@ -54,14 +54,14 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
||||
|
||||
di->ops = uart_getops(&uart_ns8250_class);
|
||||
di->bas.chan = 0;
|
||||
di->bas.bst = obio_bs_tag;
|
||||
di->bas.bst = arm_base_bs_tag;
|
||||
di->bas.regshft = 2;
|
||||
di->bas.rclk = 33334000;
|
||||
di->baudrate = 115200;
|
||||
di->databits = 8;
|
||||
di->stopbits = 1;
|
||||
di->parity = UART_PARITY_NONE;
|
||||
uart_bus_space_io = obio_bs_tag;
|
||||
uart_bus_space_io = arm_base_bs_tag;
|
||||
uart_bus_space_mem = NULL;
|
||||
di->bas.bsh = IOP34X_UART0_VADDR;
|
||||
return (0);
|
||||
|
@ -2936,14 +2936,17 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
|
||||
PTE_SYNC(l3);
|
||||
pmap_invalidate_page(pmap, va);
|
||||
|
||||
if ((pmap != pmap_kernel()) && (pmap == &curproc->p_vmspace->vm_pmap))
|
||||
cpu_icache_sync_range(va, PAGE_SIZE);
|
||||
if (pmap != pmap_kernel()) {
|
||||
if (pmap == &curproc->p_vmspace->vm_pmap)
|
||||
cpu_icache_sync_range(va, PAGE_SIZE);
|
||||
|
||||
if ((mpte == NULL || mpte->wire_count == NL3PG) &&
|
||||
pmap_superpages_enabled() && (m->flags & PG_FICTITIOUS) == 0 &&
|
||||
vm_reserv_level_iffullpop(m) == 0) {
|
||||
KASSERT(lvl == 2, ("Invalid pde level %d", lvl));
|
||||
pmap_promote_l2(pmap, pde, va, &lock);
|
||||
if ((mpte == NULL || mpte->wire_count == NL3PG) &&
|
||||
pmap_superpages_enabled() &&
|
||||
(m->flags & PG_FICTITIOUS) == 0 &&
|
||||
vm_reserv_level_iffullpop(m) == 0) {
|
||||
KASSERT(lvl == 2, ("Invalid pde level %d", lvl));
|
||||
pmap_promote_l2(pmap, pde, va, &lock);
|
||||
}
|
||||
}
|
||||
|
||||
if (lock != NULL)
|
||||
|
@ -285,6 +285,7 @@ do_el1h_sync(struct trapframe *frame)
|
||||
print_registers(frame);
|
||||
printf(" esr: %.8lx\n", esr);
|
||||
panic("VFP exception in the kernel");
|
||||
case EXCP_INSN_ABORT:
|
||||
case EXCP_DATA_ABORT:
|
||||
far = READ_SPECIALREG(far_el1);
|
||||
intr_enable();
|
||||
|
@ -167,13 +167,14 @@ net_open(struct open_file *f, ...)
|
||||
setenv("boot.netif.ip", inet_ntoa(myip), 1);
|
||||
setenv("boot.netif.netmask", intoa(netmask), 1);
|
||||
setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
|
||||
#ifdef LOADER_TFTP_SUPPORT
|
||||
setenv("boot.tftproot.server", inet_ntoa(rootip), 1);
|
||||
setenv("boot.tftproot.path", rootpath, 1);
|
||||
#else
|
||||
setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
|
||||
setenv("boot.nfsroot.path", rootpath, 1);
|
||||
#endif
|
||||
setenv("boot.netif.server", inet_ntoa(rootip), 1);
|
||||
if (netproto == NET_TFTP) {
|
||||
setenv("boot.tftproot.server", inet_ntoa(rootip), 1);
|
||||
setenv("boot.tftproot.path", rootpath, 1);
|
||||
} else if (netproto == NET_NFS) {
|
||||
setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
|
||||
setenv("boot.nfsroot.path", rootpath, 1);
|
||||
}
|
||||
if (intf_mtu != 0) {
|
||||
char mtu[16];
|
||||
sprintf(mtu, "%u", intf_mtu);
|
||||
@ -367,16 +368,24 @@ net_print(int verbose)
|
||||
uint32_t
|
||||
net_parse_rootpath()
|
||||
{
|
||||
int i;
|
||||
int i, ipstart;
|
||||
n_long addr = INADDR_NONE;
|
||||
|
||||
netproto = NET_NFS;
|
||||
|
||||
if (tftpip.s_addr != 0) {
|
||||
netproto = NET_TFTP;
|
||||
addr = tftpip.s_addr;
|
||||
}
|
||||
|
||||
for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
|
||||
if (rootpath[i] == ':')
|
||||
break;
|
||||
if (i && i != FNAME_SIZE && rootpath[i] == ':') {
|
||||
rootpath[i++] = '\0';
|
||||
addr = inet_addr(&rootpath[0]);
|
||||
addr = inet_addr(&rootpath[ipstart]);
|
||||
bcopy(&rootpath[i], rootpath, strlen(&rootpath[i])+1);
|
||||
}
|
||||
|
||||
return (addr);
|
||||
}
|
||||
|
@ -89,11 +89,15 @@ EFI_TARGET= efi-app-ia32
|
||||
EFI_TARGET= binary
|
||||
.endif
|
||||
|
||||
# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
|
||||
# for build reproducibility.
|
||||
SOURCE_DATE_EPOCH?=1451606400
|
||||
boot1.efi: ${PROG}
|
||||
if ${NM} ${.ALLSRC} | grep ' U '; then \
|
||||
echo "Undefined symbols in ${.ALLSRC}"; \
|
||||
exit 1; \
|
||||
fi
|
||||
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
|
||||
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
|
||||
-j .dynamic -j .dynsym -j .rel.dyn \
|
||||
-j .rela.dyn -j .reloc -j .eh_frame \
|
||||
|
@ -13,10 +13,6 @@ SRCS+= time.c
|
||||
SRCS+= time_event.c
|
||||
.endif
|
||||
|
||||
.if defined(LOADER_TFTP_SUPPORT)
|
||||
CFLAGS+= -DLOADER_TFTP_SUPPORT -DNETIF_OPEN_CLOSE_ONCE
|
||||
.endif
|
||||
|
||||
# We implement a slightly non-standard %S in that it always takes a
|
||||
# CHAR16 that's common in UEFI-land instead of a wchar_t. This only
|
||||
# seems to matter on arm64 where wchar_t defaults to an int instead
|
||||
|
@ -21,10 +21,6 @@ SRCS= autoload.c \
|
||||
smbios.c \
|
||||
vers.c
|
||||
|
||||
.if defined(LOADER_TFTP_SUPPORT)
|
||||
CFLAGS+= -DLOADER_TFTP_SUPPORT -DNETIF_OPEN_CLOSE_ONCE
|
||||
.endif
|
||||
|
||||
.if ${MK_ZFS} != "no"
|
||||
SRCS+= zfs.c
|
||||
.PATH: ${.CURDIR}/../../zfs
|
||||
@ -135,11 +131,15 @@ EFI_TARGET= efi-app-ia32
|
||||
EFI_TARGET= binary
|
||||
.endif
|
||||
|
||||
# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00
|
||||
# for build reproducibility.
|
||||
SOURCE_DATE_EPOCH?=1451606400
|
||||
loader.efi: ${PROG}
|
||||
if ${NM} ${.ALLSRC} | grep ' U '; then \
|
||||
echo "Undefined symbols in ${.ALLSRC}"; \
|
||||
exit 1; \
|
||||
fi
|
||||
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
|
||||
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
|
||||
-j .dynamic -j .dynsym -j .rel.dyn \
|
||||
-j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \
|
||||
|
@ -51,11 +51,8 @@ struct fs_ops *file_system[] = {
|
||||
&dosfs_fsops,
|
||||
&ufs_fsops,
|
||||
&cd9660_fsops,
|
||||
#ifdef LOADER_TFTP_SUPPORT
|
||||
&tftp_fsops,
|
||||
#else
|
||||
&nfs_fsops,
|
||||
#endif
|
||||
&gzipfs_fsops,
|
||||
&bzipfs_fsops,
|
||||
NULL
|
||||
|
@ -1,5 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR=arm mips powerpc
|
||||
SUBDIR=arm arm64 mips powerpc
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user