1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00

o Make efinet_put a blocking call by waiting for the protocol

layer to signal transmission of the packet. This resolves the
   problem I'm seeing that an immediate call to net->Receive
   after calling net->Transmit returns EFI_DEVICE_ERROR. This
   condition seems to be sufficiently persistent that BOOTP and
   RARP fail.
o  While here, unify all functions to have 'nif' defined. Some
   have it as arguments. The others now have them as locals. We
   now always get the protocol interface by using the 'nif' var.

The current status of netbooting is that even though we now reliably
have BOOTP working (again), opening a file (ie loading a kernel)
across the network causes the loader to hang. I'm working on that now.
This commit is contained in:
Marcel Moolenaar 2002-03-29 23:10:15 +00:00
parent 7d8817d249
commit 9423456018
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=93403

View File

@ -56,26 +56,39 @@ efinet_probe(struct netif *nif, void *machdep_hint)
int int
efinet_put(struct iodesc *desc, void *pkt, size_t len) efinet_put(struct iodesc *desc, void *pkt, size_t len)
{ {
EFI_SIMPLE_NETWORK *net = desc->io_netif->nif_devdata; struct netif *nif = desc->io_netif;
EFI_SIMPLE_NETWORK *net;
EFI_STATUS status; EFI_STATUS status;
int i; void *buf;
net = nif->nif_devdata;
status = net->Transmit(net, 0, len, pkt, 0, 0, 0); status = net->Transmit(net, 0, len, pkt, 0, 0, 0);
if (!EFI_ERROR(status)) if (status != EFI_SUCCESS)
return len;
else
return -1; return -1;
/* Wait for the buffer to be transmitted */
buf = 0; /* XXX Is this needed? */
do {
status = net->GetStatus(net, 0, &buf);
} while (status == EFI_SUCCESS && buf != pkt);
/* XXX How do we deal with status != EFI_SUCCESS now? */
return (status == EFI_SUCCESS) ? len : -1;
} }
int int
efinet_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout) efinet_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
{ {
EFI_SIMPLE_NETWORK *net = desc->io_netif->nif_devdata; struct netif *nif = desc->io_netif;
EFI_SIMPLE_NETWORK *net;
EFI_STATUS status; EFI_STATUS status;
UINTN bufsz; UINTN bufsz;
time_t t; time_t t;
net = nif->nif_devdata;
t = time(0); t = time(0);
while ((time(0) - t) < timeout) { while ((time(0) - t) < timeout) {
bufsz = len; bufsz = len;
@ -92,13 +105,11 @@ efinet_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
void void
efinet_init(struct iodesc *desc, void *machdep_hint) efinet_init(struct iodesc *desc, void *machdep_hint)
{ {
struct netif *nif; struct netif *nif = desc->io_netif;
EFI_SIMPLE_NETWORK *net; EFI_SIMPLE_NETWORK *net;
int i;
nif = desc->io_netif;
net = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private; net = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private;
desc->io_netif->nif_devdata = net; nif->nif_devdata = net;
net->Start(net); net->Start(net);
net->Initialize(net, 0, 0); net->Initialize(net, 0, 0);
@ -145,7 +156,6 @@ efinet_init_driver()
dif->dif_unit = i; dif->dif_unit = i;
dif->dif_nsel = 1; dif->dif_nsel = 1;
dif->dif_stats = &stats[i]; dif->dif_stats = &stats[i];
dif->dif_private = handles[i];
BS->HandleProtocol(handles[i], &netid, BS->HandleProtocol(handles[i], &netid,
(VOID**) &dif->dif_private); (VOID**) &dif->dif_private);