|
@@ -72,7 +72,8 @@ int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) {
|
72
|
72
|
/* Only one UNDI instance may be loaded at any given time */
|
73
|
73
|
if ( undi_loader_entry.segment ) {
|
74
|
74
|
DBG ( "UNDI %p cannot load multiple instances\n", undi );
|
75
|
|
- return -EBUSY;
|
|
75
|
+ rc = -EBUSY;
|
|
76
|
+ goto err_multiple;
|
76
|
77
|
}
|
77
|
78
|
|
78
|
79
|
/* Set up START_UNDI parameters */
|
|
@@ -90,10 +91,15 @@ int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) {
|
90
|
91
|
undi_loader.UNDI_CS = fbms_seg;
|
91
|
92
|
fbms_seg -= ( ( undirom->data_size + 0x0f ) >> 4 );
|
92
|
93
|
undi_loader.UNDI_DS = fbms_seg;
|
|
94
|
+ undi->fbms = ( fbms_seg >> 6 );
|
|
95
|
+ set_fbms ( undi->fbms );
|
|
96
|
+ DBGC ( undi, "UNDI %p allocated [%d,%d) kB of base memory\n",
|
|
97
|
+ undi, undi->fbms, undi->restore_fbms );
|
93
|
98
|
|
94
|
99
|
/* Debug info */
|
95
|
|
- DBGC ( undi, "UNDI %p loading UNDI ROM %p to CS %04x DS %04x for ",
|
96
|
|
- undi, undirom, undi_loader.UNDI_CS, undi_loader.UNDI_DS );
|
|
100
|
+ DBGC ( undi, "UNDI %p loading ROM %p to CS %04x:%04zx DS %04x:%04zx "
|
|
101
|
+ "for ", undi, undirom, undi_loader.UNDI_CS, undirom->code_size,
|
|
102
|
+ undi_loader.UNDI_DS, undirom->data_size );
|
97
|
103
|
if ( undi->pci_busdevfn != UNDI_NO_PCI_BUSDEVFN ) {
|
98
|
104
|
unsigned int bus = ( undi->pci_busdevfn >> 8 );
|
99
|
105
|
unsigned int devfn = ( undi->pci_busdevfn & 0xff );
|
|
@@ -116,15 +122,11 @@ int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) {
|
116
|
122
|
: "=a" ( exit )
|
117
|
123
|
: "a" ( __from_data16 ( &undi_loader ) )
|
118
|
124
|
: "ebx", "ecx", "edx", "esi", "edi" );
|
119
|
|
-
|
120
|
125
|
if ( exit != PXENV_EXIT_SUCCESS ) {
|
121
|
|
- /* Clear entry point */
|
122
|
|
- memset ( &undi_loader_entry, 0, sizeof ( undi_loader_entry ) );
|
123
|
|
-
|
124
|
126
|
rc = -EUNDILOAD ( undi_loader.Status );
|
125
|
127
|
DBGC ( undi, "UNDI %p loader failed: %s\n",
|
126
|
128
|
undi, strerror ( rc ) );
|
127
|
|
- return rc;
|
|
129
|
+ goto err_loader;
|
128
|
130
|
}
|
129
|
131
|
|
130
|
132
|
/* Populate PXE device structure */
|
|
@@ -138,13 +140,13 @@ int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) {
|
138
|
140
|
undi->pxenv.offset, undi->ppxe.segment, undi->ppxe.offset,
|
139
|
141
|
undi->entry.segment, undi->entry.offset );
|
140
|
142
|
|
141
|
|
- /* Update free base memory counter */
|
142
|
|
- undi->fbms = ( fbms_seg >> 6 );
|
143
|
|
- set_fbms ( undi->fbms );
|
144
|
|
- DBGC ( undi, "UNDI %p using [%d,%d) kB of base memory\n",
|
145
|
|
- undi, undi->fbms, undi->restore_fbms );
|
146
|
|
-
|
147
|
143
|
return 0;
|
|
144
|
+
|
|
145
|
+ err_loader:
|
|
146
|
+ set_fbms ( undi->restore_fbms );
|
|
147
|
+ memset ( &undi_loader_entry, 0, sizeof ( undi_loader_entry ) );
|
|
148
|
+ err_multiple:
|
|
149
|
+ return rc;
|
148
|
150
|
}
|
149
|
151
|
|
150
|
152
|
/**
|