Merge ^/head r293686 through r293849.

This commit is contained in:
Dimitry Andric 2016-01-13 20:16:53 +00:00
commit ea2c42d8d3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang380-import/; revision=293850
235 changed files with 4365 additions and 2241 deletions

View File

@ -569,7 +569,7 @@ _worldtmp: .PHONY
.endif
.else
rm -rf ${WORLDTMP}/legacy/usr/include
# XXX - These three can depend on any header file.
# XXX - These can depend on any header file.
rm -f ${OBJTREE}${.CURDIR}/lib/libsysdecode/ioctl.c
rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
.endif

View File

@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20160113:
With the addition of ypldap(8), a new _ypldap user is now required
during installworld. "mergemaster -p" can be used to add the user
prior to installworld, as documented in the handbook.
20151216:
The tftp loader (pxeboot) now uses the option root-path directive. As a
consequence it no longer looks for a pxeboot.4th file on the tftp

View File

@ -22,5 +22,6 @@ uucp:*:66:66::0:0:UUCP pseudo-user:/var/spool/uucppublic:/usr/local/libexec/uucp
pop:*:68:6::0:0:Post Office Owner:/nonexistent:/usr/sbin/nologin
auditdistd:*:78:77::0:0:Auditdistd unprivileged user:/var/empty:/usr/sbin/nologin
www:*:80:80::0:0:World Wide Web Owner:/nonexistent:/usr/sbin/nologin
_ypldap:*:93:93::0:0:YP Ldap unprivileged user:/var/empty:/usr/sbin/nologin
hast:*:845:845::0:0:HAST unprivileged user:/var/empty:/usr/sbin/nologin
nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin

View File

@ -376,6 +376,32 @@
..
file
..
geom
class
concat
..
eli
..
gate
..
gpt
..
mirror
..
nop
..
raid3
..
shsec
..
stripe
..
uzip
etalon
..
..
..
..
kern
acct
..

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 */

View File

@ -483,7 +483,7 @@ svcunix_create(int sock, u_int sendsize, u_int recvsize, char *path)
break;
}
if (nconf == NULL)
return(xprt);
goto done;
if ((sock = __rpc_nconf2fd(nconf)) < 0)
goto done;

View File

@ -661,11 +661,11 @@ __rpcbind_is_up(void)
strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0)
break;
}
endnetconfig(localhandle);
if (nconf == NULL)
return (FALSE);
endnetconfig(localhandle);
memset(&sun, 0, sizeof sun);
sock = _socket(AF_LOCAL, SOCK_STREAM, 0);
if (sock < 0)

View File

@ -207,14 +207,14 @@ xdr_rpcb_entry_list_ptr(XDR *xdrs, rpcb_entry_list_ptr *rp)
* the case of freeing we must remember the next object
* before we free the current object ...
*/
if (freeing)
if (freeing && *rp)
next = (*rp)->rpcb_entry_next;
if (! xdr_reference(xdrs, (caddr_t *)rp,
(u_int)sizeof (rpcb_entry_list),
(xdrproc_t)xdr_rpcb_entry)) {
return (FALSE);
}
if (freeing && *rp) {
if (freeing) {
next_copy = next;
rp = &next_copy;
/*

View File

@ -42,8 +42,11 @@ futimens(int fd, const struct timespec times[2])
{
struct timeval now, tv[2], *tvp;
struct stat sb;
int osreldate;
if (__getosreldate() >= 1100056)
osreldate = __getosreldate();
if (osreldate >= 1100056 ||
(osreldate >= 1002506 && osreldate < 1100000))
return (__sys_futimens(fd, times));
if (times == NULL || (times[0].tv_nsec == UTIME_NOW &&

View File

@ -31,7 +31,7 @@
.\" @(#)utimes.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd January 23, 2015
.Dd January 12, 2016
.Dt UTIMENSAT 2
.Os
.Sh NAME
@ -289,4 +289,4 @@ The
and
.Fn utimensat
system calls appeared in
.Fx 11.0 .
.Fx 10.3 .

View File

@ -42,8 +42,11 @@ utimensat(int fd, const char *path, const struct timespec times[2], int flag)
{
struct timeval now, tv[2], *tvp;
struct stat sb;
int osreldate;
if (__getosreldate() >= 1100056)
osreldate = __getosreldate();
if (osreldate >= 1100056 ||
(osreldate >= 1002506 && osreldate < 1100000))
return (__sys_utimensat(fd, path, times, flag));
if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) {

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 */

View File

@ -51,7 +51,7 @@ ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL}
@echo "--------------------------------------------------------------"
@false
.endif
/usr/local/bin/bsdec2-image-upload ${PUBLISH} \
/usr/local/bin/bsdec2-image-upload ${PUBLISH} --sriov \
${.OBJDIR}/ec2.raw \
"${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \
"${TYPE} ${REVISION}-${BRANCH}-${TARGET}" \

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

View File

@ -0,0 +1,40 @@
$FreeBSD$
domain "freebsd.org"
interval 60
provide map "passwd.byname"
provide map "passwd.byuid"
provide map "group.byname"
provide map "group.bygid"
provide map "netid.byname"
directory "127.0.0.1" {
# directory options
binddn "cn=ldap,dc=freebsd,dc=org"
bindcred "secret"
basedn "dc=freebsd.,dc=org"
# starting point for groups directory search, default to basedn
groupdn "ou=Groups,dc=freebsd,dc=org"
# passwd maps configuration (RFC 2307 posixAccount object class)
passwd filter "(objectClass=posixAccount)"
attribute name maps to "uid"
fixed attribute passwd "*"
attribute uid maps to "uidNumber"
attribute gid maps to "gidNumber"
attribute gecos maps to "cn"
attribute home maps to "homeDirectory"
attribute shell maps to "loginShell"
fixed attribute change "0"
fixed attribute expire "0"
fixed attribute class ""
# group maps configuration (RFC 2307 posixGroup object class)
group filter "(objectClass=posixGroup)"
attribute groupname maps to "cn"
fixed attribute grouppasswd "*"
attribute groupgid maps to "gidNumber"
# memberUid returns multiple group members
list groupmembers maps to "memberUid"
}

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd August 10, 2015
.Dd December 9, 2015
.Dt UART 4
.Os
.Sh NAME
@ -160,7 +160,9 @@ The API, accessed via
is available on the tty device.
To use the PPS capture feature with
.Xr ntpd 8 ,
symlink the tty device to
symlink the tty callout device
.Va /dev/cuau?
to
.Va /dev/pps0.
.Pp
The
@ -175,15 +177,54 @@ it can be set in
.Xr loader.conf 5
or
.Xr sysctl.conf 5 .
.Pp
The following capture modes are available:
.Bl -tag -compact -offset "mmmm" -width "mmmm"
.It 0
.It 0x00
Capture disabled.
.It 1
.It 0x01
Capture pulses on the CTS line.
.It 2
Capture pulses on the DCD line (default).
.It 0x02
Capture pulses on the DCD line.
.El
.Pp
The following values may be ORed with the capture mode to configure
capture processing options:
.Bl -tag -compact -offset "mmmm" -width "mmmm"
.It 0x10
Invert the pulse (RS-232 logic low = ASSERT, high = CLEAR).
.It 0x20
Attempt to capture narrow pulses.
.El
.Pp
Add the narrow pulse option when the incoming PPS pulse width is small
enough to prevent reliable capture in normal mode.
In narrow mode the driver uses the hardware's ability to latch a line
state change; not all hardware has this capability.
The hardware latch provides a reliable indication that a pulse occurred,
but prevents distinguishing between the CLEAR and ASSERT edges of the pulse.
For each detected pulse, the driver synthesizes both an ASSERT and a CLEAR
event, using the same timestamp for each.
To prevent spurious events when the hardware is intermittently able to
see both edges of a pulse, the driver will not generate a new pair of
events within a half second of the prior pair.
Both normal and narrow pulse modes work with
.Xr ntpd 8 .
.Pp
Add the invert option when the connection to the uart device uses TTL
level signals, or when the PPS source emits inverted pulses.
RFC 2783 defines an ASSERT event as a higher-voltage line level, and a CLEAR
event as a lower-voltage line level, in the context of the RS-232 protocol.
The modem control signals on a TTL-level connection are typically
inverted from the RS-232 levels.
For example, carrier presence is indicated by a high signal on an RS-232
DCD line, and by a low signal on a TTL DCD line.
This is due to the use of inverting line driver buffers to convert between
TTL and RS-232 line levels in most hardware designs.
Generally speaking, a connection to a DB-9 style connector is an RS-232
level signal at up to 12 volts.
A connection to header pins or an edge-connector on an embedded board
is typically a TTL signal at 3.3 or 5 volts.
.Sh FILES
.Bl -tag -width ".Pa /dev/ttyu?.init" -compact
.It Pa /dev/ttyu?

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]);

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);

View File

@ -1109,7 +1109,7 @@ pmap_bootstrap(vm_offset_t firstaddr)
* mapping of pages.
*/
#define SYSMAP(c, p, v, n) do { \
v = (c)pmap_preboot_reserve_pages(1); \
v = (c)pmap_preboot_reserve_pages(n); \
p = pt2map_entry((vm_offset_t)v); \
} while (0)

View File

@ -67,7 +67,7 @@ cpu_flush_dcache(const void *ptr, size_t len)
cl_size = get_dcache_line_size();
/* Calculate end address to clean */
end = (vm_offset_t)(ptr + len);
end = (vm_offset_t)ptr + (vm_offset_t)len;
/* Align start address to cache line */
addr = (vm_offset_t)ptr;
addr = rounddown2(addr, cl_size);

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);

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);
}

View File

@ -886,7 +886,7 @@ __elfN(parse_modmetadata)(struct preloaded_file *fp, elf_file_t ef,
error = __elfN(reloc_ptr)(fp, ef, v, &md, sizeof(md));
if (error == EOPNOTSUPP) {
md.md_cval += ef->off;
md.md_data += ef->off;
md.md_data = (void *)((uintptr_t)md.md_data + ef->off);
} else if (error != 0)
return (error);
#endif

View File

@ -520,10 +520,8 @@ __elfN(obj_symaddr)(struct elf_file *ef, Elf_Size symidx)
{
Elf_Sym sym;
Elf_Addr base;
int symcnt;
symcnt = ef->e_shdr[ef->symtabindex].sh_size / sizeof(Elf_Sym);
if (symidx >= symcnt)
if (symidx >= ef->e_shdr[ef->symtabindex].sh_size / sizeof(Elf_Sym))
return (0);
COPYOUT(ef->e_shdr[ef->symtabindex].sh_addr + symidx * sizeof(Elf_Sym),
&sym, sizeof(sym));

View File

@ -118,7 +118,6 @@ kern_bzero(vm_offset_t dest, size_t len)
int
kern_pread(int fd, vm_offset_t dest, size_t len, off_t off)
{
ssize_t nread;
if (lseek(fd, off, SEEK_SET) == -1) {
#ifdef DEBUG
@ -126,8 +125,7 @@ kern_pread(int fd, vm_offset_t dest, size_t len, off_t off)
#endif
return (-1);
}
nread = archsw.arch_readin(fd, dest, len);
if (nread != len) {
if ((size_t)archsw.arch_readin(fd, dest, len) != len) {
#ifdef DEBUG
printf("\nreadin failed\n");
#endif
@ -144,7 +142,6 @@ void *
alloc_pread(int fd, off_t off, size_t len)
{
void *buf;
ssize_t nread;
buf = malloc(len);
if (buf == NULL) {
@ -160,8 +157,7 @@ alloc_pread(int fd, off_t off, size_t len)
free(buf);
return (NULL);
}
nread = read(fd, buf, len);
if (nread != len) {
if ((size_t)read(fd, buf, len) != len) {
#ifdef DEBUG
printf("\nread failed\n");
#endif

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) {
@ -126,7 +126,7 @@ command_load(int argc, char *argv[])
case '?':
default:
/* getopt has already reported an error */
return(CMD_OK);
return (CMD_OK);
}
}
argv += (optind - 1);
@ -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);
@ -983,7 +996,7 @@ moduledir_rebuild(void)
{
struct moduledir *mdp, *mtmp;
const char *path, *cp, *ep;
int cplen;
size_t cplen;
path = getenv("module_path");
if (path == NULL)

View File

@ -102,7 +102,7 @@ static struct parttypes {
const char *
parttype2str(enum partition_type type)
{
int i;
size_t i;
for (i = 0; i < sizeof(ptypes) / sizeof(ptypes[0]); i++)
if (ptypes[i].type == type)
@ -203,7 +203,7 @@ gpt_checktbl(const struct gpt_hdr *hdr, u_char *tbl, size_t size,
uint64_t lba_last)
{
struct gpt_ent *ent;
int i, cnt;
uint32_t i, cnt;
cnt = size / hdr->hdr_entsz;
if (hdr->hdr_entries <= cnt) {
@ -234,8 +234,8 @@ ptable_gptread(struct ptable *table, void *dev, diskread_t dread)
struct gpt_ent *ent;
u_char *buf, *tbl;
uint64_t offset;
int pri, sec, i;
size_t size;
int pri, sec;
size_t size, i;
buf = malloc(table->sectorsize);
if (buf == NULL)
@ -358,7 +358,7 @@ mbr_parttype(uint8_t type)
return (PART_UNKNOWN);
}
struct ptable*
static struct ptable*
ptable_ebrread(struct ptable *table, void *dev, diskread_t dread)
{
struct dos_partition *dp;
@ -436,7 +436,7 @@ bsd_parttype(uint8_t type)
return (PART_UNKNOWN);
}
struct ptable*
static struct ptable*
ptable_bsdread(struct ptable *table, void *dev, diskread_t dread)
{
struct disklabel *dl;

View File

@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$");
#define RELOC_TYPE_RELATIVE R_386_RELATIVE
#endif
void self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic);
/*
* A simple elf relocator.
*/
@ -118,6 +120,6 @@ self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic)
/* XXX: do we need other relocations ? */
break;
}
rel = (ElfW_Rel *) ((caddr_t) rel + relent);
rel = (ElfW_Rel *)(void *)((caddr_t) rel + relent);
}
}

View File

@ -207,7 +207,7 @@ fsread(ufs_ino_t inode, void *buf, size_t nbyte)
#endif
) &&
fs.fs_bsize <= MAXBSIZE &&
fs.fs_bsize >= sizeof(struct fs))
fs.fs_bsize >= (int32_t)sizeof(struct fs))
break;
}
if (sblock_try[n] == -1) {
@ -231,10 +231,10 @@ fsread(ufs_ino_t inode, void *buf, size_t nbyte)
sizeof(struct ufs2_dinode));
#else
if (fs.fs_magic == FS_UFS1_MAGIC)
memcpy(&dp1, (struct ufs1_dinode *)blkbuf + n,
memcpy(&dp1, (struct ufs1_dinode *)(void *)blkbuf + n,
sizeof(struct ufs1_dinode));
else
memcpy(&dp2, (struct ufs2_dinode *)blkbuf + n,
memcpy(&dp2, (struct ufs2_dinode *)(void *)blkbuf + n,
sizeof(struct ufs2_dinode));
#endif
inomap = inode;
@ -283,7 +283,7 @@ fsread(ufs_ino_t inode, void *buf, size_t nbyte)
return -1;
vbaddr = fsbtodb(&fs, addr2) + (off >> VBLKSHIFT) * DBPERVBLK;
vboff = off & VBLKMASK;
n = sblksize(&fs, size, lbn) - (off & ~VBLKMASK);
n = sblksize(&fs, (off_t)size, lbn) - (off & ~VBLKMASK);
if (n > VBLKSIZE)
n = VBLKSIZE;
if (blkmap != vbaddr) {

View File

@ -11,6 +11,7 @@ MK_SSP= no
PROG= boot1.sym
INTERNALPROG=
WARNS?= 6
# architecture-specific loader code
SRCS= boot1.c self_reloc.c start.S

View File

@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
void panic(const char *fmt, ...) __dead2;
void putchar(int c);
EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab);
static int domount(EFI_DEVICE_PATH *device, EFI_BLOCK_IO *blkio, int quiet);
static void load(const char *fname);
@ -62,7 +63,7 @@ EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab)
EFI_BOOT_SERVICES *BS;
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl = NULL;
SIMPLE_TEXT_OUTPUT_INTERFACE *conout = NULL;
char *path = _PATH_LOADER;
const char *path = _PATH_LOADER;
systab = Xsystab;
image = Ximage;
@ -157,7 +158,6 @@ fsstat(ufs_ino_t inode)
{
#ifndef UFS2_ONLY
static struct ufs1_dinode dp1;
ufs1_daddr_t addr1;
#endif
#ifndef UFS1_ONLY
static struct ufs2_dinode dp2;
@ -166,11 +166,8 @@ fsstat(ufs_ino_t inode)
static ufs_ino_t inomap;
char *blkbuf;
void *indbuf;
size_t n, nb, size, off, vboff;
ufs_lbn_t lbn;
ufs2_daddr_t addr2, vbaddr;
size_t n, size;
static ufs2_daddr_t blkmap, indmap;
u_int u;
blkbuf = dmadat->blkbuf;
indbuf = dmadat->indbuf;
@ -194,7 +191,7 @@ fsstat(ufs_ino_t inode)
#endif
) &&
fs.fs_bsize <= MAXBSIZE &&
fs.fs_bsize >= sizeof(struct fs))
fs.fs_bsize >= (int32_t)sizeof(struct fs))
break;
}
if (sblock_try[n] == -1) {
@ -218,10 +215,10 @@ fsstat(ufs_ino_t inode)
sizeof(struct ufs2_dinode));
#else
if (fs.fs_magic == FS_UFS1_MAGIC)
memcpy(&dp1, (struct ufs1_dinode *)blkbuf + n,
memcpy(&dp1, (struct ufs1_dinode *)(void *)blkbuf + n,
sizeof(struct ufs1_dinode));
else
memcpy(&dp2, (struct ufs2_dinode *)blkbuf + n,
memcpy(&dp2, (struct ufs2_dinode *)(void *)blkbuf + n,
sizeof(struct ufs2_dinode));
#endif
inomap = inode;

View File

@ -6,6 +6,7 @@
LIB= efi_fdt
INTERNALLIB=
WARNS?= 6
SRCS= efi_fdt.c

View File

@ -44,7 +44,6 @@ int
fdt_platform_load_dtb(void)
{
struct fdt_header *hdr;
int err;
hdr = efi_get_table(&fdtdtb);
if (hdr != NULL) {
@ -54,7 +53,7 @@ fdt_platform_load_dtb(void)
}
}
return (err);
return (1);
}
void

View File

@ -127,7 +127,6 @@ typedef uint64_t UINTN;
#define BAD_POINTER 0xFBFBFBFBFBFBFBFB
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF
#pragma intrinsic (__break)
#define BREAKPOINT() __break(0)
//
@ -180,7 +179,6 @@ typedef uint64_t UINTN;
// BugBug: Need to find out if this is portable accross compliers.
//
void __mfa (void);
#pragma intrinsic (__mfa)
#define MEMORY_FENCE() __mfa()
#ifdef EFI_NO_INTERFACE_DECL

View File

@ -26,9 +26,9 @@ Revision history:
--*/
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL \
{ 0xE18541CD, 0xF755, 0x4f73, 0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29 }
{ 0xE18541CD, 0xF755, 0x4f73, {0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29} }
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_31 \
{ 0x1ACED566, 0x76ED, 0x4218, 0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89 }
{ 0x1ACED566, 0x76ED, 0x4218, {0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89} }
#define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION 0x00010000
#define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION_31 0x00010001

View File

@ -214,8 +214,8 @@ VOID
// EFI platform varibles
//
#define EFI_GLOBAL_VARIABLE \
{ 0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C }
#define EFI_GLOBAL_VARIABLE \
{ 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} }
// Variable attributes
#define EFI_VARIABLE_NON_VOLATILE 0x00000001
@ -363,8 +363,8 @@ EFI_STATUS
// Image handle
#define LOADED_IMAGE_PROTOCOL \
{ 0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }
#define LOADED_IMAGE_PROTOCOL \
{ 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
#define EFI_LOADED_IMAGE_INFORMATION_REVISION 0x1000
typedef struct {
@ -827,35 +827,35 @@ typedef struct {
// EFI Configuration Table and GUID definitions
//
#define MPS_TABLE_GUID \
{ 0xeb9d2d2f, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
#define MPS_TABLE_GUID \
{ 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define ACPI_TABLE_GUID \
{ 0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
#define ACPI_TABLE_GUID \
{ 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define ACPI_20_TABLE_GUID \
{ 0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }
#define ACPI_20_TABLE_GUID \
{ 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
#define SMBIOS_TABLE_GUID \
{ 0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
#define SMBIOS_TABLE_GUID \
{ 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define SAL_SYSTEM_TABLE_GUID \
{ 0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
#define SAL_SYSTEM_TABLE_GUID \
{ 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define FDT_TABLE_GUID \
{ 0xb1b621d5, 0xf19c, 0x41a5, 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 }
#define FDT_TABLE_GUID \
{ 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} }
#define DXE_SERVICES_TABLE_GUID \
{ 0x5ad34ba, 0x6f02, 0x4214, 0x95, 0x2e, 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9 }
#define DXE_SERVICES_TABLE_GUID \
{ 0x5ad34ba, 0x6f02, 0x4214, {0x95, 0x2e, 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9} }
#define HOB_LIST_TABLE_GUID \
{ 0x7739f24c, 0x93d7, 0x11d4, 0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
#define HOB_LIST_TABLE_GUID \
{ 0x7739f24c, 0x93d7, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define MEMORY_TYPE_INFORMATION_TABLE_GUID \
{ 0x4c19049f, 0x4137, 0x4dd3, 0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa }
{ 0x4c19049f, 0x4137, 0x4dd3, {0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa} }
#define DEBUG_IMAGE_INFO_TABLE_GUID \
{ 0x49152e77, 0x1ada, 0x4764, 0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b }
{ 0x49152e77, 0x1ada, 0x4764, {0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b} }
typedef struct _EFI_CONFIGURATION_TABLE {
EFI_GUID VendorGuid;

View File

@ -32,7 +32,7 @@ Revision History
//
#define SIMPLE_TEXT_OUTPUT_PROTOCOL \
{ 0x387477c2, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
{ 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
INTERFACE_DECL(_SIMPLE_TEXT_OUTPUT_INTERFACE);
@ -239,8 +239,8 @@ typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE {
// Text input protocol
//
#define SIMPLE_TEXT_INPUT_PROTOCOL \
{ 0x387477c1, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
#define SIMPLE_TEXT_INPUT_PROTOCOL \
{ 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
INTERFACE_DECL(_SIMPLE_INPUT_INTERFACE);

View File

@ -35,7 +35,7 @@
#define _EFI_CONS_CTL_H
#define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \
{ 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} }
{ 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} }
typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL EFI_CONSOLE_CONTROL_PROTOCOL;

View File

@ -110,7 +110,7 @@ typedef struct _VENDOR_DEVICE_PATH {
} VENDOR_DEVICE_PATH;
#define UNKNOWN_DEVICE_GUID \
{ 0xcf31fac5, 0xc24e, 0x11d2, 0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b }
{ 0xcf31fac5, 0xc24e, 0x11d2, {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} }
typedef struct _UKNOWN_DEVICE_VENDOR_DP {
VENDOR_DEVICE_PATH DevicePath;
@ -274,16 +274,16 @@ typedef struct _UART_DEVICE_PATH {
/* Use VENDOR_DEVICE_PATH struct */
#define DEVICE_PATH_MESSAGING_PC_ANSI \
{ 0xe0c14753, 0xf9be, 0x11d2, 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
{ 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define DEVICE_PATH_MESSAGING_VT_100 \
{ 0xdfa66065, 0xb419, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
{ 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define DEVICE_PATH_MESSAGING_VT_100_PLUS \
{ 0x7baec70b, 0x57e0, 0x4c76, 0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43 }
{ 0x7baec70b, 0x57e0, 0x4c76, {0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43} }
#define DEVICE_PATH_MESSAGING_VT_UTF8 \
{ 0xad15a0d6, 0x8bec, 0x4acf, 0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 }
{ 0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88} }
#define MEDIA_DEVICE_PATH 0x04

View File

@ -31,7 +31,7 @@ Revision History
#define EFIWARN(a) (a)
#define EFI_ERROR(a) (((INTN) a) < 0)
#define EFI_ERROR_CODE(a) (a & ~EFI_ERROR_MASK)
#define EFI_ERROR_CODE(a) (unsigned long)(a & ~EFI_ERROR_MASK)
#define EFI_SUCCESS 0

View File

@ -7,7 +7,7 @@
*/
#define EFI_INTEL_FPSWA \
{ 0xc41b6531, 0x97b9, 0x11d3, 0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
{ 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
INTERFACE_DECL(_FPSWA_INTERFACE);

View File

@ -27,9 +27,8 @@ Revision History
#ifndef _EFIGOP_H
#define _EFIGOP_H
#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
{ 0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, \
0x51, 0x6a }
#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
{ 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a} }
INTERFACE_DECL(_EFI_GRAPHICS_OUTPUT);

View File

@ -50,3 +50,4 @@ time_t efi_time(EFI_TIME *);
EFI_STATUS main(int argc, CHAR16 *argv[]);
void exit(EFI_STATUS status);
void delay(int usecs);

View File

@ -29,7 +29,7 @@ Revision History
//
#define EFI_SIMPLE_NETWORK_PROTOCOL \
{ 0xA19832B9, 0xAC25, 0x11D3, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }
{ 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
INTERFACE_DECL(_EFI_SIMPLE_NETWORK);

View File

@ -21,9 +21,7 @@
/// Global ID for the PCI I/O Protocol
///
#define EFI_PCI_IO_PROTOCOL_GUID \
{ \
0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a } \
}
{ 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a} }
typedef struct _EFI_PCI_IO_PROTOCOL EFI_PCI_IO_PROTOCOL;

View File

@ -31,8 +31,8 @@ Revision History
// Device Path protocol
//
#define DEVICE_PATH_PROTOCOL \
{ 0x9576e91, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
#define DEVICE_PATH_PROTOCOL \
{ 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
//
@ -40,7 +40,7 @@ Revision History
//
#define BLOCK_IO_PROTOCOL \
{ 0x964e5b21, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
{ 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
#define EFI_BLOCK_IO_INTERFACE_REVISION 0x00010000
INTERFACE_DECL(_EFI_BLOCK_IO);
@ -116,7 +116,7 @@ typedef struct _EFI_BLOCK_IO {
//
#define DISK_IO_PROTOCOL \
{ 0xce345171, 0xba0b, 0x11d2, 0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
{ 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
#define EFI_DISK_IO_INTERFACE_REVISION 0x00010000
INTERFACE_DECL(_EFI_DISK_IO);
@ -155,7 +155,7 @@ typedef struct _EFI_DISK_IO {
//
#define SIMPLE_FILE_SYSTEM_PROTOCOL \
{ 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
{ 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
INTERFACE_DECL(_EFI_FILE_IO_INTERFACE);
INTERFACE_DECL(_EFI_FILE_HANDLE);
@ -290,8 +290,8 @@ typedef struct _EFI_FILE_HANDLE {
// File information types
//
#define EFI_FILE_INFO_ID \
{ 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
#define EFI_FILE_INFO_ID \
{ 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
typedef struct {
UINT64 Size;
@ -314,8 +314,8 @@ typedef struct {
#define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName)
#define EFI_FILE_SYSTEM_INFO_ID \
{ 0x9576e93, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
#define EFI_FILE_SYSTEM_INFO_ID \
{ 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
typedef struct {
UINT64 Size;
@ -336,8 +336,8 @@ typedef struct {
#define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel)
#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \
{ 0xDB47D7D3,0xFE81, 0x11d3, 0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }
#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \
{ 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
typedef struct {
CHAR16 VolumeLabel[1];
@ -351,7 +351,7 @@ typedef struct {
#define LOAD_FILE_PROTOCOL \
{ 0x56EC3091, 0x954C, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }
{ 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE);
@ -375,7 +375,7 @@ typedef struct _EFI_LOAD_FILE_INTERFACE {
//
#define DEVICE_IO_PROTOCOL \
{ 0xaf6ac311, 0x84c3, 0x11d2, 0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
{ 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE);
@ -485,7 +485,7 @@ typedef struct _EFI_DEVICE_IO_INTERFACE {
//
#define UNICODE_COLLATION_PROTOCOL \
{ 0x1d85cd7f, 0xf43d, 0x11d2, 0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
{ 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
#define UNICODE_BYTE_ORDER_MARK (CHAR16)(0xfeff)

View File

@ -32,7 +32,7 @@ Revision History
//
#define EFI_PXE_BASE_CODE_PROTOCOL \
{ 0x03c4e603, 0xac28, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
{ 0x03c4e603, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
INTERFACE_DECL(_EFI_PXE_BASE_CODE);
@ -425,7 +425,7 @@ typedef struct _EFI_PXE_BASE_CODE {
//
#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL \
{ 0x245dca21, 0xfb7b, 0x11d3, 0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
{ 0x245dca21, 0xfb7b, 0x11d3, {0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
//
// Revision Number

View File

@ -30,7 +30,7 @@ Revision History
//
#define SERIAL_IO_PROTOCOL \
{ 0xBB25CF6F, 0xF1D4, 0x11D2, 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD }
{ 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD} }
INTERFACE_DECL(_SERIAL_IO_INTERFACE);

View File

@ -22,9 +22,7 @@
#define __UGA_DRAW_H__
#define EFI_UGA_DRAW_PROTOCOL_GUID \
{ \
0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \
}
{ 0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39} }
typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL;

View File

@ -2,6 +2,7 @@
LIB= efi
INTERNALLIB=
WARNS?= 2
SRCS= delay.c efi_console.c efinet.c efipart.c errno.c handles.c \
libefi.c time.c

View File

@ -47,6 +47,8 @@ static int esc;
void get_pos(int *x, int *y);
void curs_move(int *_x, int *_y, int x, int y);
static void CL(int);
void HO(void);
void end_term(void);
#endif
static void efi_cons_probe(struct console *);

View File

@ -67,7 +67,6 @@ efipart_init(void)
EFI_HANDLE *hin, *hout, *aliases, handle;
EFI_STATUS status;
UINTN sz;
CHAR16 *path;
u_int n, nin, nout;
int err;
size_t devpathlen;

View File

@ -179,7 +179,7 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table)
argv = malloc((argc + 1) * sizeof(CHAR16*));
argc = 0;
if (addprog)
argv[argc++] = L"loader.efi";
argv[argc++] = (CHAR16 *)L"loader.efi";
argp = args;
while (argp != NULL && *argp != 0) {
argp = arg_skipsep(argp);

View File

@ -11,6 +11,7 @@ MK_SSP= no
PROG= loader.sym
INTERNALPROG=
WARNS?= 3
# architecture-specific loader code
SRCS= autoload.c \

View File

@ -100,7 +100,6 @@ elf64_exec(struct preloaded_file *fp)
ACPI_TABLE_RSDP *rsdp;
char buf[24];
int revision;
EFI_STATUS status;
rsdp = efi_get_table(&acpi20_guid);
if (rsdp == NULL) {

View File

@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$");
#include <efipciio.h>
#include <machine/metadata.h>
#include "framebuffer.h"
static EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
static EFI_GUID pciio_guid = EFI_PCI_IO_PROTOCOL_GUID;
static EFI_GUID uga_guid = EFI_UGA_DRAW_PROTOCOL_GUID;
@ -270,7 +272,7 @@ efifb_from_uga(struct efi_fb *efifb, EFI_UGA_DRAW_PROTOCOL *uga)
char *ev, *p;
EFI_STATUS status;
ssize_t offset;
uint64_t fbaddr, fbsize;
uint64_t fbaddr;
uint32_t horiz, vert, stride;
uint32_t np, depth, refresh;

View File

@ -44,8 +44,9 @@ __FBSDID("$FreeBSD$");
#include "loader_efi.h"
extern vm_offset_t md_load(char *, vm_offset_t *);
extern int bi_load(char *, vm_offset_t *, vm_offset_t *);
int
static int
__elfN(arm_load)(char *filename, u_int64_t dest,
struct preloaded_file **result)
{
@ -58,7 +59,7 @@ __elfN(arm_load)(char *filename, u_int64_t dest,
return (0);
}
int
static int
__elfN(arm_exec)(struct preloaded_file *fp)
{
struct file_metadata *fmp;
@ -66,7 +67,6 @@ __elfN(arm_exec)(struct preloaded_file *fp)
Elf_Ehdr *e;
int error;
void (*entry)(void *);
EFI_STATUS status;
if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL)
return (EFTYPE);

View File

@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include "platform/acfreebsd.h"
#include "acconfig.h"
#define ACPI_SYSTEM_XFACE
#define ACPI_USE_SYSTEM_INTTYPES
#include "actypes.h"
#include "actbl.h"
@ -74,8 +75,6 @@ elf64_exec(struct preloaded_file *fp)
size_t clean_size;
struct file_metadata *md;
ACPI_TABLE_RSDP *rsdp;
EFI_STATUS status;
EFI_PHYSICAL_ADDRESS addr;
Elf_Ehdr *ehdr;
char buf[24];
int err, revision;
@ -119,8 +118,8 @@ elf64_exec(struct preloaded_file *fp)
return (err);
/* Clean D-cache under kernel area and invalidate whole I-cache */
clean_addr = efi_translate(fp->f_addr);
clean_size = efi_translate(kernendp) - clean_addr;
clean_addr = (vm_offset_t)efi_translate(fp->f_addr);
clean_size = (vm_offset_t)efi_translate(kernendp) - clean_addr;
cpu_flush_dcache((void *)clean_addr, clean_size);
cpu_inval_icache(NULL, 0);

View File

@ -27,6 +27,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "loader_efi.h"
int
efi_autoload(void)
{

View File

@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$");
#include <fdt_platform.h>
#endif
int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp);
extern EFI_SYSTEM_TABLE *ST;
static const char howto_switches[] = "aCdrgDmphsv";
@ -122,7 +124,7 @@ bi_copyenv(vm_offset_t start)
/* Traverse the environment. */
for (ep = environ; ep != NULL; ep = ep->ev_next) {
len = strlen(ep->ev_name);
if (archsw.arch_copyin(ep->ev_name, addr, len) != len)
if ((size_t)archsw.arch_copyin(ep->ev_name, addr, len) != len)
break;
addr += len;
if (archsw.arch_copyin("=", addr, 1) != 1)
@ -130,7 +132,7 @@ bi_copyenv(vm_offset_t start)
addr++;
if (ep->ev_value != NULL) {
len = strlen(ep->ev_value);
if (archsw.arch_copyin(ep->ev_value, addr, len) != len)
if ((size_t)archsw.arch_copyin(ep->ev_value, addr, len) != len)
break;
addr += len;
}
@ -351,7 +353,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp)
#endif
#if defined(__arm__)
vm_offset_t vaddr;
int i;
size_t i;
/*
* These metadata addreses must be converted for kernel after
* relocation.

View File

@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
#include <efi.h>
#include <efilib.h>
#include "loader_efi.h"
#ifndef EFI_STAGING_SIZE
#define EFI_STAGING_SIZE 48
#endif

View File

@ -31,11 +31,13 @@ __FBSDID("$FreeBSD$");
#include <stand.h>
#include <string.h>
#include <sys/disklabel.h>
#include "bootstrap.h"
#include <bootstrap.h>
#include <efi.h>
#include <efilib.h>
#include "loader_efi.h"
static int efi_parsedev(struct devdesc **, const char *, const char **);
/*

View File

@ -31,6 +31,8 @@
#ifndef _LOADER_EFI_COPY_H_
#define _LOADER_EFI_COPY_H_
#include <stand.h>
int efi_autoload(void);
int efi_getdev(void **vdev, const char *devspec, const char **path);

View File

@ -68,6 +68,7 @@ main(int argc, CHAR16 *argv[])
EFI_LOADED_IMAGE *img;
EFI_GUID *guid;
int i, j, vargood;
UINTN k;
/*
* XXX Chicken-and-egg problem; we want to have console output
@ -155,10 +156,10 @@ main(int argc, CHAR16 *argv[])
archsw.arch_copyout = efi_copyout;
archsw.arch_readin = efi_readin;
for (i = 0; i < ST->NumberOfTableEntries; i++) {
guid = &ST->ConfigurationTable[i].VendorGuid;
for (k = 0; k < ST->NumberOfTableEntries; k++) {
guid = &ST->ConfigurationTable[k].VendorGuid;
if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) {
smbios_detect(ST->ConfigurationTable[i].VendorTable);
smbios_detect(ST->ConfigurationTable[k].VendorTable);
break;
}
}
@ -242,8 +243,9 @@ command_memmap(int argc, char *argv[])
for (i = 0, p = map; i < ndesc;
i++, p = NextMemoryDescriptor(p, dsz)) {
printf("%23s %012lx %012lx %08lx ", types[p->Type],
p->PhysicalStart, p->VirtualStart, p->NumberOfPages);
printf("%23s %012jx %012jx %08jx ", types[p->Type],
(uintmax_t)p->PhysicalStart, (uintmax_t)p->VirtualStart,
(uintmax_t)p->NumberOfPages);
if (p->Attribute & EFI_MEMORY_UC)
printf("UC ");
if (p->Attribute & EFI_MEMORY_WC)
@ -284,9 +286,10 @@ guid_to_string(EFI_GUID *guid)
static int
command_configuration(int argc, char *argv[])
{
int i;
UINTN i;
printf("NumberOfTableEntries=%ld\n", ST->NumberOfTableEntries);
printf("NumberOfTableEntries=%lu\n",
(unsigned long)ST->NumberOfTableEntries);
for (i = 0; i < ST->NumberOfTableEntries; i++) {
EFI_GUID *guid;
@ -382,9 +385,8 @@ command_nvram(int argc, char *argv[])
CHAR16 *data;
EFI_STATUS status;
EFI_GUID varguid = { 0,0,0,{0,0,0,0,0,0,0,0} };
UINTN varsz, datasz;
UINTN varsz, datasz, i;
SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
int i;
conout = ST->ConOut;

View File

@ -332,7 +332,7 @@ static caddr_t
smbios_find_struct(int type)
{
caddr_t dmi;
int i;
size_t i;
if (smbios.addr == NULL)
return (NULL);
@ -402,7 +402,7 @@ smbios_detect(const caddr_t addr)
{
char buf[16];
caddr_t dmi;
int i;
size_t i;
smbios_probe(addr);
if (smbios.addr == NULL)

View File

@ -100,7 +100,7 @@ uboot_loadaddr(u_int type, void *data, uint64_t addr)
biggest_block = 0;
biggest_size = 0;
subldr = rounddown2((uint64_t)(uintptr_t)_start, KERN_ALIGN);
subldr = rounddown2((uintptr_t)_start, KERN_ALIGN);
eubldr = roundup2((uint64_t)uboot_heap_end, KERN_ALIGN);
for (i = 0; i < si->mr_no; i++) {
if (si->mr[i].flags != MR_ATTR_DRAM)

View File

@ -594,7 +594,15 @@ vdev_geom_attach_by_guids(vdev_t *vd)
vdev_geom_read_guids(zcp, &pguid, &vguid);
g_topology_lock();
vdev_geom_detach_taster(zcp);
if (pguid != spa_guid(vd->vdev_spa) ||
/*
* Check that the label's vdev guid matches the
* desired guid. If the label has a pool guid,
* check that it matches too. (Inactive spares
* and L2ARCs do not have any pool guid in the
* label.)
*/
if ((pguid != 0 &&
pguid != spa_guid(vd->vdev_spa)) ||
vguid != vd->vdev_guid)
continue;
cp = vdev_geom_attach(pp, vd);

View File

@ -2586,6 +2586,25 @@ device pps
device lpbb
device pcfclock
#
# Etherswitch framework and drivers
#
# etherswitch The etherswitch(4) framework
# miiproxy Proxy device for miibus(4) functionality
#
# Switch hardware support:
# arswitch Atheros switches
# ip17x IC+ 17x family switches
# rtl8366r Realtek RTL8366 switches
# ukswitch Multi-PHY switches
#
device etherswitch
device miiproxy
device arswitch
device ip17x
device rtl8366rb
device ukswitch
# Kernel BOOTP support
options BOOTP # Use BOOTP to obtain IP address/hostname

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;
}

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 >

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);
@ -217,7 +221,7 @@ void i915_gem_init_ppgtt(struct drm_device *dev)
if (INTEL_INFO(dev)->gen == 6) {
uint32_t ecochk, gab_ctl, ecobits;
ecobits = I915_READ(GAC_ECO_BITS);
ecobits = I915_READ(GAC_ECO_BITS);
I915_WRITE(GAC_ECO_BITS, ecobits | ECOBITS_PPGTT_CACHE64B);
gab_ctl = I915_READ(GAB_CTL);
@ -336,9 +340,8 @@ 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,
enum i915_cache_level cache_level)
void i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj,
enum i915_cache_level cache_level)
{
struct drm_device *dev;
struct drm_i915_private *dev_priv;
@ -375,15 +378,14 @@ void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj)
}
int i915_gem_init_global_gtt(struct drm_device *dev,
unsigned long start,
unsigned long mappable_end,
unsigned long end)
unsigned long start,
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 ... */

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) {

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

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,

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");
@ -1469,7 +1468,7 @@ static void intel_disable_pch_pll(struct intel_crtc *intel_crtc)
/* PCH only available on ILK+ */
KASSERT(dev_priv->info->gen >= 5, ("Wrong device gen"));
if (pll == NULL)
return;
return;
if (pll->refcount == 0) {
DRM_DEBUG_KMS("pll->refcount == 0\n");
@ -1495,7 +1494,7 @@ static void intel_disable_pch_pll(struct intel_crtc *intel_crtc)
/* Make sure transcoder isn't still depending on us */
assert_transcoder_disabled(dev_priv, intel_crtc->pipe);
reg = pll->pll_reg;
val = I915_READ(reg);
val &= ~DPLL_VCO_ENABLE;
@ -1507,7 +1506,7 @@ static void intel_disable_pch_pll(struct intel_crtc *intel_crtc)
}
static void intel_enable_transcoder(struct drm_i915_private *dev_priv,
enum pipe pipe)
enum pipe pipe)
{
int reg;
u32 val, pipeconf_val;
@ -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;
@ -2525,7 +2528,7 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
POSTING_READ(reg);
DELAY(150);
for (i = 0; i < 4; i++ ) {
for (i = 0; i < 4; i++) {
reg = FDI_TX_CTL(pipe);
temp = I915_READ(reg);
temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK;
@ -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 {

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);

View File

@ -919,6 +919,7 @@ hv_nv_on_receive(netvsc_dev *net_dev, struct hv_device *device,
*/
hv_nv_on_receive_completion(device, vm_xfer_page_pkt->d.transaction_id,
status);
hv_rf_receive_rollup(net_dev);
}
/*

View File

@ -44,6 +44,12 @@
#include <sys/malloc.h>
#include <sys/sx.h>
#include <netinet/in.h>
#include <netinet/tcp_lro.h>
#include <net/if.h>
#include <net/if_media.h>
#include <dev/hyperv/include/hyperv.h>
MALLOC_DECLARE(M_NETVSC);
@ -983,6 +989,7 @@ typedef struct {
*/
typedef struct hn_softc {
struct ifnet *hn_ifp;
struct ifmedia hn_media;
device_t hn_dev;
uint8_t hn_unit;
int hn_carrier;
@ -993,6 +1000,18 @@ typedef struct hn_softc {
int temp_unusable;
struct hv_device *hn_dev_obj;
netvsc_dev *net_dev;
struct lro_ctrl hn_lro;
int hn_lro_hiwat;
/* Trust tcp segments verification on host side */
int hn_trust_hosttcp;
u_long hn_csum_ip;
u_long hn_csum_tcp;
u_long hn_csum_trusted;
u_long hn_lro_tried;
u_long hn_small_pkts;
} hn_softc_t;

View File

@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$");
#include <sys/queue.h>
#include <sys/lock.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <net/if_arp.h>
@ -138,13 +139,14 @@ __FBSDID("$FreeBSD$");
CSUM_IP_ISCSI|CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP| \
CSUM_IP6_TSO|CSUM_IP6_ISCSI)
/*
* Data types
*/
struct hv_netvsc_driver_context {
uint32_t drv_inited;
};
/* XXX move to netinet/tcp_lro.h */
#define HN_LRO_HIWAT_MAX 65535
#define HN_LRO_HIWAT_DEF HN_LRO_HIWAT_MAX
/* YYY 2*MTU is a bit rough, but should be good enough. */
#define HN_LRO_HIWAT_MTULIM(ifp) (2 * (ifp)->if_mtu)
#define HN_LRO_HIWAT_ISVALID(sc, hiwat) \
((hiwat) >= HN_LRO_HIWAT_MTULIM((sc)->hn_ifp) || \
(hiwat) <= HN_LRO_HIWAT_MAX)
/*
* Be aware that this sleepable mutex will exhibit WITNESS errors when
@ -168,9 +170,9 @@ struct hv_netvsc_driver_context {
int hv_promisc_mode = 0; /* normal mode by default */
/* The one and only one */
static struct hv_netvsc_driver_context g_netvsc_drv;
/* Trust tcp segements verification on host side. */
static int hn_trust_hosttcp = 0;
TUNABLE_INT("dev.hn.trust_hosttcp", &hn_trust_hosttcp);
/*
* Forward declarations
@ -181,6 +183,21 @@ static void hn_ifinit(void *xsc);
static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data);
static int hn_start_locked(struct ifnet *ifp);
static void hn_start(struct ifnet *ifp);
static int hn_ifmedia_upd(struct ifnet *ifp);
static void hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr);
#ifdef HN_LRO_HIWAT
static int hn_lro_hiwat_sysctl(SYSCTL_HANDLER_ARGS);
#endif
static int hn_check_iplen(const struct mbuf *, int);
static __inline void
hn_set_lro_hiwat(struct hn_softc *sc, int hiwat)
{
sc->hn_lro_hiwat = hiwat;
#ifdef HN_LRO_HIWAT
sc->hn_lro.lro_hiwat = sc->hn_lro_hiwat;
#endif
}
/*
* NetVsc get message transport protocol type
@ -238,35 +255,27 @@ static uint32_t get_transport_proto_type(struct mbuf *m_head)
return (ret_val);
}
/*
* NetVsc driver initialization
* Note: Filter init is no longer required
*/
static int
netvsc_drv_init(void)
hn_ifmedia_upd(struct ifnet *ifp __unused)
{
return (0);
return EOPNOTSUPP;
}
/*
* NetVsc global initialization entry point
*/
static void
netvsc_init(void)
hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
{
if (bootverbose)
printf("Netvsc initializing... ");
struct hn_softc *sc = ifp->if_softc;
/*
* XXXKYS: cleanup initialization
*/
if (!cold && !g_netvsc_drv.drv_inited) {
g_netvsc_drv.drv_inited = 1;
netvsc_drv_init();
if (bootverbose)
printf("done!\n");
} else if (bootverbose)
printf("Already initialized!\n");
ifmr->ifm_status = IFM_AVALID;
ifmr->ifm_active = IFM_ETHER;
if (!sc->hn_carrier) {
ifmr->ifm_active |= IFM_NONE;
return;
}
ifmr->ifm_status |= IFM_ACTIVE;
ifmr->ifm_active |= IFM_10G_T | IFM_FDX;
}
/* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */
@ -310,10 +319,10 @@ netvsc_attach(device_t dev)
hn_softc_t *sc;
int unit = device_get_unit(dev);
struct ifnet *ifp;
struct sysctl_oid_list *child;
struct sysctl_ctx_list *ctx;
int ret;
netvsc_init();
sc = device_get_softc(dev);
if (sc == NULL) {
return (ENOMEM);
@ -322,6 +331,8 @@ netvsc_attach(device_t dev)
bzero(sc, sizeof(hn_softc_t));
sc->hn_unit = unit;
sc->hn_dev = dev;
sc->hn_lro_hiwat = HN_LRO_HIWAT_DEF;
sc->hn_trust_hosttcp = hn_trust_hosttcp;
NV_LOCK_INIT(sc, "NetVSCLock");
@ -344,14 +355,22 @@ netvsc_attach(device_t dev)
ifp->if_snd.ifq_drv_maxlen = 511;
IFQ_SET_READY(&ifp->if_snd);
ifmedia_init(&sc->hn_media, 0, hn_ifmedia_upd, hn_ifmedia_sts);
ifmedia_add(&sc->hn_media, IFM_ETHER | IFM_AUTO, 0, NULL);
ifmedia_set(&sc->hn_media, IFM_ETHER | IFM_AUTO);
/* XXX ifmedia_set really should do this for us */
sc->hn_media.ifm_media = sc->hn_media.ifm_cur->ifm_media;
/*
* Tell upper layers that we support full VLAN capability.
*/
ifp->if_hdrlen = sizeof(struct ether_vlan_header);
ifp->if_capabilities |=
IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO;
IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO |
IFCAP_LRO;
ifp->if_capenable |=
IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO;
IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO |
IFCAP_LRO;
/*
* Only enable UDP checksum offloading when it is on 2012R2 or
* later. UDP checksum offloading doesn't work on earlier
@ -372,8 +391,61 @@ netvsc_attach(device_t dev)
sc->hn_carrier = 1;
}
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
ether_ifattach(ifp, device_info.mac_addr);
ctx = device_get_sysctl_ctx(dev);
child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev));
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "lro_queued",
CTLFLAG_RW, &sc->hn_lro.lro_queued, 0, "LRO queued");
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "lro_flushed",
CTLFLAG_RW, &sc->hn_lro.lro_flushed, 0, "LRO flushed");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "lro_tried",
CTLFLAG_RW, &sc->hn_lro_tried, "# of LRO tries");
#ifdef HN_LRO_HIWAT
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_hiwat",
CTLTYPE_INT | CTLFLAG_RW, sc, 0, hn_lro_hiwat_sysctl,
"I", "LRO high watermark");
#endif
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "trust_hosttcp",
CTLFLAG_RW, &sc->hn_trust_hosttcp, 0,
"Trust tcp segement verification on host side, "
"when csum info is missing");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_ip",
CTLFLAG_RW, &sc->hn_csum_ip, "RXCSUM IP");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_tcp",
CTLFLAG_RW, &sc->hn_csum_tcp, "RXCSUM TCP");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_trusted",
CTLFLAG_RW, &sc->hn_csum_trusted,
"# of TCP segements that we trust host's csum verification");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "small_pkts",
CTLFLAG_RW, &sc->hn_small_pkts, "# of small packets received");
if (unit == 0) {
struct sysctl_ctx_list *dc_ctx;
struct sysctl_oid_list *dc_child;
devclass_t dc;
/*
* Add sysctl nodes for devclass
*/
dc = device_get_devclass(dev);
dc_ctx = devclass_get_sysctl_ctx(dc);
dc_child = SYSCTL_CHILDREN(devclass_get_sysctl_tree(dc));
SYSCTL_ADD_INT(dc_ctx, dc_child, OID_AUTO, "trust_hosttcp",
CTLFLAG_RD, &hn_trust_hosttcp, 0,
"Trust tcp segement verification on host side, "
"when csum info is missing (global setting)");
}
return (0);
}
@ -383,6 +455,7 @@ netvsc_attach(device_t dev)
static int
netvsc_detach(device_t dev)
{
struct hn_softc *sc = device_get_softc(dev);
struct hv_device *hv_device = vmbus_get_devctx(dev);
if (bootverbose)
@ -401,6 +474,9 @@ netvsc_detach(device_t dev)
hv_rf_on_device_remove(hv_device, HV_RF_NV_DESTROY_CHANNEL);
ifmedia_removeall(&sc->hn_media);
tcp_lro_free(&sc->hn_lro);
return (0);
}
@ -887,7 +963,7 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet,
struct mbuf *m_new;
struct ifnet *ifp;
device_t dev = device_ctx->device;
int size;
int size, do_lro = 0;
if (sc == NULL) {
return (0); /* TODO: KYS how can this be! */
@ -904,40 +980,44 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet,
*/
if (packet->tot_data_buf_len > (ifp->if_mtu + ETHER_HDR_LEN)) {
return (0);
} else if (packet->tot_data_buf_len <= MHLEN) {
m_new = m_gethdr(M_NOWAIT, MT_DATA);
if (m_new == NULL)
return (0);
memcpy(mtod(m_new, void *), packet->data,
packet->tot_data_buf_len);
m_new->m_pkthdr.len = m_new->m_len = packet->tot_data_buf_len;
sc->hn_small_pkts++;
} else {
/*
* Get an mbuf with a cluster. For packets 2K or less,
* get a standard 2K cluster. For anything larger, get a
* 4K cluster. Any buffers larger than 4K can cause problems
* if looped around to the Hyper-V TX channel, so avoid them.
*/
size = MCLBYTES;
if (packet->tot_data_buf_len > MCLBYTES) {
/* 4096 */
size = MJUMPAGESIZE;
}
m_new = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, size);
if (m_new == NULL) {
device_printf(dev, "alloc mbuf failed.\n");
return (0);
}
hv_m_append(m_new, packet->tot_data_buf_len, packet->data);
}
/*
* Get an mbuf with a cluster. For packets 2K or less,
* get a standard 2K cluster. For anything larger, get a
* 4K cluster. Any buffers larger than 4K can cause problems
* if looped around to the Hyper-V TX channel, so avoid them.
*/
size = MCLBYTES;
if (packet->tot_data_buf_len > MCLBYTES) {
/* 4096 */
size = MJUMPAGESIZE;
}
m_new = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, size);
if (m_new == NULL) {
device_printf(dev, "alloc mbuf failed.\n");
return (0);
}
hv_m_append(m_new, packet->tot_data_buf_len,
packet->data);
m_new->m_pkthdr.rcvif = ifp;
/* receive side checksum offload */
m_new->m_pkthdr.csum_flags = 0;
if (NULL != csum_info) {
/* IP csum offload */
if (csum_info->receive.ip_csum_succeeded) {
m_new->m_pkthdr.csum_flags |=
(CSUM_IP_CHECKED | CSUM_IP_VALID);
sc->hn_csum_ip++;
}
/* TCP csum offload */
@ -945,9 +1025,50 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet,
m_new->m_pkthdr.csum_flags |=
(CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
m_new->m_pkthdr.csum_data = 0xffff;
sc->hn_csum_tcp++;
}
if (csum_info->receive.ip_csum_succeeded &&
csum_info->receive.tcp_csum_succeeded)
do_lro = 1;
} else {
const struct ether_header *eh;
uint16_t etype;
int hoff;
hoff = sizeof(*eh);
if (m_new->m_len < hoff)
goto skip;
eh = mtod(m_new, struct ether_header *);
etype = ntohs(eh->ether_type);
if (etype == ETHERTYPE_VLAN) {
const struct ether_vlan_header *evl;
hoff = sizeof(*evl);
if (m_new->m_len < hoff)
goto skip;
evl = mtod(m_new, struct ether_vlan_header *);
etype = ntohs(evl->evl_proto);
}
if (etype == ETHERTYPE_IP) {
int pr;
pr = hn_check_iplen(m_new, hoff);
if (pr == IPPROTO_TCP) {
if (sc->hn_trust_hosttcp) {
sc->hn_csum_trusted++;
m_new->m_pkthdr.csum_flags |=
(CSUM_IP_CHECKED | CSUM_IP_VALID |
CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
m_new->m_pkthdr.csum_data = 0xffff;
}
/* Rely on SW csum verification though... */
do_lro = 1;
}
}
}
skip:
if ((packet->vlan_tci != 0) &&
(ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) {
m_new->m_pkthdr.ether_vtag = packet->vlan_tci;
@ -961,12 +1082,37 @@ 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) {
struct lro_ctrl *lro = &sc->hn_lro;
if (lro->lro_cnt) {
sc->hn_lro_tried++;
if (tcp_lro_rx(lro, m_new, 0) == 0) {
/* DONE! */
return 0;
}
}
}
/* We're not holding the lock here, so don't release it */
(*ifp->if_input)(ifp, m_new);
return (0);
}
void
netvsc_recv_rollup(struct hv_device *device_ctx)
{
hn_softc_t *sc = device_get_softc(device_ctx->device);
struct lro_ctrl *lro = &sc->hn_lro;
struct lro_entry *queued;
while ((queued = SLIST_FIRST(&lro->lro_active)) != NULL) {
SLIST_REMOVE_HEAD(&lro->lro_active, next);
tcp_lro_flush(lro, queued);
}
}
/*
* Rules for using sc->temp_unusable:
* 1. sc->temp_unusable can only be read or written while holding NV_LOCK()
@ -1022,7 +1168,13 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
/* Obtain and record requested MTU */
ifp->if_mtu = ifr->ifr_mtu;
/*
* Make sure that LRO high watermark is still valid,
* after MTU change (the 2*MTU limit).
*/
if (!HN_LRO_HIWAT_ISVALID(sc, sc->hn_lro_hiwat))
hn_set_lro_hiwat(sc, HN_LRO_HIWAT_MTULIM(ifp));
do {
NV_LOCK(sc);
if (!sc->temp_unusable) {
@ -1147,6 +1299,8 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ifp->if_capenable |= IFCAP_RXCSUM;
}
}
if (mask & IFCAP_LRO)
ifp->if_capenable ^= IFCAP_LRO;
if (mask & IFCAP_TSO4) {
ifp->if_capenable ^= IFCAP_TSO4;
@ -1171,10 +1325,11 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
error = 0;
}
#endif
/* FALLTHROUGH */
error = EINVAL;
break;
case SIOCSIFMEDIA:
case SIOCGIFMEDIA:
error = EINVAL;
error = ifmedia_ioctl(ifp, ifr, &sc->hn_media, cmd);
break;
default:
error = ether_ioctl(ifp, cmd, data);
@ -1292,6 +1447,102 @@ hn_watchdog(struct ifnet *ifp)
}
#endif
#ifdef HN_LRO_HIWAT
static int
hn_lro_hiwat_sysctl(SYSCTL_HANDLER_ARGS)
{
struct hn_softc *sc = arg1;
int hiwat, error;
hiwat = sc->hn_lro_hiwat;
error = sysctl_handle_int(oidp, &hiwat, 0, req);
if (error || req->newptr == NULL)
return error;
if (!HN_LRO_HIWAT_ISVALID(sc, hiwat))
return EINVAL;
if (sc->hn_lro_hiwat != hiwat)
hn_set_lro_hiwat(sc, hiwat);
return 0;
}
#endif /* HN_LRO_HIWAT */
static int
hn_check_iplen(const struct mbuf *m, int hoff)
{
const struct ip *ip;
int len, iphlen, iplen;
const struct tcphdr *th;
int thoff; /* TCP data offset */
len = hoff + sizeof(struct ip);
/* The packet must be at least the size of an IP header. */
if (m->m_pkthdr.len < len)
return IPPROTO_DONE;
/* The fixed IP header must reside completely in the first mbuf. */
if (m->m_len < len)
return IPPROTO_DONE;
ip = mtodo(m, hoff);
/* Bound check the packet's stated IP header length. */
iphlen = ip->ip_hl << 2;
if (iphlen < sizeof(struct ip)) /* minimum header length */
return IPPROTO_DONE;
/* The full IP header must reside completely in the one mbuf. */
if (m->m_len < hoff + iphlen)
return IPPROTO_DONE;
iplen = ntohs(ip->ip_len);
/*
* Check that the amount of data in the buffers is as
* at least much as the IP header would have us expect.
*/
if (m->m_pkthdr.len < hoff + iplen)
return IPPROTO_DONE;
/*
* Ignore IP fragments.
*/
if (ntohs(ip->ip_off) & (IP_OFFMASK | IP_MF))
return IPPROTO_DONE;
/*
* The TCP/IP or UDP/IP header must be entirely contained within
* the first fragment of a packet.
*/
switch (ip->ip_p) {
case IPPROTO_TCP:
if (iplen < iphlen + sizeof(struct tcphdr))
return IPPROTO_DONE;
if (m->m_len < hoff + iphlen + sizeof(struct tcphdr))
return IPPROTO_DONE;
th = (const struct tcphdr *)((const uint8_t *)ip + iphlen);
thoff = th->th_off << 2;
if (thoff < sizeof(struct tcphdr) || thoff + iphlen > iplen)
return IPPROTO_DONE;
if (m->m_len < hoff + iphlen + thoff)
return IPPROTO_DONE;
break;
case IPPROTO_UDP:
if (iplen < iphlen + sizeof(struct udphdr))
return IPPROTO_DONE;
if (m->m_len < hoff + iphlen + sizeof(struct udphdr))
return IPPROTO_DONE;
break;
default:
if (iplen < iphlen)
return IPPROTO_DONE;
break;
}
return ip->ip_p;
}
static device_method_t netvsc_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, netvsc_probe),
@ -1313,6 +1564,3 @@ static devclass_t netvsc_devclass;
DRIVER_MODULE(hn, vmbus, netvsc_driver, netvsc_devclass, 0, 0);
MODULE_VERSION(hn, 1);
MODULE_DEPEND(hn, vmbus, 1, 1, 1);
SYSINIT(netvsc_initx, SI_SUB_KTHREAD_IDLE, SI_ORDER_MIDDLE + 1, netvsc_init,
NULL);

View File

@ -1049,6 +1049,7 @@ typedef struct rndismp_rx_bufs_info_ {
int netvsc_recv(struct hv_device *device_ctx,
netvsc_packet *packet,
rndis_tcp_ip_csum_info *csum_info);
void netvsc_recv_rollup(struct hv_device *device_ctx);
void* hv_set_rppi_data(rndis_msg *rndis_mesg,
uint32_t rppi_size,

View File

@ -963,3 +963,14 @@ hv_rf_on_send_request_halt_completion(void *context)
request->halt_complete_flag = 1;
}
/*
* RNDIS filter when "all" reception is done
*/
void
hv_rf_receive_rollup(netvsc_dev *net_dev)
{
rndis_device *rndis_dev;
rndis_dev = (rndis_device *)net_dev->extension;
netvsc_recv_rollup(rndis_dev->net_dev->dev);
}

View File

@ -98,6 +98,7 @@ typedef struct rndis_device_ {
int hv_rf_on_receive(netvsc_dev *net_dev,
struct hv_device *device, netvsc_packet *pkt);
void hv_rf_receive_rollup(netvsc_dev *net_dev);
int hv_rf_on_device_add(struct hv_device *device, void *additl_info);
int hv_rf_on_device_remove(struct hv_device *device, boolean_t destroy_channel);
int hv_rf_on_open(struct hv_device *device);

View File

@ -177,11 +177,15 @@ static void iwn4965_print_power_group(struct iwn_softc *, int);
#endif
static void iwn5000_read_eeprom(struct iwn_softc *);
static uint32_t iwn_eeprom_channel_flags(struct iwn_eeprom_chan *);
static void iwn_read_eeprom_band(struct iwn_softc *, int);
static void iwn_read_eeprom_ht40(struct iwn_softc *, int);
static void iwn_read_eeprom_band(struct iwn_softc *, int, int, int *,
struct ieee80211_channel[]);
static void iwn_read_eeprom_ht40(struct iwn_softc *, int, int, int *,
struct ieee80211_channel[]);
static void iwn_read_eeprom_channels(struct iwn_softc *, int, uint32_t);
static struct iwn_eeprom_chan *iwn_find_eeprom_channel(struct iwn_softc *,
struct ieee80211_channel *);
static void iwn_getradiocaps(struct ieee80211com *, int, int *,
struct ieee80211_channel[]);
static int iwn_setregdomain(struct ieee80211com *,
struct ieee80211_regdomain *, int,
struct ieee80211_channel[]);
@ -666,6 +670,7 @@ iwn_attach(device_t dev)
ic->ic_set_channel = iwn_set_channel;
ic->ic_scan_curchan = iwn_scan_curchan;
ic->ic_scan_mindwell = iwn_scan_mindwell;
ic->ic_getradiocaps = iwn_getradiocaps;
ic->ic_setregdomain = iwn_setregdomain;
iwn_radiotap_attach(sc);
@ -2371,9 +2376,9 @@ iwn_eeprom_channel_flags(struct iwn_eeprom_chan *channel)
}
static void
iwn_read_eeprom_band(struct iwn_softc *sc, int n)
iwn_read_eeprom_band(struct iwn_softc *sc, int n, int maxchans, int *nchans,
struct ieee80211_channel chans[])
{
struct ieee80211com *ic = &sc->sc_ic;
struct iwn_eeprom_chan *channels = sc->eeprom_channels[n];
const struct iwn_chan_band *band = &iwn_bands[n];
struct ieee80211_channel *c;
@ -2390,10 +2395,14 @@ iwn_read_eeprom_band(struct iwn_softc *sc, int n)
channels[i].maxpwr);
continue;
}
if (*nchans >= maxchans)
break;
chan = band->chan[i];
nflags = iwn_eeprom_channel_flags(&channels[i]);
c = &ic->ic_channels[ic->ic_nchans++];
c = &chans[(*nchans)++];
c->ic_ieee = chan;
c->ic_maxregpower = channels[i].maxpwr;
c->ic_maxpower = 2*c->ic_maxregpower;
@ -2402,7 +2411,11 @@ iwn_read_eeprom_band(struct iwn_softc *sc, int n)
c->ic_freq = ieee80211_ieee2mhz(chan, IEEE80211_CHAN_G);
/* G =>'s B is supported */
c->ic_flags = IEEE80211_CHAN_B | nflags;
c = &ic->ic_channels[ic->ic_nchans++];
if (*nchans >= maxchans)
break;
c = &chans[(*nchans)++];
c[0] = c[-1];
c->ic_flags = IEEE80211_CHAN_G | nflags;
} else { /* 5GHz band */
@ -2418,8 +2431,11 @@ iwn_read_eeprom_band(struct iwn_softc *sc, int n)
channels[i].flags, channels[i].maxpwr);
if (sc->sc_flags & IWN_FLAG_HAS_11N) {
if (*nchans >= maxchans)
break;
/* add HT20, HT40 added separately */
c = &ic->ic_channels[ic->ic_nchans++];
c = &chans[(*nchans)++];
c[0] = c[-1];
c->ic_flags |= IEEE80211_CHAN_HT20;
}
@ -2430,7 +2446,8 @@ iwn_read_eeprom_band(struct iwn_softc *sc, int n)
}
static void
iwn_read_eeprom_ht40(struct iwn_softc *sc, int n)
iwn_read_eeprom_ht40(struct iwn_softc *sc, int n, int maxchans, int *nchans,
struct ieee80211_channel chans[])
{
struct ieee80211com *ic = &sc->sc_ic;
struct iwn_eeprom_chan *channels = sc->eeprom_channels[n];
@ -2454,6 +2471,10 @@ iwn_read_eeprom_ht40(struct iwn_softc *sc, int n)
channels[i].maxpwr);
continue;
}
if (*nchans + 1 >= maxchans)
break;
chan = band->chan[i];
nflags = iwn_eeprom_channel_flags(&channels[i]);
@ -2481,12 +2502,12 @@ iwn_read_eeprom_ht40(struct iwn_softc *sc, int n)
"add ht40 chan %d flags 0x%x maxpwr %d\n",
chan, channels[i].flags, channels[i].maxpwr);
c = &ic->ic_channels[ic->ic_nchans++];
c = &chans[(*nchans)++];
c[0] = cent[0];
c->ic_extieee = extc->ic_ieee;
c->ic_flags &= ~IEEE80211_CHAN_HT;
c->ic_flags |= IEEE80211_CHAN_HT40U | nflags;
c = &ic->ic_channels[ic->ic_nchans++];
c = &chans[(*nchans)++];
c[0] = extc[0];
c->ic_extieee = cent->ic_ieee;
c->ic_flags &= ~IEEE80211_CHAN_HT;
@ -2505,10 +2526,13 @@ iwn_read_eeprom_channels(struct iwn_softc *sc, int n, uint32_t addr)
iwn_read_prom_data(sc, addr, &sc->eeprom_channels[n],
iwn_bands[n].nchan * sizeof (struct iwn_eeprom_chan));
if (n < 5)
iwn_read_eeprom_band(sc, n);
else
iwn_read_eeprom_ht40(sc, n);
if (n < 5) {
iwn_read_eeprom_band(sc, n, IEEE80211_CHAN_MAX, &ic->ic_nchans,
ic->ic_channels);
} else {
iwn_read_eeprom_ht40(sc, n, IEEE80211_CHAN_MAX, &ic->ic_nchans,
ic->ic_channels);
}
ieee80211_sort_channels(ic->ic_channels, ic->ic_nchans);
}
@ -2538,6 +2562,20 @@ iwn_find_eeprom_channel(struct iwn_softc *sc, struct ieee80211_channel *c)
return NULL;
}
static void
iwn_getradiocaps(struct ieee80211com *ic,
int maxchans, int *nchans, struct ieee80211_channel chans[])
{
struct iwn_softc *sc = ic->ic_softc;
int i;
/* Parse the list of authorized channels. */
for (i = 0; i < 5 && *nchans < maxchans; i++)
iwn_read_eeprom_band(sc, i, maxchans, nchans, chans);
for (i = 5; i < IWN_NBANDS - 1 && *nchans < maxchans; i++)
iwn_read_eeprom_ht40(sc, i, maxchans, nchans, chans);
}
/*
* Enforce flags read from EEPROM.
*/

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

View File

@ -1438,7 +1438,7 @@ rtwn_rx_frame(struct rtwn_softc *sc, struct r92c_rx_desc *rx_desc,
struct rtwn_rx_data *rx_data, int desc_idx)
{
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211_frame *wh;
struct ieee80211_frame_min *wh;
struct ieee80211_node *ni;
struct r92c_rx_phystat *phy = NULL;
uint32_t rxdw0, rxdw3;
@ -1462,7 +1462,8 @@ rtwn_rx_frame(struct rtwn_softc *sc, struct r92c_rx_desc *rx_desc,
}
pktlen = MS(rxdw0, R92C_RXDW0_PKTLEN);
if (__predict_false(pktlen < sizeof(*wh) || pktlen > MCLBYTES)) {
if (__predict_false(pktlen < sizeof(struct ieee80211_frame_ack) ||
pktlen > MCLBYTES)) {
counter_u64_add(ic->ic_ierrors, 1);
return;
}
@ -1554,10 +1555,13 @@ rtwn_rx_frame(struct rtwn_softc *sc, struct r92c_rx_desc *rx_desc,
}
RTWN_UNLOCK(sc);
wh = mtod(m, struct ieee80211_frame *);
wh = mtod(m, struct ieee80211_frame_min *);
if (m->m_len >= sizeof(*wh))
ni = ieee80211_find_rxnode(ic, wh);
else
ni = NULL;
/* Send the frame to the 802.11 layer. */
ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh);
if (ni != NULL) {
(void)ieee80211_input(ni, m, rssi - nf, nf);
/* Node is no longer needed. */

View File

@ -0,0 +1,54 @@
/*-
* Copyright (c) 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.
*
* $FreeBSD$
*/
#ifndef _SYS_EF10_IMPL_H
#define _SYS_EF10_IMPL_H
#ifdef __cplusplus
extern "C" {
#endif
#if (EFSYS_OPT_HUNTINGTON && EFSYS_OPT_MEDFORD)
#define EF10_MAX_PIOBUF_NBUFS MAX(HUNT_PIOBUF_NBUFS, MEDFORD_PIOBUF_NBUFS)
#elif EFSYS_OPT_HUNTINGTON
#define EF10_MAX_PIOBUF_NBUFS HUNT_PIOBUF_NBUFS
#elif EFSYS_OPT_MEDFORD
#define EF10_MAX_PIOBUF_NBUFS MEDFORD_PIOBUF_NBUFS
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_EF10_IMPL_H */

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 */

View File

@ -287,9 +287,7 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map,
#define EFSYS_OPT_RX_SCALE 1
#define EFSYS_OPT_QSTATS 1
#define EFSYS_OPT_FILTER 1
#define EFSYS_OPT_MCAST_FILTER_LIST 1
#define EFSYS_OPT_RX_SCATTER 0
#define EFSYS_OPT_RX_HDR_SPLIT 0
#define EFSYS_OPT_EV_PREFETCH 0

View File

@ -61,6 +61,7 @@ typedef enum efx_family_e {
EFX_FAMILY_FALCON,
EFX_FAMILY_SIENA,
EFX_FAMILY_HUNTINGTON,
EFX_FAMILY_MEDFORD,
EFX_FAMILY_NTYPES
} efx_family_t;
@ -90,6 +91,9 @@ efx_infer_family(
#define EFX_PCI_DEVID_FARMINGDALE_VF 0x1903 /* SFC9120 VF */
#define EFX_PCI_DEVID_GREENPORT_VF 0x1923 /* SFC9140 VF */
#define EFX_PCI_DEVID_MEDFORD_PF_UNINIT 0x0913
#define EFX_PCI_DEVID_MEDFORD 0x0A03 /* SFC9240 PF */
#define EFX_PCI_DEVID_MEDFORD_VF 0x1A03 /* SFC9240 VF */
#define EFX_MEM_BAR 2
@ -187,8 +191,8 @@ efx_nic_destroy(
#if EFSYS_OPT_MCDI
#if EFSYS_OPT_HUNTINGTON
/* Huntington requires MCDIv2 commands */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
/* Huntington and Medford require MCDIv2 commands */
#define WITH_MCDI_V2 1
#endif
@ -501,38 +505,6 @@ efx_mac_fcntl_get(
__out unsigned int *fcntl_wantedp,
__out unsigned int *fcntl_linkp);
#define EFX_MAC_HASH_BITS (1 << 8)
extern __checkReturn efx_rc_t
efx_pktfilter_init(
__in efx_nic_t *enp);
extern void
efx_pktfilter_fini(
__in efx_nic_t *enp);
extern __checkReturn efx_rc_t
efx_pktfilter_set(
__in efx_nic_t *enp,
__in boolean_t unicst,
__in boolean_t brdcst);
extern __checkReturn efx_rc_t
efx_mac_hash_set(
__in efx_nic_t *enp,
__in_ecount(EFX_MAC_HASH_BITS) unsigned int const *bucket);
#if EFSYS_OPT_MCAST_FILTER_LIST
extern __checkReturn efx_rc_t
efx_pktfilter_mcast_list_set(
__in efx_nic_t *enp,
__in uint8_t const *addrs,
__in int count);
#endif /* EFSYS_OPT_MCAST_FILTER_LIST */
extern __checkReturn efx_rc_t
efx_pktfilter_mcast_all(
__in efx_nic_t *enp);
#if EFSYS_OPT_MAC_STATS
@ -590,6 +562,7 @@ typedef enum efx_mon_type_e {
EFX_MON_MAX6647,
EFX_MON_SFC90X0,
EFX_MON_SFC91X0,
EFX_MON_SFC92X0,
EFX_MON_NTYPES
} efx_mon_type_t;
@ -610,7 +583,7 @@ efx_mon_init(
#define EFX_MON_STATS_PAGE_SIZE 0x100
#define EFX_MON_MASK_ELEMENT_SIZE 32
/* START MKCONFIG GENERATED MonitorHeaderStatsBlock c79c86b62a144846 */
/* START MKCONFIG GENERATED MonitorHeaderStatsBlock c09b13f732431f23 */
typedef enum efx_mon_stat_e {
EFX_MON_STAT_2_5V,
EFX_MON_STAT_VCCP1,
@ -681,6 +654,12 @@ typedef enum efx_mon_stat_e {
EFX_MON_STAT_CONTROLLER_SLAVE_INTERNAL_TEMP,
EFX_MON_STAT_CONTROLLER_SLAVE_VPTAT_EXT_ADC,
EFX_MON_STAT_CONTROLLER_SLAVE_INTERNAL_TEMP_EXT_ADC,
EFX_MON_STAT_SODIMM_VOUT,
EFX_MON_STAT_SODIMM_0_TEMP,
EFX_MON_STAT_SODIMM_1_TEMP,
EFX_MON_STAT_PHY0_VCC,
EFX_MON_STAT_PHY1_VCC,
EFX_MON_STAT_CONTROLLER_TDIODE_TEMP,
EFX_MON_NSTATS
} efx_mon_stat_t;
@ -1117,6 +1096,7 @@ typedef struct efx_nic_cfg_s {
uint32_t enc_buftbl_limit;
uint32_t enc_piobuf_limit;
uint32_t enc_piobuf_size;
uint32_t enc_piobuf_min_alloc_size;
uint32_t enc_evq_timer_quantum_ns;
uint32_t enc_evq_timer_max_us;
uint32_t enc_clk_mult;
@ -1144,20 +1124,20 @@ typedef struct efx_nic_cfg_s {
uint32_t enc_mcdi_phy_stat_mask;
#endif /* EFSYS_OPT_PHY_STATS */
#endif /* EFSYS_OPT_SIENA */
#if (EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
#if (EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
#if EFSYS_OPT_MON_STATS
uint32_t *enc_mcdi_sensor_maskp;
uint32_t enc_mcdi_sensor_mask_size;
#endif /* EFSYS_OPT_MON_STATS */
#endif /* (EFSYS_OPT_SIENA | EFSYS_OPT_HUNTINGTON) */
#endif /* (EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */
#if EFSYS_OPT_BIST
uint32_t enc_bist_mask;
#endif /* EFSYS_OPT_BIST */
#if EFSYS_OPT_HUNTINGTON
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
uint32_t enc_pf;
uint32_t enc_vf;
uint32_t enc_privilege_mask;
#endif /* EFSYS_OPT_HUNTINGTON */
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
boolean_t enc_bug26807_workaround;
boolean_t enc_bug35388_workaround;
boolean_t enc_bug41750_workaround;
@ -1837,15 +1817,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(
@ -1912,7 +1883,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,
@ -1936,8 +1907,6 @@ efx_psuedo_hdr_pkt_length_get(
typedef enum efx_rxq_type_e {
EFX_RXQ_TYPE_DEFAULT,
EFX_RXQ_TYPE_SPLIT_HEADER,
EFX_RXQ_TYPE_SPLIT_PAYLOAD,
EFX_RXQ_TYPE_SCATTER,
EFX_RXQ_NTYPES
} efx_rxq_type_t;
@ -2266,14 +2235,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

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

View File

@ -52,32 +52,32 @@
/* Verify chip implements accessed registers */
#if EFSYS_OPT_CHECK_REG
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "CHECK_REG requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "CHECK_REG requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_CHECK_REG */
/* Decode fatal errors */
#if EFSYS_OPT_DECODE_INTR_FATAL
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
# if EFSYS_OPT_HUNTINGTON
# error "INTR_FATAL not supported on HUNTINGTON"
# endif
# error "INTR_FATAL requires FALCON or SIENA"
# endif
#endif /* EFSYS_OPT_DECODE_INTR_FATAL */
/* Support diagnostic hardware tests */
#if EFSYS_OPT_DIAG
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "DIAG requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "DIAG requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_DIAG */
/* Support optimized EVQ data access */
#if EFSYS_OPT_EV_PREFETCH
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "EV_PREFETCH requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "EV_PREFETCH requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_EV_PREFETCH */
@ -90,21 +90,23 @@
/* Support hardware packet filters */
#if EFSYS_OPT_FILTER
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "FILTER requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "FILTER requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_FILTER */
#if EFSYS_OPT_HUNTINGTON
#if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# if !EFSYS_OPT_FILTER
# error "HUNTINGTON requires FILTER"
# error "HUNTINGTON or MEDFORD requires FILTER"
# endif
#endif /* EFSYS_OPT_HUNTINGTON */
/* Support hardware loopback modes */
#if EFSYS_OPT_LOOPBACK
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "LOOPBACK requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "LOOPBACK requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_LOOPBACK */
@ -124,26 +126,23 @@
/* Support MAC statistics */
#if EFSYS_OPT_MAC_STATS
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "MAC_STATS requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "MAC_STATS requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_MAC_STATS */
/* Support management controller messages */
#if EFSYS_OPT_MCDI
# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# if EFSYS_OPT_FALCON
# error "MCDI not supported on FALCON"
# endif
# error "MCDI requires SIENA or HUNTINGTON"
# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "MCDI requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_MCDI */
#if EFSYS_OPT_SIENA && !EFSYS_OPT_MCDI
# error "SIENA requires MCDI"
#endif
#if EFSYS_OPT_HUNTINGTON && !EFSYS_OPT_MCDI
# error "HUNTINGTON requires MCDI"
#if (EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# if !EFSYS_OPT_MCDI
# error "SIENA or HUNTINGTON or MEDFORD requires MCDI"
# endif
#endif
/* Support MCDI logging */
@ -181,27 +180,28 @@
# endif
#endif /* EFSYS_OPT_MON_NULL */
/* Support Siena monitor */
/* Obsolete option */
#ifdef EFSYS_OPT_MON_SIENA
# error "MON_SIENA is obsolete use MON_MCDI"
# error "MON_SIENA is obsolete (replaced by MON_MCDI)."
#endif /* EFSYS_OPT_MON_SIENA*/
/* Support Huntington monitor */
/* Obsolete option */
#ifdef EFSYS_OPT_MON_HUNTINGTON
# error "MON_HUNTINGTON is obsolete use MON_MCDI"
# error "MON_HUNTINGTON is obsolete (replaced by MON_MCDI)."
#endif /* EFSYS_OPT_MON_HUNTINGTON*/
/* Support monitor statistics (voltage/temperature) */
#if EFSYS_OPT_MON_STATS
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "MON_STATS requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "MON_STATS requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_MON_STATS */
/* Support Monitor via mcdi */
#if EFSYS_OPT_MON_MCDI
# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "MON_MCDI requires SIENA or HUNTINGTON"
# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "MON_MCDI requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_MON_MCDI*/
@ -216,8 +216,9 @@
/* Support non volatile configuration */
#if EFSYS_OPT_NVRAM
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "NVRAM requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "NVRAM requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_NVRAM */
@ -258,9 +259,9 @@
# endif
#endif /* EFSYS_OPT_PCIE_TUNE */
/* Support PHY BIST diagnostics */
/* Obsolete option */
#if EFSYS_OPT_PHY_BIST
# error "PHY_BIST is obsolete. It has been replaced by the BIST option."
# error "PHY_BIST is obsolete (replaced by BIST)."
#endif /* EFSYS_OPT_PHY_BIST */
/* Support PHY flags */
@ -340,41 +341,43 @@
/* Support EVQ/RXQ/TXQ statistics */
#if EFSYS_OPT_QSTATS
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "QSTATS requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "QSTATS requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# 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)
# error "RX_HDR_SPLIT requires FALCON or SIENA or HUNTINGTON"
# 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) */
#if EFSYS_OPT_RX_SCALE
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "RX_SCALE requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "RX_SCALE requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_RX_SCALE */
/* Support receive scatter DMA */
#if EFSYS_OPT_RX_SCATTER
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "RX_SCATTER requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "RX_SCATTER requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_RX_SCATTER */
/* Obsolete option */
#ifdef EFSYS_OPT_STAT_NAME
# error "EFSYS_OPT_STAT_NAME is obsolete (replaced by EFSYS_OPT_NAMES)."
# error "STAT_NAME is obsolete (replaced by NAMES)."
#endif
/* Support PCI Vital Product Data (VPD) */
#if EFSYS_OPT_VPD
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "VPD requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "VPD requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_VPD */
@ -385,17 +388,16 @@
# endif
#endif /* EFSYS_OPT_WOL */
/* Support calculating multicast pktfilter in common code */
#if EFSYS_OPT_MCAST_FILTER_LIST
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "MCAST_FILTER_LIST requires FALCON or SIENA or HUNTINGTON"
# endif
/* Obsolete option */
#ifdef EFSYS_OPT_MCAST_FILTER_LIST
# error "MCAST_FILTER_LIST is obsolete and is not supported"
#endif /* EFSYS_OPT_MCAST_FILTER_LIST */
/* Support BIST */
#if EFSYS_OPT_BIST
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON)
# error "BIST requires FALCON or SIENA or HUNTINGTON"
# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
# error "BIST requires FALCON or SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_BIST */

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"
/*

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) \
@ -139,20 +138,20 @@ static efx_ev_ops_t __efx_ev_siena_ops = {
};
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
static efx_ev_ops_t __efx_ev_hunt_ops = {
hunt_ev_init, /* eevo_init */
hunt_ev_fini, /* eevo_fini */
hunt_ev_qcreate, /* eevo_qcreate */
hunt_ev_qdestroy, /* eevo_qdestroy */
hunt_ev_qprime, /* eevo_qprime */
hunt_ev_qpost, /* eevo_qpost */
hunt_ev_qmoderate, /* eevo_qmoderate */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
static efx_ev_ops_t __efx_ev_ef10_ops = {
ef10_ev_init, /* eevo_init */
ef10_ev_fini, /* eevo_fini */
ef10_ev_qcreate, /* eevo_qcreate */
ef10_ev_qdestroy, /* eevo_qdestroy */
ef10_ev_qprime, /* eevo_qprime */
ef10_ev_qpost, /* eevo_qpost */
ef10_ev_qmoderate, /* eevo_qmoderate */
#if EFSYS_OPT_QSTATS
hunt_ev_qstats_update, /* eevo_qstats_update */
ef10_ev_qstats_update, /* eevo_qstats_update */
#endif
};
#endif /* EFSYS_OPT_HUNTINGTON */
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
__checkReturn efx_rc_t
@ -185,10 +184,16 @@ efx_ev_init(
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
eevop = (efx_ev_ops_t *)&__efx_ev_hunt_ops;
eevop = (efx_ev_ops_t *)&__efx_ev_ef10_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
eevop = (efx_ev_ops_t *)&__efx_ev_ef10_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
default:
EFSYS_ASSERT(0);
rc = ENOTSUP;
@ -492,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.
*
@ -507,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) {
@ -568,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;
@ -586,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);
@ -644,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) {

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"
@ -97,17 +94,17 @@ static efx_filter_ops_t __efx_filter_siena_ops = {
};
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
static efx_filter_ops_t __efx_filter_hunt_ops = {
hunt_filter_init, /* efo_init */
hunt_filter_fini, /* efo_fini */
hunt_filter_restore, /* efo_restore */
hunt_filter_add, /* efo_add */
hunt_filter_delete, /* efo_delete */
hunt_filter_supported_filters, /* efo_supported_filters */
hunt_filter_reconfigure, /* efo_reconfigure */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
static efx_filter_ops_t __efx_filter_ef10_ops = {
ef10_filter_init, /* efo_init */
ef10_filter_fini, /* efo_fini */
ef10_filter_restore, /* efo_restore */
ef10_filter_add, /* efo_add */
ef10_filter_delete, /* efo_delete */
ef10_filter_supported_filters, /* efo_supported_filters */
ef10_filter_reconfigure, /* efo_reconfigure */
};
#endif /* EFSYS_OPT_HUNTINGTON */
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
__checkReturn efx_rc_t
efx_filter_insert(
@ -189,10 +186,16 @@ efx_filter_init(
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
efop = (efx_filter_ops_t *)&__efx_filter_hunt_ops;
efop = (efx_filter_ops_t *)&__efx_filter_ef10_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
efop = (efx_filter_ops_t *)&__efx_filter_ef10_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
default:
EFSYS_ASSERT(0);
rc = ENOTSUP;
@ -289,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)
@ -308,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);

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 */

View File

@ -58,6 +58,14 @@
#include "hunt_impl.h"
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
#include "medford_impl.h"
#endif /* EFSYS_OPT_MEDFORD */
#if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
#include "ef10_impl.h"
#endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */
#ifdef __cplusplus
extern "C" {
#endif
@ -149,10 +157,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
@ -162,7 +166,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);
@ -258,16 +266,6 @@ efx_filter_reconfigure(
#endif /* EFSYS_OPT_FILTER */
typedef struct efx_pktfilter_ops_s {
efx_rc_t (*epfo_set)(efx_nic_t *,
boolean_t unicst,
boolean_t brdcast);
#if EFSYS_OPT_MCAST_FILTER_LIST
efx_rc_t (*epfo_mcast_list_set)(efx_nic_t *,
uint8_t const *addrs, int count);
#endif /* EFSYS_OPT_MCAST_FILTER_LIST */
efx_rc_t (*epfo_mcast_all)(efx_nic_t *);
} efx_pktfilter_ops_t;
typedef struct efx_port_s {
efx_mac_type_t ep_mac_type;
@ -344,6 +342,10 @@ typedef struct efx_intr_ops_s {
void (*eio_disable)(efx_nic_t *);
void (*eio_disable_unlocked)(efx_nic_t *);
efx_rc_t (*eio_trigger)(efx_nic_t *, unsigned int);
void (*eio_status_line)(efx_nic_t *, boolean_t *, uint32_t *);
void (*eio_status_message)(efx_nic_t *, unsigned int,
boolean_t *);
void (*eio_fatal)(efx_nic_t *);
void (*eio_fini)(efx_nic_t *);
} efx_intr_ops_t;
@ -438,9 +440,9 @@ typedef struct efx_filter_s {
#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
falconsiena_filter_t *ef_falconsiena_filter;
#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
hunt_filter_table_t *ef_hunt_filter_table;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
ef10_filter_table_t *ef_ef10_filter_table;
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
} efx_filter_t;
extern void
@ -490,6 +492,8 @@ 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_nvram_ops_t;
#endif /* EFSYS_OPT_NVRAM */
@ -616,7 +620,6 @@ struct efx_nic_s {
efx_filter_t en_filter;
efx_filter_ops_t *en_efop;
#endif /* EFSYS_OPT_FILTER */
efx_pktfilter_ops_t *en_epfop;
#if EFSYS_OPT_MCDI
efx_mcdi_t en_mcdi;
#endif /* EFSYS_OPT_MCDI */
@ -664,26 +667,30 @@ struct efx_nic_s {
int enu_unused;
} siena;
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
struct {
int enu_vi_base;
int enu_vi_count;
#if EFSYS_OPT_VPD
caddr_t enu_svpd;
size_t enu_svpd_length;
#endif /* EFSYS_OPT_VPD */
efx_piobuf_handle_t enu_piobuf_handle[HUNT_PIOBUF_NBUFS];
uint32_t enu_piobuf_count;
uint32_t enu_pio_alloc_map[HUNT_PIOBUF_NBUFS];
uint32_t enu_pio_write_vi_base;
/* Memory BAR mapping regions */
uint32_t enu_uc_mem_map_offset;
size_t enu_uc_mem_map_size;
uint32_t enu_wc_mem_map_offset;
size_t enu_wc_mem_map_size;
} hunt;
#endif /* EFSYS_OPT_HUNTINGTON */
int enu_unused;
} en_u;
#if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
union en_arch {
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;
#endif /* EFSYS_OPT_VPD */
efx_piobuf_handle_t ena_piobuf_handle[EF10_MAX_PIOBUF_NBUFS];
uint32_t ena_piobuf_count;
uint32_t ena_pio_alloc_map[EF10_MAX_PIOBUF_NBUFS];
uint32_t ena_pio_write_vi_base;
/* Memory BAR mapping regions */
uint32_t ena_uc_mem_map_offset;
size_t ena_uc_mem_map_size;
uint32_t ena_wc_mem_map_offset;
size_t ena_wc_mem_map_size;
} ef10;
} en_arch;
#endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */
};
@ -797,6 +804,10 @@ struct efx_txq_s {
rev = 'D'; \
break; \
\
case EFX_FAMILY_MEDFORD: \
rev = 'E'; \
break; \
\
default: \
rev = '?'; \
break; \
@ -1109,7 +1120,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);

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"
@ -67,14 +64,26 @@ static void
falconsiena_intr_fini(
__in efx_nic_t *enp);
static void
falconsiena_intr_status_line(
__in efx_nic_t *enp,
__out boolean_t *fatalp,
__out uint32_t *qmaskp);
static void
falconsiena_intr_status_message(
__in efx_nic_t *enp,
__in unsigned int message,
__out boolean_t *fatalp);
static void
falconsiena_intr_fatal(
__in efx_nic_t *enp);
static __checkReturn boolean_t
falconsiena_intr_check_fatal(
__in efx_nic_t *enp);
static void
falconsiena_intr_fatal(
__in efx_nic_t *enp);
#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
@ -86,6 +95,9 @@ static efx_intr_ops_t __efx_intr_falcon_ops = {
falconsiena_intr_disable, /* eio_disable */
falconsiena_intr_disable_unlocked, /* eio_disable_unlocked */
falconsiena_intr_trigger, /* eio_trigger */
falconsiena_intr_status_line, /* eio_status_line */
falconsiena_intr_status_message, /* eio_status_message */
falconsiena_intr_fatal, /* eio_fatal */
falconsiena_intr_fini, /* eio_fini */
};
#endif /* EFSYS_OPT_FALCON */
@ -97,21 +109,26 @@ static efx_intr_ops_t __efx_intr_siena_ops = {
falconsiena_intr_disable, /* eio_disable */
falconsiena_intr_disable_unlocked, /* eio_disable_unlocked */
falconsiena_intr_trigger, /* eio_trigger */
falconsiena_intr_status_line, /* eio_status_line */
falconsiena_intr_status_message, /* eio_status_message */
falconsiena_intr_fatal, /* eio_fatal */
falconsiena_intr_fini, /* eio_fini */
};
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
static efx_intr_ops_t __efx_intr_hunt_ops = {
hunt_intr_init, /* eio_init */
hunt_intr_enable, /* eio_enable */
hunt_intr_disable, /* eio_disable */
hunt_intr_disable_unlocked, /* eio_disable_unlocked */
hunt_intr_trigger, /* eio_trigger */
hunt_intr_fini, /* eio_fini */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
static efx_intr_ops_t __efx_intr_ef10_ops = {
ef10_intr_init, /* eio_init */
ef10_intr_enable, /* eio_enable */
ef10_intr_disable, /* eio_disable */
ef10_intr_disable_unlocked, /* eio_disable_unlocked */
ef10_intr_trigger, /* eio_trigger */
ef10_intr_status_line, /* eio_status_line */
ef10_intr_status_message, /* eio_status_message */
ef10_intr_fatal, /* eio_fatal */
ef10_intr_fini, /* eio_fini */
};
#endif /* EFSYS_OPT_HUNTINGTON */
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
__checkReturn efx_rc_t
efx_intr_init(
@ -152,10 +169,16 @@ efx_intr_init(
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
eiop = (efx_intr_ops_t *)&__efx_intr_hunt_ops;
eiop = (efx_intr_ops_t *)&__efx_intr_ef10_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
eiop = (efx_intr_ops_t *)&__efx_intr_ef10_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
default:
EFSYS_ASSERT(B_FALSE);
rc = ENOTSUP;
@ -256,35 +279,12 @@ efx_intr_status_line(
__out uint32_t *qmaskp)
{
efx_intr_t *eip = &(enp->en_intr);
efx_dword_t dword;
efx_intr_ops_t *eiop = eip->ei_eiop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
/* Ensure Huntington and Falcon/Siena ISR at same location */
EFX_STATIC_ASSERT(FR_BZ_INT_ISR0_REG_OFST ==
ER_DZ_BIU_INT_ISR_REG_OFST);
/*
* Read the queue mask and implicitly acknowledge the
* interrupt.
*/
EFX_BAR_READD(enp, FR_BZ_INT_ISR0_REG, &dword, B_FALSE);
*qmaskp = EFX_DWORD_FIELD(dword, EFX_DWORD_0);
EFSYS_PROBE1(qmask, uint32_t, *qmaskp);
#if EFSYS_OPT_HUNTINGTON
if (enp->en_family == EFX_FAMILY_HUNTINGTON) {
/* Huntington reports fatal errors via events */
*fatalp = B_FALSE;
return;
}
#endif
if (*qmaskp & (1U << eip->ei_level))
*fatalp = falconsiena_intr_check_fatal(enp);
else
*fatalp = B_FALSE;
eiop->eio_status_line(enp, fatalp, qmaskp);
}
void
@ -294,39 +294,25 @@ efx_intr_status_message(
__out boolean_t *fatalp)
{
efx_intr_t *eip = &(enp->en_intr);
efx_intr_ops_t *eiop = eip->ei_eiop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
#if EFSYS_OPT_HUNTINGTON
if (enp->en_family == EFX_FAMILY_HUNTINGTON) {
/* Huntington reports fatal errors via events */
*fatalp = B_FALSE;
return;
}
#endif
if (message == eip->ei_level)
*fatalp = falconsiena_intr_check_fatal(enp);
else
*fatalp = B_FALSE;
eiop->eio_status_message(enp, message, fatalp);
}
void
efx_intr_fatal(
__in efx_nic_t *enp)
{
efx_intr_t *eip = &(enp->en_intr);
efx_intr_ops_t *eiop = eip->ei_eiop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
#if EFSYS_OPT_HUNTINGTON
if (enp->en_family == EFX_FAMILY_HUNTINGTON) {
/* Huntington reports fatal errors via events */
return;
}
#endif
#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
falconsiena_intr_fatal(enp);
#endif
eiop->eio_fatal(enp);
}
@ -509,6 +495,51 @@ falconsiena_intr_check_fatal(
return (B_FALSE);
}
static void
falconsiena_intr_status_line(
__in efx_nic_t *enp,
__out boolean_t *fatalp,
__out uint32_t *qmaskp)
{
efx_intr_t *eip = &(enp->en_intr);
efx_dword_t dword;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
/*
* Read the queue mask and implicitly acknowledge the
* interrupt.
*/
EFX_BAR_READD(enp, FR_BZ_INT_ISR0_REG, &dword, B_FALSE);
*qmaskp = EFX_DWORD_FIELD(dword, EFX_DWORD_0);
EFSYS_PROBE1(qmask, uint32_t, *qmaskp);
if (*qmaskp & (1U << eip->ei_level))
*fatalp = falconsiena_intr_check_fatal(enp);
else
*fatalp = B_FALSE;
}
static void
falconsiena_intr_status_message(
__in efx_nic_t *enp,
__in unsigned int message,
__out boolean_t *fatalp)
{
efx_intr_t *eip = &(enp->en_intr);
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
if (message == eip->ei_level)
*fatalp = falconsiena_intr_check_fatal(enp);
else
*fatalp = B_FALSE;
}
static void
falconsiena_intr_fatal(
__in efx_nic_t *enp)

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
@ -462,55 +460,6 @@ efx_mac_fcntl_get(
*fcntl_wantedp = wanted;
}
/*
* FIXME: efx_mac_hash_set() should be deleted once all its callers have been
* updated to use efx_mac_multicast_list_set().
* Then efx_port_t.ep_multicst_hash could be made Falcon/Siena specific as
* well.
*/
__checkReturn efx_rc_t
efx_mac_hash_set(
__in efx_nic_t *enp,
__in_ecount(EFX_MAC_HASH_BITS) unsigned int const *bucket)
{
efx_port_t *epp = &(enp->en_port);
efx_mac_ops_t *emop = epp->ep_emop;
efx_oword_t old_hash[2];
unsigned int index;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
memcpy(old_hash, epp->ep_multicst_hash, sizeof (old_hash));
/* Set the lower 128 bits of the hash */
EFX_ZERO_OWORD(epp->ep_multicst_hash[0]);
for (index = 0; index < 128; index++) {
if (bucket[index] != 0)
EFX_SET_OWORD_BIT(epp->ep_multicst_hash[0], index);
}
/* Set the upper 128 bits of the hash */
EFX_ZERO_OWORD(epp->ep_multicst_hash[1]);
for (index = 0; index < 128; index++) {
if (bucket[index + 128] != 0)
EFX_SET_OWORD_BIT(epp->ep_multicst_hash[1], index);
}
if ((rc = emop->emo_reconfigure(enp)) != 0)
goto fail1;
return (0);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
memcpy(epp->ep_multicst_hash, old_hash, sizeof (old_hash));
return (rc);
}
__checkReturn efx_rc_t
efx_mac_multicast_list_set(
__in efx_nic_t *enp,
@ -912,6 +861,8 @@ efx_mac_select(
#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
#define EFX_MAC_HASH_BITS (1 << 8)
/* Compute the multicast hash as used on Falcon and Siena. */
static void
falconsiena_mac_multicast_hash_compute(

View File

@ -31,11 +31,7 @@
#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
@ -56,20 +52,20 @@ static efx_mcdi_ops_t __efx_mcdi_siena_ops = {
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
static efx_mcdi_ops_t __efx_mcdi_hunt_ops = {
hunt_mcdi_init, /* emco_init */
hunt_mcdi_request_copyin, /* emco_request_copyin */
hunt_mcdi_request_copyout, /* emco_request_copyout */
hunt_mcdi_poll_reboot, /* emco_poll_reboot */
hunt_mcdi_poll_response, /* emco_poll_response */
hunt_mcdi_read_response, /* emco_read_response */
hunt_mcdi_fini, /* emco_fini */
hunt_mcdi_feature_supported, /* emco_feature_supported */
static efx_mcdi_ops_t __efx_mcdi_ef10_ops = {
ef10_mcdi_init, /* emco_init */
ef10_mcdi_request_copyin, /* emco_request_copyin */
ef10_mcdi_request_copyout, /* emco_request_copyout */
ef10_mcdi_poll_reboot, /* emco_poll_reboot */
ef10_mcdi_poll_response, /* emco_poll_response */
ef10_mcdi_read_response, /* emco_read_response */
ef10_mcdi_fini, /* emco_fini */
ef10_mcdi_feature_supported, /* emco_feature_supported */
};
#endif /* EFSYS_OPT_HUNTINGTON */
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
@ -100,10 +96,16 @@ efx_mcdi_init(
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
emcop = (efx_mcdi_ops_t *)&__efx_mcdi_hunt_ops;
emcop = (efx_mcdi_ops_t *)&__efx_mcdi_ef10_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
emcop = (efx_mcdi_ops_t *)&__efx_mcdi_ef10_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
default:
EFSYS_ASSERT(0);
rc = ENOTSUP;
@ -637,7 +639,6 @@ efx_mcdi_ev_cpl(
efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;
efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
efx_nic_cfg_t *encp = &enp->en_nic_cfg;
efx_mcdi_req_t *emrp;
int state;
@ -662,7 +663,7 @@ efx_mcdi_ev_cpl(
emip->emi_pending_req = NULL;
EFSYS_UNLOCK(enp->en_eslp, state);
if (encp->enc_mcdi_max_payload_length > MCDI_CTL_SDU_LEN_MAX_V1) {
if (emip->emi_max_version >= 2) {
/* MCDIv2 response details do not fit into an event. */
efx_mcdi_read_response_header(enp, emrp);
} else {
@ -1491,7 +1492,7 @@ efx_mcdi_mac_spoofing_supported(
#if EFSYS_OPT_BIST
#if EFSYS_OPT_HUNTINGTON
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
/*
* Enter bist offline mode. This is a fw mode which puts the NIC into a state
* where memory BIST tests can be run and not much else can interfere or happen.
@ -1527,7 +1528,7 @@ efx_mcdi_bist_enable_offline(
return (rc);
}
#endif /* EFSYS_OPT_HUNTINGTON */
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
__checkReturn efx_rc_t
efx_mcdi_bist_start(
@ -1788,7 +1789,7 @@ efx_mcdi_mac_stats_periodic(
#endif /* EFSYS_OPT_MAC_STATS */
#if EFSYS_OPT_HUNTINGTON
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
/*
* This function returns the pf and vf number of a function. If it is a pf the
@ -1887,7 +1888,7 @@ efx_mcdi_privilege_mask(
return (rc);
}
#endif /* EFSYS_OPT_HUNTINGTON */
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
__checkReturn efx_rc_t
efx_mcdi_set_workaround(

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;
@ -69,6 +68,7 @@ struct efx_mcdi_req_s {
typedef struct efx_mcdi_iface_s {
unsigned int emi_port;
unsigned int emi_max_version;
unsigned int emi_seq;
efx_mcdi_req_t *emi_pending_req;
boolean_t emi_ev_cpl;
@ -188,11 +188,11 @@ efx_mcdi_mac_spoofing_supported(
#if EFSYS_OPT_BIST
#if EFSYS_OPT_HUNTINGTON
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
extern __checkReturn efx_rc_t
efx_mcdi_bist_enable_offline(
__in efx_nic_t *enp);
#endif /* EFSYS_OPT_HUNTINGTON */
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
extern __checkReturn efx_rc_t
efx_mcdi_bist_start(
__in efx_nic_t *enp,

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