Home | History | Annotate | Download | only in ddk
      1 /*
      2  * ntagp.h
      3  *
      4  * NT AGP bus driver interface
      5  *
      6  * This file is part of the w32api package.
      7  *
      8  * Contributors:
      9  *   Created by Gregor Anich <blight (at) blight.eu.org>
     10  *
     11  * THIS SOFTWARE IS NOT COPYRIGHTED
     12  *
     13  * This source code is offered for use in the public domain. You may
     14  * use, modify or distribute it freely.
     15  *
     16  * This code is distributed in the hope that it will be useful but
     17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
     18  * DISCLAIMED. This includes but is not limited to warranties of
     19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     20  *
     21  */
     22 
     23 #pragma once
     24 
     25 #ifdef __cplusplus
     26 extern "C" {
     27 #endif
     28 
     29 DEFINE_GUID(GUID_AGP_BUS_INTERFACE_STANDARD, 0x2ef74803, 0xd8d3, 0x11d1, 0x9c, 0xaa, 0x00, 0xc0, 0xf0, 0x16, 0x56, 0x36);
     30 
     31 #define AGP_BUS_INTERFACE_V1                     1
     32 #define AGP_BUS_INTERFACE_V2                     2
     33 #define AGP_BUS_INTERFACE_V3                     3
     34 #define AGP_BUS_INTERFACE_V4                     4
     35 #define AGP_BUS_INTERFACE_V5                     5
     36 
     37 /* Indicates wether the GART supports mapping of physical memory for the CPU */
     38 #define AGP_CAPABILITIES_MAP_PHYSICAL            0x00000001
     39 #define AGP_CAPABILITIES_CACHE_COHERENT          0x00000002
     40 #define AGP_CAPABILITIES_REQUIRES_GPU_FLUSH      0x00000004
     41 
     42 #define AGP_SET_RATE_DISABLE_SBA                 0x00010000
     43 #define AGP_SET_RATE_DISABLE_FW                  0x00020000
     44 
     45 #define AGP_GUARD_PAGE_CHECK_FIRST_ULONG         0x00000001
     46 #define AGP_GUARD_PAGE_CHECK_USE_SAME_OFFSET     0x00000002
     47 #define AGP_GUARD_PAGE_CHECK_DO_NOT_BUGCHECK     0x00000004
     48 
     49 #define AGP_BUS_INTERFACE_V1_SIZE (FIELD_OFFSET(AGP_BUS_INTERFACE_STANDARD,SetRate))
     50 #define AGP_BUS_INTERFACE_V2_SIZE (FIELD_OFFSET(AGP_BUS_INTERFACE_STANDARD, AgpSize))
     51 #define AGP_BUS_INTERFACE_V3_SIZE (FIELD_OFFSET(AGP_BUS_INTERFACE_STANDARD, FlushChipsetCaches))
     52 #define AGP_BUS_INTERFACE_V4_SIZE (FIELD_OFFSET(AGP_BUS_INTERFACE_STANDARD, MapMemoryEx))
     53 
     54 typedef NTSTATUS
     55 (NTAPI *PAGP_BUS_SET_RATE)(
     56   IN PVOID AgpContext,
     57   IN ULONG AgpRate);
     58 
     59 typedef NTSTATUS
     60 (NTAPI *PAGP_BUS_RESERVE_MEMORY)(
     61   IN PVOID AgpContext,
     62   IN ULONG NumberOfPages,
     63   IN MEMORY_CACHING_TYPE MemoryType,
     64   OUT PVOID *MapHandle,
     65   OUT PHYSICAL_ADDRESS *PhysicalAddress OPTIONAL);
     66 
     67 typedef NTSTATUS
     68 (NTAPI *PAGP_BUS_RELEASE_MEMORY)(
     69   IN PVOID AgpContext,
     70   IN PVOID MapHandle);
     71 
     72 typedef NTSTATUS
     73 (NTAPI *PAGP_BUS_COMMIT_MEMORY)(
     74   IN PVOID AgpContext,
     75   IN PVOID MapHandle,
     76   IN ULONG NumberOfPages,
     77   IN ULONG OffsetInPages,
     78   IN OUT PMDL Mdl OPTIONAL,
     79   OUT PHYSICAL_ADDRESS *MemoryBase);
     80 
     81 typedef NTSTATUS
     82 (NTAPI *PAGP_BUS_FREE_MEMORY)(
     83   IN PVOID AgpContext,
     84   IN PVOID MapHandle,
     85   IN ULONG NumberOfPages,
     86   IN ULONG OffsetInPages);
     87 
     88 typedef NTSTATUS
     89 (NTAPI *PAGP_GET_MAPPED_PAGES)(
     90   IN PVOID AgpContext,
     91   IN PVOID MapHandle,
     92   IN ULONG NumberOfPages,
     93   IN ULONG OffsetInPages,
     94   OUT PMDL Mdl);
     95 
     96 typedef NTSTATUS
     97 (NTAPI *PAGP_MAP_MEMORY)(
     98   IN PVOID AgpContext,
     99   IN PVOID MapHandle,
    100   IN ULONG NumberOfPages,
    101   IN ULONG OffsetInPages,
    102   IN PMDL Mdl,
    103   OUT PHYSICAL_ADDRESS *MemoryBase);
    104 
    105 typedef NTSTATUS
    106 (NTAPI *PAGP_UNMAP_MEMORY)(
    107   IN PVOID AgpContext,
    108   IN PVOID MapHandle,
    109   IN ULONG NumberOfPages,
    110   IN ULONG OffsetInPages,
    111   IN PMDL Mdl);
    112 
    113 typedef NTSTATUS
    114 (NTAPI *PAGP_FLUSH_CHIPSET_CACHES)(
    115   IN PVOID AgpContext);
    116 
    117 typedef NTSTATUS
    118 (NTAPI *PAGP_CHECK_INTEGRITY)(
    119   IN PVOID AgpContext);
    120 
    121 typedef NTSTATUS
    122 (NTAPI *PAGP_MAP_MEMORY_EX)(
    123   IN PVOID AgpContext,
    124   IN PVOID MapHandle,
    125   IN ULONG NumberOfPages,
    126   IN ULONG OffsetInPages,
    127   IN PMDL Mdl,
    128   IN MEMORY_CACHING_TYPE *CacheTypeOverride OPTIONAL,
    129   OUT PHYSICAL_ADDRESS *MemoryBase);
    130 
    131 typedef NTSTATUS
    132 (NTAPI *PAGP_UNMAP_MEMORY_EX)(
    133   IN PVOID AgpContext,
    134   IN PVOID MapHandle,
    135   IN ULONG NumberOfPages,
    136   IN ULONG OffsetInPages,
    137   IN PMDL Mdl);
    138 
    139 typedef NTSTATUS
    140 (NTAPI *PAGP_FLUSH_GART_TLB)(
    141   IN PVOID AgpContext);
    142 
    143 typedef NTSTATUS
    144 (NTAPI *PAGP_CHECK_GUARD_PAGE)(
    145   IN PVOID AgpContext,
    146   IN ULONG Flags,
    147   IN ULONG ULongsToCheck);
    148 
    149 typedef struct _AGP_INFO_COMMON {
    150   PCI_AGP_CAPABILITY MasterCap;
    151   PCI_AGP_CAPABILITY TargetCap;
    152   USHORT DeviceId;
    153   USHORT VendorId;
    154   USHORT SubVendorId;
    155   USHORT SubSystemId;
    156   UCHAR HwRevisionId;
    157   ULONG VerifierFlags;
    158   BOOLEAN GuardPageCorruption;
    159 } AGP_INFO_COMMON, *PAGP_INFO_COMMON;
    160 
    161 typedef struct _AGP_INFO_DRIVER {
    162   ULONG AGPReg1;
    163   ULONG AGPReg2;
    164   PHYSICAL_ADDRESS ApertureStart;
    165   PHYSICAL_ADDRESS GartTranslationTable;
    166   ULONG ApertureLength;
    167 } AGP_INFO_DRIVER, *PAGP_INFO_DRIVER;
    168 
    169 typedef struct _AGP_INFO {
    170   AGP_INFO_COMMON CommonInfo;
    171   AGP_INFO_DRIVER DriverInfo;
    172 } AGP_INFO, *PAGP_INFO;
    173 
    174 typedef VOID
    175 (NTAPI *PAGP_GET_INFO)(
    176   IN PVOID AgpContext,
    177   OUT PAGP_INFO AgpInfo);
    178 
    179 typedef struct _AGP_BUS_INTERFACE_STANDARD {
    180   USHORT Size;
    181   USHORT Version;
    182   PVOID AgpContext;
    183   PINTERFACE_REFERENCE InterfaceReference;
    184   PINTERFACE_DEREFERENCE InterfaceDereference;
    185   ULONG Capabilities;
    186   PAGP_BUS_RESERVE_MEMORY ReserveMemory;
    187   PAGP_BUS_RELEASE_MEMORY ReleaseMemory;
    188   PAGP_BUS_COMMIT_MEMORY CommitMemory;
    189   PAGP_BUS_FREE_MEMORY FreeMemory;
    190   PAGP_GET_MAPPED_PAGES GetMappedPages;
    191   PAGP_BUS_SET_RATE SetRate;
    192   SIZE_T AgpSize;
    193   PHYSICAL_ADDRESS AgpBase;
    194   PHYSICAL_ADDRESS MaxPhysicalAddress;
    195   PAGP_MAP_MEMORY MapMemory;
    196   PAGP_UNMAP_MEMORY UnMapMemory;
    197   PAGP_FLUSH_CHIPSET_CACHES FlushChipsetCaches;
    198   PAGP_CHECK_INTEGRITY CheckIntegrity;
    199   PAGP_MAP_MEMORY_EX  MapMemoryEx;
    200   PAGP_UNMAP_MEMORY_EX UnMapMemoryEx;
    201   PAGP_FLUSH_GART_TLB FlushGartTLB;
    202   PAGP_CHECK_GUARD_PAGE CheckGuardPage;
    203   PAGP_GET_INFO GetAgpInfo;
    204 } AGP_BUS_INTERFACE_STANDARD, *PAGP_BUS_INTERFACE_STANDARD;
    205 
    206 #ifdef __cplusplus
    207 }
    208 #endif
    209