Browse Source

Obsoleted by drivers/net/undionly.c

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
2738bdf74b
1 changed files with 0 additions and 182 deletions
  1. 0
    182
      src/arch/i386/drivers/bus/pxebus.c

+ 0
- 182
src/arch/i386/drivers/bus/pxebus.c View File

@@ -1,182 +0,0 @@
1
-#if 0
2
-
3
-/*
4
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License as
8
- * published by the Free Software Foundation; either version 2 of the
9
- * License, or any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful, but
12
- * WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
- * General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
- */
20
-
21
-#include <stdint.h>
22
-#include <stdlib.h>
23
-#include <string.h>
24
-#include <assert.h>
25
-#include <pxe.h>
26
-#include <realmode.h>
27
-#include <bios.h>
28
-#include <pnpbios.h>
29
-#include <gpxe/device.h>
30
-#include <gpxe/pci.h>
31
-
32
-/** @file
33
- *
34
- * PXE bus
35
- *
36
- */
37
-
38
-/**
39
- * Byte checksum
40
- *
41
- * @v data		Data to checksum
42
- * @v len		Length of data
43
- * @ret sum		Byte checksum
44
- */
45
-static uint8_t checksum ( void *data, size_t len ) {
46
-	uint8_t *bytes = data;
47
-	unsigned int sum = 0;
48
-
49
-	while ( len-- )
50
-		sum += *(bytes++);
51
-
52
-	return sum;
53
-}
54
-
55
-/**
56
- * Unregister a PXE device
57
- *
58
- * @v pxe		PXE device
59
- *
60
- */
61
-static void unregister_pxedev ( struct pxe_device *pxe ) {
62
-	undi_remove ( pxe );
63
-	list_del ( &pxe->dev.siblings );
64
-	DBGC ( pxe, "PXE %p unregistered\n", pxe );
65
-}
66
-
67
-static void pxebus_remove ( struct root_device *rootdev );
68
-
69
-/**
70
- * Probe PXE root bus
71
- *
72
- * @v rootdev		PXE bus root device
73
- *
74
- * Scans the PXE bus for devices and registers all devices it can
75
- * find.
76
- */
77
-static int pxebus_probe ( struct root_device *rootdev ) {
78
-	struct pxe_device *pxe = NULL;
79
-	struct s_PXENV pxenv;
80
-	struct s_PXE ppxe;
81
-	uint16_t fbms;
82
-	unsigned int segment;
83
-	unsigned int undi_cs;
84
-	int rc;
85
-
86
-	/* Scan through allocated base memory for PXENV+ structure */
87
-	get_real ( fbms, BDA_SEG, BDA_FBMS );
88
-	for ( segment = ( fbms << 6 ) ; segment < 0xa000 ; segment++ ) {
89
-
90
-		/* Verify PXENV+ signature and checksum */
91
-		copy_from_real ( &pxenv, segment, 0, sizeof ( pxenv ) );
92
-		if ( memcmp ( pxenv.Signature, "PXENV+", 6 ) != 0 )
93
-			continue;
94
-		DBG ( "Found PXENV+ signature at %04x0\n", segment );
95
-		if ( checksum ( &pxenv, sizeof ( pxenv ) ) != 0 ) {
96
-			DBG ( "...bad checksum\n" );
97
-			continue;
98
-		}
99
-
100
-		/* Allocate PXE device structure */
101
-		pxe = malloc ( sizeof ( *pxe ) );
102
-		if ( ! pxe ) {
103
-			rc = -ENOMEM;
104
-			goto err;
105
-		}
106
-		memset ( pxe, 0, sizeof ( *pxe ) );
107
-
108
-		/* Add to device hierarchy */
109
-		pxe->dev.parent = &rootdev->dev;
110
-		INIT_LIST_HEAD ( &pxe->dev.children );
111
-		list_add ( &pxe->dev.siblings, &rootdev->dev.children );
112
-
113
-		/* Populate PXE device structure */
114
-		undi_cs = pxenv.UNDICodeSeg;
115
-		pxe->pxenv.segment = undi_cs;
116
-		pxe->pxenv.offset = ( ( segment - undi_cs ) << 4 );
117
-		DBGC ( pxe, "PXE %p has PXENV+ structure at %04x:%04x\n",
118
-		       pxe, pxe->pxenv.segment, pxe->pxenv.offset );
119
-		pxe->entry = pxenv.RMEntry;
120
-		if ( pxenv.Version >= 0x0201 ) {
121
-			pxe->ppxe = pxenv.PXEPtr;
122
-			copy_from_real ( &ppxe, pxe->ppxe.segment,
123
-					 pxe->ppxe.offset, sizeof ( ppxe ) );
124
-			if ( ( memcmp ( ppxe.Signature, "!PXE", 4 ) == 0 ) &&
125
-			     ( checksum ( &ppxe, sizeof ( ppxe ) ) == 0 ) ) {
126
-				DBGC ( pxe, "PXE %p has !PXE structure at "
127
-				       "%04x:%04x\n", pxe,
128
-				       pxe->ppxe.segment, pxe->ppxe.offset );
129
-				pxe->entry = ppxe.EntryPointSP;
130
-			}
131
-		}
132
-		DBGC ( pxe, "PXE %p using entry point at %04x:%04x\n", pxe,
133
-		       pxe->entry.segment, pxe->entry.offset );
134
-
135
-		/* Register PXE device */
136
-		if ( undi_probe ( pxe ) == 0 ) {
137
-			/* Device registered; drop reference */
138
-			pxe = NULL;
139
-		} else {
140
-			/* Not registered; re-use struct pxe_device */
141
-			list_del ( &pxe->dev.siblings );
142
-		}
143
-	}
144
-
145
-	free ( pxe );
146
-	return 0;
147
-
148
- err:
149
-	free ( pxe );
150
-	pxebus_remove ( rootdev );
151
-	return rc;
152
-}
153
-
154
-/**
155
- * Remove PXE root bus
156
- *
157
- * @v rootdev		PXE bus root device
158
- */
159
-static void pxebus_remove ( struct root_device *rootdev ) {
160
-	struct pxe_device *pxe;
161
-	struct pxe_device *tmp;
162
-
163
-	list_for_each_entry_safe ( pxe, tmp, &rootdev->dev.children,
164
-				   dev.siblings ) {
165
-		unregister_pxedev ( pxe );
166
-		free ( pxe );
167
-	}
168
-}
169
-
170
-/** PXE bus root device driver */
171
-static struct root_driver pxe_root_driver = {
172
-	.probe = pxebus_probe,
173
-	.remove = pxebus_remove,
174
-};
175
-
176
-/** PXE bus root device */
177
-struct root_device pxe_root_device __root_device = {
178
-	.name = "PXE",
179
-	.driver = &pxe_root_driver,
180
-};
181
-
182
-#endif

Loading…
Cancel
Save