This commit is contained in:
klu2 2007-07-11 09:39:51 +00:00
parent 5b6cc33b88
commit ee217261ff
6 changed files with 0 additions and 2460 deletions

View File

@ -1,215 +0,0 @@
/*++
Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. 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
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
fdc.h
Abstract:
Revision History
--*/
#ifndef _PEI_RECOVERY_FDC_H
#define _PEI_RECOVERY_FDC_H
//
// FDC Registers
//
#define FDC_REGISTER_DOR 2 // 0x3F2 //Digital Output Register
#define FDC_REGISTER_MSR 4 // 0x3F4 //Main Status Register
#define FDC_REGISTER_DTR 5 // 0x3F5 //Data Register
#define FDC_REGISTER_CCR 7 // 0x3F7 //Configuration Control Register(data rate select)
#define FDC_REGISTER_DIR 7 // 0x3F7 //Digital Input Register(diskchange)
//
// FDC Register Bit Definitions
//
//
// Digital Out Register(WO)
//
#define SELECT_DRV BIT0 // Select Drive: 0=A 1=B
#define RESET_FDC BIT2 // Reset FDC
#define INT_DMA_ENABLE BIT3 // Enable Int & DMA
#define DRVA_MOTOR_ON BIT4 // Turn On Drive A Motor
#define DRVB_MOTOR_ON BIT5 // Turn On Drive B Motor
//
// Main Status Register(RO)
//
#define MSR_DAB BIT0 // Drive A Busy
#define MSR_DBB BIT1 // Drive B Busy
#define MSR_CB BIT4 // FDC Busy
#define MSR_NDM BIT5 // Non-DMA Mode
#define MSR_DIO BIT6 // Data Input/Output
#define MSR_RQM BIT7 // Request For Master
//
// Configuration Control Register(WO)
//
#define CCR_DRC (BIT0 | BIT1) // Data Rate select
//
// Digital Input Register(RO)
//
#define DIR_DCL BIT7 // Disk change line
#define DRC_500KBS 0x0 // 500K
#define DRC_300KBS 0x01 // 300K
#define DRC_250KBS 0x02 // 250K
//
// FDC Command Code
//
#define READ_DATA_CMD 0x06
#define SEEK_CMD 0x0F
#define RECALIBRATE_CMD 0x07
#define SENSE_INT_STATUS_CMD 0x08
#define SPECIFY_CMD 0x03
#define SENSE_DRV_STATUS_CMD 0x04
//
// CMD_MT: Multi_Track Selector
// when set , this flag selects the multi-track operating mode.
// In this mode, the FDC treats a complete cylinder under head0 and 1 as a single track
//
#define CMD_MT BIT7
//
// CMD_MFM: MFM/FM Mode Selector
// A one selects the double density(MFM) mode
// A zero selects single density (FM) mode
//
#define CMD_MFM BIT6
//
// CMD_SK: Skip Flag
// When set to 1, sectors containing a deleted data address mark will automatically be skipped
// during the execution of Read Data.
// When set to 0, the sector is read or written the same as the read and write commands.
//
#define CMD_SK BIT5
//
// FDC Status Register Bit Definitions
//
//
// Status Register 0
//
#define STS0_IC (BIT7 | BIT6) // Interrupt Code
#define STS0_SE BIT5 // Seek End: the FDC completed a seek or recalibrate command
#define STS0_EC BIT4 // Equipment Check
#define STS0_NR BIT3 // Not Ready(unused), this bit is always 0
#define STS0_HA BIT2 // Head Address: the current head address
// STS0_US1 & STS0_US0: Drive Select(the current selected drive)
//
#define STS0_US1 BIT1 // Unit Select1
#define STS0_US0 BIT0 // Unit Select0
//
// Status Register 1
//
#define STS1_EN BIT7 // End of Cylinder
// BIT6 is unused
//
#define STS1_DE BIT5 // Data Error: The FDC detected a CRC error in either the ID field or data field of a sector
#define STS1_OR BIT4 // Overrun/Underrun: Becomes set if FDC does not receive CPU or DMA service within the required time interval
// BIT3 is unused
//
#define STS1_ND BIT2 // No data
#define STS1_NW BIT1 // Not Writable
#define STS1_MA BIT0 // Missing Address Mark
//
// Status Register 2
//
// BIT7 is unused
//
#define STS2_CM BIT6 // Control Mark
#define STS2_DD BIT5 // Data Error in Data Field: The FDC detected a CRC error in the data field
#define STS2_WC BIT4 // Wrong Cylinder: The track address from sector ID field is different from the track address maintained inside FDC
// #define STS2_SH BIT3 // Scan Equal Hit
// #define STS2_SN BIT2 // Scan Not Satisfied
// BIT3 is unused
// BIT2 is unused
//
#define STS2_BC BIT1 // Bad Cylinder
#define STS2_MD BIT0 // Missing Address Mark in DataField
// Status Register 3
// #define STS3_FT BIT7 // Fault
// BIT7 is unused
//
#define STS3_WP BIT6 // Write Protected
// #define STS3_RDY BIT5 // Ready
// BIT5 is unused
//
#define STS3_T0 BIT4 // Track 0
// #define STS3_TS BIT3 // Two Side
// BIT3 is unused
//
#define STS3_HD BIT2 // Head Address
// STS3_US1 & STS3_US0 : Drive Select
//
#define STS3_US1 BIT1 // Unit Select1
#define STS3_US0 BIT0 // Unit Select0
//
// Status Register 0 Interrupt Code Description
//
#define IC_NT 0x0 // Normal Termination of Command
#define IC_AT 0x40 // Abnormal Termination of Command
#define IC_IC 0x80 // Invalid Command
#define IC_ATRC 0xC0 // Abnormal Termination caused by Polling
typedef struct {
UINT8 EOT; // End of track
UINT8 GPL; // Gap length
UINT8 DTL; // Data length
UINT8 Number; // Number of bytes per sector
UINT8 MaxTrackNum;
UINT8 MotorStartTime;
UINT8 MotorOffTime;
UINT8 HeadSettlingTime;
UINT8 DataTransferRate;
} DISKET_PARA_TABLE;
typedef struct {
UINT8 CommandCode;
UINT8 DiskHeadSel;
UINT8 Cylinder;
UINT8 Head;
UINT8 Sector;
UINT8 Number;
UINT8 EndOfTrack;
UINT8 GapLength;
UINT8 DataLength;
} FDC_COMMAND_PACKET1;
typedef struct {
UINT8 CommandCode;
UINT8 DiskHeadSel;
} FDC_COMMAND_PACKET2;
typedef struct {
UINT8 CommandCode;
UINT8 SrtHut;
UINT8 HltNd;
} FDC_SPECIFY_CMD;
typedef struct {
UINT8 CommandCode;
UINT8 DiskHeadSel;
UINT8 NewCylinder;
} FDC_SEEK_CMD;
typedef struct {
UINT8 Status0;
UINT8 Status1;
UINT8 Status2;
UINT8 C;
UINT8 H;
UINT8 S;
UINT8 Number;
} FDC_RESULT_PACKET;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +0,0 @@
/*++
Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. 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
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
floppypeim.dxs
Abstract:
Dependency expression file for Status Code PEIM.
--*/
#include <PeimDepex.h>
DEPENDENCY_START
EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID AND
EFI_PEI_FV_FILE_LOADER_GUID AND
EFI_PEI_BOOT_IN_RECOVERY_MODE_PEIM_PPI
DEPENDENCY_END

View File

@ -1,254 +0,0 @@
/*++
Copyright (c) 2006 - 2007, Intel Corporation<BR>
All rights reserved. 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
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
FloppyPeim.h
Abstract:
Revision History
--*/
#ifndef _RECOVERY_FLOPPY_H
#define _RECOVERY_FLOPPY_H
//
// The package level header files this module uses
//
#include <PiPei.h>
#include <FrameworkPei.h>
#include <Ppi/BlockIo.h>
//
// The Library classes this module consumes
//
#include <Library/DebugLib.h>
#include <Library/PeimEntryPoint.h>
#include <Library/PeiServicesLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <Library/TimerLib.h>
#include <Library/IoLib.h>
#include "Fdc.h"
//
// define some macro
//
#define STALL_1_SECOND 1000000
#define STALL_1_MSECOND 1000
#define DATA_IN 1
#define DATA_OUT 0
#define READ 0
#define WRITE 1
typedef enum {
_360K_360K = 0,
_360K_1200K,
_1200K_1200K,
_720K_720K,
_720K_1440K,
_1440K_1440K,
_720K_2880K,
_1440K_2880K,
_2880K_2880K
} FDC_DISKET_TYPE;
typedef struct {
UINT8 DevPos;
UINT8 Pcn;
BOOLEAN MotorOn;
BOOLEAN NeedRecalibrate;
FDC_DISKET_TYPE Type;
EFI_PEI_BLOCK_IO_MEDIA MediaInfo;
} PEI_FLOPPY_DEVICE_INFO;
#define FDC_BLK_IO_DEV_SIGNATURE EFI_SIGNATURE_32 ('F', 'b', 'i', 'o')
typedef struct {
UINTN Signature;
EFI_PEI_RECOVERY_BLOCK_IO_PPI FdcBlkIo;
EFI_PEI_PPI_DESCRIPTOR PpiDescriptor;
UINTN DeviceCount;
PEI_FLOPPY_DEVICE_INFO DeviceInfo[2];
} FDC_BLK_IO_DEV;
#define PEI_RECOVERY_FDC_FROM_BLKIO_THIS(a) CR (a, FDC_BLK_IO_DEV, FdcBlkIo, FDC_BLK_IO_DEV_SIGNATURE)
//
// PEI Recovery Block I/O PPI
//
EFI_STATUS
EFIAPI
FdcGetNumberOfBlockDevices (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,
OUT UINTN *NumberBlockDevices
);
EFI_STATUS
EFIAPI
FdcGetBlockDeviceMediaInfo (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,
IN UINTN DeviceIndex,
OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo
);
EFI_STATUS
EFIAPI
FdcReadBlocks (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,
IN UINTN DeviceIndex,
IN EFI_PEI_LBA StartLba,
IN UINTN BufferSize,
OUT VOID *Buffer
);
//
// Internal function declare
//
UINT8
FdcEnumeration (
IN FDC_BLK_IO_DEV *FdcBlkIoDev
);
EFI_STATUS
FdcReset (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN UINT8 DevPos
);
BOOLEAN
DiscoverFdcDevice (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN OUT PEI_FLOPPY_DEVICE_INFO *Info,
OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo
);
EFI_STATUS
Recalibrate (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN OUT PEI_FLOPPY_DEVICE_INFO *Info
);
EFI_STATUS
Seek (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN OUT PEI_FLOPPY_DEVICE_INFO *Info,
IN EFI_PEI_LBA Lba
);
EFI_STATUS
MotorOn (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN OUT PEI_FLOPPY_DEVICE_INFO *Info
);
EFI_STATUS
MotorOff (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN OUT PEI_FLOPPY_DEVICE_INFO *Info
);
EFI_STATUS
FdcWaitForBSYClear (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN UINT8 DevPos,
IN UINTN TimeoutInSeconds
);
EFI_STATUS
SenseIntStatus (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN OUT UINT8 *sts0,
IN OUT UINT8 *pcn
);
EFI_STATUS
Specify (
IN FDC_BLK_IO_DEV *FdcBlkIoDev
);
EFI_STATUS
DisketChanged (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN OUT PEI_FLOPPY_DEVICE_INFO *Info
);
EFI_STATUS
DataInByte (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN OUT UINT8 *pt
);
EFI_STATUS
DataOutByte (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN UINT8 *pt
);
EFI_STATUS
FdcDRQReady (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN BOOLEAN Dio,
IN UINTN TimeoutInSeconds
);
UINTN
GetTransferBlockCount (
IN PEI_FLOPPY_DEVICE_INFO *Info,
IN EFI_PEI_LBA LBA,
IN UINTN NumberOfBlocks
);
EFI_STATUS
ReadWriteDataSector (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN OUT PEI_FLOPPY_DEVICE_INFO *Info,
IN VOID *Buffer,
IN EFI_PEI_LBA Lba,
IN UINTN NumberOfBlocks,
IN BOOLEAN Read
);
EFI_STATUS
SetDMA (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN VOID *Buffer,
IN UINTN NumberOfBlocks,
IN BOOLEAN Read
);
VOID
FillPara (
IN PEI_FLOPPY_DEVICE_INFO *Info,
IN EFI_PEI_LBA Lba,
IN FDC_COMMAND_PACKET1 *Command
);
EFI_STATUS
Setup (
IN FDC_BLK_IO_DEV *FdcBlkIoDev,
IN UINT8 DevPos
);
EFI_STATUS
CheckResult (
IN FDC_RESULT_PACKET *Result,
IN OUT PEI_FLOPPY_DEVICE_INFO *Info
);
#endif

View File

@ -1,99 +0,0 @@
#/** @file
# Floppy Peim to support Fv Recovery.
#
# This module detects Floppy devices. If found, it will install BlockIo PPI.
# This module is only dispatched in Recovery Boot mode.
#
# Copyright (c) 2006 - 2007, Intel Corporation<BR>
# All rights reserved. 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
# http://opensource.org/licenses/bsd-license.php
#
#
#**/
################################################################################
#
# Defines Section - statements that will be processed to create a Makefile.
#
################################################################################
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = FloppyPeim
FILE_GUID = B7A5041B-78BA-48e3-B63B-44C7578113B6
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = FdcPeimEntry
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
################################################################################
#
# Sources Section - list of files that are required for the build to succeed.
#
################################################################################
[Sources.common]
FloppyPeim.c
FloppyPeim.h
Fdc.h
################################################################################
#
# Package Dependency Section - list of Package files that are required for
# this module.
#
################################################################################
[Packages]
MdePkg/MdePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
################################################################################
#
# Library Class Section - list of Library Classes that are required for
# this module.
#
################################################################################
[LibraryClasses]
IoLib
TimerLib
ReportStatusCodeLib
BaseMemoryLib
PeiServicesLib
PeimEntryPoint
DebugLib
################################################################################
#
# PPI C Name Section - list of PPI and PPI Notify C Names that this module
# uses or produces.
#
################################################################################
[Ppis]
gEfiPei144FloppyBlockIoPpiGuid # PPI ALWAYS_PRODUCED
################################################################################
#
# Dependency Expression Section - list of Dependency expressions that are required for
# this module.
#
################################################################################
[Depex]
gEfiPeiMemoryDiscoveredPpiGuid AND gEfiPeiLoadFilePpiGuid AND gEfiPeiBootInRecoveryModePpiGuid

View File

@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ModuleSurfaceArea xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd" xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MsaHeader>
<ModuleName>FloppyPeim</ModuleName>
<ModuleType>PEIM</ModuleType>
<GuidValue>B7A5041B-78BA-48e3-B63B-44C7578113B6</GuidValue>
<Version>1.0</Version>
<Abstract>Floppy Peim to support Fv Recovery.</Abstract>
<Description>This module detects Floppy devices. If found, it will install BlockIo PPI.
This module is only dispatched in Recovery Boot mode.</Description>
<Copyright>Copyright (c) 2006 - 2007, Intel Corporation<BR></Copyright>
<License>
All rights reserved. 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
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</License>
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
</MsaHeader>
<ModuleDefinitions>
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
<BinaryModule>false</BinaryModule>
<OutputFileBasename>FloppyPeim</OutputFileBasename>
</ModuleDefinitions>
<LibraryClassDefinitions>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DebugLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>PeimEntryPoint</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>PeiServicesLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseMemoryLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>ReportStatusCodeLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>TimerLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>IoLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>floppypeim.dxs</Filename>
<Filename>fdc.h</Filename>
<Filename>floppypeim.h</Filename>
<Filename>FloppyPeim.c</Filename>
</SourceFiles>
<PackageDependencies>
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Package PackageGuid="bea835f9-fd62-464a-81ff-f3a806360c6b"/>
</PackageDependencies>
<PPIs>
<Ppi Usage="ALWAYS_PRODUCED">
<PpiCName>gEfiPeiBlockIoPpiGuid</PpiCName>
</Ppi>
</PPIs>
<Externs>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern>
<ModuleEntryPoint>FdcPeimEntry</ModuleEntryPoint>
</Extern>
</Externs>
</ModuleSurfaceArea>