source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/ConfigurationMenu.asm@ 587

Last change on this file since 587 was 567, checked in by krille_n_@…, 11 years ago

Changes:

  • Renamed MODULE_FEATURE_SETS to MODULE_POWER_MANAGEMENT.
  • Renamed MODULE_VERY_LATE_INITIALIZATION to MODULE_VERY_LATE_INIT and removed it from the official builds.
  • Removed the code that skips detection of slave drives on XT-CF controllers since slave drives can be used with Lo-tech ISA CompactFlash boards.
  • Added autodetection of the SVC ADP50L controller to XTIDECFG.
  • The autodetection of XT-CF controllers now requires MODULE_8BIT_IDE_ADVANCED in the loaded BIOS.
  • Fixed a bug in XTIDECFG from r502 where the "Base (cmd block) address" menu option would be displayed when a serial device was selected as the IDE controller.
  • XTIDECFG would display the "Enable interrupt" menu option for the XTIDE r1 but not for the XTIDE r2. It's now displayed for both controller types.
  • Disabled the "Internal Write Cache" menu option in the Master/Slave Drive menus for serial device type drives.
  • Optimizations and other fixes.
File size: 15.5 KB
Line 
1; Project name : XTIDE Universal BIOS Configurator v2
2; Description : "Configure XTIDE Universal BIOS" menu structs and functions.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
12;
13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20; Section containing initialized data
21SECTION .data
22
23ALIGN WORD_ALIGN
24g_MenupageForConfigurationMenu:
25istruc MENUPAGE
26 at MENUPAGE.fnEnter, dw ConfigurationMenu_EnterMenuOrModifyItemVisibility
27 at MENUPAGE.fnBack, dw MainMenu_EnterMenuOrModifyItemVisibility
28 at MENUPAGE.wMenuitems, dw 11
29iend
30
31g_MenuitemConfigurationBackToMainMenu:
32istruc MENUITEM
33 at MENUITEM.fnActivate, dw MainMenu_EnterMenuOrModifyItemVisibility
34 at MENUITEM.szName, dw g_szItemCfgBackToMain
35 at MENUITEM.szQuickInfo, dw g_szItemCfgBackToMain
36 at MENUITEM.szHelp, dw g_szItemCfgBackToMain
37 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
38 at MENUITEM.bType, db TYPE_MENUITEM_PAGEBACK
39iend
40
41g_MenuitemConfigurationPrimaryIdeController:
42istruc MENUITEM
43 at MENUITEM.fnActivate, dw PrimaryIdeController
44 at MENUITEM.szName, dw g_szItemCfgIde1
45 at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
46 at MENUITEM.szHelp, dw g_szNfoCfgIde
47 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
48 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
49iend
50
51g_MenuitemConfigurationSecondaryIdeController:
52istruc MENUITEM
53 at MENUITEM.fnActivate, dw SecondaryIdeController
54 at MENUITEM.szName, dw g_szItemCfgIde2
55 at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
56 at MENUITEM.szHelp, dw g_szNfoCfgIde
57 at MENUITEM.bFlags, db NULL
58 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
59iend
60
61g_MenuitemConfigurationTertiaryIdeController:
62istruc MENUITEM
63 at MENUITEM.fnActivate, dw TertiaryIdeController
64 at MENUITEM.szName, dw g_szItemCfgIde3
65 at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
66 at MENUITEM.szHelp, dw g_szNfoCfgIde
67 at MENUITEM.bFlags, db NULL
68 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
69iend
70
71g_MenuitemConfigurationQuaternaryIdeController:
72istruc MENUITEM
73 at MENUITEM.fnActivate, dw QuaternaryIdeController
74 at MENUITEM.szName, dw g_szItemCfgIde4
75 at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
76 at MENUITEM.szHelp, dw g_szNfoCfgIde
77 at MENUITEM.bFlags, db NULL
78 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
79iend
80
81g_MenuitemConfigurationBootMenuSettings:
82istruc MENUITEM
83 at MENUITEM.fnActivate, dw BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility
84 at MENUITEM.szName, dw g_szItemCfgBootMenu
85 at MENUITEM.szQuickInfo, dw g_szNfoCfgBootMenu
86 at MENUITEM.szHelp, dw g_szNfoCfgBootMenu
87 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
88 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
89iend
90
91g_MenuitemAutoConfigure:
92istruc MENUITEM
93 at MENUITEM.fnActivate, dw AutoConfigure_ForThisSystem
94 at MENUITEM.szName, dw g_szItemAutoConfigure
95 at MENUITEM.szQuickInfo, dw g_szNfoAutoConfigure
96 at MENUITEM.szHelp, dw g_szNfoAutoConfigure
97 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU
98 at MENUITEM.bType, db TYPE_MENUITEM_ACTION
99iend
100
101g_MenuitemConfigurationFullOperatingMode:
102istruc MENUITEM
103 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
104 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
105 at MENUITEM.szName, dw g_szItemCfgFullMode
106 at MENUITEM.szQuickInfo, dw g_szNfoCfgFullMode
107 at MENUITEM.szHelp, dw g_szHelpCfgFullMode
108 at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE
109 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
110 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.wFlags
111 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgFullMode
112 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag
113 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
114 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_ROMVARS_FULLMODE
115iend
116
117g_MenuitemConfigurationKiBtoStealFromRAM:
118istruc MENUITEM
119 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
120 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
121 at MENUITEM.szName, dw g_szItemCfgStealSize
122 at MENUITEM.szQuickInfo, dw g_szNfoCfgStealSize
123 at MENUITEM.szHelp, dw g_szHelpCfgStealSize
124 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_BYTEVALUE
125 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
126 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bStealSize
127 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgStealSize
128 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
129 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 255
130iend
131
132g_MenuitemConfigurationIdeControllers:
133istruc MENUITEM
134 at MENUITEM.fnActivate, dw ActivateInputForNumberOfIdeControllersMenuitemInDSSI
135 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
136 at MENUITEM.szName, dw g_szItemCfgIdeCnt
137 at MENUITEM.szQuickInfo, dw g_szNfoCfgIdeCnt
138 at MENUITEM.szHelp, dw g_szNfoCfgIdeCnt
139 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE
140 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
141 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bIdeCnt
142 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgIdeCnt
143 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
144 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw MAX_ALLOWED_IDE_CONTROLLERS
145iend
146
147g_MenuitemConfigurationIdleTimeout:
148istruc MENUITEM
149 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
150 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI
151 at MENUITEM.szName, dw g_szItemCfgIdleTimeout
152 at MENUITEM.szQuickInfo, dw g_szNfoCfgIdleTimeout
153 at MENUITEM.szHelp, dw g_szHelpCfgIdleTimeout
154 at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS
155 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
156 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bIdleTimeout
157 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgIdleTimeout
158 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceIdleTimeout
159 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForIdleTimeout
160 at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForIdleTimeout
161iend
162
163g_rgwChoiceToValueLookupForIdleTimeout:
164 %assign i -12
165 %rep 21
166 %assign i i+12
167 dw i ; i / 12 = 0 (disabled) or 1...20 minutes
168 %endrep
169 %rep 4
170 %assign i i+1
171 dw i ; 241...244 = (i - 240) * 30 minutes
172 %endrep
173g_rgszChoiceToStringLookupForIdleTimeout:
174 %assign i 0
175 %rep 25
176 dw g_szIdleTimeoutChoice%[i]
177 %assign i i+1
178 %endrep
179 ; dw NULL ; Is this needed? *FIXME*
180
181; Section containing code
182SECTION .text
183
184;--------------------------------------------------------------------
185; MainMenu_EnterMenuOrModifyItemVisibility
186; Parameters:
187; SS:BP: Menu handle
188; Returns:
189; Nothing
190; Corrupts registers:
191; All, except BP
192;--------------------------------------------------------------------
193ALIGN JUMP_ALIGN
194ConfigurationMenu_EnterMenuOrModifyItemVisibility:
195 push cs
196 pop ds
197 call .DisableAllIdeControllerMenuitems
198 call .EnableIdeControllerMenuitemsBasedOnConfiguration
199 call .EnableOrDisableOperatingModeSelection
200 call .EnableOrDisableKiBtoStealFromRAM
201 call .EnableOrDisableIdleTimeout
202 call LimitIdeControllersForLiteMode
203 mov si, g_MenupageForConfigurationMenu
204 jmp Menupage_ChangeToNewMenupageInDSSI
205
206;--------------------------------------------------------------------
207; .DisableAllIdeControllerMenuitems
208; .EnableIdeControllerMenuitemsBasedOnConfiguration
209; Parameters:
210; SS:BP: Menu handle
211; Returns:
212; Nothing
213; Corrupts registers:
214; AX, BX, CX, DI, ES
215;--------------------------------------------------------------------
216ALIGN JUMP_ALIGN
217.DisableAllIdeControllerMenuitems:
218 mov cx, MAX_ALLOWED_IDE_CONTROLLERS-1
219 mov ax, DisableMenuitemFromCSBX
220 jmp SHORT .Go
221
222ALIGN JUMP_ALIGN
223.EnableIdeControllerMenuitemsBasedOnConfiguration:
224 call Buffers_GetIdeControllerCountToCX
225 dec cx ; Primary always enabled
226 jz SHORT .PrimaryControllerAlreadyEnabled
227 mov ax, EnableMenuitemFromCSBX
228.Go:
229 mov bx, g_MenuitemConfigurationSecondaryIdeController
230ALIGN JUMP_ALIGN
231.EnableOrDisableNextIdeControllerMenuitem:
232 call ax
233 add bx, BYTE MENUITEM_size
234 loop .EnableOrDisableNextIdeControllerMenuitem
235.PrimaryControllerAlreadyEnabled:
236 ret
237
238
239;--------------------------------------------------------------------
240; .EnableOrDisableOperatingModeSelection
241; Parameters:
242; SS:BP: Menu handle
243; Returns:
244; Nothing
245; Corrupts registers:
246; BX, DI, ES
247;--------------------------------------------------------------------
248ALIGN JUMP_ALIGN
249.EnableOrDisableOperatingModeSelection:
250 mov bx, g_MenuitemConfigurationFullOperatingMode
251 call Buffers_IsXTbuildLoaded
252 je SHORT .EnableMenuitemFromCSBX
253 jmp SHORT .DisableMenuitemFromCSBX
254
255
256;--------------------------------------------------------------------
257; .EnableOrDisableKiBtoStealFromRAM
258; Parameters:
259; SS:BP: Menu handle
260; Returns:
261; Nothing
262; Corrupts registers:
263; AX, BX, CX
264;--------------------------------------------------------------------
265ALIGN JUMP_ALIGN
266.EnableOrDisableKiBtoStealFromRAM:
267 call Buffers_GetRomvarsFlagsToAX
268 mov bx, g_MenuitemConfigurationKiBtoStealFromRAM
269 test ax, FLG_ROMVARS_FULLMODE
270 jz SHORT .DisableMenuitemFromCSBX
271 jmp SHORT .EnableMenuitemFromCSBX
272
273
274;--------------------------------------------------------------------
275; .EnableOrDisableIdleTimeout
276; Parameters:
277; SS:BP: Menu handle
278; Returns:
279; Nothing
280; Corrupts registers:
281; AX, BX
282;--------------------------------------------------------------------
283ALIGN JUMP_ALIGN
284.EnableOrDisableIdleTimeout:
285 call Buffers_GetRomvarsFlagsToAX
286 mov bx, g_MenuitemConfigurationIdleTimeout
287 test ax, FLG_ROMVARS_MODULE_POWER_MANAGEMENT
288 jz SHORT .DisableMenuitemFromCSBX
289 ; Fall to .EnableMenuitemFromCSBX
290
291
292;--------------------------------------------------------------------
293; .EnableMenuitemFromCSBX
294; .DisableMenuitemFromCSBX
295; Parameters:
296; CS:BX: Ptr to MENUITEM
297; Returns:
298; Nothing
299; Corrupts registers:
300; Nothing
301;--------------------------------------------------------------------
302ALIGN JUMP_ALIGN
303.EnableMenuitemFromCSBX:
304 jmp EnableMenuitemFromCSBX
305
306ALIGN JUMP_ALIGN
307.DisableMenuitemFromCSBX:
308 jmp DisableMenuitemFromCSBX
309
310
311;--------------------------------------------------------------------
312; MENUITEM activation functions (.fnActivate)
313; Parameters:
314; SS:BP: Ptr to MENU
315; Returns:
316; Nothing
317; Corrupts registers:
318; All, except segments
319;--------------------------------------------------------------------
320ALIGN JUMP_ALIGN
321PrimaryIdeController:
322 mov bx, ROMVARS.ideVars0
323 jmp SHORT DisplayIdeControllerMenu
324
325ALIGN JUMP_ALIGN
326SecondaryIdeController:
327 mov bx, ROMVARS.ideVars1
328 jmp SHORT DisplayIdeControllerMenu
329
330ALIGN JUMP_ALIGN
331TertiaryIdeController:
332 mov bx, ROMVARS.ideVars2
333 jmp SHORT DisplayIdeControllerMenu
334
335ALIGN JUMP_ALIGN
336QuaternaryIdeController:
337 mov bx, ROMVARS.ideVars3
338 ; Fall to DisplayIdeControllerMenu
339
340ALIGN JUMP_ALIGN
341DisplayIdeControllerMenu:
342 call IdeControllerMenu_InitializeToIdevarsOffsetInBX
343 jmp IdeControllerMenu_EnterMenuOrModifyItemVisibility
344
345
346ALIGN JUMP_ALIGN
347ActivateInputForNumberOfIdeControllersMenuitemInDSSI:
348 call Menuitem_ActivateUnsignedInputForMenuitemInDSSI
349 ; Fall to LimitIdeControllersForLiteMode
350
351;--------------------------------------------------------------------
352; LimitIdeControllersForLiteMode
353; Parameters:
354; SS:BP: Menu handle
355; Returns:
356; Nothing
357; Corrupts registers:
358; AX, CX, DI
359;--------------------------------------------------------------------
360ALIGN JUMP_ALIGN
361LimitIdeControllersForLiteMode:
362 push es
363 call Buffers_GetIdeControllerCountToCX
364 mov [es:di+ROMVARS.bIdeCnt], cl
365 CALL_MENU_LIBRARY GetHighlightedItemToAX
366 CALL_MENU_LIBRARY RefreshItemFromAX
367 pop es
368 ; Fall to ConfigurationMenu_CheckAndMoveSerialDrivesToBottom
369
370;----------------------------------------------------------------------
371; ConfigurationMenu_CheckAndMoveSerialDrivesToBottom
372;
373; Checks to ensure that serial adapters are at the end of the
374; IDEVARS structures list, as serial floppies (if present) need to be
375; the last drives detected by the BIOS. If there are other controllers
376; after a serial controller, the other controllers are moved up on the list
377; and the serial controller is placed at the end of the list.
378;
379; Parameters:
380; SS:BP: Menu handle
381; Returns:
382; Nothing
383; Corrupts registers:
384; All
385;----------------------------------------------------------------------
386ConfigurationMenu_CheckAndMoveSerialDrivesToBottom:
387 push es
388 push ds
389 push di
390 push si
391
392 call Buffers_GetIdeControllerCountToCX ; will also set ES:DI to point to file buffer
393 push es
394 pop ds
395 xor ch, ch ; clearing high order of CX and notification flag
396 mov dx, cx ; (probably unnecessary, CX should be less than 127, but just to be sure)
397 jcxz .done ; probably unnecessary, but make sure there is at least one controller
398
399 lea bx, [di+ROMVARS.ideVars0] ; add in offset of first idevars
400
401.outerLoop:
402 mov di, bx ; start of idevars
403 xor si, si ; first serial found
404 xor ax, ax ; first non-serial found
405 mov cl, dl ; idevars count
406 xor ch, ch
407
408.loop:
409 cmp byte [di+IDEVARS.bDevice], DEVICE_SERIAL_PORT
410 jnz .notSerial
411
412 test si, si ; record the first serial controller that we find
413 jnz .next
414 mov si, di
415 SKIP2B f
416
417.notSerial:
418 mov ax, di ; record the *last* non-serial controller that we find
419
420.next:
421 add di, IDEVARS_size
422 loop .loop
423
424 test si, si ; no serial drives, nothing to do
425 jz .done
426 cmp si, ax ; serial port is already later on the list than any other controllers
427 ja .done ; (also takes care of the case where there are no other controllers)
428
429;
430; move serial to end of list, others up
431;
432 cld
433
434 mov ax, di ; save end pointer of list after scan
435
436 sub sp, IDEVARS_size ; copy serial to temporary space on stack
437
438 mov di, sp
439
440 mov cx, IDEVARS_size
441 push ss
442 pop es
443
444 rep movsb
445
446 lea di, [si-IDEVARS_size] ; move up all the idevars below the serial, by one slot
447
448 mov cx, ax ; restore end pointer of list, subtract off end of serial idevars
449 sub cx, si
450
451 push ds
452 pop es
453
454 rep movsb
455
456 mov si, sp ; place serial (currently on the stack) at bottom of list
457 push ss
458 pop ds
459 mov cx, IDEVARS_size
460 ; di is already at last IDEVARS position
461
462 rep movsb
463
464 add sp, IDEVARS_size
465
466 push es
467 pop ds
468
469 mov dh, 1 ; set flag that we have done a relocation
470
471 jmp .outerLoop
472
473.done:
474 pop si
475 pop di
476 pop ds
477 pop es
478
479 test dh, dh
480 jz .noWorkDone
481
482 mov dx, g_szSerialMoved
483 call Dialogs_DisplayNotificationFromCSDX
484
485.noWorkDone:
486 ret
Note: See TracBrowser for help on using the repository browser.