Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

759 lines
13 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. extern.h
  5. Abstract:
  6. External definitions for intermodule functions.
  7. Revision History:
  8. 6-Apr-95
  9. Databook support added.
  10. 2-Nov-96
  11. Overhaul for plug'n'play - Ravisankar Pudipeddi (ravisp)
  12. --*/
  13. #ifndef _PCMCIA_EXTERN_H_
  14. #define _PCMCIA_EXTERN_H_
  15. //
  16. // Global data referenced by the driver
  17. //
  18. extern const DEVICE_DISPATCH_TABLE DeviceDispatchTable[];
  19. extern const PCMCIA_ID_ENTRY PcmciaAdapterHardwareIds[];
  20. extern const PCMCIA_CONTEXT_RANGE DefaultPciContextSave[];
  21. extern const PCMCIA_CONTEXT_RANGE DefaultCardbusContextSave[];
  22. extern const PCMCIA_CONTEXT_RANGE ExcludeCardbusContextRange[];
  23. extern const PCMCIA_REGISTER_INIT PcicRegisterInitTable[];
  24. extern const PCMCIA_DEVICE_CONFIG_PARAMS DeviceConfigParams[];
  25. extern ULONG PcmciaGlobalFlags;
  26. extern ULONG PcmciaDebugMask;
  27. extern PDEVICE_OBJECT FdoList;
  28. extern ULONG globalOverrideIrqMask;
  29. extern ULONG globalFilterIrqMask;
  30. extern ULONG globalAttributeMemoryLow;
  31. extern ULONG globalAttributeMemoryHigh;
  32. extern ULONG globalAttributeMemorySize;
  33. extern ULONG initUsePolledCsc;
  34. extern ULONG initDisableAcpiNameSpaceCheck;
  35. extern ULONG initDefaultRouteR2ToIsa;
  36. extern ULONG pcmciaDisableIsaPciRouting;
  37. extern ULONG pcmciaIsaIrqRescanComplete;
  38. extern ULONG pcmciaIrqRouteToPciController;
  39. extern ULONG pcmciaIrqRouteToIsaController;
  40. extern ULONG pcmciaIrqRouteToPciLocation;
  41. extern ULONG pcmciaIrqRouteToIsaLocation;
  42. extern ULONG pcmciaReportMTD0002AsError;
  43. extern ULONG pcmciaIoctlInterface;
  44. extern GLOBAL_REGISTRY_INFORMATION GlobalRegistryInfo[];
  45. extern ULONG GlobalInfoCount;
  46. extern const PCI_CONTROLLER_INFORMATION PciControllerInformation[];
  47. extern const PCI_VENDOR_INFORMATION PciVendorInformation[];
  48. extern KEVENT PcmciaDelayTimerEvent;
  49. extern KSPIN_LOCK PcmciaGlobalLock;
  50. extern PPCMCIA_NTDETECT_DATA pNtDetectDataList;
  51. extern ULONG EventDpcDelay;
  52. extern ULONG PcmciaPowerPolicy;
  53. extern LONG PcmciaControllerDeviceWake;
  54. //
  55. // Irp dispatch routines
  56. //
  57. VOID
  58. PcmciaInitDeviceDispatchTable(
  59. IN PDRIVER_OBJECT DriverObject
  60. );
  61. NTSTATUS
  62. PcmciaDispatch(
  63. IN PDEVICE_OBJECT DeviceObject,
  64. IN PIRP Irp
  65. );
  66. NTSTATUS
  67. PcmciaFdoPnpDispatch(
  68. IN PDEVICE_OBJECT Fdo,
  69. IN PIRP Irp
  70. );
  71. NTSTATUS
  72. PcmciaPdoPnpDispatch(
  73. IN PDEVICE_OBJECT Pdo,
  74. IN PIRP Irp
  75. );
  76. NTSTATUS
  77. PcmciaPdoCardBusPnPDispatch(
  78. IN PDEVICE_OBJECT Pdo,
  79. IN PIRP Irp
  80. );
  81. NTSTATUS
  82. PcmciaFdoPowerDispatch(
  83. IN PDEVICE_OBJECT Fdo,
  84. IN PIRP Irp
  85. );
  86. NTSTATUS
  87. PcmciaPdoPowerDispatch(
  88. IN PDEVICE_OBJECT Pdo,
  89. IN PIRP Irp
  90. );
  91. NTSTATUS
  92. PcmciaOpenCloseDispatch(
  93. IN PDEVICE_OBJECT DeviceObject,
  94. IN PIRP Irp
  95. );
  96. NTSTATUS
  97. PcmciaCleanupDispatch(
  98. IN PDEVICE_OBJECT DeviceObject,
  99. IN PIRP Irp
  100. );
  101. NTSTATUS
  102. PcmciaDeviceControl(
  103. IN PDEVICE_OBJECT DeviceObject,
  104. IN PIRP Irp
  105. );
  106. NTSTATUS
  107. PcmciaPdoDeviceControl(
  108. IN PDEVICE_OBJECT DeviceObject,
  109. IN PIRP Irp
  110. );
  111. NTSTATUS
  112. PcmciaFdoSystemControl(
  113. IN PDEVICE_OBJECT DeviceObject,
  114. IN PIRP Irp
  115. );
  116. NTSTATUS
  117. PcmciaPdoSystemControl(
  118. IN PDEVICE_OBJECT DeviceObject,
  119. IN PIRP Irp
  120. );
  121. //
  122. // enumeration routines
  123. //
  124. NTSTATUS
  125. PcmciaDeviceRelations(
  126. IN PDEVICE_OBJECT Fdo,
  127. IN PIRP Irp,
  128. IN DEVICE_RELATION_TYPE RelationType,
  129. OUT PDEVICE_RELATIONS *DeviceRelations
  130. );
  131. //
  132. // controller support routines
  133. //
  134. NTSTATUS
  135. PcmciaAddDevice(
  136. IN PDRIVER_OBJECT DriverObject,
  137. IN PDEVICE_OBJECT pdo
  138. );
  139. NTSTATUS
  140. PcmciaStartPcmciaController(
  141. IN PDEVICE_OBJECT Fdo
  142. );
  143. NTSTATUS
  144. PcmciaGetLegacyDetectedControllerType(
  145. IN PDEVICE_OBJECT Pdo,
  146. IN OUT PPCMCIA_CONTROLLER_TYPE ControllerType
  147. );
  148. NTSTATUS
  149. PcmciaSetLegacyDetectedControllerType(
  150. IN PDEVICE_OBJECT Pdo,
  151. IN PCMCIA_CONTROLLER_TYPE ControllerType
  152. );
  153. VOID
  154. PcmciaSetControllerType(
  155. IN PFDO_EXTENSION FdoExtension,
  156. IN PCMCIA_CONTROLLER_TYPE ControllerType
  157. );
  158. NTSTATUS
  159. PcmciaInitializeController(
  160. IN PDEVICE_OBJECT Fdo
  161. );
  162. VOID
  163. PcmciaCleanupPdo(
  164. IN PDEVICE_OBJECT Pdo
  165. );
  166. //
  167. // Interface routines
  168. //
  169. NTSTATUS
  170. PcmciaPdoQueryInterface(
  171. IN PDEVICE_OBJECT Pdo,
  172. IN OUT PIRP Irp
  173. );
  174. NTSTATUS
  175. PcmciaGetInterface(
  176. IN PDEVICE_OBJECT Pdo,
  177. IN CONST GUID *pGuid,
  178. IN USHORT sizeofInterface,
  179. OUT PINTERFACE pInterface
  180. );
  181. NTSTATUS
  182. PcmciaGetSetPciConfigData(
  183. IN PDEVICE_OBJECT PciPdo,
  184. IN PVOID Buffer,
  185. IN ULONG Offset,
  186. IN ULONG Length,
  187. IN BOOLEAN Read
  188. );
  189. NTSTATUS
  190. PcmciaUpdateInterruptLine(
  191. IN PPDO_EXTENSION PdoExtension,
  192. IN PFDO_EXTENSION FdoExtension
  193. );
  194. //
  195. // Socket routines
  196. //
  197. VOID
  198. PcmciaSocketPowerWorker(
  199. IN PKDPC Dpc,
  200. IN PVOID Context,
  201. IN PVOID SystemArgument1,
  202. IN PVOID SystemArgument2
  203. );
  204. NTSTATUS
  205. PcmciaRequestSocketPower(
  206. IN PPDO_EXTENSION PdoExtension,
  207. IN PPCMCIA_COMPLETION_ROUTINE PowerCompletionRoutine
  208. );
  209. NTSTATUS
  210. PcmciaReleaseSocketPower(
  211. IN PPDO_EXTENSION PdoExtension,
  212. IN PPCMCIA_COMPLETION_ROUTINE PowerCompletionRoutine
  213. );
  214. NTSTATUS
  215. PcmciaSetSocketPower(
  216. IN PSOCKET Socket,
  217. IN PPCMCIA_COMPLETION_ROUTINE PowerCompletionRoutine,
  218. IN PVOID Context,
  219. IN BOOLEAN PowerOn
  220. );
  221. VOID
  222. PcmciaGetSocketStatus(
  223. IN PSOCKET Socket
  224. );
  225. UCHAR
  226. PcmciaReadCISChar(
  227. IN PPDO_EXTENSION PdoExtension,
  228. IN MEMORY_SPACE MemorySpace,
  229. IN ULONG Offset
  230. );
  231. NTSTATUS
  232. PcmciaConfigureCardBusCard(
  233. IN PPDO_EXTENSION pdoExtension
  234. );
  235. NTSTATUS
  236. PcmciaConfigurePcCard(
  237. IN PPDO_EXTENSION pdoExtension,
  238. IN PPCMCIA_COMPLETION_ROUTINE ConfigCompletionRoutine
  239. );
  240. VOID
  241. PcmciaConfigurationWorker(
  242. IN PKDPC Dpc,
  243. IN PVOID DeferredContext,
  244. IN PVOID SystemArgument1,
  245. IN PVOID SystemArgument2
  246. );
  247. VOID
  248. PcmciaSocketDeconfigure(
  249. IN PSOCKET Socket
  250. );
  251. NTSTATUS
  252. PcmciaReadWriteCardMemory(
  253. IN PDEVICE_OBJECT Pdo,
  254. IN ULONG WhichSpace,
  255. IN OUT PUCHAR Buffer,
  256. IN ULONG Offset,
  257. IN ULONG Length,
  258. IN BOOLEAN Read
  259. );
  260. NTSTATUS
  261. PcmciaGetConfigData(
  262. IN PPDO_EXTENSION PdoExtension
  263. );
  264. VOID
  265. PcmciaCleanupCisCache(
  266. IN PSOCKET Socket
  267. );
  268. BOOLEAN
  269. PcmciaVerifyCardInSocket(
  270. IN PSOCKET Socket
  271. );
  272. //
  273. // Pnp id routines
  274. //
  275. NTSTATUS
  276. PcmciaGetDeviceId(
  277. IN PDEVICE_OBJECT Pdo,
  278. IN ULONG FunctionNumber,
  279. OUT PUNICODE_STRING DeviceId
  280. );
  281. NTSTATUS
  282. PcmciaGetHardwareIds(
  283. IN PDEVICE_OBJECT Pdo,
  284. IN ULONG FunctionNumber,
  285. OUT PUNICODE_STRING HardwareIds
  286. );
  287. NTSTATUS
  288. PcmciaGetCompatibleIds(
  289. IN PDEVICE_OBJECT Pdo,
  290. IN ULONG FunctionNumber,
  291. OUT PUNICODE_STRING CompatibleIds
  292. );
  293. NTSTATUS
  294. PcmciaGetInstanceId(
  295. IN PDEVICE_OBJECT Pdo,
  296. OUT PUNICODE_STRING InstanceId
  297. );
  298. NTSTATUS
  299. PcmciaStringsToMultiString(
  300. IN PCSTR * Strings,
  301. IN ULONG Count,
  302. IN PUNICODE_STRING MultiString
  303. );
  304. //
  305. // Registry routines
  306. //
  307. NTSTATUS
  308. PcmciaLoadGlobalRegistryValues(
  309. VOID
  310. );
  311. NTSTATUS
  312. PcmciaGetControllerRegistrySettings(
  313. IN OUT PFDO_EXTENSION FdoExtension
  314. );
  315. VOID
  316. PcmciaGetRegistryFdoIrqMask(
  317. IN OUT PFDO_EXTENSION FdoExtension
  318. );
  319. //
  320. // Intel PCIC (82365SL) and compatible routines.
  321. //
  322. NTSTATUS
  323. PcicBuildSocketList(
  324. IN PFDO_EXTENSION FdoExtension
  325. );
  326. UCHAR
  327. PcicReadSocket(
  328. IN PSOCKET Socket,
  329. IN ULONG Register
  330. );
  331. VOID
  332. PcicWriteSocket(
  333. IN PSOCKET Socket,
  334. IN ULONG Register,
  335. IN UCHAR DataByte
  336. );
  337. NTSTATUS
  338. PcicIsaDetect(
  339. IN PFDO_EXTENSION DeviceExtension
  340. );
  341. NTSTATUS
  342. PcicSetPower(
  343. IN PSOCKET Socket,
  344. IN BOOLEAN Enable,
  345. OUT PULONG pDelayTime
  346. );
  347. //
  348. // Utility routines for pcmcia work.
  349. //
  350. NTSTATUS
  351. PcmciaIoCallDriverSynchronous(
  352. PDEVICE_OBJECT deviceObject,
  353. PIRP Irp
  354. );
  355. VOID
  356. PcmciaWait(
  357. IN ULONG MilliSeconds
  358. );
  359. VOID
  360. PcmciaLogError(
  361. IN PFDO_EXTENSION DeviceExtension,
  362. IN ULONG ErrorCode,
  363. IN ULONG UniqueId,
  364. IN ULONG Argument
  365. );
  366. VOID
  367. PcmciaLogErrorWithStrings(
  368. IN PFDO_EXTENSION DeviceExtension,
  369. IN ULONG ErrorCode,
  370. IN ULONG UniqueId,
  371. IN PUNICODE_STRING String1,
  372. IN PUNICODE_STRING String2
  373. );
  374. BOOLEAN
  375. PcmciaReportControllerError(
  376. IN PFDO_EXTENSION FdoExtension,
  377. NTSTATUS ErrorCode
  378. );
  379. ULONG
  380. PcmciaCountOnes(
  381. IN ULONG Data
  382. );
  383. //
  384. // Power management routines
  385. NTSTATUS
  386. PcmciaFdoArmForWake(
  387. IN PFDO_EXTENSION FdoExtension
  388. );
  389. NTSTATUS
  390. PcmciaFdoDisarmWake(
  391. IN PFDO_EXTENSION FdoExtension
  392. );
  393. NTSTATUS
  394. PcmciaPdoWaitWakeCompletion(
  395. IN PDEVICE_OBJECT Pdo,
  396. IN PIRP Irp,
  397. IN PPDO_EXTENSION PdoExtension
  398. );
  399. NTSTATUS
  400. PcmciaSetPdoDevicePowerState(
  401. IN PDEVICE_OBJECT Pdo,
  402. IN OUT PIRP Irp
  403. );
  404. VOID
  405. PcmciaPdoPowerWorkerDpc(
  406. IN PKDPC Dpc,
  407. IN PVOID DeferredContext,
  408. IN PVOID SystemArgument1,
  409. IN PVOID SystemArgument2
  410. );
  411. VOID
  412. PcmciaFdoRetryPdoPowerRequest(
  413. IN PKDPC Dpc,
  414. IN PVOID DeferredContext,
  415. IN PVOID SystemArgument1,
  416. IN PVOID SystemArgument2
  417. );
  418. VOID
  419. PcmciaFdoPowerWorkerDpc(
  420. IN PKDPC Dpc,
  421. IN PVOID Context,
  422. IN PVOID SystemArgument1,
  423. IN PVOID SystemArgument2
  424. );
  425. NTSTATUS
  426. PcmciaFdoCheckForIdle(
  427. IN PFDO_EXTENSION FdoExtension
  428. );
  429. //
  430. //
  431. // Tuple processing routines.
  432. //
  433. NTSTATUS
  434. PcmciaParseFunctionData(
  435. IN PSOCKET Socket,
  436. IN PSOCKET_DATA SocketData
  437. );
  438. NTSTATUS
  439. PcmciaParseFunctionDataForID(
  440. IN PSOCKET_DATA SocketData
  441. );
  442. VOID
  443. PcmciaFilterTupleData(
  444. IN PPDO_EXTENSION PdoExtension
  445. );
  446. //
  447. // General detection and support.
  448. //
  449. NTSTATUS
  450. PcmciaDetectPcmciaControllers(
  451. IN PDRIVER_OBJECT DriverObject,
  452. IN PUNICODE_STRING RegistryPath
  453. );
  454. BOOLEAN
  455. PcmciaLegacyDetectionOk(
  456. VOID
  457. );
  458. //
  459. // Databook TCIC2 and compatible routines.
  460. //
  461. NTSTATUS
  462. TcicBuildSocketList(
  463. IN PFDO_EXTENSION FdoExtension
  464. );
  465. NTSTATUS
  466. TcicDetect(
  467. IN PFDO_EXTENSION DeviceExtension
  468. );
  469. VOID
  470. TcicGetControllerProperties (
  471. IN PSOCKET socketPtr,
  472. IN PUSHORT pIoPortBase,
  473. IN PUSHORT pIoPortSize
  474. );
  475. NTSTATUS
  476. TcicSetPower(
  477. IN PSOCKET Socket,
  478. IN BOOLEAN Enable,
  479. OUT PULONG pDelayTime
  480. );
  481. //
  482. // Cardbus support routines
  483. //
  484. NTSTATUS
  485. CBBuildSocketList(
  486. IN PFDO_EXTENSION FdoExtension
  487. );
  488. ULONG
  489. CBReadSocketRegister(
  490. IN PSOCKET Socket,
  491. IN UCHAR Register
  492. );
  493. VOID
  494. CBWriteSocketRegister(
  495. IN PSOCKET Socket,
  496. IN UCHAR Register,
  497. IN ULONG Data
  498. );
  499. BOOLEAN
  500. CBEnableDeviceInterruptRouting(
  501. IN PSOCKET Socket
  502. );
  503. VOID
  504. CBIssueCvsTest(
  505. IN PSOCKET Socket
  506. );
  507. //
  508. // Cardbus vendor specific exports
  509. //
  510. VOID
  511. TIInitialize(
  512. IN PFDO_EXTENSION FdoExtension
  513. );
  514. BOOLEAN
  515. TISetZV(
  516. IN PSOCKET Socket,
  517. IN BOOLEAN Enable
  518. );
  519. BOOLEAN
  520. TISetWindowPage(
  521. IN PSOCKET Socket,
  522. USHORT Index,
  523. UCHAR Page
  524. );
  525. VOID
  526. CLInitialize(
  527. IN PFDO_EXTENSION FdoExtension
  528. );
  529. NTSTATUS
  530. CLSetPower(
  531. IN PSOCKET Socket,
  532. IN BOOLEAN Enable,
  533. OUT PULONG pDelayTime
  534. );
  535. BOOLEAN
  536. CLSetZV(
  537. IN PSOCKET Socket,
  538. IN BOOLEAN Enable
  539. );
  540. VOID
  541. RicohInitialize(
  542. IN PFDO_EXTENSION FdoExtension
  543. );
  544. BOOLEAN
  545. RicohSetZV(
  546. IN PSOCKET Socket,
  547. IN BOOLEAN Enable
  548. );
  549. VOID
  550. OptiInitialize(
  551. IN PFDO_EXTENSION FdoExtension
  552. );
  553. NTSTATUS
  554. OptiSetPower(
  555. IN PSOCKET Socket,
  556. IN BOOLEAN Enable,
  557. OUT PULONG pDelayTime
  558. );
  559. BOOLEAN
  560. OptiSetZV(
  561. IN PSOCKET Socket,
  562. IN BOOLEAN Enable
  563. );
  564. VOID
  565. TopicInitialize(
  566. IN PFDO_EXTENSION FdoExtension
  567. );
  568. NTSTATUS
  569. TopicSetPower(
  570. IN PSOCKET Socket,
  571. IN BOOLEAN Enable,
  572. OUT PULONG pDelayTime
  573. );
  574. VOID
  575. TopicSetAudio(
  576. IN PSOCKET Socket,
  577. IN BOOLEAN Enable
  578. );
  579. BOOLEAN
  580. TopicSetZV(
  581. IN PSOCKET Socket,
  582. IN BOOLEAN Enable
  583. );
  584. VOID
  585. O2MInitialize(
  586. IN PFDO_EXTENSION FdoExtension
  587. );
  588. NTSTATUS
  589. O2MSetPower(
  590. IN PSOCKET Socket,
  591. IN BOOLEAN Enable,
  592. OUT PULONG pDelayTime
  593. );
  594. BOOLEAN
  595. O2MSetZV(
  596. IN PSOCKET Socket,
  597. IN BOOLEAN Enable
  598. );
  599. VOID
  600. DBInitialize(
  601. IN PFDO_EXTENSION FdoExtension
  602. );
  603. BOOLEAN
  604. DBSetZV(
  605. IN PSOCKET Socket,
  606. IN BOOLEAN Enable
  607. );
  608. BOOLEAN
  609. TridSetZV(
  610. IN PSOCKET Socket,
  611. IN BOOLEAN Enable
  612. );
  613. NTSTATUS
  614. CBSetPower(
  615. IN PSOCKET Socket,
  616. IN BOOLEAN Enable,
  617. OUT PULONG pDelayTime
  618. );
  619. BOOLEAN
  620. CBSetWindowPage(
  621. IN PSOCKET Socket,
  622. USHORT Index,
  623. UCHAR Page
  624. );
  625. #endif // _PCMCIA_EXTERN_H_