ReactOS  0.4.15-dev-3291-gea4c1a0
bus.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _PCIPBUSDATA
 
struct  _PCI_CONFIG_HANDLER
 
struct  _PCI_REGISTRY_INFO_INTERNAL
 
struct  _PCI_TYPE1_CFG_BITS
 
struct  _PCI_TYPE2_CSE_BITS
 
struct  _PCI_TYPE2_ADDRESS_BITS
 
struct  _PCI_TYPE0_CFG_CYCLE_BITS
 
struct  _PCI_TYPE1_CFG_CYCLE_BITS
 
struct  _ARRAY
 
struct  _HAL_BUS_HANDLER
 

Macros

#define PCI_ADDRESS_MEMORY_SPACE   0x00000000
 
#define PASTE2(x, y)   x ## y
 
#define POINTER_TO_(x)   PASTE2(P,x)
 
#define READ_FROM(x)   PASTE2(READ_PORT_, x)
 
#define WRITE_TO(x)   PASTE2(WRITE_PORT_, x)
 
#define TYPE_DEFINE(x, y)
 
#define TYPE1_DEFINE(x)   TYPE_DEFINE(x, PPCI_TYPE1_CFG_BITS);
 
#define TYPE2_DEFINE(x)   TYPE_DEFINE(x, PPCI_TYPE2_ADDRESS_BITS);
 
#define TYPE1_START(x, y)
 
#define TYPE1_END(y)   return sizeof(y); }
 
#define TYPE2_END   TYPE1_END
 
#define TYPE1_READ(x, y)
 
#define TYPE1_WRITE(x, y)
 
#define TYPE2_START(x, y)
 
#define TYPE2_READ(x, y)
 
#define TYPE2_WRITE(x, y)
 
#define PCI_TYPE1_ADDRESS_PORT   (PULONG)0xCF8
 
#define PCI_TYPE1_DATA_PORT   0xCFC
 
#define PCI_TYPE2_CSE_PORT   (PUCHAR)0xCF8
 
#define PCI_TYPE2_FORWARD_PORT   (PUCHAR)0xCFA
 
#define PCI_TYPE2_ADDRESS_BASE   0xC
 

Typedefs

typedef NTSTATUS(NTAPIPciIrqRange) (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN PCI_SLOT_NUMBER PciSlot, OUT PSUPPORTED_RANGE *Interrupt)
 
typedef struct _PCIPBUSDATA PCIPBUSDATA
 
typedef struct _PCIPBUSDATAPPCIPBUSDATA
 
typedef ULONG(NTAPIFncConfigIO) (IN PPCIPBUSDATA BusData, IN PVOID State, IN PUCHAR Buffer, IN ULONG Offset)
 
typedef VOID(NTAPIFncSync) (IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PKIRQL Irql, IN PVOID State)
 
typedef VOID(NTAPIFncReleaseSync) (IN PBUS_HANDLER BusHandler, IN KIRQL Irql)
 
typedef struct _PCI_CONFIG_HANDLER PCI_CONFIG_HANDLER
 
typedef struct _PCI_CONFIG_HANDLERPPCI_CONFIG_HANDLER
 
typedef struct _PCI_REGISTRY_INFO_INTERNAL PCI_REGISTRY_INFO_INTERNAL
 
typedef struct _PCI_REGISTRY_INFO_INTERNALPPCI_REGISTRY_INFO_INTERNAL
 
typedef struct _PCI_TYPE1_CFG_BITS PCI_TYPE1_CFG_BITS
 
typedef struct _PCI_TYPE1_CFG_BITSPPCI_TYPE1_CFG_BITS
 
typedef struct _PCI_TYPE2_CSE_BITS PCI_TYPE2_CSE_BITS
 
typedef struct _PCI_TYPE2_CSE_BITS PPCI_TYPE2_CSE_BITS
 
typedef struct _PCI_TYPE2_ADDRESS_BITS PCI_TYPE2_ADDRESS_BITS
 
typedef struct _PCI_TYPE2_ADDRESS_BITSPPCI_TYPE2_ADDRESS_BITS
 
typedef struct _PCI_TYPE0_CFG_CYCLE_BITS PCI_TYPE0_CFG_CYCLE_BITS
 
typedef struct _PCI_TYPE0_CFG_CYCLE_BITSPPCI_TYPE0_CFG_CYCLE_BITS
 
typedef struct _PCI_TYPE1_CFG_CYCLE_BITS PCI_TYPE1_CFG_CYCLE_BITS
 
typedef struct _PCI_TYPE1_CFG_CYCLE_BITSPPCI_TYPE1_CFG_CYCLE_BITS
 
typedef struct _ARRAY ARRAY
 
typedef struct _ARRAYPARRAY
 
typedef struct _HAL_BUS_HANDLER HAL_BUS_HANDLER
 
typedef struct _HAL_BUS_HANDLERPHAL_BUS_HANDLER
 

Functions

PPCI_REGISTRY_INFO_INTERNAL NTAPI HalpQueryPciRegistryInfo (VOID)
 
VOID NTAPI HalpPCISynchronizeType1 (IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PKIRQL Irql, IN PPCI_TYPE1_CFG_BITS PciCfg)
 
VOID NTAPI HalpPCIReleaseSynchronzationType1 (IN PBUS_HANDLER BusHandler, IN KIRQL Irql)
 
VOID NTAPI HalpPCISynchronizeType2 (IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PKIRQL Irql, IN PPCI_TYPE2_ADDRESS_BITS PciCfg)
 
VOID NTAPI HalpPCIReleaseSynchronizationType2 (IN PBUS_HANDLER BusHandler, IN KIRQL Irql)
 
 TYPE1_DEFINE (HalpPCIReadUcharType1)
 
 TYPE1_DEFINE (HalpPCIReadUshortType1)
 
 TYPE1_DEFINE (HalpPCIReadUlongType1)
 
 TYPE2_DEFINE (HalpPCIReadUcharType2)
 
 TYPE2_DEFINE (HalpPCIReadUshortType2)
 
 TYPE2_DEFINE (HalpPCIReadUlongType2)
 
 TYPE1_DEFINE (HalpPCIWriteUcharType1)
 
 TYPE1_DEFINE (HalpPCIWriteUshortType1)
 
 TYPE1_DEFINE (HalpPCIWriteUlongType1)
 
 TYPE2_DEFINE (HalpPCIWriteUcharType2)
 
 TYPE2_DEFINE (HalpPCIWriteUshortType2)
 
 TYPE2_DEFINE (HalpPCIWriteUlongType2)
 
BOOLEAN NTAPI HalpValidPCISlot (IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot)
 
VOID NTAPI HalpReadPCIConfig (IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
 
VOID NTAPI HalpWritePCIConfig (IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
 
ULONG NTAPI HalpGetPCIData (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootBusHandler, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
 
ULONG NTAPI HalpSetPCIData (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootBusHandler, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
 
NTSTATUS NTAPI HalpAssignPCISlotResources (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN PUNICODE_STRING RegistryPath, IN PUNICODE_STRING DriverClassName OPTIONAL, IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN ULONG Slot, IN OUT PCM_RESOURCE_LIST *pAllocatedResources)
 
ULONG NTAPI HalpGetRootInterruptVector (_In_ ULONG BusInterruptLevel, _In_ ULONG BusInterruptVector, _Out_ PKIRQL Irql, _Out_ PKAFFINITY Affinity)
 
ULONG NTAPI HalpGetCmosData (_In_ ULONG BusNumber, _In_ ULONG SlotNumber, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Length)
 
ULONG NTAPI HalpSetCmosData (IN ULONG BusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Length)
 
VOID NTAPI HalpInitializePciBus (VOID)
 
VOID NTAPI HalpInitializePciStubs (VOID)
 
BOOLEAN NTAPI HalpTranslateBusAddress (IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
 
NTSTATUS NTAPI HalpAssignSlotResources (IN PUNICODE_STRING RegistryPath, IN PUNICODE_STRING DriverClassName, IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT DeviceObject, IN INTERFACE_TYPE BusType, IN ULONG BusNumber, IN ULONG SlotNumber, IN OUT PCM_RESOURCE_LIST *AllocatedResources)
 
BOOLEAN NTAPI HalpFindBusAddressTranslation (IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress, IN OUT PULONG_PTR Context, IN BOOLEAN NextBus)
 
VOID NTAPI HalpRegisterPciDebuggingDeviceInfo (VOID)
 
BOOLEAN NTAPI HaliTranslateBusAddress (IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
 
BOOLEAN NTAPI HaliFindBusAddressTranslation (IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress, IN OUT PULONG_PTR Context, IN BOOLEAN NextBus)
 
NTSTATUS NTAPI HalpAdjustPCIResourceList (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *pResourceList)
 
ULONG NTAPI HalpGetPCIIntOnISABus (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN ULONG BusInterruptLevel, IN ULONG BusInterruptVector, OUT PKIRQL Irql, OUT PKAFFINITY Affinity)
 
VOID NTAPI HalpPCIPin2ISALine (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN PCI_SLOT_NUMBER SlotNumber, IN PPCI_COMMON_CONFIG PciData)
 
VOID NTAPI HalpPCIISALine2Pin (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN PCI_SLOT_NUMBER SlotNumber, IN PPCI_COMMON_CONFIG PciNewData, IN PPCI_COMMON_CONFIG PciOldData)
 
NTSTATUS NTAPI HalpGetISAFixedPCIIrq (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN PCI_SLOT_NUMBER PciSlot, OUT PSUPPORTED_RANGE *Range)
 
VOID NTAPI HalpInitBusHandler (VOID)
 
PBUS_HANDLER NTAPI HalpContextToBusHandler (IN ULONG_PTR ContextValue)
 
PBUS_HANDLER FASTCALL HaliReferenceHandlerForConfigSpace (IN BUS_DATA_TYPE ConfigType, IN ULONG BusNumber)
 
ULONG NTAPI HalpNoBusData (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
 
ULONG NTAPI HalpcGetCmosData (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
 
ULONG NTAPI HalpcSetCmosData (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
 
BOOLEAN NTAPI HalpTranslateSystemBusAddress (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
 
BOOLEAN NTAPI HalpTranslateIsaBusAddress (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
 
ULONG NTAPI HalpGetSystemInterruptVector (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN ULONG BusInterruptLevel, IN ULONG BusInterruptVector, OUT PKIRQL Irql, OUT PKAFFINITY Affinity)
 

Variables

PCI_CONFIG_HANDLER PCIConfigHandler
 
PCI_CONFIG_HANDLER PCIConfigHandlerType1
 
PCI_CONFIG_HANDLER PCIConfigHandlerType2
 
ULONG HalpBusType
 
BOOLEAN HalpPCIConfigInitialized
 
BUS_HANDLER HalpFakePciBusHandler
 
ULONG HalpMinPciBus
 
ULONG HalpMaxPciBus
 
LIST_ENTRY HalpAllBusHandlers
 

Macro Definition Documentation

◆ PASTE2

#define PASTE2 (   x,
  y 
)    x ## y

Definition at line 8 of file bus.h.

◆ PCI_ADDRESS_MEMORY_SPACE

#define PCI_ADDRESS_MEMORY_SPACE   0x00000000

Definition at line 3 of file bus.h.

◆ PCI_TYPE1_ADDRESS_PORT

#define PCI_TYPE1_ADDRESS_PORT   (PULONG)0xCF8

Definition at line 164 of file bus.h.

◆ PCI_TYPE1_DATA_PORT

#define PCI_TYPE1_DATA_PORT   0xCFC

Definition at line 165 of file bus.h.

◆ PCI_TYPE2_ADDRESS_BASE

#define PCI_TYPE2_ADDRESS_BASE   0xC

Definition at line 172 of file bus.h.

◆ PCI_TYPE2_CSE_PORT

#define PCI_TYPE2_CSE_PORT   (PUCHAR)0xCF8

Definition at line 170 of file bus.h.

◆ PCI_TYPE2_FORWARD_PORT

#define PCI_TYPE2_FORWARD_PORT   (PUCHAR)0xCFA

Definition at line 171 of file bus.h.

◆ POINTER_TO_

#define POINTER_TO_ (   x)    PASTE2(P,x)

Definition at line 9 of file bus.h.

◆ READ_FROM

#define READ_FROM (   x)    PASTE2(READ_PORT_, x)

Definition at line 10 of file bus.h.

◆ TYPE1_DEFINE

#define TYPE1_DEFINE (   x)    TYPE_DEFINE(x, PPCI_TYPE1_CFG_BITS);

Definition at line 25 of file bus.h.

◆ TYPE1_END

#define TYPE1_END (   y)    return sizeof(y); }

Definition at line 37 of file bus.h.

◆ TYPE1_READ

#define TYPE1_READ (   x,
  y 
)
Value:
*((POINTER_TO_(y))Buffer) = \
READ_FROM(y)((POINTER_TO_(y))(ULONG_PTR)(BusData->Config.Type1.Data + i)); \
TYPE1_END(y)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define POINTER_TO_(x)
Definition: bus.h:9
uint32_t ULONG_PTR
Definition: typedefs.h:65
Definition: bufpool.h:45
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define TYPE1_START(x, y)
Definition: bus.h:31

Definition at line 44 of file bus.h.

◆ TYPE1_START

#define TYPE1_START (   x,
  y 
)
Value:
{ \
ULONG i = Offset % sizeof(ULONG); \
PciCfg->u.bits.RegisterNumber = Offset / sizeof(ULONG); \
WRITE_PORT_ULONG(BusData->Config.Type1.Address, PciCfg->u.AsULONG);
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define TYPE_DEFINE(x, y)
Definition: bus.h:16
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int ULONG
Definition: retypes.h:1

Definition at line 31 of file bus.h.

◆ TYPE1_WRITE

#define TYPE1_WRITE (   x,
  y 
)
Value:
WRITE_TO(y)((POINTER_TO_(y))(ULONG_PTR)(BusData->Config.Type1.Data + i), \
*((POINTER_TO_(y))Buffer)); \
TYPE1_END(y)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define POINTER_TO_(x)
Definition: bus.h:9
uint32_t ULONG_PTR
Definition: typedefs.h:65
Definition: bufpool.h:45
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define TYPE1_START(x, y)
Definition: bus.h:31

Definition at line 53 of file bus.h.

◆ TYPE2_DEFINE

#define TYPE2_DEFINE (   x)    TYPE_DEFINE(x, PPCI_TYPE2_ADDRESS_BITS);

Definition at line 26 of file bus.h.

◆ TYPE2_END

#define TYPE2_END   TYPE1_END

Definition at line 39 of file bus.h.

◆ TYPE2_READ

#define TYPE2_READ (   x,
  y 
)
Value:
*((POINTER_TO_(y))Buffer) = \
READ_FROM(y)((POINTER_TO_(y))(ULONG_PTR)PciCfg->u.AsUSHORT); \
TYPE2_END(y)
#define TYPE2_START(x, y)
Definition: bus.h:62
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define POINTER_TO_(x)
Definition: bus.h:9
uint32_t ULONG_PTR
Definition: typedefs.h:65
Definition: bufpool.h:45
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Definition at line 70 of file bus.h.

◆ TYPE2_START

#define TYPE2_START (   x,
  y 
)
Value:
{ \
PciCfg->u.bits.RegisterNumber = (USHORT)Offset;
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define TYPE_DEFINE(x, y)
Definition: bus.h:16
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
unsigned short USHORT
Definition: pedump.c:61

Definition at line 62 of file bus.h.

◆ TYPE2_WRITE

#define TYPE2_WRITE (   x,
  y 
)
Value:
WRITE_TO(y)((POINTER_TO_(y))(ULONG_PTR)PciCfg->u.AsUSHORT, \
*((POINTER_TO_(y))Buffer)); \
TYPE2_END(y)
#define TYPE2_START(x, y)
Definition: bus.h:62
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define POINTER_TO_(x)
Definition: bus.h:9
uint32_t ULONG_PTR
Definition: typedefs.h:65
Definition: bufpool.h:45
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Definition at line 79 of file bus.h.

◆ TYPE_DEFINE

#define TYPE_DEFINE (   x,
  y 
)
Value:
x( \
IN PPCIPBUSDATA BusData, \
IN y PciCfg, \
)
#define IN
Definition: typedefs.h:39
unsigned char * PUCHAR
Definition: retypes.h:3
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
Definition: bufpool.h:45
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
unsigned int ULONG
Definition: retypes.h:1

Definition at line 16 of file bus.h.

◆ WRITE_TO

#define WRITE_TO (   x)    PASTE2(WRITE_PORT_, x)

Definition at line 11 of file bus.h.

Typedef Documentation

◆ ARRAY

typedef struct _ARRAY ARRAY

◆ FncConfigIO

typedef ULONG(NTAPI * FncConfigIO) (IN PPCIPBUSDATA BusData, IN PVOID State, IN PUCHAR Buffer, IN ULONG Offset)

Definition at line 122 of file bus.h.

◆ FncReleaseSync

typedef VOID(NTAPI * FncReleaseSync) (IN PBUS_HANDLER BusHandler, IN KIRQL Irql)

Definition at line 138 of file bus.h.

◆ FncSync

typedef VOID(NTAPI * FncSync) (IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PKIRQL Irql, IN PVOID State)

Definition at line 130 of file bus.h.

◆ HAL_BUS_HANDLER

◆ PARRAY

typedef struct _ARRAY * PARRAY

◆ PCI_CONFIG_HANDLER

◆ PCI_REGISTRY_INFO_INTERNAL

◆ PCI_TYPE0_CFG_CYCLE_BITS

◆ PCI_TYPE1_CFG_BITS

◆ PCI_TYPE1_CFG_CYCLE_BITS

◆ PCI_TYPE2_ADDRESS_BITS

◆ PCI_TYPE2_CSE_BITS

◆ PciIrqRange

typedef NTSTATUS(NTAPI * PciIrqRange) (IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN PCI_SLOT_NUMBER PciSlot, OUT PSUPPORTED_RANGE *Interrupt)

Definition at line 86 of file bus.h.

◆ PCIPBUSDATA

◆ PHAL_BUS_HANDLER

◆ PPCI_CONFIG_HANDLER

◆ PPCI_REGISTRY_INFO_INTERNAL

◆ PPCI_TYPE0_CFG_CYCLE_BITS

◆ PPCI_TYPE1_CFG_BITS

◆ PPCI_TYPE1_CFG_CYCLE_BITS

◆ PPCI_TYPE2_ADDRESS_BITS

◆ PPCI_TYPE2_CSE_BITS

◆ PPCIPBUSDATA

Function Documentation

◆ HaliFindBusAddressTranslation()

BOOLEAN NTAPI HaliFindBusAddressTranslation ( IN PHYSICAL_ADDRESS  BusAddress,
IN OUT PULONG  AddressSpace,
OUT PPHYSICAL_ADDRESS  TranslatedAddress,
IN OUT PULONG_PTR  Context,
IN BOOLEAN  NextBus 
)

Definition at line 1307 of file bussupp.c.

1312 {
1313  PHAL_BUS_HANDLER BusHandler;
1315  PLIST_ENTRY NextEntry;
1316  ULONG ContextValue;
1317 
1318  /* Make sure we have a context */
1319  if (!Context) return FALSE;
1320  ASSERT((*Context) || (NextBus == TRUE));
1321 
1322  /* Read the context */
1323  ContextValue = *Context;
1324 
1325  /* Find the bus handler */
1326  Handler = HalpContextToBusHandler(ContextValue);
1327  if (!Handler) return FALSE;
1328 
1329  /* Check if this is an ongoing lookup */
1330  if (NextBus)
1331  {
1332  /* Get the HAL bus handler */
1334  NextEntry = &BusHandler->AllHandlers;
1335 
1336  /* Get the next one if we were already with one */
1337  if (ContextValue) NextEntry = NextEntry->Flink;
1338 
1339  /* Start scanning */
1340  while (TRUE)
1341  {
1342  /* Check if this is the last one */
1343  if (NextEntry == &HalpAllBusHandlers)
1344  {
1345  /* Quit */
1346  *Context = 1;
1347  return FALSE;
1348  }
1349 
1350  /* Call this translator */
1351  BusHandler = CONTAINING_RECORD(NextEntry, HAL_BUS_HANDLER, AllHandlers);
1353  BusHandler->Handler.BusNumber,
1354  BusAddress,
1355  AddressSpace,
1356  TranslatedAddress)) break;
1357 
1358  /* Try the next one */
1359  NextEntry = NextEntry->Flink;
1360  }
1361 
1362  /* If we made it, we're done */
1363  *Context = (ULONG_PTR)&BusHandler->Handler;
1364  return TRUE;
1365  }
1366 
1367  /* Try the first one through */
1368  if (!HalTranslateBusAddress(Handler->InterfaceType,
1369  Handler->BusNumber,
1370  BusAddress,
1371  AddressSpace,
1372  TranslatedAddress)) return FALSE;
1373 
1374  /* Remember for next time */
1376  return TRUE;
1377 }
_In_ ULONG _In_ PHYSICAL_ADDRESS BusAddress
Definition: iofuncs.h:2272
PBUS_HANDLER NTAPI HalpContextToBusHandler(IN ULONG_PTR ContextValue)
Definition: bushndlr.c:206
#define TRUE
Definition: types.h:120
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2272
LIST_ENTRY HalpAllBusHandlers
Definition: bushndlr.c:19
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2272
#define FALSE
Definition: types.h:117
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
ULONG BusNumber
Definition: haltypes.h:226
#define ASSERT(a)
Definition: mode.c:44
Definition: typedefs.h:119
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:668
BUS_HANDLER Handler
Definition: bus.h:274
BOOLEAN NTAPI HalTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
Definition: bussupp.c:1642
struct tagContext Context
Definition: acpixf.h:1034
INTERFACE_TYPE InterfaceType
Definition: haltypes.h:224
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
LIST_ENTRY AllHandlers
Definition: bus.h:272

Referenced by HalpInitBusHandler().

◆ HaliReferenceHandlerForConfigSpace()

PBUS_HANDLER FASTCALL HaliReferenceHandlerForConfigSpace ( IN BUS_DATA_TYPE  ConfigType,
IN ULONG  BusNumber 
)

Definition at line 197 of file bushndlr.c.

199 {
200  /* Lookup the configuration in the configuration table and add a reference */
201  return HalpLookupHandler(HalpConfigTable, ConfigType, BusNumber, TRUE);
202 }
#define TRUE
Definition: types.h:120
PARRAY HalpConfigTable
Definition: bushndlr.c:21
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
PBUS_HANDLER FASTCALL HalpLookupHandler(IN PARRAY Array, IN ULONG Type, IN ULONG Number, IN BOOLEAN AddReference)
Definition: bushndlr.c:76

Referenced by HalGetBusDataByOffset(), and HalSetBusDataByOffset().

◆ HaliTranslateBusAddress()

BOOLEAN NTAPI HaliTranslateBusAddress ( IN INTERFACE_TYPE  InterfaceType,
IN ULONG  BusNumber,
IN PHYSICAL_ADDRESS  BusAddress,
IN OUT PULONG  AddressSpace,
OUT PPHYSICAL_ADDRESS  TranslatedAddress 
)

Definition at line 1381 of file bussupp.c.

1386 {
1388  BOOLEAN Status;
1389 
1390  /* Find the handler */
1392  if (!(Handler) || !(Handler->TranslateBusAddress))
1393  {
1394  DPRINT1("No translator Interface: %x, Bus: %x, Handler: %p, BusAddress: %x!\n", InterfaceType, BusNumber, Handler, BusAddress);
1395  return FALSE;
1396  }
1397 
1398  /* Do the assignment */
1399  Status = Handler->TranslateBusAddress(Handler,
1400  Handler,
1401  BusAddress,
1402  AddressSpace,
1404 
1405  /* Dereference the handler and return */
1407  return Status;
1408 }
#define HalReferenceHandlerForBus
Definition: haltypes.h:286
_In_ ULONG _In_ PHYSICAL_ADDRESS BusAddress
Definition: iofuncs.h:2272
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2272
#define HalDereferenceBusHandler
Definition: haltypes.h:288
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2272
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
Status
Definition: gdiplustypes.h:24
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:668
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:461

Referenced by HalpInitBusHandler(), and HalTranslateBusAddress().

◆ HalpAdjustPCIResourceList()

NTSTATUS NTAPI HalpAdjustPCIResourceList ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootHandler,
IN OUT PIO_RESOURCE_REQUIREMENTS_LIST pResourceList 
)

Definition at line 669 of file pcibus.c.

672 {
673  PPCIPBUSDATA BusData;
677 
678  /* Get PCI bus data */
679  BusData = BusHandler->BusData;
680  SlotNumber.u.AsULONG = (*pResourceList)->SlotNumber;
681 
682  /* Get the IRQ supported range */
683  Status = BusData->GetIrqRange(BusHandler, RootHandler, SlotNumber, &Interrupt);
684  if (!NT_SUCCESS(Status)) return Status;
685 #ifndef _MINIHAL_
686  /* Handle the /PCILOCK feature */
688  {
689  /* /PCILOCK is not yet supported */
690  UNIMPLEMENTED_DBGBREAK("/PCILOCK boot switch is not yet supported.");
691  }
692 #endif
693  /* Now create the correct resource list based on the supported bus ranges */
694 #if 0
695  Status = HaliAdjustResourceListRange(BusHandler->BusAddresses,
696  Interrupt,
697  pResourceList);
698 #else
699  DPRINT1("HAL: No PCI Resource Adjustment done! Hardware may malfunction\n");
701 #endif
702 
703  /* Return to caller */
705  return Status;
706 }
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:65
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFINTERRUPT * Interrupt
Definition: wdfinterrupt.h:372
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN HalpPciLockSettings
Definition: halinit.c:17
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57
#define DPRINT1
Definition: precomp.h:8
#define STATUS_SUCCESS
Definition: shellext.h:65
PciIrqRange GetIrqRange
Definition: bus.h:111
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by HalpAllocateAndInitPciBusHandler().

◆ HalpAssignPCISlotResources()

NTSTATUS NTAPI HalpAssignPCISlotResources ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootHandler,
IN PUNICODE_STRING  RegistryPath,
IN PUNICODE_STRING DriverClassName  OPTIONAL,
IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT DeviceObject  OPTIONAL,
IN ULONG  Slot,
IN OUT PCM_RESOURCE_LIST pAllocatedResources 
)

Definition at line 710 of file pcibus.c.

718 {
719  PCI_COMMON_CONFIG PciConfig;
720  SIZE_T Address;
724  UCHAR Offset;
728  DPRINT1("WARNING: PCI Slot Resource Assignment is FOOBAR\n");
729 
730  /* FIXME: Should handle 64-bit addresses */
731 
732  /* Read configuration data */
733  SlotNumber.u.AsULONG = Slot;
734  HalpReadPCIConfig(BusHandler, SlotNumber, &PciConfig, 0, PCI_COMMON_HDR_LENGTH);
735 
736  /* Check if we read it correctly */
737  if (PciConfig.VendorID == PCI_INVALID_VENDORID)
738  return STATUS_NO_SUCH_DEVICE;
739 
740  /* Read the PCI configuration space for the device and store base address and
741  size information in temporary storage. Count the number of valid base addresses */
742  ResourceCount = 0;
744  {
745  if (0xffffffff == PciConfig.u.type0.BaseAddresses[Address])
746  PciConfig.u.type0.BaseAddresses[Address] = 0;
747 
748  /* Memory resource */
749  if (0 != PciConfig.u.type0.BaseAddresses[Address])
750  {
751  ResourceCount++;
752 
753  Offset = (UCHAR)FIELD_OFFSET(PCI_COMMON_CONFIG, u.type0.BaseAddresses[Address]);
754 
755  /* Write 0xFFFFFFFF there */
756  WriteBuffer = 0xffffffff;
757  HalpWritePCIConfig(BusHandler, SlotNumber, &WriteBuffer, Offset, sizeof(ULONG));
758 
759  /* Read that figure back from the config space */
760  HalpReadPCIConfig(BusHandler, SlotNumber, &Size[Address], Offset, sizeof(ULONG));
761 
762  /* Write back initial value */
763  HalpWritePCIConfig(BusHandler, SlotNumber, &PciConfig.u.type0.BaseAddresses[Address], Offset, sizeof(ULONG));
764  }
765  }
766 
767  /* Interrupt resource */
768  if (0 != PciConfig.u.type0.InterruptPin &&
769  0 != PciConfig.u.type0.InterruptLine &&
770  0xFF != PciConfig.u.type0.InterruptLine)
771  ResourceCount++;
772 
773  /* Allocate output buffer and initialize */
775  PagedPool,
776  sizeof(CM_RESOURCE_LIST) +
778  TAG_HAL);
779 
780  if (NULL == *AllocatedResources)
781  return STATUS_NO_MEMORY;
782 
783  (*AllocatedResources)->Count = 1;
784  (*AllocatedResources)->List[0].InterfaceType = PCIBus;
785  (*AllocatedResources)->List[0].BusNumber = BusHandler->BusNumber;
786  (*AllocatedResources)->List[0].PartialResourceList.Version = 1;
787  (*AllocatedResources)->List[0].PartialResourceList.Revision = 1;
788  (*AllocatedResources)->List[0].PartialResourceList.Count = ResourceCount;
789  Descriptor = (*AllocatedResources)->List[0].PartialResourceList.PartialDescriptors;
790 
791  /* Store configuration information */
793  {
794  if (0 != PciConfig.u.type0.BaseAddresses[Address])
795  {
797  (PciConfig.u.type0.BaseAddresses[Address] & 0x1))
798  {
800  Descriptor->ShareDisposition = CmResourceShareDeviceExclusive; /* FIXME I have no idea... */
801  Descriptor->Flags = CM_RESOURCE_MEMORY_READ_WRITE; /* FIXME Just a guess */
802  Descriptor->u.Memory.Start.QuadPart = (PciConfig.u.type0.BaseAddresses[Address] & PCI_ADDRESS_MEMORY_ADDRESS_MASK);
804  }
805  else if (PCI_ADDRESS_IO_SPACE ==
806  (PciConfig.u.type0.BaseAddresses[Address] & 0x1))
807  {
809  Descriptor->ShareDisposition = CmResourceShareDeviceExclusive; /* FIXME I have no idea... */
810  Descriptor->Flags = CM_RESOURCE_PORT_IO; /* FIXME Just a guess */
811  Descriptor->u.Port.Start.QuadPart = PciConfig.u.type0.BaseAddresses[Address] &= PCI_ADDRESS_IO_ADDRESS_MASK;
812  Descriptor->u.Port.Length = PciSize(Size[Address], PCI_ADDRESS_IO_ADDRESS_MASK & 0xffff);
813  }
814  else
815  {
816  ASSERT(FALSE);
817  return STATUS_UNSUCCESSFUL;
818  }
819  Descriptor++;
820  }
821  }
822 
823  if (0 != PciConfig.u.type0.InterruptPin &&
824  0 != PciConfig.u.type0.InterruptLine &&
825  0xFF != PciConfig.u.type0.InterruptLine)
826  {
828  Descriptor->ShareDisposition = CmResourceShareShared; /* FIXME Just a guess */
829  Descriptor->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE; /* FIXME Just a guess */
830  Descriptor->u.Interrupt.Level = PciConfig.u.type0.InterruptLine;
831  Descriptor->u.Interrupt.Vector = PciConfig.u.type0.InterruptLine;
832  Descriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
833 
834  Descriptor++;
835  }
836 
837  ASSERT(Descriptor == (*AllocatedResources)->List[0].PartialResourceList.PartialDescriptors + ResourceCount);
838 
839  /* FIXME: Should store the resources in the registry resource map */
840 
841  return Status;
842 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:65
#define PCI_TYPE0_ADDRESSES
Definition: iotypes.h:3500
#define PCI_ADDRESS_IO_ADDRESS_MASK
Definition: iotypes.h:4233
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PCM_RESOURCE_LIST * AllocatedResources
Definition: ndis.h:4640
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
LONG NTSTATUS
Definition: precomp.h:26
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define CM_RESOURCE_MEMORY_READ_WRITE
Definition: cmtypes.h:120
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define FALSE
Definition: types.h:117
#define PCI_ADDRESS_MEMORY_ADDRESS_MASK
Definition: iotypes.h:4234
static WCHAR Address[46]
Definition: ping.c:68
Status
Definition: gdiplustypes.h:24
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3601
#define ASSERT(a)
Definition: mode.c:44
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
static ULONG ResourceCount
Definition: inbv.c:92
unsigned char UCHAR
Definition: xmlstorage.h:181
#define TAG_HAL
Definition: hal.h:61
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
VOID NTAPI HalpWritePCIConfig(IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: pcibus.c:285
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NULL
Definition: types.h:112
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE
Definition: cmtypes.h:143
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define DPRINT1
Definition: precomp.h:8
#define PCI_ADDRESS_MEMORY_SPACE
Definition: bus.h:3
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI HalpReadPCIConfig(IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: pcibus.c:259
#define STATUS_SUCCESS
Definition: shellext.h:65
static ULONG NTAPI PciSize(ULONG Base, ULONG Mask)
Definition: pcibus.c:660
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
#define PCI_ADDRESS_IO_SPACE
Definition: iotypes.h:4230
#define WriteBuffer(BaseIoAddress, Buffer, Count)
Definition: atapi.h:344
#define PCI_COMMON_HDR_LENGTH
Definition: iotypes.h:3594

Referenced by HalpAllocateAndInitPciBusHandler(), and HalpAssignSlotResources().

◆ HalpAssignSlotResources()

NTSTATUS NTAPI HalpAssignSlotResources ( IN PUNICODE_STRING  RegistryPath,
IN PUNICODE_STRING  DriverClassName,
IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT  DeviceObject,
IN INTERFACE_TYPE  BusType,
IN ULONG  BusNumber,
IN ULONG  SlotNumber,
IN OUT PCM_RESOURCE_LIST AllocatedResources 
)

Definition at line 45 of file busemul.c.

53 {
54  BUS_HANDLER BusHandler;
55  PAGED_CODE();
56 
57  /* Only PCI is supported */
58  if (BusType != PCIBus) return STATUS_NOT_IMPLEMENTED;
59 
60  /* Setup fake PCI Bus handler */
61  RtlCopyMemory(&BusHandler, &HalpFakePciBusHandler, sizeof(BUS_HANDLER));
62  BusHandler.BusNumber = BusNumber;
63 
64  /* Call the PCI function */
65  return HalpAssignPCISlotResources(&BusHandler,
66  &BusHandler,
71  SlotNumber,
73 }
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:65
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PCM_RESOURCE_LIST * AllocatedResources
Definition: ndis.h:4640
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE BusType
Definition: halfuncs.h:156
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
_In_opt_ PUNICODE_STRING DriverClassName
Definition: halfuncs.h:156
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
return STATUS_NOT_IMPLEMENTED
NTSTATUS NTAPI HalpAssignPCISlotResources(IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN PUNICODE_STRING RegistryPath, IN PUNICODE_STRING DriverClassName OPTIONAL, IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN ULONG Slot, IN OUT PCM_RESOURCE_LIST *pAllocatedResources)
Definition: pcibus.c:710
BUS_HANDLER HalpFakePciBusHandler
Definition: pcibus.c:96
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
ULONG BusNumber
Definition: haltypes.h:226
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define PAGED_CODE()

Referenced by HalAssignSlotResources(), HalpInitBusHandler(), and HalpInitNonBusHandler().

◆ HalpcGetCmosData()

ULONG NTAPI HalpcGetCmosData ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootHandler,
IN ULONG  SlotNumber,
IN PVOID  Buffer,
IN ULONG  Offset,
IN ULONG  Length 
)

Definition at line 21 of file cmosbus.c.

27 {
28  UNIMPLEMENTED_DBGBREAK("CMOS GetData\n");
29  return 0;
30 }
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57

Referenced by HalpRegisterInternalBusHandlers().

◆ HalpContextToBusHandler()

PBUS_HANDLER NTAPI HalpContextToBusHandler ( IN ULONG_PTR  ContextValue)

Definition at line 206 of file bushndlr.c.

207 {
208  PLIST_ENTRY NextEntry;
209  PHAL_BUS_HANDLER BusHandler, ThisHandler;
210 
211  /* Start lookup */
212  NextEntry = HalpAllBusHandlers.Flink;
213  ThisHandler = CONTAINING_RECORD(NextEntry, HAL_BUS_HANDLER, AllHandlers);
214  if (ContextValue)
215  {
216  /* If the list is empty, quit */
217  if (IsListEmpty(&HalpAllBusHandlers)) return NULL;
218 
219  /* Otherwise, scan the list */
220  BusHandler = CONTAINING_RECORD(ContextValue, HAL_BUS_HANDLER, Handler);
221  do
222  {
223  /* Check if we've reached the right one */
224  ThisHandler = CONTAINING_RECORD(NextEntry, HAL_BUS_HANDLER, AllHandlers);
225  if (ThisHandler == BusHandler) break;
226 
227  /* Try the next one */
228  NextEntry = NextEntry->Flink;
229  } while (NextEntry != &HalpAllBusHandlers);
230  }
231 
232  /* If we looped back to the end, we didn't find anything */
233  if (NextEntry == &HalpAllBusHandlers) return NULL;
234 
235  /* Otherwise return the handler */
236  return &ThisHandler->Handler;
237 }
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: typedefs.h:119
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:668
BUS_HANDLER Handler
Definition: bus.h:274
LIST_ENTRY HalpAllBusHandlers
Definition: bushndlr.c:19
#define NULL
Definition: types.h:112

Referenced by HaliFindBusAddressTranslation().

◆ HalpcSetCmosData()

ULONG NTAPI HalpcSetCmosData ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootHandler,
IN ULONG  SlotNumber,
IN PVOID  Buffer,
IN ULONG  Offset,
IN ULONG  Length 
)

Definition at line 34 of file cmosbus.c.

40 {
41  UNIMPLEMENTED_DBGBREAK("CMOS SetData\n");
42  return 0;
43 }
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57

Referenced by HalpRegisterInternalBusHandlers().

◆ HalpFindBusAddressTranslation()

BOOLEAN NTAPI HalpFindBusAddressTranslation ( IN PHYSICAL_ADDRESS  BusAddress,
IN OUT PULONG  AddressSpace,
OUT PPHYSICAL_ADDRESS  TranslatedAddress,
IN OUT PULONG_PTR  Context,
IN BOOLEAN  NextBus 
)

Definition at line 90 of file busemul.c.

95 {
96  /* Make sure we have a context */
97  if (!Context) return FALSE;
98 
99  /* If we have data in the context, then this shouldn't be a new lookup */
100  if ((*Context != 0) && (NextBus != FALSE)) return FALSE;
101 
102  /* Return bus data */
104 
105  /* Set context value and return success */
106  *Context = 1;
107  return TRUE;
108 }
_In_ ULONG _In_ PHYSICAL_ADDRESS BusAddress
Definition: iofuncs.h:2272
#define TRUE
Definition: types.h:120
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2272
#define FALSE
Definition: types.h:117
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by HalpInitNonBusHandler().

◆ HalpGetCmosData()

ULONG NTAPI HalpGetCmosData ( _In_ ULONG  BusNumber,
_In_ ULONG  SlotNumber,
_Out_writes_bytes_(Length) PVOID  Buffer,
_In_ ULONG  Length 
)

Definition at line 49 of file cmos.c.

54 {
57  ULONG Len = Length;
58 
59  /* Do nothing if we don't have a length */
60  if (!Length) return 0;
61 
62  /* Acquire CMOS Lock */
64 
65  /* Check if this is simple CMOS */
66  if (BusNumber == 0)
67  {
68  /* Loop the buffer up to 0xFF */
69  while ((Len > 0) && (Address < 0x100))
70  {
71  /* Read the data */
73 
74  /* Update position and length */
75  Ptr++;
76  Address++;
77  Len--;
78  }
79  }
80  else if (BusNumber == 1)
81  {
82  /* Loop the buffer up to 0xFFFF */
83  while ((Len > 0) && (Address < 0x10000))
84  {
85  /* Write the data */
87 
88  /* Update position and length */
89  Ptr++;
90  Address++;
91  Len--;
92  }
93  }
94 
95  /* Release CMOS Lock */
97 
98  /* Return length read */
99  return Length - Len;
100 }
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:65
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
unsigned char * PUCHAR
Definition: retypes.h:3
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
VOID NTAPI HalpReleaseCmosSpinLock(VOID)
Definition: spinlock.c:229
static WCHAR Address[46]
Definition: ping.c:68
Definition: bufpool.h:45
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
#define Len
Definition: deflate.h:82
VOID NTAPI HalpAcquireCmosSpinLock(VOID)
Definition: spinlock.c:212
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR NTAPI HalpReadCmos(_In_ UCHAR Reg)
Definition: cmos.c:123
unsigned int ULONG
Definition: retypes.h:1

Referenced by HalGetBusDataByOffset().

◆ HalpGetISAFixedPCIIrq()

NTSTATUS NTAPI HalpGetISAFixedPCIIrq ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootHandler,
IN PCI_SLOT_NUMBER  PciSlot,
OUT PSUPPORTED_RANGE Range 
)

Definition at line 567 of file pcibus.c.

571 {
572  PCI_COMMON_HEADER PciData;
573 
574  /* Read PCI configuration data */
576  BusHandler->BusNumber,
577  PciSlot.u.AsULONG,
578  &PciData,
580 
581  /* Make sure it's a real device */
582  if (PciData.VendorID == PCI_INVALID_VENDORID) return STATUS_UNSUCCESSFUL;
583 
584  /* Allocate the supported range structure */
586  if (!*Range) return STATUS_INSUFFICIENT_RESOURCES;
587 
588  /* Set it up */
590  (*Range)->Base = 1;
591 
592  /* If the PCI device has no IRQ, nothing to do */
593  if (!PciData.u.type0.InterruptPin) return STATUS_SUCCESS;
594 
595  /* FIXME: The PCI IRQ Routing Miniport should be called */
596 
597  /* Also if the INT# seems bogus, nothing to do either */
598  if ((PciData.u.type0.InterruptLine == 0) ||
599  (PciData.u.type0.InterruptLine == 255))
600  {
601  /* Fake success */
602  return STATUS_SUCCESS;
603  }
604 
605  /* Otherwise, the INT# should be valid, return it to the caller */
606  (*Range)->Base = PciData.u.type0.InterruptLine;
607  (*Range)->Limit = PciData.u.type0.InterruptLine;
608  return STATUS_SUCCESS;
609 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3601
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define TAG_HAL
Definition: hal.h:61
Definition: range.c:39
NTHALAPI ULONG NTAPI HalGetBusData(BUS_DATA_TYPE, ULONG, ULONG, PVOID, ULONG)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_SUCCESS
Definition: shellext.h:65
#define PCI_COMMON_HDR_LENGTH
Definition: iotypes.h:3594

Referenced by HalpAllocateAndInitPciBusHandler().

◆ HalpGetPCIData()

ULONG NTAPI HalpGetPCIData ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootBusHandler,
IN ULONG  SlotNumber,
IN PVOID  Buffer,
IN ULONG  Offset,
IN ULONG  Length 
)

Definition at line 369 of file pcibus.c.

375 {
376  PCI_SLOT_NUMBER Slot;
377  UCHAR PciBuffer[PCI_COMMON_HDR_LENGTH];
378  PPCI_COMMON_CONFIG PciConfig = (PPCI_COMMON_CONFIG)PciBuffer;
379  ULONG Len = 0;
380 
381  Slot.u.AsULONG = SlotNumber;
382 #ifdef SARCH_XBOX
383  if (HalpXboxBlacklistedPCISlot(BusHandler, Slot))
384  {
385  if (Offset == 0 && Length >= sizeof(USHORT))
386  {
388  return sizeof(USHORT);
389  }
390  return 0;
391  }
392 #endif
393 
394  /* Normalize the length */
395  if (Length > sizeof(PCI_COMMON_CONFIG)) Length = sizeof(PCI_COMMON_CONFIG);
396 
397  /* Check if this is a vendor-specific read */
399  {
400  /* Read the header */
401  HalpReadPCIConfig(BusHandler, Slot, PciConfig, 0, sizeof(ULONG));
402 
403  /* Make sure the vendor is valid */
404  if (PciConfig->VendorID == PCI_INVALID_VENDORID) return 0;
405  }
406  else
407  {
408  /* Read the entire header */
410  HalpReadPCIConfig(BusHandler, Slot, PciConfig, 0, Len);
411 
412  /* Validate the vendor ID */
413  if (PciConfig->VendorID == PCI_INVALID_VENDORID)
414  {
415  /* It's invalid, but we want to return this much */
416  Len = sizeof(USHORT);
417  }
418 
419  /* Now check if there's space left */
420  if (Len < Offset) return 0;
421 
422  /* There is, so return what's after the offset and normalize */
423  Len -= Offset;
424  if (Len > Length) Len = Length;
425 
426  /* Copy the data into the caller's buffer */
427  RtlMoveMemory(Buffer, PciBuffer + Offset, Len);
428 
429  /* Update buffer and offset, decrement total length */
430  Offset += Len;
431  Buffer = (PVOID)((ULONG_PTR)Buffer + Len);
432  Length -= Len;
433  }
434 
435  /* Now we still have something to copy */
436  if (Length)
437  {
438  /* Check if it's vendor-specific data */
440  {
441  /* Read it now */
442  HalpReadPCIConfig(BusHandler, Slot, Buffer, Offset, Length);
443  Len += Length;
444  }
445  }
446 
447  /* Update the total length read */
448  return Len;
449 }
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:65
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct _PCI_COMMON_CONFIG * PPCI_COMMON_CONFIG
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
uint32_t ULONG_PTR
Definition: typedefs.h:65
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3601
#define Len
Definition: deflate.h:82
unsigned char UCHAR
Definition: xmlstorage.h:181
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI HalpReadPCIConfig(IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: pcibus.c:259
union _PCI_SLOT_NUMBER::@3773 u
unsigned short * PUSHORT
Definition: retypes.h:2
#define PCI_COMMON_HDR_LENGTH
Definition: iotypes.h:3594

Referenced by HalGetBusDataByOffset(), and HalpAllocateAndInitPciBusHandler().

◆ HalpGetPCIIntOnISABus()

ULONG NTAPI HalpGetPCIIntOnISABus ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootHandler,
IN ULONG  BusInterruptLevel,
IN ULONG  BusInterruptVector,
OUT PKIRQL  Irql,
OUT PKAFFINITY  Affinity 
)

Definition at line 523 of file pcibus.c.

529 {
530  /* Validate the level first */
531  if (BusInterruptLevel < 1) return 0;
532 
533  /* PCI has its IRQs on top of ISA IRQs, so pass it on to the ISA handler */
534  return HalGetInterruptVector(Isa,
535  0,
537  0,
538  Irql,
539  Affinity);
540 }
_In_ ULONG _In_ ULONG BusInterruptLevel
Definition: halfuncs.h:170
_Out_ PKIRQL Irql
Definition: csq.h:179
NTHALAPI ULONG NTAPI HalGetInterruptVector(INTERFACE_TYPE, ULONG, ULONG, ULONG, PKIRQL, PKAFFINITY)
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:170

Referenced by HalpAllocateAndInitPciBusHandler().

◆ HalpGetRootInterruptVector()

ULONG NTAPI HalpGetRootInterruptVector ( _In_ ULONG  BusInterruptLevel,
_In_ ULONG  BusInterruptVector,
_Out_ PKIRQL  Irql,
_Out_ PKAFFINITY  Affinity 
)

Definition at line 365 of file apic.c.

370 {
371  UCHAR Vector;
372  KIRQL Irql;
373 
374  /* Get the vector currently registered */
376 
377  /* Check if it's used */
378  if (Vector != APIC_FREE_VECTOR)
379  {
380  /* Calculate IRQL */
382  *OutIrql = HalpVectorToIrql(Vector);
383  }
384  else
385  {
386  ULONG Offset;
387 
388  /* Outer loop to find alternative slots, when all IRQLs are in use */
389  for (Offset = 0; Offset < 15; Offset++)
390  {
391  /* Loop allowed IRQL range */
392  for (Irql = CLOCK_LEVEL - 1; Irql >= CMCI_LEVEL; Irql--)
393  {
394  /* Calculate the vactor */
396 
397  /* Check if the vector is free */
399  {
400  /* Found one, allocate the interrupt */
402  *OutIrql = Irql;
403  goto Exit;
404  }
405  }
406  }
407 
408  DPRINT1("Failed to get an interrupt vector for IRQ %lu\n", BusInterruptLevel);
409  *OutAffinity = 0;
410  *OutIrql = 0;
411  return 0;
412  }
413 
414 Exit:
415 
416  *OutAffinity = HalpDefaultInterruptAffinity;
418 
419  return Vector;
420 }
UCHAR FASTCALL HalpVectorToIrq(UCHAR Vector)
Definition: apic.c:242
_In_ ULONG _In_ ULONG BusInterruptLevel
Definition: halfuncs.h:170
KAFFINITY HalpDefaultInterruptAffinity
Definition: processor.c:18
_Out_ PKIRQL Irql
Definition: csq.h:179
#define CMCI_LEVEL
UCHAR KIRQL
Definition: env_spec_w32.h:591
UCHAR FASTCALL HalpIrqToVector(UCHAR Irq)
Definition: apic.c:222
#define CLOCK_LEVEL
KIRQL FASTCALL HalpVectorToIrql(UCHAR Vector)
Definition: apic.c:235
UCHAR NTAPI HalpAllocateSystemInterrupt(_In_ UCHAR Irq, _In_ UCHAR Vector)
Definition: apic.c:333
UCHAR HalpVectorToIndex[256]
Definition: apic.c:28
#define ASSERT(a)
Definition: mode.c:44
#define APIC_FREE_VECTOR
Definition: apicp.h:59
static void Exit(void)
Definition: sock.c:1331
unsigned char UCHAR
Definition: xmlstorage.h:181
#define IrqlToTpr(Irql)
Definition: apicp.h:53
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG Vector
Definition: iofuncs.h:800
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define NT_ASSERT
Definition: rtlfuncs.h:3310

Referenced by HalGetInterruptVector(), and HalpGetSystemInterruptVector().

◆ HalpGetSystemInterruptVector()

ULONG NTAPI HalpGetSystemInterruptVector ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootHandler,
IN ULONG  BusInterruptLevel,
IN ULONG  BusInterruptVector,
OUT PKIRQL  Irql,
OUT PKAFFINITY  Affinity 
)

Definition at line 115 of file sysbus.c.

121 {
122  ULONG Vector;
123 
124  /* Get the root vector */
127  Irql,
128  Affinity);
129 
130  /* Check if the vector is owned by the HAL and fail if it is */
131  if (HalpIDTUsageFlags[Vector].Flags & IDT_REGISTERED) DPRINT1("Vector %lx is ALREADY IN USE!\n", Vector);
133 }
_In_ ULONG _In_ ULONG BusInterruptLevel
Definition: halfuncs.h:170
IDTUsageFlags HalpIDTUsageFlags[256]
Definition: usage.c:19
_In_ ULONG _In_ ULONG _In_ ULONG BusInterruptVector
Definition: halfuncs.h:170
_Out_ PKIRQL Irql
Definition: csq.h:179
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define IDT_REGISTERED
Definition: halp.h:19
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:170
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG Vector
Definition: iofuncs.h:800
ULONG NTAPI HalpGetRootInterruptVector(_In_ ULONG BusInterruptLevel, _In_ ULONG BusInterruptVector, _Out_ PKIRQL OutIrql, _Out_ PKAFFINITY OutAffinity)
Definition: apic.c:365
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1

Referenced by HalpRegisterInternalBusHandlers().

◆ HalpInitBusHandler()

VOID NTAPI HalpInitBusHandler ( VOID  )

Definition at line 420 of file bushndlr.c.

421 {
422  /* Setup the bus lock */
424 
425  /* Setup the bus event */
427 
428  /* Setup the bus configuration and bus table */
431 
432  /* Setup the bus list */
434 
435  /* Setup the HAL Dispatch routines */
436 #ifndef _MINIHAL_
443 #endif
445  HalPciTranslateBusAddress = HaliTranslateBusAddress; /* PCI Driver can override */
447 }
#define HalReferenceHandlerForBus
Definition: haltypes.h:286
#define HalRegisterBusHandler
Definition: halfuncs.h:38
#define HalPciTranslateBusAddress
Definition: halfuncs.h:41
#define TRUE
Definition: types.h:120
PARRAY NTAPI HalpAllocateArray(IN ULONG ArraySize)
Definition: bushndlr.c:27
PARRAY HalpConfigTable
Definition: bushndlr.c:21
#define HalDereferenceBusHandler
Definition: haltypes.h:288
PBUS_HANDLER FASTCALL HaliHandlerForBus(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber)
Definition: bushndlr.c:170
BOOLEAN NTAPI HaliFindBusAddressTranslation(IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress, IN OUT PULONG_PTR Context, IN BOOLEAN NextBus)
Definition: bussupp.c:1307
PBUS_HANDLER FASTCALL HaliHandlerForConfigSpace(IN BUS_DATA_TYPE ConfigType, IN ULONG BusNumber)
Definition: bushndlr.c:179
BOOLEAN NTAPI HaliTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
Definition: bussupp.c:1381
VOID FASTCALL HaliDereferenceBusHandler(IN PBUS_HANDLER Handler)
Definition: bushndlr.c:158
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
PARRAY HalpBusTable
Definition: bushndlr.c:20
NTSTATUS NTAPI HaliRegisterBusHandler(IN INTERFACE_TYPE InterfaceType, IN BUS_DATA_TYPE ConfigType, IN ULONG BusNumber, IN INTERFACE_TYPE ParentBusType, IN ULONG ParentBusNumber, IN ULONG ExtraData, IN PINSTALL_BUS_HANDLER InstallCallback, OUT PBUS_HANDLER *ReturnedBusHandler)
Definition: bushndlr.c:242
#define HalHandlerForConfigSpace
Definition: halfuncs.h:36
NTSTATUS NTAPI HalpAssignSlotResources(IN PUNICODE_STRING RegistryPath, IN PUNICODE_STRING DriverClassName, IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT DeviceObject, IN INTERFACE_TYPE BusType, IN ULONG BusNumber, IN ULONG SlotNumber, IN OUT PCM_RESOURCE_LIST *AllocatedResources)
Definition: busemul.c:45
KSPIN_LOCK HalpBusDatabaseSpinLock
Definition: bushndlr.c:17
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define HalFindBusAddressTranslation
Definition: halfuncs.h:44
LIST_ENTRY HalpAllBusHandlers
Definition: bushndlr.c:19
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
KEVENT HalpBusDatabaseEvent
Definition: bushndlr.c:18
VOID FASTCALL HaliReferenceBusHandler(IN PBUS_HANDLER Handler)
Definition: bushndlr.c:147
PBUS_HANDLER FASTCALL HaliReferenceHandlerForBus(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber)
Definition: bushndlr.c:188
#define HalPciAssignSlotResources
Definition: halfuncs.h:42
#define HalHandlerForBus
Definition: halfuncs.h:35
#define HalReferenceBusHandler
Definition: haltypes.h:287

Referenced by HalpRegisterInternalBusHandlers(), and LoadBootDeviceDriver().

◆ HalpInitializePciBus()

VOID NTAPI HalpInitializePciBus ( VOID  )

Definition at line 913 of file halacpi.c.

914 {
915  /* Setup the PCI stub support */
917 
918  /* Set the NMI crash flag */
920 }
VOID NTAPI HalpGetNMICrashFlag(VOID)
Definition: usage.c:587
VOID NTAPI HalpInitializePciStubs(VOID)
Definition: pcibus.c:1102

Referenced by HalReportResourceUsage().

◆ HalpInitializePciStubs()

VOID NTAPI HalpInitializePciStubs ( VOID  )

Definition at line 1102 of file pcibus.c.

1103 {
1104  PPCI_REGISTRY_INFO_INTERNAL PciRegistryInfo;
1105  UCHAR PciType;
1107  ULONG i;
1109  ULONG VendorId = 0;
1110  ULONG MaxPciBusNumber;
1111 
1112  /* Query registry information */
1113  PciRegistryInfo = HalpQueryPciRegistryInfo();
1114  if (!PciRegistryInfo)
1115  {
1116  /* Assume type 1 */
1117  PciType = 1;
1118 
1119  /* Force a manual bus scan later */
1120  MaxPciBusNumber = MAXULONG;
1121  }
1122  else
1123  {
1124  /* Get the PCI type */
1125  PciType = PciRegistryInfo->HardwareMechanism & 0xF;
1126 
1127  /* Get MaxPciBusNumber and make it 0-based */
1128  MaxPciBusNumber = PciRegistryInfo->NoBuses - 1;
1129 
1130  /* Free the info structure */
1131  ExFreePoolWithTag(PciRegistryInfo, TAG_HAL);
1132  }
1133 
1134  /* Initialize the PCI lock */
1136 
1137  /* Check the type of PCI bus */
1138  switch (PciType)
1139  {
1140  /* Type 1 PCI Bus */
1141  case 1:
1142 
1143  /* Copy the Type 1 handler data */
1146  sizeof(PCIConfigHandler));
1147 
1148  /* Set correct I/O Ports */
1149  BusData->Config.Type1.Address = PCI_TYPE1_ADDRESS_PORT;
1150  BusData->Config.Type1.Data = PCI_TYPE1_DATA_PORT;
1151  break;
1152 
1153  /* Type 2 PCI Bus */
1154  case 2:
1155 
1156  /* Copy the Type 2 handler data */
1159  sizeof (PCIConfigHandler));
1160 
1161  /* Set correct I/O Ports */
1162  BusData->Config.Type2.CSE = PCI_TYPE2_CSE_PORT;
1163  BusData->Config.Type2.Forward = PCI_TYPE2_FORWARD_PORT;
1164  BusData->Config.Type2.Base = PCI_TYPE2_ADDRESS_BASE;
1165 
1166  /* Only 16 devices supported, not 32 */
1167  BusData->MaxDevice = 16;
1168  break;
1169 
1170  default:
1171 
1172  /* Invalid type */
1173  DbgPrint("HAL: Unknown PCI type\n");
1174  }
1175 
1176  /* Run a forced bus scan if needed */
1177  if (MaxPciBusNumber == MAXULONG)
1178  {
1179  /* Initialize the max bus number to 0xFF */
1180  HalpMaxPciBus = 0xFF;
1181 
1182  /* Initialize the counter */
1183  MaxPciBusNumber = 0;
1184 
1185  /* Loop all possible buses */
1186  for (i = 0; i < HalpMaxPciBus; i++)
1187  {
1188  /* Loop all devices */
1189  for (j.u.AsULONG = 0; j.u.AsULONG < BusData->MaxDevice; j.u.AsULONG++)
1190  {
1191  /* Query the interface */
1193  i,
1194  j,
1195  &VendorId,
1196  0,
1197  sizeof(ULONG)))
1198  {
1199  /* Validate the vendor ID */
1200  if ((VendorId & 0xFFFF) != PCI_INVALID_VENDORID)
1201  {
1202  /* Set this as the maximum ID */
1203  MaxPciBusNumber = i;
1204  break;
1205  }
1206  }
1207  }
1208  }
1209  }
1210 
1211  /* Set the real max bus number */
1212  HalpMaxPciBus = MaxPciBusNumber;
1213 
1214  /* We're done */
1216 }
ULONG MaxDevice
Definition: bus.h:110
#define DbgPrint
Definition: hal.h:12
#define TRUE
Definition: types.h:120
union _PCIPBUSDATA::@1427 Config
struct _PCIPBUSDATA::@1427::@1428 Type1
#define PCI_TYPE2_CSE_PORT
Definition: bus.h:170
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define PCI_TYPE1_ADDRESS_PORT
Definition: hardware.h:33
struct _PCIPBUSDATA * PPCIPBUSDATA
PCI_CONFIG_HANDLER PCIConfigHandler
Definition: pcibus.c:25
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3601
KSPIN_LOCK HalpPCIConfigLock
Definition: pcibus.c:24
unsigned char UCHAR
Definition: xmlstorage.h:181
#define TAG_HAL
Definition: hal.h:61
PCI_CONFIG_HANDLER PCIConfigHandlerType2
Definition: pcibus.c:59
BUS_HANDLER HalpFakePciBusHandler
Definition: pcibus.c:96
struct _PCIPBUSDATA::@1427::@1429 Type2
#define MAXULONG
Definition: typedefs.h:251
#define PCI_TYPE2_FORWARD_PORT
Definition: bus.h:171
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PCI_CONFIG_HANDLER PCIConfigHandlerType1
Definition: pcibus.c:37
#define NULL
Definition: types.h:112
#define PCI_TYPE2_ADDRESS_BASE
Definition: bus.h:172
BOOLEAN HalpPCIConfigInitialized
Definition: pcibus.c:22
#define PCI_TYPE1_DATA_PORT
Definition: hardware.h:34
unsigned int ULONG
Definition: retypes.h:1
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
ULONG NTAPI HaliPciInterfaceReadConfig(IN PBUS_HANDLER RootBusHandler, IN ULONG BusNumber, IN PCI_SLOT_NUMBER SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: pcibus.c:846
PPCI_REGISTRY_INFO_INTERNAL NTAPI HalpQueryPciRegistryInfo(VOID)
Definition: pcibus.c:869
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
PVOID BusData
Definition: haltypes.h:229
ULONG HalpMaxPciBus
Definition: pcibus.c:23

Referenced by HalpInitializePciBus(), HalReportResourceUsage(), and LoadBootDeviceDriver().

◆ HalpNoBusData()

ULONG NTAPI HalpNoBusData ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootHandler,
IN ULONG  SlotNumber,
IN PVOID  Buffer,
IN ULONG  Offset,
IN ULONG  Length 
)

Definition at line 108 of file bushndlr.c.

114 {
115  /* Not implemented */
116  DPRINT1("STUB GetSetBusData\n");
117  return 0;
118 }
#define DPRINT1
Definition: precomp.h:8

Referenced by HaliRegisterBusHandler(), and HalpRegisterInternalBusHandlers().

◆ HalpPCIISALine2Pin()

VOID NTAPI HalpPCIISALine2Pin ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootHandler,
IN PCI_SLOT_NUMBER  SlotNumber,
IN PPCI_COMMON_CONFIG  PciNewData,
IN PPCI_COMMON_CONFIG  PciOldData 
)

Definition at line 555 of file pcibus.c.

560 {
562 }
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57

Referenced by HalpAllocateAndInitPciBusHandler().

◆ HalpPCIPin2ISALine()

VOID NTAPI HalpPCIPin2ISALine ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootHandler,
IN PCI_SLOT_NUMBER  SlotNumber,
IN PPCI_COMMON_CONFIG  PciData 
)

Definition at line 545 of file pcibus.c.

549 {
551 }
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57

Referenced by HalpAllocateAndInitPciBusHandler().

◆ HalpPCIReleaseSynchronizationType2()

VOID NTAPI HalpPCIReleaseSynchronizationType2 ( IN PBUS_HANDLER  BusHandler,
IN KIRQL  Irql 
)

Definition at line 195 of file pcibus.c.

197 {
198  PCI_TYPE2_CSE_BITS PciCfg2Cse;
199  PPCIPBUSDATA BusData = (PPCIPBUSDATA)BusHandler->BusData;
200 
201  /* Clear CSE and bus number */
202  PciCfg2Cse.u.AsUCHAR = 0;
203  WRITE_PORT_UCHAR(BusData->Config.Type2.CSE, PciCfg2Cse.u.AsUCHAR);
204  WRITE_PORT_UCHAR(BusData->Config.Type2.Forward, 0);
205 
206  /* Release the lock */
208 }
union _PCIPBUSDATA::@1427 Config
union _PCI_TYPE2_CSE_BITS::@1432 u
KIRQL OldIrql
Definition: mm.h:1502
struct _PCIPBUSDATA * PPCIPBUSDATA
KSPIN_LOCK HalpPCIConfigLock
Definition: pcibus.c:24
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
struct _PCIPBUSDATA::@1427::@1429 Type2
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
UCHAR AsUCHAR
Definition: bus.h:210

◆ HalpPCIReleaseSynchronzationType1()

VOID NTAPI HalpPCIReleaseSynchronzationType1 ( IN PBUS_HANDLER  BusHandler,
IN KIRQL  Irql 
)

Definition at line 139 of file pcibus.c.

141 {
142  PCI_TYPE1_CFG_BITS PciCfg1;
143 
144  /* Clear the PCI Configuration Register */
145  PciCfg1.u.AsULONG = 0;
146  WRITE_PORT_ULONG(((PPCIPBUSDATA)BusHandler->BusData)->Config.Type1.Address,
147  PciCfg1.u.AsULONG);
148 
149  /* Release the lock */
151 }
VOID NTAPI WRITE_PORT_ULONG(IN PULONG Port, IN ULONG Value)
Definition: portio.c:123
KIRQL OldIrql
Definition: mm.h:1502
KSPIN_LOCK HalpPCIConfigLock
Definition: pcibus.c:24
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
union _PCI_TYPE1_CFG_BITS::@152 u

◆ HalpPCISynchronizeType1()

VOID NTAPI HalpPCISynchronizeType1 ( IN PBUS_HANDLER  BusHandler,
IN PCI_SLOT_NUMBER  Slot,
IN PKIRQL  Irql,
IN PPCI_TYPE1_CFG_BITS  PciCfg 
)

◆ HalpPCISynchronizeType2()

VOID NTAPI HalpPCISynchronizeType2 ( IN PBUS_HANDLER  BusHandler,
IN PCI_SLOT_NUMBER  Slot,
IN PKIRQL  Irql,
IN PPCI_TYPE2_ADDRESS_BITS  PciCfg 
)

◆ HalpQueryPciRegistryInfo()

PPCI_REGISTRY_INFO_INTERNAL NTAPI HalpQueryPciRegistryInfo ( VOID  )

Definition at line 869 of file pcibus.c.

870 {
871 #ifndef _MINIHAL_
872  WCHAR NameBuffer[8];
874  UNICODE_STRING KeyName, ConfigName, IdentName;
875  HANDLE KeyHandle, BusKeyHandle, CardListHandle;
877  UCHAR KeyBuffer[sizeof(CM_FULL_RESOURCE_DESCRIPTOR) + 100];
878  PKEY_VALUE_FULL_INFORMATION ValueInfo = (PVOID)KeyBuffer;
879  UCHAR PartialKeyBuffer[sizeof(KEY_VALUE_PARTIAL_INFORMATION) +
880  sizeof(PCI_CARD_DESCRIPTOR)];
881  PKEY_VALUE_PARTIAL_INFORMATION PartialValueInfo = (PVOID)PartialKeyBuffer;
882  KEY_FULL_INFORMATION KeyInformation;
884  PWSTR Tag;
885  ULONG i, ElementCount;
886  PCM_FULL_RESOURCE_DESCRIPTOR FullDescriptor;
887  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
888  PPCI_REGISTRY_INFO PciRegInfo;
889  PPCI_REGISTRY_INFO_INTERNAL PciRegistryInfo;
890  PPCI_CARD_DESCRIPTOR CardDescriptor;
891 
892  /* Setup the object attributes for the key */
894  L"\\Registry\\Machine\\Hardware\\Description\\"
895  L"System\\MultiFunctionAdapter");
897  &KeyName,
899  NULL,
900  NULL);
901 
902  /* Open the key */
903  Status = ZwOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes);
904  if (!NT_SUCCESS(Status)) return NULL;
905 
906  /* Setup the receiving string */
907  KeyName.Buffer = NameBuffer;
908  KeyName.MaximumLength = sizeof(NameBuffer);
909 
910  /* Setup the configuration and identifier key names */
911  RtlInitUnicodeString(&ConfigName, L"Configuration Data");
912  RtlInitUnicodeString(&IdentName, L"Identifier");
913 
914  /* Keep looping for each ID */
915  for (i = 0; TRUE; i++)
916  {
917  /* Setup the key name */
920  &KeyName,
922  KeyHandle,
923  NULL);
924 
925  /* Open it */
926  Status = ZwOpenKey(&BusKeyHandle, KEY_READ, &ObjectAttributes);
927  if (!NT_SUCCESS(Status))
928  {
929  /* None left, fail */
931  return NULL;
932  }
933 
934  /* Read the registry data */
935  Status = ZwQueryValueKey(BusKeyHandle,
936  &IdentName,
938  ValueInfo,
939  sizeof(KeyBuffer),
940  &ResultLength);
941  if (!NT_SUCCESS(Status))
942  {
943  /* Failed, try the next one */
944  ZwClose(BusKeyHandle);
945  continue;
946  }
947 
948  /* Get the PCI Tag and validate it */
949  Tag = (PWSTR)((ULONG_PTR)ValueInfo + ValueInfo->DataOffset);
950  if ((Tag[0] != L'P') ||
951  (Tag[1] != L'C') ||
952  (Tag[2] != L'I') ||
953  (Tag[3]))
954  {
955  /* Not a valid PCI entry, skip it */
956  ZwClose(BusKeyHandle);
957  continue;
958  }
959 
960  /* Now read our PCI structure */
961  Status = ZwQueryValueKey(BusKeyHandle,
962  &ConfigName,
964  ValueInfo,
965  sizeof(KeyBuffer),
966  &ResultLength);
967  ZwClose(BusKeyHandle);
968  if (!NT_SUCCESS(Status)) continue;
969 
970  /* We read it OK! Get the actual resource descriptors */
971  FullDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)
972  ((ULONG_PTR)ValueInfo + ValueInfo->DataOffset);
973  PartialDescriptor = (PCM_PARTIAL_RESOURCE_DESCRIPTOR)
974  ((ULONG_PTR)FullDescriptor->
975  PartialResourceList.PartialDescriptors);
976 
977  /* Check if this is our PCI Registry Information */
978  if (PartialDescriptor->Type == CmResourceTypeDeviceSpecific)
979  {
980  /* It is, stop searching */
981  break;
982  }
983  }
984 
985  /* Close the key */
987 
988  /* Save the PCI information for later */
989  PciRegInfo = (PPCI_REGISTRY_INFO)(PartialDescriptor + 1);
990 
991  /* Assume no Card List entries */
992  ElementCount = 0;
993 
994  /* Set up for checking the PCI Card List key */
996  L"\\Registry\\Machine\\System\\CurrentControlSet\\"
997  L"Control\\PnP\\PCI\\CardList");
999  &KeyName,
1001  NULL,
1002  NULL);
1003 
1004  /* Attempt to open it */
1005  Status = ZwOpenKey(&CardListHandle, KEY_READ, &ObjectAttributes);
1006  if (NT_SUCCESS(Status))
1007  {
1008  /* It exists, so let's query it */
1009  Status = ZwQueryKey(CardListHandle,
1011  &KeyInformation,
1012  sizeof(KEY_FULL_INFORMATION),
1013  &ResultLength);
1014  if (!NT_SUCCESS(Status))
1015  {
1016  /* Failed to query, so no info */
1017  PciRegistryInfo = NULL;
1018  }
1019  else
1020  {
1021  /* Allocate the full structure */
1022  PciRegistryInfo =
1024  sizeof(PCI_REGISTRY_INFO_INTERNAL) +
1025  (KeyInformation.Values *
1026  sizeof(PCI_CARD_DESCRIPTOR)),
1027  TAG_HAL);
1028  if (PciRegistryInfo)
1029  {
1030  /* Get the first card descriptor entry */
1031  CardDescriptor = (PPCI_CARD_DESCRIPTOR)(PciRegistryInfo + 1);
1032 
1033  /* Loop all the values */
1034  for (i = 0; i < KeyInformation.Values; i++)
1035  {
1036  /* Attempt to get the value */
1037  Status = ZwEnumerateValueKey(CardListHandle,
1038  i,
1040  PartialValueInfo,
1041  sizeof(PartialKeyBuffer),
1042  &ResultLength);
1043  if (!NT_SUCCESS(Status))
1044  {
1045  /* Something went wrong, stop the search */
1046  break;
1047  }
1048 
1049  /* Make sure it is correctly sized */
1050  if (PartialValueInfo->DataLength == sizeof(PCI_CARD_DESCRIPTOR))
1051  {
1052  /* Sure is, copy it over */
1053  *CardDescriptor = *(PPCI_CARD_DESCRIPTOR)
1054  PartialValueInfo->Data;
1055 
1056  /* One more Card List entry */
1057  ElementCount++;
1058 
1059  /* Move to the next descriptor */
1060  CardDescriptor = (CardDescriptor + 1);
1061  }
1062  }
1063  }
1064  }
1065 
1066  /* Close the Card List key */
1067  ZwClose(CardListHandle);
1068  }
1069  else
1070  {
1071  /* No key, no Card List */
1072  PciRegistryInfo = NULL;
1073  }
1074 
1075  /* Check if we failed to get the full structure */
1076  if (!PciRegistryInfo)
1077  {
1078  /* Just allocate the basic structure then */
1079  PciRegistryInfo = ExAllocatePoolWithTag(NonPagedPool,
1081  TAG_HAL);
1082  if (!PciRegistryInfo) return NULL;
1083  }
1084 
1085  /* Save the info we got */
1086  PciRegistryInfo->MajorRevision = PciRegInfo->MajorRevision;
1087  PciRegistryInfo->MinorRevision = PciRegInfo->MinorRevision;
1088  PciRegistryInfo->NoBuses = PciRegInfo->NoBuses;
1089  PciRegistryInfo->HardwareMechanism = PciRegInfo->HardwareMechanism;
1090  PciRegistryInfo->ElementCount = ElementCount;
1091 
1092  /* Return it */
1093  return PciRegistryInfo;
1094 #else
1095  return NULL;
1096 #endif
1097 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR * PCM_PARTIAL_RESOURCE_DESCRIPTOR
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
uint16_t * PWSTR
Definition: typedefs.h:56
LONG NTSTATUS
Definition: precomp.h:26
UCHAR HardwareMechanism
Definition: pci.h:110
struct _CM_FULL_RESOURCE_DESCRIPTOR CM_FULL_RESOURCE_DESCRIPTOR
UCHAR MinorRevision
Definition: pci.h:108
uint32_t ULONG_PTR
Definition: typedefs.h:65
UCHAR MajorRevision
Definition: pci.h:107
struct _PCI_CARD_DESCRIPTOR * PPCI_CARD_DESCRIPTOR
struct _CM_FULL_RESOURCE_DESCRIPTOR * PCM_FULL_RESOURCE_DESCRIPTOR
void * PVOID
Definition: retypes.h:9
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
Status
Definition: gdiplustypes.h:24
NTSYSAPI NTSTATUS NTAPI RtlIntegerToUnicodeString(ULONG Value, ULONG Base, PUNICODE_STRING String)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned char UCHAR
Definition: xmlstorage.h:181
static const WCHAR L[]
Definition: oid.c:1250
#define TAG_HAL
Definition: hal.h:61
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
#define NULL
Definition: types.h:112
UCHAR NoBuses
Definition: pci.h:109
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
struct _PCI_REGISTRY_INFO * PPCI_REGISTRY_INFO

Referenced by HalpInitializePciBus(), and HalpInitializePciStubs().

◆ HalpReadPCIConfig()

VOID NTAPI HalpReadPCIConfig ( IN PBUS_HANDLER  BusHandler,
IN PCI_SLOT_NUMBER  Slot,
IN PVOID  Buffer,
IN ULONG  Offset,
IN ULONG  Length 
)

Definition at line 259 of file pcibus.c.

264 {
265  /* Validate the PCI Slot */
266  if (!HalpValidPCISlot(BusHandler, Slot))
267  {
268  /* Fill the buffer with invalid data */
270  }
271  else
272  {
273  /* Send the request */
274  HalpPCIConfig(BusHandler,
275  Slot,
276  Buffer,
277  Offset,
278  Length,
280  }
281 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
BOOLEAN NTAPI HalpValidPCISlot(IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot)
Definition: pcibus.c:329
Definition: bufpool.h:45
PCI_CONFIG_HANDLER PCIConfigHandler
Definition: pcibus.c:25
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
VOID NTAPI HalpPCIConfig(IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PUCHAR Buffer, IN ULONG Offset, IN ULONG Length, IN FncConfigIO *ConfigIO)
Definition: pcibus.c:221
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
FncConfigIO ConfigRead[3]
Definition: bus.h:147

Referenced by HaliPciInterfaceReadConfig(), HalpAllocateAndInitPciBusHandler(), HalpAssignPCISlotResources(), HalpGetPciBridgeConfig(), HalpGetPCIData(), HalpInitializePciBus(), HalpIsValidPCIDevice(), HalpSetPCIData(), and HalpValidPCISlot().

◆ HalpRegisterPciDebuggingDeviceInfo()

VOID NTAPI HalpRegisterPciDebuggingDeviceInfo ( VOID  )

Definition at line 633 of file pcibus.c.

634 {
635  BOOLEAN Found = FALSE;
636  ULONG i;
637  PAGED_CODE();
638 
639  /* Loop PCI debugging devices */
640  for (i = 0; i < 2; i++)
641  {
642  /* Reserved bit is set if we found one */
643  if (HalpPciDebuggingDevice[i].u.bits.Reserved1)
644  {
645  Found = TRUE;
646  break;
647  }
648  }
649 
650  /* Bail out if there aren't any */
651  if (!Found) return;
652 
653  /* FIXME: TODO */
654  UNIMPLEMENTED_DBGBREAK("You have implemented the KD routines for searching PCI debugger"
655  "devices, but you have forgotten to implement this routine\n");
656 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
PCI_TYPE1_CFG_CYCLE_BITS HalpPciDebuggingDevice[2]
Definition: pcibus.c:20
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
return Found
Definition: dirsup.c:1270
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57
unsigned int ULONG
Definition: retypes.h:1
#define PAGED_CODE()

Referenced by HalReportResourceUsage().

◆ HalpSetCmosData()

ULONG NTAPI HalpSetCmosData ( IN ULONG  BusNumber,
IN ULONG  SlotNumber,
IN PVOID  Buffer,
IN ULONG  Length 
)

Definition at line 104 of file cmos.c.

108 {
109  PUCHAR Ptr = (PUCHAR)Buffer;
111  ULONG Len = Length;
112 
113  /* Do nothing if we don't have a length */
114  if (!Length) return 0;
115 
116  /* Acquire CMOS Lock */
118 
119  /* Check if this is simple CMOS */
120  if (BusNumber == 0)
121  {
122  /* Loop the buffer up to 0xFF */
123  while ((Len > 0) && (Address < 0x100))
124  {
125  /* Write the data */
127 
128  /* Update position and length */
129  Ptr++;
130  Address++;
131  Len--;
132  }
133  }
134  else if (BusNumber == 1)
135  {
136  /* Loop the buffer up to 0xFFFF */
137  while ((Len > 0) && (Address < 0x10000))
138  {
139  /* Write the data */
141 
142  /* Update position and length */
143  Ptr++;
144  Address++;
145  Len--;
146  }
147  }
148 
149  /* Release CMOS Lock */
151 
152  /* Return length read */
153  return Length - Len;
154 }
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:65
VOID NTAPI HalpWriteCmos(_In_ UCHAR Reg, _In_ UCHAR Value)
Definition: cmos.c:132
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
unsigned char * PUCHAR
Definition: retypes.h:3
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
VOID NTAPI HalpReleaseCmosSpinLock(VOID)
Definition: spinlock.c:229
static WCHAR Address[46]
Definition: ping.c:68
Definition: bufpool.h:45
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
#define Len
Definition: deflate.h:82
VOID NTAPI HalpAcquireCmosSpinLock(VOID)
Definition: spinlock.c:212
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned int ULONG
Definition: retypes.h:1

Referenced by HalSetBusDataByOffset().

◆ HalpSetPCIData()

ULONG NTAPI HalpSetPCIData ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootBusHandler,
IN ULONG  SlotNumber,
IN PVOID  Buffer,
IN ULONG  Offset,
IN ULONG  Length 
)

Definition at line 453 of file pcibus.c.

459 {
460  PCI_SLOT_NUMBER Slot;
461  UCHAR PciBuffer[PCI_COMMON_HDR_LENGTH];
462  PPCI_COMMON_CONFIG PciConfig = (PPCI_COMMON_CONFIG)PciBuffer;
463  ULONG Len = 0;
464 
465  Slot.u.AsULONG = SlotNumber;
466 #ifdef SARCH_XBOX
467  if (HalpXboxBlacklistedPCISlot(BusHandler, Slot)) return 0;
468 #endif
469 
470  /* Normalize the length */
471  if (Length > sizeof(PCI_COMMON_CONFIG)) Length = sizeof(PCI_COMMON_CONFIG);
472 
473  /* Check if this is a vendor-specific read */
475  {
476  /* Read the header */
477  HalpReadPCIConfig(BusHandler, Slot, PciConfig, 0, sizeof(ULONG));
478 
479  /* Make sure the vendor is valid */
480  if (PciConfig->VendorID == PCI_INVALID_VENDORID) return 0;
481  }
482  else
483  {
484  /* Read the entire header and validate the vendor ID */
486  HalpReadPCIConfig(BusHandler, Slot, PciConfig, 0, Len);
487  if (PciConfig->VendorID == PCI_INVALID_VENDORID) return 0;
488 
489  /* Return what's after the offset and normalize */
490  Len -= Offset;
491  if (Len > Length) Len = Length;
492 
493  /* Copy the specific caller data */
494  RtlMoveMemory(PciBuffer + Offset, Buffer, Len);
495 
496  /* Write the actual configuration data */
497  HalpWritePCIConfig(BusHandler, Slot, PciBuffer + Offset, Offset, Len);
498 
499  /* Update buffer and offset, decrement total length */
500  Offset += Len;
501  Buffer = (PVOID)((ULONG_PTR)Buffer + Len);
502  Length -= Len;
503  }
504 
505  /* Now we still have something to copy */
506  if (Length)
507  {
508  /* Check if it's vendor-specific data */
510  {
511  /* Read it now */
512  HalpWritePCIConfig(BusHandler, Slot, Buffer, Offset, Length);
513  Len += Length;
514  }
515  }
516 
517  /* Update the total length read */
518  return Len;
519 }
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:65
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct _PCI_COMMON_CONFIG * PPCI_COMMON_CONFIG
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
uint32_t ULONG_PTR
Definition: typedefs.h:65
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3601
#define Len
Definition: deflate.h:82
unsigned char UCHAR
Definition: xmlstorage.h:181
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
VOID NTAPI HalpWritePCIConfig(IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: pcibus.c:285
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI HalpReadPCIConfig(IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: pcibus.c:259
union _PCI_SLOT_NUMBER::@3773 u
#define PCI_COMMON_HDR_LENGTH
Definition: iotypes.h:3594

Referenced by HalpAllocateAndInitPciBusHandler(), and HalSetBusDataByOffset().

◆ HalpTranslateBusAddress()

BOOLEAN NTAPI HalpTranslateBusAddress ( IN INTERFACE_TYPE  InterfaceType,
IN ULONG  BusNumber,
IN PHYSICAL_ADDRESS  BusAddress,
IN OUT PULONG  AddressSpace,
OUT PPHYSICAL_ADDRESS  TranslatedAddress 
)

Definition at line 77 of file busemul.c.

82 {
83  /* Translation is easy */
85  return TRUE;
86 }
_In_ ULONG _In_ PHYSICAL_ADDRESS BusAddress
Definition: iofuncs.h:2272
#define TRUE
Definition: types.h:120
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2272
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by HalpInitNonBusHandler().

◆ HalpTranslateIsaBusAddress()

BOOLEAN NTAPI HalpTranslateIsaBusAddress ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootHandler,
IN PHYSICAL_ADDRESS  BusAddress,
IN OUT PULONG  AddressSpace,
OUT PPHYSICAL_ADDRESS  TranslatedAddress 
)

Definition at line 21 of file isabus.c.

26 {
28 
29  /* Use system translation */
31  RootHandler,
32  BusAddress,
35 
36  /* If it didn't work and it was memory address space... */
37  if (!(Status) && (*AddressSpace == 0))
38  {
39  /* Try EISA translation instead */
41  BusHandler->BusNumber,
42  BusAddress,
45  }
46 
47  /* Return the result */
48  return Status;
49 }
_In_ ULONG _In_ PHYSICAL_ADDRESS BusAddress
Definition: iofuncs.h:2272
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2272
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2272
BOOLEAN NTAPI HalpTranslateSystemBusAddress(IN PBUS_HANDLER BusHandler, IN PBUS_HANDLER RootHandler, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
Definition: sysbus.c:21
unsigned char BOOLEAN
Status
Definition: gdiplustypes.h:24
BOOLEAN NTAPI HalTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
Definition: bus.c:140

Referenced by HalpRegisterInternalBusHandlers().

◆ HalpTranslateSystemBusAddress()

BOOLEAN NTAPI HalpTranslateSystemBusAddress ( IN PBUS_HANDLER  BusHandler,
IN PBUS_HANDLER  RootHandler,
IN PHYSICAL_ADDRESS  BusAddress,
IN OUT PULONG  AddressSpace,
OUT PPHYSICAL_ADDRESS  TranslatedAddress 
)

Definition at line 21 of file sysbus.c.

26 {
28 
29  /* Check what kind of address space this is */
30  switch (*AddressSpace)
31  {
32  /* Memory address */
33  case 0:
34 
35  /* Loop all prefetch memory */
36  for (Range = &BusHandler->BusAddresses->PrefetchMemory;
37  Range;
38  Range = Range->Next)
39  {
40  /* Check if it's in a valid range */
41  if ((BusAddress.QuadPart >= Range->Base) &&
42  (BusAddress.QuadPart <= Range->Limit))
43  {
44  /* Get out */
45  break;
46  }
47  }
48 
49  /* Check if we haven't found anything yet */
50  if (!Range)
51  {
52  /* Loop all bus memory */
53  for (Range = &BusHandler->BusAddresses->Memory;
54  Range;
55  Range = Range->Next)
56  {
57  /* Check if it's in a valid range */
58  if ((BusAddress.QuadPart >= Range->Base) &&
59  (BusAddress.QuadPart <= Range->Limit))
60  {
61  /* Get out */
62  break;
63  }
64  }
65  }
66 
67  /* Done */
68  break;
69 
70  /* I/O Space */
71  case 1:
72 
73  /* Loop all bus I/O memory */
74  for (Range = &BusHandler->BusAddresses->IO;
75  Range;
76  Range = Range->Next)
77  {
78  /* Check if it's in a valid range */
79  if ((BusAddress.QuadPart >= Range->Base) &&
80  (BusAddress.QuadPart <= Range->Limit))
81  {
82  /* Get out */
83  break;
84  }
85  }
86 
87  /* Done */
88  break;
89  }
90 
91  /* Check if we found a range */
92  if (Range)
93  {
94  /* Do the translation and return the kind of address space this is */
97  (*AddressSpace != Range->SystemAddressSpace))
98  {
99  /* Different than what the old HAL would do */
100  DPRINT1("Translation of %I64x is %I64x %s\n",
102  Range->SystemAddressSpace ? "In I/O Space" : "In RAM");
103  }
104  *AddressSpace = Range->SystemAddressSpace;
105  return TRUE;
106  }
107 
108  /* Nothing found */
109  DPRINT1("Translation of %I64x failed!\n", BusAddress.QuadPart);
110  return FALSE;
111 }
_In_ ULONG _In_ PHYSICAL_ADDRESS BusAddress
Definition: iofuncs.h:2272
#define TRUE
Definition: types.h:120
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2272
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2272
#define FALSE
Definition: types.h:117
Definition: range.c:39
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by HalpRegisterInternalBusHandlers(), and HalpTranslateIsaBusAddress().

◆ HalpValidPCISlot()

BOOLEAN NTAPI HalpValidPCISlot ( IN PBUS_HANDLER  BusHandler,
IN PCI_SLOT_NUMBER  Slot 
)

Definition at line 329 of file pcibus.c.

331 {
332  PCI_SLOT_NUMBER MultiSlot;
333  PPCIPBUSDATA BusData = (PPCIPBUSDATA)BusHandler->BusData;
334  UCHAR HeaderType;
335  //ULONG Device;
336 
337  /* Simple validation */
338  if (Slot.u.bits.Reserved) return FALSE;
339  if (Slot.u.bits.DeviceNumber >= BusData->MaxDevice) return FALSE;
340 
341 #ifdef SARCH_XBOX
342  if (HalpXboxBlacklistedPCISlot(BusHandler, Slot)) return FALSE;
343 #endif
344 
345  /* Function 0 doesn't need checking */
346  if (!Slot.u.bits.FunctionNumber) return TRUE;
347 
348  /* Functions 0+ need Multi-Function support, so check the slot */
349  //Device = Slot.u.bits.DeviceNumber;
350  MultiSlot = Slot;
351  MultiSlot.u.bits.FunctionNumber = 0;
352 
353  /* Send function 0 request to get the header back */
354  HalpReadPCIConfig(BusHandler,
355  MultiSlot,
356  &HeaderType,
357  FIELD_OFFSET(PCI_COMMON_CONFIG, HeaderType),
358  sizeof(UCHAR));
359 
360  /* Now make sure the header is multi-function */
361  if (!(HeaderType & PCI_MULTIFUNCTION) || (HeaderType == 0xFF)) return FALSE;
362  return TRUE;
363 }
ULONG MaxDevice
Definition: bus.h:110
#define TRUE
Definition: types.h:120
#define PCI_MULTIFUNCTION
Definition: iotypes.h:3604
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define FALSE
Definition: types.h:117
struct _PCIPBUSDATA * PPCIPBUSDATA
unsigned char UCHAR
Definition: xmlstorage.h:181
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
VOID NTAPI HalpReadPCIConfig(IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: pcibus.c:259
union _PCI_SLOT_NUMBER::@3773 u
struct _PCI_SLOT_NUMBER::@3773::@3774 bits

Referenced by HalpReadPCIConfig(), and HalpWritePCIConfig().

◆ HalpWritePCIConfig()

VOID NTAPI HalpWritePCIConfig ( IN PBUS_HANDLER  BusHandler,
IN PCI_SLOT_NUMBER  Slot,
IN PVOID  Buffer,
IN ULONG  Offset,
IN ULONG  Length 
)

Definition at line 285 of file pcibus.c.

290 {
291  /* Validate the PCI Slot */
292  if (HalpValidPCISlot(BusHandler, Slot))
293  {
294  /* Send the request */
295  HalpPCIConfig(BusHandler,
296  Slot,
297  Buffer,
298  Offset,
299  Length,
301  }
302 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
BOOLEAN NTAPI HalpValidPCISlot(IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot)
Definition: pcibus.c:329
Definition: bufpool.h:45
PCI_CONFIG_HANDLER PCIConfigHandler
Definition: pcibus.c:25
VOID NTAPI HalpPCIConfig(IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PUCHAR Buffer, IN ULONG Offset, IN ULONG Length, IN FncConfigIO *ConfigIO)
Definition: pcibus.c:221
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
FncConfigIO ConfigWrite[3]
Definition: bus.h:148

Referenced by HalpAllocateAndInitPciBusHandler(), HalpAssignPCISlotResources(), and HalpSetPCIData().

◆ TYPE1_DEFINE() [1/6]

TYPE1_DEFINE ( HalpPCIReadUcharType1  )

◆ TYPE1_DEFINE() [2/6]

TYPE1_DEFINE ( HalpPCIReadUshortType1  )

◆ TYPE1_DEFINE() [3/6]

TYPE1_DEFINE ( HalpPCIReadUlongType1  )

◆ TYPE1_DEFINE() [4/6]

TYPE1_DEFINE ( HalpPCIWriteUcharType1  )

◆ TYPE1_DEFINE() [5/6]

TYPE1_DEFINE ( HalpPCIWriteUshortType1  )

◆ TYPE1_DEFINE() [6/6]

TYPE1_DEFINE ( HalpPCIWriteUlongType1  )

◆ TYPE2_DEFINE() [1/6]

TYPE2_DEFINE ( HalpPCIReadUcharType2  )

◆ TYPE2_DEFINE() [2/6]

TYPE2_DEFINE ( HalpPCIReadUshortType2  )

◆ TYPE2_DEFINE() [3/6]

TYPE2_DEFINE ( HalpPCIReadUlongType2  )

◆ TYPE2_DEFINE() [4/6]

TYPE2_DEFINE ( HalpPCIWriteUcharType2  )

◆ TYPE2_DEFINE() [5/6]

TYPE2_DEFINE ( HalpPCIWriteUshortType2  )

◆ TYPE2_DEFINE() [6/6]

TYPE2_DEFINE ( HalpPCIWriteUlongType2  )

Variable Documentation

◆ HalpAllBusHandlers

◆ HalpBusType

◆ HalpFakePciBusHandler

◆ HalpMaxPciBus

ULONG HalpMaxPciBus

Definition at line 23 of file pcibus.c.

Referenced by HalGetBusDataByOffset(), and HalpInitializePciStubs().

◆ HalpMinPciBus

ULONG HalpMinPciBus

Definition at line 23 of file pcibus.c.

Referenced by HalGetBusDataByOffset().

◆ HalpPCIConfigInitialized

BOOLEAN HalpPCIConfigInitialized

Definition at line 22 of file pcibus.c.

Referenced by HalGetBusDataByOffset(), HalpInitializePciStubs(), and HalSetBusDataByOffset().

◆ PCIConfigHandler

◆ PCIConfigHandlerType1

PCI_CONFIG_HANDLER PCIConfigHandlerType1

Definition at line 37 of file pcibus.c.

Referenced by HalpAllocateAndInitPciBusHandler(), and HalpInitializePciStubs().

◆ PCIConfigHandlerType2

PCI_CONFIG_HANDLER PCIConfigHandlerType2

Definition at line 59 of file pcibus.c.

Referenced by HalpAllocateAndInitPciBusHandler(), and HalpInitializePciStubs().