1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
|
TITLE SMBRUN.ASM -- SMBIOS RUNTIME PnP FUNCTIONS 5Xh
;****************************************************************************
;****************************************************************************
;** **
;** (C)Copyright 1985-2009, American Megatrends, Inc. **
;** **
;** All Rights Reserved. **
;** **
;** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
;** **
;** Phone: (770)-246-8600 **
;** **
;****************************************************************************
;****************************************************************************
;****************************************************************************
; $Header: /Alaska/BIN/Modules/SMBIOS/Smbrun.asm 6 6/02/09 3:49p Davidd $
;
; $Revision: 6 $
;
; $Date: 6/02/09 3:49p $
;
;****************************************************************************
; Revision History
; ----------------
; $Log: /Alaska/BIN/Modules/SMBIOS/Smbrun.asm $
;
; 6 6/02/09 3:49p Davidd
; Updated AMI headers and code clean up (EIP 22180)
;
; 5 5/19/09 10:53a Davidd
; Changes done for PnP 54 function support (EIP 19358).
;
; 4 1/22/08 4:17p Olegi
; Modifications for 16-bit PM calls.
;
; 2 12/31/07 12:53p Olegi
; Modifications for 16-bit protected mode interface.
;
; 1 12/26/07 5:08p Olegi
; File moved from Board to Core component.
;
; 3 9/06/07 4:23p Vyacheslava
; Added support for GPNV PnP functions: 55h, 56h, 57h
; The main procedures are in SMIGPNV module
;
; 1 9/06/07 3:31p Vyacheslava
; Added support for PnP functions: 55h, 56h, 57h
;
; 2 8/09/07 4:10p Olegi
; Support for functions 53 and 54.
;
; 1 8/03/07 4:50p Olegi
; SMBIOS PnP 16-bit functions - initial check-in; functions 50h, 51h and
; 52h are implemented.
;
;****************************************************************************
.586p
;<AMI_FHDR_START>
;---------------------------------------------------------------------------
;
; Name: Smbrun.asm
;
; Description: SMBIOS runtime PnP functions 5Xh
;
;---------------------------------------------------------------------------
;<AMI_FHDR_END>
INCLUDE Token.equ
OEM16_CSEG SEGMENT PARA PUBLIC 'CODE' USE16
ASSUME cs:OEM16_CSEG, ds:OEM16_CSEG
;------------------------------------------------------------------------------
; Run Time Function Return Codes (from Core8's RT.EQU)
;------------------------------------------------------------------------------
RT_NO_ERROR equ 00h
RT_INVALID_FUNC equ 81h
RT_NVR_READ_ERROR equ 82h
RT_CMOS_READ_ERROR equ 82h
RT_PCI_BAD_VENDOR_ID equ 83h
RT_PCI_DEV_NOT_FOUND equ 86h
RT_PCI_BAD_REG_ADD equ 87h
RT_PCI_SET_FAILED equ 88h
RT_PCI_BUF_TOO_SMALL equ 89h
RT_PNP_UNSUPPORTED equ 82h
RT_PNP_INVALID_NODE equ 83h
RT_PNP_BAD_PARAMETER equ 84h
RT_PNP_SET_FAILED equ 85h
RT_PNP_USE_ESCD equ 8Dh
RT_ESCD_READ_ERROR equ 55h
RT_ESCD_INVALID equ 56h
RT_DMI_SUCCESS equ 00h
RT_DMI_UNKNOWN_FUNCTION equ 81h
RT_DMI_FUNCTION_NOT_SUPPORTED equ 82h
RT_DMI_INVALID_HANDLE equ 83h
RT_DMI_BAD_PARAMETER equ 84h
RT_DMI_INVALID_SUBFUNCTION equ 85h
RT_DMI_NO_CHANGE equ 86h
RT_DMI_NO_EVENTS_PENDING equ 86h
RT_DMI_ADD_STRUCTURE_FAILED equ 87h
; 88h-8Ch..not defined
RT_DMI_READ_ONLY equ 8Dh
; 8Eh-8Fh..not defined
RT_DMI_LOCK_NOT_SUPPORTED equ 90h
RT_DMI_CURENTLY_LOCKED equ 91h
RT_DMI_INVALID_LOCK equ 92h
SMBIOS_PNP_FUNC50_DMIEDIT_STRUC struc
dataIgnoredByDmiFn50 DB 24 DUP (?)
dDmiBiosRevision DD ? ; BYTE
dDmiNumStructures DD ? ; WORD
dDmiStructureSize DD ? ; WORD
dDmiStorageBase DD ? ; DWORD
dDmiStorageSize DD ? ; WORD
SMBIOS_PNP_FUNC50_DMIEDIT_STRUC ends
SMBIOS_PNP_FUNC51_DMIEDIT_STRUC struc
wFunction DW ? ; 51h
dStructure DD ? ; UINT16*
dDmiStructureBuffer DD ? ; UINT32*
wDmiSelector DW ?
dBiosSelector DW ?
SMBIOS_PNP_FUNC51_DMIEDIT_STRUC ends
DMIHDR_STRUC STRUCT
bType BYTE ?
bLength BYTE ?
wHandle WORD ?
DMIHDR_STRUC ENDS
;----------------------------------------------------------------------------
; STRUCTURE OF DATA BUFFER IN SMBIOS FUNCTION 53H
;----------------------------------------------------------------------------
SMBIOSFun53BufferSTRUC STRUC
bChangeStatus BYTE ?
bChangeType BYTE ?
wChangeHandle WORD ?
bChangeReserved BYTE 12 DUP (?)
SMBIOSFun53BufferSTRUC ENDS
;----------------------------------------------------------------------------
; EQUATES USED IN SMBIOS FUNCTION 53H
;----------------------------------------------------------------------------
; equates used in SMBIOS Change Status
SMBIOS_NO_CHANGE EQU 00h ; 00h..SMBIOS No Change
SMBIOS_OTHER_CHANGE EQU 01h ; 01h..SMBIOS Other Change
SMBIOS_UNKNOWN_CHANGE EQU 02h ; 02h..SMBIOS Unknown Change
SMBIOS_SINGLE_STRUCTURE_AFFECTED EQU 03h ; 03h..SMBIOS Single Structure Affected
SMBIOS_MULTIPLE_STRUCTURE_AFFECTED EQU 04h ; 04h..SMBIOS Multiple Structure Affected
; equates used in SMBIOS Change Type
SMBIOS_ONE_MORE_STRUCTURE_CHANGED EQU 00000001b ; Bit-0 = 1, One/More Structure was changed
SMBIOS_ONE_MORE_STRUCTURE_ADDED EQU 00000010b ; Bit-1 = 1, One/More Structure was added
; Bit7-2.....Reserved
;<AMI_FHDR_START>
;---------------------------------------------------------------------------
;
; Name: SmbiosPnpFunctions
;
; Description: SMBIOS PnP functions 50..57
;
; Output: None
;
;---------------------------------------------------------------------------
;<AMI_FHDR_END>
SmbiosPnpFunctions PROC FAR PUBLIC
pushf
push fs
push bx
push dx
push si
push bp
call $+3 ; Push curent IP
pop si ; Get current IP in SI
sub si, $
inc si
mov bx, 0FF4Ch
mov bx, cs:[bx] ; OFFSET RUN_CSEG:Legacy16Data
mov bx, cs:[bx+8] ; OFFSET RUN_CSEG:smiflash_table
mov dx, WORD PTR cs:[bx+12] ; SMI port IO address
mov bx, [ebp+00h] ; get the function number
sub bx, 50h
mov ax, RT_INVALID_FUNC ; Return code for unknown func
;-IF NOT MKF_SMBIOS_DATA_STRUCTURES_BELOW_TOM
cmp bx, (smbios_func_table_end - smbios_func_table_start) / 2
jae SHORT srfe_00 ; invalid function
add si, OFFSET cs:smbios_func_table_start
shl bx, 1
add si, bx
call si ; Call proper PnP function
srfe_00:
pop bp
pop si
pop dx
pop bx
pop fs
popf
rt_pnp_exit:
pop bx
popf
pop ebp
ret
SmbiosPnpFunctions ENDP
;----------------------------------------------------------------------------
; SMBIOS_FUNC_TABLE (SHORT is the key word needed to assure 2 bytes per jmp)
;----------------------------------------------------------------------------
smbios_func_table_start LABEL BYTE
jmp SHORT func_50
jmp SHORT func_51
jmp SHORT func_52
jmp SHORT func_53
jmp SHORT func_54
jmp SHORT func_55
jmp SHORT func_56
jmp SHORT func_57
smbios_func_table_end LABEL BYTE
func_50: jmp rt_get_smbios_info
func_51: jmp rt_get_smbios_struc
func_52: jmp rt_set_smbios_struc
func_53: jmp rt_get_smbios_struc_change_info
func_54: jmp rt_smbios_control
func_55: jmp rt_smbios_get_gpnv
func_56: jmp rt_smbios_read_gpnv
func_57: jmp rt_smbios_write_gpnv
;<AMI_FHDR_START>
;---------------------------------------------------------------------------
;
; Name: rt_generate_sw_smi
;
; Description: Generate SW SMI
;
; Input: AL = PnP function number
; DX = SMI Port
;
; Output: None
;
;---------------------------------------------------------------------------
;<AMI_FHDR_END>
rt_generate_sw_smi PROC NEAR
out dx, al
movzx bx, al
ret
rt_generate_sw_smi ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Procedure: SMBIOS_Func_50h
; Procedure: RT_GET_SMBIOS_INFO
;
; Description: This function returns information about the SMBIOS extensions
; such as the number of structures present and the size of the
; largest one. This function is presently called only during RUNTIME.
;
; Input: [EBP+00] = Function number (50h)
; [EBP+02] = BYTE FAR *DmiBiosVersion
; [EBP+06] = WORD FAR *NumStructures
; [EBP+0A] = WORD FAR *StructureSize
; [EBP+0E] = DWORD FAR *DMIStorageBase
; [EBP+12] = WORD FAR *DMIStorageSize
; [EBP+16] = WORD BiosSelector
; DX = SMI IO port address
;
; Output: AX = Zero if successful
; non-zero return code if non successful
; [EBP+02] = BYTE FAR *DmiBiosVersion filled in with the version
; of the DMI BIOS spec that this code supports.
; [EBP+06] = WORD FAR *NumStructures filled with total number of
; DMI structures that are present in the system.
; [EBP+0A] = WORD FAR *StructureSize filled with the size in
; bytes of the largest DMI structure.
; [EBP+0E] = DWORD FAR *DMIStorageBase filled with the absolute
; 32Bit address of any memory-mapped structure
; [EBP+12] = WORD FAR *DMIStorageSize filled with the buffer
; size needed in Func 52h/54h.
;
; Modified: Nothing
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
rt_get_smbios_info PROC NEAR
push ebx
push eax
push si
push edi
push ds
; EBX = SS<<4+SP-sizeof(SMBIOS_PNP_FUNC50_DMIEDIT_STRUC)
mov ebx, 0
mov bx, ss
shl ebx, 4
movzx edi, sp
sub di, size SMBIOS_PNP_FUNC50_DMIEDIT_STRUC
add ebx, edi
mov sp, di
mov al, 50h
call rt_generate_sw_smi
lds si, DWORD PTR [ebp+02h]
mov eax, ss:(SMBIOS_PNP_FUNC50_DMIEDIT_STRUC PTR [di]).dDmiBiosRevision
mov BYTE PTR [si], al
lds si, DWORD PTR [ebp+06h]
mov eax, ss:(SMBIOS_PNP_FUNC50_DMIEDIT_STRUC PTR [di]).dDmiNumStructures
mov WORD PTR [si], ax
lds si, DWORD PTR [ebp+0Ah]
mov eax, ss:(SMBIOS_PNP_FUNC50_DMIEDIT_STRUC PTR [di]).dDmiStructureSize
mov WORD PTR [si], ax
lds si, DWORD PTR [ebp+0Eh]
mov eax, ss:(SMBIOS_PNP_FUNC50_DMIEDIT_STRUC PTR [di]).dDmiStorageBase
mov DWORD PTR [si], eax
lds si, DWORD PTR [ebp+12h]
mov eax, ss:(SMBIOS_PNP_FUNC50_DMIEDIT_STRUC PTR [di]).dDmiStorageSize
mov WORD PTR [si], ax
add sp, size SMBIOS_PNP_FUNC50_DMIEDIT_STRUC
pop ds
pop edi
pop si
pop eax
mov ax, bx
pop ebx
ret
rt_get_smbios_info ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Procedure: SMBIOS_Func_51h
; Procedure: RT_GET_SMBIOS_STRUC
;
; Description: This function copies one DMI structure into the buffer
; provided by the caller. The caller's DMI structure number is
; then updated with next DMI structure number (or FFFF if no
; more DMI structures are present).
;
; Input: [EBP+00] = Function number (51h)
; [EBP+02] = WORD FAR *StructureNum
; [EBP+06] = WORD FAR *DmiStructureBuffer
; [EBP+0A] = WORD DmiSelector
; [EBP+0C] = WORD BiosSelector
; DX = SMI IO port address
;
; Output: AX = Zero if success, non-zero return code if non successful
; [EBP+02] = WORD FAR *StructureNum updated to contain the next DMI
; structure number or FFFF if no more structures exist
; [EBP+06] = WORD FAR *DmiStructureBuffer pointer to buffer that is
; filled in with the requested DMI structure.
;
; Modified: AX
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
rt_get_smbios_struc PROC NEAR
push ebx
push eax
;
; convert *StructureNum and *DmiStructureBuffer from SEG:OFS format
; to 32-bit addresses
;
push [ebp+2] ; UINT16 *StructureNum
push [ebp+4]
push [ebp+6] ; UINT8 *DmiStructureBuffer
push [ebp+8]
mov eax, 0
; prepare EBX with 32-bit addresses of *StructureNum and *DmiStructureBuffer
mov ebx, 0
mov bx, [ebp+4]
shl ebx, 4
mov ax, [ebp+2]
add ebx, eax
mov [ebp+2], ebx
mov ebx, 0
mov bx, [ebp+8]
shl ebx, 4
mov ax, [ebp+6]
add ebx, eax
mov [ebp+6], ebx
; prepare EBX with 32-bit address out of DS:EBP
mov ebx, 0
mov bx, ss
shl ebx, 4
add ebx, ebp
mov al, 51h
call rt_generate_sw_smi
pop [ebp+8]
pop [ebp+6]
pop [ebp+4]
pop [ebp+2]
pop eax
mov ax, bx
pop ebx
ret
rt_get_smbios_struc ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Procedure: SMBIOS_Func_52h
; Procedure: RT_SET_SMBIOS_STRUC
;
; Description: This function sets the SMBIOS structure identified by the
; type and possibly handle, found in the SMBIOS structure
; header in the given buffer.
;
; Input: [EBP+00] = Function number (52h)
; [EBP+02] = WORD FAR *DmiDataBuffer
; [EBP+06] = WORD FAR *DmiWorkBuffer
; [EBP+0A] = WORD Control
; [EBP+0C] = WORD DmiSelector
; [EBP+0E] = WORD BiosSelector
;
; Output: AX = Zero if successful
; non-zero return code if unsuccessful
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
rt_set_smbios_struc PROC NEAR
push ebx
push eax
push si
push di
push ds
lds di, DWORD PTR [ebp+02h] ; DS:SI = ptr to given data buffer
push [ebp+2]
mov eax, 0
mov ebx, 0
mov bx, [ebp+4]
shl ebx, 4
mov ax, [ebp+2]
add ebx, eax
mov [ebp+2], ebx
; prepare EBX with 32-bit address out of DS:EBP
mov ebx, 0
mov bx, ss
shl ebx, 4
add ebx, ebp
mov al, 52h
call rt_generate_sw_smi
pop [ebp+2]
; Update smbios_change_status
; Get the offset of SMBIOS_CHANGE_STRUC data
call get_smbios_change_struc
call SMB_cs_read_x_write_ram
mov cs:(SMBIOS_CHANGE_STRUC PTR [si]).smbios_change_status, SMBIOS_SINGLE_STRUCTURE_AFFECTED
mov cs:(SMBIOS_CHANGE_STRUC PTR [si]).smbios_change_type, SMBIOS_ONE_MORE_STRUCTURE_CHANGED
mov ax, ds:WORD PTR (DMIHDR_STRUC PTR [di]).wHandle; AX = handle# of structure being changed
mov cs:(SMBIOS_CHANGE_STRUC PTR [si]).smbios_change_handle, ax ; changed handle
call SMB_cs_read_ram_write_rom
pop ds
pop di
pop si
pop eax
mov ax, bx
pop ebx
ret
rt_set_smbios_struc ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Procedure: SMBIOS_Func_53h
; Procedure: RT_GET_SMBIOS_STRUC_CHANGE_INFO
;
; Description: This function returns the information about what type of
; SMBIOS structure-change occurred.
;
; Input: [EBP+00] = Function number (53h)
; [EBP+02] = WORD FAR *DmiChangeStructure
; [EBP+06] = WORD DmiSelector
; [EBP+08] = WORD BiosSelector
;
; Output: AX = Zero if successful
; Non-zero return code if unsuccessful
;
; Modified: Nothing
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
rt_get_smbios_struc_change_info PROC NEAR
push es
push ds
push gs
push fs
mov gs, WORD PTR [ebp+08h] ; GS = BIOS Selector
mov fs, WORD PTR [ebp+06h] ; FS = GPNV Selector
call SMB_cs_read_x_write_ram
push si
push di
les di, DWORD PTR [ebp+02h] ; ES:DI = ptr to DMI Change Structure buffer
; Get the offset of SMBIOS_CHANGE_STRUC data
call get_smbios_change_struc
xor ax, ax
xchg ah, cs:(SMBIOS_CHANGE_STRUC PTR [si]).smbios_change_status; AH = SMBIOS Change Status
xchg al, cs:(SMBIOS_CHANGE_STRUC PTR [si]).smbios_change_type; AL = SMBIOS Change Type
mov es:BYTE PTR (SMBIOSFun53BufferSTRUC PTR [di]).bChangeStatus, ah
mov es:BYTE PTR (SMBIOSFun53BufferSTRUC PTR [di]).bChangeType, al
push ax
cmp ah, SMBIOS_MULTIPLE_STRUCTURE_AFFECTED
mov ax, 0000h ; DO NOT USE xor ax, ax !!!!!!!!!!!!!!!!
; Flags has the information of prev CMP
xchg ax, cs:(SMBIOS_CHANGE_STRUC PTR [si]).smbios_change_handle; AX = handle# of changed structure
jnz SHORT rgssci_00 ; single structure affected
xor ax, ax ; make handle# 00 for multiple structures change
rgssci_00:
mov es:WORD PTR (SMBIOSFun53BufferSTRUC PTR [di]).wChangeHandle, ax
pop ax
pop si
pop di
call SMB_cs_read_ram_write_rom
cmp ah, SMBIOS_NO_CHANGE ; any change in status ?
mov ax, RT_DMI_SUCCESS ; successful
jnz SHORT rgssci_01 ; change in status
mov ax, RT_DMI_NO_CHANGE ; no change in status, return with error code
rgssci_01:
pop fs
pop gs
pop ds
pop es
ret
rt_get_smbios_struc_change_info ENDP
SMBIOS_CHANGE_STRUC STRUCT
smbios_change_handle DW ?
smbios_change_status DB ?
smbios_change_type DB ?
SMBIOS_CHANGE_STRUC ENDS
get_smbios_change_struc:
pushf
cli
call l_01 ; stores IP
mov si, sp
mov si, ss:[si-2]
popf ; restore IF
add si, 11 ; cs:si points to smbios_change_handle
l_01:
ret
smbios_change_handle DW ?
smbios_change_status DB ?
smbios_change_type DB ?
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Procedure: SMB_cs_read_x_write_ram
;
; Description: This function makes the code segment Write Only.
;
; Input: None
;
; Notes: This function needs to ported or modified accordingly.
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
SMB_cs_read_x_write_ram PROC NEAR PUBLIC
push eax
push dx
mov dx, 0CF8h
mov eax, 80000094h
out dx, eax
mov dx, 0CFCh
in eax, dx
or eax, 00020000h ; 0/0/0/96/Bit1, enable E8000 for writing
out dx, eax
pop dx
pop eax
ret
SMB_cs_read_x_write_ram ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Procedure: SMB_cs_read_ram_write_rom
;
; Description: This function makes the code segment Read Only.
;
; Input: None
;
; Notes: This function needs to ported or modified accordingly.
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
SMB_cs_read_ram_write_rom PROC NEAR PUBLIC
push eax
push dx
mov dx, 0CF8h
mov eax, 80000094h
out dx, eax
mov dx, 0CFCh
in eax, dx
and eax, 0FFFDFFFFh ; 0/0/0/96/Bit1, make E8000 read-only
out dx, eax
pop dx
pop eax
ret
SMB_cs_read_ram_write_rom ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Procedure: SMBIOS_Func_54h
; Procedure: RT_SMBIOS_CONTROL
;
; Description: This function returns the information about what type of
; SMBIOS structure-change occurred.
;
; Input: [EBP+00] = Function number (54h)
; [EBP+02] = WORD SubFunction - Defines the specific control operation
; [EBP+04] = VOID FAR *Data - Input/output data buffer, SubFunction specific
; [EBP+08] = BYTE Control - Conditions for setting the structure
; [EBP+09] = WORD DmiSelector - SMBIOS data read/write selector
; [EBP+11] = WORD BiosSelector- PnP BIOS readable/writeable selector
;
; Output: AX = Zero if successful
; Non-zero return code if unsuccessful
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
rt_smbios_control PROC NEAR
; Do the porting here as needed
;- mov ax, RT_PNP_UNSUPPORTED ;Return code for unsupported func
; (debx+03062009)>
mov al, 30h ; SmiGpnv
call rt_generate_sw_smi
; <(debx+03062009)
ret
rt_smbios_control ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Procedure: SMBIOS_Func_55h
;
; Description: Required for GPNV support. This function returns information
; about a General Purpose NonVolatile (GPNV) area. The Handle
; argument is a pointer to a number that identifies which GPNV's
; information is requested, a value of 0 accesses the first
; (or only) area.
;
; Input: [EBP+00] DW PnP BIOS Function 55h
; [EBP+02] DW *Handle - Identifies which GPNV to access
; [EBP+06] DW *MinGPNVRWSize - Minimum buffer size in bytes for GPNV access
; [EBP+0A] DW *GPNVSize - Size allocated for GPNV within the R/W Block
; [EBP+0E] DD *NVStorageBase - 32-bit physical base address for...
; ... mem. mapped nonvolatile storage media
; [EBP+12] DW BiosSelector - PnP BIOS readable/writable selector
;
; Output: If successful - DMI_SUCCESS If an Error (Bit 7 set) or a
; Warning occurred the Error Code will be returned in AX, the
; FLAGS and all other registers will be preserved
;
; Notes: On return:
;
; *Handle is updated either with the handle of the next GPNV
; area or, if there are no more areas, 0FFFFh. GPNV handles
; are assigned sequentially by the system, from 0 to the total
; number of areas (minus 1).
;
; *MinGPNVRW Size is updated with the minimum size, in bytes,
; of any buffer used to access this GPNV area. For a Flash
; based GPNV area, this would be the size of the Flash block
; containing the actual GPNV.
;
; *GPNVSize is updated with the size, in bytes, of this GPNV
; area (which is less than or equal to the MinGPNVRWSize value).
;
; *NVStorageBase is updated with the paragraph-aligned, 32-bit
; absolute physical base address of this GPNV. If non-zero,
; this value allows the caller to construct a 16-bit data
; segment descriptor with a limit of MinGPNVRWSize and
; read/write access. If the value is 0, protected-mode mapping
; is not required for this GPNV.
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
rt_smbios_get_gpnv PROC NEAR PUBLIC
mov al, 30h ; SmiGpnv
call rt_generate_sw_smi
ret
rt_smbios_get_gpnv ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Procedure: SMBIOS_Func_56h
;
; Description: Required for GPNV support. This function is used to read an
; entire GPNV area into the buffer specified by GPNVBuffer. It
; is the responsibility of the caller to ensure that GPNVBuffer
; is large enough to store the entire GPNV storage block - this
; buffer must be at least the MinGPNVRWSize returned by Function
; 55h - Get GPNV Information. The Handle argument identifies the
; specific GPNV to be read. On a successful read of a GPNV area,
; that GPNV area will be placed in the GPNVBuffer beginning at
; offset 0. The protected-mode selector GPNVSelector has base
; equal to NVStorageBase and limit of at least MinGPNVRWSize -
; so long as the NVStorageBase value returned from Function 55h
; was non-zero.
;
; Input: [EBP+00] DW PnP BIOS Function 56h
; [EBP+02] DW Handle - Identifies which GPNV is to be read
; [EBP+04] DW *GPNVBuffer - Address of buffer in which to return GPNV
; [EBP+08] DW *GPNVLock - Lock value
; [EBP+0C] DW GPNVSelector - Selector for GPNV Storage
; [EBP+0E] DW BiosSelector - PnP BIOS readable/writable selector
;
; Output: If the GPNV lock is supported and the lock set request succeeds,
; the caller's GPNVLock is set to the value of the current lock
; and the function returns DMI_SUCCESS.
;
; Notes: If the GPNV request fails, one of the following values is
; returned:
; - DMI_LOCK_NOT_SUPPORTED
; - DMI_INVALID_LOCK
; - DMI_CURRENTLY_LOCKED
;
; For return status codes DMI_SUCCESS, DMI_LOCK_NOT_SUPPORTED
; and DMI_CURRENTLY_LOCKED, the GPNV Read function returns the
; current contents of the GPNV associated with Handle as the
; first GPNVSize bytes within GPNVBuffer, starting at offset 0.
; If a lock request fails with DMI_CURRENTLY_LOCKED status,
; the caller's GPNVLock will be set to the value of the current
; lock.
; Passing a GPNVLock value of -1 to the GPNV Read causes the
; GPNVLock value to be ignored - in this case the underlying
; logic makes no attempt to store a lock value for comparison
; with lock values passed into GPNV Write. Any value provided
; for GPNVLock besides -1 is accepted as a valid value for a
; lock request.
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
rt_smbios_read_gpnv PROC NEAR PUBLIC
mov al, 30h ; SmiGpnv
call rt_generate_sw_smi
ret
rt_smbios_read_gpnv ENDP
;<AMI_PHDR_START>
;----------------------------------------------------------------------------
;
; Procedure: SMBIOS_Func_57h
;
; Description: Required for GPNV support. This function is used to write an
; entire GPNV from the GPNVBuffer into the nonvolatile storage
; area. The Handle argument identifies the specific GPNV to be
; written. The protectedmode selector GPNVSelector has base equal
; to NVStorageBase and limit of at least MinGPNVRWSize - so long
; as the NVStorageBase value returned from Get GPNV Information
; was non-zero. The caller should first call Read GPNV Data
; (with a lock) to get the current area contents, modify the
; data, and pass it into this function - this ensures that the
; GPNVBuffer which is written contains a complete definition for
; the entire GPNV area. If the BIOS uses some form of block erase
; device, the caller must also allocate enough buffer space for
; the BIOS to store all data from the part during the reprogramming
; operation, not just the data of interest.
; The data to be written to the GPNV selected by Handle must
; reside as the first GPNVSize bytes of the GPNVBuffer.
; Note: The remaining (MinGPNVRWSize-GPNVSize) bytes of the
; GPNVBuffer area are used as a scratch-area by the BIOS call
; in processing the write request; the contents of that area of
; the buffer are destroyed by this function call.
; The GPNVLock provides a mechanism for cooperative use of the
; GPNV, and is set during a GPNV Read (Function 56h). If the
; input GPNVLock value is -1 the caller requests a forced write
; to the GPNV area, ignoring any outstanding GPNVLock. If the
; caller is not doing a forced write, the value passed in GPNVLock
; to the GPNV Write must be the same value as that (set and)
; returned by a previous GPNV Read (Function 56h).
;
; Input: [EBP+00] - PnP BIOS Function 57h
; [EBP+02] - Handle - Identifies which GPNV is to be written
; [EBP+04] - *GPNVBuffer - Address of buffer containing complete GPNV to write
; [EBP+08] - GPNVLock - Lock value
; [EBP+0A] - GPNVSelector - Selector for GPNV Storage
; [EBP+0C] - BiosSelector - PnP BIOS readable/writable selector
;
; Output: The GPNV Write function returns a value of DMI_ LOCK_NOT_SUPPORTED
; when a GPNVLock value other than -1 is specified and locking is
; not supported. A return status of DMI_ CURRENTLY_LOCKED indicates
; that the call has failed due to an outstanding lock on the GPNV
; area which does not match the caller's GPNVLock value. Any
; outstanding GPNVLock value (which was set by a previous Error!
; Reference source not found.) gets cleared on a successful
; write of the GPNV.
; Notes:
;
;----------------------------------------------------------------------------
;<AMI_PHDR_END>
rt_smbios_write_gpnv PROC NEAR PUBLIC
mov al, 30h ; SmiGpnv
call rt_generate_sw_smi
ret
rt_smbios_write_gpnv ENDP
OEM16_CSEG ENDS
END
;----------------------------------------------------------------------------
;****************************************************************************
;****************************************************************************
;** **
;** (C)Copyright 1985-2009, American Megatrends, Inc. **
;** **
;** All Rights Reserved. **
;** **
;** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
;** **
;** Phone: (770)-246-8600 **
;** **
;****************************************************************************
;****************************************************************************
|