1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

Merge ^/head r287490 through r287501.

This commit is contained in:
Dimitry Andric 2015-09-06 12:02:28 +00:00
commit 1757ba14bf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang-trunk/; revision=287502
48 changed files with 1048 additions and 1884 deletions

View File

@ -3,6 +3,7 @@
.clang-format
.gitignore
CMakeLists.txt
CODE_OWNERS.txt
INSTALL.txt
Makefile
cmake/
@ -27,6 +28,7 @@ include/lldb/Host/msvc/
include/lldb/Host/windows/
include/lldb/Makefile
lib/
lit/
lldb.xcodeproj/
lldb.xcworkspace/
resources/
@ -46,12 +48,15 @@ source/Expression/CMakeLists.txt
source/Expression/Makefile
source/Host/CMakeLists.txt
source/Host/Makefile
source/Host/android/
source/Host/common/Makefile
source/Host/freebsd/Makefile
source/Host/linux/
source/Host/macosx/
source/Host/posix/Makefile
source/Host/windows/
source/Initialization/CMakeLists.txt
source/Initialization/Makefile
source/Interpreter/CMakeLists.txt
source/Interpreter/Makefile
source/Makefile
@ -62,8 +67,18 @@ source/Plugins/ABI/MacOSX-arm64/CMakeLists.txt
source/Plugins/ABI/MacOSX-arm64/Makefile
source/Plugins/ABI/MacOSX-i386/CMakeLists.txt
source/Plugins/ABI/MacOSX-i386/Makefile
source/Plugins/ABI/SysV-arm/CMakeLists.txt
source/Plugins/ABI/SysV-arm/Makefile
source/Plugins/ABI/SysV-arm64/CMakeLists.txt
source/Plugins/ABI/SysV-arm64/Makefile
source/Plugins/ABI/SysV-hexagon/CMakeLists.txt
source/Plugins/ABI/SysV-hexagon/Makefile
source/Plugins/ABI/SysV-i386/CMakeLists.txt
source/Plugins/ABI/SysV-i386/Makefile
source/Plugins/ABI/SysV-mips/CMakeLists.txt
source/Plugins/ABI/SysV-mips/Makefile
source/Plugins/ABI/SysV-mips64/CMakeLists.txt
source/Plugins/ABI/SysV-mips64/Makefile
source/Plugins/ABI/SysV-ppc/CMakeLists.txt
source/Plugins/ABI/SysV-ppc/Makefile
source/Plugins/ABI/SysV-ppc64/CMakeLists.txt
@ -88,6 +103,10 @@ source/Plugins/Instruction/ARM/Makefile
source/Plugins/Instruction/ARM64/CMakeLists.txt
source/Plugins/Instruction/ARM64/Makefile
source/Plugins/Instruction/CMakeLists.txt
source/Plugins/Instruction/MIPS/CMakeLists.txt
source/Plugins/Instruction/MIPS/Makefile
source/Plugins/Instruction/MIPS64/CMakeLists.txt
source/Plugins/Instruction/MIPS64/Makefile
source/Plugins/InstrumentationRuntime/AddressSanitizer/CMakeLists.txt
source/Plugins/InstrumentationRuntime/AddressSanitizer/Makefile
source/Plugins/InstrumentationRuntime/CMakeLists.txt
@ -99,6 +118,9 @@ source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/CMakeLists.txt
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/Makefile
source/Plugins/LanguageRuntime/ObjC/
source/Plugins/LanguageRuntime/RenderScript/CMakeLists.txt
source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt
source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/Makefile
source/Plugins/Makefile
source/Plugins/MemoryHistory/CMakeLists.txt
source/Plugins/MemoryHistory/asan/CMakeLists.txt
@ -117,6 +139,7 @@ source/Plugins/ObjectFile/PECOFF/
source/Plugins/OperatingSystem/CMakeLists.txt
source/Plugins/OperatingSystem/Python/CMakeLists.txt
source/Plugins/OperatingSystem/Python/Makefile
source/Plugins/Platform/Android/
source/Plugins/Platform/CMakeLists.txt
source/Plugins/Platform/FreeBSD/CMakeLists.txt
source/Plugins/Platform/FreeBSD/Makefile
@ -168,6 +191,7 @@ source/Utility/Makefile
test/
tools/CMakeLists.txt
tools/Makefile
tools/argdumper/CMakeLists.txt
tools/darwin-debug/
tools/darwin-threads/
tools/debugserver/
@ -180,7 +204,9 @@ tools/lldb-mi/CMakeLists.txt
tools/lldb-mi/Makefile
tools/lldb-mi/lldb-Info.plist
tools/lldb-perf/
tools/lldb-platform/CMakeLists.txt
tools/lldb-platform/Makefile
tools/lldb-platform/
tools/lldb-server/CMakeLists.txt
tools/lldb-server/Makefile
unittests/
utils/
www/

View File

@ -4001,7 +4001,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun,
struct ctl_lun *nlun, *lun;
struct scsi_vpd_id_descriptor *desc;
struct scsi_vpd_id_t10 *t10id;
const char *eui, *naa, *scsiname, *vendor, *value;
const char *eui, *naa, *scsiname, *vendor;
int lun_number, i, lun_malloced;
int devidlen, idlen1, idlen2 = 0, len;
@ -4167,21 +4167,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun,
if (be_lun->flags & CTL_LUN_FLAG_PRIMARY)
lun->flags |= CTL_LUN_PRIMARY_SC;
value = ctl_get_opt(&be_lun->options, "readonly");
if (value != NULL && strcmp(value, "on") == 0)
lun->flags |= CTL_LUN_READONLY;
lun->serseq = CTL_LUN_SERSEQ_OFF;
if (be_lun->flags & CTL_LUN_FLAG_SERSEQ_READ)
lun->serseq = CTL_LUN_SERSEQ_READ;
value = ctl_get_opt(&be_lun->options, "serseq");
if (value != NULL && strcmp(value, "on") == 0)
lun->serseq = CTL_LUN_SERSEQ_ON;
else if (value != NULL && strcmp(value, "read") == 0)
lun->serseq = CTL_LUN_SERSEQ_READ;
else if (value != NULL && strcmp(value, "off") == 0)
lun->serseq = CTL_LUN_SERSEQ_OFF;
lun->ctl_softc = ctl_softc;
#ifdef CTL_TIME_IO
lun->last_busy = getsbinuptime();
@ -6274,7 +6259,7 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
header->datalen = MIN(total_len - 1, 254);
if (control_dev == 0) {
header->dev_specific = 0x10; /* DPOFUA */
if ((lun->flags & CTL_LUN_READONLY) ||
if ((lun->be_lun->flags & CTL_LUN_FLAG_READONLY) ||
(lun->mode_pages.control_page[CTL_PAGE_CURRENT]
.eca_and_aen & SCP_SWP) != 0)
header->dev_specific |= 0x80; /* WP */
@ -6297,7 +6282,7 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
scsi_ulto2b(datalen, header->datalen);
if (control_dev == 0) {
header->dev_specific = 0x10; /* DPOFUA */
if ((lun->flags & CTL_LUN_READONLY) ||
if ((lun->be_lun->flags & CTL_LUN_FLAG_READONLY) ||
(lun->mode_pages.control_page[CTL_PAGE_CURRENT]
.eca_and_aen & SCP_SWP) != 0)
header->dev_specific |= 0x80; /* WP */
@ -10530,15 +10515,16 @@ ctl_check_for_blockage(struct ctl_lun *lun, union ctl_io *pending_io,
return (CTL_ACTION_BLOCK);
case CTL_SER_EXTENT:
return (ctl_extent_check(ooa_io, pending_io,
(lun->serseq == CTL_LUN_SERSEQ_ON)));
(lun->be_lun && lun->be_lun->serseq == CTL_LUN_SERSEQ_ON)));
case CTL_SER_EXTENTOPT:
if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT].queue_flags
& SCP_QUEUE_ALG_MASK) != SCP_QUEUE_ALG_UNRESTRICTED)
return (ctl_extent_check(ooa_io, pending_io,
(lun->serseq == CTL_LUN_SERSEQ_ON)));
(lun->be_lun &&
lun->be_lun->serseq == CTL_LUN_SERSEQ_ON)));
return (CTL_ACTION_PASS);
case CTL_SER_EXTENTSEQ:
if (lun->serseq != CTL_LUN_SERSEQ_OFF)
if (lun->be_lun && lun->be_lun->serseq != CTL_LUN_SERSEQ_OFF)
return (ctl_extent_check_seq(ooa_io, pending_io));
return (CTL_ACTION_PASS);
case CTL_SER_PASS:
@ -10765,7 +10751,8 @@ ctl_scsiio_lun_check(struct ctl_lun *lun,
}
if (entry->pattern & CTL_LUN_PAT_WRITE) {
if (lun->flags & CTL_LUN_READONLY) {
if (lun->be_lun &&
lun->be_lun->flags & CTL_LUN_FLAG_READONLY) {
ctl_set_sense(ctsio, /*current_error*/ 1,
/*sense_key*/ SSD_KEY_DATA_PROTECT,
/*asc*/ 0x27, /*ascq*/ 0x01, SSD_ELEM_NONE);

View File

@ -208,6 +208,8 @@ typedef STAILQ_HEAD(ctl_options, ctl_option) ctl_options_t;
struct ctl_be_arg;
void ctl_init_opts(ctl_options_t *opts, int num_args, struct ctl_be_arg *args);
void ctl_update_opts(ctl_options_t *opts, int num_args,
struct ctl_be_arg *args);
void ctl_free_opts(ctl_options_t *opts);
char * ctl_get_opt(ctl_options_t *opts, const char *name);
int ctl_expand_number(const char *buf, uint64_t *num);

View File

@ -185,14 +185,47 @@ ctl_init_opts(ctl_options_t *opts, int num_args, struct ctl_be_arg *args)
if ((args[i].flags & CTL_BEARG_ASCII) == 0)
continue;
opt = malloc(sizeof(*opt), M_CTL, M_WAITOK);
opt->name = malloc(strlen(args[i].kname) + 1, M_CTL, M_WAITOK);
strcpy(opt->name, args[i].kname);
opt->value = malloc(strlen(args[i].kvalue) + 1, M_CTL, M_WAITOK);
strcpy(opt->value, args[i].kvalue);
opt->name = strdup(args[i].kname, M_CTL);
opt->value = strdup(args[i].kvalue, M_CTL);
STAILQ_INSERT_TAIL(opts, opt, links);
}
}
void
ctl_update_opts(ctl_options_t *opts, int num_args, struct ctl_be_arg *args)
{
struct ctl_option *opt;
int i;
for (i = 0; i < num_args; i++) {
if ((args[i].flags & CTL_BEARG_RD) == 0)
continue;
if ((args[i].flags & CTL_BEARG_ASCII) == 0)
continue;
STAILQ_FOREACH(opt, opts, links) {
if (strcmp(opt->name, args[i].kname) == 0)
break;
}
if (args[i].kvalue != NULL &&
((char *)args[i].kvalue)[0] != 0) {
if (opt) {
free(opt->value, M_CTL);
opt->value = strdup(args[i].kvalue, M_CTL);
} else {
opt = malloc(sizeof(*opt), M_CTL, M_WAITOK);
opt->name = strdup(args[i].kname, M_CTL);
opt->value = strdup(args[i].kvalue, M_CTL);
STAILQ_INSERT_TAIL(opts, opt, links);
}
} else if (opt) {
STAILQ_REMOVE(opts, opt, ctl_option, links);
free(opt->name, M_CTL);
free(opt->value, M_CTL);
free(opt, M_CTL);
}
}
}
void
ctl_free_opts(ctl_options_t *opts)
{

View File

@ -86,9 +86,15 @@ typedef enum {
CTL_LUN_FLAG_DEV_TYPE = 0x40,
CTL_LUN_FLAG_UNMAP = 0x80,
CTL_LUN_FLAG_OFFLINE = 0x100,
CTL_LUN_FLAG_SERSEQ_READ = 0x200
CTL_LUN_FLAG_READONLY = 0x200
} ctl_backend_lun_flags;
typedef enum {
CTL_LUN_SERSEQ_OFF,
CTL_LUN_SERSEQ_READ,
CTL_LUN_SERSEQ_ON
} ctl_lun_serseq;
#ifdef _KERNEL
#define CTL_BACKEND_DECLARE(name, driver) \
@ -195,6 +201,7 @@ typedef void (*be_lun_config_t)(void *be_lun,
struct ctl_be_lun {
uint8_t lun_type; /* passed to CTL */
ctl_backend_lun_flags flags; /* passed to CTL */
ctl_lun_serseq serseq; /* passed to CTL */
void *be_lun; /* passed to CTL */
uint64_t maxlba; /* passed to CTL */
uint32_t blocksize; /* passed to CTL */

File diff suppressed because it is too large Load Diff

View File

@ -73,13 +73,14 @@ typedef enum {
} ctl_be_ramdisk_lun_flags;
struct ctl_be_ramdisk_lun {
struct ctl_lun_create_params params;
char lunname[32];
uint64_t size_bytes;
uint64_t size_blocks;
struct ctl_be_ramdisk_softc *softc;
ctl_be_ramdisk_lun_flags flags;
STAILQ_ENTRY(ctl_be_ramdisk_lun) links;
struct ctl_be_lun ctl_be_lun;
struct ctl_be_lun cbe_lun;
struct taskqueue *io_taskqueue;
struct task io_task;
STAILQ_HEAD(, ctl_io_hdr) cont_queue;
@ -111,7 +112,7 @@ static int ctl_backend_ramdisk_ioctl(struct cdev *dev, u_long cmd,
static int ctl_backend_ramdisk_rm(struct ctl_be_ramdisk_softc *softc,
struct ctl_lun_req *req);
static int ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc,
struct ctl_lun_req *req, int do_wait);
struct ctl_lun_req *req);
static int ctl_backend_ramdisk_modify(struct ctl_be_ramdisk_softc *softc,
struct ctl_lun_req *req);
static void ctl_backend_ramdisk_worker(void *context, int pending);
@ -194,8 +195,8 @@ ctl_backend_ramdisk_shutdown(void)
* lock of the same mutex, which would cause a hang.
*/
mtx_unlock(&softc->lock);
ctl_disable_lun(&lun->ctl_be_lun);
ctl_invalidate_lun(&lun->ctl_be_lun);
ctl_disable_lun(&lun->cbe_lun);
ctl_invalidate_lun(&lun->cbe_lun);
mtx_lock(&softc->lock);
}
mtx_unlock(&softc->lock);
@ -218,16 +219,16 @@ ctl_backend_ramdisk_shutdown(void)
static int
ctl_backend_ramdisk_move_done(union ctl_io *io)
{
struct ctl_be_lun *ctl_be_lun;
struct ctl_be_lun *cbe_lun;
struct ctl_be_ramdisk_lun *be_lun;
#ifdef CTL_TIME_IO
struct bintime cur_bt;
#endif
CTL_DEBUG_PRINT(("ctl_backend_ramdisk_move_done\n"));
ctl_be_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[
cbe_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[
CTL_PRIV_BACKEND_LUN].ptr;
be_lun = (struct ctl_be_ramdisk_lun *)ctl_be_lun->be_lun;
be_lun = (struct ctl_be_ramdisk_lun *)cbe_lun->be_lun;
#ifdef CTL_TIME_IO
getbintime(&cur_bt);
bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt);
@ -274,10 +275,10 @@ ctl_backend_ramdisk_move_done(union ctl_io *io)
static int
ctl_backend_ramdisk_submit(union ctl_io *io)
{
struct ctl_be_lun *ctl_be_lun;
struct ctl_be_lun *cbe_lun;
struct ctl_lba_len_flags *lbalen;
ctl_be_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[
cbe_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[
CTL_PRIV_BACKEND_LUN].ptr;
lbalen = (struct ctl_lba_len_flags *)&io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
if (lbalen->flags & CTL_LLF_VERIFY) {
@ -286,7 +287,7 @@ ctl_backend_ramdisk_submit(union ctl_io *io)
return (CTL_RETVAL_COMPLETE);
}
io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer =
lbalen->len * ctl_be_lun->blocksize;
lbalen->len * cbe_lun->blocksize;
ctl_backend_ramdisk_continue(io);
return (CTL_RETVAL_COMPLETE);
}
@ -391,8 +392,7 @@ ctl_backend_ramdisk_ioctl(struct cdev *dev, u_long cmd, caddr_t addr,
switch (lun_req->reqtype) {
case CTL_LUNREQ_CREATE:
retval = ctl_backend_ramdisk_create(softc, lun_req,
/*do_wait*/ 1);
retval = ctl_backend_ramdisk_create(softc, lun_req);
break;
case CTL_LUNREQ_RM:
retval = ctl_backend_ramdisk_rm(softc, lun_req);
@ -434,7 +434,7 @@ ctl_backend_ramdisk_rm(struct ctl_be_ramdisk_softc *softc,
mtx_lock(&softc->lock);
STAILQ_FOREACH(be_lun, &softc->lun_list, links) {
if (be_lun->ctl_be_lun.lun_id == params->lun_id)
if (be_lun->cbe_lun.lun_id == params->lun_id)
break;
}
mtx_unlock(&softc->lock);
@ -446,7 +446,7 @@ ctl_backend_ramdisk_rm(struct ctl_be_ramdisk_softc *softc,
goto bailout_error;
}
retval = ctl_disable_lun(&be_lun->ctl_be_lun);
retval = ctl_disable_lun(&be_lun->cbe_lun);
if (retval != 0) {
snprintf(req->error_str, sizeof(req->error_str),
@ -467,7 +467,7 @@ ctl_backend_ramdisk_rm(struct ctl_be_ramdisk_softc *softc,
be_lun->flags |= CTL_BE_RAMDISK_LUN_WAITING;
mtx_unlock(&softc->lock);
retval = ctl_invalidate_lun(&be_lun->ctl_be_lun);
retval = ctl_invalidate_lun(&be_lun->cbe_lun);
if (retval != 0) {
snprintf(req->error_str, sizeof(req->error_str),
"%s: error %d returned from ctl_invalidate_lun() for "
@ -504,7 +504,7 @@ ctl_backend_ramdisk_rm(struct ctl_be_ramdisk_softc *softc,
if (retval == 0) {
taskqueue_drain(be_lun->io_taskqueue, &be_lun->io_task);
taskqueue_free(be_lun->io_taskqueue);
ctl_free_opts(&be_lun->ctl_be_lun.options);
ctl_free_opts(&be_lun->cbe_lun.options);
mtx_destroy(&be_lun->queue_lock);
free(be_lun, M_RAMDISK);
}
@ -521,122 +521,104 @@ ctl_backend_ramdisk_rm(struct ctl_be_ramdisk_softc *softc,
static int
ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc,
struct ctl_lun_req *req, int do_wait)
struct ctl_lun_req *req)
{
struct ctl_be_ramdisk_lun *be_lun;
struct ctl_be_lun *cbe_lun;
struct ctl_lun_create_params *params;
uint32_t blocksize;
char *value;
char tmpstr[32];
int retval, unmap;
int retval;
retval = 0;
params = &req->reqdata.create;
if (params->blocksize_bytes != 0)
blocksize = params->blocksize_bytes;
else
blocksize = 512;
be_lun = malloc(sizeof(*be_lun), M_RAMDISK, M_ZERO | (do_wait ?
M_WAITOK : M_NOWAIT));
if (be_lun == NULL) {
snprintf(req->error_str, sizeof(req->error_str),
"%s: error allocating %zd bytes", __func__,
sizeof(*be_lun));
goto bailout_error;
}
be_lun = malloc(sizeof(*be_lun), M_RAMDISK, M_ZERO | M_WAITOK);
cbe_lun = &be_lun->cbe_lun;
cbe_lun->be_lun = be_lun;
be_lun->params = req->reqdata.create;
be_lun->softc = softc;
sprintf(be_lun->lunname, "cram%d", softc->num_luns);
ctl_init_opts(&be_lun->ctl_be_lun.options,
req->num_be_args, req->kern_be_args);
ctl_init_opts(&cbe_lun->options, req->num_be_args, req->kern_be_args);
if (params->flags & CTL_LUN_FLAG_DEV_TYPE)
be_lun->ctl_be_lun.lun_type = params->device_type;
cbe_lun->lun_type = params->device_type;
else
be_lun->ctl_be_lun.lun_type = T_DIRECT;
cbe_lun->lun_type = T_DIRECT;
be_lun->flags = CTL_BE_RAMDISK_LUN_UNCONFIGURED;
cbe_lun->flags = CTL_LUN_FLAG_PRIMARY;
if (be_lun->ctl_be_lun.lun_type == T_DIRECT) {
if (params->lun_size_bytes < blocksize) {
if (cbe_lun->lun_type == T_DIRECT) {
if (params->blocksize_bytes != 0)
cbe_lun->blocksize = params->blocksize_bytes;
else
cbe_lun->blocksize = 512;
if (params->lun_size_bytes < cbe_lun->blocksize) {
snprintf(req->error_str, sizeof(req->error_str),
"%s: LUN size %ju < blocksize %u", __func__,
params->lun_size_bytes, blocksize);
params->lun_size_bytes, cbe_lun->blocksize);
goto bailout_error;
}
be_lun->size_blocks = params->lun_size_bytes / blocksize;
be_lun->size_bytes = be_lun->size_blocks * blocksize;
be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1;
be_lun->ctl_be_lun.atomicblock = UINT32_MAX;
be_lun->ctl_be_lun.opttxferlen = softc->rd_size / blocksize;
} else {
be_lun->ctl_be_lun.maxlba = 0;
blocksize = 0;
be_lun->size_bytes = 0;
be_lun->size_blocks = 0;
be_lun->size_blocks = params->lun_size_bytes / cbe_lun->blocksize;
be_lun->size_bytes = be_lun->size_blocks * cbe_lun->blocksize;
cbe_lun->maxlba = be_lun->size_blocks - 1;
cbe_lun->atomicblock = UINT32_MAX;
cbe_lun->opttxferlen = softc->rd_size / cbe_lun->blocksize;
}
be_lun->ctl_be_lun.blocksize = blocksize;
/* Tell the user the blocksize we ended up using */
params->blocksize_bytes = blocksize;
/* Tell the user the exact size we ended up using */
params->blocksize_bytes = cbe_lun->blocksize;
params->lun_size_bytes = be_lun->size_bytes;
be_lun->softc = softc;
unmap = 1;
value = ctl_get_opt(&be_lun->ctl_be_lun.options, "unmap");
value = ctl_get_opt(&cbe_lun->options, "unmap");
if (value != NULL && strcmp(value, "on") == 0)
unmap = (strcmp(value, "on") == 0);
be_lun->flags = CTL_BE_RAMDISK_LUN_UNCONFIGURED;
be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY;
if (unmap)
be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP;
be_lun->ctl_be_lun.be_lun = be_lun;
cbe_lun->flags |= CTL_LUN_FLAG_UNMAP;
value = ctl_get_opt(&cbe_lun->options, "readonly");
if (value != NULL && strcmp(value, "on") == 0)
cbe_lun->flags |= CTL_LUN_FLAG_READONLY;
cbe_lun->serseq = CTL_LUN_SERSEQ_OFF;
value = ctl_get_opt(&cbe_lun->options, "serseq");
if (value != NULL && strcmp(value, "on") == 0)
cbe_lun->serseq = CTL_LUN_SERSEQ_ON;
else if (value != NULL && strcmp(value, "read") == 0)
cbe_lun->serseq = CTL_LUN_SERSEQ_READ;
else if (value != NULL && strcmp(value, "off") == 0)
cbe_lun->serseq = CTL_LUN_SERSEQ_OFF;
if (params->flags & CTL_LUN_FLAG_ID_REQ) {
be_lun->ctl_be_lun.req_lun_id = params->req_lun_id;
be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_ID_REQ;
cbe_lun->req_lun_id = params->req_lun_id;
cbe_lun->flags |= CTL_LUN_FLAG_ID_REQ;
} else
be_lun->ctl_be_lun.req_lun_id = 0;
cbe_lun->req_lun_id = 0;
be_lun->ctl_be_lun.lun_shutdown = ctl_backend_ramdisk_lun_shutdown;
be_lun->ctl_be_lun.lun_config_status =
ctl_backend_ramdisk_lun_config_status;
be_lun->ctl_be_lun.be = &ctl_be_ramdisk_driver;
cbe_lun->lun_shutdown = ctl_backend_ramdisk_lun_shutdown;
cbe_lun->lun_config_status = ctl_backend_ramdisk_lun_config_status;
cbe_lun->be = &ctl_be_ramdisk_driver;
if ((params->flags & CTL_LUN_FLAG_SERIAL_NUM) == 0) {
snprintf(tmpstr, sizeof(tmpstr), "MYSERIAL%4d",
softc->num_luns);
strncpy((char *)be_lun->ctl_be_lun.serial_num, tmpstr,
MIN(sizeof(be_lun->ctl_be_lun.serial_num),
sizeof(tmpstr)));
strncpy((char *)cbe_lun->serial_num, tmpstr,
MIN(sizeof(cbe_lun->serial_num), sizeof(tmpstr)));
/* Tell the user what we used for a serial number */
strncpy((char *)params->serial_num, tmpstr,
MIN(sizeof(params->serial_num), sizeof(tmpstr)));
} else {
strncpy((char *)be_lun->ctl_be_lun.serial_num,
params->serial_num,
MIN(sizeof(be_lun->ctl_be_lun.serial_num),
strncpy((char *)cbe_lun->serial_num, params->serial_num,
MIN(sizeof(cbe_lun->serial_num),
sizeof(params->serial_num)));
}
if ((params->flags & CTL_LUN_FLAG_DEVID) == 0) {
snprintf(tmpstr, sizeof(tmpstr), "MYDEVID%4d", softc->num_luns);
strncpy((char *)be_lun->ctl_be_lun.device_id, tmpstr,
MIN(sizeof(be_lun->ctl_be_lun.device_id),
sizeof(tmpstr)));
strncpy((char *)cbe_lun->device_id, tmpstr,
MIN(sizeof(cbe_lun->device_id), sizeof(tmpstr)));
/* Tell the user what we used for a device ID */
strncpy((char *)params->device_id, tmpstr,
MIN(sizeof(params->device_id), sizeof(tmpstr)));
} else {
strncpy((char *)be_lun->ctl_be_lun.device_id,
params->device_id,
MIN(sizeof(be_lun->ctl_be_lun.device_id),
strncpy((char *)cbe_lun->device_id, params->device_id,
MIN(sizeof(cbe_lun->device_id),
sizeof(params->device_id)));
}
@ -667,7 +649,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc,
mtx_unlock(&softc->lock);
retval = ctl_add_lun(&be_lun->ctl_be_lun);
retval = ctl_add_lun(&be_lun->cbe_lun);
if (retval != 0) {
mtx_lock(&softc->lock);
STAILQ_REMOVE(&softc->lun_list, be_lun, ctl_be_ramdisk_lun,
@ -681,9 +663,6 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc,
goto bailout_error;
}
if (do_wait == 0)
return (retval);
mtx_lock(&softc->lock);
/*
@ -709,7 +688,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc,
mtx_unlock(&softc->lock);
goto bailout_error;
} else {
params->req_lun_id = be_lun->ctl_be_lun.lun_id;
params->req_lun_id = cbe_lun->lun_id;
}
mtx_unlock(&softc->lock);
@ -723,7 +702,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc,
if (be_lun->io_taskqueue != NULL) {
taskqueue_free(be_lun->io_taskqueue);
}
ctl_free_opts(&be_lun->ctl_be_lun.options);
ctl_free_opts(&cbe_lun->options);
mtx_destroy(&be_lun->queue_lock);
free(be_lun, M_RAMDISK);
}
@ -736,16 +715,15 @@ ctl_backend_ramdisk_modify(struct ctl_be_ramdisk_softc *softc,
struct ctl_lun_req *req)
{
struct ctl_be_ramdisk_lun *be_lun;
struct ctl_be_lun *cbe_lun;
struct ctl_lun_modify_params *params;
uint32_t blocksize;
params = &req->reqdata.modify;
be_lun = NULL;
mtx_lock(&softc->lock);
STAILQ_FOREACH(be_lun, &softc->lun_list, links) {
if (be_lun->ctl_be_lun.lun_id == params->lun_id)
if (be_lun->cbe_lun.lun_id == params->lun_id)
break;
}
mtx_unlock(&softc->lock);
@ -756,34 +734,24 @@ ctl_backend_ramdisk_modify(struct ctl_be_ramdisk_softc *softc,
__func__, params->lun_id);
goto bailout_error;
}
cbe_lun = &be_lun->cbe_lun;
if (params->lun_size_bytes == 0) {
snprintf(req->error_str, sizeof(req->error_str),
"%s: LUN size \"auto\" not supported "
"by the ramdisk backend", __func__);
goto bailout_error;
}
if (params->lun_size_bytes != 0)
be_lun->params.lun_size_bytes = params->lun_size_bytes;
ctl_update_opts(&cbe_lun->options, req->num_be_args, req->kern_be_args);
blocksize = be_lun->cbe_lun.blocksize;
blocksize = be_lun->ctl_be_lun.blocksize;
if (params->lun_size_bytes < blocksize) {
if (be_lun->params.lun_size_bytes < blocksize) {
snprintf(req->error_str, sizeof(req->error_str),
"%s: LUN size %ju < blocksize %u", __func__,
params->lun_size_bytes, blocksize);
be_lun->params.lun_size_bytes, blocksize);
goto bailout_error;
}
be_lun->size_blocks = params->lun_size_bytes / blocksize;
be_lun->size_blocks = be_lun->params.lun_size_bytes / blocksize;
be_lun->size_bytes = be_lun->size_blocks * blocksize;
/*
* The maximum LBA is the size - 1.
*
* XXX: Note that this field is being updated without locking,
* which might cause problems on 32-bit architectures.
*/
be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1;
ctl_lun_capacity_changed(&be_lun->ctl_be_lun);
be_lun->cbe_lun.maxlba = be_lun->size_blocks - 1;
ctl_lun_capacity_changed(&be_lun->cbe_lun);
/* Tell the user the exact size we ended up using */
params->lun_size_bytes = be_lun->size_bytes;
@ -848,9 +816,9 @@ ctl_backend_ramdisk_lun_config_status(void *be_lun,
/*
* We successfully added the LUN, attempt to enable it.
*/
if (ctl_enable_lun(&lun->ctl_be_lun) != 0) {
if (ctl_enable_lun(&lun->cbe_lun) != 0) {
printf("%s: ctl_enable_lun() failed!\n", __func__);
if (ctl_invalidate_lun(&lun->ctl_be_lun) != 0) {
if (ctl_invalidate_lun(&lun->cbe_lun) != 0) {
printf("%s: ctl_invalidate_lun() failed!\n",
__func__);
}
@ -911,23 +879,23 @@ ctl_backend_ramdisk_config_write(union ctl_io *io)
break;
case START_STOP_UNIT: {
struct scsi_start_stop_unit *cdb;
struct ctl_be_lun *ctl_be_lun;
struct ctl_be_lun *cbe_lun;
struct ctl_be_ramdisk_lun *be_lun;
cdb = (struct scsi_start_stop_unit *)io->scsiio.cdb;
ctl_be_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[
cbe_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[
CTL_PRIV_BACKEND_LUN].ptr;
be_lun = (struct ctl_be_ramdisk_lun *)ctl_be_lun->be_lun;
be_lun = (struct ctl_be_ramdisk_lun *)cbe_lun->be_lun;
if (cdb->how & SSS_START)
retval = ctl_start_lun(ctl_be_lun);
retval = ctl_start_lun(cbe_lun);
else {
retval = ctl_stop_lun(ctl_be_lun);
retval = ctl_stop_lun(cbe_lun);
#ifdef NEEDTOPORT
if ((retval == 0)
&& (cdb->byte2 & SSS_ONOFFLINE))
retval = ctl_lun_offline(ctl_be_lun);
retval = ctl_lun_offline(cbe_lun);
#endif
}

View File

@ -160,12 +160,6 @@ typedef enum {
CTL_LUN_READONLY = 0x800
} ctl_lun_flags;
typedef enum {
CTL_LUN_SERSEQ_OFF,
CTL_LUN_SERSEQ_READ,
CTL_LUN_SERSEQ_ON
} ctl_lun_serseq;
typedef enum {
CTLBLOCK_FLAG_NONE = 0x00,
CTLBLOCK_FLAG_INVALID = 0x01
@ -376,7 +370,6 @@ struct ctl_lun {
struct mtx lun_lock;
uint64_t lun;
ctl_lun_flags flags;
ctl_lun_serseq serseq;
STAILQ_HEAD(,ctl_error_desc) error_list;
uint64_t error_serial;
struct ctl_softc *ctl_softc;

View File

@ -73,6 +73,10 @@
#define KHz(x) (1000*x)
#define MHz(x) KHz(1000*x)
/*
* Display related stuff
*/
/* store information about an Ixxx DVO */
/* The i830->i865 use multiple DVOs with multiple i2cs */
/* the i915, i945 have a single sDVO i2c bus - which is different */
@ -94,6 +98,7 @@
#define INTEL_OUTPUT_HDMI 6
#define INTEL_OUTPUT_DISPLAYPORT 7
#define INTEL_OUTPUT_EDP 8
#define INTEL_OUTPUT_UNKNOWN 9
/* Intel Pipe Clone Bit */
#define INTEL_HDMIB_CLONE_BIT 1

View File

@ -5,6 +5,17 @@
#ifndef _INTEL_RINGBUFFER_H_
#define _INTEL_RINGBUFFER_H_
/*
* Gen2 BSpec "1. Programming Environment" / 1.4.4.6 "Ring Buffer Use"
* Gen3 BSpec "vol1c Memory Interface Functions" / 2.3.4.5 "Ring Buffer Use"
* Gen4+ BSpec "vol1c Memory Interface and Command Stream" / 5.3.4.5 "Ring Buffer Use"
*
* "If the Ring Buffer Head Pointer and the Tail Pointer are on the same
* cacheline, the Head Pointer must not be greater than the Tail
* Pointer."
*/
#define I915_RING_FREE_SPACE 64
struct intel_hw_status_page {
u32 *page_addr;
unsigned int gfx_addr;
@ -60,7 +71,7 @@ struct intel_ring_buffer {
*/
u32 last_retired_head;
u32 irq_refcount;
u32 irq_refcount; /* protected by dev_priv->irq_lock */
u32 irq_enable_mask; /* bitmask to enable ring interrupt */
u32 trace_irq_seqno;
u32 sync_seqno[I915_NUM_RINGS-1];
@ -79,14 +90,15 @@ struct intel_ring_buffer {
uint32_t (*get_seqno)(struct intel_ring_buffer *ring);
int (*dispatch_execbuffer)(struct intel_ring_buffer *ring,
uint32_t offset, uint32_t length);
#define I915_DISPATCH_SECURE 0x1
#define I915_DISPATCH_PINNED 0x2
void (*cleanup)(struct intel_ring_buffer *ring);
int (*sync_to)(struct intel_ring_buffer *ring,
struct intel_ring_buffer *to,
u32 seqno);
u32 semaphore_register[3]; /*our mbox written by others */
u32 signal_mbox[2]; /* mboxes this ring signals to */
/**
* List of objects currently involved in rendering from the
* ringbuffer.
@ -162,10 +174,10 @@ intel_ring_sync_index(struct intel_ring_buffer *ring,
return idx;
}
static inline uint32_t
intel_read_status_page(struct intel_ring_buffer *ring, int reg)
static inline u32
intel_read_status_page(struct intel_ring_buffer *ring,
int reg)
{
/* Ensure that the compiler doesn't optimize away the load. */
__compiler_membar();
return (atomic_load_acq_32(ring->status_page.page_addr + reg));
@ -183,7 +195,7 @@ static inline int intel_wait_ring_idle(struct intel_ring_buffer *ring)
int intel_ring_begin(struct intel_ring_buffer *ring, int n);
static inline void intel_ring_emit(struct intel_ring_buffer *ring,
uint32_t data)
u32 data)
{
*(volatile uint32_t *)((char *)ring->virtual_start +
ring->tail) = data;

View File

@ -63,6 +63,11 @@ struct intel_sdvo_caps {
u16 output_flags;
} __attribute__((packed));
/* Note: SDVO detailed timing flags match EDID misc flags. */
#define DTD_FLAG_HSYNC_POSITIVE (1 << 1)
#define DTD_FLAG_VSYNC_POSITIVE (1 << 2)
#define DTD_FLAG_INTERLACE (1 << 7)
/** This matches the EDID DTD structure, more or less */
struct intel_sdvo_dtd {
struct {
@ -705,6 +710,8 @@ struct intel_sdvo_enhancements_arg {
#define SDVO_CMD_SET_AUDIO_STAT 0x91
#define SDVO_CMD_GET_AUDIO_STAT 0x92
#define SDVO_CMD_SET_HBUF_INDEX 0x93
#define SDVO_HBUF_INDEX_ELD 0
#define SDVO_HBUF_INDEX_AVI_IF 1
#define SDVO_CMD_GET_HBUF_INDEX 0x94
#define SDVO_CMD_GET_HBUF_INFO 0x95
#define SDVO_CMD_SET_HBUF_AV_SPLIT 0x96

View File

@ -851,17 +851,11 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
e1000_release_phy_80003es2lan(hw);
/* Disable IBIST slave mode (far-end loopback) */
ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
E1000_KMRNCTRLSTA_INBAND_PARAM, &kum_reg_data);
if (!ret_val) {
kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
E1000_KMRNCTRLSTA_INBAND_PARAM,
kum_reg_data);
if (ret_val)
DEBUGOUT("Error disabling far-end loopback\n");
} else
DEBUGOUT("Error disabling far-end loopback\n");
e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
&kum_reg_data);
kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
kum_reg_data);
ret_val = e1000_get_auto_rd_done_generic(hw);
if (ret_val)
@ -917,18 +911,11 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
return ret_val;
/* Disable IBIST slave mode (far-end loopback) */
ret_val =
e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
&kum_reg_data);
if (!ret_val) {
kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
E1000_KMRNCTRLSTA_INBAND_PARAM,
kum_reg_data);
if (ret_val)
DEBUGOUT("Error disabling far-end loopback\n");
} else
DEBUGOUT("Error disabling far-end loopback\n");
e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
&kum_reg_data);
kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
kum_reg_data);
/* Set the transmit descriptor write-back policy */
reg_data = E1000_READ_REG(hw, E1000_TXDCTL(0));

View File

@ -66,7 +66,7 @@ static s32 e1000_read_mac_addr_82540(struct e1000_hw *hw);
static s32 e1000_init_phy_params_82540(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
s32 ret_val = E1000_SUCCESS;
phy->addr = 1;
phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
@ -329,7 +329,7 @@ static s32 e1000_init_hw_82540(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
u32 txdctl, ctrl_ext;
s32 ret_val;
s32 ret_val = E1000_SUCCESS;
u16 i;
DEBUGFUNC("e1000_init_hw_82540");
@ -411,7 +411,7 @@ static s32 e1000_init_hw_82540(struct e1000_hw *hw)
static s32 e1000_setup_copper_link_82540(struct e1000_hw *hw)
{
u32 ctrl;
s32 ret_val;
s32 ret_val = E1000_SUCCESS;
u16 data;
DEBUGFUNC("e1000_setup_copper_link_82540");
@ -498,7 +498,7 @@ static s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw)
**/
static s32 e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw)
{
s32 ret_val;
s32 ret_val = E1000_SUCCESS;
u16 nvm_data;
DEBUGFUNC("e1000_adjust_serdes_amplitude_82540");
@ -528,7 +528,7 @@ static s32 e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw)
**/
static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw)
{
s32 ret_val;
s32 ret_val = E1000_SUCCESS;
u16 default_page = 0;
u16 phy_data;

View File

@ -85,7 +85,7 @@ static const u16 e1000_igp_cable_length_table[] = {
static s32 e1000_init_phy_params_82541(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
s32 ret_val = E1000_SUCCESS;
DEBUGFUNC("e1000_init_phy_params_82541");
@ -295,7 +295,7 @@ void e1000_init_function_pointers_82541(struct e1000_hw *hw)
**/
static s32 e1000_reset_hw_82541(struct e1000_hw *hw)
{
u32 ledctl, ctrl, manc;
u32 ledctl, ctrl, icr, manc;
DEBUGFUNC("e1000_reset_hw_82541");
@ -317,7 +317,6 @@ static s32 e1000_reset_hw_82541(struct e1000_hw *hw)
/* Must reset the Phy before resetting the MAC */
if ((hw->mac.type == e1000_82541) || (hw->mac.type == e1000_82547)) {
E1000_WRITE_REG(hw, E1000_CTRL, (ctrl | E1000_CTRL_PHY_RST));
E1000_WRITE_FLUSH(hw);
msec_delay(5);
}
@ -360,7 +359,7 @@ static s32 e1000_reset_hw_82541(struct e1000_hw *hw)
E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF);
/* Clear any pending interrupt events. */
E1000_READ_REG(hw, E1000_ICR);
icr = E1000_READ_REG(hw, E1000_ICR);
return E1000_SUCCESS;
}

View File

@ -317,7 +317,7 @@ static s32 e1000_init_hw_82542(struct e1000_hw *hw)
static s32 e1000_setup_link_82542(struct e1000_hw *hw)
{
struct e1000_mac_info *mac = &hw->mac;
s32 ret_val;
s32 ret_val = E1000_SUCCESS;
DEBUGFUNC("e1000_setup_link_82542");
@ -565,7 +565,7 @@ static void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw)
*
* Reads the device MAC address from the EEPROM and stores the value.
**/
s32 e1000_read_mac_addr_82542(struct e1000_hw *hw)
static s32 e1000_read_mac_addr_82542(struct e1000_hw *hw)
{
s32 ret_val = E1000_SUCCESS;
u16 offset, nvm_data, i;

View File

@ -900,7 +900,7 @@ static s32 e1000_phy_hw_reset_82543(struct e1000_hw *hw)
**/
static s32 e1000_reset_hw_82543(struct e1000_hw *hw)
{
u32 ctrl;
u32 ctrl, icr;
s32 ret_val = E1000_SUCCESS;
DEBUGFUNC("e1000_reset_hw_82543");
@ -942,7 +942,7 @@ static s32 e1000_reset_hw_82543(struct e1000_hw *hw)
/* Masking off and clearing any pending interrupts */
E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
E1000_READ_REG(hw, E1000_ICR);
icr = E1000_READ_REG(hw, E1000_ICR);
return ret_val;
}

View File

@ -50,10 +50,9 @@
#define E1000_EIAC_82574 0x000DC /* Ext. Interrupt Auto Clear - RW */
#define E1000_EIAC_MASK_82574 0x01F00000
#define E1000_IVAR_INT_ALLOC_VALID 0x8
#define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */
/* Manageability Operation Mode mask */
#define E1000_NVM_INIT_CTRL2_MNGM 0x6000
#define E1000_RXCFGL 0x0B634 /* TimeSync Rx EtherType & Msg Type Reg - RW */
#define E1000_BASE1000T_STATUS 10
#define E1000_IDLE_ERROR_COUNT_MASK 0xFF

View File

@ -1235,7 +1235,7 @@ static s32 e1000_check_for_link_media_swap(struct e1000_hw *hw)
DEBUGFUNC("e1000_check_for_link_media_swap");
/* Check for copper. */
/* Check the copper medium. */
ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0);
if (ret_val)
return ret_val;
@ -1247,7 +1247,7 @@ static s32 e1000_check_for_link_media_swap(struct e1000_hw *hw)
if (data & E1000_M88E1112_STATUS_LINK)
port = E1000_MEDIA_PORT_COPPER;
/* Check for other. */
/* Check the other medium. */
ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 1);
if (ret_val)
return ret_val;
@ -1256,6 +1256,11 @@ static s32 e1000_check_for_link_media_swap(struct e1000_hw *hw)
if (ret_val)
return ret_val;
/* reset page to 0 */
ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0);
if (ret_val)
return ret_val;
if (data & E1000_M88E1112_STATUS_LINK)
port = E1000_MEDIA_PORT_OTHER;
@ -1263,20 +1268,8 @@ static s32 e1000_check_for_link_media_swap(struct e1000_hw *hw)
if (port && (hw->dev_spec._82575.media_port != port)) {
hw->dev_spec._82575.media_port = port;
hw->dev_spec._82575.media_changed = TRUE;
}
if (port == E1000_MEDIA_PORT_COPPER) {
/* reset page to 0 */
ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0);
if (ret_val)
return ret_val;
e1000_check_for_link_82575(hw);
} else {
e1000_check_for_link_82575(hw);
/* reset page to 0 */
ret_val = phy->ops.write_reg(hw, E1000_M88E1112_PAGE_ADDR, 0);
if (ret_val)
return ret_val;
ret_val = e1000_check_for_link_82575(hw);
}
return E1000_SUCCESS;
@ -2143,13 +2136,7 @@ void e1000_rx_fifo_flush_82575(struct e1000_hw *hw)
u32 rctl, rlpml, rxdctl[4], rfctl, temp_rctl, rx_enabled;
int i, ms_wait;
DEBUGFUNC("e1000_rx_fifo_flush_82575");
/* disable IPv6 options as per hardware errata */
rfctl = E1000_READ_REG(hw, E1000_RFCTL);
rfctl |= E1000_RFCTL_IPV6_EX_DIS;
E1000_WRITE_REG(hw, E1000_RFCTL, rfctl);
DEBUGFUNC("e1000_rx_fifo_workaround_82575");
if (hw->mac.type != e1000_82575 ||
!(E1000_READ_REG(hw, E1000_MANC) & E1000_MANC_RCV_TCO_EN))
return;
@ -2177,6 +2164,7 @@ void e1000_rx_fifo_flush_82575(struct e1000_hw *hw)
* incoming packets are rejected. Set enable and wait 2ms so that
* any packet that was coming in as RCTL.EN was set is flushed
*/
rfctl = E1000_READ_REG(hw, E1000_RFCTL);
E1000_WRITE_REG(hw, E1000_RFCTL, rfctl & ~E1000_RFCTL_LEF);
rlpml = E1000_READ_REG(hw, E1000_RLPML);
@ -2906,13 +2894,11 @@ s32 e1000_initialize_M88E1512_phy(struct e1000_hw *hw)
/**
* e1000_set_eee_i350 - Enable/disable EEE support
* @hw: pointer to the HW structure
* @adv1g: boolean flag enabling 1G EEE advertisement
* @adv100m: boolean flag enabling 100M EEE advertisement
*
* Enable/disable EEE based on setting in dev_spec structure.
*
**/
s32 e1000_set_eee_i350(struct e1000_hw *hw, bool adv1G, bool adv100M)
s32 e1000_set_eee_i350(struct e1000_hw *hw)
{
u32 ipcnfg, eeer;
@ -2928,16 +2914,7 @@ s32 e1000_set_eee_i350(struct e1000_hw *hw, bool adv1G, bool adv100M)
if (!(hw->dev_spec._82575.eee_disable)) {
u32 eee_su = E1000_READ_REG(hw, E1000_EEE_SU);
if (adv100M)
ipcnfg |= E1000_IPCNFG_EEE_100M_AN;
else
ipcnfg &= ~E1000_IPCNFG_EEE_100M_AN;
if (adv1G)
ipcnfg |= E1000_IPCNFG_EEE_1G_AN;
else
ipcnfg &= ~E1000_IPCNFG_EEE_1G_AN;
ipcnfg |= (E1000_IPCNFG_EEE_1G_AN | E1000_IPCNFG_EEE_100M_AN);
eeer |= (E1000_EEER_TX_LPI_EN | E1000_EEER_RX_LPI_EN |
E1000_EEER_LPI_FC);
@ -2961,13 +2938,11 @@ s32 e1000_set_eee_i350(struct e1000_hw *hw, bool adv1G, bool adv100M)
/**
* e1000_set_eee_i354 - Enable/disable EEE support
* @hw: pointer to the HW structure
* @adv1g: boolean flag enabling 1G EEE advertisement
* @adv100m: boolean flag enabling 100M EEE advertisement
*
* Enable/disable EEE legacy mode based on setting in dev_spec structure.
*
**/
s32 e1000_set_eee_i354(struct e1000_hw *hw, bool adv1G, bool adv100M)
s32 e1000_set_eee_i354(struct e1000_hw *hw)
{
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val = E1000_SUCCESS;
@ -3009,16 +2984,8 @@ s32 e1000_set_eee_i354(struct e1000_hw *hw, bool adv1G, bool adv100M)
if (ret_val)
goto out;
if (adv100M)
phy_data |= E1000_EEE_ADV_100_SUPPORTED;
else
phy_data &= ~E1000_EEE_ADV_100_SUPPORTED;
if (adv1G)
phy_data |= E1000_EEE_ADV_1000_SUPPORTED;
else
phy_data &= ~E1000_EEE_ADV_1000_SUPPORTED;
phy_data |= E1000_EEE_ADV_100_SUPPORTED |
E1000_EEE_ADV_1000_SUPPORTED;
ret_val = e1000_write_xmdio_reg(hw, E1000_EEE_ADV_ADDR_I354,
E1000_EEE_ADV_DEV_I354,
phy_data);

View File

@ -495,8 +495,8 @@ void e1000_rlpml_set_vf(struct e1000_hw *, u16);
s32 e1000_promisc_set_vf(struct e1000_hw *, enum e1000_promisc_type type);
u16 e1000_rxpbs_adjust_82580(u32 data);
s32 e1000_read_emi_reg(struct e1000_hw *hw, u16 addr, u16 *data);
s32 e1000_set_eee_i350(struct e1000_hw *hw, bool adv1G, bool adv100M);
s32 e1000_set_eee_i354(struct e1000_hw *hw, bool adv1G, bool adv100M);
s32 e1000_set_eee_i350(struct e1000_hw *);
s32 e1000_set_eee_i354(struct e1000_hw *);
s32 e1000_get_eee_status_i354(struct e1000_hw *, bool *);
s32 e1000_initialize_M88E1512_phy(struct e1000_hw *hw);

View File

@ -299,12 +299,6 @@ s32 e1000_set_mac_type(struct e1000_hw *hw)
case E1000_DEV_ID_PCH_I218_V3:
mac->type = e1000_pch_lpt;
break;
case E1000_DEV_ID_PCH_SPT_I219_LM:
case E1000_DEV_ID_PCH_SPT_I219_V:
case E1000_DEV_ID_PCH_SPT_I219_LM2:
case E1000_DEV_ID_PCH_SPT_I219_V2:
mac->type = e1000_pch_spt;
break;
case E1000_DEV_ID_82575EB_COPPER:
case E1000_DEV_ID_82575EB_FIBER_SERDES:
case E1000_DEV_ID_82575GB_QUAD_COPPER:
@ -455,7 +449,6 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
case e1000_pchlan:
case e1000_pch2lan:
case e1000_pch_lpt:
case e1000_pch_spt:
e1000_init_function_pointers_ich8lan(hw);
break;
case e1000_82575:
@ -935,6 +928,21 @@ s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
return e1000_mng_enable_host_if_generic(hw);
}
/**
* e1000_set_obff_timer - Set Optimized Buffer Flush/Fill timer
* @hw: pointer to the HW structure
* @itr: u32 indicating itr value
*
* Set the OBFF timer based on the given interrupt rate.
**/
s32 e1000_set_obff_timer(struct e1000_hw *hw, u32 itr)
{
if (hw->mac.ops.set_obff_timer)
return hw->mac.ops.set_obff_timer(hw, itr);
return E1000_SUCCESS;
}
/**
* e1000_check_reset_block - Verifies PHY can be reset
* @hw: pointer to the HW structure
@ -1207,21 +1215,6 @@ s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size)
return e1000_read_pba_length_generic(hw, pba_num_size);
}
/**
* e1000_read_pba_num - Read device part number
* @hw: pointer to the HW structure
* @pba_num: pointer to device part number
*
* Reads the product board assembly (PBA) number from the EEPROM and stores
* the value in pba_num.
* Currently no func pointer exists and all implementations are handled in the
* generic version of this function.
**/
s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num)
{
return e1000_read_pba_num_generic(hw, pba_num);
}
/**
* e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
* @hw: pointer to the HW structure

View File

@ -97,7 +97,6 @@ s32 e1000_phy_commit(struct e1000_hw *hw);
void e1000_power_up_phy(struct e1000_hw *hw);
void e1000_power_down_phy(struct e1000_hw *hw);
s32 e1000_read_mac_addr(struct e1000_hw *hw);
s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num);
s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size);
s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size);
void e1000_reload_nvm(struct e1000_hw *hw);

View File

@ -197,8 +197,6 @@
#define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */
#define E1000_RCTL_DTYP_PS 0x00000400 /* Packet Split descriptor */
#define E1000_RCTL_RDMTS_HALF 0x00000000 /* Rx desc min thresh size */
#define E1000_RCTL_RDMTS_HEX 0x00010000
#define E1000_RCTL_RDMTS1_HEX E1000_RCTL_RDMTS_HEX
#define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */
#define E1000_RCTL_MO_3 0x00003000 /* multicast offset 15:4 */
#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */
@ -567,6 +565,9 @@
#define E1000_ICR_THS 0x00800000 /* ICR.THS: Thermal Sensor Event*/
#define E1000_ICR_MDDET 0x10000000 /* Malicious Driver Detect */
#define E1000_ITR_MASK 0x000FFFFF /* ITR value bitfield */
#define E1000_ITR_MULT 256 /* ITR mulitplier in nsec */
/* PBA ECC Register */
#define E1000_PBA_ECC_COUNTER_MASK 0xFFF00000 /* ECC counter mask */
#define E1000_PBA_ECC_COUNTER_SHIFT 20 /* ECC counter shift value */
@ -752,12 +753,6 @@
#define E1000_TSYNCTXCTL_VALID 0x00000001 /* Tx timestamp valid */
#define E1000_TSYNCTXCTL_ENABLED 0x00000010 /* enable Tx timestamping */
/* HH Time Sync */
#define E1000_TSYNCTXCTL_MAX_ALLOWED_DLY_MASK 0x0000F000 /* max delay */
#define E1000_TSYNCTXCTL_SYNC_COMP_ERR 0x20000000 /* sync err */
#define E1000_TSYNCTXCTL_SYNC_COMP 0x40000000 /* sync complete */
#define E1000_TSYNCTXCTL_START_SYNC 0x80000000 /* initiate sync */
#define E1000_TSYNCRXCTL_VALID 0x00000001 /* Rx timestamp valid */
#define E1000_TSYNCRXCTL_TYPE_MASK 0x0000000E /* Rx type mask */
#define E1000_TSYNCRXCTL_TYPE_L2_V2 0x00
@ -1025,7 +1020,9 @@
/* NVM Addressing bits based on type 0=small, 1=large */
#define E1000_EECD_ADDR_BITS 0x00000400
#define E1000_EECD_TYPE 0x00002000 /* NVM Type (1-SPI, 0-Microwire) */
#ifndef E1000_NVM_GRANT_ATTEMPTS
#define E1000_NVM_GRANT_ATTEMPTS 1000 /* NVM # attempts to gain grant */
#endif
#define E1000_EECD_AUTO_RD 0x00000200 /* NVM Auto Read done */
#define E1000_EECD_SIZE_EX_MASK 0x00007800 /* NVM Size */
#define E1000_EECD_SIZE_EX_SHIFT 11
@ -1062,44 +1059,11 @@
/* NVM Word Offsets */
#define NVM_COMPAT 0x0003
#define NVM_ID_LED_SETTINGS 0x0004
#define NVM_VERSION 0x0005
#define NVM_SERDES_AMPLITUDE 0x0006 /* SERDES output amplitude */
#define NVM_PHY_CLASS_WORD 0x0007
#define E1000_I210_NVM_FW_MODULE_PTR 0x0010
#define E1000_I350_NVM_FW_MODULE_PTR 0x0051
#define NVM_FUTURE_INIT_WORD1 0x0019
#define NVM_ETRACK_WORD 0x0042
#define NVM_ETRACK_HIWORD 0x0043
#define NVM_COMB_VER_OFF 0x0083
#define NVM_COMB_VER_PTR 0x003d
/* NVM version defines */
#define NVM_MAJOR_MASK 0xF000
#define NVM_MINOR_MASK 0x0FF0
#define NVM_IMAGE_ID_MASK 0x000F
#define NVM_COMB_VER_MASK 0x00FF
#define NVM_MAJOR_SHIFT 12
#define NVM_MINOR_SHIFT 4
#define NVM_COMB_VER_SHFT 8
#define NVM_VER_INVALID 0xFFFF
#define NVM_ETRACK_SHIFT 16
#define NVM_ETRACK_VALID 0x8000
#define NVM_NEW_DEC_MASK 0x0F00
#define NVM_HEX_CONV 16
#define NVM_HEX_TENS 10
/* FW version defines */
/* Offset of "Loader patch ptr" in Firmware Header */
#define E1000_I350_NVM_FW_LOADER_PATCH_PTR_OFFSET 0x01
/* Patch generation hour & minutes */
#define E1000_I350_NVM_FW_VER_WORD1_OFFSET 0x04
/* Patch generation month & day */
#define E1000_I350_NVM_FW_VER_WORD2_OFFSET 0x05
/* Patch generation year */
#define E1000_I350_NVM_FW_VER_WORD3_OFFSET 0x06
/* Patch major & minor numbers */
#define E1000_I350_NVM_FW_VER_WORD4_OFFSET 0x07
#define NVM_MAC_ADDR 0x0000
#define NVM_SUB_DEV_ID 0x000B
#define NVM_SUB_VEN_ID 0x000C
@ -1476,6 +1440,8 @@
#define I210_RXPBSIZE_DEFAULT 0x000000A2 /* RXPBSIZE default */
#define I210_TXPBSIZE_DEFAULT 0x04000014 /* TXPBSIZE default */
#define E1000_DOBFFCTL_OBFFTHR_MASK 0x000000FF /* OBFF threshold */
#define E1000_DOBFFCTL_EXIT_ACT_MASK 0x01000000 /* Exit active CB */
/* Proxy Filter Control */
#define E1000_PROXYFC_D0 0x00000001 /* Enable offload in D0 */

View File

@ -137,10 +137,6 @@ struct e1000_hw;
#define E1000_DEV_ID_PCH_I218_V2 0x15A1
#define E1000_DEV_ID_PCH_I218_LM3 0x15A2 /* Wildcat Point PCH */
#define E1000_DEV_ID_PCH_I218_V3 0x15A3 /* Wildcat Point PCH */
#define E1000_DEV_ID_PCH_SPT_I219_LM 0x156F /* Sunrise Point PCH */
#define E1000_DEV_ID_PCH_SPT_I219_V 0x1570 /* Sunrise Point PCH */
#define E1000_DEV_ID_PCH_SPT_I219_LM2 0x15B7 /* Sunrise Point-H PCH */
#define E1000_DEV_ID_PCH_SPT_I219_V2 0x15B8 /* Sunrise Point-H PCH */
#define E1000_DEV_ID_82576 0x10C9
#define E1000_DEV_ID_82576_FIBER 0x10E6
#define E1000_DEV_ID_82576_SERDES 0x10E7
@ -226,7 +222,6 @@ enum e1000_mac_type {
e1000_pchlan,
e1000_pch2lan,
e1000_pch_lpt,
e1000_pch_spt,
e1000_82575,
e1000_82576,
e1000_82580,
@ -708,6 +703,7 @@ struct e1000_mac_operations {
int (*rar_set)(struct e1000_hw *, u8*, u32);
s32 (*read_mac_addr)(struct e1000_hw *);
s32 (*validate_mdi_setting)(struct e1000_hw *);
s32 (*set_obff_timer)(struct e1000_hw *, u32);
s32 (*acquire_swfw_sync)(struct e1000_hw *, u16);
void (*release_swfw_sync)(struct e1000_hw *, u16);
};
@ -809,7 +805,7 @@ struct e1000_mac_info {
enum e1000_serdes_link_state serdes_link_state;
bool serdes_has_link;
bool tx_pkt_filtering;
u32 max_frame_size;
u32 max_frame_size;
};
struct e1000_phy_info {

View File

@ -488,105 +488,6 @@ static s32 e1000_read_invm_i210(struct e1000_hw *hw, u16 offset,
return ret_val;
}
/**
* e1000_read_invm_version - Reads iNVM version and image type
* @hw: pointer to the HW structure
* @invm_ver: version structure for the version read
*
* Reads iNVM version and image type.
**/
s32 e1000_read_invm_version(struct e1000_hw *hw,
struct e1000_fw_version *invm_ver)
{
u32 *record = NULL;
u32 *next_record = NULL;
u32 i = 0;
u32 invm_dword = 0;
u32 invm_blocks = E1000_INVM_SIZE - (E1000_INVM_ULT_BYTES_SIZE /
E1000_INVM_RECORD_SIZE_IN_BYTES);
u32 buffer[E1000_INVM_SIZE];
s32 status = -E1000_ERR_INVM_VALUE_NOT_FOUND;
u16 version = 0;
DEBUGFUNC("e1000_read_invm_version");
/* Read iNVM memory */
for (i = 0; i < E1000_INVM_SIZE; i++) {
invm_dword = E1000_READ_REG(hw, E1000_INVM_DATA_REG(i));
buffer[i] = invm_dword;
}
/* Read version number */
for (i = 1; i < invm_blocks; i++) {
record = &buffer[invm_blocks - i];
next_record = &buffer[invm_blocks - i + 1];
/* Check if we have first version location used */
if ((i == 1) && ((*record & E1000_INVM_VER_FIELD_ONE) == 0)) {
version = 0;
status = E1000_SUCCESS;
break;
}
/* Check if we have second version location used */
else if ((i == 1) &&
((*record & E1000_INVM_VER_FIELD_TWO) == 0)) {
version = (*record & E1000_INVM_VER_FIELD_ONE) >> 3;
status = E1000_SUCCESS;
break;
}
/*
* Check if we have odd version location
* used and it is the last one used
*/
else if ((((*record & E1000_INVM_VER_FIELD_ONE) == 0) &&
((*record & 0x3) == 0)) || (((*record & 0x3) != 0) &&
(i != 1))) {
version = (*next_record & E1000_INVM_VER_FIELD_TWO)
>> 13;
status = E1000_SUCCESS;
break;
}
/*
* Check if we have even version location
* used and it is the last one used
*/
else if (((*record & E1000_INVM_VER_FIELD_TWO) == 0) &&
((*record & 0x3) == 0)) {
version = (*record & E1000_INVM_VER_FIELD_ONE) >> 3;
status = E1000_SUCCESS;
break;
}
}
if (status == E1000_SUCCESS) {
invm_ver->invm_major = (version & E1000_INVM_MAJOR_MASK)
>> E1000_INVM_MAJOR_SHIFT;
invm_ver->invm_minor = version & E1000_INVM_MINOR_MASK;
}
/* Read Image Type */
for (i = 1; i < invm_blocks; i++) {
record = &buffer[invm_blocks - i];
next_record = &buffer[invm_blocks - i + 1];
/* Check if we have image type in first location used */
if ((i == 1) && ((*record & E1000_INVM_IMGTYPE_FIELD) == 0)) {
invm_ver->invm_img_type = 0;
status = E1000_SUCCESS;
break;
}
/* Check if we have image type in first location used */
else if ((((*record & 0x3) == 0) &&
((*record & E1000_INVM_IMGTYPE_FIELD) == 0)) ||
((((*record & 0x3) != 0) && (i != 1)))) {
invm_ver->invm_img_type =
(*next_record & E1000_INVM_IMGTYPE_FIELD) >> 23;
status = E1000_SUCCESS;
break;
}
}
return status;
}
/**
* e1000_validate_nvm_checksum_i210 - Validate EEPROM checksum
* @hw: pointer to the HW structure

View File

@ -43,8 +43,6 @@ s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset,
u16 words, u16 *data);
s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset,
u16 words, u16 *data);
s32 e1000_read_invm_version(struct e1000_hw *hw,
struct e1000_fw_version *invm_ver);
s32 e1000_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask);
void e1000_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask);
s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr,

File diff suppressed because it is too large Load Diff

View File

@ -35,11 +35,11 @@
#ifndef _E1000_ICH8LAN_H_
#define _E1000_ICH8LAN_H_
#define ICH_FLASH_GFPREG 0xE000
#define ICH_FLASH_HSFSTS 0xE004
#define ICH_FLASH_HSFCTL 0xE006
#define ICH_FLASH_FADDR 0xE008
#define ICH_FLASH_FDATA0 0xE010
#define ICH_FLASH_GFPREG 0x0000
#define ICH_FLASH_HSFSTS 0x0004
#define ICH_FLASH_HSFCTL 0x0006
#define ICH_FLASH_FADDR 0x0008
#define ICH_FLASH_FDATA0 0x0010
/* Requires up to 10 seconds when MNG might be accessing part. */
#define ICH_FLASH_READ_COMMAND_TIMEOUT 10000000
@ -107,25 +107,9 @@
#define E1000_FEXTNVM6_REQ_PLL_CLK 0x00000100
#define E1000_FEXTNVM6_ENABLE_K1_ENTRY_CONDITION 0x00000200
#define E1000_FEXTNVM6_K1_OFF_ENABLE 0x80000000
/* bit for disabling packet buffer read */
#define E1000_FEXTNVM7_DISABLE_PB_READ 0x00040000
#define E1000_FEXTNVM7_SIDE_CLK_UNGATE 0x00000004
#define E1000_FEXTNVM7_DISABLE_SMB_PERST 0x00000020
#define E1000_FEXTNVM9_IOSFSB_CLKGATE_DIS 0x00000800
#define E1000_FEXTNVM9_IOSFSB_CLKREQ_DIS 0x00001000
#define E1000_FEXTNVM11_DISABLE_PB_READ 0x00000200
#define E1000_FEXTNVM11_DISABLE_MULR_FIX 0x00002000
/* bit24: RXDCTL thresholds granularity: 0 - cache lines, 1 - descriptors */
#define E1000_RXDCTL_THRESH_UNIT_DESC 0x01000000
#define NVM_SIZE_MULTIPLIER 4096 /*multiplier for NVMS field*/
#define E1000_FLASH_BASE_ADDR 0xE000 /*offset of NVM access regs*/
#define E1000_CTRL_EXT_NVMVS 0x3 /*NVM valid sector */
#define E1000_SPT_B_STEP_REV 0x10 /*SPT B step Rev ID*/
#define E1000_TARC0_CB_MULTIQ_2_REQ (1 << 29)
#define E1000_TARC0_CB_MULTIQ_3_REQ (1 << 28 | 1 << 29)
#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
#define E1000_ICH_RAR_ENTRIES 7
@ -187,8 +171,6 @@
#define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */
#define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */
#define K1_ENTRY_LATENCY 0
#define K1_MIN_TIME 1
/* SMBus Control Phy Register */
#define CV_SMB_CTRL PHY_REG(769, 23)
@ -299,13 +281,36 @@
/* Receive Address Initial CRC Calculation */
#define E1000_PCH_RAICC(_n) (0x05F50 + ((_n) * 4))
/* Latency Tolerance Reporting */
#define E1000_LTRV 0x000F8
#define E1000_LTRV_VALUE_MASK 0x000003FF
#define E1000_LTRV_SCALE_MAX 5
#define E1000_LTRV_SCALE_FACTOR 5
#define E1000_LTRV_SCALE_SHIFT 10
#define E1000_LTRV_SCALE_MASK 0x00001C00
#define E1000_LTRV_REQ_SHIFT 15
#define E1000_LTRV_NOSNOOP_SHIFT 16
#define E1000_LTRV_SEND (1 << 30)
/* Proprietary Latency Tolerance Reporting PCI Capability */
#define E1000_PCI_LTR_CAP_LPT 0xA8
/* OBFF Control & Threshold Defines */
#define E1000_SVCR_OFF_EN 0x00000001
#define E1000_SVCR_OFF_MASKINT 0x00001000
#define E1000_SVCR_OFF_TIMER_MASK 0xFFFF0000
#define E1000_SVCR_OFF_TIMER_SHIFT 16
#define E1000_SVT_OFF_HWM_MASK 0x0000001F
#if defined(QV_RELEASE) || !defined(NO_PCH_LPT_B0_SUPPORT)
#define E1000_PCI_REVISION_ID_REG 0x08
#endif /* defined(QV_RELEASE) || !defined(NO_PCH_LPT_B0_SUPPORT) */
void e1000_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
bool state);
void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw);
void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw);
u32 e1000_resume_workarounds_pchlan(struct e1000_hw *hw);
void e1000_resume_workarounds_pchlan(struct e1000_hw *hw);
s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable);
void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw);
s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable);

View File

@ -70,6 +70,7 @@ void e1000_init_mac_ops_generic(struct e1000_hw *hw)
mac->ops.setup_link = e1000_null_ops_generic;
mac->ops.get_link_up_info = e1000_null_link_info;
mac->ops.check_for_link = e1000_null_ops_generic;
mac->ops.set_obff_timer = e1000_null_set_obff_timer;
/* Management */
mac->ops.check_mng_mode = e1000_null_mng_mode;
/* VLAN, MC, etc. */
@ -154,6 +155,17 @@ int e1000_null_rar_set(struct e1000_hw E1000_UNUSEDARG *hw,
return E1000_SUCCESS;
}
/**
* e1000_null_set_obff_timer - No-op function, return 0
* @hw: pointer to the HW structure
**/
s32 e1000_null_set_obff_timer(struct e1000_hw E1000_UNUSEDARG *hw,
u32 E1000_UNUSEDARG a)
{
DEBUGFUNC("e1000_null_set_obff_timer");
return E1000_SUCCESS;
}
/**
* e1000_get_bus_info_pci_generic - Get PCI(x) bus information
* @hw: pointer to the HW structure

View File

@ -36,7 +36,9 @@
#define _E1000_MAC_H_
void e1000_init_mac_ops_generic(struct e1000_hw *hw);
#ifndef E1000_REMOVED
#define E1000_REMOVED(a) (0)
#endif /* E1000_REMOVED */
void e1000_null_mac_generic(struct e1000_hw *hw);
s32 e1000_null_ops_generic(struct e1000_hw *hw);
s32 e1000_null_link_info(struct e1000_hw *hw, u16 *s, u16 *d);
@ -44,6 +46,7 @@ bool e1000_null_mng_mode(struct e1000_hw *hw);
void e1000_null_update_mc(struct e1000_hw *hw, u8 *h, u32 a);
void e1000_null_write_vfta(struct e1000_hw *hw, u32 a, u32 b);
int e1000_null_rar_set(struct e1000_hw *hw, u8 *h, u32 a);
s32 e1000_null_set_obff_timer(struct e1000_hw *hw, u32 a);
s32 e1000_blink_led_generic(struct e1000_hw *hw);
s32 e1000_check_for_copper_link_generic(struct e1000_hw *hw);
s32 e1000_check_for_fiber_link_generic(struct e1000_hw *hw);

View File

@ -930,41 +930,6 @@ s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size)
return E1000_SUCCESS;
}
/**
* e1000_read_pba_num_generic - Read device part number
* @hw: pointer to the HW structure
* @pba_num: pointer to device part number
*
* Reads the product board assembly (PBA) number from the EEPROM and stores
* the value in pba_num.
**/
s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num)
{
s32 ret_val;
u16 nvm_data;
DEBUGFUNC("e1000_read_pba_num_generic");
ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data);
if (ret_val) {
DEBUGOUT("NVM Read Error\n");
return ret_val;
} else if (nvm_data == NVM_PBA_PTR_GUARD) {
DEBUGOUT("NVM Not Supported\n");
return -E1000_NOT_IMPLEMENTED;
}
*pba_num = (u32)(nvm_data << 16);
ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &nvm_data);
if (ret_val) {
DEBUGOUT("NVM Read Error\n");
return ret_val;
}
*pba_num |= nvm_data;
return E1000_SUCCESS;
}
/**
* e1000_read_pba_raw
@ -1267,115 +1232,4 @@ static void e1000_reload_nvm_generic(struct e1000_hw *hw)
E1000_WRITE_FLUSH(hw);
}
/**
* e1000_get_fw_version - Get firmware version information
* @hw: pointer to the HW structure
* @fw_vers: pointer to output version structure
*
* unsupported/not present features return 0 in version structure
**/
void e1000_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers)
{
u16 eeprom_verh, eeprom_verl, etrack_test, fw_version;
u8 q, hval, rem, result;
u16 comb_verh, comb_verl, comb_offset;
memset(fw_vers, 0, sizeof(struct e1000_fw_version));
/* basic eeprom version numbers, bits used vary by part and by tool
* used to create the nvm images */
/* Check which data format we have */
switch (hw->mac.type) {
case e1000_i211:
e1000_read_invm_version(hw, fw_vers);
return;
case e1000_82575:
case e1000_82576:
case e1000_82580:
hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test);
/* Use this format, unless EETRACK ID exists,
* then use alternate format
*/
if ((etrack_test & NVM_MAJOR_MASK) != NVM_ETRACK_VALID) {
hw->nvm.ops.read(hw, NVM_VERSION, 1, &fw_version);
fw_vers->eep_major = (fw_version & NVM_MAJOR_MASK)
>> NVM_MAJOR_SHIFT;
fw_vers->eep_minor = (fw_version & NVM_MINOR_MASK)
>> NVM_MINOR_SHIFT;
fw_vers->eep_build = (fw_version & NVM_IMAGE_ID_MASK);
goto etrack_id;
}
break;
case e1000_i210:
if (!(e1000_get_flash_presence_i210(hw))) {
e1000_read_invm_version(hw, fw_vers);
return;
}
/* fall through */
case e1000_i350:
hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test);
/* find combo image version */
hw->nvm.ops.read(hw, NVM_COMB_VER_PTR, 1, &comb_offset);
if ((comb_offset != 0x0) &&
(comb_offset != NVM_VER_INVALID)) {
hw->nvm.ops.read(hw, (NVM_COMB_VER_OFF + comb_offset
+ 1), 1, &comb_verh);
hw->nvm.ops.read(hw, (NVM_COMB_VER_OFF + comb_offset),
1, &comb_verl);
/* get Option Rom version if it exists and is valid */
if ((comb_verh && comb_verl) &&
((comb_verh != NVM_VER_INVALID) &&
(comb_verl != NVM_VER_INVALID))) {
fw_vers->or_valid = TRUE;
fw_vers->or_major =
comb_verl >> NVM_COMB_VER_SHFT;
fw_vers->or_build =
(comb_verl << NVM_COMB_VER_SHFT)
| (comb_verh >> NVM_COMB_VER_SHFT);
fw_vers->or_patch =
comb_verh & NVM_COMB_VER_MASK;
}
}
break;
default:
hw->nvm.ops.read(hw, NVM_ETRACK_HIWORD, 1, &etrack_test);
return;
}
hw->nvm.ops.read(hw, NVM_VERSION, 1, &fw_version);
fw_vers->eep_major = (fw_version & NVM_MAJOR_MASK)
>> NVM_MAJOR_SHIFT;
/* check for old style version format in newer images*/
if ((fw_version & NVM_NEW_DEC_MASK) == 0x0) {
eeprom_verl = (fw_version & NVM_COMB_VER_MASK);
} else {
eeprom_verl = (fw_version & NVM_MINOR_MASK)
>> NVM_MINOR_SHIFT;
}
/* Convert minor value to hex before assigning to output struct
* Val to be converted will not be higher than 99, per tool output
*/
q = eeprom_verl / NVM_HEX_CONV;
hval = q * NVM_HEX_TENS;
rem = eeprom_verl % NVM_HEX_CONV;
result = hval + rem;
fw_vers->eep_minor = result;
etrack_id:
if ((etrack_test & NVM_MAJOR_MASK) == NVM_ETRACK_VALID) {
hw->nvm.ops.read(hw, NVM_ETRACK_WORD, 1, &eeprom_verl);
hw->nvm.ops.read(hw, (NVM_ETRACK_WORD + 1), 1, &eeprom_verh);
fw_vers->etrack_id = (eeprom_verh << NVM_ETRACK_SHIFT)
| eeprom_verl;
} else if ((etrack_test & NVM_ETRACK_VALID) == 0) {
hw->nvm.ops.read(hw, NVM_ETRACK_WORD, 1, &eeprom_verh);
hw->nvm.ops.read(hw, (NVM_ETRACK_WORD + 1), 1, &eeprom_verl);
fw_vers->etrack_id = (eeprom_verh << NVM_ETRACK_SHIFT) |
eeprom_verl;
}
}

View File

@ -35,26 +35,12 @@
#ifndef _E1000_NVM_H_
#define _E1000_NVM_H_
#if !defined(NO_READ_PBA_RAW) || !defined(NO_WRITE_PBA_RAW)
struct e1000_pba {
u16 word[2];
u16 *pba_block;
};
struct e1000_fw_version {
u32 etrack_id;
u16 eep_major;
u16 eep_minor;
u16 eep_build;
u8 invm_major;
u8 invm_minor;
u8 invm_img_type;
bool or_valid;
u16 or_major;
u16 or_build;
u16 or_patch;
};
#endif
void e1000_init_nvm_ops_generic(struct e1000_hw *hw);
@ -66,7 +52,6 @@ s32 e1000_acquire_nvm_generic(struct e1000_hw *hw);
s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg);
s32 e1000_read_mac_addr_generic(struct e1000_hw *hw);
s32 e1000_read_pba_num_generic(struct e1000_hw *hw, u32 *pba_num);
s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num,
u32 pba_num_size);
s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size);
@ -91,8 +76,6 @@ s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words,
s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw);
void e1000_stop_nvm(struct e1000_hw *hw);
void e1000_release_nvm_generic(struct e1000_hw *hw);
void e1000_get_fw_version(struct e1000_hw *hw,
struct e1000_fw_version *fw_vers);
#define E1000_STM_OPCODE 0xDB00

View File

@ -74,6 +74,10 @@
#define STATIC static
#define FALSE 0
#define TRUE 1
#ifndef __bool_true_false_are_defined
#define false FALSE
#define true TRUE
#endif
#define CMD_MEM_WRT_INVALIDATE 0x0010 /* BIT_4 */
#define PCI_COMMAND_REGISTER PCIR_COMMAND
@ -95,6 +99,9 @@ typedef int64_t s64;
typedef int32_t s32;
typedef int16_t s16;
typedef int8_t s8;
#ifndef __bool_true_false_are_defined
typedef boolean_t bool;
#endif
#define __le16 u16
#define __le32 u32

View File

@ -1827,10 +1827,10 @@ s32 e1000_phy_force_speed_duplex_m88(struct e1000_hw *hw)
phy_data);
if (ret_val)
return ret_val;
DEBUGOUT1("M88E1000 PSCR: %X\n", phy_data);
}
DEBUGOUT1("M88E1000 PSCR: %X\n", phy_data);
ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data);
if (ret_val)
return ret_val;

View File

@ -65,9 +65,6 @@
#define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */
#define E1000_FEXTNVM6 0x00010 /* Future Extended NVM 6 - RW */
#define E1000_FEXTNVM7 0x000E4 /* Future Extended NVM 7 - RW */
#define E1000_FEXTNVM9 0x5BB4 /* Future Extended NVM 9 - RW */
#define E1000_FEXTNVM11 0x5BBC /* Future Extended NVM 11 - RW */
#define E1000_PCIEANACFG 0x00F18 /* PCIE Analog Config */
#define E1000_FCT 0x00030 /* Flow Control Type - RW */
#define E1000_CONNSW 0x00034 /* Copper/Fiber switch control - RW */
#define E1000_VET 0x00038 /* VLAN Ether Type - RW */
@ -110,8 +107,6 @@
#define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */
#define E1000_PBS 0x01008 /* Packet Buffer Size */
#define E1000_PBECCSTS 0x0100C /* Packet Buffer ECC Status - RW */
#define E1000_IOSFPC 0x00F28 /* TX corrupted data */
#define E1000_IOSFPC 0x00F28 /* TX corrupted data */
#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */
#define E1000_EEARBC 0x01024 /* EEPROM Auto Read Bus Control */
#define E1000_EEARBC_I210 0x12024 /* EEPROM Auto Read Bus Control */
@ -593,10 +588,6 @@
#define E1000_TIMADJL 0x0B60C /* Time sync time adjustment offset Low - RW */
#define E1000_TIMADJH 0x0B610 /* Time sync time adjustment offset High - RW */
#define E1000_TSAUXC 0x0B640 /* Timesync Auxiliary Control register */
#define E1000_SYSSTMPL 0x0B648 /* HH Timesync system stamp low register */
#define E1000_SYSSTMPH 0x0B64C /* HH Timesync system stamp hi register */
#define E1000_PLTSTMPL 0x0B640 /* HH Timesync platform stamp low register */
#define E1000_PLTSTMPH 0x0B644 /* HH Timesync platform stamp hi register */
#define E1000_SYSTIMR 0x0B6F8 /* System time register Residue */
#define E1000_TSICR 0x0B66C /* Interrupt Cause Register */
#define E1000_TSIM 0x0B674 /* Interrupt Mask Register */
@ -689,6 +680,7 @@
#define E1000_O2BGPTC 0x08FE4 /* OS2BMC packets received by BMC */
#define E1000_O2BSPC 0x0415C /* OS2BMC packets transmitted by host */
#define E1000_DOBFFCTL 0x3F24 /* DMA OBFF Control Register */
#endif

View File

@ -103,7 +103,7 @@ int em_display_debug_stats = 0;
/*********************************************************************
* Driver version:
*********************************************************************/
char em_driver_version[] = "7.5.2";
char em_driver_version[] = "7.4.2";
/*********************************************************************
* PCI Device ID Table
@ -191,11 +191,6 @@ static em_vendor_info_t em_vendor_info_array[] =
{ 0x8086, E1000_DEV_ID_PCH_I218_V2, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_PCH_I218_LM3, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_PCH_I218_V3, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_PCH_SPT_I219_LM, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_PCH_SPT_I219_V, PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_PCH_SPT_I219_LM2,
PCI_ANY_ID, PCI_ANY_ID, 0},
{ 0x8086, E1000_DEV_ID_PCH_SPT_I219_V2, PCI_ANY_ID, PCI_ANY_ID, 0},
/* required last entry */
{ 0, 0, 0, 0, 0}
};
@ -243,7 +238,6 @@ static void em_free_pci_resources(struct adapter *);
static void em_local_timer(void *);
static void em_reset(struct adapter *);
static int em_setup_interface(device_t, struct adapter *);
static void em_flush_desc_rings(struct adapter *);
static void em_setup_transmit_structures(struct adapter *);
static void em_initialize_transmit_unit(struct adapter *);
@ -589,20 +583,6 @@ em_attach(device_t dev)
goto err_pci;
}
/*
** In the new SPT device flash is not a
** separate BAR, rather it is also in BAR0,
** so use the same tag and handle for the
** FLASH read/write macros in the shared
** code.
*/
if (hw->mac.type == e1000_pch_spt) {
adapter->osdep.flash_bus_space_tag =
adapter->osdep.mem_bus_space_tag;
adapter->osdep.flash_bus_space_handle =
adapter->osdep.mem_bus_space_handle;
}
/*
* Setup MSI/X or MSI if PCI Express
*/
@ -1188,7 +1168,6 @@ em_ioctl(if_t ifp, u_long command, caddr_t data)
case e1000_ich10lan:
case e1000_pch2lan:
case e1000_pch_lpt:
case e1000_pch_spt:
case e1000_82574:
case e1000_82583:
case e1000_80003es2lan: /* 9K Jumbo Frame size */
@ -1390,15 +1369,8 @@ em_init_locked(struct adapter *adapter)
if_clearhwassist(ifp);
if (if_getcapenable(ifp) & IFCAP_TXCSUM)
if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP, 0);
/*
** There have proven to be problems with TSO when not
** at full gigabit speed, so disable the assist automatically
** when at lower speeds. -jfv
*/
if (if_getcapenable(ifp) & IFCAP_TSO4) {
if (adapter->link_speed == SPEED_1000)
if_sethwassistbits(ifp, CSUM_TSO, 0);
}
if (if_getcapenable(ifp) & IFCAP_TSO4)
if_sethwassistbits(ifp, CSUM_TSO, 0);
/* Configure for OS presence */
em_init_manageability(adapter);
@ -2378,8 +2350,6 @@ em_update_link_status(struct adapter *adapter)
switch (hw->phy.media_type) {
case e1000_media_type_copper:
if (hw->mac.get_link_status) {
if (hw->mac.type == e1000_pch_spt)
msec_delay(50);
/* Do the work to read phy */
e1000_check_for_link(hw);
link_check = !hw->mac.get_link_status;
@ -2471,10 +2441,6 @@ em_stop(void *arg)
EM_TX_UNLOCK(txr);
}
/* I219 needs some special flushing to avoid hangs */
if (adapter->hw.mac.type == e1000_pch_spt)
em_flush_desc_rings(adapter);
e1000_reset_hw(&adapter->hw);
E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0);
@ -2894,116 +2860,6 @@ em_setup_msix(struct adapter *adapter)
}
/*
** The 3 following flush routines are used as a workaround in the
** I219 client parts and only for them.
**
** em_flush_tx_ring - remove all descriptors from the tx_ring
**
** We want to clear all pending descriptors from the TX ring.
** zeroing happens when the HW reads the regs. We assign the ring itself as
** the data of the next descriptor. We don't care about the data we are about
** to reset the HW.
*/
static void
em_flush_tx_ring(struct adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
struct tx_ring *txr = adapter->tx_rings;
struct e1000_tx_desc *txd;
u32 tctl, txd_lower = E1000_TXD_CMD_IFCS;
u16 size = 512;
tctl = E1000_READ_REG(hw, E1000_TCTL);
E1000_WRITE_REG(hw, E1000_TCTL, tctl | E1000_TCTL_EN);
txd = &txr->tx_base[txr->next_avail_desc++];
if (txr->next_avail_desc == adapter->num_tx_desc)
txr->next_avail_desc = 0;
/* Just use the ring as a dummy buffer addr */
txd->buffer_addr = txr->txdma.dma_paddr;
txd->lower.data = htole32(txd_lower | size);
txd->upper.data = 0;
/* flush descriptors to memory before notifying the HW */
wmb();
E1000_WRITE_REG(hw, E1000_TDT(0), txr->next_avail_desc);
mb();
usec_delay(250);
}
/*
** em_flush_rx_ring - remove all descriptors from the rx_ring
**
** Mark all descriptors in the RX ring as consumed and disable the rx ring
*/
static void
em_flush_rx_ring(struct adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
u32 rctl, rxdctl;
rctl = E1000_READ_REG(hw, E1000_RCTL);
E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN);
E1000_WRITE_FLUSH(hw);
usec_delay(150);
rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0));
/* zero the lower 14 bits (prefetch and host thresholds) */
rxdctl &= 0xffffc000;
/*
* update thresholds: prefetch threshold to 31, host threshold to 1
* and make sure the granularity is "descriptors" and not "cache lines"
*/
rxdctl |= (0x1F | (1 << 8) | E1000_RXDCTL_THRESH_UNIT_DESC);
E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl);
/* momentarily enable the RX ring for the changes to take effect */
E1000_WRITE_REG(hw, E1000_RCTL, rctl | E1000_RCTL_EN);
E1000_WRITE_FLUSH(hw);
usec_delay(150);
E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN);
}
/*
** em_flush_desc_rings - remove all descriptors from the descriptor rings
**
** In i219, the descriptor rings must be emptied before resetting the HW
** or before changing the device state to D3 during runtime (runtime PM).
**
** Failure to do this will cause the HW to enter a unit hang state which can
** only be released by PCI reset on the device
**
*/
static void
em_flush_desc_rings(struct adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
device_t dev = adapter->dev;
u16 hang_state;
u32 fext_nvm11, tdlen;
/* First, disable MULR fix in FEXTNVM11 */
fext_nvm11 = E1000_READ_REG(hw, E1000_FEXTNVM11);
fext_nvm11 |= E1000_FEXTNVM11_DISABLE_MULR_FIX;
E1000_WRITE_REG(hw, E1000_FEXTNVM11, fext_nvm11);
/* do nothing if we're not in faulty state, or if the queue is empty */
tdlen = E1000_READ_REG(hw, E1000_TDLEN(0));
hang_state = pci_read_config(dev, PCICFG_DESC_RING_STATUS, 2);
if (!(hang_state & FLUSH_DESC_REQUIRED) || !tdlen)
return;
em_flush_tx_ring(adapter);
/* recheck, maybe the fault is caused by the rx ring */
hang_state = pci_read_config(dev, PCICFG_DESC_RING_STATUS, 2);
if (hang_state & FLUSH_DESC_REQUIRED)
em_flush_rx_ring(adapter);
}
/*********************************************************************
*
* Initialize the hardware to a configuration
@ -3065,7 +2921,6 @@ em_reset(struct adapter *adapter)
case e1000_pchlan:
case e1000_pch2lan:
case e1000_pch_lpt:
case e1000_pch_spt:
pba = E1000_PBA_26K;
break;
default:
@ -3124,7 +2979,6 @@ em_reset(struct adapter *adapter)
break;
case e1000_pch2lan:
case e1000_pch_lpt:
case e1000_pch_spt:
hw->fc.high_water = 0x5C20;
hw->fc.low_water = 0x5048;
hw->fc.pause_time = 0x0650;
@ -3149,10 +3003,6 @@ em_reset(struct adapter *adapter)
break;
}
/* I219 needs some special flushing to avoid hangs */
if (hw->mac.type == e1000_pch_spt)
em_flush_desc_rings(adapter);
/* Issue a global reset */
e1000_reset_hw(hw);
E1000_WRITE_REG(hw, E1000_WUC, 0);
@ -3749,15 +3599,6 @@ em_initialize_transmit_unit(struct adapter *adapter)
/* This write will effectively turn on the transmit unit. */
E1000_WRITE_REG(&adapter->hw, E1000_TCTL, tctl);
if (hw->mac.type == e1000_pch_spt) {
u32 reg;
reg = E1000_READ_REG(hw, E1000_IOSFPC);
reg |= E1000_RCTL_RDMTS_HEX;
E1000_WRITE_REG(hw, E1000_IOSFPC, reg);
reg = E1000_READ_REG(hw, E1000_TARC(0));
reg |= E1000_TARC0_CB_MULTIQ_3_REQ;
E1000_WRITE_REG(hw, E1000_TARC(0), reg);
}
}

View File

@ -218,9 +218,6 @@
#define EM_TX_HUNG 0x80000000
#define EM_TX_MAXTRIES 10
#define PCICFG_DESC_RING_STATUS 0xe4
#define FLUSH_DESC_REQUIRED 0x100
/*
* TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be
* multiple of 128 bytes. So we align TDBA/RDBA on 128 byte boundary. This will

View File

@ -541,9 +541,9 @@ igb_attach(device_t dev)
"Disable Energy Efficient Ethernet");
if (adapter->hw.phy.media_type == e1000_media_type_copper) {
if (adapter->hw.mac.type == e1000_i354)
e1000_set_eee_i354(&adapter->hw, TRUE, TRUE);
e1000_set_eee_i354(&adapter->hw);
else
e1000_set_eee_i350(&adapter->hw, TRUE, TRUE);
e1000_set_eee_i350(&adapter->hw);
}
}
@ -1330,9 +1330,9 @@ igb_init_locked(struct adapter *adapter)
/* Set Energy Efficient Ethernet */
if (adapter->hw.phy.media_type == e1000_media_type_copper) {
if (adapter->hw.mac.type == e1000_i354)
e1000_set_eee_i354(&adapter->hw, TRUE, TRUE);
e1000_set_eee_i354(&adapter->hw);
else
e1000_set_eee_i350(&adapter->hw, TRUE, TRUE);
e1000_set_eee_i350(&adapter->hw);
}
}

View File

@ -327,11 +327,17 @@ sysctl_debug_hashstat_rawnchash(SYSCTL_HANDLER_ARGS)
struct namecache *ncp;
int i, error, n_nchash, *cntbuf;
retry:
n_nchash = nchash + 1; /* nchash is max index, not count */
if (req->oldptr == NULL)
return SYSCTL_OUT(req, 0, n_nchash * sizeof(int));
cntbuf = malloc(n_nchash * sizeof(int), M_TEMP, M_ZERO | M_WAITOK);
CACHE_RLOCK();
if (n_nchash != nchash + 1) {
CACHE_RUNLOCK();
free(cntbuf, M_TEMP);
goto retry;
}
/* Scan hash tables counting entries */
for (ncpp = nchashtbl, i = 0; i < n_nchash; ncpp++, i++)
LIST_FOREACH(ncp, ncpp, nc_hash)
@ -930,6 +936,44 @@ nchinit(void *dummy __unused)
}
SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_SECOND, nchinit, NULL);
void
cache_changesize(int newmaxvnodes)
{
struct nchashhead *new_nchashtbl, *old_nchashtbl;
u_long new_nchash, old_nchash;
struct namecache *ncp;
uint32_t hash;
int i;
new_nchashtbl = hashinit(newmaxvnodes * 2, M_VFSCACHE, &new_nchash);
/* If same hash table size, nothing to do */
if (nchash == new_nchash) {
free(new_nchashtbl, M_VFSCACHE);
return;
}
/*
* Move everything from the old hash table to the new table.
* None of the namecache entries in the table can be removed
* because to do so, they have to be removed from the hash table.
*/
CACHE_WLOCK();
old_nchashtbl = nchashtbl;
old_nchash = nchash;
nchashtbl = new_nchashtbl;
nchash = new_nchash;
for (i = 0; i <= old_nchash; i++) {
while ((ncp = LIST_FIRST(&old_nchashtbl[i])) != NULL) {
hash = fnv_32_buf(nc_get_name(ncp), ncp->nc_nlen,
FNV1_32_INIT);
hash = fnv_32_buf(&ncp->nc_dvp, sizeof(ncp->nc_dvp),
hash);
LIST_REMOVE(ncp, nc_hash);
LIST_INSERT_HEAD(NCHHASH(hash), ncp, nc_hash);
}
}
CACHE_WUNLOCK();
free(old_nchashtbl, M_VFSCACHE);
}
/*
* Invalidate all entries to a particular vnode.

View File

@ -161,3 +161,40 @@ vfs_hash_rehash(struct vnode *vp, u_int hash)
vp->v_hash = hash;
rw_wunlock(&vfs_hash_lock);
}
void
vfs_hash_changesize(int newmaxvnodes)
{
struct vfs_hash_head *vfs_hash_newtbl, *vfs_hash_oldtbl;
u_long vfs_hash_newmask, vfs_hash_oldmask;
struct vnode *vp;
int i;
vfs_hash_newtbl = hashinit(newmaxvnodes, M_VFS_HASH,
&vfs_hash_newmask);
/* If same hash table size, nothing to do */
if (vfs_hash_mask == vfs_hash_newmask) {
free(vfs_hash_newtbl, M_VFS_HASH);
return;
}
/*
* Move everything from the old hash table to the new table.
* None of the vnodes in the table can be recycled because to
* do so, they have to be removed from the hash table.
*/
rw_wlock(&vfs_hash_lock);
vfs_hash_oldtbl = vfs_hash_tbl;
vfs_hash_oldmask = vfs_hash_mask;
vfs_hash_tbl = vfs_hash_newtbl;
vfs_hash_mask = vfs_hash_newmask;
for (i = 0; i <= vfs_hash_oldmask; i++) {
while ((vp = LIST_FIRST(&vfs_hash_oldtbl[i])) != NULL) {
LIST_REMOVE(vp, v_hashlist);
LIST_INSERT_HEAD(
vfs_hash_bucket(vp->v_mount, vp->v_hash),
vp, v_hashlist);
}
}
rw_wunlock(&vfs_hash_lock);
free(vfs_hash_oldtbl, M_VFS_HASH);
}

View File

@ -281,8 +281,25 @@ static enum { SYNCER_RUNNING, SYNCER_SHUTTING_DOWN, SYNCER_FINAL_DELAY }
* XXX desiredvnodes is historical cruft and should not exist.
*/
int desiredvnodes;
SYSCTL_INT(_kern, KERN_MAXVNODES, maxvnodes, CTLFLAG_RW,
&desiredvnodes, 0, "Maximum number of vnodes");
static int
sysctl_update_desiredvnodes(SYSCTL_HANDLER_ARGS)
{
int error, old_desiredvnodes;
old_desiredvnodes = desiredvnodes;
if ((error = sysctl_handle_int(oidp, arg1, arg2, req)) != 0)
return (error);
if (old_desiredvnodes != desiredvnodes) {
vfs_hash_changesize(desiredvnodes);
cache_changesize(desiredvnodes);
}
return (0);
}
SYSCTL_PROC(_kern, KERN_MAXVNODES, maxvnodes,
CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, &desiredvnodes, 0,
sysctl_update_desiredvnodes, "I", "Maximum number of vnodes");
SYSCTL_ULONG(_kern, OID_AUTO, minvnodes, CTLFLAG_RW,
&wantfreevnodes, 0, "Minimum number of vnodes (legacy)");
static int vnlru_nowhere;

View File

@ -607,6 +607,7 @@ struct vnode;
typedef int (*vn_get_ino_t)(struct mount *, void *, int, struct vnode **);
/* cache_* may belong in namei.h. */
void cache_changesize(int newhashsize);
#define cache_enter(dvp, vp, cnp) \
cache_enter_time(dvp, vp, cnp, NULL, NULL)
void cache_enter_time(struct vnode *dvp, struct vnode *vp,
@ -843,6 +844,7 @@ int fifo_printinfo(struct vnode *);
/* vfs_hash.c */
typedef int vfs_hash_cmp_t(struct vnode *vp, void *arg);
void vfs_hash_changesize(int newhashsize);
int vfs_hash_get(const struct mount *mp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
u_int vfs_hash_index(struct vnode *vp);
int vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);

View File

@ -131,6 +131,7 @@ kstack_cleanup_encoded(const char *old, char *new, int kflag)
cp_new++;
}
}
*cp_new = '\0';
cp_tofree = cp_loop = strdup(new);
} else
cp_tofree = cp_loop = strdup(old);
@ -138,7 +139,6 @@ kstack_cleanup_encoded(const char *old, char *new, int kflag)
if (strlen(cp_line) != 0 && *cp_line != 127)
xo_emit("{le:token/%s}", cp_line);
}
*cp_new = '\0';
free(cp_tofree);
}

View File

@ -34,7 +34,7 @@
.\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $
.\" $FreeBSD$
.\"
.Dd June 3, 2015
.Dd September 6, 2015
.Dt CTLADM 8
.Os
.Sh NAME
@ -166,6 +166,7 @@
.Ic modify
.Aq Fl b Ar backend
.Aq Fl l Ar lun_id
.Op Fl o Ar name=value
.Aq Fl s Ar size_bytes
.Nm
.Ic devlist
@ -859,6 +860,12 @@ and
.Dq block .
.It Fl l Ar lun_id
Specify the LUN number to remove.
.It Fl o Ar name=value
Specify a backend-specific name/value pair.
Multiple
.Fl o
arguments may be specified.
Refer to the backend documentation for arguments that may be used.
.It Fl s Ar size_bytes
Specify the size of the LUN in bytes.
For the

View File

@ -183,7 +183,7 @@ static struct ctladm_opts option_table[] = {
{"lunlist", CTLADM_CMD_LUNLIST, CTLADM_ARG_NONE, NULL},
{"lunmap", CTLADM_CMD_LUNMAP, CTLADM_ARG_NONE, "p:l:L:"},
{"modesense", CTLADM_CMD_MODESENSE, CTLADM_ARG_NEED_TL, "P:S:dlm:c:"},
{"modify", CTLADM_CMD_MODIFY, CTLADM_ARG_NONE, "b:l:s:"},
{"modify", CTLADM_CMD_MODIFY, CTLADM_ARG_NONE, "b:l:o:s:"},
{"port", CTLADM_CMD_PORT, CTLADM_ARG_NONE, "lo:p:qt:w:W:x"},
{"portlist", CTLADM_CMD_PORTLIST, CTLADM_ARG_NONE, "f:ilp:qvx"},
{"prin", CTLADM_CMD_PRES_IN, CTLADM_ARG_NEED_TL, "a:"},
@ -3169,8 +3169,11 @@ cctl_modify_lun(int fd, int argc, char **argv, char *combinedopt)
uint32_t lun_id = 0;
int lun_id_set = 0, lun_size_set = 0;
char *backend_name = NULL;
STAILQ_HEAD(, cctl_req_option) option_list;
int num_options = 0;
int retval = 0, c;
STAILQ_INIT(&option_list);
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch (c) {
case 'b':
@ -3180,6 +3183,43 @@ cctl_modify_lun(int fd, int argc, char **argv, char *combinedopt)
lun_id = strtoul(optarg, NULL, 0);
lun_id_set = 1;
break;
case 'o': {
struct cctl_req_option *option;
char *tmpstr;
char *name, *value;
tmpstr = strdup(optarg);
name = strsep(&tmpstr, "=");
if (name == NULL) {
warnx("%s: option -o takes \"name=value\""
"argument", __func__);
retval = 1;
goto bailout;
}
value = strsep(&tmpstr, "=");
if (value == NULL) {
warnx("%s: option -o takes \"name=value\""
"argument", __func__);
retval = 1;
goto bailout;
}
option = malloc(sizeof(*option));
if (option == NULL) {
warn("%s: error allocating %zd bytes",
__func__, sizeof(*option));
retval = 1;
goto bailout;
}
option->name = strdup(name);
option->namelen = strlen(name) + 1;
option->value = strdup(value);
option->vallen = strlen(value) + 1;
free(tmpstr);
STAILQ_INSERT_TAIL(&option_list, option, links);
num_options++;
break;
}
case 's':
if (strcasecmp(optarg, "auto") != 0) {
retval = expand_number(optarg, &lun_size);
@ -3203,8 +3243,9 @@ cctl_modify_lun(int fd, int argc, char **argv, char *combinedopt)
if (lun_id_set == 0)
errx(1, "%s: LUN id (-l) must be specified", __func__);
if (lun_size_set == 0)
errx(1, "%s: size (-s) must be specified", __func__);
if (lun_size_set == 0 && num_options == 0)
errx(1, "%s: size (-s) or options (-o) must be specified",
__func__);
bzero(&req, sizeof(req));
@ -3214,6 +3255,42 @@ cctl_modify_lun(int fd, int argc, char **argv, char *combinedopt)
req.reqdata.modify.lun_id = lun_id;
req.reqdata.modify.lun_size_bytes = lun_size;
req.num_be_args = num_options;
if (num_options > 0) {
struct cctl_req_option *option, *next_option;
int i;
req.be_args = malloc(num_options * sizeof(*req.be_args));
if (req.be_args == NULL) {
warn("%s: error allocating %zd bytes", __func__,
num_options * sizeof(*req.be_args));
retval = 1;
goto bailout;
}
for (i = 0, option = STAILQ_FIRST(&option_list);
i < num_options; i++, option = next_option) {
next_option = STAILQ_NEXT(option, links);
req.be_args[i].namelen = option->namelen;
req.be_args[i].name = strdup(option->name);
req.be_args[i].vallen = option->vallen;
req.be_args[i].value = strdup(option->value);
/*
* XXX KDM do we want a way to specify a writeable
* flag of some sort? Do we want a way to specify
* binary data?
*/
req.be_args[i].flags = CTL_BEARG_ASCII | CTL_BEARG_RD;
STAILQ_REMOVE(&option_list, option, cctl_req_option,
links);
free(option->name);
free(option->value);
free(option);
}
}
if (ioctl(fd, CTL_LUN_REQ, &req) == -1) {
warn("%s: error issuing CTL_LUN_REQ ioctl", __func__);
retval = 1;

View File

@ -1961,18 +1961,14 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
TAILQ_FOREACH_SAFE(newlun, &newconf->conf_luns, l_next, tmplun) {
oldlun = lun_find(oldconf, newlun->l_name);
if (oldlun != NULL) {
if (newlun->l_size != oldlun->l_size ||
newlun->l_size == 0) {
log_debugx("resizing lun \"%s\", CTL lun %d",
log_debugx("modifying lun \"%s\", CTL lun %d",
newlun->l_name, newlun->l_ctl_lun);
error = kernel_lun_modify(newlun);
if (error != 0) {
log_warnx("failed to "
"modify lun \"%s\", CTL lun %d",
newlun->l_name, newlun->l_ctl_lun);
error = kernel_lun_resize(newlun);
if (error != 0) {
log_warnx("failed to "
"resize lun \"%s\", CTL lun %d",
newlun->l_name,
newlun->l_ctl_lun);
cumulated_error++;
}
cumulated_error++;
}
continue;
}

View File

@ -391,7 +391,7 @@ void lun_option_set(struct lun_option *clo,
void kernel_init(void);
int kernel_lun_add(struct lun *lun);
int kernel_lun_resize(struct lun *lun);
int kernel_lun_modify(struct lun *lun);
int kernel_lun_remove(struct lun *lun);
void kernel_handoff(struct connection *conn);
void kernel_limits(const char *offload,

View File

@ -743,9 +743,11 @@ kernel_lun_add(struct lun *lun)
}
int
kernel_lun_resize(struct lun *lun)
kernel_lun_modify(struct lun *lun)
{
struct lun_option *lo;
struct ctl_lun_req req;
int error, i, num_options;
bzero(&req, sizeof(req));
@ -755,7 +757,30 @@ kernel_lun_resize(struct lun *lun)
req.reqdata.modify.lun_id = lun->l_ctl_lun;
req.reqdata.modify.lun_size_bytes = lun->l_size;
if (ioctl(ctl_fd, CTL_LUN_REQ, &req) == -1) {
num_options = 0;
TAILQ_FOREACH(lo, &lun->l_options, lo_next)
num_options++;
req.num_be_args = num_options;
if (num_options > 0) {
req.be_args = malloc(num_options * sizeof(*req.be_args));
if (req.be_args == NULL) {
log_warn("error allocating %zd bytes",
num_options * sizeof(*req.be_args));
return (1);
}
i = 0;
TAILQ_FOREACH(lo, &lun->l_options, lo_next) {
str_arg(&req.be_args[i], lo->lo_name, lo->lo_value);
i++;
}
assert(i == num_options);
}
error = ioctl(ctl_fd, CTL_LUN_REQ, &req);
free(req.be_args);
if (error != 0) {
log_warn("error issuing CTL_LUN_REQ ioctl");
return (1);
}

View File

@ -83,13 +83,13 @@ do_locate(int fd, unsigned int idx, bool onoff)
static bool
disk_match(const char *devnames, const char *disk, size_t len)
{
const char *devname;
const char *dname;
devname = devnames;
while ((devname = strstr(devname, disk)) != NULL) {
if (devname[len] == '\0' || devname[len] == ',')
dname = devnames;
while ((dname = strstr(dname, disk)) != NULL) {
if (dname[len] == '\0' || dname[len] == ',')
return (true);
devname++;
dname++;
}
return (false);
}
@ -175,7 +175,6 @@ locate(int argc, char **argv)
}
}
close(fd);
i++;
}
globfree(&g);