Merge ^/head r357179 through r357269.

This commit is contained in:
Dimitry Andric 2020-01-29 21:09:36 +00:00
commit bb1d0df511
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang1000-import/; revision=357270
82 changed files with 11293 additions and 6253 deletions

View File

@ -1244,12 +1244,20 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
avl_tree_t slice_cache;
rdsk_node_t *slice;
void *cookie;
boolean_t skip_zvols = B_FALSE;
int value;
size_t size = sizeof(value);
if (dirs == 0) {
dirs = 1;
dir = &default_dir;
}
if (sysctlbyname("vfs.zfs.vol.recursive", &value, &size, NULL, 0) == 0
&& value == 0) {
skip_zvols = B_TRUE;
}
/*
* Go through and read the label configuration information from every
* possible device, organizing the information according to pool GUID
@ -1314,6 +1322,10 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
}
LIST_FOREACH(mp, &mesh.lg_class, lg_class) {
if (skip_zvols &&
strcmp(mp->lg_name, "ZFS::ZVOL") == 0) {
continue;
}
LIST_FOREACH(gp, &mp->lg_geom, lg_geom) {
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
slice = zfs_alloc(hdl, sizeof (rdsk_node_t));

View File

@ -79,7 +79,7 @@ ATF_TC_BODY(o_search_perm1, tc)
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(fchmod(dfd, 644) == 0);
ATF_REQUIRE(fchmod(dfd, 0644) == 0);
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
ATF_REQUIRE(errno == EACCES);
@ -109,12 +109,12 @@ ATF_TC_BODY(o_search_root_flag1, tc)
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(fchmod(dfd, 644) == 0);
ATF_REQUIRE(fchmod(dfd, 0644) == 0);
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(fchmod(dfd, 444) == 0);
ATF_REQUIRE(fchmod(dfd, 0444) == 0);
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
@ -141,12 +141,12 @@ ATF_TC_BODY(o_search_unpriv_flag1, tc)
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(fchmod(dfd, 644) == 0);
ATF_REQUIRE(fchmod(dfd, 0644) == 0);
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(fchmod(dfd, 444) == 0);
ATF_REQUIRE(fchmod(dfd, 0444) == 0);
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
@ -173,7 +173,7 @@ ATF_TC_BODY(o_search_perm2, tc)
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
ATF_REQUIRE(fchmod(dfd, 644) == 0);
ATF_REQUIRE(fchmod(dfd, 0644) == 0);
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == -1);
ATF_REQUIRE(errno == EACCES);
@ -202,11 +202,11 @@ ATF_TC_BODY(o_search_root_flag2, tc)
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
ATF_REQUIRE(fchmod(dfd, 644) == 0);
ATF_REQUIRE(fchmod(dfd, 0644) == 0);
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
ATF_REQUIRE(fchmod(dfd, 444) == 0);
ATF_REQUIRE(fchmod(dfd, 0444) == 0);
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
@ -232,11 +232,11 @@ ATF_TC_BODY(o_search_unpriv_flag2, tc)
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
ATF_REQUIRE(fchmod(dfd, 644) == 0);
ATF_REQUIRE(fchmod(dfd, 0644) == 0);
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
ATF_REQUIRE(fchmod(dfd, 444) == 0);
ATF_REQUIRE(fchmod(dfd, 0444) == 0);
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);

View File

@ -210,6 +210,12 @@ OPTIMIZATIONS = 2
SESSION = 0
!ENDIF
# Set this to non-0 to enable support for the rbu extension.
#
!IFNDEF RBU
RBU = 0
!ENDIF
# Set the source code file to be used by executables and libraries when
# they need the amalgamation.
#
@ -282,7 +288,6 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_JSON1=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_INTROSPECTION_PRAGMAS=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DESERIALIZE=1
!ENDIF
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
@ -296,6 +301,13 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
!ENDIF
# Should the rbu extension be enabled? If so, add compilation options
# to enable it.
#
!IF $(RBU)!=0
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1
!ENDIF
# These are the "extended" SQLite compilation options used when compiling for
# the Windows 10 platform.
#
@ -978,7 +990,7 @@ Replace.exe:
sqlite3.def: Replace.exe $(LIBOBJ)
echo EXPORTS > sqlite3.def
dumpbin /all $(LIBOBJ) \
| .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup|rebaser)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \
| .\Replace.exe "^\s+/EXPORT:_?(sqlite3(?:session|changeset|changegroup|rebaser|rbu)?_[^@,]*)(?:@\d+|,DATA)?$$" $$1 true \
| sort >> sqlite3.def
$(SQLITE3EXE): shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLITE3H)

View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for sqlite 3.30.1.
# Generated by GNU Autoconf 2.69 for sqlite 3.31.0.
#
# Report bugs to <http://www.sqlite.org>.
#
@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.30.1'
PACKAGE_STRING='sqlite 3.30.1'
PACKAGE_VERSION='3.31.0'
PACKAGE_STRING='sqlite 3.31.0'
PACKAGE_BUGREPORT='http://www.sqlite.org'
PACKAGE_URL=''
@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures sqlite 3.30.1 to adapt to many kinds of systems.
\`configure' configures sqlite 3.31.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1412,7 +1412,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of sqlite 3.30.1:";;
short | recursive ) echo "Configuration of sqlite 3.31.0:";;
esac
cat <<\_ACEOF
@ -1537,7 +1537,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
sqlite configure 3.30.1
sqlite configure 3.31.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by sqlite $as_me 3.30.1, which was
It was created by sqlite $as_me 3.31.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2818,7 +2818,7 @@ fi
# Define the identity of the package.
PACKAGE='sqlite'
VERSION='3.30.1'
VERSION='3.31.0'
cat >>confdefs.h <<_ACEOF
@ -13653,7 +13653,7 @@ else
fi
if test x"$enable_rtree" = "xyes"; then
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_RTREE"
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY"
fi
#-----------------------------------------------------------------------
@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by sqlite $as_me 3.30.1, which was
This file was extended by sqlite $as_me 3.31.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -14495,7 +14495,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
sqlite config.status 3.30.1
sqlite config.status 3.31.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@ -10,7 +10,7 @@
#
AC_PREREQ(2.61)
AC_INIT(sqlite, 3.30.1, http://www.sqlite.org)
AC_INIT(sqlite, 3.31.0, http://www.sqlite.org)
AC_CONFIG_SRCDIR([sqlite3.c])
AC_CONFIG_AUX_DIR([.])
@ -161,7 +161,7 @@ AC_ARG_ENABLE(rtree, [AS_HELP_STRING(
[--enable-rtree], [include rtree support [default=yes]])],
[], [enable_rtree=yes])
if test x"$enable_rtree" = "xyes"; then
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_RTREE"
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY"
fi
#-----------------------------------------------------------------------

View File

@ -2007,19 +2007,23 @@ int sqlite3_shathree_init(
int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "sha3", 1, SQLITE_UTF8, 0,
sha3Func, 0, 0);
rc = sqlite3_create_function(db, "sha3", 1,
SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
0, sha3Func, 0, 0);
if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "sha3", 2, SQLITE_UTF8, 0,
sha3Func, 0, 0);
rc = sqlite3_create_function(db, "sha3", 2,
SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
0, sha3Func, 0, 0);
}
if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "sha3_query", 1, SQLITE_UTF8, 0,
sha3QueryFunc, 0, 0);
rc = sqlite3_create_function(db, "sha3_query", 1,
SQLITE_UTF8 | SQLITE_DIRECTONLY,
0, sha3QueryFunc, 0, 0);
}
if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "sha3_query", 2, SQLITE_UTF8, 0,
sha3QueryFunc, 0, 0);
rc = sqlite3_create_function(db, "sha3_query", 2,
SQLITE_UTF8 | SQLITE_DIRECTONLY,
0, sha3QueryFunc, 0, 0);
}
return rc;
}
@ -2613,6 +2617,7 @@ static int fsdirConnect(
pNew = (fsdir_tab*)sqlite3_malloc( sizeof(*pNew) );
if( pNew==0 ) return SQLITE_NOMEM;
memset(pNew, 0, sizeof(*pNew));
sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
}
*ppVtab = (sqlite3_vtab*)pNew;
return rc;
@ -3006,10 +3011,12 @@ int sqlite3_fileio_init(
int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "readfile", 1, SQLITE_UTF8, 0,
rc = sqlite3_create_function(db, "readfile", 1,
SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
readfileFunc, 0, 0);
if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "writefile", -1, SQLITE_UTF8, 0,
rc = sqlite3_create_function(db, "writefile", -1,
SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
writefileFunc, 0, 0);
}
if( rc==SQLITE_OK ){
@ -3144,6 +3151,7 @@ static int completionConnect(
#define COMPLETION_COLUMN_WHOLELINE 2 /* Entire line seen so far */
#define COMPLETION_COLUMN_PHASE 3 /* ePhase - used for debugging only */
sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
rc = sqlite3_declare_vtab(db,
"CREATE TABLE x("
" candidate TEXT,"
@ -4578,6 +4586,7 @@ static int zipfileConnect(
zipfileDequote(pNew->zFile);
}
}
sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
*ppVtab = (sqlite3_vtab*)pNew;
return rc;
}
@ -5190,25 +5199,25 @@ static int zipfileDeflate(
u8 **ppOut, int *pnOut, /* Output */
char **pzErr /* OUT: Error message */
){
sqlite3_int64 nAlloc = compressBound(nIn);
u8 *aOut;
int rc = SQLITE_OK;
sqlite3_int64 nAlloc;
z_stream str;
u8 *aOut;
memset(&str, 0, sizeof(str));
str.next_in = (Bytef*)aIn;
str.avail_in = nIn;
deflateInit2(&str, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
nAlloc = deflateBound(&str, nIn);
aOut = (u8*)sqlite3_malloc64(nAlloc);
if( aOut==0 ){
rc = SQLITE_NOMEM;
}else{
int res;
z_stream str;
memset(&str, 0, sizeof(str));
str.next_in = (Bytef*)aIn;
str.avail_in = nIn;
str.next_out = aOut;
str.avail_out = nAlloc;
deflateInit2(&str, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
res = deflate(&str, Z_FINISH);
if( res==Z_STREAM_END ){
*ppOut = aOut;
*pnOut = (int)str.total_out;
@ -5517,10 +5526,10 @@ static int zipfileBestIndex(
idx = i;
}
}
pIdxInfo->estimatedCost = 1000.0;
if( idx>=0 ){
pIdxInfo->aConstraintUsage[idx].argvIndex = 1;
pIdxInfo->aConstraintUsage[idx].omit = 1;
pIdxInfo->estimatedCost = 1000.0;
pIdxInfo->idxNum = 1;
}else if( unusable ){
return SQLITE_CONSTRAINT;
@ -5642,8 +5651,8 @@ static int zipfileGetMode(
** identical, ignoring any trailing '/' character in either path. */
static int zipfileComparePath(const char *zA, const char *zB, int nB){
int nA = (int)strlen(zA);
if( zA[nA-1]=='/' ) nA--;
if( zB[nB-1]=='/' ) nB--;
if( nA>0 && zA[nA-1]=='/' ) nA--;
if( nB>0 && zB[nB-1]=='/' ) nB--;
if( nA==nB && memcmp(zA, zB, nA)==0 ) return 0;
return 1;
}
@ -5653,6 +5662,10 @@ static int zipfileBegin(sqlite3_vtab *pVtab){
int rc = SQLITE_OK;
assert( pTab->pWriteFd==0 );
if( pTab->zFile==0 || pTab->zFile[0]==0 ){
pTab->base.zErrMsg = sqlite3_mprintf("zipfile: missing filename");
return SQLITE_ERROR;
}
/* Open a write fd on the file. Also load the entire central directory
** structure into memory. During the transaction any new file data is
@ -5827,6 +5840,7 @@ static int zipfileUpdate(
if( rc==SQLITE_OK ){
zPath = (const char*)sqlite3_value_text(apVal[2]);
if( zPath==0 ) zPath = "";
nPath = (int)strlen(zPath);
mTime = zipfileGetTime(apVal[4]);
}
@ -5836,11 +5850,15 @@ static int zipfileUpdate(
** '/'. This appears to be required for compatibility with info-zip
** (the unzip command on unix). It does not create directories
** otherwise. */
if( zPath[nPath-1]!='/' ){
if( nPath<=0 || zPath[nPath-1]!='/' ){
zFree = sqlite3_mprintf("%s/", zPath);
if( zFree==0 ){ rc = SQLITE_NOMEM; }
zPath = (const char*)zFree;
nPath++;
if( zFree==0 ){
rc = SQLITE_NOMEM;
nPath = 0;
}else{
nPath = (int)strlen(zPath);
}
}
}
@ -6233,19 +6251,19 @@ void zipfileStep(sqlite3_context *pCtx, int nVal, sqlite3_value **apVal){
** at the end of the path. Or, if this is not a directory and the path
** ends in '/' it is an error. */
if( bIsDir==0 ){
if( zName[nName-1]=='/' ){
if( nName>0 && zName[nName-1]=='/' ){
zErr = sqlite3_mprintf("non-directory name must not end with /");
rc = SQLITE_ERROR;
goto zipfile_step_out;
}
}else{
if( zName[nName-1]!='/' ){
if( nName==0 || zName[nName-1]!='/' ){
zName = zFree = sqlite3_mprintf("%s/", zName);
nName++;
if( zName==0 ){
rc = SQLITE_NOMEM;
goto zipfile_step_out;
}
nName = (int)strlen(zName);
}else{
while( nName>1 && zName[nName-2]=='/' ) nName--;
}
@ -6501,10 +6519,12 @@ int sqlite3_sqlar_init(
int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "sqlar_compress", 1, SQLITE_UTF8, 0,
rc = sqlite3_create_function(db, "sqlar_compress", 1,
SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
sqlarCompressFunc, 0, 0);
if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "sqlar_uncompress", 2, SQLITE_UTF8, 0,
rc = sqlite3_create_function(db, "sqlar_uncompress", 2,
SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
sqlarUncompressFunc, 0, 0);
}
return rc;
@ -6525,8 +6545,8 @@ int sqlite3_sqlar_init(
**
*************************************************************************
*/
#if !defined(SQLITEEXPERT_H)
#define SQLITEEXPERT_H 1
/* #include "sqlite3.h" */
typedef struct sqlite3expert sqlite3expert;
@ -6680,7 +6700,7 @@ const char *sqlite3_expert_report(sqlite3expert*, int iStmt, int eReport);
*/
void sqlite3_expert_destroy(sqlite3expert*);
#endif /* !defined(SQLITEEXPERT_H) */
/************************* End ../ext/expert/sqlite3expert.h ********************/
/************************* Begin ../ext/expert/sqlite3expert.c ******************/
@ -9566,6 +9586,7 @@ struct ShellState {
int outCount; /* Revert to stdout when reaching zero */
int cnt; /* Number of records displayed so far */
int lineno; /* Line number of last line read from in */
int openFlags; /* Additional flags to open. (SQLITE_OPEN_NOFOLLOW) */
FILE *in; /* Read commands from this stream */
FILE *out; /* Write results here */
FILE *traceOut; /* Output for sqlite3_trace() */
@ -10400,19 +10421,22 @@ static int shell_callback(
const int *colWidth;
int showHdr;
char *rowSep;
int nWidth;
if( p->cMode==MODE_Column ){
colWidth = p->colWidth;
nWidth = ArraySize(p->colWidth);
showHdr = p->showHeader;
rowSep = p->rowSeparator;
}else{
colWidth = aExplainWidths;
nWidth = ArraySize(aExplainWidths);
showHdr = 1;
rowSep = SEP_Row;
}
if( p->cnt++==0 ){
for(i=0; i<nArg; i++){
int w, n;
if( i<ArraySize(p->colWidth) ){
if( i<nWidth ){
w = colWidth[i];
}else{
w = 0;
@ -11302,6 +11326,9 @@ static void restore_debug_trace_modes(void){
/* Create the TEMP table used to store parameter bindings */
static void bind_table_init(ShellState *p){
int wrSchema = 0;
int defensiveMode = 0;
sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, -1, &defensiveMode);
sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, 0, 0);
sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema);
sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0);
sqlite3_exec(p->db,
@ -11311,6 +11338,7 @@ static void bind_table_init(ShellState *p){
") WITHOUT ROWID;",
0, 0, 0);
sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0);
sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, defensiveMode, 0);
}
/*
@ -12053,9 +12081,7 @@ static const char *(azHelp[]) = {
".excel Display the output of next command in spreadsheet",
".exit ?CODE? Exit this program with return-code CODE",
".expert EXPERIMENTAL. Suggest indexes for queries",
/* Because explain mode comes on automatically now, the ".explain" mode
** is removed from the help screen. It is still supported for legacy, however */
/*".explain ?on|off|auto? Turn EXPLAIN output mode on or off",*/
".explain ?on|off|auto? Change the EXPLAIN formatting mode. Default: auto",
".filectrl CMD ... Run various sqlite3_file_control() operations",
" Run \".filectrl\" with no arguments for details",
".fullschema ?--indent? Show schema and the content of sqlite_stat tables",
@ -12106,6 +12132,7 @@ static const char *(azHelp[]) = {
" --maxsize N Maximum size for --hexdb or --deserialized database",
#endif
" --new Initialize FILE to an empty database",
" --nofollow Do not follow symbolic links",
" --readonly Open FILE readonly",
" --zip FILE is a ZIP archive",
".output ?FILE? Send output to FILE or stdout if FILE is omitted",
@ -12670,7 +12697,7 @@ static void open_db(ShellState *p, int openFlags){
switch( p->openMode ){
case SHELL_OPEN_APPENDVFS: {
sqlite3_open_v2(p->zDbFilename, &p->db,
SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, "apndvfs");
SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|p->openFlags, "apndvfs");
break;
}
case SHELL_OPEN_HEXDB:
@ -12683,12 +12710,14 @@ static void open_db(ShellState *p, int openFlags){
break;
}
case SHELL_OPEN_READONLY: {
sqlite3_open_v2(p->zDbFilename, &p->db, SQLITE_OPEN_READONLY, 0);
sqlite3_open_v2(p->zDbFilename, &p->db,
SQLITE_OPEN_READONLY|p->openFlags, 0);
break;
}
case SHELL_OPEN_UNSPEC:
case SHELL_OPEN_NORMAL: {
sqlite3_open(p->zDbFilename, &p->db);
sqlite3_open_v2(p->zDbFilename, &p->db,
SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|p->openFlags, 0);
break;
}
}
@ -13462,7 +13491,7 @@ static unsigned int get4byteInt(unsigned char *a){
}
/*
** Implementation of the ".info" command.
** Implementation of the ".dbinfo" command.
**
** Return 1 on error, 2 to exit, and 0 otherwise.
*/
@ -15699,20 +15728,22 @@ static int do_meta_command(char *zLine, ShellState *p){
const char *zName;
int op;
} aDbConfig[] = {
{ "defensive", SQLITE_DBCONFIG_DEFENSIVE },
{ "dqs_ddl", SQLITE_DBCONFIG_DQS_DDL },
{ "dqs_dml", SQLITE_DBCONFIG_DQS_DML },
{ "enable_fkey", SQLITE_DBCONFIG_ENABLE_FKEY },
{ "enable_qpsg", SQLITE_DBCONFIG_ENABLE_QPSG },
{ "enable_trigger", SQLITE_DBCONFIG_ENABLE_TRIGGER },
{ "enable_view", SQLITE_DBCONFIG_ENABLE_VIEW },
{ "fts3_tokenizer", SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER },
{ "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
{ "legacy_file_format", SQLITE_DBCONFIG_LEGACY_FILE_FORMAT },
{ "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
{ "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
{ "enable_qpsg", SQLITE_DBCONFIG_ENABLE_QPSG },
{ "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
{ "reset_database", SQLITE_DBCONFIG_RESET_DATABASE },
{ "defensive", SQLITE_DBCONFIG_DEFENSIVE },
{ "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
{ "trusted_schema", SQLITE_DBCONFIG_TRUSTED_SCHEMA },
{ "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA },
{ "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
{ "dqs_dml", SQLITE_DBCONFIG_DQS_DML },
{ "dqs_ddl", SQLITE_DBCONFIG_DQS_DDL },
};
int ii, v;
open_db(p, 0);
@ -15722,7 +15753,7 @@ static int do_meta_command(char *zLine, ShellState *p){
sqlite3_db_config(p->db, aDbConfig[ii].op, booleanValue(azArg[2]), 0);
}
sqlite3_db_config(p->db, aDbConfig[ii].op, -1, &v);
utf8_printf(p->out, "%18s %s\n", aDbConfig[ii].zName, v ? "on" : "off");
utf8_printf(p->out, "%19s %s\n", aDbConfig[ii].zName, v ? "on" : "off");
if( nArg>1 ) break;
}
if( nArg>1 && ii==ArraySize(aDbConfig) ){
@ -16303,10 +16334,19 @@ static int do_meta_command(char *zLine, ShellState *p){
char *zCollist = 0;
sqlite3_stmt *pStmt;
int tnum = 0;
int isWO = 0; /* True if making an imposter of a WITHOUT ROWID table */
int lenPK = 0; /* Length of the PRIMARY KEY string for isWO tables */
int i;
if( !(nArg==3 || (nArg==2 && sqlite3_stricmp(azArg[1],"off")==0)) ){
utf8_printf(stderr, "Usage: .imposter INDEX IMPOSTER\n"
" .imposter off\n");
/* Also allowed, but not documented:
**
** .imposter TABLE IMPOSTER
**
** where TABLE is a WITHOUT ROWID table. In that case, the
** imposter is another WITHOUT ROWID table with the columns in
** storage order. */
rc = 1;
goto meta_command_exit;
}
@ -16315,19 +16355,22 @@ static int do_meta_command(char *zLine, ShellState *p){
sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 0, 1);
goto meta_command_exit;
}
zSql = sqlite3_mprintf("SELECT rootpage FROM sqlite_master"
" WHERE name='%q' AND type='index'", azArg[1]);
zSql = sqlite3_mprintf(
"SELECT rootpage, 0 FROM sqlite_master"
" WHERE name='%q' AND type='index'"
"UNION ALL "
"SELECT rootpage, 1 FROM sqlite_master"
" WHERE name='%q' AND type='table'"
" AND sql LIKE '%%without%%rowid%%'",
azArg[1], azArg[1]
);
sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
sqlite3_free(zSql);
if( sqlite3_step(pStmt)==SQLITE_ROW ){
tnum = sqlite3_column_int(pStmt, 0);
isWO = sqlite3_column_int(pStmt, 1);
}
sqlite3_finalize(pStmt);
if( tnum==0 ){
utf8_printf(stderr, "no such index: \"%s\"\n", azArg[1]);
rc = 1;
goto meta_command_exit;
}
zSql = sqlite3_mprintf("PRAGMA index_xinfo='%q'", azArg[1]);
rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
sqlite3_free(zSql);
@ -16344,6 +16387,9 @@ static int do_meta_command(char *zLine, ShellState *p){
zCol = zLabel;
}
}
if( isWO && lenPK==0 && sqlite3_column_int(pStmt,5)==0 && zCollist ){
lenPK = (int)strlen(zCollist);
}
if( zCollist==0 ){
zCollist = sqlite3_mprintf("\"%w\"", zCol);
}else{
@ -16351,9 +16397,16 @@ static int do_meta_command(char *zLine, ShellState *p){
}
}
sqlite3_finalize(pStmt);
if( i==0 || tnum==0 ){
utf8_printf(stderr, "no such index: \"%s\"\n", azArg[1]);
rc = 1;
sqlite3_free(zCollist);
goto meta_command_exit;
}
if( lenPK==0 ) lenPK = 100000;
zSql = sqlite3_mprintf(
"CREATE TABLE \"%w\"(%s,PRIMARY KEY(%s))WITHOUT ROWID",
azArg[2], zCollist, zCollist);
"CREATE TABLE \"%w\"(%s,PRIMARY KEY(%.*s))WITHOUT ROWID",
azArg[2], zCollist, lenPK, zCollist);
sqlite3_free(zCollist);
rc = sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 1, tnum);
if( rc==SQLITE_OK ){
@ -16364,7 +16417,8 @@ static int do_meta_command(char *zLine, ShellState *p){
}else{
utf8_printf(stdout, "%s;\n", zSql);
raw_printf(stdout,
"WARNING: writing to an imposter table will corrupt the index!\n"
"WARNING: writing to an imposter table will corrupt the \"%s\" %s!\n",
azArg[1], isWO ? "table" : "index"
);
}
}else{
@ -16562,6 +16616,7 @@ static int do_meta_command(char *zLine, ShellState *p){
sqlite3_free(p->zFreeOnClose);
p->zFreeOnClose = 0;
p->openMode = SHELL_OPEN_UNSPEC;
p->openFlags = 0;
p->szMax = 0;
/* Check for command-line arguments */
for(iName=1; iName<nArg && azArg[iName][0]=='-'; iName++){
@ -16576,6 +16631,8 @@ static int do_meta_command(char *zLine, ShellState *p){
p->openMode = SHELL_OPEN_APPENDVFS;
}else if( optionMatch(z, "readonly") ){
p->openMode = SHELL_OPEN_READONLY;
}else if( optionMatch(z, "nofollow") ){
p->openFlags |= SQLITE_OPEN_NOFOLLOW;
#ifdef SQLITE_ENABLE_DESERIALIZE
}else if( optionMatch(z, "deserialize") ){
p->openMode = SHELL_OPEN_DESERIALIZE;
@ -17732,7 +17789,7 @@ static int do_meta_command(char *zLine, ShellState *p){
{ "extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,"BOOLEAN" },
/*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" },*/
{ "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"},
{ "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN" },
{ "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "" },
{ "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" },
{ "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" },
{ "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" },
@ -17848,7 +17905,6 @@ static int do_meta_command(char *zLine, ShellState *p){
/* sqlite3_test_control(int, int) */
case SQLITE_TESTCTRL_ASSERT:
case SQLITE_TESTCTRL_ALWAYS:
case SQLITE_TESTCTRL_INTERNAL_FUNCTIONS:
if( nArg==3 ){
int opt = booleanValue(azArg[2]);
rc2 = sqlite3_test_control(testctrl, opt);
@ -17866,6 +17922,12 @@ static int do_meta_command(char *zLine, ShellState *p){
}
break;
/* sqlite3_test_control(sqlite3*) */
case SQLITE_TESTCTRL_INTERNAL_FUNCTIONS:
rc2 = sqlite3_test_control(testctrl, p->db);
isOk = 3;
break;
case SQLITE_TESTCTRL_IMPOSTER:
if( nArg==5 ){
rc2 = sqlite3_test_control(testctrl, p->db,
@ -18496,6 +18558,7 @@ static const char zOptions[] =
" -multiplex enable the multiplexor VFS\n"
#endif
" -newline SEP set output row separator. Default: '\\n'\n"
" -nofollow refuse to open symbolic links to database files\n"
" -nullvalue TEXT set text string for NULL values. Default ''\n"
" -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n"
" -quote set output mode to 'quote'\n"
@ -18806,6 +18869,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
#endif
}else if( strcmp(z,"-readonly")==0 ){
data.openMode = SHELL_OPEN_READONLY;
}else if( strcmp(z,"-nofollow")==0 ){
data.openFlags = SQLITE_OPEN_NOFOLLOW;
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB)
}else if( strncmp(z, "-A",2)==0 ){
/* All remaining command-line arguments are passed to the ".archive"
@ -18909,6 +18974,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
#endif
}else if( strcmp(z,"-readonly")==0 ){
data.openMode = SHELL_OPEN_READONLY;
}else if( strcmp(z,"-nofollow")==0 ){
data.openFlags |= SQLITE_OPEN_NOFOLLOW;
}else if( strcmp(z,"-ascii")==0 ){
data.mode = MODE_Ascii;
sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -324,6 +324,12 @@ struct sqlite3_api_routines {
int (*value_frombind)(sqlite3_value*);
/* Version 3.30.0 and later */
int (*drop_modules)(sqlite3*,const char**);
/* Version 3.31.0 and later */
sqlite3_int64 (*hard_heap_limit64)(sqlite3_int64);
const char *(*uri_key)(const char*,int);
const char *(*filename_database)(const char*);
const char *(*filename_journal)(const char*);
const char *(*filename_wal)(const char*);
};
/*
@ -618,6 +624,12 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_value_frombind sqlite3_api->frombind
/* Version 3.30.0 and later */
#define sqlite3_drop_modules sqlite3_api->drop_modules
/* Version 3.31.0 andn later */
#define sqlite3_hard_heap_limit64 sqlite3_api->hard_heap_limit64
#define sqlite3_uri_key sqlite3_api->uri_key
#define sqlite3_filename_database sqlite3_api->filename_database
#define sqlite3_filename_journal sqlite3_api->filename_journal
#define sqlite3_filename_wal sqlite3_api->filename_wal
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)

View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for sqlite 3.30.1.
# Generated by GNU Autoconf 2.69 for sqlite 3.31.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.30.1'
PACKAGE_STRING='sqlite 3.30.1'
PACKAGE_VERSION='3.31.0'
PACKAGE_STRING='sqlite 3.31.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@ -1303,7 +1303,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures sqlite 3.30.1 to adapt to many kinds of systems.
\`configure' configures sqlite 3.31.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1365,7 +1365,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of sqlite 3.30.1:";;
short | recursive ) echo "Configuration of sqlite 3.31.0:";;
esac
cat <<\_ACEOF
@ -1467,7 +1467,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
sqlite configure 3.30.1
sqlite configure 3.31.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -1878,7 +1878,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by sqlite $as_me 3.30.1, which was
It was created by sqlite $as_me 3.31.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -9373,7 +9373,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by sqlite $as_me 3.30.1, which was
This file was extended by sqlite $as_me 3.31.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -9426,7 +9426,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
sqlite config.status 3.30.1
sqlite config.status 3.31.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@ -19,7 +19,7 @@ dnl to configure the system for the local environment.
# so you can encode the package version directly into the source files.
#-----------------------------------------------------------------------
AC_INIT([sqlite], [3.30.1])
AC_INIT([sqlite], [3.31.0])
#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.

View File

@ -2346,20 +2346,22 @@ static int SQLITE_TCLAPI DbObjCmd(
const char *zName;
int op;
} aDbConfig[] = {
{ "defensive", SQLITE_DBCONFIG_DEFENSIVE },
{ "dqs_ddl", SQLITE_DBCONFIG_DQS_DDL },
{ "dqs_dml", SQLITE_DBCONFIG_DQS_DML },
{ "enable_fkey", SQLITE_DBCONFIG_ENABLE_FKEY },
{ "enable_qpsg", SQLITE_DBCONFIG_ENABLE_QPSG },
{ "enable_trigger", SQLITE_DBCONFIG_ENABLE_TRIGGER },
{ "enable_view", SQLITE_DBCONFIG_ENABLE_VIEW },
{ "fts3_tokenizer", SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER },
{ "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
{ "legacy_file_format", SQLITE_DBCONFIG_LEGACY_FILE_FORMAT },
{ "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
{ "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
{ "enable_qpsg", SQLITE_DBCONFIG_ENABLE_QPSG },
{ "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
{ "reset_database", SQLITE_DBCONFIG_RESET_DATABASE },
{ "defensive", SQLITE_DBCONFIG_DEFENSIVE },
{ "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
{ "trusted_schema", SQLITE_DBCONFIG_TRUSTED_SCHEMA },
{ "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA },
{ "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
{ "dqs_dml", SQLITE_DBCONFIG_DQS_DML },
{ "dqs_ddl", SQLITE_DBCONFIG_DQS_DDL },
};
Tcl_Obj *pResult;
int ii;
@ -2823,6 +2825,7 @@ static int SQLITE_TCLAPI DbObjCmd(
** --argcount N Function has exactly N arguments
** --deterministic The function is pure
** --directonly Prohibit use inside triggers and views
** --innocuous Has no side effects or information leaks
** --returntype TYPE Specify the return type of the function
*/
case DB_FUNCTION: {
@ -2859,6 +2862,9 @@ static int SQLITE_TCLAPI DbObjCmd(
if( n>1 && strncmp(z, "-directonly",n)==0 ){
flags |= SQLITE_DIRECTONLY;
}else
if( n>1 && strncmp(z, "-innocuous",n)==0 ){
flags |= SQLITE_INNOCUOUS;
}else
if( n>1 && strncmp(z, "-returntype", n)==0 ){
const char *azType[] = {"integer", "real", "text", "blob", "any", 0};
assert( SQLITE_INTEGER==1 && SQLITE_FLOAT==2 && SQLITE_TEXT==3 );
@ -2875,7 +2881,7 @@ static int SQLITE_TCLAPI DbObjCmd(
}else{
Tcl_AppendResult(interp, "bad option \"", z,
"\": must be -argcount, -deterministic, -directonly,"
" or -returntype", (char*)0
" -innocuous, or -returntype", (char*)0
);
return TCL_ERROR;
}
@ -3675,6 +3681,7 @@ static int sqliteCmdUsage(
){
Tcl_WrongNumArgs(interp, 1, objv,
"HANDLE ?FILENAME? ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN?"
" ?-nofollow BOOLEAN?"
" ?-nomutex BOOLEAN? ?-fullmutex BOOLEAN? ?-uri BOOLEAN?"
#if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_CODEC_FROM_TCL)
" ?-key CODECKEY?"
@ -3686,6 +3693,7 @@ static int sqliteCmdUsage(
/*
** sqlite3 DBNAME FILENAME ?-vfs VFSNAME? ?-key KEY? ?-readonly BOOLEAN?
** ?-create BOOLEAN? ?-nomutex BOOLEAN?
** ?-nofollow BOOLEAN?
**
** This is the main Tcl command. When the "sqlite" Tcl command is
** invoked, this routine runs to process that command.
@ -3784,6 +3792,14 @@ static int SQLITE_TCLAPI DbMain(
}else{
flags &= ~SQLITE_OPEN_CREATE;
}
}else if( strcmp(zArg, "-nofollow")==0 ){
int b;
if( Tcl_GetBooleanFromObj(interp, objv[i], &b) ) return TCL_ERROR;
if( b ){
flags |= SQLITE_OPEN_NOFOLLOW;
}else{
flags &= ~SQLITE_OPEN_NOFOLLOW;
}
}else if( strcmp(zArg, "-nomutex")==0 ){
int b;
if( Tcl_GetBooleanFromObj(interp, objv[i], &b) ) return TCL_ERROR;

View File

@ -153,7 +153,7 @@ Please `cd` to its location first.
#
#-------------------------------------------------------------------------
PROJECT = sqlite3
PROJECT = tclsqlite3
!include "rules.vc"
# nmakehelp -V <file> <tag> will search the file for tag, skips until a
@ -162,18 +162,15 @@ PROJECT = sqlite3
!if [echo REM = This file is generated from Makefile.vc > versions.vc]
!endif
# get project version from row "AC_INIT([sqlite], [3.7.14])"
# get project version from row "AC_INIT([sqlite], [3.x.y])"
!if [echo DOTVERSION = \>> versions.vc] \
&& [nmakehlp -V ..\configure.in AC_INIT >> versions.vc]
&& [nmakehlp -V ..\configure.ac AC_INIT >> versions.vc]
!endif
!include "versions.vc"
VERSION = $(DOTVERSION:.=)
STUBPREFIX = $(PROJECT)stub
DLLOBJS = \
$(TMP_DIR)\tclsqlite3.obj
#-------------------------------------------------------------------------
# Target names and paths ( shouldn't need changing )
#-------------------------------------------------------------------------
@ -182,7 +179,7 @@ BINROOT = .
ROOT = ..
PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
PRJLIBNAME = $(PROJECT).$(EXT)
PRJLIB = $(OUT_DIR)\$(PRJLIBNAME)
PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib
@ -204,6 +201,17 @@ DOCDIR = $(ROOT)\doc
TOOLSDIR = $(ROOT)\tools
COMPATDIR = $(ROOT)\compat
### Figure out where the primary source code file(s) is/are.
!if exist("$(ROOT)\..\..\sqlite3.c") && exist("$(ROOT)\..\..\src\tclsqlite.c")
SQL_INCLUDES = -I"$(ROOT)\..\.."
SQLITE_SRCDIR = $(ROOT)\..\..
TCLSQLITE_SRCDIR = $(ROOT)\..\..\src
DLLOBJS = $(TMP_DIR)\sqlite3.obj $(TMP_DIR)\tclsqlite.obj
!else
TCLSQLITE_SRCDIR = $(ROOT)\generic
DLLOBJS = $(TMP_DIR)\tclsqlite3.obj
!endif
#---------------------------------------------------------------------
# Compile flags
#---------------------------------------------------------------------
@ -223,7 +231,7 @@ cdebug = -Z7 -WX -Od -GZ
!endif
### Declarations common to all compiler options
cflags = -nologo -c -W3 -YX -Fp$(TMP_DIR)^\
cflags = -nologo -c -W3 -D_CRT_SECURE_NO_WARNINGS -YX -Fp$(TMP_DIR)^\
!if $(MSVCRT)
!if $(DEBUG)
@ -239,8 +247,8 @@ crt = -MT
!endif
!endif
INCLUDES = $(TCL_INCLUDES) -I"$(WINDIR)" -I"$(GENERICDIR)" \
-I"$(ROOT)\.."
INCLUDES = $(SQL_INCLUDES) $(TCL_INCLUDES) -I"$(WINDIR)" \
-I"$(GENERICDIR)" -I"$(ROOT)\.."
BASE_CLFAGS = $(cflags) $(cdebug) $(crt) $(INCLUDES) \
-DSQLITE_3_SUFFIX_ONLY=1 -DSQLITE_ENABLE_RTREE=1 \
-DSQLITE_ENABLE_FTS3=1 -DSQLITE_OMIT_DEPRECATED=1
@ -341,20 +349,17 @@ $(PRJSTUBLIB): $(PRJSTUBOBJS)
# Implicit rules
#---------------------------------------------------------------------
{$(WINDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
$<
<<
$(TMP_DIR)\sqlite3.obj: $(SQLITE_SRCDIR)\sqlite3.c
$(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ \
-c $(SQLITE_SRCDIR)\sqlite3.c
{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
$<
<<
$(TMP_DIR)\tclsqlite.obj: $(TCLSQLITE_SRCDIR)\tclsqlite.c
$(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ \
-c $(TCLSQLITE_SRCDIR)\tclsqlite.c
{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
$<
<<
$(TMP_DIR)\tclsqlite3.obj: $(TCLSQLITE_SRCDIR)\tclsqlite3.c
$(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ \
-c $(TCLSQLITE_SRCDIR)\tclsqlite3.c
{$(WINDIR)}.rc{$(TMP_DIR)}.res:
$(rc32) -fo $@ -r -i "$(GENERICDIR)" -D__WIN32__ \

View File

@ -207,9 +207,9 @@
..
..
certs
blacklisted
blacklisted tags=package=caroot
..
trusted
trusted tags=package=caroot
..
..
dict

View File

@ -18,7 +18,7 @@ FILESDIR= ${LIBDIR}
.undef LIBRARIES_ONLY
CLEANFILES= ${OBJS}
CLEANFILES+= crt1.s crtsavres.s gcrt1.s Scrt1.s
CLEANFILES+= crt1.s crtsavres.S gcrt1.s Scrt1.s
# See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not
# directly compiled to .o files.
@ -28,7 +28,7 @@ crt1.s: crt1.c
sed ${SED_FIX_NOTE} ${.TARGET}
# On powerpc64 crtsavres is an empty file
crtsavres.s:
crtsavres.S:
touch ${.TARGET}
crt1.o: crt1.s

View File

@ -158,7 +158,7 @@ The
command accepts these options:
.Bl -tag -width 12n
.It Fl a Ar alignment
If specified, then
If specified, then the
.Nm
utility tries to align
.Ar start
@ -407,7 +407,7 @@ The
command accepts these options:
.Bl -tag -width 12n
.It Fl a Ar alignment
If specified, then
If specified, then the
.Nm
utility tries to align partition
.Ar size
@ -704,8 +704,8 @@ for APM,
for GPT, and 0x0904 for VTOC8.
.El
.Pp
Other symbolic names that can be used with
.Cm gpart
Other symbolic names that can be used with the
.Nm
utility are:
.Bl -tag -width ".Cm dragonfly-disklabel64"
.It Cm apple-apfs
@ -1215,8 +1215,8 @@ This variable overrides this restriction and allows arbitrary nesting (except
within partitions created at offset 0).
Some schemes have their own separate checks, for which see below.
.It Va kern.geom.part.auto_resize : No 1
This variable controls automatic resize behavior of
.Nm
This variable controls automatic resize behavior of the
.Nm PART
GEOM class.
When this variable is enable and new size of provider is detected, the schema
metadata is resized but all changes are not saved to disk, until

View File

@ -31,91 +31,185 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */
ENTRY(memcmp)
cmpq $16,%rdx
jae 5f
1:
testq %rdx,%rdx
je 3f
xorl %ecx,%ecx
2:
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%r8d
cmpb %r8b,%al
jne 4f
addq $1,%rcx
cmpq %rcx,%rdx
jz 3f
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%r8d
cmpb %r8b,%al
jne 4f
addq $1,%rcx
cmpq %rcx,%rdx
jz 3f
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%r8d
cmpb %r8b,%al
jne 4f
addq $1,%rcx
cmpq %rcx,%rdx
jz 3f
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%r8d
cmpb %r8b,%al
jne 4f
addq $1,%rcx
cmpq %rcx,%rdx
jne 2b
3:
xorl %eax,%eax
ret
4:
subl %r8d,%eax
ret
5:
cmpq $32,%rdx
jae 7f
6:
/*
* 8 bytes
*/
10:
cmpq $16,%rdx
ja 101632f
100816:
cmpb $8,%dl
jl 100408f
movq (%rdi),%r8
movq (%rsi),%r9
cmpq %r8,%r9
jne 1b
leaq 8(%rdi),%rdi
leaq 8(%rsi),%rsi
subq $8,%rdx
cmpq $8,%rdx
jae 6b
jl 1b
jmp 3b
7:
/*
* 32 bytes
*/
movq (%rsi),%r8
jne 1f
movq -8(%rdi,%rdx),%r8
movq -8(%rsi,%rdx),%r9
cmpq %r8,%r9
jne 10081608f
ret
100408:
cmpb $4,%dl
jl 100204f
movl (%rsi),%r8d
movl (%rdi),%r9d
cmpl %r8d,%r9d
jne 1f
movl -4(%rsi,%rdx),%r8d
movl -4(%rdi,%rdx),%r9d
cmpl %r8d,%r9d
jne 1f
ret
100204:
cmpb $2,%dl
jl 100001f
movzwl (%rsi),%r8d
movzwl (%rdi),%r9d
cmpl %r8d,%r9d
jne 1f
movzwl -2(%rsi,%rdx),%r8d
movzwl -2(%rdi,%rdx),%r9d
cmpl %r8d,%r9d
jne 1f
ret
100001:
cmpb $1,%dl
jl 100000f
movzbl (%rdi),%r8d
movzbl (%rsi),%r9d
cmpb %r8b,%r9b
jne 1f
100000:
ret
ALIGN_TEXT
101632:
cmpq $32,%rdx
ja 103200f
movq (%rdi),%r8
movq (%rsi),%r9
cmpq %r8,%r9
jne 1f
movq 8(%rdi),%r8
movq 8(%rsi),%r9
subq (%rdi),%r8
subq 8(%rdi),%r9
cmpq %r8,%r9
jne 10163208f
movq -16(%rdi,%rdx),%r8
movq -16(%rsi,%rdx),%r9
cmpq %r8,%r9
jne 10163216f
movq -8(%rdi,%rdx),%r8
movq -8(%rsi,%rdx),%r9
cmpq %r8,%r9
jne 10163224f
ret
ALIGN_TEXT
103200:
movq (%rdi),%r8
movq 8(%rdi),%r9
subq (%rsi),%r8
subq 8(%rsi),%r9
or %r8,%r9
jnz 1b
jnz 10320000f
movq 16(%rsi),%r8
movq 24(%rsi),%r9
subq 16(%rdi),%r8
subq 24(%rdi),%r9
or %r8,%r9
jnz 1b
movq 16(%rdi),%r8
movq 24(%rdi),%r9
subq 16(%rsi),%r8
subq 24(%rsi),%r9
or %r8,%r9
jnz 10320016f
leaq 32(%rdi),%rdi
leaq 32(%rsi),%rsi
subq $32,%rdx
cmpq $32,%rdx
jae 7b
jnz 1b
jmp 3b
jae 103200b
cmpb $0,%dl
jne 10b
ret
10320016:
leaq 16(%rdi),%rdi
leaq 16(%rsi),%rsi
10320000:
/*
* Mismatch was found within a 16 bytes range. The part of the routine
* which calculates it only operates on sizes up to 8 bytes. Find the
* right part.
*/
movq (%rdi),%r8
movq (%rsi),%r9
cmpq %r8,%r9
jne 1f
leaq 8(%rdi),%rdi
leaq 8(%rsi),%rsi
jmp 1f
10163224:
leaq -8(%rdi,%rdx),%rdi
leaq -8(%rsi,%rdx),%rsi
jmp 1f
10163216:
leaq -16(%rdi,%rdx),%rdi
leaq -16(%rsi,%rdx),%rsi
jmp 1f
10163208:
10081608:
leaq 8(%rdi),%rdi
leaq 8(%rsi),%rsi
jmp 1f
/*
* Mismatch was found. We have no more than 8 bytes to inspect.
*/
ALIGN_TEXT
1:
movzbl (%rdi),%eax
movzbl (%rsi),%r8d
cmpb %r8b,%al
jne 2f
movzbl 1(%rdi),%eax
movzbl 1(%rsi),%r8d
cmpb %r8b,%al
jne 2f
movzbl 2(%rdi),%eax
movzbl 2(%rsi),%r8d
cmpb %r8b,%al
jne 2f
movzbl 3(%rdi),%eax
movzbl 3(%rsi),%r8d
cmpb %r8b,%al
jne 2f
movzbl 4(%rdi),%eax
movzbl 4(%rsi),%r8d
cmpb %r8b,%al
jne 2f
movzbl 5(%rdi),%eax
movzbl 5(%rsi),%r8d
cmpb %r8b,%al
jne 2f
movzbl 6(%rdi),%eax
movzbl 6(%rsi),%r8d
cmpb %r8b,%al
jne 2f
movzbl 7(%rdi),%eax
movzbl 7(%rsi),%r8d
cmpb %r8b,%al
jne 2f
xorl %eax,%eax
ret
2:
subl %r8d,%eax
ret
END(memcmp)
.section .note.GNU-stack,"",%progbits

View File

@ -35,8 +35,6 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
@ -276,7 +274,6 @@ _filldir(DIR *dirp, bool use_current_pos)
static bool
is_unionstack(int fd)
{
struct statfs sfb;
int unionstack;
unionstack = _fcntl(fd, F_ISUNIONSTACK, 0);
@ -284,12 +281,10 @@ is_unionstack(int fd)
return (unionstack);
/*
* Temporary compat for kernels which don't provide F_ISUNIONSTACK.
* Should not happen unless running on a kernel without the op,
* but no use rendering the system useless in such a case.
*/
if (_fstatfs(fd, &sfb) < 0)
return (true);
return (strcmp(sfb.f_fstypename, "unionfs") == 0 ||
(sfb.f_flags & MNT_UNION));
return (0);
}
/*

View File

@ -332,6 +332,8 @@ fetch_pctdecode(char *dst, const char *src, size_t dlen)
}
if (dlen-- > 0)
*dst++ = c;
else
return (NULL);
}
return (s);
}
@ -381,11 +383,15 @@ fetchParseURL(const char *URL)
if (p && *p == '@') {
/* username */
q = fetch_pctdecode(u->user, URL, URL_USERLEN);
if (q == NULL)
goto ouch;
/* password */
if (*q == ':')
if (*q == ':') {
q = fetch_pctdecode(u->pwd, q + 1, URL_PWDLEN);
if (q == NULL)
goto ouch;
}
p++;
} else {
p = URL;

View File

@ -35,18 +35,22 @@
#include <sys/resource.h> /* getrlimit */
#include <sys/stat.h>
#include <sys/time.h> /* getrlimit */
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fts.h>
#include <ftw.h>
#include <libgen.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ftw.h>
#include "list.h"
#include "jsmn.h"
#include "json.h"
@ -56,12 +60,11 @@ static int
nftw_ordered(const char *path, int (*fn)(const char *, const struct stat *, int,
struct FTW *), int nfds, int ftwflags);
_Noreturn void _Exit(int);
int verbose;
static char *prog;
int eprintf(int level, int var, const char *fmt, ...)
int
eprintf(int level, int var, const char *fmt, ...)
{
int ret;
@ -79,13 +82,14 @@ int eprintf(int level, int var, const char *fmt, ...)
return ret;
}
__attribute__((weak)) char *get_cpu_str(void)
__attribute__((weak)) char *
get_cpu_str(void)
{
return NULL;
}
static void addfield(char *map, char **dst, const char *sep,
const char *a, jsmntok_t *bt)
static void
addfield(char *map, char **dst, const char *sep, const char *a, jsmntok_t *bt)
{
unsigned int len = strlen(a) + 1 + strlen(sep);
int olen = *dst ? strlen(*dst) : 0;
@ -108,13 +112,15 @@ static void addfield(char *map, char **dst, const char *sep,
strncat(*dst, map + bt->start, blen);
}
static void fixname(char *s)
static void
fixname(char *s)
{
for (; *s; s++)
*s = tolower(*s);
}
static void fixdesc(char *s)
static void
fixdesc(char *s)
{
char *e = s + strlen(s);
@ -127,7 +133,8 @@ static void fixdesc(char *s)
}
/* Add escapes for '\' so they are proper C strings. */
static char *fixregex(char *s)
static char *
fixregex(char *s)
{
int len = 0;
int esc_count = 0;
@ -191,7 +198,8 @@ static struct field {
{ NULL, NULL }
};
static void cut_comma(char *map, jsmntok_t *newval)
static void
cut_comma(char *map, jsmntok_t *newval)
{
int i;
@ -202,8 +210,8 @@ static void cut_comma(char *map, jsmntok_t *newval)
}
}
static int match_field(char *map, jsmntok_t *field, int nz,
char **event, jsmntok_t *val)
static int
match_field(char *map, jsmntok_t *field, int nz, char **event, jsmntok_t *val)
{
struct field *f;
jsmntok_t newval = *val;
@ -217,7 +225,8 @@ static int match_field(char *map, jsmntok_t *field, int nz,
return 0;
}
static struct msrmap *lookup_msr(char *map, jsmntok_t *val)
static struct msrmap *
lookup_msr(char *map, jsmntok_t *val)
{
jsmntok_t newval = *val;
static bool warned;
@ -246,7 +255,8 @@ static struct map {
{}
};
static const char *field_to_perf(struct map *table, char *map, jsmntok_t *val)
static const char *
field_to_perf(struct map *table, char *map, jsmntok_t *val)
{
int i;
@ -270,7 +280,8 @@ static const char *field_to_perf(struct map *table, char *map, jsmntok_t *val)
static char *topic;
static char *get_topic(void)
static char *
get_topic(void)
{
char *tp;
int i;
@ -296,7 +307,8 @@ static char *get_topic(void)
return tp;
}
static int add_topic(const char *bname)
static int
add_topic(const char *bname)
{
free(topic);
topic = strdup(bname);
@ -315,17 +327,17 @@ struct perf_entry_data {
static int close_table;
static void print_events_table_prefix(FILE *fp, const char *tblname)
static void
print_events_table_prefix(FILE *fp, const char *tblname)
{
fprintf(fp, "static struct pmu_event %s[] = {\n", tblname);
close_table = 1;
}
static int print_events_table_entry(void *data, char *name, const char *event,
char *desc, char *long_desc,
char *pmu, char *unit, char *perpkg,
char *metric_expr,
char *metric_name, char *metric_group)
static int
print_events_table_entry(void *data, char *name, const char *event, char *desc,
char *long_desc, char *pmu, char *unit, char *perpkg, char *metric_expr,
char *metric_name, char *metric_group)
{
struct perf_entry_data *pd = data;
FILE *outfp = pd->outfp;
@ -405,7 +417,8 @@ struct event_struct {
static LIST_HEAD(arch_std_events);
static void free_arch_std_events(void)
static void
free_arch_std_events(void)
{
struct event_struct *es, *next;
@ -416,10 +429,10 @@ static void free_arch_std_events(void)
}
}
static int save_arch_std_events(void *data __unused, char *name, const char *event,
char *desc, char *long_desc, char *pmu,
char *unit, char *perpkg, char *metric_expr,
char *metric_name, char *metric_group)
static int
save_arch_std_events(void *data __unused, char *name, const char *event,
char *desc, char *long_desc, char *pmu, char *unit, char *perpkg,
char *metric_expr, char *metric_name, char *metric_group)
{
struct event_struct *es;
@ -436,7 +449,8 @@ static int save_arch_std_events(void *data __unused, char *name, const char *eve
return -ENOMEM;
}
static void print_events_table_suffix(FILE *outfp)
static void
print_events_table_suffix(FILE *outfp)
{
fprintf(outfp, "{\n");
@ -464,7 +478,8 @@ static struct fixed {
/*
* Handle different fixed counter encodings between JSON and perf.
*/
static const char *real_event(const char *name, char *event)
static const char *
real_event(const char *name, char *event)
{
int i;
@ -479,9 +494,9 @@ static const char *real_event(const char *name, char *event)
static int
try_fixup(const char *fn, char *arch_std, char **event, char **desc,
char **name, char **long_desc, char **pmu, char **filter __unused,
char **perpkg, char **unit, char **metric_expr, char **metric_name,
char **metric_group, unsigned long long eventcode)
char **name, char **long_desc, char **pmu, char **filter __unused,
char **perpkg, char **unit, char **metric_expr, char **metric_name,
char **metric_group, unsigned long long eventcode)
{
/* try to find matching event from arch standard values */
struct event_struct *es;
@ -504,7 +519,8 @@ try_fixup(const char *fn, char *arch_std, char **event, char **desc,
}
/* Call func with each event in the json file */
int json_events(const char *fn,
int
json_events(const char *fn,
int (*func)(void *data, char *name, const char *event, char *desc,
char *long_desc,
char *pmu, char *unit, char *perpkg,
@ -692,7 +708,8 @@ int json_events(const char *fn,
return err;
}
static char *file_name_to_table_name(const char *fname)
static char *
file_name_to_table_name(const char *fname)
{
unsigned int i;
int n;
@ -734,12 +751,14 @@ static char *file_name_to_table_name(const char *fname)
return tblname;
}
static void print_mapping_table_prefix(FILE *outfp)
static void
print_mapping_table_prefix(FILE *outfp)
{
fprintf(outfp, "struct pmu_events_map pmu_events_map[] = {\n");
}
static void print_mapping_table_suffix(FILE *outfp)
static void
print_mapping_table_suffix(FILE *outfp)
{
/*
* Print the terminating, NULL entry.
@ -755,7 +774,8 @@ static void print_mapping_table_suffix(FILE *outfp)
fprintf(outfp, "};\n");
}
static int process_mapfile(FILE *outfp, char *fpath)
static int
process_mapfile(FILE *outfp, char *fpath)
{
int n = 16384;
FILE *mapfp;
@ -838,7 +858,8 @@ static int process_mapfile(FILE *outfp, char *fpath)
* table. This would at least allow perf to build even if we can't find/use
* the aliases.
*/
static void create_empty_mapping(const char *output_file)
static void
create_empty_mapping(const char *output_file)
{
FILE *outfp;
@ -857,7 +878,8 @@ static void create_empty_mapping(const char *output_file)
fclose(outfp);
}
static int get_maxfds(void)
static int
get_maxfds(void)
{
struct rlimit rlim;
@ -877,7 +899,8 @@ static int get_maxfds(void)
static FILE *eventsfp;
static char *mapfile;
static int is_leaf_dir(const char *fpath)
static int
is_leaf_dir(const char *fpath)
{
DIR *d;
struct dirent *dir;
@ -898,7 +921,8 @@ static int is_leaf_dir(const char *fpath)
char path[PATH_MAX];
struct stat st;
sprintf(path, "%s/%s", fpath, dir->d_name);
snprintf(path, sizeof(path), "%s/%s", fpath,
dir->d_name);
if (stat(path, &st))
break;
@ -914,7 +938,8 @@ static int is_leaf_dir(const char *fpath)
return res;
}
static int is_json_file(const char *name)
static int
is_json_file(const char *name)
{
const char *suffix;
@ -928,8 +953,9 @@ static int is_json_file(const char *name)
return 0;
}
static int preprocess_arch_std_files(const char *fpath, const struct stat *sb,
int typeflag, struct FTW *ftwbuf)
static int
preprocess_arch_std_files(const char *fpath, const struct stat *sb,
int typeflag, struct FTW *ftwbuf)
{
int level = ftwbuf->level;
int is_file = typeflag == FTW_F;
@ -940,8 +966,9 @@ static int preprocess_arch_std_files(const char *fpath, const struct stat *sb,
return 0;
}
static int process_one_file(const char *fpath, const struct stat *sb,
int typeflag, struct FTW *ftwbuf)
static int
process_one_file(const char *fpath, const struct stat *sb, int typeflag,
struct FTW *ftwbuf)
{
char *tblname;
const char *bname;
@ -1054,10 +1081,6 @@ static int process_one_file(const char *fpath, const struct stat *sb,
return err;
}
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
/*
* Starting in directory 'start_dirname', find the "mapfile.csv" and
* the set of JSON files for the architecture 'arch'.
@ -1070,7 +1093,8 @@ static int process_one_file(const char *fpath, const struct stat *sb,
*
* Write out the PMU events tables and the mapping table to pmu-event.c.
*/
int main(int argc, char *argv[])
int
main(int argc, char *argv[])
{
int rc;
int maxfds;
@ -1101,7 +1125,7 @@ int main(int argc, char *argv[])
return 2;
}
sprintf(ldirname, "%s/%s", start_dirname, arch);
snprintf(ldirname, sizeof(ldirname), "%s/%s", start_dirname, arch);
/* If architecture does not have any event lists, bail out */
if (stat(ldirname, &stbuf) < 0) {
@ -1172,8 +1196,6 @@ int main(int argc, char *argv[])
return 0;
}
#include <fts.h>
static int
fts_compare(const FTSENT * const *a, const FTSENT * const *b)
{

View File

@ -0,0 +1,31 @@
#
# $FreeBSD$
#
name = "FreeBSD-%PKGNAME%"
origin = "base"
version = "%VERSION%"
comment = "%COMMENT%"
categories = [ base ]
maintainer = "re@FreeBSD.org"
www = "https://www.FreeBSD.org"
prefix = "/"
licenselogic = "single"
licenses = [ BSD2CLAUSE ]
desc = <<EOD
%DESC%
EOD
deps: {
FreeBSD-%PKGDEPS%: {
origin: "base",
version: "%VERSION%"
}
}
scripts: {
# XXX If pkg picks up a mechanism to detect in the post-install script
# files being added or removed, we should use it instead to gate the
# rehash.
post-install = <<EOD
[ -x /usr/sbin/certctl ] && /usr/sbin/certctl rehash
EOD
}

View File

@ -1,17 +0,0 @@
#
# $FreeBSD$
#
name = "FreeBSD-%PKGNAME%"
origin = "base"
version = "%VERSION%"
comment = "%COMMENT%"
categories = [ base ]
maintainer = "re@FreeBSD.org"
www = "https://www.FreeBSD.org"
prefix = "/"
licenselogic = "single"
licenses = [ BSD2CLAUSE ]
desc = <<EOD
%DESC%
EOD

View File

@ -1,17 +0,0 @@
#
# $FreeBSD$
#
name = "FreeBSD-%PKGNAME%"
origin = "base"
version = "%VERSION%"
comment = "%COMMENT%"
categories = [ base ]
maintainer = "re@FreeBSD.org"
www = "https://www.FreeBSD.org"
prefix = "/"
licenselogic = "single"
licenses = [ BSD2CLAUSE ]
desc = <<EOD
%DESC%
EOD

View File

@ -34,6 +34,9 @@ main() {
outname="$(echo ${outname} | tr '-' '_')"
case "${outname}" in
caroot)
pkgdeps="utilities"
;;
runtime)
outname="runtime"
uclfile="${uclfile}"

View File

@ -41,6 +41,9 @@ vm_extra_pre_umount() {
# The console is not interactive, so we might as well boot quickly.
echo 'autoboot_delay="-1"' >> ${DESTDIR}/boot/loader.conf
echo 'beastie_disable="YES"' >> ${DESTDIR}/boot/loader.conf
echo 'boot_multicons="YES"' >> ${DESTDIR}/boot/loader.conf
echo 'console="comconsole vidconsole"' >> ${DESTDIR}/boot/loader.conf
echo 'comconsole_speed="115200"' >> ${DESTDIR}/boot/loader.conf
# Reboot quickly, Don't wait at the panic screen
echo 'debug.trace_on_panic=1' >> ${DESTDIR}/etc/sysctl.conf

View File

@ -1,7 +1,5 @@
# $FreeBSD$
PACKAGE= caroot
CLEANFILES+= certdata.txt
SUBDIR+= trusted

View File

@ -0,0 +1,3 @@
# $FreeBSD$
PACKAGE= caroot

View File

@ -2,6 +2,8 @@
BINDIR= /usr/share/certs/blacklisted
FILES=
BLACKLISTED_CERTS!= ls ${.CURDIR}/*.pem 2> /dev/null || true
FILES+= ${BLACKLISTED_CERTS}
.include <bsd.prog.mk>

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd April 19, 2014
.Dd January 27, 2020
.Dt UMASS 4
.Os
.Sh NAME
@ -73,114 +73,6 @@ requires
and
.Xr scbus 4
to be included in the kernel.
.Sh HARDWARE
The
.Nm
driver supports USB Mass Storage devices, including:
.Pp
.Bl -bullet -compact
.It
ADTEC Stick Drive AD-UST32M, 64M, 128M, 256M
.It
Denno FireWire/USB2 Removable 2.5-inch HDD Case MIFU-25CB20
.It
FujiFilm Zip USB Drive ZDR100 USB A
.It
GREEN HOUSE USB Flash Memory "PicoDrive" GH-UFD32M, 64M, 128M
.It
Huawei Mobile (SD slot)
.It
IBM 32MB USB Memory Key (P/N 22P5296)
.It
IBM 256MB USB Drive (MSYSTEM DiskOnKey2)
.It
IBM ThinkPad USB Portable CD-ROM Drive (P/N 33L5151)
.It
I-O DATA USB CD/CD-R/CD-RW/DVD-R/DVD-RW/DVD-RAM/DVD-ROM Drive DVR-iUH2 (CDROM, DVD-RAM only)
.It
I-O DATA USB x6 CD-RW Drive CDRW-i64/USB (CDROM only)
.It
I-O DATA USB/IEEE1394 Portable HD Drive HDP-i30P/CI, HDP-i40P/CI
.It
Iomega USB Zip 100/250 drive
.It
Iomega Zip750 USB2.0 drive
.It
Keian USB1.1/2.0 3.5-inch HDD Case KU350A
.It
Kurouto Shikou USB 2.5-inch HDD Case GAWAP2.5PS-USB2.0
.It
LaCie P3 HardDrive USB 200GB
.It
Logitec LDR-H443U2 DVD-RAM/-R/+R/-RW/+RW drive
.It
Logitec Mobile USB Memory LMC-256UD
.It
Logitec USB1.1/2.0 HDD Unit SHD-E60U2
.It
Logitec USB Double-Speed Floppy Drive LFD-31U2
.It
Logitec USB/IEEE1394 DVD-RAM/R/RW Unit LDR-N21FU2 (CDROM only)
.It
MELCO USB Flash Disk "ClipDrive", RUF-C32M, -C64M, -C128M, -C256M, -C512M
.It
MELCO USB Flash Disk "PetitDrive", RUF-32M, -64M, -128M, -256Mm
.It
MELCO USB2.0 Flash Disk "PetitDrive2", RUF-256M/U2, -512M/U2
.It
MELCO USB2.0 MO Drive MO-CH640U2
.It
Matshita CF-VFDU03 floppy drive
.It
Merlin SM300 MP3/WMA Player (256Mb)
.It
Microtech International, Inc.\& USB-SCSI-HD 50 USB to SCSI cable
.It
Motorola E398 Mobile Phone (TransFlash memory card)
.It
NOVAC USB2.0 2.5/3.5-inch HDD Case NV-HD351U
.It
PNY Attache Flash Drive
.It
Panasonic ("Matshita FDD CF-VFDU03")
.It
Panasonic KXL-CB20AN Portable DVD-ROM/CD-R/RW
.It
Panasonic KXL-CB35AN (DVD-ROM & CD-R/RW)
.It
Panasonic USB2.0 Portable CD-RW Drive KXL-RW40AN (CDROM only)
.It
Panasonic floppy drive
.It
Qware BeatZkey!\& Pro
.It
RATOC Systems USB2.0 Removable HDD Case U2-MDK1, U2-MDK1B
.It
SanDisk SDDR-31 (Compact Flash)
.It
SanDisk SDDR-75 (only Compact Flash port works)
.It
Sitecom CN-300 MultiFlash (MMC/SD, SmartMedia, CF, MemoryStick)
.It
Sony Portable CD-R/RW Drive CRX10U (CDROM only)
.It
TEAC Portable USB CD-ROM Unit CD-110PU/210PU
.It
Time DPA20B MP3 Player (1Gb)
.It
Trek Thumbdrive 8MB
.It
VAIO floppy drive (includes Y-E Data Flashbuster-U)
.It
Y-E Data floppy drive (720/1.44/2.88Mb)
.El
.Pp
Among the supported digital cameras are:
.Pp
.Bl -bullet -compact
.It
Asahi Optical (PENTAX) Optio 230 & 330
.El
.Sh EXAMPLES
.Bd -literal -offset indent
device umass
@ -193,11 +85,6 @@ Add the
.Nm
driver to the kernel.
.Pp
.Dl "camcontrol rescan 0"
.Pp
Rescan a Zip drive that was added after boot.
The command above
assumes that the Zip drive is on the first SCSI bus in the system.
.Bd -literal -offset indent
camcontrol rescan 0:0:0
camcontrol rescan 0:0:1
@ -208,46 +95,14 @@ camcontrol rescan 0:0:3
Rescan all slots on a multi-slot flash reader, where the slots map to separate
LUNs on a single SCSI ID.
Typically only the first slot will be enabled at boot time.
Again, this assumes that the flash reader is the first SCSI bus in the system.
.Bd -literal -offset indent
bsdlabel -w da0 zip100
newfs da0c
mount -t ufs /dev/da0c /mnt
.Ed
.Pp
Write a disklabel to the Zip drive (see
.Xr vpo 4
for the
.Xr disktab 5
entry), creates the file system and mounts the new file system on /mnt.
.Pp
.Dl "newfs_msdos /dev/da0"
.Pp
Create a new FAT type file system.
Care should be taken not to run
.Xr newfs 8
on devices that already contain data, as this will result in the
information being lost.
.Pp
Many consumer devices such as digital cameras automatically create
.Tn MS-DOS
based file systems when storing information such as images and
videos.
These file systems can be accessed by specifying the file system
type as
.Cm msdosfs
when using
.Xr mount 8 .
This assumes that the flash reader is the first SCSI bus in the system and has 4 slots.
.Sh SEE ALSO
.Xr cfumass 4 ,
.Xr ehci 4 ,
.Xr ohci 4 ,
.Xr uhci 4 ,
.Xr usb 4 ,
.Xr vpo 4 ,
.Xr xhci 4 ,
.Xr disktab 5 ,
.Xr bsdlabel 8 ,
.Xr camcontrol 8
.\".Sh HISTORY
.Sh AUTHORS

View File

@ -105,6 +105,7 @@ adrian [label="Adrian Chadd\nadrian@FreeBSD.org\n2000/07/03"]
ae [label="Andrey V. Elsukov\nae@FreeBSD.org\n2010/06/03"]
akiyama [label="Shunsuke Akiyama\nakiyama@FreeBSD.org\n2000/06/19"]
alc [label="Alan Cox\nalc@FreeBSD.org\n1999/02/23"]
alfredo [label="Alfredo Dal'Ava Junior\nalfredo@FreeBSD.org\n2020/01/27"]
allanjude [label="Allan Jude\nallanjude@FreeBSD.org\n2015/07/30"]
ambrisko [label="Doug Ambrisko\nambrisko@FreeBSD.org\n2001/12/19"]
anchie [label="Ana Kukec\nanchie@FreeBSD.org\n2010/04/14"]
@ -613,6 +614,7 @@ jhb -> rpokala
jhb -> arichardson
jhb -> scottph
jhibbits -> alfredo
jhibbits -> bdragon
jhibbits -> leitao
jhibbits -> luporl

View File

@ -111,92 +111,191 @@ END(sse2_pagezero)
*/
ENTRY(memcmp)
PUSH_FRAME_POINTER
xorl %eax,%eax
10:
cmpq $16,%rdx
jae 5f
ja 101632f
100816:
cmpb $8,%dl
jl 100408f
movq (%rdi),%r8
movq (%rsi),%r9
cmpq %r8,%r9
jne 1f
movq -8(%rdi,%rdx),%r8
movq -8(%rsi,%rdx),%r9
cmpq %r8,%r9
jne 10081608f
POP_FRAME_POINTER
ret
100408:
cmpb $4,%dl
jl 100204f
movl (%rsi),%r8d
movl (%rdi),%r9d
cmpl %r8d,%r9d
jne 1f
movl -4(%rsi,%rdx),%r8d
movl -4(%rdi,%rdx),%r9d
cmpl %r8d,%r9d
jne 1f
POP_FRAME_POINTER
ret
100204:
cmpb $2,%dl
jl 100001f
movzwl (%rsi),%r8d
movzwl (%rdi),%r9d
cmpl %r8d,%r9d
jne 1f
movzwl -2(%rsi,%rdx),%r8d
movzwl -2(%rdi,%rdx),%r9d
cmpl %r8d,%r9d
jne 1f
POP_FRAME_POINTER
ret
100001:
cmpb $1,%dl
jl 100000f
movzbl (%rdi),%r8d
movzbl (%rsi),%r9d
cmpb %r8b,%r9b
jne 1f
100000:
POP_FRAME_POINTER
ret
ALIGN_TEXT
101632:
cmpq $32,%rdx
ja 103200f
movq (%rdi),%r8
movq (%rsi),%r9
cmpq %r8,%r9
jne 1f
movq 8(%rdi),%r8
movq 8(%rsi),%r9
cmpq %r8,%r9
jne 10163208f
movq -16(%rdi,%rdx),%r8
movq -16(%rsi,%rdx),%r9
cmpq %r8,%r9
jne 10163216f
movq -8(%rdi,%rdx),%r8
movq -8(%rsi,%rdx),%r9
cmpq %r8,%r9
jne 10163224f
POP_FRAME_POINTER
ret
ALIGN_TEXT
103200:
movq (%rdi),%r8
movq 8(%rdi),%r9
subq (%rsi),%r8
subq 8(%rsi),%r9
or %r8,%r9
jnz 10320000f
movq 16(%rdi),%r8
movq 24(%rdi),%r9
subq 16(%rsi),%r8
subq 24(%rsi),%r9
or %r8,%r9
jnz 10320016f
leaq 32(%rdi),%rdi
leaq 32(%rsi),%rsi
subq $32,%rdx
cmpq $32,%rdx
jae 103200b
cmpb $0,%dl
jne 10b
POP_FRAME_POINTER
ret
10320016:
leaq 16(%rdi),%rdi
leaq 16(%rsi),%rsi
10320000:
/*
* Mismatch was found within a 16 bytes range. The part of the routine
* which calculates it only operates on sizes up to 8 bytes. Find the
* right part.
*/
movq (%rdi),%r8
movq (%rsi),%r9
cmpq %r8,%r9
jne 1f
leaq 8(%rdi),%rdi
leaq 8(%rsi),%rsi
jmp 1f
10163224:
leaq -8(%rdi,%rdx),%rdi
leaq -8(%rsi,%rdx),%rsi
jmp 1f
10163216:
leaq -16(%rdi,%rdx),%rdi
leaq -16(%rsi,%rdx),%rsi
jmp 1f
10163208:
10081608:
leaq 8(%rdi),%rdi
leaq 8(%rsi),%rsi
jmp 1f
/*
* Mismatch was found. We have no more than 8 bytes to inspect.
*/
ALIGN_TEXT
1:
testq %rdx,%rdx
je 3f
xorl %ecx,%ecx
2:
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%r8d
movzbl (%rdi),%eax
movzbl (%rsi),%r8d
cmpb %r8b,%al
jne 4f
addq $1,%rcx
cmpq %rcx,%rdx
jz 3f
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%r8d
jne 2f
movzbl 1(%rdi),%eax
movzbl 1(%rsi),%r8d
cmpb %r8b,%al
jne 4f
addq $1,%rcx
cmpq %rcx,%rdx
jz 3f
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%r8d
jne 2f
movzbl 2(%rdi),%eax
movzbl 2(%rsi),%r8d
cmpb %r8b,%al
jne 4f
addq $1,%rcx
cmpq %rcx,%rdx
jz 3f
movzbl (%rdi,%rcx,1),%eax
movzbl (%rsi,%rcx,1),%r8d
jne 2f
movzbl 3(%rdi),%eax
movzbl 3(%rsi),%r8d
cmpb %r8b,%al
jne 4f
addq $1,%rcx
cmpq %rcx,%rdx
jne 2b
3:
jne 2f
movzbl 4(%rdi),%eax
movzbl 4(%rsi),%r8d
cmpb %r8b,%al
jne 2f
movzbl 5(%rdi),%eax
movzbl 5(%rsi),%r8d
cmpb %r8b,%al
jne 2f
movzbl 6(%rdi),%eax
movzbl 6(%rsi),%r8d
cmpb %r8b,%al
jne 2f
movzbl 7(%rdi),%eax
movzbl 7(%rsi),%r8d
cmpb %r8b,%al
jne 2f
xorl %eax,%eax
POP_FRAME_POINTER
ret
4:
2:
subl %r8d,%eax
POP_FRAME_POINTER
ret
5:
cmpq $32,%rdx
jae 7f
6:
/*
* 8 bytes
*/
movq (%rdi),%r8
movq (%rsi),%r9
cmpq %r8,%r9
jne 1b
leaq 8(%rdi),%rdi
leaq 8(%rsi),%rsi
subq $8,%rdx
cmpq $8,%rdx
jae 6b
jl 1b
jmp 3b
7:
/*
* 32 bytes
*/
movq (%rsi),%r8
movq 8(%rsi),%r9
subq (%rdi),%r8
subq 8(%rdi),%r9
or %r8,%r9
jnz 1b
movq 16(%rsi),%r8
movq 24(%rsi),%r9
subq 16(%rdi),%r8
subq 24(%rdi),%r9
or %r8,%r9
jnz 1b
leaq 32(%rdi),%rdi
leaq 32(%rsi),%rsi
subq $32,%rdx
cmpq $32,%rdx
jae 7b
jnz 1b
jmp 3b
END(memcmp)
/*

View File

@ -213,33 +213,11 @@ aw_mmc_cam_action(struct cam_sim *sim, union ccb *ccb)
switch (ccb->ccb_h.func_code) {
case XPT_PATH_INQ:
{
struct ccb_pathinq *cpi;
cpi = &ccb->cpi;
cpi->version_num = 1;
cpi->hba_inquiry = 0;
cpi->target_sprt = 0;
cpi->hba_misc = PIM_NOBUSRESET | PIM_SEQSCAN;
cpi->hba_eng_cnt = 0;
cpi->max_target = 0;
cpi->max_lun = 0;
cpi->initiator_id = 1;
cpi->maxio = (sc->aw_mmc_conf->dma_xferlen *
AW_MMC_DMA_SEGS) / MMC_SECTOR_SIZE;
strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
strncpy(cpi->hba_vid, "Deglitch Networks", HBA_IDLEN);
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
cpi->unit_number = cam_sim_unit(sim);
cpi->bus_id = cam_sim_bus(sim);
cpi->protocol = PROTO_MMCSD;
cpi->protocol_version = SCSI_REV_0;
cpi->transport = XPORT_MMCSD;
cpi->transport_version = 1;
cpi->ccb_h.status = CAM_REQ_CMP;
mmc_path_inq(&ccb->cpi, "Deglitch Networks", sim,
(sc->aw_mmc_conf->dma_xferlen * AW_MMC_DMA_SEGS) /
MMC_SECTOR_SIZE);
break;
}
case XPT_GET_TRAN_SETTINGS:
{
struct ccb_trans_settings *cts = &ccb->cts;

View File

@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$");
/* GATES */
#define SCLK_USB3OTG_REF 96
#define ACLK_USB3OTG 132
#define ACLK_PERI 153
#define PCLK_GPIO0 200
#define PCLK_GPIO1 201
@ -61,6 +63,9 @@ __FBSDID("$FreeBSD$");
#define PCLK_I2C2 207
#define PCLK_I2C3 208
#define PCLK_TSADC 213
#define PCLK_USB3PHY_OTG 224
#define PCLK_USB3PHY_PIPE 225
#define PCLK_USB3_GRF 226
#define HCLK_SDMMC 317
#define HCLK_SDIO 318
#define HCLK_EMMC 319
@ -76,6 +81,7 @@ static struct rk_cru_gate rk3328_gates[] = {
/* CRU_CLKGATE_CON4 */
CRU_GATE(0, "gpll_peri", "gpll", 0x210, 0)
CRU_GATE(0, "cpll_peri", "cpll", 0x210, 1)
CRU_GATE(SCLK_USB3OTG_REF, "clk_usb3otg_ref", "xin24m", 0x210, 7)
/* CRU_CLKGATE_CON8 */
CRU_GATE(0, "pclk_bus", "pclk_bus_pre", 0x220, 3)
@ -98,13 +104,21 @@ static struct rk_cru_gate rk3328_gates[] = {
CRU_GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_bus", 0x240, 9)
CRU_GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_bus", 0x240, 10)
/* CRU_CLKGATE_CON17 */
CRU_GATE(PCLK_USB3_GRF, "pclk_usb3_grf", "pclk_phy_pre", 0x244, 2)
/* CRU_CLKGATE_CON19 */
CRU_GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0x24C, 0)
CRU_GATE(HCLK_SDIO, "hclk_sdio", "hclk_peri", 0x24C, 1)
CRU_GATE(HCLK_EMMC, "hclk_emmc", "hclk_peri", 0x24C, 2)
CRU_GATE(0, "hclk_peri_niu", "hclk_peri", 0x24C, 12)
CRU_GATE(0, "pclk_peri_niu", "hclk_peri", 0x24C, 13)
CRU_GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0x24C, 14)
CRU_GATE(HCLK_SDMMC_EXT, "hclk_sdmmc_ext", "hclk_peri", 0x24C, 15)
/* CRU_CLKGATE_CON28 */
CRU_GATE(PCLK_USB3PHY_OTG, "pclk_usb3phy_otg", "pclk_phy_pre", 0x270, 1)
CRU_GATE(PCLK_USB3PHY_PIPE, "pclk_usb3phy_pipe", "pclk_phy_pre", 0x270, 2)
};
/*
@ -991,6 +1005,78 @@ static struct rk_clk_composite_def i2c3 = {
.flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
};
#define SCLK_USB3_REF 72
#define SCLK_USB3_SUSPEND 73
#define SCLK_USB3PHY_REF 94
#define SCLK_REF_USB3OTG 95
#define SCLK_USB3OTG_SUSPEND 97
#define SCLK_REF_USB3OTG_SRC 98
static const char *ref_usb3otg_parents[] = { "xin24m", "clk_usb3otg_ref" };
static struct rk_clk_composite_def ref_usb3otg = {
.clkdef = {
.id = SCLK_REF_USB3OTG,
.name = "clk_ref_usb3otg",
.parent_names = ref_usb3otg_parents,
.parent_cnt = nitems(ref_usb3otg_parents),
},
.muxdiv_offset = 0x1B4,
.mux_shift = 8,
.mux_width = 1,
.flags = RK_CLK_COMPOSITE_HAVE_MUX,
};
static const char *usb3otg_suspend_parents[] = { "xin24m"/*, "clk_rtc32k" */};
static struct rk_clk_composite_def usb3otg_suspend = {
.clkdef = {
.id = SCLK_USB3OTG_SUSPEND,
.name = "clk_usb3otg_suspend",
.parent_names = usb3otg_suspend_parents,
.parent_cnt = nitems(usb3otg_suspend_parents),
},
.muxdiv_offset = 0x184,
.mux_shift = 15,
.mux_width = 1,
.div_shift = 0,
.div_width = 10,
/* CRU_CLKGATE_CON4 */
.gate_offset = 0x210,
.gate_shift = 8,
.flags = RK_CLK_COMPOSITE_HAVE_GATE,
};
static const char *ref_usb3otg_src_parents[] = { "cpll", "gpll" };
static struct rk_clk_composite_def ref_usb3otg_src = {
.clkdef = {
.id = SCLK_REF_USB3OTG_SRC,
.name = "clk_ref_usb3otg_src",
.parent_names = ref_usb3otg_src_parents,
.parent_cnt = nitems(ref_usb3otg_src_parents),
},
.muxdiv_offset = 0x1B4,
.mux_shift = 7,
.mux_width = 1,
.div_shift = 0,
.div_width = 7,
/* CRU_CLKGATE_CON4 */
.gate_offset = 0x210,
.gate_shift = 9,
.flags = RK_CLK_COMPOSITE_HAVE_GATE,
};
static struct rk_clk rk3328_clks[] = {
{
.type = RK3328_CLK_PLL,
@ -1076,6 +1162,19 @@ static struct rk_clk rk3328_clks[] = {
.type = RK_CLK_COMPOSITE,
.clk.composite = &i2c3
},
{
.type = RK_CLK_COMPOSITE,
.clk.composite = &ref_usb3otg
},
{
.type = RK_CLK_COMPOSITE,
.clk.composite = &ref_usb3otg_src
},
{
.type = RK_CLK_COMPOSITE,
.clk.composite = &usb3otg_suspend
},
};
static int

View File

@ -54,8 +54,14 @@ __FBSDID("$FreeBSD$");
#include <dev/extres/phy/phy_usb.h>
#include <dev/extres/syscon/syscon.h>
enum rk_dwc3_type {
RK3328 = 1,
RK3399,
};
static struct ofw_compat_data compat_data[] = {
{ "rockchip,rk3399-dwc3", 1 },
{ "rockchip,rk3328-dwc3", RK3328 },
{ "rockchip,rk3399-dwc3", RK3399 },
{ NULL, 0 }
};
@ -69,6 +75,7 @@ struct rk_dwc3_softc {
clk_t clk_usb3;
clk_t clk_grf;
hwreset_t rst_usb3;
enum rk_dwc3_type type;
};
static int
@ -102,6 +109,7 @@ rk_dwc3_attach(device_t dev)
sc = device_get_softc(dev);
sc->dev = dev;
node = ofw_bus_get_node(dev);
sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
/* Mandatory clocks */
if (clk_get_by_ofw_name(dev, 0, "ref_clk", &sc->clk_ref) != 0) {
@ -134,17 +142,18 @@ rk_dwc3_attach(device_t dev)
clk_get_name(sc->clk_bus));
return (ENXIO);
}
if (clk_get_by_ofw_name(dev, 0, "grf_clk", &sc->clk_grf) != 0) {
device_printf(dev, "Cannot get grf_clk clock\n");
return (ENXIO);
if (sc->type == RK3399) {
if (clk_get_by_ofw_name(dev, 0, "grf_clk", &sc->clk_grf) != 0) {
device_printf(dev, "Cannot get grf_clk clock\n");
return (ENXIO);
}
err = clk_enable(sc->clk_grf);
if (err != 0) {
device_printf(dev, "Could not enable clock %s\n",
clk_get_name(sc->clk_grf));
return (ENXIO);
}
}
err = clk_enable(sc->clk_grf);
if (err != 0) {
device_printf(dev, "Could not enable clock %s\n",
clk_get_name(sc->clk_grf));
return (ENXIO);
}
/* Optional clocks */
if (clk_get_by_ofw_name(dev, 0, "aclk_usb3_rksoc_axi_perf", &sc->clk_axi_perf) == 0) {
err = clk_enable(sc->clk_axi_perf);

View File

@ -68,5 +68,9 @@
#include <dev/mmc/mmcreg.h>
void mmc_print_ident(struct mmc_params *ident_data);
struct ccb_pathinq;
struct cam_sim;
void mmc_path_inq(struct ccb_pathinq *cpi, const char *hba,
const struct cam_sim *sim, size_t maxio);
#endif

View File

@ -1104,3 +1104,32 @@ mmcprobe_done(struct cam_periph *periph, union ccb *done_ccb)
cam_periph_release_locked(periph);
}
}
void
mmc_path_inq(struct ccb_pathinq *cpi, const char *hba,
const struct cam_sim *sim, size_t maxio)
{
cpi->version_num = 1;
cpi->hba_inquiry = 0;
cpi->target_sprt = 0;
cpi->hba_misc = PIM_NOBUSRESET | PIM_SEQSCAN;
cpi->hba_eng_cnt = 0;
cpi->max_target = 0;
cpi->max_lun = 0;
cpi->initiator_id = 1;
cpi->maxio = maxio;
strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
strncpy(cpi->hba_vid, hba, HBA_IDLEN);
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
cpi->unit_number = cam_sim_unit(sim);
cpi->bus_id = cam_sim_bus(sim);
cpi->protocol = PROTO_MMCSD;
cpi->protocol_version = SCSI_REV_0;
cpi->transport = XPORT_MMCSD;
cpi->transport_version = 1;
cpi->base_transfer_speed = 100; /* XXX WTF? */
cpi->ccb_h.status = CAM_REQ_CMP;
}

View File

@ -1796,7 +1796,7 @@ daclose(struct disk *dp)
}
/*
* If we've got removeable media, mark the blocksize as
* If we've got removable media, mark the blocksize as
* unavailable, since it could change when new media is
* inserted.
*/

View File

@ -62,6 +62,10 @@ static unsigned linux_osd_jail_slot;
SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0, "Linux mode");
int linux_ignore_ip_recverr = 1;
SYSCTL_INT(_compat_linux, OID_AUTO, ignore_ip_recverr, CTLFLAG_RWTUN,
&linux_ignore_ip_recverr, 0, "Ignore enabling IP_RECVERR");
int linux_preserve_vstatus = 0;
SYSCTL_INT(_compat_linux, OID_AUTO, preserve_vstatus, CTLFLAG_RWTUN,
&linux_preserve_vstatus, 0, "Preserve VSTATUS termios(4) flag");

View File

@ -62,6 +62,7 @@ int linux_kernver(struct thread *td);
#define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000)
extern int linux_ignore_ip_recverr;
extern int linux_preserve_vstatus;
#endif /* _LINUX_MIB_H_ */

View File

@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
#endif
#include <compat/linux/linux_common.h>
#include <compat/linux/linux_file.h>
#include <compat/linux/linux_mib.h>
#include <compat/linux/linux_socket.h>
#include <compat/linux/linux_timer.h>
#include <compat/linux/linux_util.h>
@ -243,6 +244,8 @@ linux_to_bsd_tcp_sockopt(int opt)
return (TCP_NODELAY);
case LINUX_TCP_MAXSEG:
return (TCP_MAXSEG);
case LINUX_TCP_CORK:
return (TCP_NOPUSH);
case LINUX_TCP_KEEPIDLE:
return (TCP_KEEPIDLE);
case LINUX_TCP_KEEPINTVL:
@ -1424,6 +1427,14 @@ linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args)
}
break;
case IPPROTO_IP:
if (args->optname == LINUX_IP_RECVERR &&
linux_ignore_ip_recverr) {
/*
* XXX: This is a hack to unbreak DNS resolution
* with glibc 2.30 and above.
*/
return (0);
}
name = linux_to_bsd_ip_sockopt(args->optname);
break;
case IPPROTO_IPV6:

View File

@ -202,6 +202,7 @@ int linux_accept(struct thread *td, struct linux_accept_args *args);
#define LINUX_IP_TTL 2
#define LINUX_IP_HDRINCL 3
#define LINUX_IP_OPTIONS 4
#define LINUX_IP_RECVERR 11
#define LINUX_IP_MULTICAST_IF 32
#define LINUX_IP_MULTICAST_TTL 33
@ -236,6 +237,7 @@ int linux_accept(struct thread *td, struct linux_accept_args *args);
#define LINUX_TCP_NODELAY 1
#define LINUX_TCP_MAXSEG 2
#define LINUX_TCP_CORK 3
#define LINUX_TCP_KEEPIDLE 4
#define LINUX_TCP_KEEPINTVL 5
#define LINUX_TCP_KEEPCNT 6

View File

@ -1526,7 +1526,9 @@ linux_file_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *cred,
struct linux_file *filp;
const struct file_operations *fop;
struct linux_cdev *ldev;
int error;
struct fiodgname_arg *fgn;
const char *p;
int error, i;
error = 0;
filp = (struct linux_file *)fp->f_data;
@ -1554,6 +1556,23 @@ linux_file_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *cred,
case FIOGETOWN:
*(int *)data = fgetown(&filp->f_sigio);
break;
case FIODGNAME:
#ifdef COMPAT_FREEBSD32
case FIODGNAME_32:
#endif
if (filp->f_cdev == NULL || filp->f_cdev->cdev == NULL) {
error = ENXIO;
break;
}
fgn = data;
p = devtoname(filp->f_cdev->cdev);
i = strlen(p) + 1;
if (i > fgn->len) {
error = EINVAL;
break;
}
error = copyout(p, fiodgname_buf_get_ptr(fgn, cmd), i);
break;
default:
error = linux_file_ioctl_sub(fp, filp, fop, cmd, data, td);
break;

View File

@ -8,6 +8,11 @@
# the code here when they all produce identical results
# (or should)
.if !defined(KERNBUILDDIR)
opt_global.h:
touch ${.TARGET}
.if ${MACHINE} != "mips"
@echo "#define VIMAGE 1" >> ${.TARGET}
.endif
opt_bpf.h:
echo "#define DEV_BPF 1" > ${.TARGET}
.if ${MK_INET_SUPPORT} != "no"

View File

@ -14,6 +14,7 @@ dev/uart/uart_dev_lowrisc.c optional uart_lowrisc
dev/xilinx/axi_quad_spi.c optional xilinx_spi
dev/xilinx/axidma.c optional axidma xdma
dev/xilinx/if_xae.c optional xae
dev/xilinx/xlnx_pcib.c optional pci fdt xlnx_pcib
kern/kern_clocksource.c standard
kern/msi_if.m standard
kern/pic_if.m standard

View File

@ -106,6 +106,9 @@ NOSTDINC= -nostdinc
CFLAGS:= ${CFLAGS:N-I*} ${NOSTDINC} ${INCLMAGIC} ${CFLAGS:M-I*}
.if defined(KERNBUILDDIR)
CFLAGS+= -DHAVE_KERNEL_OPTION_HEADERS -include ${KERNBUILDDIR}/opt_global.h
.else
SRCS+= opt_global.h
CFLAGS+= -include ${.OBJDIR}/opt_global.h
.endif
# Add -I paths for system headers. Individual module makefiles don't

View File

@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
#define PCI_DEVICE_ID_AMD_15H_M60H_ROOT 0x1576
#define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450
#define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0
#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480
#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 /* Also M70H. */
struct pciid;
struct amdsmn_softc {

View File

@ -5,8 +5,7 @@
* Copyright (c) 2009 Norikatsu Shigemura <nork@FreeBSD.org>
* Copyright (c) 2009-2012 Jung-uk Kim <jkim@FreeBSD.org>
* All rights reserved.
* Copyright (c) 2017-2019 Conrad Meyer <cem@FreeBSD.org>
* All rights reserved.
* Copyright (c) 2017-2020 Conrad Meyer <cem@FreeBSD.org>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -61,7 +60,18 @@ typedef enum {
CORE1_SENSOR0,
CORE1_SENSOR1,
CORE0,
CORE1
CORE1,
CCD1,
CCD_BASE = CCD1,
CCD2,
CCD3,
CCD4,
CCD5,
CCD6,
CCD7,
CCD8,
CCD_MAX = CCD8,
NUM_CCDS = CCD_MAX - CCD_BASE + 1,
} amdsensor_t;
struct amdtemp_softc {
@ -96,7 +106,7 @@ struct amdtemp_softc {
#define DEVICEID_AMD_MISC16_M30H 0x1583
#define DEVICEID_AMD_HOSTB17H_ROOT 0x1450
#define DEVICEID_AMD_HOSTB17H_M10H_ROOT 0x15d0
#define DEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480
#define DEVICEID_AMD_HOSTB17H_M30H_ROOT 0x1480 /* Also M70h. */
static const struct amdtemp_product {
uint16_t amdtemp_vendorid;
@ -149,7 +159,15 @@ static const struct amdtemp_product {
* to -49..206C.
*/
#define AMDTEMP_17H_CUR_TMP 0x59800
#define AMDTEMP_17H_CUR_TMP_RANGE_SEL (1 << 19)
#define AMDTEMP_17H_CUR_TMP_RANGE_SEL (1u << 19)
/*
* The following register set was discovered experimentally by Ondrej Čerman
* and collaborators, but is not (yet) documented in a PPR/OSRR (other than
* the M70H PPR SMN memory map showing [0x59800, +0x314] as allocated to
* SMU::THM). It seems plausible and the Linux sensor folks have adopted it.
*/
#define AMDTEMP_17H_CCD_TMP_BASE 0x59954
#define AMDTEMP_17H_CCD_TMP_VALID (1u << 11)
/*
* AMD temperature range adjustment, in deciKelvins (i.e., 49.0 Celsius).
@ -186,6 +204,7 @@ static int32_t amdtemp_gettemp0f(device_t dev, amdsensor_t sensor);
static int32_t amdtemp_gettemp(device_t dev, amdsensor_t sensor);
static int32_t amdtemp_gettemp15hm60h(device_t dev, amdsensor_t sensor);
static int32_t amdtemp_gettemp17h(device_t dev, amdsensor_t sensor);
static void amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model);
static int amdtemp_sysctl(SYSCTL_HANDLER_ARGS);
static device_method_t amdtemp_methods[] = {
@ -485,7 +504,9 @@ amdtemp_attach(device_t dev)
dev, CORE0_SENSOR0, amdtemp_sysctl, "IK",
"Core 0 / Sensor 0 temperature");
if (sc->sc_ntemps > 1) {
if (family == 0x17)
amdtemp_probe_ccd_sensors17h(dev, model);
else if (sc->sc_ntemps > 1) {
SYSCTL_ADD_PROC(sysctlctx,
SYSCTL_CHILDREN(sysctlnode),
OID_AUTO, "sensor1", CTLTYPE_INT | CTLFLAG_RD,
@ -638,6 +659,8 @@ amdtemp_gettemp0f(device_t dev, amdsensor_t sensor)
if ((sc->sc_flags & AMDTEMP_FLAG_CS_SWAP) == 0)
temp |= AMDTEMP_TTSR_SELCORE;
break;
default:
__unreachable();
}
pci_write_config(dev, AMDTEMP_THERMTP_STAT, temp, 1);
@ -651,26 +674,46 @@ amdtemp_gettemp0f(device_t dev, amdsensor_t sensor)
}
static uint32_t
amdtemp_decode_fam10h_to_16h(int32_t sc_offset, uint32_t val)
amdtemp_decode_fam10h_to_17h(int32_t sc_offset, uint32_t val, bool minus49)
{
uint32_t temp;
/* Convert raw register subfield units (0.125C) to units of 0.1C. */
temp = ((val >> AMDTEMP_REPTMP10H_CURTMP_SHIFT) &
AMDTEMP_REPTMP10H_CURTMP_MASK) * 5 / 4;
temp = (val & AMDTEMP_REPTMP10H_CURTMP_MASK) * 5 / 4;
if (minus49)
temp -= AMDTEMP_CURTMP_RANGE_ADJUST;
temp += AMDTEMP_ZERO_C_TO_K + sc_offset * 10;
return (temp);
}
static uint32_t
amdtemp_decode_fam10h_to_16h(int32_t sc_offset, uint32_t val)
{
bool minus49;
/*
* On Family 15h and higher, if CurTmpTjSel is 11b, the range is
* adjusted down by 49.0 degrees Celsius. (This adjustment is not
* documented in BKDGs prior to family 15h model 00h.)
*/
if (CPUID_TO_FAMILY(cpu_id) >= 0x15 &&
minus49 = (CPUID_TO_FAMILY(cpu_id) >= 0x15 &&
((val >> AMDTEMP_REPTMP10H_TJSEL_SHIFT) &
AMDTEMP_REPTMP10H_TJSEL_MASK) == 0x3)
temp -= AMDTEMP_CURTMP_RANGE_ADJUST;
AMDTEMP_REPTMP10H_TJSEL_MASK) == 0x3);
temp += AMDTEMP_ZERO_C_TO_K + sc_offset * 10;
return (temp);
return (amdtemp_decode_fam10h_to_17h(sc_offset,
val >> AMDTEMP_REPTMP10H_CURTMP_SHIFT, minus49));
}
static uint32_t
amdtemp_decode_fam17h_tctl(int32_t sc_offset, uint32_t val)
{
bool minus49;
minus49 = ((val & AMDTEMP_17H_CUR_TMP_RANGE_SEL) != 0);
return (amdtemp_decode_fam10h_to_17h(sc_offset,
val >> AMDTEMP_REPTMP10H_CURTMP_SHIFT, minus49));
}
static int32_t
@ -699,16 +742,67 @@ static int32_t
amdtemp_gettemp17h(device_t dev, amdsensor_t sensor)
{
struct amdtemp_softc *sc = device_get_softc(dev);
uint32_t temp, val;
uint32_t val;
int error;
error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CUR_TMP, &val);
KASSERT(error == 0, ("amdsmn_read"));
temp = ((val >> 21) & 0x7ff) * 5 / 4;
if ((val & AMDTEMP_17H_CUR_TMP_RANGE_SEL) != 0)
temp -= AMDTEMP_CURTMP_RANGE_ADJUST;
temp += AMDTEMP_ZERO_C_TO_K + sc->sc_offset * 10;
return (temp);
switch (sensor) {
case CORE0_SENSOR0:
/* Tctl */
error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CUR_TMP, &val);
KASSERT(error == 0, ("amdsmn_read"));
return (amdtemp_decode_fam17h_tctl(sc->sc_offset, val));
case CCD_BASE ... CCD_MAX:
/* Tccd<N> */
error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CCD_TMP_BASE +
(((int)sensor - CCD_BASE) * sizeof(val)), &val);
KASSERT(error == 0, ("amdsmn_read2"));
KASSERT((val & AMDTEMP_17H_CCD_TMP_VALID) != 0,
("sensor %d: not valid", (int)sensor));
return (amdtemp_decode_fam10h_to_17h(sc->sc_offset, val, true));
default:
__unreachable();
}
}
static void
amdtemp_probe_ccd_sensors17h(device_t dev, uint32_t model)
{
char sensor_name[16], sensor_descr[32];
struct amdtemp_softc *sc;
uint32_t maxreg, i, val;
int error;
switch (model) {
case 0x00 ... 0x1f: /* Zen1, Zen+ */
maxreg = 4;
break;
case 0x30 ... 0x3f: /* Zen2 TR/Epyc */
case 0x70 ... 0x7f: /* Zen2 Ryzen */
maxreg = 8;
_Static_assert((int)NUM_CCDS >= 8, "");
break;
default:
device_printf(dev,
"Unrecognized Family 17h Model: %02xh\n", model);
return;
}
sc = device_get_softc(dev);
for (i = 0; i < maxreg; i++) {
error = amdsmn_read(sc->sc_smn, AMDTEMP_17H_CCD_TMP_BASE +
(i * sizeof(val)), &val);
if (error != 0)
continue;
if ((val & AMDTEMP_17H_CCD_TMP_VALID) == 0)
continue;
snprintf(sensor_name, sizeof(sensor_name), "ccd%u", i);
snprintf(sensor_descr, sizeof(sensor_descr),
"CCD %u temperature (Tccd%u)", i, i);
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
sensor_name, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
dev, CCD_BASE + i, amdtemp_sysctl, "IK", sensor_descr);
}
}

View File

@ -1778,16 +1778,14 @@ int bnxt_hwrm_func_rgtr_async_events(struct bnxt_softc *softc, unsigned long *bm
uint32_t *events;
int i;
async_events_bmap = bit_alloc(256, M_DEVBUF, M_WAITOK|M_ZERO);
events = (uint32_t *)async_events_bmap;
#define AE_BMAP_SZ_BITS 256
async_events_bmap = bit_alloc(AE_BMAP_SZ_BITS, M_DEVBUF, M_WAITOK);
bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_FUNC_DRV_RGTR);
req.enables =
htole32(HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_ASYNC_EVENT_FWD);
memset(async_events_bmap, 0, sizeof(256 / 8));
bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE);
bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD);
bit_set(async_events_bmap, HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED);
@ -1801,8 +1799,12 @@ int bnxt_hwrm_func_rgtr_async_events(struct bnxt_softc *softc, unsigned long *bm
}
}
for (i = 0; i < 8; i++)
#define AE_BMAP_SZ_WORDS (AE_BMAP_SZ_BITS / 8 / sizeof(uint32_t))
events = (uint32_t *)async_events_bmap;
for (i = 0; i < AE_BMAP_SZ_WORDS; i++)
req.async_event_fwd[i] |= htole32(events[i]);
#undef AE_BMAP_SZ_WORDS
#undef AE_BMAP_SZ_BITS
free(async_events_bmap, M_DEVBUF);

View File

@ -99,9 +99,10 @@ __FBSDID("$FreeBSD$");
CSUM_TCP_IPV6 | CSUM_UDP_IPV6)
static struct ofw_compat_data compat_data[] = {
{ "cadence,gem", 1 },
{ "cdns,macb", 1 },
{ NULL, 0 },
{ "cadence,gem", 1 },
{ "cdns,macb", 1 },
{ "sifive,fu540-c000-gem", 1 },
{ NULL, 0 },
};
struct cgem_softc {

View File

@ -1550,10 +1550,10 @@ ixgbe_add_hw_stats(struct adapter *adapter)
queue_list = SYSCTL_CHILDREN(queue_node);
SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_head",
CTLTYPE_UINT | CTLFLAG_RD, txr, sizeof(txr),
CTLTYPE_UINT | CTLFLAG_RD, txr, 0,
ixgbe_sysctl_tdh_handler, "IU", "Transmit Descriptor Head");
SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_tail",
CTLTYPE_UINT | CTLFLAG_RD, txr, sizeof(txr),
CTLTYPE_UINT | CTLFLAG_RD, txr, 0,
ixgbe_sysctl_tdt_handler, "IU", "Transmit Descriptor Tail");
SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "tso_tx",
CTLFLAG_RD, &txr->tso_tx, "TSO");
@ -1570,18 +1570,17 @@ ixgbe_add_hw_stats(struct adapter *adapter)
queue_list = SYSCTL_CHILDREN(queue_node);
SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "interrupt_rate",
CTLTYPE_UINT | CTLFLAG_RW, &adapter->rx_queues[i],
sizeof(&adapter->rx_queues[i]),
CTLTYPE_UINT | CTLFLAG_RW, &adapter->rx_queues[i], 0,
ixgbe_sysctl_interrupt_rate_handler, "IU",
"Interrupt Rate");
SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "irqs",
CTLFLAG_RD, &(adapter->rx_queues[i].irqs),
"irqs on this queue");
SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_head",
CTLTYPE_UINT | CTLFLAG_RD, rxr, sizeof(rxr),
CTLTYPE_UINT | CTLFLAG_RD, rxr, 0,
ixgbe_sysctl_rdh_handler, "IU", "Receive Descriptor Head");
SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_tail",
CTLTYPE_UINT | CTLFLAG_RD, rxr, sizeof(rxr),
CTLTYPE_UINT | CTLFLAG_RD, rxr, 0,
ixgbe_sysctl_rdt_handler, "IU", "Receive Descriptor Tail");
SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "rx_packets",
CTLFLAG_RD, &rxr->rx_packets, "Queue Packets Received");

View File

@ -67,8 +67,6 @@ __FBSDID("$FreeBSD$");
#include <dev/mmc/host/dwmmc_reg.h>
#include <dev/mmc/host/dwmmc_var.h>
#include "opt_mmccam.h"
#include "mmcbr_if.h"
#define dprintf(x, arg...)

View File

@ -226,7 +226,7 @@ qla_watchdog(void *arg)
taskqueue_enqueue(ha->tx_tq, &ha->tx_task);
}
}
ha->watchdog_ticks = ha->watchdog_ticks++ % 1000;
ha->watchdog_ticks = (ha->watchdog_ticks + 1) % 1000;
callout_reset(&ha->tx_callout, QLA_WATCHDOG_CALLOUT_TICKS,
qla_watchdog, ha);
}

View File

@ -321,7 +321,7 @@ qls_watchdog(void *arg)
ha->qla_watchdog_paused = 1;
}
ha->watchdog_ticks = ha->watchdog_ticks++ % 1000;
ha->watchdog_ticks = (ha->watchdog_ticks + 1) % 1000;
callout_reset(&ha->tx_callout, QLA_WATCHDOG_CALLOUT_TICKS,
qls_watchdog, ha);

View File

@ -124,7 +124,6 @@ static void sdhci_transfer_pio(struct sdhci_slot *slot);
static void sdhci_cam_action(struct cam_sim *sim, union ccb *ccb);
static int sdhci_cam_get_possible_host_clock(const struct sdhci_slot *slot,
int proposed_clock);
static void sdhci_cam_handle_mmcio(struct cam_sim *sim, union ccb *ccb);
static void sdhci_cam_poll(struct cam_sim *sim);
static int sdhci_cam_request(struct sdhci_slot *slot, union ccb *ccb);
static int sdhci_cam_settran_settings(struct sdhci_slot *slot, union ccb *ccb);
@ -2560,16 +2559,6 @@ sdhci_start_slot(struct sdhci_slot *slot)
cam_simq_free(slot->devq);
}
static void
sdhci_cam_handle_mmcio(struct cam_sim *sim, union ccb *ccb)
{
struct sdhci_slot *slot;
slot = cam_sim_softc(sim);
sdhci_cam_request(slot, ccb);
}
void
sdhci_cam_action(struct cam_sim *sim, union ccb *ccb)
{
@ -2586,33 +2575,9 @@ sdhci_cam_action(struct cam_sim *sim, union ccb *ccb)
switch (ccb->ccb_h.func_code) {
case XPT_PATH_INQ:
{
struct ccb_pathinq *cpi;
cpi = &ccb->cpi;
cpi->version_num = 1;
cpi->hba_inquiry = 0;
cpi->target_sprt = 0;
cpi->hba_misc = PIM_NOBUSRESET | PIM_SEQSCAN;
cpi->hba_eng_cnt = 0;
cpi->max_target = 0;
cpi->max_lun = 0;
cpi->initiator_id = 1;
cpi->maxio = MAXPHYS;
strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
strncpy(cpi->hba_vid, "Deglitch Networks", HBA_IDLEN);
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
cpi->unit_number = cam_sim_unit(sim);
cpi->bus_id = cam_sim_bus(sim);
cpi->base_transfer_speed = 100; /* XXX WTF? */
cpi->protocol = PROTO_MMCSD;
cpi->protocol_version = SCSI_REV_0;
cpi->transport = XPORT_MMCSD;
cpi->transport_version = 0;
cpi->ccb_h.status = CAM_REQ_CMP;
mmc_path_inq(&ccb->cpi, "Deglitch Networks", sim, MAXPHYS);
break;
}
case XPT_GET_TRAN_SETTINGS:
{
struct ccb_trans_settings *cts = &ccb->cts;
@ -2648,13 +2613,11 @@ sdhci_cam_action(struct cam_sim *sim, union ccb *ccb)
break;
}
case XPT_SET_TRAN_SETTINGS:
{
if (sdhci_debug > 1)
slot_printf(slot, "Got XPT_SET_TRAN_SETTINGS\n");
sdhci_cam_settran_settings(slot, ccb);
ccb->ccb_h.status = CAM_REQ_CMP;
break;
}
case XPT_RESET_BUS:
if (sdhci_debug > 1)
slot_printf(slot, "Got XPT_RESET_BUS, ACK it...\n");
@ -2671,10 +2634,8 @@ sdhci_cam_action(struct cam_sim *sim, union ccb *ccb)
slot_printf(slot, "Got XPT_MMC_IO\n");
ccb->ccb_h.status = CAM_REQ_INPROG;
sdhci_cam_handle_mmcio(sim, ccb);
sdhci_cam_request(cam_sim_softc(sim), ccb);
return;
/* NOTREACHED */
break;
default:
ccb->ccb_h.status = CAM_REQ_INVALID;
break;

794
sys/dev/xilinx/xlnx_pcib.c Normal file
View File

@ -0,0 +1,794 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2020 Ruslan Bukin <br@bsdpad.com>
*
* This software was developed by SRI International and the University of
* Cambridge Computer Laboratory (Department of Computer Science and
* Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
* DARPA SSITH research programme.
*
* 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 "opt_platform.h"
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/kernel.h>
#include <sys/rman.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/endian.h>
#include <sys/cpuset.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <machine/intr.h>
#include <machine/bus.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/vm_kern.h>
#include <vm/pmap.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pci_host_generic.h>
#include <dev/pci/pci_host_generic_fdt.h>
#include <dev/pci/pcib_private.h>
#include "xlnx_pcib.h"
#include "ofw_bus_if.h"
#include "msi_if.h"
#include "pcib_if.h"
#include "pic_if.h"
#define XLNX_PCIB_MAX_MSI 64
static int xlnx_pcib_fdt_attach(device_t);
static int xlnx_pcib_fdt_probe(device_t);
static int xlnx_pcib_fdt_get_id(device_t, device_t, enum pci_id_type,
uintptr_t *);
static void xlnx_pcib_msi_mask(device_t dev, struct intr_irqsrc *isrc,
bool mask);
struct xlnx_pcib_softc {
struct generic_pcie_fdt_softc fdt_sc;
struct resource *res[4];
struct mtx mtx;
vm_offset_t msi_page;
struct xlnx_pcib_irqsrc *isrcs;
device_t dev;
void *intr_cookie[3];
};
static struct resource_spec xlnx_pcib_spec[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
{ SYS_RES_IRQ, 0, RF_ACTIVE },
{ SYS_RES_IRQ, 1, RF_ACTIVE },
{ SYS_RES_IRQ, 2, RF_ACTIVE },
{ -1, 0 }
};
struct xlnx_pcib_irqsrc {
struct intr_irqsrc isrc;
u_int irq;
#define XLNX_IRQ_FLAG_USED (1 << 0)
u_int flags;
};
static void
xlnx_pcib_clear_err_interrupts(struct generic_pcie_core_softc *sc)
{
uint32_t reg;
reg = bus_read_4(sc->res, XLNX_PCIE_RPERRFRR);
if (reg & RPERRFRR_VALID) {
device_printf(sc->dev, "Requested ID: %x\n",
reg & RPERRFRR_REQ_ID_M);
bus_write_4(sc->res, XLNX_PCIE_RPERRFRR, ~0U);
}
}
static int
xlnx_pcib_intr(void *arg)
{
struct generic_pcie_fdt_softc *fdt_sc;
struct generic_pcie_core_softc *sc;
struct xlnx_pcib_softc *xlnx_sc;
uint32_t val, mask, status;
xlnx_sc = arg;
fdt_sc = &xlnx_sc->fdt_sc;
sc = &fdt_sc->base;
val = bus_read_4(sc->res, XLNX_PCIE_IDR);
mask = bus_read_4(sc->res, XLNX_PCIE_IMR);
status = val & mask;
if (!status)
return (FILTER_HANDLED);
if (status & IMR_LINK_DOWN)
device_printf(sc->dev, "Link down");
if (status & IMR_HOT_RESET)
device_printf(sc->dev, "Hot reset");
if (status & IMR_CORRECTABLE)
xlnx_pcib_clear_err_interrupts(sc);
if (status & IMR_FATAL)
xlnx_pcib_clear_err_interrupts(sc);
if (status & IMR_NON_FATAL)
xlnx_pcib_clear_err_interrupts(sc);
if (status & IMR_MSI) {
device_printf(sc->dev, "MSI interrupt");
/* FIFO mode MSI not implemented. */
}
if (status & IMR_INTX) {
device_printf(sc->dev, "INTx received");
/* Not implemented. */
}
if (status & IMR_SLAVE_UNSUPP_REQ)
device_printf(sc->dev, "Slave unsupported request");
if (status & IMR_SLAVE_UNEXP_COMPL)
device_printf(sc->dev, "Slave unexpected completion");
if (status & IMR_SLAVE_COMPL_TIMOUT)
device_printf(sc->dev, "Slave completion timeout");
if (status & IMR_SLAVE_ERROR_POISON)
device_printf(sc->dev, "Slave error poison");
if (status & IMR_SLAVE_COMPL_ABORT)
device_printf(sc->dev, "Slave completion abort");
if (status & IMR_SLAVE_ILLEG_BURST)
device_printf(sc->dev, "Slave illegal burst");
if (status & IMR_MASTER_DECERR)
device_printf(sc->dev, "Master decode error");
if (status & IMR_MASTER_SLVERR)
device_printf(sc->dev, "Master slave error");
bus_write_4(sc->res, XLNX_PCIE_IDR, val);
return (FILTER_HANDLED);
}
static void
xlnx_pcib_handle_msi_intr(void *arg, int msireg)
{
struct generic_pcie_fdt_softc *fdt_sc;
struct generic_pcie_core_softc *sc;
struct xlnx_pcib_softc *xlnx_sc;
struct xlnx_pcib_irqsrc *xi;
struct trapframe *tf;
int irq;
int reg;
int i;
xlnx_sc = arg;
fdt_sc = &xlnx_sc->fdt_sc;
sc = &fdt_sc->base;
tf = curthread->td_intr_frame;
do {
reg = bus_read_4(sc->res, msireg);
for (i = 0; i < sizeof(uint32_t) * 8; i++) {
if (reg & (1 << i)) {
bus_write_4(sc->res, msireg, (1 << i));
irq = i;
if (msireg == XLNX_PCIE_RPMSIID2)
irq += 32;
xi = &xlnx_sc->isrcs[irq];
if (intr_isrc_dispatch(&xi->isrc, tf) != 0) {
/* Disable stray. */
xlnx_pcib_msi_mask(sc->dev,
&xi->isrc, 1);
device_printf(sc->dev,
"Stray irq %u disabled\n", irq);
}
}
}
} while (reg != 0);
}
static int
xlnx_pcib_msi0_intr(void *arg)
{
xlnx_pcib_handle_msi_intr(arg, XLNX_PCIE_RPMSIID1);
return (FILTER_HANDLED);
}
static int
xlnx_pcib_msi1_intr(void *arg)
{
xlnx_pcib_handle_msi_intr(arg, XLNX_PCIE_RPMSIID2);
return (FILTER_HANDLED);
}
static int
xlnx_pcib_register_msi(struct xlnx_pcib_softc *sc)
{
const char *name;
int error;
int irq;
sc->isrcs = malloc(sizeof(*sc->isrcs) * XLNX_PCIB_MAX_MSI, M_DEVBUF,
M_WAITOK | M_ZERO);
name = device_get_nameunit(sc->dev);
for (irq = 0; irq < XLNX_PCIB_MAX_MSI; irq++) {
sc->isrcs[irq].irq = irq;
error = intr_isrc_register(&sc->isrcs[irq].isrc,
sc->dev, 0, "%s,%u", name, irq);
if (error != 0)
return (error); /* XXX deregister ISRCs */
}
if (intr_msi_register(sc->dev,
OF_xref_from_node(ofw_bus_get_node(sc->dev))) != 0)
return (ENXIO);
return (0);
}
static void
xlnx_pcib_init(struct xlnx_pcib_softc *sc)
{
bus_addr_t addr;
int reg;
/* Disable interrupts. */
bus_write_4(sc->res[0], XLNX_PCIE_IMR, 0);
/* Clear pending interrupts.*/
reg = bus_read_4(sc->res[0], XLNX_PCIE_IDR);
bus_write_4(sc->res[0], XLNX_PCIE_IDR, reg);
/* Setup an MSI page. */
sc->msi_page = kmem_alloc_contig(PAGE_SIZE, M_WAITOK, 0,
BUS_SPACE_MAXADDR, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT);
addr = vtophys(sc->msi_page);
bus_write_4(sc->res[0], XLNX_PCIE_RPMSIBR1, (addr >> 32));
bus_write_4(sc->res[0], XLNX_PCIE_RPMSIBR2, (addr >> 0));
/* Enable the bridge. */
reg = bus_read_4(sc->res[0], XLNX_PCIE_RPSCR);
reg |= RPSCR_BE;
bus_write_4(sc->res[0], XLNX_PCIE_RPSCR, reg);
/* Enable interrupts. */
reg = IMR_LINK_DOWN
| IMR_HOT_RESET
| IMR_CFG_COMPL_STATUS_M
| IMR_CFG_TIMEOUT
| IMR_CORRECTABLE
| IMR_NON_FATAL
| IMR_FATAL
| IMR_INTX
| IMR_MSI
| IMR_SLAVE_UNSUPP_REQ
| IMR_SLAVE_UNEXP_COMPL
| IMR_SLAVE_COMPL_TIMOUT
| IMR_SLAVE_ERROR_POISON
| IMR_SLAVE_COMPL_ABORT
| IMR_SLAVE_ILLEG_BURST
| IMR_MASTER_DECERR
| IMR_MASTER_SLVERR;
bus_write_4(sc->res[0], XLNX_PCIE_IMR, reg);
}
static int
xlnx_pcib_fdt_probe(device_t dev)
{
if (!ofw_bus_status_okay(dev))
return (ENXIO);
if (ofw_bus_is_compatible(dev, "xlnx,xdma-host-3.00")) {
device_set_desc(dev, "Xilinx XDMA PCIe Controller");
return (BUS_PROBE_DEFAULT);
}
return (ENXIO);
}
static int
xlnx_pcib_fdt_attach(device_t dev)
{
struct xlnx_pcib_softc *sc;
int error;
sc = device_get_softc(dev);
sc->dev = dev;
mtx_init(&sc->mtx, "msi_mtx", NULL, MTX_DEF);
if (bus_alloc_resources(dev, xlnx_pcib_spec, sc->res)) {
device_printf(dev, "could not allocate resources\n");
return (ENXIO);
}
/* Setup MISC interrupt handler. */
error = bus_setup_intr(dev, sc->res[1], INTR_TYPE_MISC | INTR_MPSAFE,
xlnx_pcib_intr, NULL, sc, &sc->intr_cookie[0]);
if (error != 0) {
device_printf(dev, "could not setup interrupt handler.\n");
return (ENXIO);
}
/* Setup MSI0 interrupt handler. */
error = bus_setup_intr(dev, sc->res[2], INTR_TYPE_MISC | INTR_MPSAFE,
xlnx_pcib_msi0_intr, NULL, sc, &sc->intr_cookie[1]);
if (error != 0) {
device_printf(dev, "could not setup interrupt handler.\n");
return (ENXIO);
}
/* Setup MSI1 interrupt handler. */
error = bus_setup_intr(dev, sc->res[3], INTR_TYPE_MISC | INTR_MPSAFE,
xlnx_pcib_msi1_intr, NULL, sc, &sc->intr_cookie[2]);
if (error != 0) {
device_printf(dev, "could not setup interrupt handler.\n");
return (ENXIO);
}
xlnx_pcib_init(sc);
/*
* Allow the core driver to map registers.
* We will be accessing the device memory using core_softc.
*/
bus_release_resources(dev, xlnx_pcib_spec, sc->res);
error = xlnx_pcib_register_msi(sc);
if (error)
return (error);
return (pci_host_generic_attach(dev));
}
static int
xlnx_pcib_fdt_get_id(device_t pci, device_t child, enum pci_id_type type,
uintptr_t *id)
{
phandle_t node;
int bsf;
if (type != PCI_ID_MSI)
return (pcib_get_id(pci, child, type, id));
node = ofw_bus_get_node(pci);
if (OF_hasprop(node, "msi-map"))
return (generic_pcie_get_id(pci, child, type, id));
bsf = pci_get_rid(child);
*id = (pci_get_domain(child) << PCI_RID_DOMAIN_SHIFT) | bsf;
return (0);
}
static int
xlnx_pcib_req_valid(struct generic_pcie_core_softc *sc,
u_int bus, u_int slot, u_int func, u_int reg)
{
bus_space_handle_t h;
bus_space_tag_t t;
uint32_t val;
t = sc->bst;
h = sc->bsh;
if ((bus < sc->bus_start) || (bus > sc->bus_end))
return (0);
if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) ||
(reg > PCIE_REGMAX))
return (0);
if (bus == 0 && slot > 0)
return (0);
val = bus_space_read_4(t, h, XLNX_PCIE_PHYSCR);
if ((val & PHYSCR_LINK_UP) == 0) {
/* Link is down */
return (0);
}
/* Valid */
return (1);
}
static uint32_t
xlnx_pcib_read_config(device_t dev, u_int bus, u_int slot,
u_int func, u_int reg, int bytes)
{
struct generic_pcie_fdt_softc *fdt_sc;
struct xlnx_pcib_softc *xlnx_sc;
struct generic_pcie_core_softc *sc;
bus_space_handle_t h;
bus_space_tag_t t;
uint64_t offset;
uint32_t data;
xlnx_sc = device_get_softc(dev);
fdt_sc = &xlnx_sc->fdt_sc;
sc = &fdt_sc->base;
if (!xlnx_pcib_req_valid(sc, bus, slot, func, reg))
return (~0U);
offset = PCIE_ADDR_OFFSET(bus - sc->bus_start, slot, func, reg);
t = sc->bst;
h = sc->bsh;
data = bus_space_read_4(t, h, offset & ~3);
switch (bytes) {
case 1:
data >>= (offset & 3) * 8;
data &= 0xff;
break;
case 2:
data >>= (offset & 3) * 8;
data = le16toh(data);
break;
case 4:
data = le32toh(data);
break;
default:
return (~0U);
}
return (data);
}
static void
xlnx_pcib_write_config(device_t dev, u_int bus, u_int slot,
u_int func, u_int reg, uint32_t val, int bytes)
{
struct generic_pcie_fdt_softc *fdt_sc;
struct xlnx_pcib_softc *xlnx_sc;
struct generic_pcie_core_softc *sc;
bus_space_handle_t h;
bus_space_tag_t t;
uint64_t offset;
uint32_t data;
xlnx_sc = device_get_softc(dev);
fdt_sc = &xlnx_sc->fdt_sc;
sc = &fdt_sc->base;
if (!xlnx_pcib_req_valid(sc, bus, slot, func, reg))
return;
offset = PCIE_ADDR_OFFSET(bus - sc->bus_start, slot, func, reg);
t = sc->bst;
h = sc->bsh;
/*
* 32-bit access used due to a bug in the Xilinx bridge that
* requires to write primary and secondary buses in one blast.
*
* TODO: This is probably wrong on big-endian.
*/
switch (bytes) {
case 1:
data = bus_space_read_4(t, h, offset & ~3);
data &= ~(0xff << ((offset & 3) * 8));
data |= (val & 0xff) << ((offset & 3) * 8);
bus_space_write_4(t, h, offset & ~3, htole32(data));
break;
case 2:
data = bus_space_read_4(t, h, offset & ~3);
data &= ~(0xffff << ((offset & 3) * 8));
data |= (val & 0xffff) << ((offset & 3) * 8);
bus_space_write_4(t, h, offset & ~3, htole32(data));
break;
case 4:
bus_space_write_4(t, h, offset, htole32(val));
break;
default:
return;
}
}
static int
xlnx_pcib_alloc_msi(device_t pci, device_t child, int count, int maxcount,
int *irqs)
{
phandle_t msi_parent;
ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
NULL);
msi_parent = OF_xref_from_node(ofw_bus_get_node(pci));
return (intr_alloc_msi(pci, child, msi_parent, count, maxcount,
irqs));
}
static int
xlnx_pcib_release_msi(device_t pci, device_t child, int count, int *irqs)
{
phandle_t msi_parent;
ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
NULL);
msi_parent = OF_xref_from_node(ofw_bus_get_node(pci));
return (intr_release_msi(pci, child, msi_parent, count, irqs));
}
static int
xlnx_pcib_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
uint32_t *data)
{
phandle_t msi_parent;
ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
NULL);
msi_parent = OF_xref_from_node(ofw_bus_get_node(pci));
return (intr_map_msi(pci, child, msi_parent, irq, addr, data));
}
static int
xlnx_pcib_msi_alloc_msi(device_t dev, device_t child, int count, int maxcount,
device_t *pic, struct intr_irqsrc **srcs)
{
struct xlnx_pcib_softc *sc;
int irq, end_irq, i;
bool found;
sc = device_get_softc(dev);
mtx_lock(&sc->mtx);
found = false;
for (irq = 0; (irq + count - 1) < XLNX_PCIB_MAX_MSI; irq++) {
/* Assume the range is valid. */
found = true;
/* Check this range is valid. */
for (end_irq = irq; end_irq < irq + count; end_irq++) {
if (sc->isrcs[end_irq].flags & XLNX_IRQ_FLAG_USED) {
/* This is already used. */
found = false;
break;
}
}
if (found)
break;
}
if (!found || irq == (XLNX_PCIB_MAX_MSI - 1)) {
/* Not enough interrupts were found. */
mtx_unlock(&sc->mtx);
return (ENXIO);
}
/* Mark the interrupt as used. */
for (i = 0; i < count; i++)
sc->isrcs[irq + i].flags |= XLNX_IRQ_FLAG_USED;
mtx_unlock(&sc->mtx);
for (i = 0; i < count; i++)
srcs[i] = (struct intr_irqsrc *)&sc->isrcs[irq + i];
*pic = device_get_parent(dev);
return (0);
}
static int
xlnx_pcib_msi_release_msi(device_t dev, device_t child, int count,
struct intr_irqsrc **isrc)
{
struct xlnx_pcib_softc *sc;
struct xlnx_pcib_irqsrc *xi;
int i;
sc = device_get_softc(dev);
mtx_lock(&sc->mtx);
for (i = 0; i < count; i++) {
xi = (struct xlnx_pcib_irqsrc *)isrc[i];
KASSERT(xi->flags & XLNX_IRQ_FLAG_USED,
("%s: Releasing an unused MSI interrupt", __func__));
xi->flags &= ~XLNX_IRQ_FLAG_USED;
}
mtx_unlock(&sc->mtx);
return (0);
}
static int
xlnx_pcib_msi_map_msi(device_t dev, device_t child, struct intr_irqsrc *isrc,
uint64_t *addr, uint32_t *data)
{
struct xlnx_pcib_softc *sc;
struct xlnx_pcib_irqsrc *xi;
sc = device_get_softc(dev);
xi = (struct xlnx_pcib_irqsrc *)isrc;
*addr = vtophys(sc->msi_page);
*data = xi->irq;
return (0);
}
static void
xlnx_pcib_msi_mask(device_t dev, struct intr_irqsrc *isrc, bool mask)
{
struct generic_pcie_fdt_softc *fdt_sc;
struct generic_pcie_core_softc *sc;
struct xlnx_pcib_softc *xlnx_sc;
struct xlnx_pcib_irqsrc *xi;
uint32_t msireg, irq;
uint32_t reg;
xlnx_sc = device_get_softc(dev);
fdt_sc = &xlnx_sc->fdt_sc;
sc = &fdt_sc->base;
xi = (struct xlnx_pcib_irqsrc *)isrc;
irq = xi->irq;
if (irq < 32)
msireg = XLNX_PCIE_RPMSIID1_MASK;
else
msireg = XLNX_PCIE_RPMSIID2_MASK;
reg = bus_read_4(sc->res, msireg);
if (mask)
reg &= ~(1 << irq);
else
reg |= (1 << irq);
bus_write_4(sc->res, msireg, reg);
}
static void
xlnx_pcib_msi_disable_intr(device_t dev, struct intr_irqsrc *isrc)
{
xlnx_pcib_msi_mask(dev, isrc, true);
}
static void
xlnx_pcib_msi_enable_intr(device_t dev, struct intr_irqsrc *isrc)
{
xlnx_pcib_msi_mask(dev, isrc, false);
}
static void
xlnx_pcib_msi_post_filter(device_t dev, struct intr_irqsrc *isrc)
{
}
static void
xlnx_pcib_msi_post_ithread(device_t dev, struct intr_irqsrc *isrc)
{
xlnx_pcib_msi_mask(dev, isrc, false);
}
static void
xlnx_pcib_msi_pre_ithread(device_t dev, struct intr_irqsrc *isrc)
{
xlnx_pcib_msi_mask(dev, isrc, true);
}
static int
xlnx_pcib_msi_setup_intr(device_t dev, struct intr_irqsrc *isrc,
struct resource *res, struct intr_map_data *data)
{
return (0);
}
static int
xlnx_pcib_msi_teardown_intr(device_t dev, struct intr_irqsrc *isrc,
struct resource *res, struct intr_map_data *data)
{
return (0);
}
static device_method_t xlnx_pcib_fdt_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, xlnx_pcib_fdt_probe),
DEVMETHOD(device_attach, xlnx_pcib_fdt_attach),
/* pcib interface */
DEVMETHOD(pcib_get_id, xlnx_pcib_fdt_get_id),
DEVMETHOD(pcib_read_config, xlnx_pcib_read_config),
DEVMETHOD(pcib_write_config, xlnx_pcib_write_config),
DEVMETHOD(pcib_alloc_msi, xlnx_pcib_alloc_msi),
DEVMETHOD(pcib_release_msi, xlnx_pcib_release_msi),
DEVMETHOD(pcib_map_msi, xlnx_pcib_map_msi),
/* MSI interface */
DEVMETHOD(msi_alloc_msi, xlnx_pcib_msi_alloc_msi),
DEVMETHOD(msi_release_msi, xlnx_pcib_msi_release_msi),
DEVMETHOD(msi_map_msi, xlnx_pcib_msi_map_msi),
/* Interrupt controller interface */
DEVMETHOD(pic_disable_intr, xlnx_pcib_msi_disable_intr),
DEVMETHOD(pic_enable_intr, xlnx_pcib_msi_enable_intr),
DEVMETHOD(pic_setup_intr, xlnx_pcib_msi_setup_intr),
DEVMETHOD(pic_teardown_intr, xlnx_pcib_msi_teardown_intr),
DEVMETHOD(pic_post_filter, xlnx_pcib_msi_post_filter),
DEVMETHOD(pic_post_ithread, xlnx_pcib_msi_post_ithread),
DEVMETHOD(pic_pre_ithread, xlnx_pcib_msi_pre_ithread),
/* End */
DEVMETHOD_END
};
DEFINE_CLASS_1(pcib, xlnx_pcib_fdt_driver, xlnx_pcib_fdt_methods,
sizeof(struct xlnx_pcib_softc), generic_pcie_fdt_driver);
static devclass_t xlnx_pcib_fdt_devclass;
DRIVER_MODULE(xlnx_pcib, simplebus, xlnx_pcib_fdt_driver,
xlnx_pcib_fdt_devclass, 0, 0);
DRIVER_MODULE(xlnx_pcib, ofwbus, xlnx_pcib_fdt_driver,
xlnx_pcib_fdt_devclass, 0, 0);

View File

@ -0,0 +1,84 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2020 Ruslan Bukin <br@bsdpad.com>
*
* This software was developed by SRI International and the University of
* Cambridge Computer Laboratory (Department of Computer Science and
* Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
* DARPA SSITH research programme.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _DEV_XILINX_XLNX_PCIB_H_
#define _DEV_XILINX_XLNX_PCIB_H_
#define XLNX_PCIE_VSEC 0x12c
#define XLNX_PCIE_BIR 0x130 /* Bridge Info Register */
#define XLNX_PCIE_BSCR 0x134 /* Bridge Status and Control */
#define XLNX_PCIE_IDR 0x138 /* Interrupt Decode Register */
#define XLNX_PCIE_IMR 0x13C /* Interrupt Mask Register */
#define IMR_LINK_DOWN (1 << 0)
#define IMR_HOT_RESET (1 << 3)
#define IMR_CFG_COMPL_STATUS_S 5
#define IMR_CFG_COMPL_STATUS_M (0x7 << IMR_CFG_COMPL_STATUS_S)
#define IMR_CFG_TIMEOUT (1 << 8)
#define IMR_CORRECTABLE (1 << 9)
#define IMR_NON_FATAL (1 << 10)
#define IMR_FATAL (1 << 11)
#define IMR_INTX (1 << 16) /* INTx Interrupt Received */
#define IMR_MSI (1 << 17) /* MSI Interrupt Received */
#define IMR_SLAVE_UNSUPP_REQ (1 << 20)
#define IMR_SLAVE_UNEXP_COMPL (1 << 21)
#define IMR_SLAVE_COMPL_TIMOUT (1 << 22)
#define IMR_SLAVE_ERROR_POISON (1 << 23)
#define IMR_SLAVE_COMPL_ABORT (1 << 24)
#define IMR_SLAVE_ILLEG_BURST (1 << 25)
#define IMR_MASTER_DECERR (1 << 26)
#define IMR_MASTER_SLVERR (1 << 27)
#define XLNX_PCIE_BLR 0x140 /* Bus Location Register */
#define XLNX_PCIE_PHYSCR 0x144 /* PHY Status/Control Register */
#define PHYSCR_LINK_UP (1 << 11) /* Current PHY Link-up state */
#define XLNX_PCIE_RPSCR 0x148 /* Root Port Status/Control Register */
#define RPSCR_BE (1 << 0) /* Bridge Enable */
#define XLNX_PCIE_RPMSIBR1 0x14C /* Root Port MSI Base Register 1 */
#define XLNX_PCIE_RPMSIBR2 0x150 /* Root Port MSI Base Register 2 */
#define XLNX_PCIE_RPERRFRR 0x154 /* Root Port Error FIFO Read */
#define RPERRFRR_VALID (1 << 18) /* Indicates whether read succeeded.*/
#define RPERRFRR_REQ_ID_S 0 /* Requester of the error message. */
#define RPERRFRR_REQ_ID_M (0xffff << RPERRFRR_REQ_ID_S)
#define XLNX_PCIE_RPIFRR1 0x158 /* Root Port Interrupt FIFO Read 1 */
#define XLNX_PCIE_RPIFRR2 0x15C /* Root Port Interrupt FIFO Read 2 */
#define XLNX_PCIE_RPID2 0x160 /* Root Port Interrupt Decode 2 */
#define XLNX_PCIE_RPID2_MASK 0x164 /* Root Port Interrupt Decode 2 Mask */
#define XLNX_PCIE_RPMSIID1 0x170 /* Root Port MSI Interrupt Decode 1 */
#define XLNX_PCIE_RPMSIID2 0x174 /* Root Port MSI Interrupt Decode 2 */
#define XLNX_PCIE_RPMSIID1_MASK 0x178 /* Root Port MSI Int. Decode 1 Mask */
#define XLNX_PCIE_RPMSIID2_MASK 0x17C /* Root Port MSI Int. Decode 2 Mask */
#define XLNX_PCIE_CCR 0x168 /* Configuration Control Register */
#define XLNX_PCIE_VSEC_CR 0x200 /* VSEC Capability Register 2 */
#define XLNX_PCIE_VSEC_HR 0x204 /* VSEC Header Register 2 */
#endif /* !_DEV_XILINX_XLNX_PCIB_H_ */

View File

@ -0,0 +1,39 @@
/dts-v1/;
/plugin/;
#include <dt-bindings/clock/rk3328-cru.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/interrupt-controller/irq.h>
/ {
compatible = "rockchip,rk3328";
};
&{/} {
usbdrd3: usb@ff600000 {
compatible = "rockchip,rk3328-dwc3";
clocks = <&cru SCLK_USB3OTG_REF>, <&cru SCLK_USB3OTG_SUSPEND>,
<&cru ACLK_USB3OTG>;
clock-names = "ref_clk", "suspend_clk",
"bus_clk";
#address-cells = <2>;
#size-cells = <2>;
ranges;
status = "okay";
usbdrd_dwc3: dwc3@ff600000 {
compatible = "snps,dwc3";
reg = <0x0 0xff600000 0x0 0x100000>;
interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
dr_mode = "host";
phy_type = "utmi_wide";
snps,dis_enblslpm_quirk;
snps,dis-u2-freeclk-exists-quirk;
snps,dis_u2_susphy_quirk;
snps,dis_u3_susphy_quirk;
snps,dis-del-phy-power-chg-quirk;
snps,dis-tx-ipgap-linecheck-quirk;
status = "okay";
};
};
};

View File

@ -43,7 +43,7 @@
struct null_mount {
struct mount *nullm_vfs;
struct vnode *nullm_rootvp; /* Reference to root null_node */
struct vnode *nullm_lowerrootvp; /* Ref to lower root vnode */
uint64_t nullm_flags;
};

View File

@ -252,6 +252,8 @@ null_nodeget(mp, lowervp, vpp)
vp->v_type = lowervp->v_type;
vp->v_data = xp;
vp->v_vnlock = lowervp->v_vnlock;
if (lowervp == MOUNTTONULLMOUNT(mp)->nullm_lowerrootvp)
vp->v_vflag |= VV_ROOT;
error = insmntque1(vp, mp, null_insmntque_dtr, xp);
if (error != 0)
return (error);

View File

@ -74,7 +74,7 @@ static vfs_extattrctl_t nullfs_extattrctl;
static int
nullfs_mount(struct mount *mp)
{
struct vnode *lowerrootvp, *vp;
struct vnode *lowerrootvp;
struct vnode *nullm_rootvp;
struct null_mount *xmp;
struct null_node *nn;
@ -158,36 +158,24 @@ nullfs_mount(struct mount *mp)
M_NULLFSMNT, M_WAITOK | M_ZERO);
/*
* Save reference to underlying FS
* Save pointer to underlying FS and the reference to the
* lower root vnode.
*/
xmp->nullm_vfs = lowerrootvp->v_mount;
vref(lowerrootvp);
xmp->nullm_lowerrootvp = lowerrootvp;
mp->mnt_data = xmp;
/*
* Save reference. Each mount also holds
* a reference on the root vnode.
* Make sure the node alias worked.
*/
error = null_nodeget(mp, lowerrootvp, &vp);
/*
* Make sure the node alias worked
*/
if (error) {
error = null_nodeget(mp, lowerrootvp, &nullm_rootvp);
if (error != 0) {
vrele(lowerrootvp);
free(xmp, M_NULLFSMNT);
return (error);
}
/*
* Keep a held reference to the root vnode.
* It is vrele'd in nullfs_unmount.
*/
nullm_rootvp = vp;
nullm_rootvp->v_vflag |= VV_ROOT;
xmp->nullm_rootvp = nullm_rootvp;
/*
* Unlock the node (either the lower or the alias)
*/
VOP_UNLOCK(vp);
if (NULLVPTOLOWERVP(nullm_rootvp)->v_mount->mnt_flag & MNT_LOCAL) {
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
@ -209,7 +197,6 @@ nullfs_mount(struct mount *mp)
mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag &
(MNTK_USES_BCACHE | MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS);
MNT_IUNLOCK(mp);
mp->mnt_data = xmp;
vfs_getnewfsid(mp);
if ((xmp->nullm_flags & NULLM_CACHE) != 0) {
MNT_ILOCK(xmp->nullm_vfs);
@ -219,6 +206,7 @@ nullfs_mount(struct mount *mp)
}
vfs_mountedfrom(mp, target);
vput(nullm_rootvp);
NULLFSDEBUG("nullfs_mount: lower %s, alias at %s\n",
mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntonname);
@ -235,7 +223,7 @@ nullfs_unmount(mp, mntflags)
{
struct null_mount *mntdata;
struct mount *ump;
int error, flags, rootrefs;
int error, flags;
NULLFSDEBUG("nullfs_unmount: mp = %p\n", (void *)mp);
@ -244,9 +232,9 @@ nullfs_unmount(mp, mntflags)
else
flags = 0;
for (rootrefs = 1;; rootrefs = 0) {
for (;;) {
/* There is 1 extra root vnode reference (nullm_rootvp). */
error = vflush(mp, rootrefs, flags, curthread);
error = vflush(mp, 0, flags, curthread);
if (error)
return (error);
MNT_ILOCK(mp);
@ -273,6 +261,7 @@ nullfs_unmount(mp, mntflags)
TAILQ_REMOVE(&ump->mnt_uppers, mp, mnt_upper_link);
MNT_IUNLOCK(ump);
}
vrele(mntdata->nullm_lowerrootvp);
mp->mnt_data = NULL;
free(mntdata, M_NULLFSMNT);
return (0);
@ -285,21 +274,24 @@ nullfs_root(mp, flags, vpp)
struct vnode **vpp;
{
struct vnode *vp;
struct null_mount *mntdata;
int error;
NULLFSDEBUG("nullfs_root(mp = %p, vp = %p->%p)\n", (void *)mp,
(void *)MOUNTTONULLMOUNT(mp)->nullm_rootvp,
(void *)NULLVPTOLOWERVP(MOUNTTONULLMOUNT(mp)->nullm_rootvp));
mntdata = MOUNTTONULLMOUNT(mp);
NULLFSDEBUG("nullfs_root(mp = %p, vp = %p)\n", mp,
mntdata->nullm_lowerrootvp);
/*
* Return locked reference to root.
*/
vp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
VREF(vp);
ASSERT_VOP_UNLOCKED(vp, "root vnode is locked");
vn_lock(vp, flags | LK_RETRY);
*vpp = vp;
return 0;
error = vget(mntdata->nullm_lowerrootvp, (flags & ~LK_TYPE_MASK) |
LK_EXCLUSIVE, curthread);
if (error == 0) {
error = null_nodeget(mp, mntdata->nullm_lowerrootvp, &vp);
if (error == 0) {
if ((flags & LK_TYPE_MASK) == LK_SHARED)
vn_lock(vp, LK_DOWNGRADE | LK_RETRY);
*vpp = vp;
}
}
return (error);
}
static int

View File

@ -473,11 +473,12 @@ cf_get_method(device_t dev, struct cf_level *level)
* first try the driver and if that fails, fall back to
* estimating.
*/
if (CPUFREQ_DRV_GET(sc->cf_drv_dev, &set) != 0)
goto estimate;
sc->curr_level.total_set = set;
CF_DEBUG("get returning immediate freq %d\n", curr_set->freq);
goto out;
if (CPUFREQ_DRV_GET(sc->cf_drv_dev, &set) == 0) {
sc->curr_level.total_set = set;
CF_DEBUG("get returning immediate freq %d\n",
curr_set->freq);
goto out;
}
} else if (curr_set->freq != CPUFREQ_VAL_UNKNOWN) {
CF_DEBUG("get returning known freq %d\n", curr_set->freq);
error = 0;
@ -523,9 +524,6 @@ cf_get_method(device_t dev, struct cf_level *level)
goto out;
}
estimate:
CF_MTX_ASSERT(&sc->lock);
/*
* We couldn't find an exact match, so attempt to estimate and then
* match against a level.

View File

@ -2669,6 +2669,7 @@ static struct fileops mqueueops = {
.fo_chown = mqf_chown,
.fo_sendfile = invfo_sendfile,
.fo_fill_kinfo = mqf_fill_kinfo,
.fo_flags = DFLAG_PASSABLE,
};
static struct vop_vector mqfs_vnodeops = {

View File

@ -7,4 +7,6 @@ DTS= \
rockchip/rk3328-rock64.dts \
rockchip/rk3399-rockpro64.dts
DTSO= rk3328-dwc3.dtso
.include <bsd.dtb.mk>

View File

@ -211,6 +211,18 @@ if_clone_create(char *name, size_t len, caddr_t params)
return (if_clone_createif(ifc, name, len, params));
}
void
if_clone_addif(struct if_clone *ifc, struct ifnet *ifp)
{
if ((ifc->ifc_flags & IFC_NOGROUP) == 0)
if_addgroup(ifp, ifc->ifc_name);
IF_CLONE_LOCK(ifc);
IFC_IFLIST_INSERT(ifc, ifp);
IF_CLONE_UNLOCK(ifc);
}
/*
* Create a clone network interface.
*/
@ -233,12 +245,7 @@ if_clone_createif(struct if_clone *ifc, char *name, size_t len, caddr_t params)
if (ifp == NULL)
panic("%s: lookup failed for %s", __func__, name);
if ((ifc->ifc_flags & IFC_NOGROUP) == 0)
if_addgroup(ifp, ifc->ifc_name);
IF_CLONE_LOCK(ifc);
IFC_IFLIST_INSERT(ifc, ifp);
IF_CLONE_UNLOCK(ifc);
if_clone_addif(ifc, ifp);
}
return (err);

View File

@ -79,7 +79,8 @@ int if_clone_list(struct if_clonereq *);
struct if_clone *if_clone_findifc(struct ifnet *);
void if_clone_addgroup(struct ifnet *, struct if_clone *);
/* The below interface used only by epair(4). */
/* The below interfaces are used only by epair(4). */
void if_clone_addif(struct if_clone *, struct ifnet *);
int if_clone_destroyif(struct if_clone *, struct ifnet *);
#endif /* _KERNEL */

View File

@ -711,6 +711,21 @@ epair_clone_match(struct if_clone *ifc, const char *name)
return (1);
}
static void
epair_clone_add(struct if_clone *ifc, struct epair_softc *scb)
{
struct ifnet *ifp;
uint8_t eaddr[ETHER_ADDR_LEN]; /* 00:00:00:00:00:00 */
ifp = scb->ifp;
/* Copy epairNa etheraddr and change the last byte. */
memcpy(eaddr, scb->oifp->if_hw_addr, ETHER_ADDR_LEN);
eaddr[5] = 0x0b;
ether_ifattach(ifp, eaddr);
if_clone_addif(ifc, ifp);
}
static int
epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
{
@ -723,24 +738,6 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
uint32_t hash;
uint8_t eaddr[ETHER_ADDR_LEN]; /* 00:00:00:00:00:00 */
/*
* We are abusing params to create our second interface.
* Actually we already created it and called if_clone_create()
* for it to do the official insertion procedure the moment we knew
* it cannot fail anymore. So just do attach it here.
*/
if (params) {
scb = (struct epair_softc *)params;
ifp = scb->ifp;
/* Copy epairNa etheraddr and change the last byte. */
memcpy(eaddr, scb->oifp->if_hw_addr, ETHER_ADDR_LEN);
eaddr[5] = 0x0b;
ether_ifattach(ifp, eaddr);
/* Correctly set the name for the cloner list. */
strlcpy(name, ifp->if_xname, len);
return (0);
}
/* Try to see if a special unit was requested. */
error = ifc_name2unit(name, &unit);
if (error != 0)
@ -891,10 +888,11 @@ epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
if_setsendqready(ifp);
/* We need to play some tricks here for the second interface. */
strlcpy(name, epairname, len);
error = if_clone_create(name, len, (caddr_t)scb);
if (error)
panic("%s: if_clone_create() for our 2nd iface failed: %d",
__func__, error);
/* Correctly set the name for the cloner list. */
strlcpy(name, scb->ifp->if_xname, len);
epair_clone_add(ifc, scb);
scb->if_qflush = ifp->if_qflush;
ifp->if_qflush = epair_qflush;
ifp->if_transmit = epair_transmit;

View File

@ -963,10 +963,14 @@ vlan_clone_match_ethervid(const char *name, int *vidp)
static int
vlan_clone_match(struct if_clone *ifc, const char *name)
{
struct ifnet *ifp;
const char *cp;
if (vlan_clone_match_ethervid(name, NULL) != NULL)
ifp = vlan_clone_match_ethervid(name, NULL);
if (ifp != NULL) {
if_rele(ifp);
return (1);
}
if (strncmp(vlanname, name, strlen(vlanname)) != 0)
return (0);

View File

@ -105,7 +105,7 @@ sctp_asconf_error_response(uint32_t id, uint16_t cause, uint8_t *error_tlv,
struct mbuf *m_reply = NULL;
struct sctp_asconf_paramhdr *aph;
struct sctp_error_cause *error;
size_t buf_len;
uint32_t buf_len;
uint16_t i, param_length, cause_length, padding_length;
uint8_t *tlv;

View File

@ -6885,7 +6885,7 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m,
/* There is another. */
return (EBUSY);
}
if (uio->uio_resid > SCTP_BASE_SYSCTL(sctp_sendall_limit)) {
if (uio->uio_resid > (ssize_t)SCTP_BASE_SYSCTL(sctp_sendall_limit)) {
/* You must not be larger than the limit! */
return (EMSGSIZE);
}

View File

@ -517,17 +517,20 @@ powernv_node_numa_domain(platform_t platform, phandle_t node)
cell_t associativity[5];
int i, res;
res = OF_getproplen(node, "ibm,associativity");
res = OF_getencprop(node, "ibm,associativity",
associativity, sizeof(associativity));
/* If already at the root, use default domain. */
if (res == 0)
return (0);
else if (res < 0)
/* If this node doesn't have associativity, check its parent. */
return (powernv_node_numa_domain(platform, OF_parent(node)));
OF_getencprop(node, "ibm,associativity",
associativity, res);
/*
* If this node doesn't have associativity, or if there are not
* enough elements in it, check its parent.
*/
if (res < (int)(sizeof(cell_t) * (platform_associativity + 1))) {
node = OF_parent(node);
/* If already at the root, use default domain. */
if (node == 0)
return (0);
return (powernv_node_numa_domain(platform, node));
}
for (i = 0; i < numa_max_domain; i++) {
if (numa_domains[i] == associativity[platform_associativity])

View File

@ -72,8 +72,11 @@
#define SSTATUS_XS_SHIFT 15
#define SSTATUS_XS_MASK (0x3 << SSTATUS_XS_SHIFT)
#define SSTATUS_SUM (1 << 18)
#define SSTATUS32_SD (1 << 63)
#define SSTATUS64_SD (1 << 31)
#if __riscv_xlen == 64
#define SSTATUS_SD (1 << 63)
#else
#define SSTATUS_SD (1 << 31)
#endif
#define MSTATUS_UIE (1 << 0)
#define MSTATUS_SIE (1 << 1)

View File

@ -107,16 +107,24 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2);
} while (0)
#define VNASSERT(exp, vp, msg) do { \
if (__predict_false(!(exp))) { \
vn_printf(vp, "VNASSERT failed\n"); \
vn_printf(vp, "VNASSERT failed: %s not true at %s:%d (%s)\n",\
#exp, __FILE__, __LINE__, __func__); \
kassert_panic msg; \
} \
} while (0)
#define VNPASS(exp, vp) do { \
const char *_exp = #exp; \
VNASSERT(exp, vp, ("condition %s not met at %s:%d (%s)", \
_exp, __FILE__, __LINE__, __func__)); \
} while (0)
#else
#define KASSERT(exp,msg) do { \
} while (0)
#define VNASSERT(exp, vp, msg) do { \
} while (0)
#define VNPASS(exp, vp) do { \
} while (0)
#endif
#ifndef CTASSERT /* Allow lint to override */

View File

@ -1073,12 +1073,14 @@ vm_fault_allocate(struct faultstate *fs)
fs->oom < vm_pfault_oom_attempts) {
fs->oom++;
vm_waitpfault(dset, vm_pfault_oom_wait * hz);
} else {
if (bootverbose)
printf(
"proc %d (%s) failed to alloc page on fault, starting OOM\n",
curproc->p_pid, curproc->p_comm);
vm_pageout_oom(VM_OOM_MEM_PF);
fs->oom = 0;
}
if (bootverbose)
printf(
"proc %d (%s) failed to alloc page on fault, starting OOM\n",
curproc->p_pid, curproc->p_comm);
vm_pageout_oom(VM_OOM_MEM_PF);
return (KERN_RESOURCE_SHORTAGE);
}
fs->oom = 0;

View File

@ -147,17 +147,19 @@ intel_hwp_dump_sysctl_handler(SYSCTL_HANDLER_ARGS)
sbuf_printf(sb, "\tLowest Performance: %03ju\n", (data >> 24) & 0xff);
rdmsr_safe(MSR_IA32_HWP_REQUEST, &data);
if (sc->hwp_pkg_ctrl && (data & IA32_HWP_REQUEST_PACKAGE_CONTROL)) {
data2 = 0;
if (sc->hwp_pkg_ctrl && (data & IA32_HWP_REQUEST_PACKAGE_CONTROL))
rdmsr_safe(MSR_IA32_HWP_REQUEST_PKG, &data2);
}
sbuf_putc(sb, '\n');
#define pkg_print(x, name, offset) do { \
if (!sc->hwp_pkg_ctrl || (data & x) != 0) \
sbuf_printf(sb, "\t%s: %03ju\n", name, (data >> offset) & 0xff);\
else \
sbuf_printf(sb, "\t%s: %03ju\n", name, (data2 >> offset) & 0xff);\
#define pkg_print(x, name, offset) do { \
if (!sc->hwp_pkg_ctrl || (data & x) != 0) \
sbuf_printf(sb, "\t%s: %03u\n", name, \
(unsigned)(data >> offset) & 0xff); \
else \
sbuf_printf(sb, "\t%s: %03u\n", name, \
(unsigned)(data2 >> offset) & 0xff); \
} while (0)
pkg_print(IA32_HWP_REQUEST_EPP_VALID,
@ -413,7 +415,7 @@ intel_hwpstate_attach(device_t dev)
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
"epp", CTLTYPE_INT | CTLFLAG_RWTUN, dev, sizeof(dev),
"epp", CTLTYPE_INT | CTLFLAG_RWTUN, dev, 0,
sysctl_epp_select, "I",
"Efficiency/Performance Preference "
"(range from 0, most performant, through 100, most efficient)");

View File

@ -933,7 +933,7 @@ printcpuinfo(void)
"\034PTSC" /* Performance TSC */
"\035PL2I" /* L2I perf count */
"\036MWAITX" /* MONITORX/MWAITX instructions */
"\037<b30>"
"\037ADMSKX" /* Address mask extension */
"\040<b31>"
);
}
@ -1024,10 +1024,12 @@ printcpuinfo(void)
"\020"
"\003AVX512_4VNNIW"
"\004AVX512_4FMAPS"
"\005FSRM"
"\011AVX512VP2INTERSECT"
"\013MD_CLEAR"
"\016TSXFA"
"\023PCONFIG"
"\025IBT"
"\033IBPB"
"\034STIBP"
"\035L1DFL"

View File

@ -68,6 +68,36 @@ attach_r_cleanup()
geli_test_cleanup
}
atf_test_case attach_multiple cleanup
attach_multiple_head()
{
atf_set "descr" "geli attach can attach multiple providers"
atf_set "require.user" "root"
}
attach_multiple_body()
{
geli_test_setup
sectors=100
md0=$(attach_md -t malloc -s `expr $sectors + 1`)
md1=$(attach_md -t malloc -s `expr $sectors + 1`)
md2=$(attach_md -t malloc -s `expr $sectors + 1`)
atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none
atf_check geli init -B none -P -K keyfile ${md0}
atf_check geli init -B none -P -K keyfile ${md1}
atf_check geli init -B none -P -K keyfile ${md2}
atf_check geli attach -p -k keyfile ${md0} ${md1} ${md2}
# verify that it did create all 3 geli devices
atf_check -s exit:0 test -c /dev/${md0}.eli
atf_check -s exit:0 test -c /dev/${md1}.eli
atf_check -s exit:0 test -c /dev/${md2}.eli
}
attach_multiple_cleanup()
{
geli_test_cleanup
}
atf_test_case nokey cleanup
nokey_head()
{
@ -95,5 +125,6 @@ atf_init_test_cases()
{
atf_add_test_case attach_d
atf_add_test_case attach_r
atf_add_test_case attach_multiple
atf_add_test_case nokey
}

View File

@ -9,6 +9,7 @@ ATF_TESTS_SH+= if_lagg_test
ATF_TESTS_SH+= if_clone_test
ATF_TESTS_SH+= if_tun_test
ATF_TESTS_SH+= if_vlan
ATF_TESTS_C+= if_epair
TESTS_SUBDIRS+= routing
@ -18,7 +19,7 @@ TESTS_SUBDIRS+= routing
TEST_METADATA+= is_exclusive=true
MAN=
PROG= randsleep
PROGS+= randsleep
WARNS?= 6

73
tests/sys/net/if_epair.c Normal file
View File

@ -0,0 +1,73 @@
/*-
* Copyright (c) 2020 Kristof Provost <kp@FreeBSD.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#include <sys/ioctl.h>
#include <sys/linker.h>
#include <sys/module.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <net/if.h>
#include <fcntl.h>
#include <stdio.h>
#include <atf-c.h>
ATF_TC(params);
ATF_TC_HEAD(params, tc)
{
atf_tc_set_md_var(tc, "require.user", "root");
}
ATF_TC_BODY(params, tc)
{
struct ifreq ifr;
int s;
s = kldload("if_epair");
if (s != 0)
atf_tc_fail("Failed to load if_epair");
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0)
atf_tc_fail("Failed to create socket");
bzero(&ifr, sizeof(ifr));
ifr.ifr_data = (caddr_t)-1;
(void) strlcpy(ifr.ifr_name, "epair", sizeof(ifr.ifr_name));
ioctl(s, SIOCIFCREATE2, &ifr);
}
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, params);
return (atf_no_error());
}

View File

@ -47,25 +47,7 @@
#define QTEST_QITRUNC(q, iv) ((iv) >> Q_RPSHFT(q))
#define QTEST_FFACTOR 32.0
#define bitsperrand 31
#define GENRAND(a, lb, ub) \
({ \
int _rembits; \
do { \
_rembits = Q_BITSPERBASEUP(ub) + Q_LTZ(lb); \
*(a) = (__typeof(*(a)))0; \
while (_rembits > 0) { \
*(a) |= (((uint64_t)random()) & \
((1ULL << (_rembits > bitsperrand ? \
bitsperrand : _rembits)) - 1)); \
*(a) <<= (_rembits - (_rembits > bitsperrand ? \
bitsperrand : _rembits)); \
_rembits -= bitsperrand; \
} \
*(a) += lb; \
} while (*(a) < (lb) || (uint64_t)*(a) > (ub)); \
*(a); \
})
#define GENRAND(a) arc4random_buf((a), sizeof(*(a)))
/*
* Smoke tests for basic qmath operations, such as initialization
@ -213,11 +195,9 @@ ATF_TC_BODY(qmulq_s64q, tc)
#endif
int error;
srandomdev();
for (int i = 0; i < 10;) {
GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&a_s64q);
GENRAND(&b_s64q);
/*
* XXX: We cheat a bit, to stand any chance of multiplying
@ -278,12 +258,9 @@ ATF_TC_BODY(qdivq_s64q, tc)
if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
atf_tc_skip("https://bugs.freebsd.org/240219");
srandomdev();
for (int i = 0; i < 10; i++) {
GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&a_s64q);
GENRAND(&b_s64q);
/*
* XXXLAS: Until Qmath handles precision normalisation, only
* test with equal precision.
@ -324,11 +301,9 @@ ATF_TC_BODY(qaddq_s64q, tc)
double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl;
int error;
srandomdev();
for (int i = 0; i < 10;) {
GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&a_s64q);
GENRAND(&b_s64q);
/*
* XXXLAS: Until Qmath handles precision normalisation, only
* test with equal precision.
@ -372,11 +347,9 @@ ATF_TC_BODY(qsubq_s64q, tc)
double a_dbl, b_dbl, r_dbl, maxe_dbl, delta_dbl;
int error;
srandomdev();
for (int i = 0; i < 10; i++) {
GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&a_s64q);
GENRAND(&b_s64q);
/*
* XXXLAS: Until Qmath handles precision normalisation, only
* test with equal precision.
@ -418,11 +391,9 @@ ATF_TC_BODY(qfraci_s64q, tc)
int64_t a_int, b_int;
int error;
srandomdev();
for (int i = 0; i < 10;) {
GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&a_s64q);
GENRAND(&b_s64q);
/*
* XXXLAS: Until Qmath handles precision normalisation, only
* test with equal precision.
@ -465,11 +436,9 @@ ATF_TC_BODY(qmuli_s64q, tc)
int64_t a_int, b_int;
int error;
srandomdev();
for (int i = 0; i < 10;) {
GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&a_s64q);
GENRAND(&b_s64q);
/*
* XXXLAS: Until Qmath handles precision normalisation, only
* test with equal precision.
@ -512,11 +481,9 @@ ATF_TC_BODY(qaddi_s64q, tc)
int64_t a_int, b_int;
int error;
srandomdev();
for (int i = 0; i < 10;) {
GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&a_s64q);
GENRAND(&b_s64q);
/*
* XXXLAS: Until Qmath handles precision normalisation, only
* test with equal precision.
@ -563,11 +530,9 @@ ATF_TC_BODY(qsubi_s64q, tc)
int64_t a_int, b_int;
int error;
srandomdev();
for (int i = 0; i < 10; i++) {
GENRAND(&a_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&b_s64q, INT64_MIN, UINT64_MAX);
GENRAND(&a_s64q);
GENRAND(&b_s64q);
/*
* XXXLAS: Until Qmath handles precision normalisation, only
* test with equal precision.

View File

@ -324,6 +324,7 @@
08/19 Chin-San Huang <chinsan@FreeBSD.org> born in Yi-Lan, Taiwan, Republic of China, 1979
08/19 Pav Lucistnik <pav@FreeBSD.org> born in Kutna Hora, Czech Republic, 1980
08/20 Michael Heffner <mikeh@FreeBSD.org> born in Cleona, Pennsylvania, United States, 1981
08/21 Alfredo Dal'Ava Junior <alfredo@FreeBSD.org> born in Pocos de Caldas, Minas Gerais, Brazil, 1981
08/21 Jason A. Harmening <jah@FreeBSD.org> born in Fort Wayne, Indiana, United States, 1981
08/22 Ilya Bakulin <kibab@FreeBSD.org> born in Tbilisi, USSR, 1986
08/24 Mark Linimon <linimon@FreeBSD.org> born in Houston, Texas, United States, 1955

View File

@ -41,13 +41,25 @@ f_include $BSDCFG_SHARE/dialog.subr
hline_arrows_tab_enter="Press arrows, TAB or ENTER"
hline_arrows_tab_space_enter="Press arrows, TAB, SPACE or ENTER"
msg_abort="Abort"
msg_an_installation_step_has_been_aborted="An installation step has been aborted. Would you like\nto restart the installation or exit the installer?"
msg_auto_ufs="Auto (UFS)"
msg_auto_ufs_desc="Guided UFS Disk Setup"
msg_auto_ufs_help="Menu options help choose which disk to setup using UFS and standard partitions"
msg_auto_zfs="Auto (ZFS)"
msg_auto_zfs_desc="Guided Root-on-ZFS"
msg_auto_zfs_help="To use ZFS with less than 8GB RAM, see https://wiki.freebsd.org/ZFSTuningGuide"
msg_exit="Exit"
msg_freebsd_installer="FreeBSD Installer"
msg_gpt_active_fix="Your hardware is known to have issues booting in CSM/Legacy/BIOS mode from GPT partitions that are not set active. Would you like the installer to apply this workaround for you?"
msg_lenovo_fix="Your model of Lenovo is known to have a BIOS bug that prevents it booting from GPT partitions without UEFI. Would you like the installer to apply a workaround for you?"
msg_an_installation_step_has_been_aborted="An installation step has been aborted. Would you like\nto restart the installation or exit the installer?"
msg_manual="Manual"
msg_manual_desc="Manual Disk Setup (experts)"
msg_manual_help="Create customized partitions from menu options"
msg_no="NO"
msg_restart="Restart"
msg_shell="Shell"
msg_shell_desc="Open a shell and partition by hand"
msg_shell_help="Create customized partitions using command-line utilities"
msg_yes="YES"
############################################################ FUNCTIONS
@ -281,42 +293,47 @@ if f_interactive; then
esac
fi
PMODES="\
\"Auto (UFS)\" \"Guided Disk Setup\" \
Manual \"Manual Disk Setup (experts)\" \
Shell \"Open a shell and partition by hand\""
PMODES="
'$msg_auto_ufs' '$msg_auto_ufs_desc' '$msg_auto_ufs_help'
'$msg_manual' '$msg_manual_desc' '$msg_manual_help'
'$msg_shell' '$msg_shell_desc' '$msg_shell_help'
" # END-QUOTE
CURARCH=$( uname -m )
case $CURARCH in
amd64|arm64|i386) # Booting ZFS Supported
PMODES="\"Auto (ZFS)\" \"Guided Root-on-ZFS\" $PMODES"
PMODES="
'$msg_auto_zfs' '$msg_auto_zfs_desc' '$msg_auto_zfs_help'
$PMODES
" # END-QUOTE
;;
*) # Booting ZFS Unspported
*) # Booting ZFS Unsupported
;;
esac
exec 3>&1
PARTMODE=`echo $PMODES | xargs dialog --backtitle "FreeBSD Installer" \
--title "Partitioning" \
--item-help \
--menu "How would you like to partition your disk?" \
0 0 0 2>&1 1>&3` || exit 1
exec 3>&-
case "$PARTMODE" in
"Auto (ZFS)") # ZFS
"$msg_auto_zfs") # ZFS
bsdinstall zfsboot || error "ZFS setup failed"
bsdinstall mount || error "Failed to mount filesystem"
;;
"Auto (UFS)") # Guided
"$msg_auto_ufs") # Guided UFS
bsdinstall autopart || error "Partitioning error"
bsdinstall mount || error "Failed to mount filesystem"
;;
"Shell") # Shell
"$msg_shell") # Shell
clear
echo "Use this shell to set up partitions for the new system. When finished, mount the system at $BSDINSTALL_CHROOT and place an fstab file for the new system at $PATH_FSTAB. Then type 'exit'. You can also enter the partition editor at any time by entering 'bsdinstall partedit'."
sh 2>&1
;;
"Manual") # Manual
"$msg_manual") # Manual
if f_isset debugFile; then
# Give partedit the path to our logfile so it can append
BSDINSTALL_LOG="${debugFile#+}" bsdinstall partedit || error "Partitioning error"

View File

@ -621,6 +621,7 @@ ber_printf_elements(struct ber_element *ber, char *fmt, ...)
return (ber);
fail:
va_end(ap);
return (NULL);
}