Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. include 'cfg_bios.inc'
  2. use16
  3. org     0
  4.  
  5. rom_header:
  6. ;       PnP Option ROM header
  7. rom_signature   dw      0xAA55                  ; +0    : magic
  8. rom_length      db      1                       ; +2    : number of 512byte blocks
  9. rom_entry:
  10.                 jmp     init_entry              ; +3    : initialization entry point
  11. ;                retf                            ; +5
  12. @@:
  13.         times (24-$) db 0                       ;       : left blank
  14. rom_pci_struc   dw      pci_header              ; +18h  : offset to PCI data structure
  15.  
  16.         times (32-$) db 0
  17.  
  18. ; +32
  19. pci_header:
  20. ;       PCI Data Structure
  21. pci_magic       db      'PCIR'                  ; +0    : magic
  22. pci_vendor      dw      BIOS_PCI_VENDOR         ; +4    : 10EE
  23. pci_device      dw      BIOS_PCI_DEVICE         ; +6    : 0007
  24. pci_vdata       dw      0                       ; +8    : 0 = no vital product data
  25. pci_length      dw      0x18                    ; +A    : PCI data structure length
  26. pci_classrev    dd      BIOS_PCI_CLASS          ; +C    : rev.00 + class 05.00.00
  27. pci_size        dw      1                       ; +10   : image length (512byte blocks)
  28. pci_rev         dw      0                       ; +12
  29. pci_codetype    db      0                       ; +14   : x86
  30. pci_indicator   db      0x80                    ; +15   : last image
  31. pci_maxlen      dw      1                       ; +16   : max length (512b blocks)
  32. pci_hdrptr      dw      0; manstr                  ; +18   : ExROM's config utility code header
  33. pci_dmtf_entry  dw      0                       ; +1A   : DMTP CLP entry point
  34.  
  35.         times (64-$) db 0
  36.  
  37. manstr:
  38.         db      1,'Kolibri-A Operating System',13,10,0
  39.                                                 ; utility code header size = 42 bytes
  40.         times (64+41-$) db  0                   ;
  41.         db      1                               ; ver.1
  42.  
  43. utility_entry:
  44.         jmp boot_failure
  45.         times (128-$) db 0
  46.  
  47. ;align 128
  48.  
  49. boot_failure:
  50.         int     18h                             ; return to BIOS Boot sequence
  51.  
  52. align   4
  53. init_entry:
  54. ; note x86 "unreal" mode!
  55. ; ax    =  b:d.f
  56. ; bx    =  run-time segment
  57. ; cx    =  PMM segment
  58. ; dx    =  PMM entry offset
  59.  
  60.         mov     dx, 0x0cf8                      ; PCI config address
  61. ;        mov     eax, 0x80010010                 ; BAR0
  62.         and     eax, 0x0FFFF
  63.         shl     eax, 8
  64.         or      eax, 0x80000010                 ;BAR0
  65.         out     dx, eax
  66.         out     dx, eax
  67.         add     dl, 4
  68.         in      eax, dx
  69.         and     eax, 0xFFFFFF00
  70.         add     eax, 0x0400                     ; LPC control reg
  71.         mov     dword[eax], 0x90050000          ; LED port
  72.         mov     dword[eax+4], 0x055
  73.         xor     eax, eax
  74.         sub     dl, 4
  75.         out     dx, eax
  76.         mov     bx, ax
  77.         retf
  78.  
  79.  
  80. ;        mov     edx,[esp]                       ; get the origin
  81. ;        and     dl, 0xF0
  82. ;        shl     ebx,  4                         ; correct run-time address
  83. ;        mov     cx, 0                           ; words counter
  84. ;@@:
  85. ;        mov     ax, word[edx+ecx]
  86. ;        mov     [ebx+ecx],ax
  87. ;        inc     cx
  88. ;        inc     cx
  89. ;        test    cx,0x200
  90. ;        jz  @b
  91. ;        xor     ax, ax
  92. ;        mov     bx, ax
  93. ;        mov     al, 0x20                        ; IPL device's attached
  94.  
  95. ;        retd                                    ; double !
  96.  
  97.  
  98.         times (0xDF-$) db 0             ; checksum position
  99.  
  100. sum = 0
  101. repeat  $-$$
  102.         load a byte from $$+% -1
  103.         sum = a + sum
  104. end repeat
  105. check = sum mod 256
  106. check_byte   db      (0x100 - check ) mod 256
  107.  
  108. times   (512-$) db 0