Subversion Repositories Kolibri OS

Rev

Rev 1641 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                              ;;
  3. ;; Copyright (C) 2010 KolibriOS team.     All rights reserved.  ;;
  4. ;; Distributed under terms of the GNU General Public License    ;;
  5. ;;                                                              ;;
  6. ;;                                                              ;;
  7. ;;  PCIe.INC                                                    ;;
  8. ;;                                                              ;;
  9. ;;  Extended PCI express services                               ;;
  10. ;;                                                              ;;
  11. ;;                  art_zh  <artem@jerdev.co.uk>                ;;
  12. ;;                                                              ;;
  13. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  14.  
  15. $Revision: 1554 $
  16.  
  17. ;***************************************************************************
  18. ;   Function
  19. ;      pci_ext_config:
  20. ;
  21. ;   Description
  22. ;       PCIe extended (memory-mapped) config space detection
  23. ;
  24. ;   WARNINGs:
  25. ;       1) Very Experimental!
  26. ;       2) direct HT-detection (no ACPI or BIOS service used)
  27. ;       3) Only AMD/HT processors currently supported
  28. ;
  29. ;***************************************************************************
  30.  
  31. align 4
  32. mmio_pcie_cfg_addr      dd      0x00000000      ; pcie space may be defined here
  33. mmio_pcie_cfg_lim       dd      0x000FFFFF      ; upper pcie space address
  34. mmio_pcie_cfg_pdes      dw      1               ; number of PDEs to map the space
  35. PCIe_bus_range          dw      2               ; the Bus range: power-of-2 Megabytes
  36.  
  37.  
  38. align 4
  39. pci_ext_config:
  40.         mov     eax, [mmio_pcie_cfg_addr]
  41.         mov     ebx, eax
  42.         or      ebx, ebx
  43.         jz      @f
  44.         or      ebx, 0x7FFFFFFF         ; required by PCI-SIG standards
  45.         jnz     .pcie_failed
  46.         add     ebx, 0x0FFFFC
  47.         cmp     ebx, [mmio_pcie_cfg_lim]; is the space limit correct?
  48.         ja      .pcie_failed
  49.         ret                             ; return the address forced
  50. @@:
  51.         mov     ebx, [cpu_vendor]
  52.         cmp     ebx, dword [AMD_str]
  53.         jne     .pcie_failed
  54.         mov     bx, 0xC184              ; dev = 24, fn = 01, reg = 84h
  55.  
  56. .check_HT_mmio:
  57.         mov     cx, bx
  58.         mov     ax, 0x0002              ; bus = 0, 1dword to read
  59.         call    pci_read_reg
  60.         mov     bx, cx
  61.         sub     bl, 4
  62.         and     al, 0x80                ; check the NP bit
  63.         jz      .no_pcie_cfg
  64.         shl     eax, 8                  ; bus:[27..20], dev:[19:15]
  65.         or      eax, 0x00007FFC         ; fun:[14..12], reg:[11:2]
  66. ;       mov     [mmio_pcie_cfg_lim], eax
  67.         mov     cl, bl
  68.         mov     ax, 0x0002              ; bus = 0, 1dword to read
  69.         call    pci_read_reg
  70.         mov     bx, cx
  71.         test    al, 0x03                ; MMIO Base RW enabled?
  72.         jz      .no_pcie_cfg
  73.         test    al, 0x0C                ; MMIO Base locked?
  74.         jnz     .no_pcie_cfg
  75.         xor     al, al
  76.         shl     eax, 8
  77.         test    eax, 0x000F0000         ; MMIO Base must be bus0-aligned
  78.         jnz     .no_pcie_cfg
  79.         ret     ; <<<<<<<<<<< OK >>>>>>>>>>>
  80.  
  81. .no_pcie_cfg:
  82.         xor     eax, eax
  83.         mov     [mmio_pcie_cfg_addr], eax
  84.         mov     [mmio_pcie_cfg_lim],  eax
  85.         add     bl, 12
  86.         cmp     bl, 0xC0                ; MMIO regs lay below this offset
  87.         jb      .check_HT_mmio
  88.  
  89. .pcie_failed:
  90.         jmp     $
  91. ;        xor     eax, eax
  92. ;        ret     ; <<<<<<<<< FAILURE >>>>>>>>>
  93.  
  94.  
  95. ;--------------------------------------------------------------------------
  96. ; this routine is platform-specific and used to change some BIOS settengs
  97. ; pcie_init_gfx
  98. ;       sets the GPP mode of GFX bus
  99.  
  100.  
  101. ;       this option disables external graphics
  102. pcie_init_gfx:
  103.  
  104.          ret
  105.