/*-
* Copyright (c) 2001 Doug Rabson
* Copyright (c) 2002, 2006 Marcel Moolenaar
* 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
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
__FBSDID("$FreeBSD$");
#include <netinet/in_systm.h>
#include <stand.h>
#include <net.h>
#include <netif.h>
#include <dev_net.c>
#include <efi.h>
#include <efilib.h>
static void efinet_end(struct netif *);
static void efinet_init(struct iodesc *, void *);
static int efinet_match(struct netif *, void *);
static int efinet_probe(struct netif *, void *);
.netif_bname = "efinet",
.netif_get = efinet_get,
.netif_put = efinet_put,
.netif_end = efinet_end,
.netif_nifs = 0
};
#ifdef EFINET_DEBUG
static void
{
int i;
printf("MCastFilter = {");
for (i = 0; i < mode->MCastFilterCount; i++)
printf(" }\n");
printf("CurrentAddress = %s\n",
printf("BroadcastAddress = %s\n",
printf("PermanentAddress = %s\n",
}
#endif
static int
{
return (1);
return(0);
}
static int
{
return (0);
}
static int
{
void *buf;
if (status != EFI_SUCCESS)
return (-1);
/* Wait for the buffer to be transmitted */
do {
buf = 0; /* XXX Is this needed? */
/*
* XXX EFI1.1 and the E1000 card returns a different
* address than we gave. Sigh.
*/
/* XXX How do we deal with status != EFI_SUCCESS now? */
}
static int
{
time_t t;
t = time(0);
if (status == EFI_SUCCESS) {
/*
* XXX EFI1.1 and the E1000 card trash our
* workspace if we do not do this silly copy.
* Either they are not respecting the len
* value or do not like the alignment.
*/
return (bufsz);
}
if (status != EFI_NOT_READY)
return (0);
}
return (0);
}
static void
{
EFI_HANDLE h;
return;
}
if (status != EFI_SUCCESS) {
printf("net%d: cannot start interface (status=%lu)\n",
return;
}
if (status != EFI_SUCCESS) {
printf("net%d: cannot start interface (status=%ld)\n",
return;
}
}
if (status != EFI_SUCCESS) {
printf("net%d: cannot init. interface (status=%ld)\n",
return;
}
}
if (status != EFI_SUCCESS) {
printf("net%d: cannot set rx. filters (status=%ld)\n",
return;
}
}
#ifdef EFINET_DEBUG
#endif
}
static void
{
}
static int efinet_dev_init(void);
static int efinet_dev_print(int);
.dv_name = "net",
.dv_cleanup = NULL
};
static int
{
sz = 0;
if (status == EFI_BUFFER_TOO_SMALL) {
handles);
}
return (efi_status_to_errno(status));
if (err != 0)
return (err);
for (i = 0; i < nifs; i++) {
EFI_HANDLE h;
h = efi_find_handle(&efinet_dev, i);
/*
* Open the network device in exclusive mode. Without this
* we will be racing with the UEFI network stack. It will
* pull packets off the network leading to lost packets.
*/
if (status != EFI_SUCCESS) {
printf("Unable to open network interface %d for "
"exclusive access\n", i);
}
dif->dif_private = h;
}
return (0);
}
static int
{
EFI_HANDLE h;
if (ret)
break;
}
return (ret);
}