Update to support to produce Component Name and & Component Name 2 protocol based...
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / AtapiPassThruDxe / AtapiPassThru.h
CommitLineData
513f3f44 1/** @file\r
2 Copyright (c) 2006, Intel Corporation \r
3 All rights reserved. This program and the accompanying materials \r
4 are licensed and made available under the terms and conditions of the BSD License \r
5 which accompanies this distribution. The full text of the license may be found at \r
6 http://opensource.org/licenses/bsd-license.php \r
7\r
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
10\r
11 Module Name: AtapiPassThru.h\r
12\r
13**/\r
14\r
15#ifndef _APT_H\r
16#define _APT_H\r
17\r
18\r
ed7748fe 19\r
513f3f44 20#include <Uefi.h>\r
ed7748fe 21\r
513f3f44 22#include <Protocol/ScsiPassThru.h>\r
23#include <Protocol/PciIo.h>\r
ed7748fe 24\r
513f3f44 25#include <Library/DebugLib.h>\r
26#include <Library/UefiDriverEntryPoint.h>\r
27#include <Library/BaseLib.h>\r
28#include <Library/UefiLib.h>\r
29#include <Library/BaseMemoryLib.h>\r
30#include <Library/MemoryAllocationLib.h>\r
31#include <Library/UefiBootServicesTableLib.h>\r
32#include <IndustryStandard/pci22.h>\r
33\r
34///\r
35/// bit definition\r
36///\r
37#define bit(a) (1 << (a))\r
38\r
39#define MAX_TARGET_ID 4\r
40\r
41//\r
42// IDE Registers\r
43//\r
44typedef union {\r
45 UINT16 Command; /* when write */\r
46 UINT16 Status; /* when read */\r
47} IDE_CMD_OR_STATUS;\r
48\r
49typedef union {\r
50 UINT16 Error; /* when read */\r
51 UINT16 Feature; /* when write */\r
52} IDE_ERROR_OR_FEATURE;\r
53\r
54typedef union {\r
55 UINT16 AltStatus; /* when read */\r
56 UINT16 DeviceControl; /* when write */\r
57} IDE_AltStatus_OR_DeviceControl;\r
58\r
f36d6e66 59\r
60typedef enum {\r
61 IdePrimary = 0,\r
62 IdeSecondary = 1,\r
63 IdeMaxChannel = 2\r
64} EFI_IDE_CHANNEL;\r
65\r
66///\r
67\r
68\r
69//\r
70// Bit definitions in Programming Interface byte of the Class Code field\r
71// in PCI IDE controller's Configuration Space\r
72//\r
73#define IDE_PRIMARY_OPERATING_MODE BIT0\r
74#define IDE_PRIMARY_PROGRAMMABLE_INDICATOR BIT1\r
75#define IDE_SECONDARY_OPERATING_MODE BIT2\r
76#define IDE_SECONDARY_PROGRAMMABLE_INDICATOR BIT3\r
77\r
78\r
79#define ATAPI_MAX_CHANNEL 2\r
80\r
513f3f44 81///\r
82/// IDE registers set\r
83///\r
84typedef struct {\r
85 UINT16 Data;\r
86 IDE_ERROR_OR_FEATURE Reg1;\r
87 UINT16 SectorCount;\r
88 UINT16 SectorNumber;\r
89 UINT16 CylinderLsb;\r
90 UINT16 CylinderMsb;\r
91 UINT16 Head;\r
92 IDE_CMD_OR_STATUS Reg;\r
513f3f44 93 IDE_AltStatus_OR_DeviceControl Alt;\r
94 UINT16 DriveAddress;\r
513f3f44 95} IDE_BASE_REGISTERS;\r
96\r
97#define ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE EFI_SIGNATURE_32 ('a', 's', 'p', 't')\r
98\r
99typedef struct {\r
f36d6e66 100 UINTN Signature;\r
101 EFI_HANDLE Handle;\r
102 EFI_SCSI_PASS_THRU_PROTOCOL ScsiPassThru;\r
103 EFI_SCSI_PASS_THRU_MODE ScsiPassThruMode;\r
104 EFI_PCI_IO_PROTOCOL *PciIo;\r
513f3f44 105 //\r
106 // Local Data goes here\r
107 //\r
f36d6e66 108 IDE_BASE_REGISTERS *IoPort;\r
109 IDE_BASE_REGISTERS AtapiIoPortRegisters[2];\r
110 CHAR16 ControllerName[100];\r
111 CHAR16 ChannelName[100];\r
112 UINT32 LatestTargetId;\r
113 UINT64 LatestLun;\r
513f3f44 114} ATAPI_SCSI_PASS_THRU_DEV;\r
115\r
f36d6e66 116//\r
117// IDE registers' base addresses\r
118//\r
119typedef struct {\r
120 UINT16 CommandBlockBaseAddr;\r
121 UINT16 ControlBlockBaseAddr;\r
122} IDE_REGISTERS_BASE_ADDR;\r
123\r
513f3f44 124#define ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS(a) \\r
125 CR (a, \\r
126 ATAPI_SCSI_PASS_THRU_DEV, \\r
127 ScsiPassThru, \\r
128 ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE \\r
129 )\r
130\r
131//\r
132// Global Variables\r
133//\r
f527bce3 134extern EFI_DRIVER_BINDING_PROTOCOL gAtapiScsiPassThruDriverBinding;\r
135extern EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName;\r
136extern EFI_COMPONENT_NAME2_PROTOCOL gAtapiScsiPassThruComponentName2;\r
513f3f44 137\r
138//\r
139// ATAPI Command op code\r
140//\r
141#define OP_INQUIRY 0x12\r
142#define OP_LOAD_UNLOAD_CD 0xa6\r
143#define OP_MECHANISM_STATUS 0xbd\r
144#define OP_MODE_SELECT_10 0x55\r
145#define OP_MODE_SENSE_10 0x5a\r
146#define OP_PAUSE_RESUME 0x4b\r
147#define OP_PLAY_AUDIO_10 0x45\r
148#define OP_PLAY_AUDIO_MSF 0x47\r
149#define OP_PLAY_CD 0xbc\r
150#define OP_PLAY_CD_MSF 0xb4\r
151#define OP_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e\r
152#define OP_READ_10 0x28\r
153#define OP_READ_12 0xa8\r
154#define OP_READ_CAPACITY 0x25\r
155#define OP_READ_CD 0xbe\r
156#define OP_READ_CD_MSF 0xb9\r
157#define OP_READ_HEADER 0x44\r
158#define OP_READ_SUB_CHANNEL 0x42\r
159#define OP_READ_TOC 0x43\r
160#define OP_REQUEST_SENSE 0x03\r
161#define OP_SCAN 0xba\r
162#define OP_SEEK_10 0x2b\r
163#define OP_SET_CD_SPEED 0xbb\r
164#define OP_STOPPLAY_SCAN 0x4e\r
165#define OP_START_STOP_UNIT 0x1b\r
166#define OP_TEST_UNIT_READY 0x00\r
167\r
168#define OP_FORMAT_UNIT 0x04\r
169#define OP_READ_FORMAT_CAPACITIES 0x23\r
170#define OP_VERIFY 0x2f\r
171#define OP_WRITE_10 0x2a\r
172#define OP_WRITE_12 0xaa\r
173#define OP_WRITE_AND_VERIFY 0x2e\r
174\r
175//\r
176// ATA Command\r
177//\r
178#define ATAPI_SOFT_RESET_CMD 0x08\r
179\r
180typedef enum {\r
181 DataIn = 0,\r
182 DataOut = 1,\r
183 NoData = 2,\r
184 End = 0xff\r
185} DATA_DIRECTION;\r
186\r
187typedef struct {\r
188 UINT8 OpCode;\r
189 DATA_DIRECTION Direction;\r
190} SCSI_COMMAND_SET;\r
191\r
192#define MAX_CHANNEL 2\r
193\r
194#define ValidCdbLength(Len) ((Len) == 6 || (Len) == 10 || (Len) == 12) ? 1 : 0\r
195\r
196//\r
197// IDE registers bit definitions\r
198//\r
199// ATA Err Reg bitmap\r
200//\r
201#define BBK_ERR bit (7) ///< Bad block detected\r
202#define UNC_ERR bit (6) ///< Uncorrectable Data\r
203#define MC_ERR bit (5) ///< Media Change\r
204#define IDNF_ERR bit (4) ///< ID Not Found\r
205#define MCR_ERR bit (3) ///< Media Change Requested\r
206#define ABRT_ERR bit (2) ///< Aborted Command\r
207#define TK0NF_ERR bit (1) ///< Track 0 Not Found\r
208#define AMNF_ERR bit (0) ///< Address Mark Not Found\r
209\r
210//\r
211// ATAPI Err Reg bitmap\r
212//\r
213#define SENSE_KEY_ERR (bit (7) | bit (6) | bit (5) | bit (4))\r
214#define EOM_ERR bit (1) ///< End of Media Detected\r
215#define ILI_ERR bit (0) ///< Illegal Length Indication\r
216\r
217//\r
218// Device/Head Reg\r
219//\r
220#define LBA_MODE bit (6)\r
221#define DEV bit (4)\r
222#define HS3 bit (3)\r
223#define HS2 bit (2)\r
224#define HS1 bit (1)\r
225#define HS0 bit (0)\r
226#define CHS_MODE (0)\r
227#define DRV0 (0)\r
228#define DRV1 (1)\r
229#define MST_DRV DRV0\r
230#define SLV_DRV DRV1\r
231\r
232//\r
233// Status Reg\r
234//\r
235#define BSY bit (7) ///< Controller Busy\r
236#define DRDY bit (6) ///< Drive Ready\r
237#define DWF bit (5) ///< Drive Write Fault\r
238#define DSC bit (4) ///< Disk Seek Complete\r
239#define DRQ bit (3) ///< Data Request\r
240#define CORR bit (2) ///< Corrected Data\r
241#define IDX bit (1) ///< Index\r
242#define ERR bit (0) ///< Error\r
243#define CHECK bit (0) ///< Check bit for ATAPI Status Reg\r
244\r
245//\r
246// Device Control Reg\r
247//\r
248#define SRST bit (2) ///< Software Reset\r
249#define IEN_L bit (1) ///< Interrupt Enable\r
250\r
251//\r
252// ATAPI Feature Register\r
253//\r
254#define OVERLAP bit (1)\r
255#define DMA bit (0)\r
256\r
257//\r
258// ATAPI Interrupt Reason Reson Reg (ATA Sector Count Register)\r
259//\r
260#define RELEASE bit (2)\r
261#define IO bit (1)\r
262#define CoD bit (0)\r
263\r
264#define PACKET_CMD 0xA0\r
265\r
266#define DEFAULT_CMD (0xa0)\r
267//\r
268// default content of device control register, disable INT\r
269//\r
270#define DEFAULT_CTL (0x0a)\r
271#define MAX_ATAPI_BYTE_COUNT (0xfffe)\r
272\r
273//\r
274// function prototype\r
275//\r
276\r
277EFI_STATUS\r
278EFIAPI\r
279AtapiScsiPassThruDriverBindingSupported (\r
280 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
281 IN EFI_HANDLE Controller,\r
282 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
283 );\r
284\r
285EFI_STATUS\r
286EFIAPI\r
287AtapiScsiPassThruDriverBindingStart (\r
288 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
289 IN EFI_HANDLE Controller,\r
290 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
291 );\r
292\r
293EFI_STATUS\r
294EFIAPI\r
295AtapiScsiPassThruDriverBindingStop (\r
296 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
297 IN EFI_HANDLE Controller,\r
298 IN UINTN NumberOfChildren,\r
299 IN EFI_HANDLE *ChildHandleBuffer\r
300 );\r
301\r
302//\r
303// EFI Component Name Functions\r
304//\r
f527bce3 305/**\r
306 Retrieves a Unicode string that is the user readable name of the driver.\r
307\r
308 This function retrieves the user readable name of a driver in the form of a\r
309 Unicode string. If the driver specified by This has a user readable name in\r
310 the language specified by Language, then a pointer to the driver name is\r
311 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
312 by This does not support the language specified by Language,\r
313 then EFI_UNSUPPORTED is returned.\r
314\r
315 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
316 EFI_COMPONENT_NAME_PROTOCOL instance.\r
317\r
318 @param Language[in] A pointer to a Null-terminated ASCII string\r
319 array indicating the language. This is the\r
320 language of the driver name that the caller is\r
321 requesting, and it must match one of the\r
322 languages specified in SupportedLanguages. The\r
323 number of languages supported by a driver is up\r
324 to the driver writer. Language is specified\r
325 in RFC 3066 or ISO 639-2 language code format.\r
326\r
327 @param DriverName[out] A pointer to the Unicode string to return.\r
328 This Unicode string is the name of the\r
329 driver specified by This in the language\r
330 specified by Language.\r
331\r
332 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
333 This and the language specified by Language was\r
334 returned in DriverName.\r
335\r
336 @retval EFI_INVALID_PARAMETER Language is NULL.\r
337\r
338 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
339\r
340 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
341 the language specified by Language.\r
342\r
343**/\r
513f3f44 344EFI_STATUS\r
345EFIAPI\r
346AtapiScsiPassThruComponentNameGetDriverName (\r
347 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
348 IN CHAR8 *Language,\r
349 OUT CHAR16 **DriverName\r
350 );\r
351\r
f527bce3 352\r
353/**\r
354 Retrieves a Unicode string that is the user readable name of the controller\r
355 that is being managed by a driver.\r
356\r
357 This function retrieves the user readable name of the controller specified by\r
358 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
359 driver specified by This has a user readable name in the language specified by\r
360 Language, then a pointer to the controller name is returned in ControllerName,\r
361 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
362 managing the controller specified by ControllerHandle and ChildHandle,\r
363 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
364 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
365\r
366 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
367 EFI_COMPONENT_NAME_PROTOCOL instance.\r
368\r
369 @param ControllerHandle[in] The handle of a controller that the driver\r
370 specified by This is managing. This handle\r
371 specifies the controller whose name is to be\r
372 returned.\r
373\r
374 @param ChildHandle[in] The handle of the child controller to retrieve\r
375 the name of. This is an optional parameter that\r
376 may be NULL. It will be NULL for device\r
377 drivers. It will also be NULL for a bus drivers\r
378 that wish to retrieve the name of the bus\r
379 controller. It will not be NULL for a bus\r
380 driver that wishes to retrieve the name of a\r
381 child controller.\r
382\r
383 @param Language[in] A pointer to a Null-terminated ASCII string\r
384 array indicating the language. This is the\r
385 language of the driver name that the caller is\r
386 requesting, and it must match one of the\r
387 languages specified in SupportedLanguages. The\r
388 number of languages supported by a driver is up\r
389 to the driver writer. Language is specified in\r
390 RFC 3066 or ISO 639-2 language code format.\r
391\r
392 @param ControllerName[out] A pointer to the Unicode string to return.\r
393 This Unicode string is the name of the\r
394 controller specified by ControllerHandle and\r
395 ChildHandle in the language specified by\r
396 Language from the point of view of the driver\r
397 specified by This.\r
398\r
399 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
400 the language specified by Language for the\r
401 driver specified by This was returned in\r
402 DriverName.\r
403\r
404 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
405\r
406 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
407 EFI_HANDLE.\r
408\r
409 @retval EFI_INVALID_PARAMETER Language is NULL.\r
410\r
411 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
412\r
413 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
414 managing the controller specified by\r
415 ControllerHandle and ChildHandle.\r
416\r
417 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
418 the language specified by Language.\r
419\r
420**/\r
513f3f44 421EFI_STATUS\r
422EFIAPI\r
423AtapiScsiPassThruComponentNameGetControllerName (\r
424 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
425 IN EFI_HANDLE ControllerHandle,\r
426 IN EFI_HANDLE ChildHandle OPTIONAL,\r
427 IN CHAR8 *Language,\r
428 OUT CHAR16 **ControllerName\r
429 );\r
430\r
f527bce3 431\r
513f3f44 432/**\r
433 AtapiScsiPassThruDriverEntryPoint\r
434\r
435 @param ImageHandle\r
436 @param SystemTable\r
437\r
438 @todo Add function description\r
439 @todo ImageHandle - add argument description\r
440 @todo SystemTable - add argument description\r
441 @todo add return values\r
442--*/\r
443EFI_STATUS\r
444EFIAPI\r
445AtapiScsiPassThruDriverEntryPoint (\r
446 IN EFI_HANDLE ImageHandle,\r
447 IN EFI_SYSTEM_TABLE *SystemTable\r
448 )\r
449;\r
450\r
451/**\r
452 RegisterAtapiScsiPassThru\r
453\r
454 @param This\r
455 @param Controller\r
456 @param PciIo\r
457\r
458 @todo Add function description\r
459 @todo This add argument description\r
460 @todo Controller add argument description\r
461 @todo PciIo add argument description\r
462 @todo add return values\r
463**/\r
464EFI_STATUS\r
465RegisterAtapiScsiPassThru (\r
466 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
467 IN EFI_HANDLE Controller,\r
468 IN EFI_PCI_IO_PROTOCOL *PciIo\r
469 )\r
470;\r
471\r
472/**\r
473 AtapiScsiPassThruFunction\r
474\r
475 @param This\r
476 @param Target\r
477 @param Lun\r
478 @param Packet\r
479 @param Event\r
480\r
481 @todo Add function description\r
482 @todo This - add argument description\r
483 @todo Target - add argument description\r
484 @todo Lun - add argument description\r
485 @todo Packet - add argument description\r
486 @todo Event - add argument description\r
487 @todo add return values\r
488**/\r
489EFI_STATUS\r
490EFIAPI\r
491AtapiScsiPassThruFunction (\r
492 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r
493 IN UINT32 Target,\r
494 IN UINT64 Lun,\r
495 IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r
496 IN EFI_EVENT Event OPTIONAL\r
497 )\r
498;\r
499\r
500/**\r
501 AtapiScsiPassThruGetNextDevice\r
502\r
503 TODO: Add function description\r
504\r
505 @param This TODO: add argument description\r
506 @param Target TODO: add argument description\r
507 @param Lun TODO: add argument description\r
508\r
509 TODO: add return values\r
510\r
511**/\r
512EFI_STATUS\r
513EFIAPI\r
514AtapiScsiPassThruGetNextDevice (\r
515 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r
516 IN OUT UINT32 *Target,\r
517 IN OUT UINT64 *Lun\r
518 )\r
519;\r
520\r
521/**\r
522 AtapiScsiPassThruBuildDevicePath\r
523\r
524 TODO: Add function description\r
525\r
526 @param This TODO: add argument description\r
527 @param Target TODO: add argument description\r
528 @param Lun TODO: add argument description\r
529 @param DevicePath TODO: add argument description\r
530\r
531 TODO: add return values\r
532\r
533**/\r
534EFI_STATUS\r
535EFIAPI\r
536AtapiScsiPassThruBuildDevicePath (\r
537 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r
538 IN UINT32 Target,\r
539 IN UINT64 Lun,\r
540 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
541 )\r
542;\r
543\r
544/**\r
545 AtapiScsiPassThruGetTargetLun\r
546\r
547 TODO: Add function description\r
548\r
549 @param This TODO: add argument description\r
550 @param DevicePath TODO: add argument description\r
551 @param Target TODO: add argument description\r
552 @param Lun TODO: add argument description\r
553\r
554 TODO: add return values\r
555\r
556**/\r
557EFI_STATUS\r
558EFIAPI\r
559AtapiScsiPassThruGetTargetLun (\r
560 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r
561 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
562 OUT UINT32 *Target,\r
563 OUT UINT64 *Lun\r
564 )\r
565;\r
566\r
567/**\r
568 AtapiScsiPassThruResetChannel\r
569\r
570 TODO: Add function description\r
571\r
572 @param This TODO: add argument description\r
573\r
574 TODO: add return values\r
575\r
576**/\r
577EFI_STATUS\r
578EFIAPI\r
579AtapiScsiPassThruResetChannel (\r
580 IN EFI_SCSI_PASS_THRU_PROTOCOL *This\r
581 )\r
582;\r
583\r
584/**\r
585 AtapiScsiPassThruResetTarget\r
586\r
587 TODO: Add function description\r
588\r
589 @param This TODO: add argument description\r
590 @param Target TODO: add argument description\r
591 @param Lun TODO: add argument description\r
592\r
593 TODO: add return values\r
594\r
595**/\r
596EFI_STATUS\r
597EFIAPI\r
598AtapiScsiPassThruResetTarget (\r
599 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r
600 IN UINT32 Target,\r
601 IN UINT64 Lun\r
602 )\r
603;\r
604\r
605/**\r
606 CheckSCSIRequestPacket\r
607\r
608 TODO: Add function description\r
609\r
610 @param Packet TODO: add argument description\r
611\r
612 TODO: add return values\r
613\r
614**/\r
615EFI_STATUS\r
616CheckSCSIRequestPacket (\r
617 EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r
618 )\r
619;\r
620\r
621/**\r
622 SubmitBlockingIoCommand\r
623\r
624 TODO: Add function description\r
625\r
626 @param AtapiScsiPrivate TODO: add argument description\r
627 @param Target TODO: add argument description\r
628 @param Packet TODO: add argument description\r
629\r
630 TODO: add return values\r
631\r
632**/\r
633EFI_STATUS\r
634SubmitBlockingIoCommand (\r
635 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
636 UINT32 Target,\r
637 EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r
638 )\r
639;\r
640\r
641/**\r
642 IsCommandValid\r
643\r
644 TODO: Add function description\r
645\r
646 @param Packet - TODO: add argument description\r
647\r
648 @return TODO: add return values\r
649\r
650--*/\r
651BOOLEAN\r
652IsCommandValid (\r
653 EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r
654 )\r
655;\r
656\r
657/**\r
658 RequestSenseCommand\r
659\r
660 TODO: Add function description\r
661\r
662 @param AtapiScsiPrivate TODO: add argument description\r
663 @param Target TODO: add argument description\r
664 @param Timeout TODO: add argument description\r
665 @param SenseData TODO: add argument description\r
666 @param SenseDataLength TODO: add argument description\r
667\r
668 TODO: add return values\r
669\r
670**/\r
671EFI_STATUS\r
672RequestSenseCommand (\r
673 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
674 UINT32 Target,\r
675 UINT64 Timeout,\r
676 VOID *SenseData,\r
677 UINT8 *SenseDataLength\r
678 )\r
679;\r
680\r
681/**\r
682 AtapiPacketCommand\r
683\r
684 TODO: Add function description\r
685\r
686 @param AtapiScsiPrivate TODO: add argument description\r
687 @param Target TODO: add argument description\r
688 @param PacketCommand TODO: add argument description\r
689 @param Buffer TODO: add argument description\r
690 @param ByteCount TODO: add argument description\r
691 @param Direction TODO: add argument description\r
692 @param TimeOutInMicroSeconds TODO: add argument description\r
693\r
694 TODO: add return values\r
695\r
696**/\r
697EFI_STATUS\r
698AtapiPacketCommand (\r
699 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
700 UINT32 Target,\r
701 UINT8 *PacketCommand,\r
702 VOID *Buffer,\r
703 UINT32 *ByteCount,\r
704 DATA_DIRECTION Direction,\r
705 UINT64 TimeOutInMicroSeconds\r
706 )\r
707;\r
708\r
709\r
710/**\r
711 ReadPortB\r
712\r
713 TODO: Add function description\r
714\r
715 @param PciIo TODO: add argument description\r
716 @param Port TODO: add argument description\r
717\r
718 TODO: add return values\r
719\r
720**/\r
721UINT8\r
722ReadPortB (\r
723 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
724 IN UINT16 Port\r
725 )\r
726;\r
727\r
728\r
729/**\r
730 ReadPortW\r
731\r
732 TODO: Add function description\r
733\r
734 @param PciIo TODO: add argument description\r
735 @param Port TODO: add argument description\r
736\r
737 TODO: add return values\r
738\r
739**/\r
740UINT16\r
741ReadPortW (\r
742 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
743 IN UINT16 Port\r
744 )\r
745;\r
746\r
747\r
748/**\r
749 WritePortB\r
750\r
751 TODO: Add function description\r
752\r
753 @param PciIo TODO: add argument description\r
754 @param Port TODO: add argument description\r
755 @param Data TODO: add argument description\r
756\r
757 TODO: add return values\r
758\r
759**/\r
760VOID\r
761WritePortB (\r
762 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
763 IN UINT16 Port,\r
764 IN UINT8 Data\r
765 )\r
766;\r
767\r
768\r
769/**\r
770 WritePortW\r
771\r
772 TODO: Add function description\r
773\r
774 @param PciIo TODO: add argument description\r
775 @param Port TODO: add argument description\r
776 @param Data TODO: add argument description\r
777\r
778 TODO: add return values\r
779\r
780**/\r
781VOID\r
782WritePortW (\r
783 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
784 IN UINT16 Port,\r
785 IN UINT16 Data\r
786 )\r
787;\r
788\r
789/**\r
790 StatusDRQClear\r
791\r
792 TODO: Add function description\r
793\r
794 @param AtapiScsiPrivate TODO: add argument description\r
795 @param TimeOutInMicroSeconds TODO: add argument description\r
796\r
797 TODO: add return values\r
798\r
799**/\r
800EFI_STATUS\r
801StatusDRQClear (\r
802 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
803 UINT64 TimeOutInMicroSeconds\r
804 )\r
805;\r
806\r
807/**\r
808 AltStatusDRQClear\r
809\r
810 TODO: Add function description\r
811\r
812 @param AtapiScsiPrivate TODO: add argument description\r
813 @param TimeOutInMicroSeconds TODO: add argument description\r
814\r
815 TODO: add return values\r
816\r
817**/\r
818EFI_STATUS\r
819AltStatusDRQClear (\r
820 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
821 UINT64 TimeOutInMicroSeconds\r
822 )\r
823;\r
824\r
825/**\r
826 StatusDRQReady\r
827\r
828 TODO: Add function description\r
829\r
830 @param AtapiScsiPrivate TODO: add argument description\r
831 @param TimeOutInMicroSeconds TODO: add argument description\r
832\r
833 TODO: add return values\r
834\r
835**/\r
836EFI_STATUS\r
837StatusDRQReady (\r
838 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
839 UINT64 TimeOutInMicroSeconds\r
840 )\r
841;\r
842\r
843/**\r
844 AltStatusDRQReady\r
845\r
846 TODO: Add function description\r
847\r
848 @param AtapiScsiPrivate TODO: add argument description\r
849 @param TimeOutInMicroSeconds TODO: add argument description\r
850\r
851 TODO: add return values\r
852\r
853**/\r
854EFI_STATUS\r
855AltStatusDRQReady (\r
856 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
857 UINT64 TimeOutInMicroSeconds\r
858 )\r
859;\r
860\r
861/**\r
862 TODO: Add function description\r
863\r
864 @param AtapiScsiPrivate TODO: add argument description\r
865 @param TimeoutInMicroSeconds TODO: add argument description\r
866\r
867 TODO: add return values\r
868\r
869**/\r
870EFI_STATUS\r
871StatusWaitForBSYClear (\r
872 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
873 UINT64 TimeoutInMicroSeconds\r
874 )\r
875;\r
876\r
877/**\r
878 TODO: Add function description\r
879\r
880 @param AtapiScsiPrivate TODO: add argument description\r
881 @param TimeoutInMicroSeconds TODO: add argument description\r
882\r
883 TODO: add return values\r
884\r
885**/\r
886EFI_STATUS\r
887AltStatusWaitForBSYClear (\r
888 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
889 UINT64 TimeoutInMicroSeconds\r
890 )\r
891;\r
892\r
893/**\r
894 TODO: Add function description\r
895\r
896 @param AtapiScsiPrivate TODO: add argument description\r
897 @param TimeoutInMicroSeconds TODO: add argument description\r
898\r
899 TODO: add return values\r
900\r
901**/\r
902EFI_STATUS\r
903StatusDRDYReady (\r
904 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
905 UINT64 TimeoutInMicroSeconds\r
906 )\r
907;\r
908\r
909/**\r
910 TODO: Add function description\r
911\r
912 @param AtapiScsiPrivate TODO: add argument description\r
913 @param TimeoutInMicroSeconds TODO: add argument description\r
914\r
915 TODO: add return values\r
916\r
917**/\r
918EFI_STATUS\r
919AltStatusDRDYReady (\r
920 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
921 UINT64 TimeoutInMicroSeconds\r
922 )\r
923;\r
924\r
925/**\r
926 TODO: Add function description\r
927\r
928 @param AtapiScsiPrivate TODO: add argument description\r
929 @param Buffer TODO: add argument description\r
930 @param ByteCount TODO: add argument description\r
931 @param Direction TODO: add argument description\r
932 @param TimeOutInMicroSeconds TODO: add argument description\r
933\r
934 TODO: add return values\r
935\r
936**/\r
937EFI_STATUS\r
938AtapiPassThruPioReadWriteData (\r
939 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
940 UINT16 *Buffer,\r
941 UINT32 *ByteCount,\r
942 DATA_DIRECTION Direction,\r
943 UINT64 TimeOutInMicroSeconds\r
944 )\r
945;\r
946\r
947/**\r
948 TODO: Add function description\r
949\r
950 @param AtapiScsiPrivate TODO: add argument description\r
951\r
952 TODO: add return values\r
953\r
954**/\r
955EFI_STATUS\r
956AtapiPassThruCheckErrorStatus (\r
957 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate\r
958 )\r
959;\r
f36d6e66 960EFI_STATUS\r
961GetIdeRegistersBaseAddr (\r
962 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
963 OUT IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr\r
964 )\r
965/*++\r
966\r
967Routine Description:\r
968 Get IDE IO port registers' base addresses by mode. In 'Compatibility' mode,\r
969 use fixed addresses. In Native-PCI mode, get base addresses from BARs in\r
970 the PCI IDE controller's Configuration Space.\r
971\r
972Arguments:\r
973 PciIo - Pointer to the EFI_PCI_IO_PROTOCOL instance\r
974 IdeRegsBaseAddr - Pointer to IDE_REGISTERS_BASE_ADDR to \r
975 receive IDE IO port registers' base addresses\r
976 \r
977Returns:\r
978\r
979 EFI_STATUS\r
980 \r
981--*/\r
982;\r
983\r
984VOID\r
985InitAtapiIoPortRegisters (\r
986 IN ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
987 IN IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr\r
988 )\r
989/*++\r
990\r
991Routine Description:\r
992\r
993 Initialize each Channel's Base Address of CommandBlock and ControlBlock.\r
994\r
995Arguments:\r
996 \r
997 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r
998 IdeRegsBaseAddr - The pointer of IDE_REGISTERS_BASE_ADDR\r
999 \r
1000Returns:\r
1001 \r
1002 None\r
1003\r
1004--*/ \r
1005;\r
1006\r
513f3f44 1007#endif\r