pxe.c revision 1.14 1 1.14 cegger /* $NetBSD: pxe.c,v 1.14 2009/03/18 10:22:30 cegger Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*
4 1.1 thorpej * Copyright 2001 Wasabi Systems, Inc.
5 1.1 thorpej * All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 1.1 thorpej *
9 1.1 thorpej * Redistribution and use in source and binary forms, with or without
10 1.1 thorpej * modification, are permitted provided that the following conditions
11 1.1 thorpej * are met:
12 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
13 1.1 thorpej * notice, this list of conditions and the following disclaimer.
14 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
16 1.1 thorpej * documentation and/or other materials provided with the distribution.
17 1.1 thorpej * 3. All advertising materials mentioning features or use of this software
18 1.1 thorpej * must display the following acknowledgement:
19 1.1 thorpej * This product includes software developed for the NetBSD Project by
20 1.1 thorpej * Wasabi Systems, Inc.
21 1.1 thorpej * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 1.1 thorpej * or promote products derived from this software without specific prior
23 1.1 thorpej * written permission.
24 1.1 thorpej *
25 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 1.1 thorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 1.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 1.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 1.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 1.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 1.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 1.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 1.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 1.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 1.1 thorpej * POSSIBILITY OF SUCH DAMAGE.
36 1.1 thorpej */
37 1.1 thorpej
38 1.1 thorpej /*
39 1.1 thorpej * Copyright (c) 2000 Alfred Perlstein <alfred (at) freebsd.org>
40 1.1 thorpej * All rights reserved.
41 1.1 thorpej * Copyright (c) 2000 Paul Saab <ps (at) freebsd.org>
42 1.1 thorpej * All rights reserved.
43 1.1 thorpej * Copyright (c) 2000 John Baldwin <jhb (at) freebsd.org>
44 1.1 thorpej * All rights reserved.
45 1.1 thorpej *
46 1.1 thorpej * Redistribution and use in source and binary forms, with or without
47 1.1 thorpej * modification, are permitted provided that the following conditions
48 1.1 thorpej * are met:
49 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
50 1.1 thorpej * notice, this list of conditions and the following disclaimer.
51 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
52 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
53 1.1 thorpej * documentation and/or other materials provided with the distribution.
54 1.1 thorpej *
55 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
56 1.1 thorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 1.1 thorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58 1.1 thorpej * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
59 1.1 thorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60 1.1 thorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61 1.1 thorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62 1.1 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
63 1.1 thorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
64 1.1 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 1.1 thorpej * SUCH DAMAGE.
66 1.1 thorpej */
67 1.1 thorpej
68 1.1 thorpej /*
69 1.1 thorpej * Support for the Intel Preboot Execution Environment (PXE).
70 1.1 thorpej *
71 1.1 thorpej * PXE provides a UDP implementation as well as a UNDI network device
72 1.1 thorpej * driver. UNDI is much more complicated to use than PXE UDP, so we
73 1.1 thorpej * use PXE UDP as a cheap and easy way to get PXE support.
74 1.1 thorpej */
75 1.1 thorpej
76 1.1 thorpej #include <sys/param.h>
77 1.1 thorpej #include <sys/socket.h>
78 1.1 thorpej
79 1.1 thorpej #ifdef _STANDALONE
80 1.1 thorpej #include <lib/libkern/libkern.h>
81 1.1 thorpej #else
82 1.1 thorpej #include <string.h>
83 1.1 thorpej #endif
84 1.1 thorpej
85 1.1 thorpej #include <netinet/in.h>
86 1.1 thorpej #include <netinet/in_systm.h>
87 1.1 thorpej #include <netinet/ip.h>
88 1.1 thorpej #include <netinet/ip_var.h>
89 1.1 thorpej #include <netinet/udp.h>
90 1.1 thorpej #include <netinet/udp_var.h>
91 1.1 thorpej
92 1.1 thorpej #include <net/if_ether.h>
93 1.1 thorpej
94 1.1 thorpej #include <lib/libsa/stand.h>
95 1.1 thorpej #include <lib/libsa/net.h>
96 1.1 thorpej #include <lib/libsa/bootp.h>
97 1.1 thorpej
98 1.1 thorpej #include <libi386.h>
99 1.1 thorpej #include <bootinfo.h>
100 1.1 thorpej
101 1.1 thorpej #include "pxeboot.h"
102 1.1 thorpej #include "pxe.h"
103 1.6 drochner #include "pxe_netif.h"
104 1.1 thorpej
105 1.9 perry void (*pxe_call)(uint16_t);
106 1.1 thorpej
107 1.9 perry void pxecall_bangpxe(uint16_t); /* pxe_call.S */
108 1.9 perry void pxecall_pxenv(uint16_t); /* pxe_call.S */
109 1.1 thorpej
110 1.1 thorpej char pxe_command_buf[256];
111 1.1 thorpej
112 1.1 thorpej BOOTPLAYER bootplayer;
113 1.1 thorpej
114 1.6 drochner static struct btinfo_netif bi_netif;
115 1.6 drochner
116 1.1 thorpej /*****************************************************************************
117 1.1 thorpej * This section is a replacement for libsa/udp.c
118 1.1 thorpej *****************************************************************************/
119 1.1 thorpej
120 1.1 thorpej /* Caller must leave room for ethernet, ip, and udp headers in front!! */
121 1.1 thorpej ssize_t
122 1.1 thorpej sendudp(struct iodesc *d, void *pkt, size_t len)
123 1.1 thorpej {
124 1.1 thorpej t_PXENV_UDP_WRITE *uw = (void *) pxe_command_buf;
125 1.1 thorpej
126 1.1 thorpej uw->status = 0;
127 1.1 thorpej
128 1.1 thorpej uw->ip = d->destip.s_addr;
129 1.1 thorpej uw->gw = gateip.s_addr;
130 1.1 thorpej uw->src_port = d->myport;
131 1.1 thorpej uw->dst_port = d->destport;
132 1.1 thorpej uw->buffer_size = len;
133 1.1 thorpej uw->buffer.segment = VTOPSEG(pkt);
134 1.1 thorpej uw->buffer.offset = VTOPOFF(pkt);
135 1.1 thorpej
136 1.1 thorpej pxe_call(PXENV_UDP_WRITE);
137 1.1 thorpej
138 1.1 thorpej if (uw->status != PXENV_STATUS_SUCCESS) {
139 1.1 thorpej /* XXX This happens a lot; it shouldn't. */
140 1.1 thorpej if (uw->status != PXENV_STATUS_FAILURE)
141 1.1 thorpej printf("sendudp: PXENV_UDP_WRITE failed: 0x%x\n",
142 1.1 thorpej uw->status);
143 1.1 thorpej return (-1);
144 1.1 thorpej }
145 1.1 thorpej
146 1.1 thorpej return (len);
147 1.1 thorpej }
148 1.1 thorpej
149 1.1 thorpej /*
150 1.1 thorpej * Receive a UDP packet and validate it for us.
151 1.1 thorpej * Caller leaves room for the headers (Ether, IP, UDP).
152 1.1 thorpej */
153 1.1 thorpej ssize_t
154 1.12 tsutsui readudp(struct iodesc *d, void *pkt, size_t len, saseconds_t tleft)
155 1.1 thorpej {
156 1.1 thorpej t_PXENV_UDP_READ *ur = (void *) pxe_command_buf;
157 1.1 thorpej struct udphdr *uh;
158 1.1 thorpej struct ip *ip;
159 1.1 thorpej
160 1.1 thorpej uh = (struct udphdr *)pkt - 1;
161 1.1 thorpej ip = (struct ip *)uh - 1;
162 1.1 thorpej
163 1.11 christos (void)memset(ur, 0, sizeof(*ur));
164 1.1 thorpej
165 1.1 thorpej ur->dest_ip = d->myip.s_addr;
166 1.1 thorpej ur->d_port = d->myport;
167 1.1 thorpej ur->buffer_size = len;
168 1.1 thorpej ur->buffer.segment = VTOPSEG(pkt);
169 1.1 thorpej ur->buffer.offset = VTOPOFF(pkt);
170 1.1 thorpej
171 1.1 thorpej /* XXX Timeout unused. */
172 1.1 thorpej
173 1.1 thorpej pxe_call(PXENV_UDP_READ);
174 1.1 thorpej
175 1.1 thorpej if (ur->status != PXENV_STATUS_SUCCESS) {
176 1.1 thorpej /* XXX This happens a lot; it shouldn't. */
177 1.1 thorpej if (ur->status != PXENV_STATUS_FAILURE)
178 1.1 thorpej printf("readudp: PXENV_UDP_READ_failed: 0x%0x\n",
179 1.1 thorpej ur->status);
180 1.1 thorpej return (-1);
181 1.1 thorpej }
182 1.1 thorpej
183 1.1 thorpej ip->ip_src.s_addr = ur->src_ip;
184 1.1 thorpej uh->uh_sport = ur->s_port;
185 1.1 thorpej uh->uh_dport = d->myport;
186 1.1 thorpej
187 1.5 drochner return (ur->buffer_size);
188 1.1 thorpej }
189 1.1 thorpej
190 1.6 drochner /*
191 1.6 drochner * netif layer:
192 1.6 drochner * open, close, shutdown: called from dev_net.c
193 1.6 drochner * socktodesc: called by network protocol modules
194 1.6 drochner *
195 1.6 drochner * We only allow one open socket.
196 1.6 drochner */
197 1.1 thorpej
198 1.6 drochner static int pxe_inited;
199 1.6 drochner static struct iodesc desc;
200 1.1 thorpej
201 1.1 thorpej int
202 1.14 cegger pxe_netif_open(void)
203 1.1 thorpej {
204 1.1 thorpej t_PXENV_UDP_OPEN *uo = (void *) pxe_command_buf;
205 1.1 thorpej
206 1.6 drochner if (!pxe_inited) {
207 1.6 drochner if (pxe_init() != 0)
208 1.6 drochner return (-1);
209 1.6 drochner pxe_inited = 1;
210 1.6 drochner }
211 1.6 drochner BI_ADD(&bi_netif, BTINFO_NETIF, sizeof(bi_netif));
212 1.1 thorpej
213 1.11 christos (void)memset(uo, 0, sizeof(*uo));
214 1.1 thorpej
215 1.1 thorpej uo->src_ip = bootplayer.yip;
216 1.1 thorpej
217 1.1 thorpej pxe_call(PXENV_UDP_OPEN);
218 1.1 thorpej
219 1.1 thorpej if (uo->status != PXENV_STATUS_SUCCESS) {
220 1.1 thorpej printf("pxe_netif_probe: PXENV_UDP_OPEN failed: 0x%x\n",
221 1.1 thorpej uo->status);
222 1.6 drochner return (-1);
223 1.1 thorpej }
224 1.1 thorpej
225 1.6 drochner bcopy(bootplayer.CAddr, desc.myea, ETHER_ADDR_LEN);
226 1.1 thorpej
227 1.1 thorpej /*
228 1.1 thorpej * Since the PXE BIOS has already done DHCP, make sure we
229 1.1 thorpej * don't reuse any of its transaction IDs.
230 1.1 thorpej */
231 1.6 drochner desc.xid = bootplayer.ident;
232 1.1 thorpej
233 1.6 drochner return (0);
234 1.1 thorpej }
235 1.1 thorpej
236 1.1 thorpej void
237 1.13 dsl pxe_netif_close(int sock)
238 1.1 thorpej {
239 1.1 thorpej t_PXENV_UDP_CLOSE *uc = (void *) pxe_command_buf;
240 1.1 thorpej
241 1.6 drochner #ifdef NETIF_DEBUG
242 1.6 drochner if (sock != 0)
243 1.6 drochner printf("pxe_netif_close: sock=%d\n", sock);
244 1.6 drochner #endif
245 1.6 drochner
246 1.1 thorpej uc->status = 0;
247 1.1 thorpej
248 1.1 thorpej pxe_call(PXENV_UDP_CLOSE);
249 1.1 thorpej
250 1.1 thorpej if (uc->status != PXENV_STATUS_SUCCESS)
251 1.1 thorpej printf("pxe_netif_end: PXENV_UDP_CLOSE failed: 0x%x\n",
252 1.1 thorpej uc->status);
253 1.6 drochner }
254 1.6 drochner
255 1.6 drochner void
256 1.14 cegger pxe_netif_shutdown(void)
257 1.6 drochner {
258 1.2 thorpej
259 1.2 thorpej pxe_fini();
260 1.1 thorpej }
261 1.1 thorpej
262 1.6 drochner struct iodesc *
263 1.13 dsl socktodesc(int sock)
264 1.6 drochner {
265 1.6 drochner
266 1.6 drochner #ifdef NETIF_DEBUG
267 1.6 drochner if (sock != 0)
268 1.6 drochner return (0);
269 1.6 drochner else
270 1.6 drochner #endif
271 1.6 drochner return (&desc);
272 1.6 drochner }
273 1.6 drochner
274 1.1 thorpej /*****************************************************************************
275 1.1 thorpej * PXE initialization and support routines
276 1.1 thorpej *****************************************************************************/
277 1.1 thorpej
278 1.9 perry uint16_t pxe_command_buf_seg;
279 1.9 perry uint16_t pxe_command_buf_off;
280 1.1 thorpej
281 1.9 perry extern uint16_t bangpxe_off, bangpxe_seg;
282 1.9 perry extern uint16_t pxenv_off, pxenv_seg;
283 1.1 thorpej
284 1.1 thorpej static struct btinfo_netif bi_netif;
285 1.1 thorpej
286 1.1 thorpej int
287 1.1 thorpej pxe_init(void)
288 1.1 thorpej {
289 1.1 thorpej t_PXENV_GET_CACHED_INFO *gci = (void *) pxe_command_buf;
290 1.1 thorpej t_PXENV_UNDI_GET_NIC_TYPE *gnt = (void *) pxe_command_buf;
291 1.1 thorpej pxenv_t *pxenv;
292 1.1 thorpej pxe_t *pxe;
293 1.1 thorpej char *cp;
294 1.1 thorpej int i;
295 1.9 perry uint8_t cksum, *ucp;
296 1.1 thorpej
297 1.1 thorpej /*
298 1.1 thorpej * Checking for the presence of PXE is a machine-dependent
299 1.1 thorpej * operation. On the IA-32, this can be done two ways:
300 1.1 thorpej *
301 1.1 thorpej * Int 0x1a function 0x5650
302 1.1 thorpej *
303 1.1 thorpej * Scan memory for the !PXE or PXENV+ signatures
304 1.1 thorpej *
305 1.1 thorpej * We do the latter, since the Int method returns a pointer
306 1.1 thorpej * to a deprecated structure (PXENV+).
307 1.1 thorpej */
308 1.1 thorpej
309 1.1 thorpej pxenv = NULL;
310 1.1 thorpej pxe = NULL;
311 1.1 thorpej
312 1.4 kanaoka for (cp = (char *)0xa0000; cp > (char *)0x10000; cp -= 2) {
313 1.1 thorpej if (pxenv == NULL) {
314 1.1 thorpej pxenv = (pxenv_t *)cp;
315 1.7 tron if (MEMSTRCMP(pxenv->Signature, "PXENV+"))
316 1.1 thorpej pxenv = NULL;
317 1.1 thorpej else {
318 1.9 perry for (i = 0, ucp = (uint8_t *)cp, cksum = 0;
319 1.1 thorpej i < pxenv->Length; i++)
320 1.1 thorpej cksum += ucp[i];
321 1.1 thorpej if (cksum != 0) {
322 1.1 thorpej printf("pxe_init: bad cksum (0x%x) "
323 1.1 thorpej "for PXENV+ at 0x%lx\n", cksum,
324 1.1 thorpej (u_long) cp);
325 1.1 thorpej pxenv = NULL;
326 1.1 thorpej }
327 1.1 thorpej }
328 1.1 thorpej }
329 1.1 thorpej
330 1.1 thorpej if (pxe == NULL) {
331 1.1 thorpej pxe = (pxe_t *)cp;
332 1.7 tron if (MEMSTRCMP(pxe->Signature, "!PXE"))
333 1.1 thorpej pxe = NULL;
334 1.1 thorpej else {
335 1.9 perry for (i = 0, ucp = (uint8_t *)cp, cksum = 0;
336 1.1 thorpej i < pxe->StructLength; i++)
337 1.1 thorpej cksum += ucp[i];
338 1.1 thorpej if (cksum != 0) {
339 1.1 thorpej printf("pxe_init: bad cksum (0x%x) "
340 1.1 thorpej "for !PXE at 0x%lx\n", cksum,
341 1.1 thorpej (u_long) cp);
342 1.1 thorpej pxe = NULL;
343 1.1 thorpej }
344 1.1 thorpej }
345 1.1 thorpej }
346 1.1 thorpej
347 1.1 thorpej if (pxe != NULL && pxenv != NULL)
348 1.1 thorpej break;
349 1.1 thorpej }
350 1.1 thorpej
351 1.1 thorpej if (pxe == NULL && pxenv == NULL) {
352 1.1 thorpej printf("pxe_init: No PXE BIOS found.\n");
353 1.1 thorpej return (1);
354 1.1 thorpej }
355 1.1 thorpej
356 1.1 thorpej if (pxenv != NULL) {
357 1.1 thorpej printf("PXE BIOS Version %d.%d\n",
358 1.1 thorpej (pxenv->Version >> 8) & 0xff, pxenv->Version & 0xff);
359 1.1 thorpej if (pxenv->Version >= 0x0201 && pxe != NULL) {
360 1.1 thorpej /* 2.1 or greater -- don't use PXENV+ */
361 1.1 thorpej pxenv = NULL;
362 1.1 thorpej }
363 1.1 thorpej }
364 1.1 thorpej
365 1.1 thorpej if (pxe != NULL) {
366 1.1 thorpej pxe_call = pxecall_bangpxe;
367 1.1 thorpej bangpxe_off = pxe->EntryPointSP.offset;
368 1.1 thorpej bangpxe_seg = pxe->EntryPointSP.segment;
369 1.1 thorpej } else {
370 1.1 thorpej pxe_call = pxecall_pxenv;
371 1.1 thorpej pxenv_off = pxenv->RMEntry.offset;
372 1.1 thorpej pxenv_seg = pxenv->RMEntry.segment;
373 1.1 thorpej }
374 1.1 thorpej
375 1.1 thorpej /*
376 1.1 thorpej * Pre-compute the segment/offset of the pxe_command_buf
377 1.1 thorpej * to make things nicer in the low-level calling glue.
378 1.1 thorpej */
379 1.1 thorpej pxe_command_buf_seg = VTOPSEG(pxe_command_buf);
380 1.1 thorpej pxe_command_buf_off = VTOPOFF(pxe_command_buf);
381 1.1 thorpej
382 1.1 thorpej /*
383 1.1 thorpej * Get the cached info from the server's Discovery reply packet.
384 1.1 thorpej */
385 1.11 christos (void)memset(gci, 0, sizeof(*gci));
386 1.1 thorpej gci->PacketType = PXENV_PACKET_TYPE_BINL_REPLY;
387 1.1 thorpej pxe_call(PXENV_GET_CACHED_INFO);
388 1.1 thorpej if (gci->Status != PXENV_STATUS_SUCCESS) {
389 1.1 thorpej printf("pxe_init: PXENV_GET_CACHED_INFO failed: 0x%x\n",
390 1.1 thorpej gci->Status);
391 1.1 thorpej return (1);
392 1.1 thorpej }
393 1.1 thorpej pvbcopy((void *)((gci->Buffer.segment << 4) + gci->Buffer.offset),
394 1.1 thorpej &bootplayer, gci->BufferSize);
395 1.1 thorpej
396 1.1 thorpej /*
397 1.1 thorpej * Get network interface information.
398 1.1 thorpej */
399 1.11 christos (void)memset(gnt, 0, sizeof(*gnt));
400 1.1 thorpej pxe_call(PXENV_UNDI_GET_NIC_TYPE);
401 1.1 thorpej
402 1.1 thorpej if (gnt->Status != PXENV_STATUS_SUCCESS) {
403 1.1 thorpej printf("pxe_init: PXENV_UNDI_GET_NIC_TYPE failed: 0x%x\n",
404 1.1 thorpej gnt->Status);
405 1.1 thorpej return (0);
406 1.1 thorpej }
407 1.1 thorpej
408 1.1 thorpej switch (gnt->NicType) {
409 1.1 thorpej case PCI_NIC:
410 1.1 thorpej case CardBus_NIC:
411 1.1 thorpej strncpy(bi_netif.ifname, "pxe", sizeof(bi_netif.ifname));
412 1.1 thorpej bi_netif.bus = BI_BUS_PCI;
413 1.1 thorpej bi_netif.addr.tag = gnt->info.pci.BusDevFunc;
414 1.1 thorpej
415 1.1 thorpej printf("Using %s device at bus %d device %d function %d\n",
416 1.1 thorpej gnt->NicType == PCI_NIC ? "PCI" : "CardBus",
417 1.1 thorpej (gnt->info.pci.BusDevFunc >> 8) & 0xff,
418 1.1 thorpej (gnt->info.pci.BusDevFunc >> 3) & 0x1f,
419 1.1 thorpej gnt->info.pci.BusDevFunc & 0x7);
420 1.1 thorpej break;
421 1.1 thorpej
422 1.1 thorpej case PnP_NIC:
423 1.1 thorpej /* XXX Make bootinfo work with this. */
424 1.1 thorpej printf("Using PnP device at 0x%x\n", gnt->info.pnp.CardSelNum);
425 1.1 thorpej }
426 1.6 drochner
427 1.6 drochner printf("Ethernet address %s\n", ether_sprintf(bootplayer.CAddr));
428 1.1 thorpej
429 1.1 thorpej return (0);
430 1.1 thorpej }
431 1.1 thorpej
432 1.1 thorpej void
433 1.1 thorpej pxe_fini(void)
434 1.1 thorpej {
435 1.1 thorpej t_PXENV_UNDI_SHUTDOWN *shutdown = (void *) pxe_command_buf;
436 1.1 thorpej
437 1.1 thorpej if (pxe_call == NULL)
438 1.1 thorpej return;
439 1.1 thorpej
440 1.1 thorpej pxe_call(PXENV_UNDI_SHUTDOWN);
441 1.1 thorpej
442 1.1 thorpej if (shutdown->Status != PXENV_STATUS_SUCCESS)
443 1.1 thorpej printf("pxe_fini: PXENV_UNDI_SHUTDOWN failed: 0x%x\n",
444 1.1 thorpej shutdown->Status);
445 1.1 thorpej }
446