Source code of Windows XP (NT5)
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.

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