Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Glen Barber
2016-01-14 13:29:12 +00:00
223 changed files with 3037 additions and 1442 deletions
@@ -283,7 +283,6 @@ static int
equiv_su(tdesc_t *stdp, tdesc_t *ttdp, equiv_data_t *ed)
{
mlist_t *ml1 = stdp->t_members, *ml2 = ttdp->t_members;
mlist_t *olm1 = NULL;
while (ml1 && ml2) {
if (ml1->ml_offset != ml2->ml_offset ||
@@ -292,7 +291,6 @@ equiv_su(tdesc_t *stdp, tdesc_t *ttdp, equiv_data_t *ed)
!equiv_node(ml1->ml_type, ml2->ml_type, ed))
return (0);
olm1 = ml1;
ml1 = ml1->ml_next;
ml2 = ml2->ml_next;
}
+5 -4
View File
@@ -82,10 +82,6 @@ BIN1+= apmd.conf
BIN1+= auto_master
.endif
.if ${MK_BSNMP} != "no"
BIN1+= snmpd.config
.endif
.if ${MK_FREEBSD_UPDATE} != "no"
BIN1+= freebsd-update.conf
.endif
@@ -219,6 +215,11 @@ distribution:
${BIN2} ${DESTDIR}/etc; \
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
master.passwd nsmb.conf opieaccess ${DESTDIR}/etc;
.if ${MK_BSNMP} != "no"
cd ${.CURDIR}; \
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
snmpd.config ${DESTDIR}/etc;
.endif
.if ${MK_AT} == "no"
sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab
.endif
+26
View File
@@ -376,6 +376,32 @@
..
file
..
geom
class
concat
..
eli
..
gate
..
gpt
..
mirror
..
nop
..
raid3
..
shsec
..
stripe
..
uzip
etalon
..
..
..
..
kern
acct
..
+1 -5
View File
@@ -54,11 +54,7 @@ __asm(" .text \n"
" .align 0 \n"
" .globl _start \n"
" _start: \n"
/* TODO: Remove this when the kernel correctly aligns the stack */
" cbnz x0, 1f \n" /* Are we using a new kernel? */
" mov x0, sp \n" /* No, load the args from sp */
" and sp, x0, #~0xf \n" /* And align the stack */
"1: mov x3, x2 \n" /* cleanup */
" mov x3, x2 \n" /* cleanup */
" add x1, x0, #8 \n" /* load argv */
" ldr x0, [x0] \n" /* load argc */
" add x2, x1, x0, lsl #3 \n" /* env is after argv */
-1
View File
@@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$");
base = leaf; \
path_init(&path); \
} \
result = &(*leaf)->key; \
path_taking_right(&path); \
leaf = &(*leaf)->rlink; \
} while (0)
+1 -1
View File
@@ -54,7 +54,7 @@ wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (*d != '\0' && n-- != 0)
while (n-- != 0 && *d != '\0')
d++;
dlen = d - dst;
n = siz - dlen;
+1 -1
View File
@@ -48,7 +48,7 @@ wcsncat(wchar_t * __restrict s1, const wchar_t * __restrict s2, size_t n)
p++;
q = p;
r = s2;
while (*r && n) {
while (n && *r) {
*q++ = *r++;
n--;
}
+3 -4
View File
@@ -28,7 +28,7 @@
.\" @(#)stat.2 8.4 (Berkeley) 5/1/95
.\" $FreeBSD$
.\"
.Dd June 2, 2012
.Dd January 14, 2016
.Dt STAT 2
.Os
.Sh NAME
@@ -40,12 +40,11 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/types.h
.In sys/stat.h
.Ft int
.Fn stat "const char *path" "struct stat *sb"
.Fn stat "const char * restrict path" "struct stat * restrict sb"
.Ft int
.Fn lstat "const char *path" "struct stat *sb"
.Fn lstat "const char * restrict path" "struct stat * restrict sb"
.Ft int
.Fn fstat "int fd" "struct stat *sb"
.Ft int
+6
View File
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <dialog.h>
#include <err.h>
#include <limits.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -482,6 +483,11 @@ dpv(struct dpv_config *config, struct dpv_file_node *file_list)
/* Reads: label_size pbar_size pprompt aprompt dpv_nfiles */
/* Inits: dheight and dwidth */
/* Default localeconv(3) settings for dialog(3) status */
setlocale(LC_NUMERIC,
getenv("LC_ALL") == NULL && getenv("LC_NUMERIC") == NULL ?
LC_NUMERIC_DEFAULT : "");
if (!debug) {
/* Internally create the initial `--gauge' prompt text */
dprompt_recreate(file_list, (struct dpv_file_node *)NULL, 0);
+3
View File
@@ -38,6 +38,9 @@
#define FALSE 0
#endif
/* localeconv(3) */
#define LC_NUMERIC_DEFAULT "en_US.ISO8859-1"
/* Data to process */
extern long long dpv_overall_read;
+3 -2
View File
@@ -42,7 +42,7 @@ int _umtx_op_err(void *obj, int op, u_long val, void *uaddr, void *uaddr2)
void
_thr_umutex_init(struct umutex *mtx)
{
static struct umutex default_mtx = DEFAULT_UMUTEX;
static const struct umutex default_mtx = DEFAULT_UMUTEX;
*mtx = default_mtx;
}
@@ -50,7 +50,8 @@ _thr_umutex_init(struct umutex *mtx)
void
_thr_urwlock_init(struct urwlock *rwl)
{
static struct urwlock default_rwl = DEFAULT_URWLOCK;
static const struct urwlock default_rwl = DEFAULT_URWLOCK;
*rwl = default_rwl;
}
+1 -7
View File
@@ -34,13 +34,7 @@ ENTRY(.rtld_start)
mov x19, x0 /* Put ps_strings in a callee-saved register */
mov x20, sp /* And the stack pointer */
/* Handle the old style stack */
/* TODO: Remove this when the kernel correctly aligns the stack */
cbnz x0, 1f
mov x0, sp /* sp points to the args */
and sp, x0, #~0xf /* Align the stack as needed */
1: sub sp, sp, #16 /* Make room for obj_main & exit proc */
sub sp, sp, #16 /* Make room for obj_main & exit proc */
mov x1, sp /* exit_proc */
add x2, x1, #8 /* obj_main */
+1 -1
View File
@@ -28,7 +28,7 @@ if [ "x$1" = "x-b" ]; then
bootable="-o bootimage=i386;$4/boot/cdboot -o no-emul-boot"
# Make EFI system partition (should be done with makefs in the future)
dd if=/dev/zero of=efiboot.img bs=4k count=100
dd if=/dev/zero of=efiboot.img bs=4k count=200
device=`mdconfig -a -t vnode -f efiboot.img`
newfs_msdos -F 12 -m 0xf8 /dev/$device
mkdir efi
+2 -2
View File
@@ -2,8 +2,8 @@
# $OpenBSD: pf.conf,v 1.34 2007/02/24 19:30:59 millert Exp $
#
# See pf.conf(5) and /usr/share/examples/pf for syntax and examples.
# Remember to set net.inet.ip.forwarding=1 and/or net.inet6.ip6.forwarding=1
# in /etc/sysctl.conf if packets are to be forwarded between interfaces.
# Remember to set gateway_enable="YES" and/or ipv6_gateway_enable="YES"
# in /etc/rc.conf if packets are to be forwarded between interfaces.
#ext_if="ext0"
#int_if="int0"
+3 -2
View File
@@ -164,10 +164,11 @@ SSP_CFLAGS?= -fstack-protector
CFLAGS+= ${SSP_CFLAGS}
.endif # SSP && !ARM && !MIPS
# Allow user-specified additional warning flags, plus compiler specific flag overrides.
# Unless we've overriden this...
# Allow user-specified additional warning flags, plus compiler and file
# specific flag overrides, unless we've overriden this...
.if ${MK_WARNS} != "no"
CFLAGS+= ${CWARNFLAGS} ${CWARNFLAGS.${COMPILER_TYPE}}
CFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}}
.endif
CFLAGS+= ${CFLAGS.${COMPILER_TYPE}}
+4 -1
View File
@@ -3018,11 +3018,14 @@ reserve_pv_entries(pmap_t pmap, int needed, struct rwlock **lockp)
retry:
avail = 0;
TAILQ_FOREACH(pc, &pmap->pm_pvchunk, pc_list) {
#ifndef __POPCNT__
if ((cpu_feature2 & CPUID2_POPCNT) == 0) {
free = bitcount64(pc->pc_map[0]);
free += bitcount64(pc->pc_map[1]);
free += bitcount64(pc->pc_map[2]);
} else {
} else
#endif
{
free = popcnt_pc_map_elem_pq(pc->pc_map[0]);
free += popcnt_pc_map_elem_pq(pc->pc_map[1]);
free += popcnt_pc_map_elem_pq(pc->pc_map[2]);
+2 -2
View File
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: head/sys/amd64/linux/syscalls.master 289769 2015-10-22 21:28:20Z jhb
* created from FreeBSD: head/sys/amd64/linux/syscalls.master 293907 2016-01-14 10:13:58Z glebius
*/
#ifndef _LINUX_SYSPROTO_H_
@@ -966,7 +966,7 @@ struct linux_set_robust_list_args {
};
struct linux_get_robust_list_args {
char pid_l_[PADL_(l_int)]; l_int pid; char pid_r_[PADR_(l_int)];
char head_l_[PADL_(struct linux_robust_list_head *)]; struct linux_robust_list_head * head; char head_r_[PADR_(struct linux_robust_list_head *)];
char head_l_[PADL_(struct linux_robust_list_head **)]; struct linux_robust_list_head ** head; char head_r_[PADR_(struct linux_robust_list_head **)];
char len_l_[PADL_(l_size_t *)]; l_size_t * len; char len_r_[PADR_(l_size_t *)];
};
struct linux_splice_args {
+1 -1
View File
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: head/sys/amd64/linux/syscalls.master 289769 2015-10-22 21:28:20Z jhb
* created from FreeBSD: head/sys/amd64/linux/syscalls.master 293907 2016-01-14 10:13:58Z glebius
*/
#define LINUX_SYS_read 0
+1 -1
View File
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: head/sys/amd64/linux/syscalls.master 289769 2015-10-22 21:28:20Z jhb
* created from FreeBSD: head/sys/amd64/linux/syscalls.master 293907 2016-01-14 10:13:58Z glebius
*/
const char *linux_syscallnames[] = {
+1 -1
View File
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: head/sys/amd64/linux/syscalls.master 289769 2015-10-22 21:28:20Z jhb
* created from FreeBSD: head/sys/amd64/linux/syscalls.master 293907 2016-01-14 10:13:58Z glebius
*/
#include <sys/param.h>
+2 -2
View File
@@ -2020,7 +2020,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 274: {
struct linux_get_robust_list_args *p = params;
iarg[0] = p->pid; /* l_int */
uarg[1] = (intptr_t) p->head; /* struct linux_robust_list_head * */
uarg[1] = (intptr_t) p->head; /* struct linux_robust_list_head ** */
uarg[2] = (intptr_t) p->len; /* l_size_t * */
*n_args = 3;
break;
@@ -5347,7 +5347,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 1:
p = "struct linux_robust_list_head *";
p = "struct linux_robust_list_head **";
break;
case 2:
p = "l_size_t *";
+2 -2
View File
@@ -461,8 +461,8 @@
272 AUE_NULL STD { int linux_unshare(void); }
273 AUE_NULL STD { int linux_set_robust_list(struct linux_robust_list_head *head, \
l_size_t len); }
274 AUE_NULL STD { int linux_get_robust_list(l_int pid, struct linux_robust_list_head *head, \
l_size_t *len); }
274 AUE_NULL STD { int linux_get_robust_list(l_int pid, \
struct linux_robust_list_head **head, l_size_t *len); }
275 AUE_NULL STD { int linux_splice(void); }
276 AUE_NULL STD { int linux_tee(void); }
277 AUE_NULL STD { int linux_sync_file_range(void); }
+2 -2
View File
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 289769 2015-10-22 21:28:20Z jhb
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 293907 2016-01-14 10:13:58Z glebius
*/
#ifndef _LINUX32_SYSPROTO_H_
@@ -1023,7 +1023,7 @@ struct linux_set_robust_list_args {
};
struct linux_get_robust_list_args {
char pid_l_[PADL_(l_int)]; l_int pid; char pid_r_[PADR_(l_int)];
char head_l_[PADL_(struct linux_robust_list_head *)]; struct linux_robust_list_head * head; char head_r_[PADR_(struct linux_robust_list_head *)];
char head_l_[PADL_(struct linux_robust_list_head **)]; struct linux_robust_list_head ** head; char head_r_[PADR_(struct linux_robust_list_head **)];
char len_l_[PADL_(l_size_t *)]; l_size_t * len; char len_r_[PADR_(l_size_t *)];
};
struct linux_splice_args {
+1 -1
View File
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 289769 2015-10-22 21:28:20Z jhb
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 293907 2016-01-14 10:13:58Z glebius
*/
#define LINUX32_SYS_linux_exit 1
+1 -1
View File
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 289769 2015-10-22 21:28:20Z jhb
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 293907 2016-01-14 10:13:58Z glebius
*/
const char *linux32_syscallnames[] = {
+1 -1
View File
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 289769 2015-10-22 21:28:20Z jhb
* created from FreeBSD: head/sys/amd64/linux32/syscalls.master 293907 2016-01-14 10:13:58Z glebius
*/
#include "opt_compat.h"
+2 -2
View File
@@ -2122,7 +2122,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 312: {
struct linux_get_robust_list_args *p = params;
iarg[0] = p->pid; /* l_int */
uarg[1] = (intptr_t) p->head; /* struct linux_robust_list_head * */
uarg[1] = (intptr_t) p->head; /* struct linux_robust_list_head ** */
uarg[2] = (intptr_t) p->len; /* l_size_t * */
*n_args = 3;
break;
@@ -5551,7 +5551,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 1:
p = "struct linux_robust_list_head *";
p = "struct linux_robust_list_head **";
break;
case 2:
p = "l_size_t *";
+2 -2
View File
@@ -520,8 +520,8 @@
; linux 2.6.17:
311 AUE_NULL STD { int linux_set_robust_list(struct linux_robust_list_head *head, \
l_size_t len); }
312 AUE_NULL STD { int linux_get_robust_list(l_int pid, struct linux_robust_list_head *head, \
l_size_t *len); }
312 AUE_NULL STD { int linux_get_robust_list(l_int pid, \
struct linux_robust_list_head **head, l_size_t *len); }
313 AUE_NULL STD { int linux_splice(void); }
314 AUE_NULL STD { int linux_sync_file_range(void); }
315 AUE_NULL STD { int linux_tee(void); }
+2 -2
View File
@@ -139,8 +139,8 @@ EENTRY_NP(fueword32)
mov r0, #0x00000000
str r0, [r2, #PCB_ONFAULT]
RET
EEND(fuword32)
END(fuword)
EEND(fueword32)
END(fueword)
/*
* fusword(caddr_t uaddr);
+2
View File
@@ -8,6 +8,8 @@ NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH}
BINDIR?= /boot
INSTALLFLAGS= -b
WARNS?= 1
CWARNFLAGS.gcc+= -Wno-int-to-pointer-cast
# Address at which ubldr will be loaded.
# This varies for different boards and SOCs.
UBLDR_LOADADDR?= 0x1000000
+4 -1
View File
@@ -56,7 +56,10 @@ typedef int (bootblk_cmd_t)(int argc, char *argv[]);
extern char *command_errmsg;
extern char command_errbuf[]; /* XXX blah, length */
#define CMD_OK 0
#define CMD_ERROR 1
#define CMD_WARN 1
#define CMD_ERROR 2
#define CMD_CRIT 3
#define CMD_FATAL 4
/* interp.c */
void interact(const char *rc);
+11 -1
View File
@@ -138,13 +138,23 @@ bf_command(FICL_VM *vm)
} else {
result=BF_PARSE;
}
switch (result) {
case CMD_CRIT:
printf("%s\n", command_errmsg);
break;
case CMD_FATAL:
panic("%s\n", command_errmsg);
}
free(line);
/*
* If there was error during nested ficlExec(), we may no longer have
* valid environment to return. Throw all exceptions from here.
*/
if (result != 0)
if (result != CMD_OK)
vmThrow(vm, result);
/* This is going to be thrown!!! */
stackPushINT(vm->pStack,result);
}
+21 -8
View File
@@ -112,7 +112,7 @@ command_load(int argc, char *argv[])
typestr = NULL;
if (argc == 1) {
command_errmsg = "no filename specified";
return(CMD_ERROR);
return (CMD_CRIT);
}
while ((ch = getopt(argc, argv, "kt:")) != -1) {
switch(ch) {
@@ -138,33 +138,46 @@ command_load(int argc, char *argv[])
if (dofile) {
if ((argc != 2) || (typestr == NULL) || (*typestr == 0)) {
command_errmsg = "invalid load type";
return(CMD_ERROR);
return (CMD_CRIT);
}
fp = file_findfile(argv[1], typestr);
if (fp) {
sprintf(command_errbuf, "warning: file '%s' already loaded", argv[1]);
return (CMD_ERROR);
return (CMD_WARN);
}
return (file_loadraw(argv[1], typestr, 1) ? CMD_OK : CMD_ERROR);
if (file_loadraw(argv[1], typestr, 1) != NULL)
return (CMD_OK);
/* Failing to load mfs_root is never going to end well! */
if (strcmp("mfs_root", typestr) == 0)
return (CMD_FATAL);
return (CMD_ERROR);
}
/*
* Do we have explicit KLD load ?
*/
if (dokld || file_havepath(argv[1])) {
error = mod_loadkld(argv[1], argc - 2, argv + 2);
if (error == EEXIST)
if (error == EEXIST) {
sprintf(command_errbuf, "warning: KLD '%s' already loaded", argv[1]);
return (error == 0 ? CMD_OK : CMD_ERROR);
return (CMD_WARN);
}
return (error == 0 ? CMD_OK : CMD_CRIT);
}
/*
* Looks like a request for a module.
*/
error = mod_load(argv[1], NULL, argc - 2, argv + 2);
if (error == EEXIST)
if (error == EEXIST) {
sprintf(command_errbuf, "warning: module '%s' already loaded", argv[1]);
return (error == 0 ? CMD_OK : CMD_ERROR);
return (CMD_WARN);
}
return (error == 0 ? CMD_OK : CMD_CRIT);
}
COMMAND_SET(load_geli, "load_geli", "load a geli key", command_load_geli);
+2
View File
@@ -7,6 +7,8 @@
LIB= efi_fdt
INTERNALLIB=
WARNS?= 6
CWARNFLAGS.gcc+= -Wno-strict-prototypes
CWARNFLAGS.gcc+= -Wno-redundant-decls
SRCS= efi_fdt.c
+1
View File
@@ -3,6 +3,7 @@
LIB= efi
INTERNALLIB=
WARNS?= 2
CWARNFLAGS.gcc+= -Wno-attributes
SRCS= delay.c efi_console.c efinet.c efipart.c errno.c handles.c \
libefi.c time.c
+1 -1
View File
@@ -1131,7 +1131,7 @@ linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args
return (EFAULT);
}
error = copyout(head, args->head, sizeof(struct linux_robust_list_head));
error = copyout(&head, args->head, sizeof(head));
if (error) {
LIN_SDT_PROBE1(futex, linux_get_robust_list, copyout_error,
error);
+3 -1
View File
@@ -1304,9 +1304,11 @@ linux_setgroups(struct thread *td, struct linux_setgroups_args *args)
if (error)
goto out;
newcred = crget();
crextend(newcred, ngrp + 1);
p = td->td_proc;
PROC_LOCK(p);
oldcred = crcopysafe(p, newcred);
oldcred = p->p_ucred;
crcopy(newcred, oldcred);
/*
* cr_groups[0] holds egid. Setting the whole set from
+2
View File
@@ -273,6 +273,7 @@ dev/hyperv/vmbus/hv_channel.c optional hyperv
dev/hyperv/vmbus/hv_channel_mgmt.c optional hyperv
dev/hyperv/vmbus/hv_connection.c optional hyperv
dev/hyperv/vmbus/hv_hv.c optional hyperv
dev/hyperv/vmbus/hv_et.c optional hyperv
dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv
dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c optional hyperv
dev/nfe/if_nfe.c optional nfe pci
@@ -316,6 +317,7 @@ dev/sfxge/common/efx_ev.c optional sfxge pci
dev/sfxge/common/efx_filter.c optional sfxge pci
dev/sfxge/common/efx_hash.c optional sfxge pci
dev/sfxge/common/efx_intr.c optional sfxge pci
dev/sfxge/common/efx_lic.c optional sfxge pci
dev/sfxge/common/efx_mac.c optional sfxge pci
dev/sfxge/common/efx_mcdi.c optional sfxge pci
dev/sfxge/common/efx_mon.c optional sfxge pci
+1
View File
@@ -247,6 +247,7 @@ dev/hyperv/vmbus/hv_channel.c optional hyperv
dev/hyperv/vmbus/hv_channel_mgmt.c optional hyperv
dev/hyperv/vmbus/hv_connection.c optional hyperv
dev/hyperv/vmbus/hv_hv.c optional hyperv
dev/hyperv/vmbus/hv_et.c optional hyperv
dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv
dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c optional hyperv
dev/ichwd/ichwd.c optional ichwd
+10 -10
View File
@@ -663,7 +663,7 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane,
plane->dev = dev;
plane->funcs = funcs;
plane->format_types = malloc(sizeof(uint32_t) * format_count,
DRM_MEM_KMS, M_NOWAIT);
DRM_MEM_KMS, M_WAITOK);
if (!plane->format_types) {
DRM_DEBUG_KMS("out of memory when allocating plane\n");
drm_mode_object_put(dev, &plane->base);
@@ -1010,7 +1010,7 @@ int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *group)
total_objects += dev->mode_config.num_encoder;
group->id_list = malloc(total_objects * sizeof(uint32_t),
DRM_MEM_KMS, M_NOWAIT | M_ZERO);
DRM_MEM_KMS, M_WAITOK | M_ZERO);
if (!group->id_list)
return -ENOMEM;
@@ -1998,7 +1998,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
connector_set = malloc(crtc_req->count_connectors *
sizeof(struct drm_connector *),
DRM_MEM_KMS, M_NOWAIT);
DRM_MEM_KMS, M_WAITOK);
if (!connector_set) {
ret = -ENOMEM;
goto out;
@@ -2523,7 +2523,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
goto out_err1;
}
clips = malloc(num_clips * sizeof(*clips), DRM_MEM_KMS,
M_NOWAIT | M_ZERO);
M_WAITOK | M_ZERO);
if (!clips) {
ret = -ENOMEM;
goto out_err1;
@@ -2774,13 +2774,13 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
int ret;
property = malloc(sizeof(struct drm_property), DRM_MEM_KMS,
M_NOWAIT | M_ZERO);
M_WAITOK | M_ZERO);
if (!property)
return NULL;
if (num_values) {
property->values = malloc(sizeof(uint64_t)*num_values, DRM_MEM_KMS,
M_NOWAIT | M_ZERO);
M_WAITOK | M_ZERO);
if (!property->values)
goto fail;
}
@@ -2908,7 +2908,7 @@ int drm_property_add_enum(struct drm_property *property, int index,
}
prop_enum = malloc(sizeof(struct drm_property_enum), DRM_MEM_KMS,
M_NOWAIT | M_ZERO);
M_WAITOK | M_ZERO);
if (!prop_enum)
return -ENOMEM;
@@ -3104,7 +3104,7 @@ static struct drm_property_blob *drm_property_create_blob(struct drm_device *dev
return NULL;
blob = malloc(sizeof(struct drm_property_blob)+length, DRM_MEM_KMS,
M_NOWAIT | M_ZERO);
M_WAITOK | M_ZERO);
if (!blob)
return NULL;
@@ -3434,7 +3434,7 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
crtc->gamma_size = gamma_size;
crtc->gamma_store = malloc(gamma_size * sizeof(uint16_t) * 3,
DRM_MEM_KMS, M_NOWAIT | M_ZERO);
DRM_MEM_KMS, M_WAITOK | M_ZERO);
if (!crtc->gamma_store) {
crtc->gamma_size = 0;
return -ENOMEM;
@@ -3632,7 +3632,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
file_priv->event_space -= sizeof e->event;
mtx_unlock(&dev->event_lock);
e = malloc(sizeof *e, DRM_MEM_KMS, M_NOWAIT | M_ZERO);
e = malloc(sizeof *e, DRM_MEM_KMS, M_WAITOK | M_ZERO);
if (e == NULL) {
mtx_lock(&dev->event_lock);
file_priv->event_space += sizeof e->event;
+1 -1
View File
@@ -225,7 +225,7 @@ int drm_pci_set_unique(struct drm_device *dev,
master->unique_len = u->unique_len;
master->unique_size = u->unique_len + 1;
master->unique = malloc(master->unique_size, DRM_MEM_DRIVER, M_NOWAIT);
master->unique = malloc(master->unique_size, DRM_MEM_DRIVER, M_WAITOK);
if (!master->unique) {
ret = -ENOMEM;
goto err;
+11 -6
View File
@@ -156,7 +156,7 @@ i915_gem_wait_for_error(struct drm_device *dev)
int ret;
if (!atomic_load_acq_int(&dev_priv->mm.wedged))
return (0);
return 0;
mtx_lock(&dev_priv->error_completion_lock);
while (dev_priv->error_completion == 0) {
@@ -166,7 +166,7 @@ i915_gem_wait_for_error(struct drm_device *dev)
ret = -ERESTARTSYS;
if (ret != 0) {
mtx_unlock(&dev_priv->error_completion_lock);
return (ret);
return ret;
}
}
mtx_unlock(&dev_priv->error_completion_lock);
@@ -1861,26 +1861,30 @@ i915_gem_object_put_pages_range(struct drm_i915_gem_object *obj,
static void
i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj)
{
vm_page_t page;
int page_count, i;
int page_count = obj->base.size / PAGE_SIZE;
int i;
KASSERT(obj->madv != I915_MADV_PURGED_INTERNAL, ("Purged object"));
if (obj->tiling_mode != I915_TILING_NONE)
i915_gem_object_save_bit_17_swizzle(obj);
if (obj->madv == I915_MADV_DONTNEED)
obj->dirty = 0;
page_count = obj->base.size / PAGE_SIZE;
VM_OBJECT_WLOCK(obj->base.vm_obj);
#if GEM_PARANOID_CHECK_GTT
i915_gem_assert_pages_not_mapped(obj->base.dev, obj->pages, page_count);
#endif
for (i = 0; i < page_count; i++) {
page = obj->pages[i];
vm_page_t page = obj->pages[i];
if (obj->dirty)
vm_page_dirty(page);
if (obj->madv == I915_MADV_WILLNEED)
vm_page_reference(page);
vm_page_lock(page);
vm_page_unwire(obj->pages[i], PQ_ACTIVE);
vm_page_unlock(page);
@@ -1888,6 +1892,7 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj)
}
VM_OBJECT_WUNLOCK(obj->base.vm_obj);
obj->dirty = 0;
free(obj->pages, DRM_I915_GEM);
obj->pages = NULL;
}
+4 -4
View File
@@ -411,8 +411,8 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
reloc->offset += obj->gtt_offset;
reloc_page = pmap_mapdev_attr(dev->agp->base + (reloc->offset &
~PAGE_MASK), PAGE_SIZE, PAT_WRITE_COMBINING);
reloc_entry = (uint32_t *)(reloc_page + (reloc->offset &
PAGE_MASK));
reloc_entry = (uint32_t *)
(reloc_page + (reloc->offset & PAGE_MASK));
*(volatile uint32_t *)reloc_entry = reloc->delta;
pmap_unmapdev((vm_offset_t)reloc_page, PAGE_SIZE);
}
@@ -502,7 +502,7 @@ i915_gem_execbuffer_relocate(struct drm_device *dev,
struct list_head *objects)
{
struct drm_i915_gem_object *obj;
int ret, pflags;
int ret = 0, pflags;
/* Try to move as many of the relocation targets off the active list
* to avoid unnecessary fallbacks to the slow path, as we cannot wait
@@ -510,7 +510,6 @@ i915_gem_execbuffer_relocate(struct drm_device *dev,
*/
i915_gem_retire_requests(dev);
ret = 0;
/* This is the fast path and we cannot handle a pagefault whilst
* holding the device lock lest the user pass in the relocations
* contained within a mmaped bo. For in such a case we, the page
@@ -952,6 +951,7 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, int count,
*map = malloc(count * sizeof(*ma), DRM_I915_GEM, M_WAITOK | M_ZERO);
*maplen = malloc(count * sizeof(*maplen), DRM_I915_GEM, M_WAITOK |
M_ZERO);
for (i = 0; i < count; i++) {
/* First check for malicious input causing overflow */
if (exec[i].relocation_count >
+19 -17
View File
@@ -107,21 +107,22 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
I915_PPGTT_PT_ENTRIES);
ppgtt->pd_offset = (first_pd_entry_in_global_pt) * sizeof(uint32_t);
dev_priv->mm.aliasing_ppgtt = ppgtt;
return (0);
return 0;
}
static void
i915_ppgtt_insert_pages(struct i915_hw_ppgtt *ppgtt, unsigned first_entry,
unsigned num_entries, vm_page_t *pages, uint32_t pte_flags)
static void i915_ppgtt_insert_pages(struct i915_hw_ppgtt *ppgtt,
unsigned first_entry,
unsigned num_entries,
vm_page_t *pages,
uint32_t pte_flags)
{
uint32_t *pt_vaddr, pte;
struct sf_buf *sf;
unsigned act_pd, first_pte;
unsigned last_pte, i;
unsigned act_pd = first_entry / I915_PPGTT_PT_ENTRIES;
unsigned first_pte = first_entry % I915_PPGTT_PT_ENTRIES;
unsigned j, last_pte;
vm_paddr_t page_addr;
act_pd = first_entry / I915_PPGTT_PT_ENTRIES;
first_pte = first_entry % I915_PPGTT_PT_ENTRIES;
struct sf_buf *sf;
while (num_entries) {
last_pte = first_pte + num_entries;
@@ -132,10 +133,10 @@ i915_ppgtt_insert_pages(struct i915_hw_ppgtt *ppgtt, unsigned first_entry,
sf = sf_buf_alloc(ppgtt->pt_pages[act_pd], SFB_CPUPRIVATE);
pt_vaddr = (uint32_t *)(uintptr_t)sf_buf_kva(sf);
for (i = first_pte; i < last_pte; i++) {
for (j = first_pte; j < last_pte; j++) {
page_addr = VM_PAGE_TO_PHYS(*pages);
pte = GEN6_PTE_ADDR_ENCODE(page_addr);
pt_vaddr[i] = pte | pte_flags;
pt_vaddr[j] = pte | pte_flags;
pages++;
}
@@ -194,18 +195,21 @@ void i915_gem_init_ppgtt(struct drm_device *dev)
struct intel_ring_buffer *ring;
struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
u_int first_pd_entry_in_global_pt;
vm_paddr_t pt_addr;
uint32_t pd_entry;
int i;
if (!dev_priv->mm.aliasing_ppgtt)
return;
first_pd_entry_in_global_pt = 512 * 1024 - I915_PPGTT_PD_ENTRIES;
for (i = 0; i < ppgtt->num_pd_entries; i++) {
vm_paddr_t pt_addr;
pt_addr = VM_PAGE_TO_PHYS(ppgtt->pt_pages[i]);
pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr);
pd_entry |= GEN6_PDE_VALID;
intel_gtt_write(first_pd_entry_in_global_pt + i, pd_entry);
}
intel_gtt_read_pte(first_pd_entry_in_global_pt);
@@ -336,8 +340,7 @@ int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj)
return 0;
}
void
i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj,
void i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj,
enum i915_cache_level cache_level)
{
struct drm_device *dev;
@@ -379,11 +382,10 @@ int i915_gem_init_global_gtt(struct drm_device *dev,
unsigned long mappable_end,
unsigned long end)
{
drm_i915_private_t *dev_priv;
drm_i915_private_t *dev_priv = dev->dev_private;
unsigned long mappable;
int error;
dev_priv = dev->dev_private;
mappable = min(end, mappable_end) - start;
/* Substract the guard page ... */
+3 -3
View File
@@ -453,15 +453,15 @@ i915_gem_get_tiling(struct drm_device *dev, void *data,
* by the GPU.
*/
static void
i915_gem_swizzle_page(vm_page_t m)
i915_gem_swizzle_page(vm_page_t page)
{
char temp[64];
char *vaddr;
struct sf_buf *sf;
char *vaddr;
int i;
/* XXXKIB sleep */
sf = sf_buf_alloc(m, SFB_DEFAULT);
sf = sf_buf_alloc(page, SFB_DEFAULT);
vaddr = (char *)sf_buf_kva(sf);
for (i = 0; i < PAGE_SIZE; i += 128) {
+23 -16
View File
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include <dev/drm2/i915/i915_drm.h>
#include <dev/drm2/i915/i915_drv.h>
#include <dev/drm2/i915/intel_drv.h>
#include <sys/sched.h>
#include <sys/sf_buf.h>
#include <sys/sleepqueue.h>
@@ -770,42 +771,47 @@ i915_error_object_create(struct drm_i915_private *dev_priv,
struct drm_i915_gem_object *src)
{
struct drm_i915_error_object *dst;
struct sf_buf *sf;
void *d, *s;
int page, page_count;
int i, count;
u32 reloc_offset;
if (src == NULL || src->pages == NULL)
return NULL;
page_count = src->base.size / PAGE_SIZE;
count = src->base.size / PAGE_SIZE;
dst = malloc(sizeof(*dst) + page_count * sizeof(u32 *), DRM_I915_GEM,
M_NOWAIT);
dst = malloc(sizeof(*dst) + count * sizeof(u32 *), DRM_I915_GEM, M_NOWAIT);
if (dst == NULL)
return (NULL);
return NULL;
reloc_offset = src->gtt_offset;
for (page = 0; page < page_count; page++) {
for (i = 0; i < count; i++) {
void *d;
d = malloc(PAGE_SIZE, DRM_I915_GEM, M_NOWAIT);
if (d == NULL)
goto unwind;
if (reloc_offset < dev_priv->mm.gtt_mappable_end &&
src->has_global_gtt_mapping) {
void *s;
/* Simply ignore tiling or any overlapping fence.
* It's part of the error state, and this hopefully
* captures what the GPU read.
*/
s = pmap_mapdev_attr(src->base.dev->agp->base +
reloc_offset, PAGE_SIZE, PAT_WRITE_COMBINING);
reloc_offset,
PAGE_SIZE, PAT_WRITE_COMBINING);
memcpy(d, s, PAGE_SIZE);
pmap_unmapdev((vm_offset_t)s, PAGE_SIZE);
} else {
drm_clflush_pages(&src->pages[page], 1);
struct sf_buf *sf;
void *s;
drm_clflush_pages(&src->pages[i], 1);
sched_pin();
sf = sf_buf_alloc(src->pages[page], SFB_CPUPRIVATE |
sf = sf_buf_alloc(src->pages[i], SFB_CPUPRIVATE |
SFB_NOWAIT);
if (sf != NULL) {
s = (void *)(uintptr_t)sf_buf_kva(sf);
@@ -817,21 +823,21 @@ i915_error_object_create(struct drm_i915_private *dev_priv,
}
sched_unpin();
drm_clflush_pages(&src->pages[page], 1);
drm_clflush_pages(&src->pages[i], 1);
}
dst->pages[page] = d;
dst->pages[i] = d;
reloc_offset += PAGE_SIZE;
}
dst->page_count = page_count;
dst->page_count = count;
dst->gtt_offset = src->gtt_offset;
return dst;
unwind:
while (page--)
free(dst->pages[page], DRM_I915_GEM);
while (i--)
free(dst->pages[i], DRM_I915_GEM);
free(dst, DRM_I915_GEM);
return NULL;
}
@@ -2571,6 +2577,7 @@ void intel_irq_init(struct drm_device *dev)
dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
dev->driver->get_vblank_counter = gm45_get_vblank_counter;
}
if (drm_core_check_feature(dev, DRIVER_MODESET))
dev->driver->get_vblank_timestamp = i915_get_vblank_timestamp;
else
+1 -2
View File
@@ -598,8 +598,7 @@ void intel_crt_init(struct drm_device *dev)
crt = malloc(sizeof(struct intel_crt), DRM_MEM_KMS, M_WAITOK | M_ZERO);
intel_connector = malloc(sizeof(struct intel_connector), DRM_MEM_KMS,
M_WAITOK | M_ZERO);
intel_connector = malloc(sizeof(struct intel_connector), DRM_MEM_KMS, M_WAITOK | M_ZERO);
connector = &intel_connector->base;
drm_connector_init(dev, &intel_connector->base,
+7 -4
View File
@@ -1382,9 +1382,8 @@ intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value)
static u32
intel_sbi_read(struct drm_i915_private *dev_priv, u16 reg)
{
u32 value;
u32 value = 0;
value = 0;
mtx_lock(&dev_priv->dpio_lock);
if (wait_for((I915_READ(SBI_CTL_STAT) & SBI_READY) == 0, 100)) {
DRM_ERROR("timeout waiting for SBI to become ready\n");
@@ -1517,7 +1516,8 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv,
KASSERT(dev_priv->info->gen >= 5, ("Wrong device gen"));
/* Make sure PCH DPLL is enabled */
assert_pch_pll_enabled(dev_priv, to_intel_crtc(crtc));
assert_pch_pll_enabled(dev_priv,
to_intel_crtc(crtc));
/* FDI must be feeding us bits for PCH ports */
assert_fdi_tx_enabled(dev_priv, pipe);
@@ -1527,9 +1527,11 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv,
DRM_ERROR("Attempting to enable transcoder on Haswell with pipe > 0\n");
return;
}
reg = TRANSCONF(pipe);
val = I915_READ(reg);
pipeconf_val = I915_READ(PIPECONF(pipe));
if (HAS_PCH_IBX(dev_priv->dev)) {
/*
* make the BPC in transcoder be consistent with
@@ -1886,6 +1888,7 @@ static int i9xx_update_plane(struct drm_crtc *crtc, struct drm_framebuffer *fb,
DRM_ERROR("Unknown color depth %d\n", fb->bits_per_pixel);
return -EINVAL;
}
if (INTEL_INFO(dev)->gen >= 4) {
if (obj->tiling_mode != I915_TILING_NONE)
dspcntr |= DISPPLANE_TILED;
@@ -7132,7 +7135,7 @@ int intel_modeset_vga_set_state(struct drm_device *dev, bool state)
else
gmch_ctrl |= INTEL_GMCH_VGA_DISABLE;
pci_write_config(bridge_dev, INTEL_GMCH_CTRL, gmch_ctrl, 2);
return (0);
return 0;
}
struct intel_display_error_state {
+5 -8
View File
@@ -1138,8 +1138,7 @@ int intel_overlay_put_image(struct drm_device *dev, void *data,
return ret;
}
params = malloc(sizeof(struct put_image_params), DRM_I915_GEM,
M_WAITOK | M_ZERO);
params = malloc(sizeof(struct put_image_params), DRM_I915_GEM, M_WAITOK | M_ZERO);
drmmode_obj = drm_mode_object_find(dev, put_image_rec->crtc_id,
DRM_MODE_OBJECT_CRTC);
@@ -1403,8 +1402,7 @@ void intel_setup_overlay(struct drm_device *dev)
if (!HAS_OVERLAY(dev))
return;
overlay = malloc(sizeof(struct intel_overlay), DRM_I915_GEM,
M_WAITOK | M_ZERO);
overlay = malloc(sizeof(struct intel_overlay), DRM_I915_GEM, M_WAITOK | M_ZERO);
DRM_LOCK(dev);
if (dev_priv->overlay != NULL)
goto out_free;
@@ -1523,16 +1521,15 @@ intel_overlay_capture_error_state(struct drm_device *dev)
memcpy(&error->regs, regs, sizeof(struct overlay_registers));
intel_overlay_unmap_regs(overlay, regs);
return (error);
return error;
err:
free(error, DRM_I915_GEM);
return (NULL);
return NULL;
}
void
intel_overlay_print_error_state(struct sbuf *m,
struct intel_overlay_error_state *error)
intel_overlay_print_error_state(struct sbuf *m, struct intel_overlay_error_state *error)
{
sbuf_printf(m, "Overlay, status: 0x%08x, interrupt: 0x%08x\n",
error->dovsta, error->isr);
+8 -11
View File
@@ -2035,9 +2035,9 @@ em_xmit(struct tx_ring *txr, struct mbuf **m_headp)
if (error == EFBIG && remap) {
struct mbuf *m;
m = m_defrag(*m_headp, M_NOWAIT);
m = m_collapse(*m_headp, M_NOWAIT, EM_MAX_SCATTER);
if (m == NULL) {
adapter->mbuf_alloc_failed++;
adapter->mbuf_defrag_failed++;
m_freem(*m_headp);
*m_headp = NULL;
return (ENOBUFS);
@@ -5493,18 +5493,15 @@ em_add_hw_stats(struct adapter *adapter)
char namebuf[QUEUE_NAME_LEN];
/* Driver Statistics */
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq",
CTLFLAG_RD, &adapter->link_irq,
"Link MSIX IRQ Handled");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_alloc_fail",
CTLFLAG_RD, &adapter->mbuf_alloc_failed,
"Std mbuf failed");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "cluster_alloc_fail",
CTLFLAG_RD, &adapter->mbuf_cluster_failed,
"Std mbuf cluster failed");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped",
CTLFLAG_RD, &adapter->dropped_pkts,
"Driver dropped packets");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq",
CTLFLAG_RD, &adapter->link_irq,
"Link MSIX IRQ Handled");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_defrag_fail",
CTLFLAG_RD, &adapter->mbuf_defrag_failed,
"Defragmenting mbuf chain failed");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_dma_fail",
CTLFLAG_RD, &adapter->no_tx_dma_setup,
"Driver tx dma failure in xmit");
+3 -4
View File
@@ -473,13 +473,12 @@ struct adapter {
/* Misc stats maintained by the driver */
unsigned long dropped_pkts;
unsigned long mbuf_alloc_failed;
unsigned long mbuf_cluster_failed;
unsigned long no_tx_map_avail;
unsigned long link_irq;
unsigned long mbuf_defrag_failed;
unsigned long no_tx_dma_setup;
unsigned long no_tx_map_avail;
unsigned long rx_overruns;
unsigned long watchdog_events;
unsigned long link_irq;
struct e1000_hw_stats stats;
};
+8 -4
View File
@@ -1835,7 +1835,8 @@ igb_xmit(struct tx_ring *txr, struct mbuf **m_headp)
/* Try it again? - one try */
if (remap == TRUE) {
remap = FALSE;
m = m_defrag(*m_headp, M_NOWAIT);
m = m_collapse(*m_headp, M_NOWAIT,
IGB_MAX_SCATTER);
if (m == NULL) {
adapter->mbuf_defrag_failed++;
m_freem(*m_headp);
@@ -5826,12 +5827,15 @@ igb_add_hw_stats(struct adapter *adapter)
char namebuf[QUEUE_NAME_LEN];
/* Driver Statistics */
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq",
CTLFLAG_RD, &adapter->link_irq,
"Link MSIX IRQ Handled");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped",
CTLFLAG_RD, &adapter->dropped_pkts,
"Driver dropped packets");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq",
CTLFLAG_RD, &adapter->link_irq,
"Link MSIX IRQ Handled");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_defrag_fail",
CTLFLAG_RD, &adapter->mbuf_defrag_failed,
"Defragmenting mbuf chain failed");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_dma_fail",
CTLFLAG_RD, &adapter->no_tx_dma_setup,
"Driver tx dma failure in xmit");
+9 -10
View File
@@ -512,20 +512,19 @@ struct adapter {
u8 *mta;
/* Misc stats maintained by the driver */
unsigned long dropped_pkts;
unsigned long mbuf_defrag_failed;
unsigned long mbuf_header_failed;
unsigned long mbuf_packet_failed;
unsigned long no_tx_dma_setup;
unsigned long watchdog_events;
unsigned long link_irq;
unsigned long rx_overruns;
unsigned long device_control;
unsigned long rx_control;
unsigned long int_mask;
unsigned long dropped_pkts;
unsigned long eint_mask;
unsigned long int_mask;
unsigned long link_irq;
unsigned long mbuf_defrag_failed;
unsigned long no_tx_dma_setup;
unsigned long packet_buf_alloc_rx;
unsigned long packet_buf_alloc_tx;
unsigned long rx_control;
unsigned long rx_overruns;
unsigned long watchdog_events;
/* Used in pf and vf */
void *stats;
+5 -5
View File
@@ -1675,9 +1675,9 @@ lem_xmit(struct adapter *adapter, struct mbuf **m_headp)
if (error == EFBIG) {
struct mbuf *m;
m = m_defrag(*m_headp, M_NOWAIT);
m = m_collapse(*m_headp, M_NOWAIT, EM_MAX_SCATTER);
if (m == NULL) {
adapter->mbuf_alloc_failed++;
adapter->mbuf_defrag_failed++;
m_freem(*m_headp);
*m_headp = NULL;
return (ENOBUFS);
@@ -4526,12 +4526,12 @@ lem_add_hw_stats(struct adapter *adapter)
struct sysctl_oid_list *stat_list;
/* Driver Statistics */
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_alloc_fail",
CTLFLAG_RD, &adapter->mbuf_alloc_failed,
"Std mbuf failed");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "cluster_alloc_fail",
CTLFLAG_RD, &adapter->mbuf_cluster_failed,
"Std mbuf cluster failed");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_defrag_fail",
CTLFLAG_RD, &adapter->mbuf_defrag_failed,
"Defragmenting mbuf chain failed");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped",
CTLFLAG_RD, &adapter->dropped_pkts,
"Driver dropped packets");
+4 -4
View File
@@ -417,17 +417,17 @@ struct adapter {
/* Misc stats maintained by the driver */
unsigned long dropped_pkts;
unsigned long mbuf_alloc_failed;
unsigned long link_irq;
unsigned long mbuf_cluster_failed;
unsigned long mbuf_defrag_failed;
unsigned long no_tx_desc_avail1;
unsigned long no_tx_desc_avail2;
unsigned long no_tx_map_avail;
unsigned long no_tx_dma_setup;
unsigned long no_tx_map_avail;
unsigned long watchdog_events;
unsigned long rx_overruns;
unsigned long rx_irq;
unsigned long rx_overruns;
unsigned long tx_irq;
unsigned long link_irq;
/* 82547 workaround */
uint32_t tx_fifo_size;
+1 -1
View File
@@ -184,7 +184,7 @@ gpiobus_init_softc(device_t dev)
if (GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins) != 0)
return (ENXIO);
KASSERT(sc->sc_npins != 0, ("GPIO device with no pins"));
KASSERT(sc->sc_npins >= 0, ("GPIO device with no pins"));
/* Pins = GPIO_PIN_MAX() + 1 */
sc->sc_npins++;
-5
View File
@@ -335,11 +335,6 @@ typedef enum {
HV_CHANNEL_MESSAGE_INITIATED_CONTACT = 14,
HV_CHANNEL_MESSAGE_VERSION_RESPONSE = 15,
HV_CHANNEL_MESSAGE_UNLOAD = 16,
#ifdef HV_VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
HV_CHANNEL_MESSAGE_VIEW_RANGE_ADD = 17,
HV_CHANNEL_MESSAGE_VIEW_RANGE_REMOVE = 18,
#endif
HV_CHANNEL_MESSAGE_COUNT
} hv_vmbus_channel_msg_type;
+6 -3
View File
@@ -642,6 +642,12 @@ hv_nv_connect_to_vsp(struct hv_device *device)
/* sema_wait(&NetVscChannel->channel_init_sema); */
/* Post the big receive buffer to NetVSP */
if (net_dev->nvsp_version <= NVSP_PROTOCOL_VERSION_2)
net_dev->rx_buf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY;
else
net_dev->rx_buf_size = NETVSC_RECEIVE_BUFFER_SIZE;
net_dev->send_buf_size = NETVSC_SEND_BUFFER_SIZE;
ret = hv_nv_init_rx_buffer_with_net_vsp(device);
if (ret == 0)
ret = hv_nv_init_send_buffer_with_net_vsp(device);
@@ -676,9 +682,6 @@ hv_nv_on_device_add(struct hv_device *device, void *additional_info)
goto cleanup;
/* Initialize the NetVSC channel extension */
net_dev->rx_buf_size = NETVSC_RECEIVE_BUFFER_SIZE;
net_dev->send_buf_size = NETVSC_SEND_BUFFER_SIZE;
sema_init(&net_dev->channel_init_sema, 0, "netdev_sema");
+1 -1
View File
@@ -857,7 +857,7 @@ typedef struct nvsp_msg_ {
#define NETVSC_SEND_BUFFER_SIZE (1024*1024*15) /* 15M */
#define NETVSC_SEND_BUFFER_ID 0xface
#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024*1024*15) /* 15MB */
#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */
#define NETVSC_RECEIVE_BUFFER_ID 0xcafe
@@ -391,12 +391,14 @@ netvsc_attach(device_t dev)
sc->hn_carrier = 1;
}
#if defined(INET) || defined(INET6)
tcp_lro_init(&sc->hn_lro);
/* Driver private LRO settings */
sc->hn_lro.ifp = ifp;
#ifdef HN_LRO_HIWAT
sc->hn_lro.lro_hiwat = sc->hn_lro_hiwat;
#endif
#endif /* INET || INET6 */
ether_ifattach(ifp, device_info.mac_addr);
@@ -475,7 +477,9 @@ netvsc_detach(device_t dev)
hv_rf_on_device_remove(hv_device, HV_RF_NV_DESTROY_CHANNEL);
ifmedia_removeall(&sc->hn_media);
#if defined(INET) || defined(INET6)
tcp_lro_free(&sc->hn_lro);
#endif
return (0);
}
@@ -1083,6 +1087,7 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet,
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
if ((ifp->if_capenable & IFCAP_LRO) && do_lro) {
#if defined(INET) || defined(INET6)
struct lro_ctrl *lro = &sc->hn_lro;
if (lro->lro_cnt) {
@@ -1092,6 +1097,7 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet,
return 0;
}
}
#endif
}
/* We're not holding the lock here, so don't release it */
@@ -1103,6 +1109,7 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet,
void
netvsc_recv_rollup(struct hv_device *device_ctx)
{
#if defined(INET) || defined(INET6)
hn_softc_t *sc = device_get_softc(device_ctx->device);
struct lro_ctrl *lro = &sc->hn_lro;
struct lro_entry *queued;
@@ -1111,6 +1118,7 @@ netvsc_recv_rollup(struct hv_device *device_ctx)
SLIST_REMOVE_HEAD(&lro->lro_active, next);
tcp_lro_flush(lro, queued);
}
#endif
}
/*
+1 -18
View File
@@ -251,7 +251,7 @@ hv_vmbus_connect(void) {
hv_vmbus_protocal_version = version;
if (bootverbose)
printf("VMBUS: Portocal Version: %d.%d\n",
printf("VMBUS: Protocol Version: %d.%d\n",
version >> 16, version & 0xFFFF);
sema_destroy(&msg_info->wait_sema);
@@ -423,12 +423,6 @@ VmbusProcessChannelEvent(uint32_t relid)
// mtx_unlock(&channel->inbound_lock);
}
#ifdef HV_DEBUG_INTR
extern uint32_t hv_intr_count;
extern uint32_t hv_vmbus_swintr_event_cpu[MAXCPU];
extern uint32_t hv_vmbus_intr_cpu[MAXCPU];
#endif
/**
* Handler for events
*/
@@ -449,17 +443,6 @@ hv_vmbus_on_events(void *arg)
KASSERT(cpu <= mp_maxid, ("VMBUS: hv_vmbus_on_events: "
"cpu out of range!"));
#ifdef HV_DEBUG_INTR
int i;
hv_vmbus_swintr_event_cpu[cpu]++;
if (hv_intr_count % 10000 == 0) {
printf("VMBUS: Total interrupt %d\n", hv_intr_count);
for (i = 0; i < mp_ncpus; i++)
printf("VMBUS: hw cpu[%d]: %d, event sw intr cpu[%d]: %d\n",
i, hv_vmbus_intr_cpu[i], i, hv_vmbus_swintr_event_cpu[i]);
}
#endif
if ((hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008) ||
(hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7)) {
maxdword = HV_MAX_NUM_CHANNELS_SUPPORTED >> 5;
+131
View File
@@ -0,0 +1,131 @@
/*-
* Copyright (c) 2015 Microsoft Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/smp.h>
#include <sys/time.h>
#include <sys/timeet.h>
#include "hv_vmbus_priv.h"
#define HV_TIMER_FREQUENCY (10 * 1000 * 1000LL) /* 100ns period */
#define HV_MAX_DELTA_TICKS 0xffffffffLL
#define HV_MIN_DELTA_TICKS 1LL
static struct eventtimer et;
static uint64_t periodticks[MAXCPU];
static inline uint64_t
sbintime2tick(sbintime_t time)
{
struct timespec val;
val = sbttots(time);
return val.tv_sec * HV_TIMER_FREQUENCY + val.tv_nsec / 100;
}
static int
hv_et_start(struct eventtimer *et, sbintime_t firsttime, sbintime_t periodtime)
{
union hv_timer_config timer_cfg;
uint64_t current;
timer_cfg.as_uint64 = 0;
timer_cfg.auto_enable = 1;
timer_cfg.sintx = HV_VMBUS_MESSAGE_SINT;
periodticks[curcpu] = sbintime2tick(periodtime);
if (firsttime == 0)
firsttime = periodtime;
current = rdmsr(HV_X64_MSR_TIME_REF_COUNT);
current += sbintime2tick(firsttime);
wrmsr(HV_X64_MSR_STIMER0_CONFIG, timer_cfg.as_uint64);
wrmsr(HV_X64_MSR_STIMER0_COUNT, current);
return (0);
}
static int
hv_et_stop(struct eventtimer *et)
{
wrmsr(HV_X64_MSR_STIMER0_CONFIG, 0);
wrmsr(HV_X64_MSR_STIMER0_COUNT, 0);
return (0);
}
void
hv_et_intr(struct trapframe *frame)
{
union hv_timer_config timer_cfg;
struct trapframe *oldframe;
struct thread *td;
if (periodticks[curcpu] != 0) {
uint64_t tick = sbintime2tick(periodticks[curcpu]);
timer_cfg.as_uint64 = rdmsr(HV_X64_MSR_STIMER0_CONFIG);
timer_cfg.enable = 0;
timer_cfg.auto_enable = 1;
timer_cfg.periodic = 1;
periodticks[curcpu] = 0;
wrmsr(HV_X64_MSR_STIMER0_CONFIG, timer_cfg.as_uint64);
wrmsr(HV_X64_MSR_STIMER0_COUNT, tick);
}
if (et.et_active) {
td = curthread;
td->td_intr_nesting_level++;
oldframe = td->td_intr_frame;
td->td_intr_frame = frame;
et.et_event_cb(&et, et.et_arg);
td->td_intr_frame = oldframe;
td->td_intr_nesting_level--;
}
}
void
hv_et_init(void)
{
et.et_name = "HyperV";
et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU | ET_FLAGS_PERIODIC;
et.et_quality = 1000;
et.et_frequency = HV_TIMER_FREQUENCY;
et.et_min_period = (1LL << 32) / HV_TIMER_FREQUENCY;
et.et_max_period = HV_MAX_DELTA_TICKS * ((1LL << 32) / HV_TIMER_FREQUENCY);
et.et_start = hv_et_start;
et.et_stop = hv_et_stop;
et.et_priv = &et;
et_register(&et);
}
+10 -51
View File
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/pcpu.h>
#include <sys/timetc.h>
#include <machine/bus.h>
#include <machine/md_var.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
@@ -44,23 +45,11 @@ __FBSDID("$FreeBSD$");
#include "hv_vmbus_priv.h"
#define HV_X64_MSR_GUEST_OS_ID 0x40000000
#define HV_X64_CPUID_MIN 0x40000005
#define HV_X64_CPUID_MAX 0x4000ffff
#define HV_X64_MSR_TIME_REF_COUNT 0x40000020
#define HV_NANOSECONDS_PER_SEC 1000000000L
static u_int hv_get_timecount(struct timecounter *tc);
static inline void do_cpuid_inline(unsigned int op, unsigned int *eax,
unsigned int *ebx, unsigned int *ecx, unsigned int *edx) {
__asm__ __volatile__("cpuid" : "=a" (*eax), "=b" (*ebx), "=c" (*ecx),
"=d" (*edx) : "0" (op), "c" (ecx));
}
/**
* Globals
*/
@@ -86,27 +75,10 @@ hv_get_timecount(struct timecounter *tc)
int
hv_vmbus_query_hypervisor_presence(void)
{
u_int regs[4];
int hyper_v_detected = 0;
/*
* When Xen is detected and native Xen PV support is enabled,
* ignore Xen's HyperV emulation.
*/
if (vm_guest == VM_GUEST_XEN)
if (vm_guest != VM_GUEST_HV)
return (0);
do_cpuid(1, regs);
if (regs[2] & 0x80000000) { /* if(a hypervisor is detected) */
/* make sure this really is Hyper-V */
/* we look at the CPUID info */
do_cpuid(HV_X64_MSR_GUEST_OS_ID, regs);
hyper_v_detected =
regs[0] >= HV_X64_CPUID_MIN &&
regs[0] <= HV_X64_CPUID_MAX &&
!memcmp("Microsoft Hv", &regs[1], 12);
}
return (hyper_v_detected);
return (hv_high >= HV_X64_CPUID_MIN && hv_high <= HV_X64_CPUID_MAX);
}
/**
@@ -115,10 +87,7 @@ hv_vmbus_query_hypervisor_presence(void)
static int
hv_vmbus_get_hypervisor_version(void)
{
unsigned int eax;
unsigned int ebx;
unsigned int ecx;
unsigned int edx;
u_int regs[4];
unsigned int maxLeaf;
unsigned int op;
@@ -127,28 +96,16 @@ hv_vmbus_get_hypervisor_version(void)
* Viridian is present
* Query id and revision.
*/
eax = 0;
ebx = 0;
ecx = 0;
edx = 0;
op = HV_CPU_ID_FUNCTION_HV_VENDOR_AND_MAX_FUNCTION;
do_cpuid_inline(op, &eax, &ebx, &ecx, &edx);
do_cpuid(op, regs);
maxLeaf = eax;
eax = 0;
ebx = 0;
ecx = 0;
edx = 0;
maxLeaf = regs[0];
op = HV_CPU_ID_FUNCTION_HV_INTERFACE;
do_cpuid_inline(op, &eax, &ebx, &ecx, &edx);
do_cpuid(op, regs);
if (maxLeaf >= HV_CPU_ID_FUNCTION_MS_HV_VERSION) {
eax = 0;
ebx = 0;
ecx = 0;
edx = 0;
op = HV_CPU_ID_FUNCTION_MS_HV_VERSION;
do_cpuid_inline(op, &eax, &ebx, &ecx, &edx);
do_cpuid(op, regs);
}
return (maxLeaf);
}
@@ -256,6 +213,8 @@ hv_vmbus_init(void)
tc_init(&hv_timecounter); /* register virtual timecount */
hv_et_init();
return (0);
cleanup:
+44 -32
View File
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/systm.h>
@@ -60,13 +61,15 @@ __FBSDID("$FreeBSD$");
#include "hv_vmbus_priv.h"
#define VMBUS_IRQ 0x5
#include <contrib/dev/acpica/include/acpi.h>
#include "acpi_if.h"
static device_t vmbus_devp;
static int vmbus_inited;
static hv_setup_args setup_args; /* only CPU 0 supported at this time */
static char *vmbus_ids[] = { "VMBUS", NULL };
/**
* @brief Software interrupt thread routine to handle channel messages from
* the hypervisor.
@@ -151,7 +154,7 @@ vmbus_msg_swintr(void *arg)
* message to process - an event or a channel message.
*/
static inline int
hv_vmbus_isr(void *unused)
hv_vmbus_isr(struct trapframe *frame)
{
int cpu;
hv_vmbus_message* msg;
@@ -191,41 +194,57 @@ hv_vmbus_isr(void *unused)
page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu];
msg = (hv_vmbus_message*) page_addr + HV_VMBUS_MESSAGE_SINT;
/* we call eventtimer process the message */
if (msg->header.message_type == HV_MESSAGE_TIMER_EXPIRED) {
msg->header.message_type = HV_MESSAGE_TYPE_NONE;
/*
* Make sure the write to message_type (ie set to
* HV_MESSAGE_TYPE_NONE) happens before we read the
* message_pending and EOMing. Otherwise, the EOMing will
* not deliver any more messages
* since there is no empty slot
*/
wmb();
if (msg->header.message_flags.u.message_pending) {
/*
* This will cause message queue rescan to possibly
* deliver another msg from the hypervisor
*/
wrmsr(HV_X64_MSR_EOM, 0);
}
hv_et_intr(frame);
return (FILTER_HANDLED);
}
if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) {
swi_sched(hv_vmbus_g_context.msg_swintr[cpu], 0);
}
return FILTER_HANDLED;
return (FILTER_HANDLED);
}
#ifdef HV_DEBUG_INTR
uint32_t hv_intr_count = 0;
#endif
uint32_t hv_vmbus_swintr_event_cpu[MAXCPU];
uint32_t hv_vmbus_intr_cpu[MAXCPU];
u_long *hv_vmbus_intr_cpu[MAXCPU];
void
hv_vector_handler(struct trapframe *trap_frame)
{
#ifdef HV_DEBUG_INTR
int cpu;
#endif
/*
* Disable preemption.
*/
critical_enter();
#ifdef HV_DEBUG_INTR
/*
* Do a little interrupt counting.
*/
cpu = PCPU_GET(cpuid);
hv_vmbus_intr_cpu[cpu]++;
hv_intr_count++;
#endif
(*hv_vmbus_intr_cpu[cpu])++;
hv_vmbus_isr(NULL);
hv_vmbus_isr(trap_frame);
/*
* Enable preemption.
@@ -350,25 +369,15 @@ hv_vmbus_child_device_unregister(struct hv_device *child_dev)
return(ret);
}
static void
vmbus_identify(driver_t *driver, device_t parent)
{
if (!hv_vmbus_query_hypervisor_presence())
return;
vm_guest = VM_GUEST_HV;
BUS_ADD_CHILD(parent, 0, "vmbus", 0);
}
static int
vmbus_probe(device_t dev) {
if(bootverbose)
device_printf(dev, "VMBUS: probe\n");
if (ACPI_ID_PROBE(device_get_parent(dev), dev, vmbus_ids) == NULL ||
device_get_unit(dev) != 0)
return (ENXIO);
device_set_desc(dev, "Vmbus Devices");
return (BUS_PROBE_NOWILDCARD);
return (BUS_PROBE_DEFAULT);
}
#ifdef HYPERV
@@ -462,6 +471,7 @@ static int
vmbus_bus_init(void)
{
int i, j, n, ret;
char buf[MAXCOMLEN + 1];
if (vmbus_inited)
return (0);
@@ -498,13 +508,15 @@ vmbus_bus_init(void)
setup_args.vector = hv_vmbus_g_context.hv_cb_vector;
CPU_FOREACH(j) {
hv_vmbus_intr_cpu[j] = 0;
hv_vmbus_swintr_event_cpu[j] = 0;
hv_vmbus_g_context.hv_event_intr_event[j] = NULL;
hv_vmbus_g_context.hv_msg_intr_event[j] = NULL;
hv_vmbus_g_context.event_swintr[j] = NULL;
hv_vmbus_g_context.msg_swintr[j] = NULL;
snprintf(buf, sizeof(buf), "cpu%d:hyperv", j);
intrcnt_add(buf, &hv_vmbus_intr_cpu[j]);
for (i = 0; i < 2; i++)
setup_args.page_buffers[2 * j + i] = NULL;
}
@@ -723,7 +735,6 @@ vmbus_modevent(module_t mod, int what, void *arg)
static device_method_t vmbus_methods[] = {
/** Device interface */
DEVMETHOD(device_identify, vmbus_identify),
DEVMETHOD(device_probe, vmbus_probe),
DEVMETHOD(device_attach, vmbus_attach),
DEVMETHOD(device_detach, vmbus_detach),
@@ -745,7 +756,8 @@ static driver_t vmbus_driver = { driver_name, vmbus_methods,0, };
devclass_t vmbus_devclass;
DRIVER_MODULE(vmbus, nexus, vmbus_driver, vmbus_devclass, vmbus_modevent, 0);
DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, vmbus_modevent, 0);
MODULE_DEPEND(vmbus, acpi, 1, 1, 1);
MODULE_VERSION(vmbus, 1);
/* We want to be started after SMP is initialized */
+46 -9
View File
@@ -359,11 +359,6 @@ typedef struct {
struct sema control_sema;
} hv_vmbus_connection;
/*
* Declare the MSR used to identify the guest OS
*/
#define HV_X64_MSR_GUEST_OS_ID 0x40000000
typedef union {
uint64_t as_uint64_t;
struct {
@@ -380,10 +375,6 @@ typedef union {
} u;
} hv_vmbus_x64_msr_guest_os_id_contents;
/*
* Declare the MSR used to setup pages used to communicate with the hypervisor
*/
#define HV_X64_MSR_HYPERCALL 0x40000001
typedef union {
uint64_t as_uint64_t;
@@ -512,6 +503,22 @@ typedef union {
} u;
} hv_vmbus_synic_sint;
/*
* Timer configuration register.
*/
union hv_timer_config {
uint64_t as_uint64;
struct {
uint64_t enable:1;
uint64_t periodic:1;
uint64_t lazy:1;
uint64_t auto_enable:1;
uint64_t reserved_z0:12;
uint64_t sintx:4;
uint64_t reserved_z1:44;
};
};
/*
* Define syn_ic control register
*/
@@ -542,9 +549,22 @@ typedef union {
uint32_t flags32[HV_EVENT_FLAGS_DWORD_COUNT];
} hv_vmbus_synic_event_flags;
#define HV_X64_CPUID_MIN (0x40000005)
#define HV_X64_CPUID_MAX (0x4000ffff)
/*
* Declare the MSR used to identify the guest OS
*/
#define HV_X64_MSR_GUEST_OS_ID (0x40000000)
/*
* Declare the MSR used to setup pages used to communicate with the hypervisor
*/
#define HV_X64_MSR_HYPERCALL (0x40000001)
/* MSR used to provide vcpu index */
#define HV_X64_MSR_VP_INDEX (0x40000002)
#define HV_X64_MSR_TIME_REF_COUNT (0x40000020)
/*
* Define synthetic interrupt controller model specific registers
*/
@@ -571,6 +591,18 @@ typedef union {
#define HV_X64_MSR_SINT14 (0x4000009E)
#define HV_X64_MSR_SINT15 (0x4000009F)
/*
* Synthetic Timer MSRs. Four timers per vcpu.
*/
#define HV_X64_MSR_STIMER0_CONFIG 0x400000B0
#define HV_X64_MSR_STIMER0_COUNT 0x400000B1
#define HV_X64_MSR_STIMER1_CONFIG 0x400000B2
#define HV_X64_MSR_STIMER1_COUNT 0x400000B3
#define HV_X64_MSR_STIMER2_CONFIG 0x400000B4
#define HV_X64_MSR_STIMER2_COUNT 0x400000B5
#define HV_X64_MSR_STIMER3_CONFIG 0x400000B6
#define HV_X64_MSR_STIMER3_COUNT 0x400000B7
/*
* Declare the various hypercall operations
*/
@@ -678,6 +710,11 @@ int hv_vmbus_post_message(void *buffer, size_t buf_size);
int hv_vmbus_set_event(hv_vmbus_channel *channel);
void hv_vmbus_on_events(void *);
/**
* Event Timer interfaces
*/
void hv_et_init(void);
void hv_et_intr(struct trapframe*);
/*
* The guest OS needs to register the guest ID with the hypervisor.
+13 -2
View File
@@ -97,6 +97,8 @@ static void
pty_clone(void *arg, struct ucred *cr, char *name, int namelen,
struct cdev **dev)
{
struct make_dev_args mda;
int error;
/* Cloning is already satisfied. */
if (*dev != NULL)
@@ -117,8 +119,17 @@ pty_clone(void *arg, struct ucred *cr, char *name, int namelen,
return;
/* Create the controller device node. */
*dev = make_dev_credf(MAKEDEV_REF, &ptydev_cdevsw, 0,
NULL, UID_ROOT, GID_WHEEL, 0666, "%s", name);
make_dev_args_init(&mda);
mda.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_REF;
mda.mda_devsw = &ptydev_cdevsw;
mda.mda_uid = UID_ROOT;
mda.mda_gid = GID_WHEEL;
mda.mda_mode = 0666;
error = make_dev_s(&mda, dev, "%s", name);
if (error != 0) {
printf("pty_clone: failed to create %s: %d\n", name, error);
*dev = NULL;
}
}
static int
+41
View File
@@ -45,6 +45,47 @@ extern "C" {
#define EF10_MAX_PIOBUF_NBUFS MEDFORD_PIOBUF_NBUFS
#endif
extern __checkReturn efx_rc_t
efx_mcdi_get_port_assignment(
__in efx_nic_t *enp,
__out uint32_t *portp);
extern __checkReturn efx_rc_t
efx_mcdi_get_port_modes(
__in efx_nic_t *enp,
__out uint32_t *modesp);
extern __checkReturn efx_rc_t
efx_mcdi_get_mac_address_pf(
__in efx_nic_t *enp,
__out_ecount_opt(6) uint8_t mac_addrp[6]);
extern __checkReturn efx_rc_t
efx_mcdi_get_mac_address_vf(
__in efx_nic_t *enp,
__out_ecount_opt(6) uint8_t mac_addrp[6]);
extern __checkReturn efx_rc_t
efx_mcdi_get_clock(
__in efx_nic_t *enp,
__out uint32_t *sys_freqp);
extern __checkReturn efx_rc_t
efx_mcdi_get_vector_cfg(
__in efx_nic_t *enp,
__out_opt uint32_t *vec_basep,
__out_opt uint32_t *pf_nvecp,
__out_opt uint32_t *vf_nvecp);
extern __checkReturn efx_rc_t
ef10_get_datapath_caps(
__in efx_nic_t *enp);
extern __checkReturn efx_rc_t
ef10_external_port_mapping(
__in efx_nic_t *enp,
__in uint32_t port,
__out uint8_t *external_portp);
#ifdef __cplusplus
+16
View File
@@ -764,4 +764,20 @@ struct tlv_rx_event_merging_config {
#define TLV_RX_EVENT_MERGING_MAX_EVENTS_DEFAULT 7
#define TLV_RX_EVENT_MERGING_TIMEOUT_NS_DEFAULT 8740
#define TLV_TAG_PCIE_LINK_SETTINGS (0x101f0000)
struct tlv_pcie_link_settings {
uint32_t tag;
uint32_t length;
uint16_t gen; /* Target PCIe generation: 1, 2, 3 */
uint16_t width; /* Number of lanes */
};
#define TLV_TAG_LICENSE (0x20800000)
typedef struct tlv_license {
uint32_t tag;
uint32_t length;
uint8_t data[];
} tlv_license_t;
#endif /* CI_MGMT_TLV_LAYOUT_H */
+2 -1
View File
@@ -288,12 +288,13 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map,
#define EFSYS_OPT_QSTATS 1
#define EFSYS_OPT_FILTER 1
#define EFSYS_OPT_RX_SCATTER 0
#define EFSYS_OPT_RX_HDR_SPLIT 0
#define EFSYS_OPT_EV_PREFETCH 0
#define EFSYS_OPT_DECODE_INTR_FATAL 1
#define EFSYS_OPT_LICENSING 0
/* ID */
typedef struct __efsys_identifier_s efsys_identifier_t;
+73 -12
View File
@@ -1071,6 +1071,7 @@ efx_bist_stop(
#define EFX_FEATURE_TX_SRC_FILTERS 0x00000400
#define EFX_FEATURE_PIO_BUFFERS 0x00000800
#define EFX_FEATURE_FW_ASSISTED_TSO 0x00001000
#define EFX_FEATURE_FW_ASSISTED_TSO_V2 0x00002000
typedef struct efx_nic_cfg_s {
uint32_t enc_board_type;
@@ -1152,6 +1153,7 @@ typedef struct efx_nic_cfg_s {
*/
uint32_t enc_tx_tso_tcp_header_offset_limit;
boolean_t enc_fw_assisted_tso_enabled;
boolean_t enc_fw_assisted_tso_v2_enabled;
boolean_t enc_hw_tx_insert_vlan_enabled;
/* Datapath firmware vadapter/vport/vswitch support */
boolean_t enc_datapath_cap_evb;
@@ -1315,6 +1317,7 @@ typedef enum efx_nvram_type_e {
EFX_NVRAM_CPLD,
EFX_NVRAM_FPGA_BACKUP,
EFX_NVRAM_DYNAMIC_CFG,
EFX_NVRAM_LICENSE,
EFX_NVRAM_NTYPES,
} efx_nvram_type_t;
@@ -1817,15 +1820,6 @@ extern void
efx_rx_fini(
__in efx_nic_t *enp);
#if EFSYS_OPT_RX_HDR_SPLIT
__checkReturn efx_rc_t
efx_rx_hdr_split_enable(
__in efx_nic_t *enp,
__in unsigned int hdr_buf_size,
__in unsigned int pld_buf_size);
#endif /* EFSYS_OPT_RX_HDR_SPLIT */
#if EFSYS_OPT_RX_SCATTER
__checkReturn efx_rc_t
efx_rx_scatter_enable(
@@ -1892,7 +1886,7 @@ efx_rx_scale_key_set(
__in_ecount(n) uint8_t *key,
__in size_t n);
extern uint32_t
extern __checkReturn uint32_t
efx_psuedo_hdr_hash_get(
__in efx_nic_t *enp,
__in efx_rx_hash_alg_t func,
@@ -2011,6 +2005,7 @@ efx_tx_fini(
#define EFX_TXQ_CKSUM_IPV4 0x0001
#define EFX_TXQ_CKSUM_TCPUDP 0x0002
#define EFX_TXQ_FATSOV2 0x0004
extern __checkReturn efx_rc_t
efx_tx_qcreate(
@@ -2098,6 +2093,21 @@ efx_tx_qdesc_tso_create(
__in uint8_t tcp_flags,
__out efx_desc_t *edp);
/* Number of FATSOv2 option descriptors */
#define EFX_TX_FATSOV2_OPT_NDESCS 2
/* Maximum number of DMA segments per TSO packet (not superframe) */
#define EFX_TX_FATSOV2_DMA_SEGS_PER_PKT_MAX 24
extern void
efx_tx_qdesc_tso2_create(
__in efx_txq_t *etp,
__in uint16_t ipv4_id,
__in uint32_t tcp_seq,
__in uint16_t tcp_mss,
__out_ecount(count) efx_desc_t *edp,
__in int count);
extern void
efx_tx_qdesc_vlantci_create(
__in efx_txq_t *etp,
@@ -2244,14 +2254,14 @@ efx_filter_supported_filters(
extern void
efx_filter_spec_init_rx(
__inout efx_filter_spec_t *spec,
__out efx_filter_spec_t *spec,
__in efx_filter_priority_t priority,
__in efx_filter_flag_t flags,
__in efx_rxq_t *erp);
extern void
efx_filter_spec_init_tx(
__inout efx_filter_spec_t *spec,
__out efx_filter_spec_t *spec,
__in efx_txq_t *etp);
extern __checkReturn efx_rc_t
@@ -2300,6 +2310,57 @@ efx_hash_bytes(
__in size_t length,
__in uint32_t init);
#if EFSYS_OPT_LICENSING
/* LICENSING */
typedef struct efx_key_stats_s {
uint32_t eks_valid;
uint32_t eks_invalid;
uint32_t eks_blacklisted;
uint32_t eks_unverifiable;
uint32_t eks_wrong_node;
uint32_t eks_licensed_apps_lo;
uint32_t eks_licensed_apps_hi;
uint32_t eks_licensed_features_lo;
uint32_t eks_licensed_features_hi;
} efx_key_stats_t;
extern __checkReturn efx_rc_t
efx_lic_init(
__in efx_nic_t *enp);
extern void
efx_lic_fini(
__in efx_nic_t *enp);
extern __checkReturn efx_rc_t
efx_lic_update_licenses(
__in efx_nic_t *enp);
extern __checkReturn efx_rc_t
efx_lic_get_key_stats(
__in efx_nic_t *enp,
__out efx_key_stats_t *ksp);
extern __checkReturn efx_rc_t
efx_lic_app_state(
__in efx_nic_t *enp,
__in uint64_t app_id,
__out boolean_t *licensedp);
extern __checkReturn efx_rc_t
efx_lic_get_id(
__in efx_nic_t *enp,
__in size_t buffer_size,
__out uint32_t *typep,
__out size_t *lengthp,
__out_opt uint8_t *bufferp);
#endif /* EFSYS_OPT_LICENSING */
#ifdef __cplusplus
}
-2
View File
@@ -31,9 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_impl.h"
#if EFSYS_OPT_BOOTCFG
+14 -6
View File
@@ -347,12 +347,9 @@
# endif
#endif /* EFSYS_OPT_QSTATS */
/* Support receive header split */
#if EFSYS_OPT_RX_HDR_SPLIT
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "RX_HDR_SPLIT requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
/* Obsolete option */
#ifdef EFSYS_OPT_RX_HDR_SPLIT
# error "RX_HDR_SPLIT is obsolete and is not supported"
#endif /* EFSYS_OPT_RX_HDR_SPLIT */
/* Support receive scaling (RSS) */
@@ -404,4 +401,15 @@
# endif
#endif /* EFSYS_OPT_BIST */
/* Support MCDI licensing API */
#if EFSYS_OPT_LICENSING
# if !EFSYS_OPT_MCDI
# error "LICENSING requires MCDI"
# endif
# if !EFSYS_HAS_UINT64
# error "LICENSING requires UINT64"
# endif
#endif /* EFSYS_OPT_LICENSING */
#endif /* _SYS_EFX_CHECK_H */
-2
View File
@@ -31,9 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_impl.h"
/*
+10 -11
View File
@@ -31,12 +31,11 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_impl.h"
#if EFSYS_OPT_MON_MCDI
#include "mcdi_mon.h"
#endif
#if EFSYS_OPT_QSTATS
#define EFX_EV_QSTAT_INCR(_eep, _stat) \
@@ -498,7 +497,7 @@ falconsiena_ev_rx_not_ok(
EFX_EV_QSTAT_INCR(eep, EV_RX_FRM_TRUNC);
(*flagsp) |= EFX_DISCARD;
#if (EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER)
#if EFSYS_OPT_RX_SCATTER
/*
* Lookout for payload queue ran dry errors and ignore them.
*
@@ -513,7 +512,7 @@ falconsiena_ev_rx_not_ok(
(EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_JUMBO_CONT) == 0) &&
(EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_BYTE_CNT) == 0))
ignore = B_TRUE;
#endif /* EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER */
#endif /* EFSYS_OPT_RX_SCATTER */
}
if (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_ETH_CRC_ERR) != 0) {
@@ -574,10 +573,10 @@ falconsiena_ev_rx(
uint32_t size;
uint32_t label;
boolean_t ok;
#if (EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER)
#if EFSYS_OPT_RX_SCATTER
boolean_t sop;
boolean_t jumbo_cont;
#endif /* EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER */
#endif /* EFSYS_OPT_RX_SCATTER */
uint32_t hdr_type;
boolean_t is_v6;
uint16_t flags;
@@ -592,10 +591,10 @@ falconsiena_ev_rx(
label = EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_Q_LABEL);
ok = (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_PKT_OK) != 0);
#if (EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER)
#if EFSYS_OPT_RX_SCATTER
sop = (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_SOP) != 0);
jumbo_cont = (EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_JUMBO_CONT) != 0);
#endif /* EFSYS_OPT_RX_HDR_SPLIT || EFSYS_OPT_RX_SCATTER */
#endif /* EFSYS_OPT_RX_SCATTER */
hdr_type = EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_HDR_TYPE);
@@ -650,13 +649,13 @@ falconsiena_ev_rx(
break;
}
#if EFSYS_OPT_RX_SCATTER || EFSYS_OPT_RX_HDR_SPLIT
#if EFSYS_OPT_RX_SCATTER
/* Report scatter and header/lookahead split buffer flags */
if (sop)
flags |= EFX_PKT_START;
if (jumbo_cont)
flags |= EFX_PKT_CONT;
#endif /* EFSYS_OPT_RX_SCATTER || EFSYS_OPT_RX_HDR_SPLIT */
#endif /* EFSYS_OPT_RX_SCATTER */
/* Detect errors included in the FSF_AZ_RX_EV_PKT_OK indication */
if (!ok) {
+2 -5
View File
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_impl.h"
@@ -295,7 +292,7 @@ efx_filter_reconfigure(
void
efx_filter_spec_init_rx(
__inout efx_filter_spec_t *spec,
__out efx_filter_spec_t *spec,
__in efx_filter_priority_t priority,
__in efx_filter_flag_t flags,
__in efx_rxq_t *erp)
@@ -314,7 +311,7 @@ efx_filter_spec_init_rx(
void
efx_filter_spec_init_tx(
__inout efx_filter_spec_t *spec,
__out efx_filter_spec_t *spec,
__in efx_txq_t *etp)
{
EFSYS_ASSERT3P(spec, !=, NULL);
-2
View File
@@ -42,9 +42,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_impl.h"
/* Hash initial value */
+32 -9
View File
@@ -84,6 +84,7 @@ extern "C" {
#define EFX_MOD_WOL 0x00000800
#define EFX_MOD_FILTER 0x00001000
#define EFX_MOD_PKTFILTER 0x00002000
#define EFX_MOD_LIC 0x00004000
#define EFX_RESET_MAC 0x00000001
#define EFX_RESET_PHY 0x00000002
@@ -146,6 +147,9 @@ typedef struct efx_tx_ops_s {
void (*etxo_qdesc_tso_create)(efx_txq_t *, uint16_t,
uint32_t, uint8_t,
efx_desc_t *);
void (*etxo_qdesc_tso2_create)(efx_txq_t *, uint16_t,
uint32_t, uint16_t,
efx_desc_t *, int);
void (*etxo_qdesc_vlantci_create)(efx_txq_t *, uint16_t,
efx_desc_t *);
#if EFSYS_OPT_QSTATS
@@ -157,10 +161,6 @@ typedef struct efx_tx_ops_s {
typedef struct efx_rx_ops_s {
efx_rc_t (*erxo_init)(efx_nic_t *);
void (*erxo_fini)(efx_nic_t *);
#if EFSYS_OPT_RX_HDR_SPLIT
efx_rc_t (*erxo_hdr_split_enable)(efx_nic_t *, unsigned int,
unsigned int);
#endif
#if EFSYS_OPT_RX_SCATTER
efx_rc_t (*erxo_scatter_enable)(efx_nic_t *, unsigned int);
#endif
@@ -170,7 +170,11 @@ typedef struct efx_rx_ops_s {
efx_rc_t (*erxo_scale_key_set)(efx_nic_t *, uint8_t *, size_t);
efx_rc_t (*erxo_scale_tbl_set)(efx_nic_t *, unsigned int *,
size_t);
#endif
uint32_t (*erxo_prefix_hash)(efx_nic_t *, efx_rx_hash_alg_t,
uint8_t *);
#endif /* EFSYS_OPT_RX_SCALE */
efx_rc_t (*erxo_prefix_pktlen)(efx_nic_t *, uint8_t *,
uint16_t *);
void (*erxo_qpost)(efx_rxq_t *, efsys_dma_addr_t *, size_t,
unsigned int, unsigned int,
unsigned int);
@@ -358,6 +362,7 @@ typedef struct efx_intr_s {
typedef struct efx_nic_ops_s {
efx_rc_t (*eno_probe)(efx_nic_t *);
efx_rc_t (*eno_board_cfg)(efx_nic_t *);
efx_rc_t (*eno_set_drv_limits)(efx_nic_t *, efx_drv_limits_t*);
efx_rc_t (*eno_reset)(efx_nic_t *);
efx_rc_t (*eno_init)(efx_nic_t *);
@@ -456,8 +461,8 @@ falconsiena_filter_tbl_clear(
typedef struct efx_mcdi_ops_s {
efx_rc_t (*emco_init)(efx_nic_t *, const efx_mcdi_transport_t *);
void (*emco_request_copyin)(efx_nic_t *, efx_mcdi_req_t *,
unsigned int, boolean_t, boolean_t);
void (*emco_send_request)(efx_nic_t *, void *, size_t,
void *, size_t);
void (*emco_request_copyout)(efx_nic_t *, efx_mcdi_req_t *);
efx_rc_t (*emco_poll_reboot)(efx_nic_t *);
boolean_t (*emco_poll_response)(efx_nic_t *);
@@ -479,7 +484,6 @@ typedef struct efx_nvram_ops_s {
#if EFSYS_OPT_DIAG
efx_rc_t (*envo_test)(efx_nic_t *);
#endif /* EFSYS_OPT_DIAG */
efx_rc_t (*envo_size)(efx_nic_t *, efx_nvram_type_t, size_t *);
efx_rc_t (*envo_get_version)(efx_nic_t *, efx_nvram_type_t,
uint32_t *, uint16_t *);
efx_rc_t (*envo_rw_start)(efx_nic_t *, efx_nvram_type_t, size_t *);
@@ -492,6 +496,9 @@ typedef struct efx_nvram_ops_s {
efx_rc_t (*envo_set_version)(efx_nic_t *, efx_nvram_type_t,
uint16_t *);
efx_rc_t (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t,
uint32_t *);
efx_rc_t (*envo_partn_size)(efx_nic_t *, uint32_t, size_t *);
} efx_nvram_ops_t;
#endif /* EFSYS_OPT_NVRAM */
@@ -585,6 +592,18 @@ efx_mcdi_nvram_test(
#endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */
#if EFSYS_OPT_LICENSING
typedef struct efx_lic_ops_s {
efx_rc_t (*elo_update_licenses)(efx_nic_t *);
efx_rc_t (*elo_get_key_stats)(efx_nic_t *, efx_key_stats_t *);
efx_rc_t (*elo_app_state)(efx_nic_t *, uint64_t, boolean_t *);
efx_rc_t (*elo_get_id)(efx_nic_t *, size_t, uint32_t *,
size_t *, uint8_t *);
} efx_lic_ops_t;
#endif
typedef struct efx_drv_cfg_s {
uint32_t edc_min_vi_count;
uint32_t edc_max_vi_count;
@@ -634,6 +653,9 @@ struct efx_nic_s {
uint32_t en_rss_context;
#endif /* EFSYS_OPT_RX_SCALE */
uint32_t en_vport_id;
#if EFSYS_OPT_LICENSING
efx_lic_ops_t *en_elop;
#endif
union {
#if EFSYS_OPT_FALCON
struct {
@@ -672,6 +694,7 @@ struct efx_nic_s {
struct {
int ena_vi_base;
int ena_vi_count;
int ena_vi_shift;
#if EFSYS_OPT_VPD
caddr_t ena_svpd;
size_t ena_svpd_length;
@@ -1117,7 +1140,7 @@ efx_vpd_hunk_next(
__in size_t size,
__out efx_vpd_tag_t *tagp,
__out efx_vpd_keyword_t *keyword,
__out_bcount_opt(*paylenp) unsigned int *payloadp,
__out_opt unsigned int *payloadp,
__out_opt uint8_t *paylenp,
__inout unsigned int *contp);
-3
View File
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_impl.h"
+792
View File
@@ -0,0 +1,792 @@
/*-
* Copyright (c) 2009-2015 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the FreeBSD Project.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efx.h"
#include "efx_impl.h"
#if EFSYS_OPT_LICENSING
#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
efx_mcdi_fc_license_update_license(
__in efx_nic_t *enp);
static __checkReturn efx_rc_t
efx_mcdi_fc_license_get_key_stats(
__in efx_nic_t *enp,
__out efx_key_stats_t *eksp);
static efx_lic_ops_t __efx_lic_v1_ops = {
efx_mcdi_fc_license_update_license, /* elo_update_licenses */
efx_mcdi_fc_license_get_key_stats, /* elo_get_key_stats */
NULL, /* elo_app_state */
NULL, /* elo_get_id */
};
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
static __checkReturn efx_rc_t
efx_mcdi_licensing_update_licenses(
__in efx_nic_t *enp);
static __checkReturn efx_rc_t
efx_mcdi_licensing_get_key_stats(
__in efx_nic_t *enp,
__out efx_key_stats_t *eksp);
static __checkReturn efx_rc_t
efx_mcdi_licensed_app_state(
__in efx_nic_t *enp,
__in uint64_t app_id,
__out boolean_t *licensedp);
static efx_lic_ops_t __efx_lic_v2_ops = {
efx_mcdi_licensing_update_licenses, /* elo_update_licenses */
efx_mcdi_licensing_get_key_stats, /* elo_get_key_stats */
efx_mcdi_licensed_app_state, /* elo_app_state */
NULL, /* elo_get_id */
};
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
static __checkReturn efx_rc_t
efx_mcdi_licensing_v3_update_licenses(
__in efx_nic_t *enp);
static __checkReturn efx_rc_t
efx_mcdi_licensing_v3_report_license(
__in efx_nic_t *enp,
__out efx_key_stats_t *eksp);
static __checkReturn efx_rc_t
efx_mcdi_licensing_v3_app_state(
__in efx_nic_t *enp,
__in uint64_t app_id,
__out boolean_t *licensedp);
static __checkReturn efx_rc_t
efx_mcdi_licensing_v3_get_id(
__in efx_nic_t *enp,
__in size_t buffer_size,
__out uint32_t *typep,
__out size_t *lengthp,
__out_bcount_part_opt(buffer_size, *lengthp)
uint8_t *bufferp);
static efx_lic_ops_t __efx_lic_v3_ops = {
efx_mcdi_licensing_v3_update_licenses, /* elo_update_licenses */
efx_mcdi_licensing_v3_report_license, /* elo_get_key_stats */
efx_mcdi_licensing_v3_app_state, /* elo_app_state */
efx_mcdi_licensing_v3_get_id, /* elo_get_id */
};
#endif /* EFSYS_OPT_MEDFORD */
/* V1 Licensing - used in Siena Modena only */
#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
efx_mcdi_fc_license_update_license(
__in efx_nic_t *enp)
{
efx_mcdi_req_t req;
uint8_t payload[MC_CMD_FC_IN_LICENSE_LEN];
efx_rc_t rc;
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_SIENA);
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_FC_OP_LICENSE;
req.emr_in_buf = payload;
req.emr_in_length = MC_CMD_FC_IN_LICENSE_LEN;
req.emr_out_buf = payload;
req.emr_out_length = 0;
MCDI_IN_SET_DWORD(req, FC_IN_LICENSE_OP,
MC_CMD_FC_IN_LICENSE_UPDATE_LICENSE);
efx_mcdi_execute(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
goto fail1;
}
if (req.emr_out_length_used != 0) {
rc = EIO;
goto fail2;
}
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
static __checkReturn efx_rc_t
efx_mcdi_fc_license_get_key_stats(
__in efx_nic_t *enp,
__out efx_key_stats_t *eksp)
{
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_FC_IN_LICENSE_LEN,
MC_CMD_FC_OUT_LICENSE_LEN)];
efx_rc_t rc;
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_SIENA);
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_FC_OP_LICENSE;
req.emr_in_buf = payload;
req.emr_in_length = MC_CMD_FC_IN_LICENSE_LEN;
req.emr_out_buf = payload;
req.emr_out_length = MC_CMD_FC_OUT_LICENSE_LEN;
MCDI_IN_SET_DWORD(req, FC_IN_LICENSE_OP,
MC_CMD_FC_IN_LICENSE_GET_KEY_STATS);
efx_mcdi_execute(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
goto fail1;
}
if (req.emr_out_length_used < MC_CMD_FC_OUT_LICENSE_LEN) {
rc = EMSGSIZE;
goto fail2;
}
eksp->eks_valid =
MCDI_OUT_DWORD(req, FC_OUT_LICENSE_VALID_KEYS);
eksp->eks_invalid =
MCDI_OUT_DWORD(req, FC_OUT_LICENSE_INVALID_KEYS);
eksp->eks_blacklisted =
MCDI_OUT_DWORD(req, FC_OUT_LICENSE_BLACKLISTED_KEYS);
eksp->eks_unverifiable = 0;
eksp->eks_wrong_node = 0;
eksp->eks_licensed_apps_lo = 0;
eksp->eks_licensed_apps_hi = 0;
eksp->eks_licensed_features_lo = 0;
eksp->eks_licensed_features_hi = 0;
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
#endif /* EFSYS_OPT_SIENA */
/* V2 Licensing - used by Huntington family only. See SF-113611-TC */
#if EFSYS_OPT_HUNTINGTON
static __checkReturn efx_rc_t
efx_mcdi_licensed_app_state(
__in efx_nic_t *enp,
__in uint64_t app_id,
__out boolean_t *licensedp)
{
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_GET_LICENSED_APP_STATE_IN_LEN,
MC_CMD_GET_LICENSED_APP_STATE_OUT_LEN)];
uint32_t app_state;
efx_rc_t rc;
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON);
/* V2 licensing supports 32bit app id only */
if ((app_id >> 32) != 0) {
rc = EINVAL;
goto fail1;
}
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_GET_LICENSED_APP_STATE;
req.emr_in_buf = payload;
req.emr_in_length = MC_CMD_GET_LICENSED_APP_STATE_IN_LEN;
req.emr_out_buf = payload;
req.emr_out_length = MC_CMD_GET_LICENSED_APP_STATE_OUT_LEN;
MCDI_IN_SET_DWORD(req, GET_LICENSED_APP_STATE_IN_APP_ID,
app_id & 0xffffffff);
efx_mcdi_execute(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
goto fail2;
}
if (req.emr_out_length_used < MC_CMD_GET_LICENSED_APP_STATE_OUT_LEN) {
rc = EMSGSIZE;
goto fail3;
}
app_state = (MCDI_OUT_DWORD(req, GET_LICENSED_APP_STATE_OUT_STATE));
if (app_state != MC_CMD_GET_LICENSED_APP_STATE_OUT_NOT_LICENSED) {
*licensedp = B_TRUE;
} else {
*licensedp = B_FALSE;
}
return (0);
fail3:
EFSYS_PROBE(fail3);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
static __checkReturn efx_rc_t
efx_mcdi_licensing_update_licenses(
__in efx_nic_t *enp)
{
efx_mcdi_req_t req;
uint8_t payload[MC_CMD_LICENSING_IN_LEN];
efx_rc_t rc;
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON);
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_LICENSING;
req.emr_in_buf = payload;
req.emr_in_length = MC_CMD_LICENSING_IN_LEN;
req.emr_out_buf = payload;
req.emr_out_length = 0;
MCDI_IN_SET_DWORD(req, LICENSING_IN_OP,
MC_CMD_LICENSING_IN_OP_UPDATE_LICENSE);
efx_mcdi_execute(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
goto fail1;
}
if (req.emr_out_length_used != 0) {
rc = EIO;
goto fail2;
}
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
static __checkReturn efx_rc_t
efx_mcdi_licensing_get_key_stats(
__in efx_nic_t *enp,
__out efx_key_stats_t *eksp)
{
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_LICENSING_IN_LEN,
MC_CMD_LICENSING_OUT_LEN)];
efx_rc_t rc;
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON);
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_LICENSING;
req.emr_in_buf = payload;
req.emr_in_length = MC_CMD_LICENSING_IN_LEN;
req.emr_out_buf = payload;
req.emr_out_length = MC_CMD_LICENSING_OUT_LEN;
MCDI_IN_SET_DWORD(req, LICENSING_IN_OP,
MC_CMD_LICENSING_IN_OP_GET_KEY_STATS);
efx_mcdi_execute(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
goto fail1;
}
if (req.emr_out_length_used < MC_CMD_LICENSING_OUT_LEN) {
rc = EMSGSIZE;
goto fail2;
}
eksp->eks_valid =
MCDI_OUT_DWORD(req, LICENSING_OUT_VALID_APP_KEYS);
eksp->eks_invalid =
MCDI_OUT_DWORD(req, LICENSING_OUT_INVALID_APP_KEYS);
eksp->eks_blacklisted =
MCDI_OUT_DWORD(req, LICENSING_OUT_BLACKLISTED_APP_KEYS);
eksp->eks_unverifiable =
MCDI_OUT_DWORD(req, LICENSING_OUT_UNVERIFIABLE_APP_KEYS);
eksp->eks_wrong_node =
MCDI_OUT_DWORD(req, LICENSING_OUT_WRONG_NODE_APP_KEYS);
eksp->eks_licensed_apps_lo = 0;
eksp->eks_licensed_apps_hi = 0;
eksp->eks_licensed_features_lo = 0;
eksp->eks_licensed_features_hi = 0;
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
#endif /* EFSYS_OPT_HUNTINGTON */
/* V3 Licensing - used starting from Medford family. See SF-114884-SW */
#if EFSYS_OPT_MEDFORD
static __checkReturn efx_rc_t
efx_mcdi_licensing_v3_update_licenses(
__in efx_nic_t *enp)
{
efx_mcdi_req_t req;
uint8_t payload[MC_CMD_LICENSING_V3_IN_LEN];
efx_rc_t rc;
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_MEDFORD);
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_LICENSING_V3;
req.emr_in_buf = payload;
req.emr_in_length = MC_CMD_LICENSING_V3_IN_LEN;
req.emr_out_buf = NULL;
req.emr_out_length = 0;
MCDI_IN_SET_DWORD(req, LICENSING_V3_IN_OP,
MC_CMD_LICENSING_V3_IN_OP_UPDATE_LICENSE);
efx_mcdi_execute(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
goto fail1;
}
return (0);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
static __checkReturn efx_rc_t
efx_mcdi_licensing_v3_report_license(
__in efx_nic_t *enp,
__out efx_key_stats_t *eksp)
{
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_LICENSING_V3_IN_LEN,
MC_CMD_LICENSING_V3_OUT_LEN)];
efx_rc_t rc;
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_MEDFORD);
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_LICENSING_V3;
req.emr_in_buf = payload;
req.emr_in_length = MC_CMD_LICENSING_V3_IN_LEN;
req.emr_out_buf = payload;
req.emr_out_length = MC_CMD_LICENSING_V3_OUT_LEN;
MCDI_IN_SET_DWORD(req, LICENSING_V3_IN_OP,
MC_CMD_LICENSING_V3_IN_OP_REPORT_LICENSE);
efx_mcdi_execute(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
goto fail1;
}
if (req.emr_out_length_used < MC_CMD_LICENSING_V3_OUT_LEN) {
rc = EMSGSIZE;
goto fail2;
}
eksp->eks_valid =
MCDI_OUT_DWORD(req, LICENSING_V3_OUT_VALID_KEYS);
eksp->eks_invalid =
MCDI_OUT_DWORD(req, LICENSING_V3_OUT_INVALID_KEYS);
eksp->eks_blacklisted = 0;
eksp->eks_unverifiable =
MCDI_OUT_DWORD(req, LICENSING_V3_OUT_UNVERIFIABLE_KEYS);
eksp->eks_wrong_node =
MCDI_OUT_DWORD(req, LICENSING_V3_OUT_WRONG_NODE_KEYS);
eksp->eks_licensed_apps_lo =
MCDI_OUT_DWORD(req, LICENSING_V3_OUT_LICENSED_APPS_LO);
eksp->eks_licensed_apps_hi =
MCDI_OUT_DWORD(req, LICENSING_V3_OUT_LICENSED_APPS_HI);
eksp->eks_licensed_features_lo =
MCDI_OUT_DWORD(req, LICENSING_V3_OUT_LICENSED_FEATURES_LO);
eksp->eks_licensed_features_hi =
MCDI_OUT_DWORD(req, LICENSING_V3_OUT_LICENSED_FEATURES_HI);
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
static __checkReturn efx_rc_t
efx_mcdi_licensing_v3_app_state(
__in efx_nic_t *enp,
__in uint64_t app_id,
__out boolean_t *licensedp)
{
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_GET_LICENSED_V3_APP_STATE_IN_LEN,
MC_CMD_GET_LICENSED_V3_APP_STATE_OUT_LEN)];
uint32_t app_state;
efx_rc_t rc;
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_MEDFORD);
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_GET_LICENSED_V3_APP_STATE;
req.emr_in_buf = payload;
req.emr_in_length = MC_CMD_GET_LICENSED_V3_APP_STATE_IN_LEN;
req.emr_out_buf = payload;
req.emr_out_length = MC_CMD_GET_LICENSED_V3_APP_STATE_OUT_LEN;
MCDI_IN_SET_DWORD(req, GET_LICENSED_V3_APP_STATE_IN_APP_ID_LO,
app_id & 0xffffffff);
MCDI_IN_SET_DWORD(req, GET_LICENSED_V3_APP_STATE_IN_APP_ID_HI,
app_id >> 32);
efx_mcdi_execute(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
goto fail1;
}
if (req.emr_out_length_used < MC_CMD_GET_LICENSED_V3_APP_STATE_OUT_LEN) {
rc = EMSGSIZE;
goto fail2;
}
app_state = (MCDI_OUT_DWORD(req, GET_LICENSED_V3_APP_STATE_OUT_STATE));
if (app_state != MC_CMD_GET_LICENSED_V3_APP_STATE_OUT_NOT_LICENSED) {
*licensedp = B_TRUE;
} else {
*licensedp = B_FALSE;
}
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
static __checkReturn efx_rc_t
efx_mcdi_licensing_v3_get_id(
__in efx_nic_t *enp,
__in size_t buffer_size,
__out uint32_t *typep,
__out size_t *lengthp,
__out_bcount_part_opt(buffer_size, *lengthp)
uint8_t *bufferp)
{
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_LICENSING_GET_ID_V3_IN_LEN,
MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN)];
efx_rc_t rc;
req.emr_cmd = MC_CMD_LICENSING_GET_ID_V3;
if (bufferp == NULL) {
/* Request id type and length only */
req.emr_in_buf = bufferp;
req.emr_in_length = MC_CMD_LICENSING_GET_ID_V3_IN_LEN;
req.emr_out_buf = bufferp;
req.emr_out_length = MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN;
(void) memset(payload, 0, sizeof (payload));
} else {
/* Request full buffer */
req.emr_in_buf = bufferp;
req.emr_in_length = MC_CMD_LICENSING_GET_ID_V3_IN_LEN;
req.emr_out_buf = bufferp;
req.emr_out_length = MIN(buffer_size, MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN);
(void) memset(bufferp, 0, req.emr_out_length);
}
efx_mcdi_execute(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
goto fail1;
}
if (req.emr_out_length_used < MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN) {
rc = EMSGSIZE;
goto fail2;
}
*typep = MCDI_OUT_DWORD(req, LICENSING_GET_ID_V3_OUT_LICENSE_TYPE);
*lengthp = MCDI_OUT_DWORD(req, LICENSING_GET_ID_V3_OUT_LICENSE_ID_LENGTH);
if (bufferp == NULL) {
/* modify length requirements to indicate to caller the extra buffering
** needed to read the complete output.
*/
*lengthp += MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN;
} else {
/* Shift ID down to start of buffer */
memmove(bufferp,
bufferp+MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_OFST,
*lengthp);
memset(bufferp+(*lengthp), 0, MC_CMD_LICENSING_GET_ID_V3_OUT_LICENSE_ID_OFST);
}
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
#endif /* EFSYS_OPT_MEDFORD */
__checkReturn efx_rc_t
efx_lic_init(
__in efx_nic_t *enp)
{
efx_lic_ops_t *elop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_LIC));
switch (enp->en_family) {
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
elop = (efx_lic_ops_t *)&__efx_lic_v1_ops;
break;
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
elop = (efx_lic_ops_t *)&__efx_lic_v2_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
elop = (efx_lic_ops_t *)&__efx_lic_v3_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
default:
EFSYS_ASSERT(0);
rc = ENOTSUP;
goto fail1;
}
enp->en_elop = elop;
enp->en_mod_flags |= EFX_MOD_LIC;
return (0);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
void
efx_lic_fini(
__in efx_nic_t *enp)
{
efx_lic_ops_t *elop = enp->en_elop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
enp->en_elop = NULL;
enp->en_mod_flags &= ~EFX_MOD_LIC;
}
__checkReturn efx_rc_t
efx_lic_update_licenses(
__in efx_nic_t *enp)
{
efx_lic_ops_t *elop = enp->en_elop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
if ((rc = elop->elo_update_licenses(enp)) != 0)
goto fail1;
return (0);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
__checkReturn efx_rc_t
efx_lic_get_key_stats(
__in efx_nic_t *enp,
__out efx_key_stats_t *eksp)
{
efx_lic_ops_t *elop = enp->en_elop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
if ((rc = elop->elo_get_key_stats(enp, eksp)) != 0)
goto fail1;
return (0);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
__checkReturn efx_rc_t
efx_lic_app_state(
__in efx_nic_t *enp,
__in uint64_t app_id,
__out boolean_t *licensedp)
{
efx_lic_ops_t *elop = enp->en_elop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
if (elop->elo_app_state == NULL) {
rc = ENOTSUP;
goto fail1;
}
if ((rc = elop->elo_app_state(enp, app_id, licensedp)) != 0)
goto fail2;
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
__checkReturn efx_rc_t
efx_lic_get_id(
__in efx_nic_t *enp,
__in size_t buffer_size,
__out uint32_t *typep,
__out size_t *lengthp,
__out_opt uint8_t *bufferp
)
{
efx_lic_ops_t *elop = enp->en_elop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
if (elop->elo_get_id == NULL) {
rc = ENOTSUP;
goto fail1;
}
if ((rc = elop->elo_get_id(enp, buffer_size, typep,
lengthp, bufferp)) != 0)
goto fail2;
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
#endif /* EFSYS_OPT_LICENSING */
-2
View File
@@ -31,9 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_impl.h"
#if EFSYS_OPT_MAC_FALCON_GMAC
+87 -20
View File
@@ -31,21 +31,37 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_regs_mcdi.h"
#include "efx_impl.h"
#if EFSYS_OPT_MCDI
/*
* There are three versions of the MCDI interface:
* - MCDIv0: Siena BootROM. Transport uses MCDIv1 headers.
* - MCDIv1: Siena firmware and Huntington BootROM.
* - MCDIv2: EF10 firmware (Huntington/Medford) and Medford BootROM.
* Transport uses MCDIv2 headers.
*
* MCDIv2 Header NOT_EPOCH flag
* ----------------------------
* A new epoch begins at initial startup or after an MC reboot, and defines when
* the MC should reject stale MCDI requests.
*
* The first MCDI request sent by the host should contain NOT_EPOCH=0, and all
* subsequent requests (until the next MC reboot) should contain NOT_EPOCH=1.
*
* After rebooting the MC will fail all requests with NOT_EPOCH=1 by writing a
* response with ERROR=1 and DATALEN=0 until a request is seen with NOT_EPOCH=0.
*/
#if EFSYS_OPT_SIENA
static efx_mcdi_ops_t __efx_mcdi_siena_ops = {
siena_mcdi_init, /* emco_init */
siena_mcdi_request_copyin, /* emco_request_copyin */
siena_mcdi_send_request, /* emco_send_request */
siena_mcdi_request_copyout, /* emco_request_copyout */
siena_mcdi_poll_reboot, /* emco_poll_reboot */
siena_mcdi_poll_response, /* emco_poll_response */
@@ -60,7 +76,7 @@ static efx_mcdi_ops_t __efx_mcdi_siena_ops = {
static efx_mcdi_ops_t __efx_mcdi_ef10_ops = {
ef10_mcdi_init, /* emco_init */
ef10_mcdi_request_copyin, /* emco_request_copyin */
ef10_mcdi_send_request, /* emco_send_request */
ef10_mcdi_request_copyout, /* emco_request_copyout */
ef10_mcdi_poll_reboot, /* emco_poll_reboot */
ef10_mcdi_poll_response, /* emco_poll_response */
@@ -183,16 +199,16 @@ efx_mcdi_new_epoch(
}
static void
efx_mcdi_request_copyin(
efx_mcdi_send_request(
__in efx_nic_t *enp,
__in efx_mcdi_req_t *emrp,
__in unsigned int seq,
__in boolean_t ev_cpl,
__in boolean_t new_epoch)
__in void *hdrp,
__in size_t hdr_len,
__in void *sdup,
__in size_t sdu_len)
{
efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
emcop->emco_request_copyin(enp, emrp, seq, ev_cpl, new_epoch);
emcop->emco_send_request(enp, hdrp, hdr_len, sdup, sdu_len);
}
static void
@@ -245,8 +261,15 @@ efx_mcdi_request_start(
__in efx_mcdi_req_t *emrp,
__in boolean_t ev_cpl)
{
#if EFSYS_OPT_MCDI_LOGGING
const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;
#endif
efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
efx_dword_t hdr[2];
size_t hdr_len;
unsigned int max_version;
unsigned int seq;
unsigned int xflags;
boolean_t new_epoch;
int state;
@@ -273,9 +296,60 @@ efx_mcdi_request_start(
emip->emi_poll_cnt = 0;
seq = emip->emi_seq++ & EFX_MASK32(MCDI_HEADER_SEQ);
new_epoch = emip->emi_new_epoch;
max_version = emip->emi_max_version;
EFSYS_UNLOCK(enp->en_eslp, state);
efx_mcdi_request_copyin(enp, emrp, seq, ev_cpl, new_epoch);
xflags = 0;
if (ev_cpl)
xflags |= MCDI_HEADER_XFLAGS_EVREQ;
/*
* Huntington firmware supports MCDIv2, but the Huntington BootROM only
* supports MCDIv1. Use MCDIv1 headers for MCDIv1 commands where
* possible to support this.
*/
if ((max_version >= 2) &&
((emrp->emr_cmd > MC_CMD_CMD_SPACE_ESCAPE_7) ||
(emrp->emr_in_length > MCDI_CTL_SDU_LEN_MAX_V1))) {
/* Construct MCDI v2 header */
hdr_len = sizeof (hdr);
EFX_POPULATE_DWORD_8(hdr[0],
MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
MCDI_HEADER_RESYNC, 1,
MCDI_HEADER_DATALEN, 0,
MCDI_HEADER_SEQ, seq,
MCDI_HEADER_NOT_EPOCH, new_epoch ? 0 : 1,
MCDI_HEADER_ERROR, 0,
MCDI_HEADER_RESPONSE, 0,
MCDI_HEADER_XFLAGS, xflags);
EFX_POPULATE_DWORD_2(hdr[1],
MC_CMD_V2_EXTN_IN_EXTENDED_CMD, emrp->emr_cmd,
MC_CMD_V2_EXTN_IN_ACTUAL_LEN, emrp->emr_in_length);
} else {
/* Construct MCDI v1 header */
hdr_len = sizeof (hdr[0]);
EFX_POPULATE_DWORD_8(hdr[0],
MCDI_HEADER_CODE, emrp->emr_cmd,
MCDI_HEADER_RESYNC, 1,
MCDI_HEADER_DATALEN, emrp->emr_in_length,
MCDI_HEADER_SEQ, seq,
MCDI_HEADER_NOT_EPOCH, new_epoch ? 0 : 1,
MCDI_HEADER_ERROR, 0,
MCDI_HEADER_RESPONSE, 0,
MCDI_HEADER_XFLAGS, xflags);
}
#if EFSYS_OPT_MCDI_LOGGING
if (emtp->emt_logger != NULL) {
emtp->emt_logger(emtp->emt_context, EFX_LOG_MCDI_REQUEST,
&hdr, hdr_len,
emrp->emr_in_buf, emrp->emr_in_length);
}
#endif /* EFSYS_OPT_MCDI_LOGGING */
efx_mcdi_send_request(enp, &hdr[0], hdr_len,
emrp->emr_in_buf, emrp->emr_in_length);
}
@@ -388,15 +462,8 @@ efx_mcdi_read_response_header(
return;
fail3:
if (!emrp->emr_quiet)
EFSYS_PROBE(fail3);
fail2:
if (!emrp->emr_quiet)
EFSYS_PROBE(fail2);
fail1:
if (!emrp->emr_quiet)
EFSYS_PROBE1(fail1, efx_rc_t, rc);
emrp->emr_rc = rc;
emrp->emr_out_length_used = 0;
}
+1 -2
View File
@@ -34,7 +34,6 @@
#define _SYS_EFX_MCDI_H
#include "efx.h"
#include "efx_regs.h"
#include "efx_regs_mcdi.h"
#ifdef __cplusplus
@@ -55,7 +54,7 @@ struct efx_mcdi_req_s {
uint8_t *emr_in_buf;
size_t emr_in_length;
/* Outputs: retcode, buffer, length, and length used*/
int emr_rc;
efx_rc_t emr_rc;
uint8_t *emr_out_buf;
size_t emr_out_length;
size_t emr_out_length_used;
-3
View File
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_impl.h"
#if EFSYS_OPT_MON_NULL
+57 -16
View File
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_impl.h"
__checkReturn efx_rc_t
@@ -247,6 +244,7 @@ efx_nic_biu_test(
static efx_nic_ops_t __efx_nic_falcon_ops = {
falcon_nic_probe, /* eno_probe */
NULL, /* eno_board_cfg */
NULL, /* eno_set_drv_limits */
falcon_nic_reset, /* eno_reset */
falcon_nic_init, /* eno_init */
@@ -266,6 +264,7 @@ static efx_nic_ops_t __efx_nic_falcon_ops = {
static efx_nic_ops_t __efx_nic_siena_ops = {
siena_nic_probe, /* eno_probe */
NULL, /* eno_board_cfg */
NULL, /* eno_set_drv_limits */
siena_nic_reset, /* eno_reset */
siena_nic_init, /* eno_init */
@@ -284,22 +283,44 @@ static efx_nic_ops_t __efx_nic_siena_ops = {
#if EFSYS_OPT_HUNTINGTON
static efx_nic_ops_t __efx_nic_hunt_ops = {
hunt_nic_probe, /* eno_probe */
hunt_nic_set_drv_limits, /* eno_set_drv_limits */
hunt_nic_reset, /* eno_reset */
hunt_nic_init, /* eno_init */
hunt_nic_get_vi_pool, /* eno_get_vi_pool */
hunt_nic_get_bar_region, /* eno_get_bar_region */
ef10_nic_probe, /* eno_probe */
hunt_board_cfg, /* eno_board_cfg */
ef10_nic_set_drv_limits, /* eno_set_drv_limits */
ef10_nic_reset, /* eno_reset */
ef10_nic_init, /* eno_init */
ef10_nic_get_vi_pool, /* eno_get_vi_pool */
ef10_nic_get_bar_region, /* eno_get_bar_region */
#if EFSYS_OPT_DIAG
ef10_sram_test, /* eno_sram_test */
hunt_nic_register_test, /* eno_register_test */
ef10_nic_register_test, /* eno_register_test */
#endif /* EFSYS_OPT_DIAG */
hunt_nic_fini, /* eno_fini */
hunt_nic_unprobe, /* eno_unprobe */
ef10_nic_fini, /* eno_fini */
ef10_nic_unprobe, /* eno_unprobe */
};
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
static efx_nic_ops_t __efx_nic_medford_ops = {
ef10_nic_probe, /* eno_probe */
medford_board_cfg, /* eno_board_cfg */
ef10_nic_set_drv_limits, /* eno_set_drv_limits */
ef10_nic_reset, /* eno_reset */
ef10_nic_init, /* eno_init */
ef10_nic_get_vi_pool, /* eno_get_vi_pool */
ef10_nic_get_bar_region, /* eno_get_bar_region */
#if EFSYS_OPT_DIAG
ef10_sram_test, /* eno_sram_test */
ef10_nic_register_test, /* eno_register_test */
#endif /* EFSYS_OPT_DIAG */
ef10_nic_fini, /* eno_fini */
ef10_nic_unprobe, /* eno_unprobe */
};
#endif /* EFSYS_OPT_MEDFORD */
__checkReturn efx_rc_t
efx_nic_create(
__in efx_family_t family,
@@ -360,10 +381,29 @@ efx_nic_create(
EFX_FEATURE_MAC_HEADER_FILTERS |
EFX_FEATURE_MCDI_DMA |
EFX_FEATURE_PIO_BUFFERS |
EFX_FEATURE_FW_ASSISTED_TSO;
EFX_FEATURE_FW_ASSISTED_TSO |
EFX_FEATURE_FW_ASSISTED_TSO_V2;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
enp->en_enop = (efx_nic_ops_t *)&__efx_nic_medford_ops;
/*
* FW_ASSISTED_TSO ommitted as Medford only supports firmware
* assisted TSO version 2, not the v1 scheme used on Huntington.
*/
enp->en_features =
EFX_FEATURE_IPV6 |
EFX_FEATURE_LINK_EVENTS |
EFX_FEATURE_PERIODIC_MAC_STATS |
EFX_FEATURE_MCDI |
EFX_FEATURE_MAC_HEADER_FILTERS |
EFX_FEATURE_MCDI_DMA |
EFX_FEATURE_PIO_BUFFERS;
break;
#endif /* EFSYS_OPT_MEDFORD */
default:
rc = ENOTSUP;
goto fail2;
@@ -668,8 +708,9 @@ efx_nic_reset(
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT(enp->en_mod_flags & EFX_MOD_PROBE);
/*
* All modules except the MCDI, PROBE, NVRAM, VPD, MON (which we
* do not reset here) must have been shut down or never initialized.
* All modules except the MCDI, PROBE, NVRAM, VPD, MON, LIC
* (which we do not reset here) must have been shut down or never
* initialized.
*
* A rule of thumb here is: If the controller or MC reboots, is *any*
* state lost. If it's lost and needs reapplying, then the module
@@ -677,7 +718,7 @@ efx_nic_reset(
*/
mod_flags = enp->en_mod_flags;
mod_flags &= ~(EFX_MOD_MCDI | EFX_MOD_PROBE | EFX_MOD_NVRAM |
EFX_MOD_VPD | EFX_MOD_MON);
EFX_MOD_VPD | EFX_MOD_MON | EFX_MOD_LIC);
EFSYS_ASSERT3U(mod_flags, ==, 0);
if (mod_flags != 0) {
rc = EINVAL;
+14 -7
View File
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_impl.h"
#if EFSYS_OPT_NVRAM
@@ -45,7 +42,6 @@ static efx_nvram_ops_t __efx_nvram_falcon_ops = {
#if EFSYS_OPT_DIAG
falcon_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
falcon_nvram_size, /* envo_size */
falcon_nvram_get_version, /* envo_get_version */
falcon_nvram_rw_start, /* envo_rw_start */
falcon_nvram_read_chunk, /* envo_read_chunk */
@@ -53,6 +49,8 @@ static efx_nvram_ops_t __efx_nvram_falcon_ops = {
falcon_nvram_write_chunk, /* envo_write_chunk */
falcon_nvram_rw_finish, /* envo_rw_finish */
falcon_nvram_set_version, /* envo_set_version */
falcon_nvram_type_to_partn, /* envo_type_to_partn */
falcon_nvram_partn_size, /* envo_partn_size */
};
#endif /* EFSYS_OPT_FALCON */
@@ -63,7 +61,6 @@ static efx_nvram_ops_t __efx_nvram_siena_ops = {
#if EFSYS_OPT_DIAG
siena_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
siena_nvram_size, /* envo_size */
siena_nvram_get_version, /* envo_get_version */
siena_nvram_rw_start, /* envo_rw_start */
siena_nvram_read_chunk, /* envo_read_chunk */
@@ -71,6 +68,8 @@ static efx_nvram_ops_t __efx_nvram_siena_ops = {
siena_nvram_write_chunk, /* envo_write_chunk */
siena_nvram_rw_finish, /* envo_rw_finish */
siena_nvram_set_version, /* envo_set_version */
siena_nvram_type_to_partn, /* envo_type_to_partn */
siena_nvram_partn_size, /* envo_partn_size */
};
#endif /* EFSYS_OPT_SIENA */
@@ -81,7 +80,6 @@ static efx_nvram_ops_t __efx_nvram_ef10_ops = {
#if EFSYS_OPT_DIAG
ef10_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
ef10_nvram_size, /* envo_size */
ef10_nvram_get_version, /* envo_get_version */
ef10_nvram_rw_start, /* envo_rw_start */
ef10_nvram_read_chunk, /* envo_read_chunk */
@@ -89,6 +87,8 @@ static efx_nvram_ops_t __efx_nvram_ef10_ops = {
ef10_nvram_write_chunk, /* envo_write_chunk */
ef10_nvram_rw_finish, /* envo_rw_finish */
ef10_nvram_set_version, /* envo_set_version */
ef10_nvram_type_to_partn, /* envo_type_to_partn */
ef10_nvram_partn_size, /* envo_partn_size */
};
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
@@ -178,6 +178,7 @@ efx_nvram_size(
__out size_t *sizep)
{
efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -185,13 +186,19 @@ efx_nvram_size(
EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
if ((rc = envop->envo_size(enp, type, sizep)) != 0)
if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0)
goto fail1;
if ((rc = envop->envo_partn_size(enp, partn, sizep)) != 0)
goto fail2;
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
*sizep = 0;
return (rc);
}
-3
View File
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_impl.h"
#if EFSYS_OPT_FALCON
#include "falcon_nvram.h"
-2
View File
@@ -31,9 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_impl.h"
__checkReturn efx_rc_t
+42
View File
@@ -429,6 +429,48 @@ extern "C" {
#define ESF_DZ_TX_TSO_TCP_SEQNO_WIDTH 32
/* TX_TSO_FATSO2A_DESC */
#define ESF_DZ_TX_DESC_IS_OPT_LBN 63
#define ESF_DZ_TX_DESC_IS_OPT_WIDTH 1
#define ESF_DZ_TX_OPTION_TYPE_LBN 60
#define ESF_DZ_TX_OPTION_TYPE_WIDTH 3
#define ESE_DZ_TX_OPTION_DESC_TSO 7
#define ESE_DZ_TX_OPTION_DESC_VLAN 6
#define ESE_DZ_TX_OPTION_DESC_CRC_CSUM 0
#define ESF_DZ_TX_TSO_OPTION_TYPE_LBN 56
#define ESF_DZ_TX_TSO_OPTION_TYPE_WIDTH 4
#define ESE_DZ_TX_TSO_OPTION_DESC_FATSO2B 3
#define ESE_DZ_TX_TSO_OPTION_DESC_FATSO2A 2
#define ESE_DZ_TX_TSO_OPTION_DESC_ENCAP 1
#define ESE_DZ_TX_TSO_OPTION_DESC_NORMAL 0
#define ESF_DZ_TX_TSO_IP_ID_LBN 32
#define ESF_DZ_TX_TSO_IP_ID_WIDTH 16
#define ESF_DZ_TX_TSO_TCP_SEQNO_LBN 0
#define ESF_DZ_TX_TSO_TCP_SEQNO_WIDTH 32
/* TX_TSO_FATSO2B_DESC */
#define ESF_DZ_TX_DESC_IS_OPT_LBN 63
#define ESF_DZ_TX_DESC_IS_OPT_WIDTH 1
#define ESF_DZ_TX_OPTION_TYPE_LBN 60
#define ESF_DZ_TX_OPTION_TYPE_WIDTH 3
#define ESE_DZ_TX_OPTION_DESC_TSO 7
#define ESE_DZ_TX_OPTION_DESC_VLAN 6
#define ESE_DZ_TX_OPTION_DESC_CRC_CSUM 0
#define ESF_DZ_TX_TSO_OPTION_TYPE_LBN 56
#define ESF_DZ_TX_TSO_OPTION_TYPE_WIDTH 4
#define ESE_DZ_TX_TSO_OPTION_DESC_FATSO2B 3
#define ESE_DZ_TX_TSO_OPTION_DESC_FATSO2A 2
#define ESE_DZ_TX_TSO_OPTION_DESC_ENCAP 1
#define ESE_DZ_TX_TSO_OPTION_DESC_NORMAL 0
#define ESF_DZ_TX_TSO_OUTER_IP_ID_LBN 16
#define ESF_DZ_TX_TSO_OUTER_IP_ID_WIDTH 16
#define ESF_DZ_TX_TSO_TCP_MSS_LBN 32
#define ESF_DZ_TX_TSO_TCP_MSS_WIDTH 16
#define ESF_DZ_TX_TSO_INNER_PE_CSUM_LBN 0
#define ESF_DZ_TX_TSO_INNER_PE_CSUM_WIDTH 16
/* ES_TX_VLAN_DESC */
#define ESF_DZ_TX_DESC_IS_OPT_LBN 63
#define ESF_DZ_TX_DESC_IS_OPT_WIDTH 1
+78 -191
View File
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_impl.h"
@@ -48,14 +45,6 @@ static void
falconsiena_rx_fini(
__in efx_nic_t *enp);
#if EFSYS_OPT_RX_HDR_SPLIT
static __checkReturn efx_rc_t
falconsiena_rx_hdr_split_enable(
__in efx_nic_t *enp,
__in unsigned int hdr_buf_size,
__in unsigned int pld_buf_size);
#endif /* EFSYS_OPT_RX_HDR_SPLIT */
#if EFSYS_OPT_RX_SCATTER
static __checkReturn efx_rc_t
falconsiena_rx_scatter_enable(
@@ -83,8 +72,20 @@ falconsiena_rx_scale_tbl_set(
__in_ecount(n) unsigned int *table,
__in size_t n);
static __checkReturn uint32_t
falconsiena_rx_prefix_hash(
__in efx_nic_t *enp,
__in efx_rx_hash_alg_t func,
__in uint8_t *buffer);
#endif /* EFSYS_OPT_RX_SCALE */
static __checkReturn efx_rc_t
falconsiena_rx_prefix_pktlen(
__in efx_nic_t *enp,
__in uint8_t *buffer,
__out uint16_t *lengthp);
static void
falconsiena_rx_qpost(
__in efx_rxq_t *erp,
@@ -131,9 +132,6 @@ falconsiena_rx_qdestroy(
static efx_rx_ops_t __efx_rx_falcon_ops = {
falconsiena_rx_init, /* erxo_init */
falconsiena_rx_fini, /* erxo_fini */
#if EFSYS_OPT_RX_HDR_SPLIT
falconsiena_rx_hdr_split_enable, /* erxo_hdr_split_enable */
#endif
#if EFSYS_OPT_RX_SCATTER
falconsiena_rx_scatter_enable, /* erxo_scatter_enable */
#endif
@@ -141,7 +139,9 @@ static efx_rx_ops_t __efx_rx_falcon_ops = {
falconsiena_rx_scale_mode_set, /* erxo_scale_mode_set */
falconsiena_rx_scale_key_set, /* erxo_scale_key_set */
falconsiena_rx_scale_tbl_set, /* erxo_scale_tbl_set */
falconsiena_rx_prefix_hash, /* erxo_prefix_hash */
#endif
falconsiena_rx_prefix_pktlen, /* erxo_prefix_pktlen */
falconsiena_rx_qpost, /* erxo_qpost */
falconsiena_rx_qpush, /* erxo_qpush */
falconsiena_rx_qflush, /* erxo_qflush */
@@ -155,9 +155,6 @@ static efx_rx_ops_t __efx_rx_falcon_ops = {
static efx_rx_ops_t __efx_rx_siena_ops = {
falconsiena_rx_init, /* erxo_init */
falconsiena_rx_fini, /* erxo_fini */
#if EFSYS_OPT_RX_HDR_SPLIT
falconsiena_rx_hdr_split_enable, /* erxo_hdr_split_enable */
#endif
#if EFSYS_OPT_RX_SCATTER
falconsiena_rx_scatter_enable, /* erxo_scatter_enable */
#endif
@@ -165,7 +162,9 @@ static efx_rx_ops_t __efx_rx_siena_ops = {
falconsiena_rx_scale_mode_set, /* erxo_scale_mode_set */
falconsiena_rx_scale_key_set, /* erxo_scale_key_set */
falconsiena_rx_scale_tbl_set, /* erxo_scale_tbl_set */
falconsiena_rx_prefix_hash, /* erxo_prefix_hash */
#endif
falconsiena_rx_prefix_pktlen, /* erxo_prefix_pktlen */
falconsiena_rx_qpost, /* erxo_qpost */
falconsiena_rx_qpush, /* erxo_qpush */
falconsiena_rx_qflush, /* erxo_qflush */
@@ -179,9 +178,6 @@ static efx_rx_ops_t __efx_rx_siena_ops = {
static efx_rx_ops_t __efx_rx_ef10_ops = {
ef10_rx_init, /* erxo_init */
ef10_rx_fini, /* erxo_fini */
#if EFSYS_OPT_RX_HDR_SPLIT
ef10_rx_hdr_split_enable, /* erxo_hdr_split_enable */
#endif
#if EFSYS_OPT_RX_SCATTER
ef10_rx_scatter_enable, /* erxo_scatter_enable */
#endif
@@ -189,7 +185,9 @@ static efx_rx_ops_t __efx_rx_ef10_ops = {
ef10_rx_scale_mode_set, /* erxo_scale_mode_set */
ef10_rx_scale_key_set, /* erxo_scale_key_set */
ef10_rx_scale_tbl_set, /* erxo_scale_tbl_set */
ef10_rx_prefix_hash, /* erxo_prefix_hash */
#endif
ef10_rx_prefix_pktlen, /* erxo_prefix_pktlen */
ef10_rx_qpost, /* erxo_qpost */
ef10_rx_qpush, /* erxo_qpush */
ef10_rx_qflush, /* erxo_qflush */
@@ -289,32 +287,6 @@ efx_rx_fini(
enp->en_mod_flags &= ~EFX_MOD_RX;
}
#if EFSYS_OPT_RX_HDR_SPLIT
__checkReturn efx_rc_t
efx_rx_hdr_split_enable(
__in efx_nic_t *enp,
__in unsigned int hdr_buf_size,
__in unsigned int pld_buf_size)
{
efx_rx_ops_t *erxop = enp->en_erxop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_RX);
EFSYS_ASSERT3U(enp->en_family, >=, EFX_FAMILY_SIENA);
if ((rc = erxop->erxo_hdr_split_enable(enp, hdr_buf_size,
pld_buf_size)) != 0)
goto fail1;
return (0);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
#endif /* EFSYS_OPT_RX_HDR_SPLIT */
#if EFSYS_OPT_RX_SCATTER
__checkReturn efx_rc_t
efx_rx_scatter_enable(
@@ -596,92 +568,29 @@ efx_rx_qdestroy(
erxop->erxo_qdestroy(erp);
}
/*
* Psuedo-header info for Siena/Falcon.
*
* The psuedo-header is a byte array of one of the forms:
*
* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
* XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.TT.TT.TT.TT
* XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.XX.LL.LL
*
* where:
*
* TT.TT.TT.TT is a 32-bit Toeplitz hash
* LL.LL is a 16-bit LFSR hash
*
* Hash values are in network (big-endian) byte order.
*
*
* On EF10 the pseudo-header is laid out as:
* (See also SF-109306-TC section 9)
*
* Toeplitz hash (32 bits, little-endian)
* Out-of-band outer VLAN tag
* (16 bits, big-endian, 0 if the packet did not have an outer VLAN tag)
* Out-of-band inner VLAN tag
* (16 bits, big-endian, 0 if the packet did not have an inner VLAN tag)
* Packet length (16 bits, little-endian, may be 0)
* MAC timestamp (32 bits, little-endian, may be 0)
* VLAN tag
* (16 bits, big-endian, 0 if the packet did not have an outer VLAN tag)
* VLAN tag
* (16 bits, big-endian, 0 if the packet did not have an inner VLAN tag)
*/
__checkReturn efx_rc_t
efx_psuedo_hdr_pkt_length_get(
__in efx_nic_t *enp,
__in uint8_t *buffer,
__out uint16_t *pkt_lengthp)
__out uint16_t *lengthp)
{
if (enp->en_family != EFX_FAMILY_HUNTINGTON &&
enp->en_family != EFX_FAMILY_MEDFORD) {
EFSYS_ASSERT(0);
return (ENOTSUP);
}
efx_rx_ops_t *erxop = enp->en_erxop;
*pkt_lengthp = buffer[8] | (buffer[9] << 8);
return (0);
return (erxop->erxo_prefix_pktlen(enp, buffer, lengthp));
}
#if EFSYS_OPT_RX_SCALE
uint32_t
__checkReturn uint32_t
efx_psuedo_hdr_hash_get(
__in efx_nic_t *enp,
__in efx_rx_hash_alg_t func,
__in uint8_t *buffer)
{
if (func == EFX_RX_HASHALG_TOEPLITZ) {
switch (enp->en_family) {
case EFX_FAMILY_FALCON:
case EFX_FAMILY_SIENA:
return ((buffer[12] << 24) |
(buffer[13] << 16) |
(buffer[14] << 8) |
buffer[15]);
case EFX_FAMILY_HUNTINGTON:
case EFX_FAMILY_MEDFORD:
return (buffer[0] |
(buffer[1] << 8) |
(buffer[2] << 16) |
(buffer[3] << 24));
default:
EFSYS_ASSERT(0);
return (0);
}
} else if (func == EFX_RX_HASHALG_LFSR) {
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_FALCON ||
enp->en_family == EFX_FAMILY_SIENA);
return ((buffer[14] << 8) | buffer[15]);
} else {
EFSYS_ASSERT(0);
return (0);
}
}
efx_rx_ops_t *erxop = enp->en_erxop;
EFSYS_ASSERT3U(enp->en_hash_support, ==, EFX_RX_HASH_AVAILABLE);
return (erxop->erxo_prefix_hash(enp, func, buffer));
}
#endif /* EFSYS_OPT_RX_SCALE */
#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
@@ -722,60 +631,6 @@ falconsiena_rx_init(
return (0);
}
#if EFSYS_OPT_RX_HDR_SPLIT
static __checkReturn efx_rc_t
falconsiena_rx_hdr_split_enable(
__in efx_nic_t *enp,
__in unsigned int hdr_buf_size,
__in unsigned int pld_buf_size)
{
unsigned int nhdr32;
unsigned int npld32;
efx_oword_t oword;
efx_rc_t rc;
nhdr32 = hdr_buf_size / 32;
if ((nhdr32 == 0) ||
(nhdr32 >= (1 << FRF_CZ_RX_HDR_SPLIT_HDR_BUF_SIZE_WIDTH)) ||
((hdr_buf_size % 32) != 0)) {
rc = EINVAL;
goto fail1;
}
npld32 = pld_buf_size / 32;
if ((npld32 == 0) ||
(npld32 >= (1 << FRF_CZ_RX_HDR_SPLIT_PLD_BUF_SIZE_WIDTH)) ||
((pld_buf_size % 32) != 0)) {
rc = EINVAL;
goto fail2;
}
if (enp->en_rx_qcount > 0) {
rc = EBUSY;
goto fail3;
}
EFX_BAR_READO(enp, FR_AZ_RX_CFG_REG, &oword);
EFX_SET_OWORD_FIELD(oword, FRF_CZ_RX_HDR_SPLIT_EN, 1);
EFX_SET_OWORD_FIELD(oword, FRF_CZ_RX_HDR_SPLIT_HDR_BUF_SIZE, nhdr32);
EFX_SET_OWORD_FIELD(oword, FRF_CZ_RX_HDR_SPLIT_PLD_BUF_SIZE, npld32);
EFX_BAR_WRITEO(enp, FR_AZ_RX_CFG_REG, &oword);
return (0);
fail3:
EFSYS_PROBE(fail3);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
#endif /* EFSYS_OPT_RX_HDR_SPLIT */
#if EFSYS_OPT_RX_SCATTER
static __checkReturn efx_rc_t
falconsiena_rx_scatter_enable(
@@ -1123,6 +978,58 @@ falconsiena_rx_scale_tbl_set(
}
#endif
/*
* Falcon/Siena psuedo-header
* --------------------------
*
* Receive packets are prefixed by an optional 16 byte pseudo-header.
* The psuedo-header is a byte array of one of the forms:
*
* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
* xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.TT.TT.TT.TT
* xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.LL.LL
*
* where:
* TT.TT.TT.TT Toeplitz hash (32-bit big-endian)
* LL.LL LFSR hash (16-bit big-endian)
*/
#if EFSYS_OPT_RX_SCALE
static __checkReturn uint32_t
falconsiena_rx_prefix_hash(
__in efx_nic_t *enp,
__in efx_rx_hash_alg_t func,
__in uint8_t *buffer)
{
switch (func) {
case EFX_RX_HASHALG_TOEPLITZ:
return ((buffer[12] << 24) |
(buffer[13] << 16) |
(buffer[14] << 8) |
buffer[15]);
case EFX_RX_HASHALG_LFSR:
return ((buffer[14] << 8) | buffer[15]);
default:
EFSYS_ASSERT(0);
return (0);
}
}
#endif /* EFSYS_OPT_RX_SCALE */
static __checkReturn efx_rc_t
falconsiena_rx_prefix_pktlen(
__in efx_nic_t *enp,
__in uint8_t *buffer,
__out uint16_t *lengthp)
{
/* Not supported by Falcon/Siena hardware */
EFSYS_ASSERT(0);
return (ENOTSUP);
}
static void
falconsiena_rx_qpost(
__in efx_rxq_t *erp,
@@ -1279,26 +1186,6 @@ falconsiena_rx_qcreate(
jumbo = B_FALSE;
break;
#if EFSYS_OPT_RX_HDR_SPLIT
case EFX_RXQ_TYPE_SPLIT_HEADER:
if ((enp->en_family < EFX_FAMILY_SIENA) || ((index & 1) != 0)) {
rc = EINVAL;
goto fail4;
}
split = B_TRUE;
jumbo = B_TRUE;
break;
case EFX_RXQ_TYPE_SPLIT_PAYLOAD:
if ((enp->en_family < EFX_FAMILY_SIENA) || ((index & 1) == 0)) {
rc = EINVAL;
goto fail4;
}
split = B_FALSE;
jumbo = B_TRUE;
break;
#endif /* EFSYS_OPT_RX_HDR_SPLIT */
#if EFSYS_OPT_RX_SCATTER
case EFX_RXQ_TYPE_SCATTER:
if (enp->en_family < EFX_FAMILY_SIENA) {
-3
View File
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_impl.h"
__checkReturn efx_rc_t
+22 -3
View File
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_impl.h"
#if EFSYS_OPT_QSTATS
@@ -145,6 +142,7 @@ static efx_tx_ops_t __efx_tx_falcon_ops = {
falconsiena_tx_qdesc_post, /* etxo_qdesc_post */
falconsiena_tx_qdesc_dma_create, /* etxo_qdesc_dma_create */
NULL, /* etxo_qdesc_tso_create */
NULL, /* etxo_qdesc_tso2_create */
NULL, /* etxo_qdesc_vlantci_create */
#if EFSYS_OPT_QSTATS
falconsiena_tx_qstats_update, /* etxo_qstats_update */
@@ -170,6 +168,7 @@ static efx_tx_ops_t __efx_tx_siena_ops = {
falconsiena_tx_qdesc_post, /* etxo_qdesc_post */
falconsiena_tx_qdesc_dma_create, /* etxo_qdesc_dma_create */
NULL, /* etxo_qdesc_tso_create */
NULL, /* etxo_qdesc_tso2_create */
NULL, /* etxo_qdesc_vlantci_create */
#if EFSYS_OPT_QSTATS
falconsiena_tx_qstats_update, /* etxo_qstats_update */
@@ -195,6 +194,7 @@ static efx_tx_ops_t __efx_tx_hunt_ops = {
ef10_tx_qdesc_post, /* etxo_qdesc_post */
ef10_tx_qdesc_dma_create, /* etxo_qdesc_dma_create */
hunt_tx_qdesc_tso_create, /* etxo_qdesc_tso_create */
ef10_tx_qdesc_tso2_create, /* etxo_qdesc_tso2_create */
ef10_tx_qdesc_vlantci_create, /* etxo_qdesc_vlantci_create */
#if EFSYS_OPT_QSTATS
ef10_tx_qstats_update, /* etxo_qstats_update */
@@ -220,6 +220,7 @@ static efx_tx_ops_t __efx_tx_medford_ops = {
ef10_tx_qdesc_post, /* etxo_qdesc_post */
ef10_tx_qdesc_dma_create, /* etxo_qdesc_dma_create */
NULL, /* etxo_qdesc_tso_create */
ef10_tx_qdesc_tso2_create, /* etxo_qdesc_tso2_create */
ef10_tx_qdesc_vlantci_create, /* etxo_qdesc_vlantci_create */
#if EFSYS_OPT_QSTATS
ef10_tx_qstats_update, /* etxo_qstats_update */
@@ -643,6 +644,24 @@ efx_tx_qdesc_tso_create(
etxop->etxo_qdesc_tso_create(etp, ipv4_id, tcp_seq, tcp_flags, edp);
}
void
efx_tx_qdesc_tso2_create(
__in efx_txq_t *etp,
__in uint16_t ipv4_id,
__in uint32_t tcp_seq,
__in uint16_t mss,
__out_ecount(count) efx_desc_t *edp,
__in int count)
{
efx_nic_t *enp = etp->et_enp;
efx_tx_ops_t *etxop = enp->en_etxop;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
EFSYS_ASSERT(etxop->etxo_qdesc_tso2_create != NULL);
etxop->etxo_qdesc_tso2_create(etp, ipv4_id, tcp_seq, mss, edp, count);
}
void
efx_tx_qdesc_vlantci_create(
__in efx_txq_t *etp,
+1 -1
View File
@@ -536,7 +536,7 @@ extern int fix_lint;
(_oword).eo_u32[3]) == ~((uint32_t)0))
#define EFX_QWORD_IS_SET64(_qword) \
(((_qword).eq_u64[0]) == ~((uint32_t)0))
(((_qword).eq_u64[0]) == ~((uint64_t)0))
#define EFX_QWORD_IS_SET32(_qword) \
(((_qword).eq_u32[0] & \
+11 -11
View File
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_impl.h"
#if EFSYS_OPT_VPD
@@ -672,7 +669,7 @@ efx_vpd_hunk_next(
__in size_t size,
__out efx_vpd_tag_t *tagp,
__out efx_vpd_keyword_t *keywordp,
__out_bcount_opt(*paylenp) unsigned int *payloadp,
__out_opt unsigned int *payloadp,
__out_opt uint8_t *paylenp,
__inout unsigned int *contp)
{
@@ -692,12 +689,18 @@ efx_vpd_hunk_next(
if ((rc = efx_vpd_next_tag(data, size, &offset,
&tag, &taglen)) != 0)
goto fail1;
if (tag == EFX_VPD_END)
if (tag == EFX_VPD_END) {
keyword = 0;
paylen = 0;
index = 0;
break;
}
if (tag == EFX_VPD_ID) {
if (index == *contp) {
if (index++ == *contp) {
EFSYS_ASSERT3U(taglen, <, 0x100);
keyword = 0;
paylen = (uint8_t)MIN(taglen, 0xff);
goto done;
@@ -708,7 +711,7 @@ efx_vpd_hunk_next(
taglen, pos, &keyword, &keylen)) != 0)
goto fail2;
if (index == *contp) {
if (index++ == *contp) {
offset += pos + 3;
paylen = keylen;
@@ -720,9 +723,6 @@ efx_vpd_hunk_next(
offset += taglen;
}
*contp = 0;
return (0);
done:
*tagp = tag;
*keywordp = keyword;
@@ -731,7 +731,7 @@ efx_vpd_hunk_next(
if (paylenp != NULL)
*paylenp = paylen;
++(*contp);
*contp = index;
return (0);
fail2:
-2
View File
@@ -31,9 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_impl.h"
#if EFSYS_OPT_WOL
+3 -6
View File
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs.h"
#include "efx_impl.h"
#if EFSYS_OPT_MON_STATS
#include "mcdi_mon.h"
@@ -447,9 +444,9 @@ ef10_ev_qmoderate(
eep->ee_index, &dword, 0);
} else {
EFX_POPULATE_DWORD_2(dword,
FRF_CZ_TC_TIMER_MODE, mode,
FRF_CZ_TC_TIMER_VAL, timer_val);
EFX_BAR_TBL_WRITED(enp, FR_BZ_TIMER_COMMAND_REGP0,
ERF_DZ_TC_TIMER_MODE, mode,
ERF_DZ_TC_TIMER_VAL, timer_val);
EFX_BAR_TBL_WRITED(enp, ER_DZ_EVQ_TMR_REG,
eep->ee_index, &dword, 0);
}
-3
View File
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_types.h"
#include "efx_regs_mcdi.h"
#include "efx_impl.h"
#if EFSYS_OPT_HUNTINGTON
+64 -40
View File
@@ -52,7 +52,14 @@ extern "C" {
/* Alignment requirement for value written to RX WPTR:
* the WPTR must be aligned to an 8 descriptor boundary
*/
#define HUNTINGTON_RX_WPTR_ALIGN 8
#define EF10_RX_WPTR_ALIGN 8
/*
* Max byte offset into the packet the TCP header must start for the hardware
* to be able to parse the packet correctly.
* FIXME: Move to ef10_impl.h when it is included in all driver builds.
*/
#define EF10_TCP_HEADER_OFFSET_LIMIT 208
/* Invalid RSS context handle */
#define EF10_RSS_CONTEXT_INVALID (0xffffffff)
@@ -161,48 +168,52 @@ ef10_intr_fini(
/* NIC */
extern __checkReturn efx_rc_t
hunt_nic_probe(
ef10_nic_probe(
__in efx_nic_t *enp);
extern __checkReturn efx_rc_t
hunt_nic_set_drv_limits(
hunt_board_cfg(
__in efx_nic_t *enp);
extern __checkReturn efx_rc_t
ef10_nic_set_drv_limits(
__inout efx_nic_t *enp,
__in efx_drv_limits_t *edlp);
extern __checkReturn efx_rc_t
hunt_nic_get_vi_pool(
ef10_nic_get_vi_pool(
__in efx_nic_t *enp,
__out uint32_t *vi_countp);
extern __checkReturn efx_rc_t
hunt_nic_get_bar_region(
ef10_nic_get_bar_region(
__in efx_nic_t *enp,
__in efx_nic_region_t region,
__out uint32_t *offsetp,
__out size_t *sizep);
extern __checkReturn efx_rc_t
hunt_nic_reset(
ef10_nic_reset(
__in efx_nic_t *enp);
extern __checkReturn efx_rc_t
hunt_nic_init(
ef10_nic_init(
__in efx_nic_t *enp);
#if EFSYS_OPT_DIAG
extern __checkReturn efx_rc_t
hunt_nic_register_test(
ef10_nic_register_test(
__in efx_nic_t *enp);
#endif /* EFSYS_OPT_DIAG */
extern void
hunt_nic_fini(
ef10_nic_fini(
__in efx_nic_t *enp);
extern void
hunt_nic_unprobe(
ef10_nic_unprobe(
__in efx_nic_t *enp);
@@ -276,12 +287,12 @@ ef10_mcdi_fini(
__in efx_nic_t *enp);
extern void
ef10_mcdi_request_copyin(
ef10_mcdi_send_request(
__in efx_nic_t *enp,
__in efx_mcdi_req_t *emrp,
__in unsigned int seq,
__in boolean_t ev_cpl,
__in boolean_t new_epoch);
__in void *hdrp,
__in size_t hdr_len,
__in void *sdup,
__in size_t sdu_len);
extern __checkReturn boolean_t
ef10_mcdi_poll_response(
@@ -290,7 +301,7 @@ ef10_mcdi_poll_response(
extern void
ef10_mcdi_read_response(
__in efx_nic_t *enp,
__out void *bufferp,
__out_bcount(length) void *bufferp,
__in size_t offset,
__in size_t length);
@@ -358,12 +369,6 @@ ef10_nvram_partn_write_segment_tlv(
__in size_t size,
__in boolean_t all_segments);
extern __checkReturn efx_rc_t
ef10_nvram_partn_size(
__in efx_nic_t *enp,
__in uint32_t partn,
__out size_t *sizep);
extern __checkReturn efx_rc_t
ef10_nvram_partn_lock(
__in efx_nic_t *enp,
@@ -409,12 +414,6 @@ ef10_nvram_test(
#endif /* EFSYS_OPT_DIAG */
extern __checkReturn efx_rc_t
ef10_nvram_size(
__in efx_nic_t *enp,
__in efx_nvram_type_t type,
__out size_t *sizep);
extern __checkReturn efx_rc_t
ef10_nvram_get_version(
__in efx_nic_t *enp,
@@ -466,6 +465,18 @@ ef10_nvram_set_version(
__in efx_nvram_type_t type,
__in_ecount(4) uint16_t version[4]);
extern __checkReturn efx_rc_t
ef10_nvram_type_to_partn(
__in efx_nic_t *enp,
__in efx_nvram_type_t type,
__out uint32_t *partnp);
extern __checkReturn efx_rc_t
ef10_nvram_partn_size(
__in efx_nic_t *enp,
__in uint32_t partn,
__out size_t *sizep);
#endif /* EFSYS_OPT_NVRAM */
@@ -689,6 +700,15 @@ hunt_tx_qdesc_tso_create(
__in uint8_t tcp_flags,
__out efx_desc_t *edp);
extern void
ef10_tx_qdesc_tso2_create(
__in efx_txq_t *etp,
__in uint16_t ipv4_id,
__in uint32_t tcp_seq,
__in uint16_t tcp_mss,
__out_ecount(count) efx_desc_t *edp,
__in int count);
extern void
ef10_tx_qdesc_vlantci_create(
__in efx_txq_t *etp,
@@ -747,7 +767,7 @@ typedef uint32_t efx_piobuf_handle_t;
#define EFX_PIOBUF_HANDLE_INVALID ((efx_piobuf_handle_t) -1)
extern __checkReturn efx_rc_t
hunt_nic_pio_alloc(
ef10_nic_pio_alloc(
__inout efx_nic_t *enp,
__out uint32_t *bufnump,
__out efx_piobuf_handle_t *handlep,
@@ -756,19 +776,19 @@ hunt_nic_pio_alloc(
__out size_t *sizep);
extern __checkReturn efx_rc_t
hunt_nic_pio_free(
ef10_nic_pio_free(
__inout efx_nic_t *enp,
__in uint32_t bufnum,
__in uint32_t blknum);
extern __checkReturn efx_rc_t
hunt_nic_pio_link(
ef10_nic_pio_link(
__inout efx_nic_t *enp,
__in uint32_t vi_index,
__in efx_piobuf_handle_t handle);
extern __checkReturn efx_rc_t
hunt_nic_pio_unlink(
ef10_nic_pio_unlink(
__inout efx_nic_t *enp,
__in uint32_t vi_index);
@@ -845,14 +865,6 @@ extern __checkReturn efx_rc_t
ef10_rx_init(
__in efx_nic_t *enp);
#if EFSYS_OPT_RX_HDR_SPLIT
extern __checkReturn efx_rc_t
ef10_rx_hdr_split_enable(
__in efx_nic_t *enp,
__in unsigned int hdr_buf_size,
__in unsigned int pld_buf_size);
#endif /* EFSYS_OPT_RX_HDR_SPLIT */
#if EFSYS_OPT_RX_SCATTER
extern __checkReturn efx_rc_t
ef10_rx_scatter_enable(
@@ -882,8 +894,20 @@ ef10_rx_scale_tbl_set(
__in_ecount(n) unsigned int *table,
__in size_t n);
extern __checkReturn uint32_t
ef10_rx_prefix_hash(
__in efx_nic_t *enp,
__in efx_rx_hash_alg_t func,
__in uint8_t *buffer);
#endif /* EFSYS_OPT_RX_SCALE */
extern __checkReturn efx_rc_t
ef10_rx_prefix_pktlen(
__in efx_nic_t *enp,
__in uint8_t *buffer,
__out uint16_t *lengthp);
extern void
ef10_rx_qpost(
__in efx_rxq_t *erp,
-1
View File
@@ -31,7 +31,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_impl.h"
-1
View File
@@ -31,7 +31,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_impl.h"
+20 -104
View File
@@ -31,7 +31,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "efsys.h"
#include "efx.h"
#include "efx_impl.h"
@@ -44,37 +43,6 @@ __FBSDID("$FreeBSD$");
#error "WITH_MCDI_V2 required for EF10 MCDIv2 commands."
#endif
typedef enum efx_mcdi_header_type_e {
EFX_MCDI_HEADER_TYPE_V1, /* MCDIv0 (BootROM), MCDIv1 commands */
EFX_MCDI_HEADER_TYPE_V2, /* MCDIv2 commands */
} efx_mcdi_header_type_t;
/*
* Return the header format to use for sending an MCDI request.
*
* An MCDIv1 (Siena compatible) command should use MCDIv2 encapsulation if the
* request input buffer or response output buffer are too large for the MCDIv1
* format. An MCDIv2 command must always be sent using MCDIv2 encapsulation.
*/
#define EFX_MCDI_HEADER_TYPE(_cmd, _length) \
((((_cmd) & ~EFX_MASK32(MCDI_HEADER_CODE)) || \
((_length) & ~EFX_MASK32(MCDI_HEADER_DATALEN))) ? \
EFX_MCDI_HEADER_TYPE_V2 : EFX_MCDI_HEADER_TYPE_V1)
/*
* MCDI Header NOT_EPOCH flag
* ==========================
* A new epoch begins at initial startup or after an MC reboot, and defines when
* the MC should reject stale MCDI requests.
*
* The first MCDI request sent by the host should contain NOT_EPOCH=0, and all
* subsequent requests (until the next MC reboot) should contain NOT_EPOCH=1.
*
* After rebooting the MC will fail all requests with NOT_EPOCH=1 by writing a
* response with ERROR=1 and DATALEN=0 until a request is seen with NOT_EPOCH=0.
*/
__checkReturn efx_rc_t
ef10_mcdi_init(
@@ -141,96 +109,44 @@ ef10_mcdi_fini(
}
void
ef10_mcdi_request_copyin(
ef10_mcdi_send_request(
__in efx_nic_t *enp,
__in efx_mcdi_req_t *emrp,
__in unsigned int seq,
__in boolean_t ev_cpl,
__in boolean_t new_epoch)
__in void *hdrp,
__in size_t hdr_len,
__in void *sdup,
__in size_t sdu_len)
{
const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;
efsys_mem_t *esmp = emtp->emt_dma_mem;
efx_mcdi_header_type_t hdr_type;
efx_dword_t dword;
efx_dword_t hdr[2];
unsigned int xflags;
unsigned int pos;
size_t offset;
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
enp->en_family == EFX_FAMILY_MEDFORD);
xflags = 0;
if (ev_cpl)
xflags |= MCDI_HEADER_XFLAGS_EVREQ;
offset = 0;
hdr_type = EFX_MCDI_HEADER_TYPE(emrp->emr_cmd,
MAX(emrp->emr_in_length, emrp->emr_out_length));
if (hdr_type == EFX_MCDI_HEADER_TYPE_V2) {
/* Construct MCDI v2 header */
EFX_POPULATE_DWORD_8(hdr[0],
MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
MCDI_HEADER_RESYNC, 1,
MCDI_HEADER_DATALEN, 0,
MCDI_HEADER_SEQ, seq,
MCDI_HEADER_NOT_EPOCH, new_epoch ? 0 : 1,
MCDI_HEADER_ERROR, 0,
MCDI_HEADER_RESPONSE, 0,
MCDI_HEADER_XFLAGS, xflags);
EFSYS_MEM_WRITED(esmp, offset, &hdr[0]);
offset += sizeof (efx_dword_t);
EFX_POPULATE_DWORD_2(hdr[1],
MC_CMD_V2_EXTN_IN_EXTENDED_CMD, emrp->emr_cmd,
MC_CMD_V2_EXTN_IN_ACTUAL_LEN, emrp->emr_in_length);
EFSYS_MEM_WRITED(esmp, offset, &hdr[1]);
offset += sizeof (efx_dword_t);
} else {
/* Construct MCDI v1 header */
EFX_POPULATE_DWORD_8(hdr[0],
MCDI_HEADER_CODE, emrp->emr_cmd,
MCDI_HEADER_RESYNC, 1,
MCDI_HEADER_DATALEN, emrp->emr_in_length,
MCDI_HEADER_SEQ, seq,
MCDI_HEADER_NOT_EPOCH, new_epoch ? 0 : 1,
MCDI_HEADER_ERROR, 0,
MCDI_HEADER_RESPONSE, 0,
MCDI_HEADER_XFLAGS, xflags);
EFSYS_MEM_WRITED(esmp, 0, &hdr[0]);
offset += sizeof (efx_dword_t);
/* Write the header */
for (pos = 0; pos < hdr_len; pos += sizeof (efx_dword_t)) {
dword = *(efx_dword_t *)((uint8_t *)hdrp + pos);
EFSYS_MEM_WRITED(esmp, pos, &dword);
}
#if EFSYS_OPT_MCDI_LOGGING
if (emtp->emt_logger != NULL) {
emtp->emt_logger(emtp->emt_context, EFX_LOG_MCDI_REQUEST,
&hdr, offset,
emrp->emr_in_buf, emrp->emr_in_length);
/* Write the payload */
for (pos = 0; pos < sdu_len; pos += sizeof (efx_dword_t)) {
dword = *(efx_dword_t *)((uint8_t *)sdup + pos);
EFSYS_MEM_WRITED(esmp, hdr_len + pos, &dword);
}
#endif /* EFSYS_OPT_MCDI_LOGGING */
/* Construct the payload */
for (pos = 0; pos < emrp->emr_in_length; pos += sizeof (efx_dword_t)) {
memcpy(&dword, MCDI_IN(*emrp, efx_dword_t, pos),
MIN(sizeof (dword), emrp->emr_in_length - pos));
EFSYS_MEM_WRITED(esmp, offset + pos, &dword);
}
/* Ring the doorbell to post the command DMA address to the MC */
EFSYS_ASSERT((EFSYS_MEM_ADDR(esmp) & 0xFF) == 0);
/* Guarantee ordering of memory (MCDI request) and PIO (MC doorbell) */
EFSYS_DMA_SYNC_FOR_DEVICE(esmp, 0, offset + emrp->emr_in_length);
EFSYS_DMA_SYNC_FOR_DEVICE(esmp, 0, hdr_len + sdu_len);
EFSYS_PIO_WRITE_BARRIER();
EFX_POPULATE_DWORD_1(dword,
EFX_DWORD_0, EFSYS_MEM_ADDR(esmp) >> 32);
/* Ring the doorbell to post the command DMA address to the MC */
EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0,
EFSYS_MEM_ADDR(esmp) >> 32);
EFX_BAR_WRITED(enp, ER_DZ_MC_DB_LWRD_REG, &dword, B_FALSE);
EFX_POPULATE_DWORD_1(dword,
EFX_DWORD_0, EFSYS_MEM_ADDR(esmp) & 0xffffffff);
EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0,
EFSYS_MEM_ADDR(esmp) & 0xffffffff);
EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE);
}
@@ -293,7 +209,7 @@ ef10_mcdi_poll_response(
void
ef10_mcdi_read_response(
__in efx_nic_t *enp,
__out void *bufferp,
__out_bcount(length) void *bufferp,
__in size_t offset,
__in size_t length)
{

Some files were not shown because too many files have changed in this diff Show More