/** @file
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
of the BSD License which accompanies this distribution. The
full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "LegacyBiosInterface.h"
#include <IndustryStandard/Pci.h>
// Give floppy 3 states
// FLOPPY_PRESENT_WITH_MEDIA = Floppy controller present and media is inserted
// FLOPPY_NOT_PRESENT = No floppy controller present
// FLOPPY_PRESENT_NO_MEDIA = Floppy controller present but no media inserted
//
#define FLOPPY_NOT_PRESENT 0
/**
Checks the state of the floppy and if media is inserted.
This routine checks the state of the floppy and if media is inserted.
There are 3 cases:
No floppy present - Set BBS entry to ignore
Floppy present & no media - Set BBS entry to lowest priority. We cannot
set it to ignore since 16-bit CSM will
indicate no floppy and thus drive A: is
unusable. CSM-16 will not try floppy since
lowest priority and thus not incur boot
time penality.
Floppy present & media - Set BBS entry to some priority.
@return State of floppy media
**/
)
{
HandleBuffer = NULL;
HandleCount = 0;
NULL,
);
//
// free system
//
if (HandleCount == 0) {
return FLOPPY_NOT_PRESENT;
}
);
continue;
}
continue;
}
//
// Update blockio in case the floppy is inserted in during BdsTimeout
//
continue;
}
continue;
}
);
continue;
}
return FLOPPY_PRESENT_WITH_MEDIA;
} else {
return FLOPPY_PRESENT_NO_MEDIA;
}
}
return FLOPPY_NOT_PRESENT;
}
/**
Complete build of BBS TABLE.
@param Private Legacy BIOS Instance data
@param BbsTable BBS Table passed to 16-bit code
@retval EFI_SUCCESS Removable media not present
**/
)
{
//
// First entry is floppy.
// Next 2*MAX_IDE_CONTROLLER entries are for onboard IDE.
// Next n entries are filled in after each ROM is dispatched.
// Entry filled in if follow BBS spec. See LegacyPci.c
// Next entries are for non-BBS compliant ROMS. They are filled in by
// 16-bit code during Legacy16UpdateBbs invocation. Final BootPriority
// occurs after that invocation.
//
// Floppy
// Set default state.
//
if (IsHaveMediaInFloppy == FLOPPY_PRESENT_WITH_MEDIA) {
} else {
if (IsHaveMediaInFloppy == FLOPPY_PRESENT_NO_MEDIA) {
} else {
}
}
//
// Onboard HDD - Note Each HDD controller controls 2 drives
// Master & Slave
//
//
// Get IDE Drive Info
//
//
// If no controller found or no device found set to ignore
// else set to unprioritized and set device type
//
} else {
if (Index == 0) {
if ((HddInfo[HddIndex].Status & (HDD_MASTER_IDE | HDD_MASTER_ATAPI_CDROM | HDD_MASTER_ATAPI_ZIPDISK)) != 0) {
} else {
//
// for ZIPDISK
//
}
} else {
}
} else {
if ((HddInfo[HddIndex].Status & (HDD_SLAVE_IDE | HDD_SLAVE_ATAPI_CDROM | HDD_SLAVE_ATAPI_ZIPDISK)) != 0) {
} else {
//
// for ZIPDISK
//
}
} else {
}
}
}
}
}
return EFI_SUCCESS;
}
/**
Get all BBS info
@param This Protocol instance pointer.
@param HddCount Number of HDD_INFO structures
@param HddInfo Onboard IDE controller information
@param BbsCount Number of BBS_TABLE structures
@param BbsTable List BBS entries
@retval EFI_SUCCESS Tables returned
@retval EFI_NOT_FOUND resource not found
@retval EFI_DEVICE_ERROR can not get BBS table
**/
)
{
// HDD_INFO *LocalHddInfo;
// IN BBS_TABLE *LocalBbsTable;
HandleBuffer = NULL;
// LocalHddInfo = EfiToLegacy16BootTable->HddInfo;
// LocalBbsTable = (BBS_TABLE*)(UINTN)EfiToLegacy16BootTable->BbsTable;
if (!mBbsTableDoneFlag) {
//
// Always enable disk controllers so 16-bit CSM code has valid information for all
// drives.
//
//
// Get PciRootBridgeIO protocol
//
NULL,
);
if (NumHandles == 0) {
return EFI_NOT_FOUND;
}
//
// Connect PciRootBridgeIO protocol handle with FALSE parameter to let
// PCI bus driver enumerate all subsequent handles
//
}
//
// Call into Legacy16 code to add to BBS table for non BBS compliant OPROMs.
//
//
// Pass in handoff data
//
This,
&Regs,
NULL,
0
);
return EFI_DEVICE_ERROR;
}
}
if (HandleBuffer != NULL) {
}
return EFI_SUCCESS;
}