⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smb_fcn.asm

📁 This program displays all SMBIOS/DMI information within the BIOS. The information is organized as a
💻 ASM
📖 第 1 页 / 共 5 页
字号:
;' $Header$
	title	SMB_FCN -- Function Routines for SMBIOS
	page	58,122
	name	SMB_FCN

COMMENT|				Module Specifications

Copyright: (C) Copyright 2001-2002 Qualitas, Inc.  All rights reserved.

|
.386p
.xlist
	include MASM.INC
	include PTR.INC
	include ASCII.INC
	include WINDOWS.INC
	include DOSCALL.INC
	include PCI.INC
	include SMBIOS.INC

	include SMBCOM.INC
	include SMBIOS.MAC
.list

DGROUP	group	_DATA,SMBACT2_SEG,SMBTXT_SEG,SMBITM_SEG
PGROUP	group	_TEXT


;=============== DATA segment ================================================

_DATA	segment use16 dword public 'data' ; Start _DATA segment
	assume	ds:DGROUP

	extrn	SMBTYP:word
	extrn	RECTYP:word
	extrn	SMB4_FET_TAB:tbyte
	extrn	SMB9_TYPE_ACT:tbyte
	extrn	SMBUNKDATA:tbyte
	extrn	SMBTYPE_ENUM:tbyte
	extrn	SMB2_TYPE_ENUM:tbyte

	extrn	ITEM_SMB2_PROD:tbyte
	extrn	ITEM_SMB4_SOCK:tbyte
	extrn	ITEM_SMB6_SOCK:tbyte
	extrn	ITEM_SMB8_ERD:tbyte
	extrn	ITEM_SMB9_TYPE:tbyte
	extrn	ITEM_SMB17_BNKLOC:tbyte

	extrn	FMT_UNK:byte
	extrn	LCL_FLAG:word

	extrn	lpszData:dword
	extrn	lpszTemp:dword

	extrn	MSG_HANDLE:byte

	public	lpOutput
lpOutput dd	PGROUP:TextAppend ; Output routine

	public	RouteBuffer,DataBuffer,@DataBufferSize
RouteBuffer PCI_RB_STR <?, DGROUP:DataBuffer, ?>
@DataBufferLen equ 20
@DataBufferSize equ @DataBufferLen * (size PCI_DB_STR)
DataBuffer PCI_DB_STR @DataBufferLen dup (<>) ; Data buffer

	public	HEXRAW_LEN,STRCNT
HEXRAW_LEN dw	?		; Length of hex raw data
STRCNT	dw	?		; String count

	public	DispItemData
DispItemData dw TRUE		; Display item data

	public	MSG_STRHDR,StrucLen,@MSG_STRHDR_LEN
MSG_STRHDR db	'DMI/SMBIOS Strucs' ; Header
StrucLen dd	?		; Byte length of Strucs
@MSG_STRHDR_LEN equ $-MSG_STRHDR ; Length of Header

	public	MSG_HDR_LEN,MSG_HDR_HNDL
MSG_HDR_LEN db	'Struc length is %tu bytes.',CR,LF,0
MSG_HDR_HNDL db 'Struc handle is %04Xh.',CR,LF,0

	public	MSG_NONE
MSG_NONE db	'None',CR,LF,0

	public	MSG_STRNF
MSG_STRNF db	BEL,'*** String not found ***',CR,LF,0

	public	MSG_CRLF
MSG_CRLF db	CR,LF,0

	public	MSG_REC
MSG_REC db	BEL,'*** Unknown bits:  %08lXh.',CR,LF,0

	public	MSG_BCDREV
MSG_BCDREV db	'%tu.%tu.',CR,LF,0

	public	MSG_BCDBYTE
MSG_BCDBYTE db	'%2tX.',CR,LF,0

	public	MSG_UDECBYTE
MSG_UDECBYTE db '%tu.',CR,LF,0

	public	MSG_UDECWORD
MSG_UDECWORD db '%u.',CR,LF,0

	public	MSG_UNK_VAL,MSG_UNK2A_VAL,MSG_UNK2B_VAL
MSG_UNK_VAL db	'Unknown, N/A, or No Value',CR,LF,0
MSG_UNK2A_VAL db 'N/A',CR,LF,0
MSG_UNK2B_VAL db 'No Error',CR,LF,0

	public	MSG_UDECDWORD
	public	MSG_VALB
MSG_VALB label	byte
MSG_UDECDWORD db '%lu.',CR,LF,0

	public	MSG_HEXBYTE
MSG_HEXBYTE db	'%02tXh.',CR,LF,0

	public	MSG_HEXWORD
MSG_HEXWORD db	'%04Xh.',CR,LF,0

	public	MSG_HEXDWORD
MSG_HEXDWORD db '%08lXh.',CR,LF,0

	public	MSG_PTR16
MSG_PTR16 db	'%04X:%04X.',CR,LF,0

	public	MSG_HEXQWORD
MSG_HEXQWORD db '%08lX%08lXh.',CR,LF,0

	public	MSG_DHDWORD
MSG_DHDWORD db	'%08lXh (%,lu).',CR,LF,0

	public	MSG_HEX6
MSG_HEX6 db	 6 dup ('__'),CR,LF,0

	public	MSG_HEX9
MSG_HEX9 db	 9 dup ('__'),CR,LF,0

	public	MSG_HEX15
MSG_HEX15 db	15 dup ('__'),CR,LF,0

	public	MSG_HEX16
MSG_HEX16 db	16 dup ('__'),CR,LF,0

	public	MSG_HEXRAW
MSG_HEXRAW db	'%*(%02tX )',CR,LF,0

	public	MSG_ENUMNOTF
MSG_ENUMNOTF db BEL,'*** Enumerated Data Not Found:  %04Xh.',CR,LF,0

	public	MSG_ROMSIZE
MSG_ROMSIZE db	'%08lXh (%lu KB).',CR,LF,0

	public	MSG_VOLT
MSG_VOLT db    '%u.%uV.',CR,LF,0

	public	MSG_BANKSEP
MSG_BANKSEP db	' & ',0

	public	MSG_VALA
	public	MSG_MODSIZE
MSG_MODSIZE label byte
MSG_VALA db	'%lu MB.',CR,LF,0

	public	MSG_VALA_NODET,MSG_VALA_NOENA,MSG_VALA_NOINS
MSG_VALA_NODET db 'Not determinable',CR,LF,0
MSG_VALA_NOENA db 'Module is installed, but not enabled',CR,LF,0
MSG_VALA_NOINS db 'Not installed',CR,LF,0

	public	MSG_LANG
MSG_LANG db	'Available Language:  ',0

	public	MSG_OEMSTR
MSG_OEMSTR db	'OEM String:  ',0

	public	MSG_CFGSTR
MSG_CFGSTR db	'Configuration String:  ',0

	public	MSG_PID,MSG_FET
MSG_PID db	'%08lXh.',CR,LF,0
MSG_FET db	'Features:  ',0

	public	MSG_SID_MCA
	public	MSG_SID_EISA
	public	MSG_SID_PCMCIA
	public	MSG_SID_NONE
	public	MSG_SID_PCI_XTAB
	public	MSG_SID_PCI_TAB
MSG_SID_MCA db	'%04Xh,',CR,LF
;;;;;;; db	'Slot ID:  '
	db	'          ','MCA Slot #:  %tu.',CR,LF,0
MSG_SID_EISA db '%04Xh,',CR,LF
;;;;;;; db	'Slot ID:  '
	db	'          ','EISA Slot #:  %tu.',CR,LF,0
MSG_SID_PCMCIA db '%04Xh,',CR,LF
;;;;;;; db	'Slot ID:  '
	db	'          ','PCMCIA Adapter #:  %tu, Socket #:  %tu.',CR,LF,0
MSG_SID_NONE db '%04Xh.',CR,LF,0
MSG_SID_PCI_XTAB db '%04Xh,',CR,LF
	db	BEL,'*** PCI/AGP/PCI-X Slot # %tu not found in PCI Interrupt Routing Table.',CR,LF,0
MSG_SID_PCI_TAB db '%04Xh,',CR,LF
;;;;;;; db	'Slot ID:  '
	db	'          ','PCI Bus #:  %u,',CR,LF
	db	'          ','PCI Device # (in upper 5 bits):  %02Xh,',CR,LF
	db	'          ','Link value for INTA#:  %02Xh,',CR,LF
	db	'          ','IRQ Bitmap for INTA#:  %002b,',CR,LF
	db	'          ','Link value for INTB#:  %02Xh,',CR,LF
	db	'          ','IRQ Bitmap for INTB#:  %004b,',CR,LF
	db	'          ','Link value for INTC#:  %02Xh,',CR,LF
	db	'          ','IRQ Bitmap for INTC#:  %008b,',CR,LF
	db	'          ','Link value for INTD#:  %02Xh,',CR,LF
	db	'          ','IRQ Bitmap for INTD#:  %016b,',CR,LF
	db	'          ','Slot #:  %u.',CR,LF,0

	public	FMT_STR,FMT_STR2
FMT_STR db	'String #%u:  %Fs',CR,LF,0
FMT_STR2 db	' (%Fs)',0

_DATA	ends			; End _DATA segment


SMBACT2_SEG segment use16 word public 'data' ; Start SMBACT2_SEG segment
	assume	ds:DGROUP

	extrn	SMBACT2:word	; Start of SMB secondary action table

SMBACT2_SEG ends		; End SMBACT2_SEG segment


SMBTXT_SEG segment use16 word public 'data' ; Start SMBTXT_SEG segment
	assume	ds:DGROUP

	extrn	SMBTXT:word	; Start of SMB text table

SMBTXT_SEG ends 		; End SMBTXT_SEG segment


SMBITM_SEG segment use16 word public 'data' ; Start SMBITM_SEG segment
	assume	ds:DGROUP

	extrn	SMBITM:word	; Start of SMB item information

SMBITM_SEG ends 		; End SMBITM_SEG segment


_TEXT	segment use16 byte public 'code' ; Start _TEXT segment
	assume	cs:PGROUP

	extrn	RPRINTF16:near
	extrn	SPRINTF16:near
	extrn	StrCpy:near
	extrn	StrLen:near
	extrn	DB2HEX:near

	FPPROC	TextAppend -- Text Append Output Routine
	assume	ds:nothing,es:nothing,fs:DGROUP,gs:nothing,ss:nothing
COMMENT|

Text append output routine for RPRINTF16.

On entry:

DL	=	char to append

|

	test	LCL_FLAG,@LCL_BUFF ; Copy to buffer?
	jnz	short @F	; Jump if so

	cmp	dl,0		; Izit EOS (0)?
	je	short TextAppendExit ; Jump if so

	push	ax		; Save for a moment
	DOSCALL @CHROUT 	; Display the character in DL
	pop	ax		; Restore

	jmp	short TextAppendExit ; Join common exit code


@@:
	REGSAVE <si,ds> 	; Save registers

	lds	si,lpszData	; DS:SI ==> output buffer
	assume	ds:nothing	; Tell the assembler about it

	mov	ds:[si].LO,dl	; Save in output buffer

	cmp	dl,1		; Izit EOS (0)?
	sbb	lpszData.VOFF,-1 ; Account for it

	REGREST <ds,si> 	; Restore
	assume	ds:nothing	; Tell the assembler about it
TextAppendExit:
	ret			; Return to caller

	assume	ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing

TextAppend endp 		; End TextAppend procedure
	NPPROC	SMB_ITEM_DATA -- Display SMB Item Data
	assume	ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|

Display SMB Item Data

On entry:

DS:BX	==>	SMBnnITEMs
SI	=	struc start
DI	=	index into SMBnnITEM strucs

On exit:

CF	=	0 if successful
	=	1 if not

|

	push	eax		; Save register

	push	ds:[bx+di].ITEM_OFFS ; Pass the struc offset
	push	ds:[bx+di].ITEM_TEXT ; ...	text offset in DGROUP
	push	ds:[bx+di].ITEM_SPC1 ; ...	special value #1
	push	ds:[bx+di].ITEM_SPC2.EDQHI ; ...	      #2 high-dword
	push	ds:[bx+di].ITEM_SPC2.EDQLO ; ......	      #2 low-dword
	push	si		; Pass the struc start
	lea	ax,[bx+di]	; Add to get current offset into SMBnnITEMs
	push	ax		; ...  offset into SMBnnITEMs
	movzx	eax,ds:[bx+di].ITEM_TYPE ; Get the item type
	call	SMBTYP[eax*(type SMBTYP)] ; Take appropriate action
				; Return with CF significant
	pop	eax		; Restore

	ret			; Return to caller

	assume	ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing

SMB_ITEM_DATA endp		; End SMB_ITEM_DATA procedure
	NPPROC	SMB_STRING -- Display A String
	assume	ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|

Display a String from FS.

On entry:

FS	=	Struc Segment
SS:BP	==>	SMB_STR (after lclPROLOG)

On exit:

CF	=	0 if successful
	=	1 if not

|

lclSMB_STR struc		; Local vars

lclSMB_CNT dw	?		; Count of # preceding items (for RPTSTR)
lclSMB_IND dw	?		; Indent		     ...
lclSMB_ILEN dw	?		; Length of ITEM_STRs	     ...
lclSMB_SLEN dw	?		; Struc length of actual data...

lclSMB_STR ends


argSMB_STR struc		; Arguments

argSMB_ITEMO dw ?		; Offset of this SMBnnITEM
argSMB_START dw ?		; Struc start
argSMB_SPC2  dq ?		; Special value #2
argSMB_SPC1  dw ?		; ...		#1
argSMB_TEXT  dw ?		; Text offset in DGROUP
argSMB_OFFS  dw ?		; Struc offset

argSMB_STR ends


SMB_STR struc

SMBlcl	db	(type lclSMB_STR) dup (?) ; Local vars
	dw	?		; Caller's BP
	dw	?		; ...	   IP
SMBarg	db	(type argSMB_STR) dup (?) ; Arguments

SMB_STR ends


	lclPROLOG SMB_STR	; Address local vars

	pusha			; Save all GP registers
	push	es		; Save segment register

; Display the leading text, unless asked not to

	test	LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
	jnz	short @F	; Jump if so

	push	ds		; Pass ptr to string
	push	[bp].SMBarg.argSMB_TEXT ; ...
	call	DispASCIIZ	; Display ASCIIZ string
@@:
	mov	di,[bp].SMBarg.argSMB_START ; Get struc start
	mov	bx,[bp].SMBarg.argSMB_OFFS  ; ...	offset
	movzx	cx,fs:[bx+di].LO ; Get the string #
	jcxz	SMB_STRING_DISP_CRLF ; Jump if it's empty

	mov	ax,fs		; Copy string segment
	mov	es,ax		; Address it
	assume	es:nothing	; Tell the assembler about it

	movzx	ax,fs:[di].SMBHDR_LEN ; Get length byte, zero to use as word
	add	di,ax		; Add to skip over struc to strings
SMB_STRING_NEXT:
	dec	cx		; Count out another string
	jz	short SMB_STRING_DISP ; Jump if we're at the string

; Skip over the string

	push	cx		; Save for a moment

	mov	al,0		; Search for this
	mov	cx,-1		; We know it's there
  repne scas	es:[di].LO	; Skip over next string
	pop	cx		; Restore
;;;;;;; jne	short ???	; Jump if not found???

; Check for last string

	cmp	es:[di].LO,0	; Izit the last string?
	jne	short SMB_STRING_NEXT ; Jump if not

; String not found

	push	ds		; Pass ptr to string
	push	offset ds:MSG_STRNF ; ...
	call	DispASCIIZ	; Display ASCIIZ string

	jmp	short SMB_STRING_DONE ; Join common done code


SMB_STRING_DISP:
	push	es		; Pass ptr to string
	push	di		; ...
	call	DispASCIIZ	; Display ASCIIZ string
SMB_STRING_DISP_CRLF:
	push	ds		; Pass ptr to string
	push	offset ds:MSG_CRLF ; ...
	call	DispASCIIZ	; Display ASCIIZ string
SMB_STRING_DONE:
	clc			; Mark as successful

	pop	es		; Restore
	assume	es:nothing	; Tell the assembler about it
	popa			; Restore

	lclEPILOG SMB_STR	; Strip local vars and return

	assume	ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing

SMB_STRING endp 		; End SMB_STRING procedure
	NPPROC	SMB_BANK -- Display A Bank Connection
	assume	ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|

Display a Bank Connection from FS.

On entry:

FS	=	Struc Segment
SS:BP	==>	SMB_STR (after lclPROLOG)

On exit:

CF	=	0 if successful
	=	1 if not

|

	lclPROLOG SMB_STR	; Address local vars

	pusha			; Save all GP registers

; Display the leading text, unless asked not to

	test	LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
	jnz	short @F	; Jump if so

	push	ds		; Pass ptr to string
	push	[bp].SMBarg.argSMB_TEXT ; ...
	call	DispASCIIZ	; Display ASCIIZ string
@@:
	mov	di,[bp].SMBarg.argSMB_START ; Get struc start
	mov	bx,[bp].SMBarg.argSMB_OFFS  ; ...	offset
	movzx	bx,fs:[bx+di].LO ; Get the Bank Connection, zero to use as word

	shl	bx,4		; Shift up the high-order nibble to BH
	shr	bl,4		; Shift back low-order nibble to BL

	cmp	bh,0Fh		; Izit absent?
	je	short SMB_BANK1 ; Jump if so

	mov	dl,bh		; Copy to @CHROUT register
	add	dl,'0'          ; Convert to ASCII

	push	fs		; Save for a moment

	mov	ax,ds		; Copy DGROUP segment/selector
	mov	fs,ax		; Address it
	assume	fs:DGROUP	; Tell the assembler about it

	call	lpOutput	; Display the character

	pop	fs		; Restore
	assume	fs:nothing	; Tell the assembler about it

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -