TianoCore EDK2 master
Loading...
Searching...
No Matches
SataController.c
Go to the documentation of this file.
1
10#include "SataController.h"
11
19 0xa,
20 NULL,
21 NULL
22};
23
33UINT32
34EFIAPI
37 IN UINT32 Offset
38 )
39{
40 UINT32 Data;
41
42 ASSERT (PciIo != NULL);
43
44 Data = 0;
45
46 PciIo->Mem.Read (
47 PciIo,
48 EfiPciIoWidthUint32,
49 AHCI_BAR_INDEX,
50 (UINT64)Offset,
51 1,
52 &Data
53 );
54
55 return Data;
56}
57
71 IN EFI_IDENTIFY_DATA *IdentifyData,
72 IN UINT16 *DisPioMode OPTIONAL,
73 OUT UINT16 *SelectedMode
74 )
75{
76 UINT16 PioMode;
77 UINT16 AdvancedPioMode;
78 UINT16 Temp;
79 UINT16 Index;
80 UINT16 MinimumPioCycleTime;
81
82 Temp = 0xff;
83
84 PioMode = (UINT8)(((ATA5_IDENTIFY_DATA *)(&(IdentifyData->AtaData)))->pio_cycle_timing >> 8);
85
86 //
87 // See whether Identify Data word 64 - 70 are valid
88 //
89 if ((IdentifyData->AtaData.field_validity & 0x02) == 0x02) {
90 AdvancedPioMode = IdentifyData->AtaData.advanced_pio_modes;
91 DEBUG ((DEBUG_INFO, "CalculateBestPioMode: AdvancedPioMode = %x\n", AdvancedPioMode));
92
93 for (Index = 0; Index < 8; Index++) {
94 if ((AdvancedPioMode & 0x01) != 0) {
95 Temp = Index;
96 }
97
98 AdvancedPioMode >>= 1;
99 }
100
101 //
102 // If Temp is modified, mean the advanced_pio_modes is not zero;
103 // if Temp is not modified, mean there is no advanced PIO mode supported,
104 // the best PIO Mode is the value in pio_cycle_timing.
105 //
106 if (Temp != 0xff) {
107 AdvancedPioMode = (UINT16)(Temp + 3);
108 } else {
109 AdvancedPioMode = PioMode;
110 }
111
112 //
113 // Limit the PIO mode to at most PIO4.
114 //
115 PioMode = (UINT16)MIN (AdvancedPioMode, 4);
116
117 MinimumPioCycleTime = IdentifyData->AtaData.min_pio_cycle_time_with_flow_control;
118
119 if (MinimumPioCycleTime <= 120) {
120 PioMode = (UINT16)MIN (4, PioMode);
121 } else if (MinimumPioCycleTime <= 180) {
122 PioMode = (UINT16)MIN (3, PioMode);
123 } else if (MinimumPioCycleTime <= 240) {
124 PioMode = (UINT16)MIN (2, PioMode);
125 } else {
126 PioMode = 0;
127 }
128
129 //
130 // Degrade the PIO mode if the mode has been disqualified
131 //
132 if (DisPioMode != NULL) {
133 if (*DisPioMode < 2) {
134 return EFI_UNSUPPORTED; // no mode below ATA_PIO_MODE_BELOW_2
135 }
136
137 if (PioMode >= *DisPioMode) {
138 PioMode = (UINT16)(*DisPioMode - 1);
139 }
140 }
141
142 if (PioMode < 2) {
143 *SelectedMode = 1; // ATA_PIO_MODE_BELOW_2;
144 } else {
145 *SelectedMode = PioMode; // ATA_PIO_MODE_2 to ATA_PIO_MODE_4;
146 }
147 } else {
148 //
149 // Identify Data word 64 - 70 are not valid
150 // Degrade the PIO mode if the mode has been disqualified
151 //
152 if (DisPioMode != NULL) {
153 if (*DisPioMode < 2) {
154 return EFI_UNSUPPORTED; // no mode below ATA_PIO_MODE_BELOW_2
155 }
156
157 if (PioMode == *DisPioMode) {
158 PioMode--;
159 }
160 }
161
162 if (PioMode < 2) {
163 *SelectedMode = 1; // ATA_PIO_MODE_BELOW_2;
164 } else {
165 *SelectedMode = 2; // ATA_PIO_MODE_2;
166 }
167 }
168
169 return EFI_SUCCESS;
170}
171
185 IN EFI_IDENTIFY_DATA *IdentifyData,
186 IN UINT16 *DisUDmaMode OPTIONAL,
187 OUT UINT16 *SelectedMode
188 )
189{
190 UINT16 TempMode;
191 UINT16 DeviceUDmaMode;
192
193 DeviceUDmaMode = 0;
194
195 //
196 // Check whether the WORD 88 (supported UltraDMA by drive) is valid
197 //
198 if ((IdentifyData->AtaData.field_validity & 0x04) == 0x00) {
199 return EFI_UNSUPPORTED;
200 }
201
202 DeviceUDmaMode = IdentifyData->AtaData.ultra_dma_mode;
203 DEBUG ((DEBUG_INFO, "CalculateBestUdmaMode: DeviceUDmaMode = %x\n", DeviceUDmaMode));
204 DeviceUDmaMode &= 0x3f;
205 TempMode = 0; // initialize it to UDMA-0
206
207 while ((DeviceUDmaMode >>= 1) != 0) {
208 TempMode++;
209 }
210
211 //
212 // Degrade the UDMA mode if the mode has been disqualified
213 //
214 if (DisUDmaMode != NULL) {
215 if (*DisUDmaMode == 0) {
216 *SelectedMode = 0;
217 return EFI_UNSUPPORTED; // no mode below ATA_UDMA_MODE_0
218 }
219
220 if (TempMode >= *DisUDmaMode) {
221 TempMode = (UINT16)(*DisUDmaMode - 1);
222 }
223 }
224
225 //
226 // Possible returned mode is between ATA_UDMA_MODE_0 and ATA_UDMA_MODE_5
227 //
228 *SelectedMode = TempMode;
229
230 return EFI_SUCCESS;
231}
232
244EFIAPI
246 IN EFI_HANDLE ImageHandle,
247 IN EFI_SYSTEM_TABLE *SystemTable
248 )
249{
250 EFI_STATUS Status;
251
252 //
253 // Install driver model protocol(s).
254 //
256 ImageHandle,
257 SystemTable,
259 ImageHandle,
262 );
263 ASSERT_EFI_ERROR (Status);
264
265 return Status;
266}
267
283EFIAPI
286 IN EFI_HANDLE Controller,
287 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
288 )
289{
290 EFI_STATUS Status;
291 EFI_PCI_IO_PROTOCOL *PciIo;
292 PCI_TYPE00 PciData;
293 EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
294
295 //
296 // Attempt to open DevicePath Protocol
297 //
298 Status = gBS->OpenProtocol (
299 Controller,
300 &gEfiDevicePathProtocolGuid,
301 (VOID *)&ParentDevicePath,
302 This->DriverBindingHandle,
303 Controller,
304 EFI_OPEN_PROTOCOL_BY_DRIVER
305 );
306 if (EFI_ERROR (Status)) {
307 return Status;
308 }
309
313 gBS->CloseProtocol (
314 Controller,
315 &gEfiDevicePathProtocolGuid,
316 This->DriverBindingHandle,
317 Controller
318 );
319
320 //
321 // Attempt to open PCI I/O Protocol
322 //
323 Status = gBS->OpenProtocol (
324 Controller,
325 &gEfiPciIoProtocolGuid,
326 (VOID **)&PciIo,
327 This->DriverBindingHandle,
328 Controller,
329 EFI_OPEN_PROTOCOL_GET_PROTOCOL
330 );
331 if (EFI_ERROR (Status)) {
332 return Status;
333 }
334
335 //
336 // Now further check the PCI header: Base Class (offset 0x0B) and
337 // Sub Class (offset 0x0A). This controller should be an SATA controller
338 //
339 Status = PciIo->Pci.Read (
340 PciIo,
341 EfiPciIoWidthUint8,
342 PCI_CLASSCODE_OFFSET,
343 sizeof (PciData.Hdr.ClassCode),
344 PciData.Hdr.ClassCode
345 );
346 if (EFI_ERROR (Status)) {
347 return EFI_UNSUPPORTED;
348 }
349
350 if (IS_PCI_IDE (&PciData) || IS_PCI_SATADPA (&PciData)) {
351 return EFI_SUCCESS;
352 }
353
354 return EFI_UNSUPPORTED;
355}
356
372EFIAPI
375 IN EFI_HANDLE Controller,
376 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
377 )
378{
379 EFI_STATUS Status;
380 EFI_PCI_IO_PROTOCOL *PciIo;
381 PCI_TYPE00 PciData;
383 UINT32 Data32;
384 UINTN TotalCount;
385 UINT64 Supports;
386 UINT8 MaxPortNumber;
387 UINTN BailLogMask;
388
389 DEBUG ((DEBUG_INFO, "SataControllerStart start\n"));
390
391 Private = NULL;
392 BailLogMask = DEBUG_ERROR;
393
394 //
395 // Now test and open PCI I/O Protocol
396 //
397 Status = gBS->OpenProtocol (
398 Controller,
399 &gEfiPciIoProtocolGuid,
400 (VOID **)&PciIo,
401 This->DriverBindingHandle,
402 Controller,
403 EFI_OPEN_PROTOCOL_BY_DRIVER
404 );
405 if (EFI_ERROR (Status)) {
406 if (Status == EFI_ALREADY_STARTED) {
407 //
408 // This is an expected condition for OpenProtocol() / BY_DRIVER, in a
409 // DriverBindingStart() member function; degrade the log mask to
410 // DEBUG_INFO in order to reduce log pollution.
411 //
412 BailLogMask = DEBUG_INFO;
413 }
414
415 goto Bail;
416 }
417
418 //
419 // Allocate Sata Private Data structure
420 //
422 if (Private == NULL) {
423 Status = EFI_OUT_OF_RESOURCES;
424 goto ClosePciIo;
425 }
426
427 //
428 // Initialize Sata Private Data
429 //
430 Private->Signature = SATA_CONTROLLER_SIGNATURE;
431 Private->PciIo = PciIo;
432 Private->IdeInit.GetChannelInfo = IdeInitGetChannelInfo;
433 Private->IdeInit.NotifyPhase = IdeInitNotifyPhase;
434 Private->IdeInit.SubmitData = IdeInitSubmitData;
435 Private->IdeInit.DisqualifyMode = IdeInitDisqualifyMode;
436 Private->IdeInit.CalculateMode = IdeInitCalculateMode;
437 Private->IdeInit.SetTiming = IdeInitSetTiming;
438 Private->IdeInit.EnumAll = SATA_ENUMER_ALL;
439 Private->PciAttributesChanged = FALSE;
440
441 //
442 // Save original PCI attributes
443 //
444 Status = PciIo->Attributes (
445 PciIo,
447 0,
448 &Private->OriginalPciAttributes
449 );
450 if (EFI_ERROR (Status)) {
451 goto FreeSataPrivate;
452 }
453
454 DEBUG ((
455 DEBUG_INFO,
456 "Original PCI Attributes = 0x%llx\n",
457 Private->OriginalPciAttributes
458 ));
459
460 Status = PciIo->Attributes (
461 PciIo,
463 0,
464 &Supports
465 );
466 if (EFI_ERROR (Status)) {
467 goto FreeSataPrivate;
468 }
469
470 DEBUG ((DEBUG_INFO, "Supported PCI Attributes = 0x%llx\n", Supports));
471
472 Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
473 Status = PciIo->Attributes (
474 PciIo,
476 Supports,
477 NULL
478 );
479 if (EFI_ERROR (Status)) {
480 goto FreeSataPrivate;
481 }
482
483 DEBUG ((DEBUG_INFO, "Enabled PCI Attributes = 0x%llx\n", Supports));
484 Private->PciAttributesChanged = TRUE;
485
486 Status = PciIo->Pci.Read (
487 PciIo,
488 EfiPciIoWidthUint8,
489 PCI_CLASSCODE_OFFSET,
490 sizeof (PciData.Hdr.ClassCode),
491 PciData.Hdr.ClassCode
492 );
493 if (EFI_ERROR (Status)) {
494 ASSERT (FALSE);
495 goto RestorePciAttributes;
496 }
497
498 if (IS_PCI_IDE (&PciData)) {
499 Private->IdeInit.ChannelCount = IDE_MAX_CHANNEL;
500 Private->DeviceCount = IDE_MAX_DEVICES;
501 } else if (IS_PCI_SATADPA (&PciData)) {
502 //
503 // Read Ports Implemented(PI) to calculate max port number (0 based).
504 //
505 Data32 = AhciReadReg (PciIo, R_AHCI_PI);
506 DEBUG ((DEBUG_INFO, "Ports Implemented(PI) = 0x%x\n", Data32));
507 if (Data32 == 0) {
508 Status = EFI_UNSUPPORTED;
509 goto RestorePciAttributes;
510 }
511
512 MaxPortNumber = 31;
513 while (MaxPortNumber > 0) {
514 if ((Data32 & ((UINT32)1 << MaxPortNumber)) != 0) {
515 break;
516 }
517
518 MaxPortNumber--;
519 }
520
521 //
522 // Make the ChannelCount equal to the max port number (0 based) plus 1.
523 //
524 Private->IdeInit.ChannelCount = MaxPortNumber + 1;
525
526 //
527 // Read HBA Capabilities(CAP) to get Supports Port Multiplier(SPM).
528 //
529 Data32 = AhciReadReg (PciIo, R_AHCI_CAP);
530 DEBUG ((DEBUG_INFO, "HBA Capabilities(CAP) = 0x%x\n", Data32));
531 Private->DeviceCount = AHCI_MAX_DEVICES;
532 if ((Data32 & B_AHCI_CAP_SPM) == B_AHCI_CAP_SPM) {
533 Private->DeviceCount = AHCI_MULTI_MAX_DEVICES;
534 }
535 }
536
537 TotalCount = (UINTN)(Private->IdeInit.ChannelCount) * (UINTN)(Private->DeviceCount);
538 Private->DisqualifiedModes = AllocateZeroPool ((sizeof (EFI_ATA_COLLECTIVE_MODE)) * TotalCount);
539 if (Private->DisqualifiedModes == NULL) {
540 Status = EFI_OUT_OF_RESOURCES;
541 goto RestorePciAttributes;
542 }
543
544 Private->IdentifyData = AllocateZeroPool ((sizeof (EFI_IDENTIFY_DATA)) * TotalCount);
545 if (Private->IdentifyData == NULL) {
546 Status = EFI_OUT_OF_RESOURCES;
547 goto FreeDisqualifiedModes;
548 }
549
550 Private->IdentifyValid = AllocateZeroPool ((sizeof (BOOLEAN)) * TotalCount);
551 if (Private->IdentifyValid == NULL) {
552 Status = EFI_OUT_OF_RESOURCES;
553 goto FreeIdentifyData;
554 }
555
556 //
557 // Install IDE Controller Init Protocol to this instance
558 //
559 Status = gBS->InstallMultipleProtocolInterfaces (
560 &Controller,
561 &gEfiIdeControllerInitProtocolGuid,
562 &(Private->IdeInit),
563 NULL
564 );
565
566 if (EFI_ERROR (Status)) {
567 goto FreeIdentifyValid;
568 }
569
570 DEBUG ((DEBUG_INFO, "SataControllerStart end with %r\n", Status));
571
572 return Status;
573
574FreeIdentifyValid:
575 FreePool (Private->IdentifyValid);
576FreeIdentifyData:
577 FreePool (Private->IdentifyData);
578FreeDisqualifiedModes:
579 FreePool (Private->DisqualifiedModes);
580RestorePciAttributes:
581 //
582 // Restore original PCI attributes
583 //
584 Private->PciIo->Attributes (
585 Private->PciIo,
587 Private->OriginalPciAttributes,
588 NULL
589 );
590FreeSataPrivate:
591 FreePool (Private);
592ClosePciIo:
593 gBS->CloseProtocol (Controller, &gEfiPciIoProtocolGuid, This->DriverBindingHandle, Controller);
594Bail:
595 DEBUG ((BailLogMask, "SataControllerStart error return status = %r\n", Status));
596 return Status;
597}
598
612EFIAPI
615 IN EFI_HANDLE Controller,
616 IN UINTN NumberOfChildren,
617 IN EFI_HANDLE *ChildHandleBuffer
618 )
619{
620 EFI_STATUS Status;
623
624 //
625 // Open the produced protocol
626 //
627 Status = gBS->OpenProtocol (
628 Controller,
629 &gEfiIdeControllerInitProtocolGuid,
630 (VOID **)&IdeInit,
631 This->DriverBindingHandle,
632 Controller,
633 EFI_OPEN_PROTOCOL_GET_PROTOCOL
634 );
635 if (EFI_ERROR (Status)) {
636 return EFI_UNSUPPORTED;
637 }
638
639 Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (IdeInit);
640
641 //
642 // Uninstall the IDE Controller Init Protocol from this instance
643 //
644 Status = gBS->UninstallMultipleProtocolInterfaces (
645 Controller,
646 &gEfiIdeControllerInitProtocolGuid,
647 &(Private->IdeInit),
648 NULL
649 );
650 if (EFI_ERROR (Status)) {
651 return Status;
652 }
653
654 if (Private->DisqualifiedModes != NULL) {
655 FreePool (Private->DisqualifiedModes);
656 }
657
658 if (Private->IdentifyData != NULL) {
659 FreePool (Private->IdentifyData);
660 }
661
662 if (Private->IdentifyValid != NULL) {
663 FreePool (Private->IdentifyValid);
664 }
665
666 if (Private->PciAttributesChanged) {
667 //
668 // Restore original PCI attributes
669 //
670 Private->PciIo->Attributes (
671 Private->PciIo,
673 Private->OriginalPciAttributes,
674 NULL
675 );
676 }
677
678 FreePool (Private);
679
680 //
681 // Close protocols opened by Sata Controller driver
682 //
683 return gBS->CloseProtocol (
684 Controller,
685 &gEfiPciIoProtocolGuid,
686 This->DriverBindingHandle,
687 Controller
688 );
689}
690
707STATIC
708UINTN
711 IN UINTN Channel,
712 IN UINTN Device
713 )
714{
715 ASSERT (Private != NULL);
716 ASSERT (Channel < Private->IdeInit.ChannelCount);
717 ASSERT (Device < Private->DeviceCount);
718
719 return Channel * Private->DeviceCount + Device;
720}
721
722//
723// Interface functions of IDE_CONTROLLER_INIT protocol
724//
725
763EFIAPI
766 IN UINT8 Channel,
767 OUT BOOLEAN *Enabled,
768 OUT UINT8 *MaxDevices
769 )
770{
772
773 ASSERT (This != NULL);
774 Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
775
776 if (Channel < This->ChannelCount) {
777 *Enabled = TRUE;
778 *MaxDevices = Private->DeviceCount;
779 return EFI_SUCCESS;
780 }
781
782 *Enabled = FALSE;
783 return EFI_INVALID_PARAMETER;
784}
785
812EFIAPI
816 IN UINT8 Channel
817 )
818{
819 return EFI_SUCCESS;
820}
821
862EFIAPI
865 IN UINT8 Channel,
866 IN UINT8 Device,
867 IN EFI_IDENTIFY_DATA *IdentifyData
868 )
869{
871 UINTN DeviceIndex;
872
873 ASSERT (This != NULL);
874 Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
875
876 if ((Channel >= This->ChannelCount) || (Device >= Private->DeviceCount)) {
877 return EFI_INVALID_PARAMETER;
878 }
879
880 DeviceIndex = FlatDeviceIndex (Private, Channel, Device);
881
882 //
883 // Make a local copy of device's IdentifyData and mark the valid flag
884 //
885 if (IdentifyData != NULL) {
886 CopyMem (
887 &(Private->IdentifyData[DeviceIndex]),
888 IdentifyData,
889 sizeof (EFI_IDENTIFY_DATA)
890 );
891
892 Private->IdentifyValid[DeviceIndex] = TRUE;
893 } else {
894 Private->IdentifyValid[DeviceIndex] = FALSE;
895 }
896
897 return EFI_SUCCESS;
898}
899
941EFIAPI
944 IN UINT8 Channel,
945 IN UINT8 Device,
947 )
948{
950 UINTN DeviceIndex;
951
952 ASSERT (This != NULL);
953 Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
954
955 if ((Channel >= This->ChannelCount) || (BadModes == NULL) || (Device >= Private->DeviceCount)) {
956 return EFI_INVALID_PARAMETER;
957 }
958
959 DeviceIndex = FlatDeviceIndex (Private, Channel, Device);
960
961 //
962 // Record the disqualified modes per channel per device. From ATA/ATAPI spec,
963 // if a mode is not supported, the modes higher than it is also not supported.
964 //
965 CopyMem (
966 &(Private->DisqualifiedModes[DeviceIndex]),
967 BadModes,
969 );
970
971 return EFI_SUCCESS;
972}
973
1029EFIAPI
1032 IN UINT8 Channel,
1033 IN UINT8 Device,
1034 OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes
1035 )
1036{
1038 EFI_IDENTIFY_DATA *IdentifyData;
1039 BOOLEAN IdentifyValid;
1040 EFI_ATA_COLLECTIVE_MODE *DisqualifiedModes;
1041 UINT16 SelectedMode;
1042 EFI_STATUS Status;
1043 UINTN DeviceIndex;
1044
1045 ASSERT (This != NULL);
1046 Private = SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This);
1047
1048 if ((Channel >= This->ChannelCount) || (SupportedModes == NULL) || (Device >= Private->DeviceCount)) {
1049 return EFI_INVALID_PARAMETER;
1050 }
1051
1052 *SupportedModes = AllocateZeroPool (sizeof (EFI_ATA_COLLECTIVE_MODE));
1053 if (*SupportedModes == NULL) {
1054 ASSERT (*SupportedModes != NULL);
1055 return EFI_OUT_OF_RESOURCES;
1056 }
1057
1058 DeviceIndex = FlatDeviceIndex (Private, Channel, Device);
1059
1060 IdentifyData = &(Private->IdentifyData[DeviceIndex]);
1061 IdentifyValid = Private->IdentifyValid[DeviceIndex];
1062 DisqualifiedModes = &(Private->DisqualifiedModes[DeviceIndex]);
1063
1064 //
1065 // Make sure we've got the valid identify data of the device from SubmitData()
1066 //
1067 if (!IdentifyValid) {
1068 FreePool (*SupportedModes);
1069 return EFI_NOT_READY;
1070 }
1071
1072 Status = CalculateBestPioMode (
1073 IdentifyData,
1074 (DisqualifiedModes->PioMode.Valid ? ((UINT16 *)&(DisqualifiedModes->PioMode.Mode)) : NULL),
1075 &SelectedMode
1076 );
1077 if (!EFI_ERROR (Status)) {
1078 (*SupportedModes)->PioMode.Valid = TRUE;
1079 (*SupportedModes)->PioMode.Mode = SelectedMode;
1080 } else {
1081 (*SupportedModes)->PioMode.Valid = FALSE;
1082 }
1083
1084 DEBUG ((DEBUG_INFO, "IdeInitCalculateMode: PioMode = %x\n", (*SupportedModes)->PioMode.Mode));
1085
1086 Status = CalculateBestUdmaMode (
1087 IdentifyData,
1088 (DisqualifiedModes->UdmaMode.Valid ? ((UINT16 *)&(DisqualifiedModes->UdmaMode.Mode)) : NULL),
1089 &SelectedMode
1090 );
1091
1092 if (!EFI_ERROR (Status)) {
1093 (*SupportedModes)->UdmaMode.Valid = TRUE;
1094 (*SupportedModes)->UdmaMode.Mode = SelectedMode;
1095 } else {
1096 (*SupportedModes)->UdmaMode.Valid = FALSE;
1097 }
1098
1099 DEBUG ((DEBUG_INFO, "IdeInitCalculateMode: UdmaMode = %x\n", (*SupportedModes)->UdmaMode.Mode));
1100
1101 //
1102 // The modes other than PIO and UDMA are not supported
1103 //
1104 return EFI_SUCCESS;
1105}
1106
1131EFIAPI
1134 IN UINT8 Channel,
1135 IN UINT8 Device,
1137 )
1138{
1139 return EFI_SUCCESS;
1140}
UINT64 UINTN
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_IDE_CONTROLLER_ENUM_PHASE
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gSataControllerComponentName
Definition: ComponentName.c:14
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gSataControllerComponentName2
Definition: ComponentName.c:23
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define MIN(a, b)
Definition: Base.h:1007
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define DEBUG(Expression)
Definition: DebugLib.h:434
@ EfiPciIoAttributeOperationGet
Definition: PciIo.h:103
@ EfiPciIoAttributeOperationEnable
Definition: PciIo.h:111
@ EfiPciIoAttributeOperationSet
Definition: PciIo.h:107
@ EfiPciIoAttributeOperationSupported
Definition: PciIo.h:119
#define IS_PCI_IDE(_p)
Definition: Pci22.h:404
#define IS_PCI_SATADPA(_p)
Definition: Pci30.h:40
EFI_STATUS EFIAPI SataControllerSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
STATIC UINTN FlatDeviceIndex(IN CONST EFI_SATA_CONTROLLER_PRIVATE_DATA *Private, IN UINTN Channel, IN UINTN Device)
EFI_STATUS EFIAPI IdeInitNotifyPhase(IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This, IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase, IN UINT8 Channel)
EFI_STATUS EFIAPI InitializeSataControllerDriver(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS CalculateBestUdmaMode(IN EFI_IDENTIFY_DATA *IdentifyData, IN UINT16 *DisUDmaMode OPTIONAL, OUT UINT16 *SelectedMode)
UINT32 EFIAPI AhciReadReg(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT32 Offset)
EFI_STATUS CalculateBestPioMode(IN EFI_IDENTIFY_DATA *IdentifyData, IN UINT16 *DisPioMode OPTIONAL, OUT UINT16 *SelectedMode)
EFI_STATUS EFIAPI IdeInitSubmitData(IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This, IN UINT8 Channel, IN UINT8 Device, IN EFI_IDENTIFY_DATA *IdentifyData)
EFI_STATUS EFIAPI IdeInitSetTiming(IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This, IN UINT8 Channel, IN UINT8 Device, IN EFI_ATA_COLLECTIVE_MODE *Modes)
EFI_DRIVER_BINDING_PROTOCOL gSataControllerDriverBinding
EFI_STATUS EFIAPI SataControllerStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
EFI_STATUS EFIAPI IdeInitGetChannelInfo(IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This, IN UINT8 Channel, OUT BOOLEAN *Enabled, OUT UINT8 *MaxDevices)
EFI_STATUS EFIAPI SataControllerStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI IdeInitDisqualifyMode(IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This, IN UINT8 Channel, IN UINT8 Device, IN EFI_ATA_COLLECTIVE_MODE *BadModes)
EFI_STATUS EFIAPI IdeInitCalculateMode(IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This, IN UINT8 Channel, IN UINT8 Device, OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes)
#define AHCI_MULTI_MAX_DEVICES
#define IDE_MAX_DEVICES
#define IDE_MAX_CHANNEL
#define AHCI_MAX_DEVICES
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
EFI_IDE_CONTROLLER_SUBMIT_DATA SubmitData
EFI_IDE_CONTROLLER_DISQUALIFY_MODE DisqualifyMode
EFI_IDE_CONTROLLER_SET_TIMING SetTiming
EFI_IDE_CONTROLLER_CALCULATE_MODE CalculateMode
EFI_IDE_CONTROLLER_NOTIFY_PHASE NotifyPhase
EFI_IDE_CONTROLLER_GET_CHANNEL_INFO GetChannelInfo
UINT32 Mode
The actual ATA mode. This field is not a bit map.
BOOLEAN Valid
TRUE if Mode is valid.
EFI_PCI_IO_PROTOCOL_CONFIG Read
Definition: PciIo.h:232