|
@@ -22,6 +22,7 @@
|
22
|
22
|
#include <pxe.h>
|
23
|
23
|
#include <realmode.h>
|
24
|
24
|
#include <bios.h>
|
|
25
|
+#include <pnpbios.h>
|
25
|
26
|
|
26
|
27
|
/** @file
|
27
|
28
|
*
|
|
@@ -118,6 +119,7 @@ static int pxedrv_parse_pcirheader ( struct pxe_driver *pxedrv,
|
118
|
119
|
static int pxedrv_probe_rom ( unsigned int rom_segment ) {
|
119
|
120
|
struct pxe_driver *pxedrv = NULL;
|
120
|
121
|
struct undi_rom rom;
|
|
122
|
+ size_t rom_len;
|
121
|
123
|
unsigned int pxeromid;
|
122
|
124
|
unsigned int pcirheader;
|
123
|
125
|
int rc;
|
|
@@ -128,6 +130,7 @@ static int pxedrv_probe_rom ( unsigned int rom_segment ) {
|
128
|
130
|
rc = -EINVAL;
|
129
|
131
|
goto err;
|
130
|
132
|
}
|
|
133
|
+ rom_len = ( rom.ROMLength * 512 );
|
131
|
134
|
|
132
|
135
|
/* Allocate memory for PXE driver */
|
133
|
136
|
pxedrv = malloc ( sizeof ( *pxedrv ) );
|
|
@@ -137,8 +140,8 @@ static int pxedrv_probe_rom ( unsigned int rom_segment ) {
|
137
|
140
|
goto err;
|
138
|
141
|
}
|
139
|
142
|
memset ( pxedrv, 0, sizeof ( *pxedrv ) );
|
140
|
|
- DBGC ( pxedrv, "PXEDRV %p using expansion ROM at %04x:0000 (%zdkB)\n",
|
141
|
|
- pxedrv, rom_segment, ( rom.ROMLength / 2 ) );
|
|
143
|
+ DBGC ( pxedrv, "PXEDRV %p trying expansion ROM at %04x:0000 (%zdkB)\n",
|
|
144
|
+ pxedrv, rom_segment, ( rom_len / 1024 ) );
|
142
|
145
|
pxedrv->rom_segment = rom_segment;
|
143
|
146
|
|
144
|
147
|
/* Check for and parse PXE ROM ID */
|
|
@@ -148,6 +151,11 @@ static int pxedrv_probe_rom ( unsigned int rom_segment ) {
|
148
|
151
|
rc = -EINVAL;
|
149
|
152
|
goto err;
|
150
|
153
|
}
|
|
154
|
+ if ( pxeromid > rom_len ) {
|
|
155
|
+ DBGC ( pxedrv, "PXEDRV %p PXE ROM ID outside ROM\n", pxedrv );
|
|
156
|
+ rc = -EINVAL;
|
|
157
|
+ goto err;
|
|
158
|
+ }
|
151
|
159
|
if ( ( rc = pxedrv_parse_pxeromid ( pxedrv, pxeromid ) ) != 0 )
|
152
|
160
|
goto err;
|
153
|
161
|
|
|
@@ -245,17 +253,26 @@ static SEGOFF16_t __data16 ( undi_loader_entry );
|
245
|
253
|
static int pxedrv_load ( struct pxe_driver *pxedrv, struct pxe_device *pxe,
|
246
|
254
|
unsigned int pci_busdevfn, unsigned int isapnp_csn,
|
247
|
255
|
unsigned int isapnp_read_port ) {
|
248
|
|
- int discard;
|
249
|
|
- uint16_t exit;
|
|
256
|
+ int pnpbios_offset;
|
250
|
257
|
uint16_t fbms;
|
251
|
258
|
unsigned int fbms_seg;
|
|
259
|
+ int discard;
|
|
260
|
+ uint16_t exit;
|
252
|
261
|
int rc;
|
253
|
262
|
|
|
263
|
+ /* Record device location information */
|
254
|
264
|
memset ( &undi_loader, 0, sizeof ( undi_loader ) );
|
255
|
265
|
undi_loader.AX = pci_busdevfn;
|
256
|
266
|
undi_loader.BX = isapnp_csn;
|
257
|
267
|
undi_loader.DX = isapnp_read_port;
|
258
|
268
|
|
|
269
|
+ /* Set up PnP BIOS pointer, if PnP BIOS present */
|
|
270
|
+ pnpbios_offset = find_pnp_bios();
|
|
271
|
+ if ( pnpbios_offset >= 0 ) {
|
|
272
|
+ undi_loader.ES = BIOS_SEG;
|
|
273
|
+ undi_loader.DI = pnpbios_offset;
|
|
274
|
+ }
|
|
275
|
+
|
259
|
276
|
/* Allocate base memory for PXE stack */
|
260
|
277
|
get_real ( fbms, BDA_SEG, BDA_FBMS );
|
261
|
278
|
fbms_seg = ( fbms << 6 );
|
|
@@ -279,7 +296,7 @@ static int pxedrv_load ( struct pxe_driver *pxedrv, struct pxe_device *pxe,
|
279
|
296
|
rc = -undi_loader.Status;
|
280
|
297
|
if ( rc == 0 ) /* Paranoia */
|
281
|
298
|
rc = -EIO;
|
282
|
|
- DBGC ( pxedrv, "PXEDRV %p loader failed: %s\n",
|
|
299
|
+ DBGC ( pxedrv, "PXEDRV %p loader failed: %s\n", pxedrv,
|
283
|
300
|
strerror ( rc ) );
|
284
|
301
|
return rc;
|
285
|
302
|
}
|