You are not logged in.


#1 2005-07-26 17:27:43

smiddy
Active member
Registered: 2005-02-15
Posts: 183
PM

Device Driver Update-age...

Hi All,

Long time no writing, eh? Here is a screen shot of what I've been working on:

Code:

PnP BIOS :
Other System Peripheral
    I/O Port 0010 - 001F
    I/O Port 0024 - 0025
    I/O Port 0028 - 0029
    I/O Port 002C - 002D
    I/O Port 0030 - 0031
    I/O Port 0034 - 0035
    I/O Port 0038 - 0039
    I/O Port 003C - 003D
    I/O Port 0050 - 0053
    I/O Port 0072 - 0073
    I/O Port 0074 - 0075
    I/O Port 0076 - 0077
    I/O Port 0080
    I/O Port 0090 - 0091
    I/O Port 0092
    I/O Port 0093 - 009F
    I/O Port 00A4 - 00A5
    I/O Port 00A8 - 00A9
    I/O Port 00AC - 00AD
    I/O Port 00B0 - 00B1
    I/O Port 00B2 - 00B3
    I/O Port 00B4 - 00B5
    I/O Port 00B8 - 00B9
    I/O Port 00BC - 00BD
    Memory: FEBFFC00 - 00000400h - ROM
    Memory: FFF00000 - 00100000h - ROM
    End of Device Resources
RAM Memory
    Memory: 00000000 - 000A0000h - Available to OS
    Memory: 000E0000 - 00020000h - ROM
    Memory: 00100000 - 3FD00000h - ROM
    End of Device Resources
DMA Controller (8237 Compatible)
    I/O Port 0000 - 000F
    I/O Port 0081 - 008F
    I/O Port 00C0 - 00DF
    DMA Channel 4
    End of Device Resources
Programmable Interrupt Controller (8259 Compatible)
    I/O Port 0020 - 0021
    I/O Port 00A0 - 00A1
    IRQ 2
    End of Device Resources
System Timer (8254 Compatible)
    I/O Port 0040 - 0043
    IRQ 0
    End of Device Resources
Real Time Clock
    I/O Port 0070 - 0071
    IRQ 8
    End of Device Resources
Keyboard Controller
    I/O Port 0060
    I/O Port 0064
    IRQ 1
    End of Device Resources
CPU is an Other ;-)
    I/O Port 00F0 - 00FF
    IRQ D
    End of Device Resources
Multimedia Audio Controller
    I/O Port 0061
    End of Device Resources
PCI Bridge
    I/O Port 0CF8 - 0CFF
    End of Device Resources
ISA Bridge
    I/O Port 04D0 - 04D1
    I/O Port 1000 - 105F
    I/O Port 1060 - 107F
    I/O Port 1180 - 11BF
    Memory: FED00000 - 00003400h - ROM
    Memory: FED20000 - 00070000h - ROM
    Memory: FEC00000 - 00000400h - ROM
    End of Device Resources
FLASH Memory
    Memory: FFB80000 - 00080000h - ROM
    Memory: FFB00000 - 00080000h - ROM
    Memory: FFA80000 - 00080000h - ROM
    Memory: FFA00000 - 00080000h - ROM
    Memory: FF980000 - 00080000h - ROM
    Memory: FF900000 - 00080000h - ROM
    Memory: FF880000 - 00080000h - ROM
    Memory: FF800000 - 00080000h - ROM
    Memory: FF000000 - 00800000h - ROM
    End of Device Resources
RAM Memory
    Memory: 000DA000 - 00002000h - Available to OS
    End of Device Resources
RAM Memory
    Memory: 000D1000 - 00003000h - ROM
    End of Device Resources
RAM Memory
    Memory: 000DD000 - 00002000h - Available to OS
    End of Device Resources
Floppy Controller
    I/O Port 0000 - FFFF
    I/O Port 0000 - FFFF
    IRQ D
    DMA Channel
    End of Device Resources



Base Add - Size     - Type of Memory
----------------------------------------------------------------
00000000 - 000A0000 - Available to OS
000D1000 - 00003000 - ROM
000DA000 - 00002000 - Available to OS
000DD000 - 00002000 - Available to OS
000E0000 - 00020000 - ROM
00100000 - 3FD00000 - ROM
FEBFFC00 - 00000400 - ROM
FEC00000 - 00000400 - ROM
FED00000 - 00003400 - ROM
FED20000 - 00070000 - ROM
FF000000 - 00800000 - ROM
FF800000 - 00080000 - ROM
FF880000 - 00080000 - ROM
FF900000 - 00080000 - ROM
FF980000 - 00080000 - ROM
FFA00000 - 00080000 - ROM
FFA80000 - 00080000 - ROM
FFB00000 - 00080000 - ROM
FFB80000 - 00080000 - ROM
FFF00000 - 00100000 - ROM
----------------------------------------------------------------
Total Mem: 000A4000 -        671,744 bytes.
c:\smiddy\smiddyOS\TOYS>

My question I pose to you all: is this information useful or redundant? If you knew the specifics from a device perspective first, would it effect the outcome of your OS implementation?

As an aside, this is from my wife's laptop. Notice that PnP BIOS says it only has 671,744 bytes. E820 on this machine reports the full 1024MB.


- [color=red]s[/color][color=blue]m[/color][color=red]i[/color][color=blue]d[/color][color=red]d[/color][color=blue]y[/color]

Offline

 

#2 2005-07-26 18:08:03

bubach
Administrator
From: Trollhättan, Sweden
Registered: 2005-02-15
Posts: 367
PM  Website

Re: Device Driver Update-age...

good work. and.. big_smile :
it's useful when we get your source.. tongue

Offline

 

#3 2005-07-26 19:02:18

smiddy
Active member
Registered: 2005-02-15
Posts: 183
PM

Re: Device Driver Update-age...

bubach wrote:

good work. and.. big_smile :
it's useful when we get your source.. tongue

OK, you asked for it big_smile, here it is, without variable definitions, just the main routine. Extranious routines are removed and not a lot of commenting. If you follow the PnP specifications, you should be able to ascertain the origins of most stuff. This version is in realmode. Routine Message is a print screen, ToHex, well it converts to hex character, as decimal converts to a decimal character....

[EDIT]Oh, BTW, it isn't entirely finished either. If you can follow this code, you can certainly finish this from the documents on PnP Specifications and Microsoft's generic device PnP Device IDs.[/EDIT]

ASM code:

PnPDetect:

    pusha
    push fs
    push es

    mov [PnPTotalMemory],dword 0
    mov ax,0F000h
    mov es,ax
    MOV BX,0                        ; Start at F000:0000h
    
.SCANIT:

    CLD                             ; Go from left to right
    MOV SI,PnPSignature             ; Place the string to look for in DS:SI
    MOV DI,BX                       ; Start ES:DI at 0
    MOV CX,4                        ; Compare 4 letters or bytes
    REPE CMPSB                      ; Scan memory until it is found.
    JE .FoundIt
    INC BX                          ; Increment BX to find string
    cmp BX,0FFFFh                   ; Check to see if we made it through the BIOS area
    je .NotFound                    ; If we did, no PnP
    jmp .SCANIT
    
.NotFound:

    pop es

    MOV si,NoPnPMessage
    call Message
    jmp .Finito
    
.FoundIt:                           ; Here is where I need to copy it.

    mov ax,bx
    inc bx
    and ax,000Fh
    cmp ax,0
    jne .SCANIT
    dec bx
    mov [PnPLocation],bx
    pop es
    mov ax,0F000h
    mov fs,ax
    mov ax,bx
    mov cl,16
    call ToHex
    
    mov si,PnPEntryMessage
    call Message
    mov si,TheEndOfLine
    call Message
    
    mov bx,[PnPLocation]
    add bx,0Fh

    mov ax,[fs:bx]                  ; Add PnP BIOS segment
    mov [PnPBIOSSegment],ax
    mov bx,[PnPLocation]
    add bx,0Dh
    
    mov ax,[fs:bx]                  ; Add PnP BIOS offset
    mov [PnPBIOSOffset],ax
    
    mov bx,[PnPLocation]
    add bx,01Bh                     ; Real mode data segment
    mov ax,[fs:bx]
    mov [PnPDataSegment],ax
    
    push ax
    push ds
    push LargestNodeSize
    push ds
    push NumberOfNodes
    push word 0                     ; Function 0
    push cs
    lea ax,[.ReturnHere]
    push ax
    
    mov ax,[PnPBIOSSegment]
    push ax
    mov bx,[PnPBIOSOffset]
    push bx
    retf    

.ReturnHere:                        ; Marker for returning from RETF above

    add sp,12
    cmp ax,0                        ; Check for success
    jne .PnPFunction0Error
    
    mov ax,[LargestNodeSize]
    call ToDecimal
    mov edi,DecimalBuffer
    call StringLength
    mov [SizeOfColumnOne],ecx
    
    mov ax,[NumberOfNodes]
    call ToDecimal
    mov edi,DecimalBuffer
    call StringLength
    mov [SizeOfColumnTwo],ecx

.DoItAgain:                         ; Loop back through until down looking.

    mov ax,[PnPDataSegment]
    push ax
    push word 1                     ; Control Flag
    push ds                         ; segment/selector of devNodeBuffer ; pointer to devNodeBuffer
    push DeviceNodeBuffer           ; Offset saved
    push ds                         ; segment/selector of Node          ; pointer to Node number
    push Node                       ; offset of Node
    push word 1                     ; GET_DEVICE_NODE Function 1
    
    push cs
    lea ax,[.ReturnHere2]
    push ax
    
    mov ax,[PnPBIOSSegment]
    push ax
    mov bx,[PnPBIOSOffset]
    push bx
    retf    
    
.ReturnHere2:                       ; Marker for returning from RETF above

    add sp,14                       ; Clean up stack
    cmp ax,0                        ; SUCCESS Function completed successfully?
    jne .PnPFunction0Error          ; No-handle error condition
    
    movzx eax,word [DeviceNodeBuffer]
    mov [SizeOfDeviceNode],ax

    mov ebx,7
    movzx eax,byte [DeviceNodeBuffer + ebx]
    
    cmp al,byte 1                   ; Is it a Mass Storage Device?
    je .Number1                     ; Yes, go get specifics
    
    cmp al,byte 2                   ; Is it a Network Interface Controller?
    je .Number2                     ; Yes, go get specifics
    
    cmp al,byte 3                   ; Is it a display controller?
    je .Number3                     ; Yes, go get specifics
    
    cmp al,byte 4                   ; Is it a Multi-media Controller?
    je .Number4                     ; Yes, go get specifics

    cmp al,byte 5                   ; Is this a memory field?
    je .Number5                     ; Yes, go get specifics
    
    cmp al,byte 6                   ; Is it a Bridge Controller?
    je .Number6                     ; Yes, go get specifics
    
    cmp al,byte 7                   ; Is it a Communications Device?
    je .Number7                     ; Yes, go get specifics
    
    cmp al,byte 8                   ; Is it a system peripheral?
    je .Number8                     ; Yes, get specifics
    
    cmp al,byte 9                   ; Is it an input device?
    je .Number9                     ; Yes, get specifics
    
    cmp al,byte 0Ah                 ; Is it a Docking Station?
    je .NumberA                     ; Yes, get specifics
    
    cmp al,byte 0Bh                 ; Is it a CPU?
    je .NumberB                     ; Yes, get specifics...
    jmp .Continue
    
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
.Number1:

    inc ebx
    mov al,[DeviceNodeBuffer + ebx; Submode
    cmp al,0
    je .SCSIController
    
    cmp al,1
    je .IDEController
    
    cmp al,2
    je .FloppyController
    
    cmp al,3
    je .IPIController
    
    cmp al,80h
    je .OtherMassStorage
    
.SCSIController:

    mov si,SCSIControllerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne

.IDEController:

    mov si,IDEControllerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne

.FloppyController:

    mov si,FloppyControllerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne

.IPIController:

    mov si,IPIControllerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne

.OtherMassStorage:

    mov si,OtherControllerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne

.Number2:

    jmp .Continue
    
.Number3:        

    jmp .Continue
    
.Number4:

    inc ebx    
    mov al,[DeviceNodeBuffer + ebx; Submode
    cmp al,0                        ; Is it Host Processor Bridge?
    je .VideoController
    cmp al,1
    je .AudioController
    cmp al,080h
    je .OtherMultimediaController
    jmp .Continue                   ; No, Continue
    
.VideoController:

    mov si,VideoControllerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.AudioController:

    mov si,AudioControllerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.OtherMultimediaController:

    mov si,OtherMultimediaControllerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
    
.Number5:

    inc ebx    
    mov al,[DeviceNodeBuffer + ebx; Submode
    cmp al,0                        ; Is it RAM memory?
    je .RAM                         ; Yes, get specifics
    
    cmp al,1                        ; Is it FLASH Memory?
    je .FlashRAM
    
    cmp al,080h
    je .OtherMemory
    
    jmp .Continue                   ; No, Continue
    
.RAM:
    
    mov si,RAMMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
    
.FlashRAM:

    mov si,FlashMemoryMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
    
.OtherMemory:

    mov si,OtherMemoryMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
    
.Number6:

    inc ebx    
    mov al,[DeviceNodeBuffer + ebx; Submode
    cmp al,0                        ; Is it Host Processor Bridge?
    je .HostBridge
    cmp al,1
    je .ISABridge
    cmp al,2
    je .EISABridge
    cmp al,3
    je .MicroChannel
    cmp al,4
    je .PCIBridge
    cmp al,5
    je .PCMCIABridge
    cmp al,080h
    je .OtherBridge
    jmp .Continue                   ; No, Continue
    
.HostBridge:

    mov si,HostBridgeMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.ISABridge:

    mov si,ISABridgeMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.EISABridge:

    mov si,EISABridgeMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.MicroChannel:

    mov si,MicroChannelBridgeMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.PCIBridge:

    mov si,PCIBridgeMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.PCMCIABridge:

    mov si,PCMCIABridgeMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
    
 .OtherBridge:

    mov si,OtherBridgeMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
    
.Number7:

    jmp .Continue
    
.Number8:

    inc ebx    
    mov al,[DeviceNodeBuffer + ebx; Submode
    cmp al,0                        ; Is it Host Processor Bridge?
    je .PIC
    cmp al,1
    je .DMAC
    cmp al,2
    je .SystemTimer
    cmp al,3
    je .RealTimeClock
    cmp al,080h
    je .OtherSystemPeripheral
    jmp .Continue                   ; No, Continue
    
.PIC:

    mov si,PICMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.DMAC:

    mov si,DMAControllerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.SystemTimer:

    mov si,SystemTimerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.RealTimeClock:
    
    mov si,RealTimeClockMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.OtherSystemPeripheral:

    mov si,OtherSystemPeripheralMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne

.Number9:

    inc ebx    
    mov al,[DeviceNodeBuffer + ebx; Submode
    cmp al,0                        ; Is it Host Processor Bridge?
    je .KeyboardController
    cmp al,1
    je .Digitizer
    cmp al,2
    je .MouseController
    cmp al,080h
    je .OtherInputController
    jmp .Continue                   ; No, Continue
    
.KeyboardController:

    mov si,KeyboardControllerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.Digitizer:

    mov si,DigitizerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.MouseController:

    mov si,MouseControllerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.OtherInputController:

    mov si,OtherInputControllerMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
    
.NumberA:

    jmp .Continue
    
.NumberB:

    inc ebx    
    mov al,[DeviceNodeBuffer + ebx; Submode
    cmp al,0                        ; Is it Host Processor Bridge?
    je .CPU386
    cmp al,1
    je .CPU486
    cmp al,2
    je .CPUPentium
    cmp al,080h
    je .OtherCPU
    jmp .Continue                   ; No, Continue
    
.CPU386:

    mov si,CPU386Message
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.CPU486:

    mov si,CPU486Message
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.CPUPentium:

    mov si,CPUPentiumMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
 
.OtherCPU:

    mov si,OtherCPUMessage
    call Message
    
    mov ebx,12
    jmp .DoAnotherOne
    
.DoAnotherOne:
    
    mov al,[DeviceNodeBuffer + ebx; Get Resource Type
    mov [ResourceType],al           ; Save Resource Type
    
    cmp al,0Ah                      ; Is it PnP Version Number?
    je .PnPVersionNumber            ; Yes, then continue until section is developed
    
    cmp al,16h                      ; Is it a logical device ID?
    je .LogicalDeviceID1            ; Yes, then continue until section is developed
    
    cmp al,17h                      ; Is it a logical device ID?
    je .LogicalDeviceID2            ; Yes, then continue until section is developed
    
    cmp al,1Ch                      ; Is it a compatible device ID
    je .CompatibleDeviceID          ; Yes, then continue until section is developed
    
    cmp al,22h                      ; Is it IRQ format?
    je .IRQFormat1                  ; Yes, then continue until section is developed
    
    cmp al,23h                      ; Is it IRQ format?
    je .IRQFormat2                  ; Yes, then continue until section is developed
    
    cmp al,2Ah                      ; Is is DMA Format?
    je .DMAFormat                   ; Yes, then continue until section is developed
    
    cmp al,30h                      ; Is it Start of Dependant Function?
    je .StartDependantFunction1     ; Yes, then continue until section is developed
    
    cmp al,31h                      ; Is it Start of Dependant Function?
    je .StartDependantFunction2     ; Yes, then continue until section is developed
    
    cmp al,38h                      ; Is it End of Dependant Function?
    je .EndDependantFunction        ; Yes, then continue until section is developed
    
    cmp al,47h                      ; Is it I/O Port Description?
    je .IOPortDescription           ; Yes, then continue until section is developed
    
    cmp al,4Bh                      ; Is it a fixed location I/O Port Description?
    je .FixedIOPortDescription      ; Yes, then continue until section is developed
    
    cmp al,71h                      ; Is it Vendor Defined?
    je .Continue                    ; Yes, then continue until section is developed
    
    cmp al,72h                      ; Is it Vendor Defined?
    je .Continue                    ; Yes, then continue until section is developed
    
    cmp al,73h                      ; Is it Vendor Defined?
    je .Continue                    ; Yes, then continue until section is developed
    
    cmp al,74h                      ; Is it Vendor Defined?
    je .Continue                    ; Yes, then continue until section is developed
    
    cmp al,75h                      ; Is it Vendor Defined?
    je .Continue                    ; Yes, then continue until section is developed
    
    cmp al,76h                      ; Is it Vendor Defined?
    je .Continue                    ; Yes, then continue until section is developed
    
    cmp al,77h                      ; Is it Vendor Defined?
    je .Continue                    ; Yes, then continue until section is developed
    
    cmp al,79h                      ; Is it an End Tag?
    je .EndTag                      ; Yes, go end tag stuff
    
    cmp al,081h                     ; Is it a Memory Range Descriptor
    je .MemoryDescriptor            ; Yes, get specifics
    
    cmp al,082h                     ; Is it an Identifier String? (ANSI)
    je .Continue                    ; Yes, go get specifics
    
    cmp al,083h                     ; Is it an Identifier String? (Unicode)
    je .Continue                    ; Yes, go get specifics
    
    cmp al,084h                     ; Is it Vendor Defined?
    je .Continue                    ; Yes, go get specifics
    
    cmp al,085h                     ; Is it 32-bit Memory Range Descriptor?
    je .MemoryDescriptor32          ; Yes, go get specifics

    cmp al,086h                     ; Is it a 32-bit fixed location memory range?
    je .FixedMemoryDescriptor       ; Yes, get specifics    
    
    jmp .Continue

.PnPVersionNumber:

    mov si,PnPVersionNumberMessage
    call Message
    
    add ebx,3                       ; Increase EBX to next record
    
    jmp .DoAnotherOne
    
.LogicalDeviceID1:

    mov si,LogicalDeviceID1Message
    call Message
    
    add ebx,6                       ; Increase EBX to next record
    
    jmp .DoAnotherOne
    
.LogicalDeviceID2:

    mov si,LogicalDeviceID2Message
    call Message
    
    add ebx,7                       ; Increase EBX to next record
    
    jmp .DoAnotherOne
    
.CompatibleDeviceID:

    mov si,CompatibleDeviceIDMessage
    call Message
    
    add ebx,5                       ; Increase EBX to next record
    
    jmp .DoAnotherOne
    
.IRQFormat1:

    mov si,IRQFormat1Message
    call Message
    
    mov al,[DeviceNodeBuffer + ebx + 1]
    mov ah,[DeviceNodeBuffer + ebx + 2]
    
    test ax,word 1                  ; Bit 0 test
    jnz .IRQ0
    test ax,word 2
    jnz .IRQ1
    test ax,word 4
    jnz .IRQ2
    test ax,word 8
    jnz .IRQ3
    test ax,word 16
    jnz .IRQ4
    test ax,word 32
    jnz .IRQ5
    test ax,word 64
    jnz .IRQ6
    test ax,word 128
    jnz .IRQ7
    test ax,word 256
    jnz .IRQ8
    test ax,word 512
    jnz .IRQ9
    test ax,word 1024
    jnz .IRQA
    test ax,word 2048
    jnz .IRQB
    test ax,word 4096
    jnz .IRQC
    test ax,word 8192
    jnz .IRQD
    test ax,word 16384
    jnz .IRQE
    test ax,word 32768
    jnz .IRQF
    jmp .IRQ1Done
    
.IRQ0:

    mov [IRQBuffer],byte '0'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQ1:

    mov [IRQBuffer],byte '1'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQ2:

    mov [IRQBuffer],byte '2'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQ3:

    mov [IRQBuffer],byte '3'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQ4:

    mov [IRQBuffer],byte '4'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQ5:

    mov [IRQBuffer],byte '5'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQ6:

    mov [IRQBuffer],byte '6'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQ7:

    mov [IRQBuffer],byte '7'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQ8:

    mov [IRQBuffer],byte '8'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQ9:

    mov [IRQBuffer],byte '9'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQA:

    mov [IRQBuffer],byte 'A'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQB:

    mov [IRQBuffer],byte 'B'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQC:

    mov [IRQBuffer],byte 'C'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQD:

    mov [IRQBuffer],byte 'D'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQE:

    mov [IRQBuffer],byte 'E'
    mov [IRQBuffer + 1],byte 0

    jmp .IRQ1Done

.IRQF:
    
    mov [IRQBuffer],byte 'F'
    mov [IRQBuffer + 1],byte 0

.IRQ1Done:
    
    add ebx,3                       ; Increase EBX to next record
    
    mov si,IRQBuffer
    call Message
    
    jmp .DoAnotherOne
    
.IRQFormat2:

    mov si,IRQFormat2Message
    call Message
    
    add ebx,4                       ; Increase EBX to next record
    
    jmp .DoAnotherOne
    
.DMAFormat:

    mov si,DMAFormatMessage
    call Message
    
    mov [DMAChannelBuffer],byte 0   ; Reinitialize the buffer   
    mov ecx,0                       ; Setup ECX for string DMAChannelBuffer
    
    mov al,[DeviceNodeBuffer + ebx + 1]
    test al,1
    jnz .DMAChannel0
.DMAReturn1:
    test al,2
    jnz .DMAChannel1
.DMAReturn2:
    test al,4
    jnz .DMAChannel2
.DMAReturn3:
    test al,8
    jnz .DMAChannel3
.DMAReturn4:
    test al,16
    jnz .DMAChannel4
.DMAReturn5:
    test al,32
    jnz .DMAChannel5
.DMAReturn6:
    test al,64
    jnz .DMAChannel6
.DMAReturn7:
    test al,128
    jnz .DMAChannel7
    jmp .DMADone
    
.DMAChannel0:

    mov [DMAChannelBuffer],byte '0'
    mov [DMAChannelBuffer + 1],byte ','
    mov [DMAChannelBuffer + 2],byte 0
    mov ecx,2

    jmp .DMAReturn1
    
.DMAChannel1:

    mov [DMAChannelBuffer + ecx],byte '1'
    mov [DMAChannelBuffer + ecx + 1],byte ','
    mov [DMAChannelBuffer + ecx + 2],byte 0
    add ecx,2

    jmp .DMAReturn2
    
.DMAChannel2:

    mov [DMAChannelBuffer + ecx],byte '2'
    mov [DMAChannelBuffer + ecx + 1],byte ','
    mov [DMAChannelBuffer + ecx + 2],byte 0
    add ecx,2

    jmp .DMAReturn3
    
.DMAChannel3:

    mov [DMAChannelBuffer + ecx],byte '3'
    mov [DMAChannelBuffer + ecx + 1],byte ','
    mov [DMAChannelBuffer + ecx + 2],byte 0
    add ecx,2

    jmp .DMAReturn4
    
.DMAChannel4:

    mov [DMAChannelBuffer + ecx],byte '4'
    mov [DMAChannelBuffer + ecx + 1],byte ','
    mov [DMAChannelBuffer + ecx + 2],byte 0
    add ecx,2

    jmp .DMAReturn5
    
.DMAChannel5:

    mov [DMAChannelBuffer + ecx],byte '5'
    mov [DMAChannelBuffer + ecx + 1],byte ','
    mov [DMAChannelBuffer + ecx + 2],byte 0
    add ecx,2

    jmp .DMAReturn6
    
.DMAChannel6:

    mov [DMAChannelBuffer + ecx],byte '6'
    mov [DMAChannelBuffer + ecx + 1],byte ','
    mov [DMAChannelBuffer + ecx + 2],byte 0
    add ecx,2

    jmp .DMAReturn7
    
.DMAChannel7:

    mov [DMAChannelBuffer + ecx],byte '7'
    mov [DMAChannelBuffer + ecx + 1],byte 0
    add ecx,2

    
.DMADone:
    
    add ebx,3                       ; Increase EBX to next record
    
    cmp [DMAChannelBuffer + ecx - 1],byte ','
    jne .DMAPrint
    mov [DMAChannelBuffer + ecx - 1],byte 0
    
.DMAPrint:

    mov si,DMAChannelBuffer
    call Message
    
    jmp .DoAnotherOne
    
.StartDependantFunction1:

    mov si,StartDependantFunction1Message
    call Message
    
    add ebx,1                       ; Increase EBX to next record
    
    jmp .DoAnotherOne
    
.StartDependantFunction2:

    mov si,StartDependantFunction2Message
    call Message
    
    add ebx,2                       ; Increase EBX to next record
    
    jmp .DoAnotherOne
    
.EndDependantFunction:

    mov si,EndDependantFunctionMessage
    call Message
    
    add ebx,1                       ; Increase EBX to next record
    
    jmp .DoAnotherOne
    
.IOPortDescription:

    mov si,IOPortDescriptionMessage
    call Message
    
    mov al,[DeviceNodeBuffer + ebx + 2]
    mov ah,[DeviceNodeBuffer + ebx + 3]
    mov [IOPortMinRange],ax
    mov al,[DeviceNodeBuffer + ebx + 4]
    mov ah,[DeviceNodeBuffer + ebx + 5]
    mov [IOPortMaxRange],ax
    mov al,[DeviceNodeBuffer + ebx + 7]
    mov [IOPortLength],al
    mov ax,[IOPortMinRange]
    mov cl,16
    call ToHex
    mov si,HexBuffer
    call Message
    cmp ax,[IOPortMinRange]
    je .AddMaxNoLength
    mov si,TheDash
    call Message
    mov ax,[IOPortMaxRange]
    mov cl,16
    call ToHex
    mov si,HexBuffer
    call Message
    mov si,TheDash
    call Message
    mov al,[IOPortLength]
    mov cl,8
    call ToHex
    mov si,HexBuffer
    call Message
    
.AddMaxNoLength:

    movzx cx,byte [IOPortLength]
    cmp cx,1
    je .IOPortDone
    mov si,TheDash
    call Message
    add ax,cx
    dec ax
    mov cl,16
    call ToHex
    mov si,HexBuffer
    call Message
    
.IOPortDone:

    add ebx,8                       ; Increase EBX to next record
    
    jmp .DoAnotherOne
    
.FixedIOPortDescription:

    mov si,FixedIOPortDescriptionMessage
    call Message
    
    add ebx,4                       ; Increase EBX to next record
    
    jmp .DoAnotherOne
    
.EndTag:

    mov si,EndTagMessage
    call Message
    
    jmp .Continue
    
.MemoryDescriptor:

    mov si,MemoryDescriptorMessage
    call Message
    
    add ebx,12                      ; Increase EBX to next record
    
    jmp .DoAnotherOne
    
.MemoryDescriptor32:

    
    mov al,[DeviceNodeBuffer + ebx + 3]
    mov [RAMType],al

    mov ah,[DeviceNodeBuffer + ebx + 7]
    mov al,[DeviceNodeBuffer + ebx  + 6]
    shl eax,16
    mov ah,[DeviceNodeBuffer + ebx  + 5]
    mov al,[DeviceNodeBuffer + ebx  + 4]
    mov [MinBase32Memory],eax
        
    mov ah,[DeviceNodeBuffer + ebx + 11]
    mov al,[DeviceNodeBuffer + ebx  + 10]
    shl eax,16
    mov ah,[DeviceNodeBuffer + ebx  + 9]
    mov al,[DeviceNodeBuffer + ebx  + 8]
    mov [MaxBase32Memory],eax
    
    mov ah,[DeviceNodeBuffer + ebx + 15]
    mov al,[DeviceNodeBuffer + ebx  + 14]
    shl eax,16
    mov ah,[DeviceNodeBuffer + ebx  + 13]
    mov al,[DeviceNodeBuffer + ebx  + 12]
    mov [Base32MemoryAlignment],eax
    
    mov ah,[DeviceNodeBuffer + ebx + 19]
    mov al,[DeviceNodeBuffer + ebx  + 18]
    shl eax,16
    mov ah,[DeviceNodeBuffer + ebx  + 17]
    mov al,[DeviceNodeBuffer + ebx  + 16]
    mov [Range32Memory],eax

    mov eax,[MinBase32Memory]
    cmp eax,[MaxBase32Memory]
    jne .TellUserMemory32Descriptor
    mov si,RAMRangeMessage
    call Message
    mov cl,32
    call ToHex
    mov si,HexBuffer
    call Message
    
    mov si,TheDash
    call Message
    
    mov eax,[Range32Memory]
    mov cl,32
    call ToHex
    mov si,HexBuffer
    call Message
    
    mov si,TheHexAfter
    call Message
    
    mov si,TheDash
    call Message
    
    mov al,[RAMType]
    test al,byte 1
    jnz .NextToDone32
    mov si,SayROMMessage
    jmp .Done32
    
.TellUserMemory32Descriptor:

    mov si,MemoryDescriptor32Message
    jmp .Done32
    
.NextToDone32:

    mov si,SayRAMMessage
    
    mov eax,[Range32Memory]
    add [PnPTotalMemory],eax
    
.Done32:

    call Message
    
    push ebx
    mov eax,[MinBase32Memory]
    mov ebx,[Range32Memory]
    mov cl,[RAMType]
    call AddMemoryRecord
    pop ebx
    
    add ebx,20                      ; Increase EBX to next record
    
    jmp .DoAnotherOne
    
.FixedMemoryDescriptor:
    
    mov si,RAMRangeMessage  ; TheBIOSE820Message2
    call Message
    
    mov ah,[DeviceNodeBuffer + ebx + 7]
    mov al,[DeviceNodeBuffer + ebx  + 6]
    shl eax,16
    mov ah,[DeviceNodeBuffer + ebx  + 5]
    mov al,[DeviceNodeBuffer + ebx  + 4]
    mov [BaseOfMemory],eax
    mov cl,20h
    call ToHex
    mov si,HexBuffer
    call Message
    mov si,TheDash
    call Message
    mov ah,[DeviceNodeBuffer + ebx  + 11]
    mov al,[DeviceNodeBuffer + ebx  + 10]
    shl eax,16
    mov ah,[DeviceNodeBuffer + ebx  + 9]
    mov al,[DeviceNodeBuffer + ebx  + 8]
    mov [PreMemoryLength],eax
    mov cl,20h
    call ToHex
    mov si,HexBuffer
    call Message
    mov si,TheHexAfter
    call Message
    
    mov al,[DeviceNodeBuffer + ebx  + 3]
    mov [RAMType],al
    mov si,TheDash
    call Message
    test al,1                               ; Check for available RAM
    jnz .SayRAM
    mov si,SayROMMessage
    jmp .TypeDone
        
.SayRAM:

    mov si,SayRAMMessage
    
    mov eax,[PreMemoryLength]
    add [PnPTotalMemory],eax
    
.TypeDone:

    call Message
    
    push ebx
    mov eax,[BaseOfMemory]
    mov ebx,[PreMemoryLength]
    mov cl,[RAMType]
    call AddMemoryRecord
    pop ebx

    add ebx,12
    cmp bx,[SizeOfDeviceNode]
    jbe .DoAnotherOne
    
.Continue:
    
    mov ax,[Node]
    cmp ax,0FFh                     ; Is this the last one?
    je .PnPExit
    mov si,TheEndOfLine
    call Message
    jmp .DoItAgain
    
.PnPFunction0Error:

    mov si,NoPnPMessage
    call Message
    jmp .Finito

.PnPExit:

    mov si,TheEndOfLine
    call Message

.Finito:

    mov si,TheEndOfLine
    call Message
    
    mov si,TheEndOfLine
    call Message
    
    call SortMemoryRecords
    
    mov si,TheEndOfLine
    call Message
    
    mov si,PnPMemoryDisplayMessage
    call Message
    
    mov si,TotalMemoryMessage3
    call Message

    call DisplayMemoryRecords
    
    mov si,TotalMemoryMessage3
    call Message

    mov si,TotalMemoryMessage4
    call Message

    mov eax,[PnPTotalMemory]
    mov cl,32
    call ToHex
    mov si,HexBuffer
    call Message
    
    mov si,TheDash
    call Message
        
    mov eax,[PnPTotalMemory]
    call ToDecimal

    call AddCommas
    mov edi,CommaBuffer
    mov eax,14
    call AddForwardSpaces
    mov si,CommaBuffer
    call Message
    mov si,JustTheBytes
    call Message
    
    pop fs
    popa

    RET

Enjoy! If you have questions or better ways of coding this do give me your tar pence!

Last edited by smiddy (2005-07-26 19:07:11)


- [color=red]s[/color][color=blue]m[/color][color=red]i[/color][color=blue]d[/color][color=red]d[/color][color=blue]y[/color]

Offline

 

#4 2005-07-26 19:11:21

bubach
Administrator
From: Trollhättan, Sweden
Registered: 2005-02-15
Posts: 367
PM  Website

Re: Device Driver Update-age...

Nice!
Don't have time to take any closer look right now, but I'll be back..

Offline

 

#5 2005-08-02 15:20:37

bubach
Administrator
From: Trollhättan, Sweden
Registered: 2005-02-15
Posts: 367
PM  Website

Re: Device Driver Update-age...

Have you or Axel done any more thinking of how to load/unload drivers, and how the driver->app interface would look like?

Offline

 

#6 2005-08-02 16:43:09

smiddy
Active member
Registered: 2005-02-15
Posts: 183
PM

Re: Device Driver Update-age...

bubach wrote:

Have you or Axel done any more thinking of how to load/unload drivers, and how the driver->app interface would look like?

The simple answer is no.

The complicated one, is yes, sort of... I've been working on device determination in order to make a clear decision on how to interface devices to OS and user apps. I like the use of DOS' setup, much like OS/2 (OS/2 is a 32 bit setup, very close to DOS). They break down the interfaces into blocks and/or characters. This seems simple enough. So there would need to be a set of standard calls for each driver type. Also, the OS would need to provide a mechanism so the driver can communicate with the user. This gets into the chicken and the egg thingy. But, to alleviate that, my initial inclination is to provide standard OS drivers that are very minimal in their implementation. These drivers would never be able to be uninstalled or at very least warn the user prior to uninstll as it could cut of the user from using their system, say if you uninstalled the keyboard handler (more like console driver), therefore if the OS recognized that the user was about to hose themselves (a smiddy technical term...) by uninstalling the basic OS driver then system would warn them or not allow them to do it. There are a few essential drivers that provide timing, which should never be uninstalled too, for synchronization et al.

I think that sums up for the most part what I have delved into. My current work is in determination of devices on a system. I think I have a fair list of [b]required[/b] drivers for a basic system. From there is is a matter of developing a [b]load[/b] and [b]unload[/b] process. This seems fairly simple to me...


- [color=red]s[/color][color=blue]m[/color][color=red]i[/color][color=blue]d[/color][color=red]d[/color][color=blue]y[/color]

Offline

 

#7 2005-08-09 13:16:59

Nelson
Member
Registered: 2005-07-02
Posts: 35
PM

Re: Device Driver Update-age...

Nice peice of code, smiddy.

Offline

 

#8 2005-08-09 14:58:18

smiddy
Active member
Registered: 2005-02-15
Posts: 183
PM

Re: Device Driver Update-age...

Nelson wrote:

Nice peice of code, smiddy.

Thanks man! Hopefully it is useful. wink


- [color=red]s[/color][color=blue]m[/color][color=red]i[/color][color=blue]d[/color][color=red]d[/color][color=blue]y[/color]

Offline

 

#9 2005-08-12 00:38:27

AxelDominatoR
Member
From: Reggio Calabria, Italy
Registered: 2005-03-07
Posts: 43
PM  Website

Re: Device Driver Update-age...

smiddy wrote:

bubach wrote:

Have you or Axel done any more thinking of how to load/unload drivers, and how the driver->app interface would look like?

The simple answer is no.

Unfortunately that damned site took me more of my "programming time" than I originally expected.
I have less than a week to finish it so... I hope that all will be ok and I can start some "serious" project wink.

smiddy wrote:

The complicated one, is yes, sort of... I've been working on device determination in order to make a clear decision on how to interface devices to OS and user apps. I like the use of DOS' setup, much like OS/2 (OS/2 is a 32 bit setup, very close to DOS). They break down the interfaces into blocks and/or characters. This seems simple enough. So there would need to be a set of standard calls for each driver type.

The nice thing within my idea is that the defined "standard" only matters to drivers and the compiler/interpreter. This way you can have your OS call drivers any manner you like, and it's a compiler's job to translate the generic drivers into your OS preferred interface way of calling them.

smiddy wrote:

This gets into the chicken and the egg thingy. But, to alleviate that, my initial inclination is to provide standard OS drivers that are very minimal in their implementation. These drivers would never be able to be uninstalled or at very least warn the user prior to uninstll as it could cut of the user from using their system, say if you uninstalled the keyboard handler (more like console driver), therefore if the OS recognized that the user was about to hose themselves (a smiddy technical term...) by uninstalling the basic OS driver then system would warn them or not allow them to do it. There are a few essential drivers that provide timing, which should never be uninstalled too, for synchronization et al.

That's entirely up to you. You can freely mix up your OS "proprietary" drivers, such as console management, keyboard and other low-level things, and then use unified drivers for printing, having 3D acceleration, etc etc. You have full freedom. Regarding the egg-and-chicken thing, a solution could be to have some drivers compiled into the kernel bin image, or maybe have a sort of "init system image" like most microkernels.

smiddy wrote:

I think that sums up for the most part what I have delved into. My current work is in determination of devices on a system. I think I have a fair list of [b]required[/b] drivers for a basic system. From there is is a matter of developing a [b]load[/b] and [b]unload[/b] process. This seems fairly simple to me...

Great job!

Goin' to finish the devilish site thing >)

Axel DominatoR ^^^ HC


---
Axel DominatoR ^^^ HC

Offline

 

#10 2005-08-12 04:22:30

smiddy
Active member
Registered: 2005-02-15
Posts: 183
PM

Re: Device Driver Update-age...

Hey Axel, long time no see you write. I'm begining to understand you perspective better now on the unified driver idea. A standard language, but the language compiles on each system differently based on the system it is on. The language remains the same, only the specific implementation changes based on the system. NICE!

Good luck with your devilish site thingy.


- [color=red]s[/color][color=blue]m[/color][color=red]i[/color][color=blue]d[/color][color=red]d[/color][color=blue]y[/color]

Offline

 

#11 2005-08-12 11:00:09

AxelDominatoR
Member
From: Reggio Calabria, Italy
Registered: 2005-03-07
Posts: 43
PM  Website

Re: Device Driver Update-age...

smiddy wrote:

A standard language, but the language compiles on each system differently based on the system it is on. The language remains the same, only the specific implementation changes based on the system. NICE!

Exactly! That's the main difference between my idea and ProjectUDI's one.


---
Axel DominatoR ^^^ HC

Offline

 

 

Board footer

Powered by PunBB
BOS homepage © Copyright 2005 Christoffer Bubach
Strict XHTML and valid CSS.