33 IN EFI_HANDLE Controller
38 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *BlockIoInfos;
39 UINTN BlockIoInfoIndex;
44 Status =
gBS->OpenProtocolInformation (
50 if (EFI_ERROR (Status)) {
51 DEBUG ((DEBUG_INFO,
"OCDC: Attached drivers could not been retrieved\n"));
55 for (BlockIoInfoIndex = 0; BlockIoInfoIndex < NumBlockIoInfo; ++BlockIoInfoIndex) {
56 if ((BlockIoInfos[BlockIoInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
57 Status =
gBS->DisconnectController (
59 BlockIoInfos[BlockIoInfoIndex].AgentHandle,
62 if (EFI_ERROR (Status)) {
65 "OCDC: Failed to unblock handle %p - %r\n",
73 FreePool (BlockIoInfos);
148 EFI_HANDLE *HandleBuffer;
149 EFI_PCI_IO_PROTOCOL *PciIo;
155 Status =
gBS->LocateHandleBuffer (
157 &gEfiPciIoProtocolGuid,
162 if (!EFI_ERROR (Status)) {
163 DEBUG ((DEBUG_INFO,
"OCDC: Found %u handles with PCI I/O\n", (UINT32)HandleCount));
164 for (Index = 0; Index < HandleCount; Index++) {
165 Status =
gBS->HandleProtocol (
167 &gEfiPciIoProtocolGuid,
170 if (EFI_ERROR (Status)) {
174 Status = PciIo->Pci.Read (
178 sizeof (Pci) /
sizeof (UINT32),
181 if (!EFI_ERROR (Status)) {
182 if (IS_PCI_VGA (&Pci) == TRUE) {
183 Status =
gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
184 DEBUG ((DEBUG_INFO,
"OCDC: Disconnected graphics driver handle %u - %p result - %r\n", Index, HandleBuffer[Index], Status));
189 FreePool (HandleBuffer);
202 EFI_HANDLE *HandleBuffer;
203 EFI_PCI_IO_PROTOCOL *PciIo;
209 Status =
gBS->LocateHandleBuffer (
211 &gEfiPciIoProtocolGuid,
216 if (!EFI_ERROR (Status)) {
217 DEBUG ((DEBUG_INFO,
"OCDC: Found %u handles with PCI I/O\n", (UINT32)HandleCount));
218 for (Index = 0; Index < HandleCount; Index++) {
219 Status =
gBS->HandleProtocol (
221 &gEfiPciIoProtocolGuid,
224 if (EFI_ERROR (Status)) {
231 Status = PciIo->Pci.Read (
234 PCI_CLASSCODE_OFFSET,
242 if ( EFI_ERROR (Status)
243 || (HdaClassReg.
BaseCode != PCI_CLASS_MEDIA)
244 || (HdaClassReg.
SubClassCode != PCI_CLASS_MEDIA_MIXED_MODE))
250 Status =
gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
251 DEBUG ((DEBUG_INFO,
"OCDC: Disconnected - %r\n", Status));
254 FreePool (HandleBuffer);