Initial import.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
commit
878ddf1fc3
BIN
DeveloperManual.doc
Normal file
BIN
DeveloperManual.doc
Normal file
Binary file not shown.
40
EdkFatBinPkg/EdkFatBinPkg.spd
Normal file
40
EdkFatBinPkg/EdkFatBinPkg.spd
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<PackageSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<SpdHeader>
|
||||
<PackageName>EdkFatBinPkg</PackageName>
|
||||
<Guid>0fd7197b-9bde-44fe-a7e4-d2177a9922e5</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>This is the Binary Package for the FAT dirver</Abstract>
|
||||
<Description>This package provides FAT drivers which are not licensed under BSD.</Description>
|
||||
<Copyright>Copyright (c) 2004, Intel Corporation.</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>
|
||||
<Created>2006-03-05 09:49</Created>
|
||||
<Updated>2006-03-19 16:18</Updated>
|
||||
<URL>http://www.TianoCore.org</URL>
|
||||
<PackageType>BINARY</PackageType>
|
||||
<ReadOnly>true</ReadOnly>
|
||||
<RePackage>false</RePackage>
|
||||
</SpdHeader>
|
||||
<MsaFiles>
|
||||
<MsaFile>
|
||||
<Filename>Fat.msa</Filename>
|
||||
</MsaFile>
|
||||
</MsaFiles>
|
||||
</PackageSurfaceArea>
|
34
EdkFatBinPkg/Fat.mbd
Normal file
34
EdkFatBinPkg/Fat.mbd
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>Fat</BaseName>
|
||||
<Guid>5058F21C-BC34-11d4-BD18-0080C73C8881</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>This is the FAT 32 EFI/Tiano Driver
|
||||
</Description>
|
||||
<Copyright>Copyright 2004, Intel Corporation</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>
|
||||
<Created>2006-03-17 20:56</Created>
|
||||
<Modified>2006-03-19 16:17</Modified>
|
||||
</MbdHeader>
|
||||
<BuildOptions>
|
||||
<Option>copy ${SOURCE_DIR}\${PROCESSOR}\Fat.FFS ${BIN_DIR}\5058F21C-BC34-11d4-BD18-0080C73C8881-Fat.DXE /y</Option>
|
||||
</BuildOptions>
|
||||
</ModuleBuildDescription>
|
53
EdkFatBinPkg/Fat.msa
Normal file
53
EdkFatBinPkg/Fat.msa
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>Fat</BaseName>
|
||||
<ModuleType>PEIM</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>5058F21C-BC34-11d4-BD18-0080C73C8881</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Make a FFS section for an FV that contains the FAT driver.*.FFS files are compressed FFS sections.</Abstract>
|
||||
<Description>This is the FAT 32 EFI/Tiano Driver</Description>
|
||||
<Copyright>Copyright 2004, Intel Corporation</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>0</Specification>
|
||||
<Created>2006-03-17 20:56</Created>
|
||||
<Updated>2006-03-19 16:17</Updated>
|
||||
</MsaHeader>
|
||||
<SourceFiles>
|
||||
<Arch ArchType="IA32">
|
||||
<Filename Path="Ia32" FileType="FFS">Fat.FFS</Filename>
|
||||
</Arch>
|
||||
<Arch ArchType="IPF">
|
||||
<Filename Path="Ipf" FileType="FFS">Fat.FFS</Filename>
|
||||
</Arch>
|
||||
<Arch ArchType="X64">
|
||||
<Filename Path="X64" FileType="FFS">Fat.FFS</Filename>
|
||||
</Arch>
|
||||
</SourceFiles>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint></ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
<BuildOptions>
|
||||
<Option>BUILD_TYPE=CUSTOM_BUILD</Option>
|
||||
</BuildOptions>
|
||||
</ModuleSurfaceArea>
|
36
EdkFatBinPkg/Fat_build.xml
Normal file
36
EdkFatBinPkg/Fat_build.xml
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<project name="Fat" default="main" basedir="." >
|
||||
<!-- Apply external ANT task -->
|
||||
<taskdef resource="frameworktasks.tasks" />
|
||||
<taskdef resource="cpptasks.tasks" />
|
||||
<typedef resource="cpptasks.types" />
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
||||
<property environment="env" />
|
||||
<!-- All Properties -->
|
||||
<property name="BASE_NAME" value="Fat" />
|
||||
|
||||
<!-- Default target -->
|
||||
<target name="main" depends="libraries, sourcefiles, sections, output" />
|
||||
<!-- Compile all dependency Library instances. -->
|
||||
<target name="libraries" />
|
||||
|
||||
<target name="sourcefiles" />
|
||||
|
||||
<target name="sections" />
|
||||
|
||||
<target name="output">
|
||||
<copy file="${MODULE_DIR}\${ARCH}\${BASE_NAME}.FFS"
|
||||
tofile="${BIN_DIR}\${FILE_GUID}-${BASE_NAME}.DXE" />
|
||||
</target>
|
||||
|
||||
</project>
|
BIN
EdkFatBinPkg/Ia32/Fat.FFS
Normal file
BIN
EdkFatBinPkg/Ia32/Fat.FFS
Normal file
Binary file not shown.
BIN
EdkFatBinPkg/Ipf/Fat.FFS
Normal file
BIN
EdkFatBinPkg/Ipf/Fat.FFS
Normal file
Binary file not shown.
BIN
EdkFatBinPkg/X64/Fat.FFS
Normal file
BIN
EdkFatBinPkg/X64/Fat.FFS
Normal file
Binary file not shown.
47
EdkFatBinPkg/build.xml
Normal file
47
EdkFatBinPkg/build.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
|
||||
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.-->
|
||||
<project basedir="." default="Fat"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="."/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="Fat">
|
||||
<GenBuild baseName="Fat" mbdFilename="${MODULE_DIR}\Fat.mbd" msaFilename="${MODULE_DIR}\Fat.msa"/>
|
||||
</target>
|
||||
<target depends="Fat_clean" name="clean"/>
|
||||
<target depends="Fat_cleanall" name="cleanall"/>
|
||||
<target name="Fat_clean">
|
||||
<OutputDirSetup baseName="Fat" mbdFilename="${MODULE_DIR}\Fat.mbd" msaFilename="${MODULE_DIR}\Fat.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\Fat_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\Fat_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="Fat_cleanall">
|
||||
<OutputDirSetup baseName="Fat" mbdFilename="${MODULE_DIR}\Fat.mbd" msaFilename="${MODULE_DIR}\Fat.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\Fat_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\Fat_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**Fat*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
18
EdkFatBinPkg/genbuildfile.xml
Normal file
18
EdkFatBinPkg/genbuildfile.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<project default="workspace" basedir=".">
|
||||
<taskdef resource="GenBuild.tasks" />
|
||||
|
||||
<target name="workspace">
|
||||
<bf recursive="true" />
|
||||
</target>
|
||||
</project>
|
47
EdkModulePkg/Application/HelloWorld/HelloWorld.c
Normal file
47
EdkModulePkg/Application/HelloWorld/HelloWorld.c
Normal file
@ -0,0 +1,47 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
HelloWorld.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver supports platform security service
|
||||
|
||||
--*/
|
||||
|
||||
VOID
|
||||
Print (
|
||||
IN CONST CHAR16 *Format,
|
||||
...
|
||||
)
|
||||
{
|
||||
CHAR16 PrintBuffer[0x100];
|
||||
VA_LIST Marker;
|
||||
|
||||
VA_START (Marker, Format);
|
||||
UnicodeVSPrint (PrintBuffer, sizeof (PrintBuffer), Format, Marker);
|
||||
gST->ConOut->OutputString (gST->ConOut, PrintBuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UefiMain (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
|
||||
{
|
||||
Print ((CHAR16 *)L"UEFI Hello World!\n");
|
||||
return EFI_SUCCESS;
|
||||
}
|
43
EdkModulePkg/Application/HelloWorld/HelloWorld.mbd
Normal file
43
EdkModulePkg/Application/HelloWorld/HelloWorld.mbd
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>HelloWorld</BaseName>
|
||||
<Guid>6987936E-ED34-44db-AE97-1FA5E4ED2116</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Modified>2006-03-20 20:41</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>UefiDebugLibStdErr</Library>
|
||||
<Library>BasePrintLib</Library>
|
||||
</Libraries>
|
||||
<BuildOptions ToolChain="MSFT">
|
||||
<ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>
|
||||
<Option>TARGET_BS_DRIVER=HelloWorld</Option>
|
||||
</BuildOptions>
|
||||
</ModuleBuildDescription>
|
51
EdkModulePkg/Application/HelloWorld/HelloWorld.msa
Normal file
51
EdkModulePkg/Application/HelloWorld/HelloWorld.msa
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>HelloWorld</BaseName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<ComponentType>APPLICATION</ComponentType>
|
||||
<Guid>6987936E-ED34-44db-AE97-1FA5E4ED2116</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for SecurityStub module</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>0</Specification>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Updated>2006-03-20 20:41</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">PrintLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>HelloWorld.c</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
</Includes>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>UefiMain</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
47
EdkModulePkg/Application/HelloWorld/build.xml
Normal file
47
EdkModulePkg/Application/HelloWorld/build.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
|
||||
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.-->
|
||||
<project basedir="." default="HelloWorld"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Application\HelloWorld"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="HelloWorld">
|
||||
<GenBuild baseName="HelloWorld" mbdFilename="${MODULE_DIR}\HelloWorld.mbd" msaFilename="${MODULE_DIR}\HelloWorld.msa"/>
|
||||
</target>
|
||||
<target depends="HelloWorld_clean" name="clean"/>
|
||||
<target depends="HelloWorld_cleanall" name="cleanall"/>
|
||||
<target name="HelloWorld_clean">
|
||||
<OutputDirSetup baseName="HelloWorld" mbdFilename="${MODULE_DIR}\HelloWorld.mbd" msaFilename="${MODULE_DIR}\HelloWorld.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\HelloWorld_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\HelloWorld_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="HelloWorld_cleanall">
|
||||
<OutputDirSetup baseName="HelloWorld" mbdFilename="${MODULE_DIR}\HelloWorld.mbd" msaFilename="${MODULE_DIR}\HelloWorld.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\HelloWorld_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\HelloWorld_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**HelloWorld*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
2226
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.c
Normal file
2226
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.c
Normal file
File diff suppressed because it is too large
Load Diff
916
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.h
Normal file
916
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.h
Normal file
@ -0,0 +1,916 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
AtapiPassThru.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Revision History
|
||||
--*/
|
||||
|
||||
#ifndef _APT_H
|
||||
#define _APT_H
|
||||
|
||||
|
||||
#include <IndustryStandard/Pci22.h>
|
||||
|
||||
//
|
||||
// bit definition
|
||||
//
|
||||
#define bit(a) 1 << (a)
|
||||
|
||||
#define MAX_TARGET_ID 4
|
||||
//
|
||||
// IDE Registers
|
||||
//
|
||||
typedef union {
|
||||
UINT16 Command; /* when write */
|
||||
UINT16 Status; /* when read */
|
||||
} IDE_CMD_OR_STATUS;
|
||||
|
||||
typedef union {
|
||||
UINT16 Error; /* when read */
|
||||
UINT16 Feature; /* when write */
|
||||
} IDE_ERROR_OR_FEATURE;
|
||||
|
||||
typedef union {
|
||||
UINT16 AltStatus; /* when read */
|
||||
UINT16 DeviceControl; /* when write */
|
||||
} IDE_AltStatus_OR_DeviceControl;
|
||||
|
||||
//
|
||||
// IDE registers set
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 Data;
|
||||
IDE_ERROR_OR_FEATURE Reg1;
|
||||
UINT16 SectorCount;
|
||||
UINT16 SectorNumber;
|
||||
UINT16 CylinderLsb;
|
||||
UINT16 CylinderMsb;
|
||||
UINT16 Head;
|
||||
IDE_CMD_OR_STATUS Reg;
|
||||
|
||||
IDE_AltStatus_OR_DeviceControl Alt;
|
||||
UINT16 DriveAddress;
|
||||
|
||||
UINT16 MasterSlave;
|
||||
} IDE_BASE_REGISTERS;
|
||||
|
||||
#define ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE EFI_SIGNATURE_32 ('a', 's', 'p', 't')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
|
||||
EFI_HANDLE Handle;
|
||||
EFI_SCSI_PASS_THRU_PROTOCOL ScsiPassThru;
|
||||
EFI_SCSI_PASS_THRU_MODE ScsiPassThruMode;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
|
||||
//
|
||||
// Local Data goes here
|
||||
//
|
||||
IDE_BASE_REGISTERS *IoPort;
|
||||
|
||||
CHAR16 ControllerName[100];
|
||||
CHAR16 ChannelName[100];
|
||||
|
||||
UINT32 LatestTargetId;
|
||||
UINT64 LatestLun;
|
||||
|
||||
} ATAPI_SCSI_PASS_THRU_DEV;
|
||||
|
||||
#define ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS(a) \
|
||||
CR (a, \
|
||||
ATAPI_SCSI_PASS_THRU_DEV, \
|
||||
ScsiPassThru, \
|
||||
ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE \
|
||||
)
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gAtapiScsiPassThruDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName;
|
||||
|
||||
//
|
||||
// ATAPI Command op code
|
||||
//
|
||||
#define OP_INQUIRY 0x12
|
||||
#define OP_LOAD_UNLOAD_CD 0xa6
|
||||
#define OP_MECHANISM_STATUS 0xbd
|
||||
#define OP_MODE_SELECT_10 0x55
|
||||
#define OP_MODE_SENSE_10 0x5a
|
||||
#define OP_PAUSE_RESUME 0x4b
|
||||
#define OP_PLAY_AUDIO_10 0x45
|
||||
#define OP_PLAY_AUDIO_MSF 0x47
|
||||
#define OP_PLAY_CD 0xbc
|
||||
#define OP_PLAY_CD_MSF 0xb4
|
||||
#define OP_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
|
||||
#define OP_READ_10 0x28
|
||||
#define OP_READ_12 0xa8
|
||||
#define OP_READ_CAPACITY 0x25
|
||||
#define OP_READ_CD 0xbe
|
||||
#define OP_READ_CD_MSF 0xb9
|
||||
#define OP_READ_HEADER 0x44
|
||||
#define OP_READ_SUB_CHANNEL 0x42
|
||||
#define OP_READ_TOC 0x43
|
||||
#define OP_REQUEST_SENSE 0x03
|
||||
#define OP_SCAN 0xba
|
||||
#define OP_SEEK_10 0x2b
|
||||
#define OP_SET_CD_SPEED 0xbb
|
||||
#define OP_STOPPLAY_SCAN 0x4e
|
||||
#define OP_START_STOP_UNIT 0x1b
|
||||
#define OP_TEST_UNIT_READY 0x00
|
||||
|
||||
#define OP_FORMAT_UNIT 0x04
|
||||
#define OP_READ_FORMAT_CAPACITIES 0x23
|
||||
#define OP_VERIFY 0x2f
|
||||
#define OP_WRITE_10 0x2a
|
||||
#define OP_WRITE_12 0xaa
|
||||
#define OP_WRITE_AND_VERIFY 0x2e
|
||||
|
||||
//
|
||||
// ATA Command
|
||||
//
|
||||
#define ATAPI_SOFT_RESET_CMD 0x08
|
||||
|
||||
typedef enum {
|
||||
DataIn = 0,
|
||||
DataOut = 1,
|
||||
NoData = 2,
|
||||
End = 0xff
|
||||
} DATA_DIRECTION;
|
||||
|
||||
typedef struct {
|
||||
UINT8 OpCode;
|
||||
DATA_DIRECTION Direction;
|
||||
} SCSI_COMMAND_SET;
|
||||
|
||||
#define MAX_CHANNEL 2
|
||||
|
||||
#define ValidCdbLength(Len) ((Len) == 6 || (Len) == 10 || (Len) == 12) ? 1 : 0
|
||||
|
||||
//
|
||||
// IDE registers bit definitions
|
||||
//
|
||||
// ATA Err Reg bitmap
|
||||
//
|
||||
#define BBK_ERR bit (7) /* Bad block detected */
|
||||
#define UNC_ERR bit (6) /* Uncorrectable Data */
|
||||
#define MC_ERR bit (5) /* Media Change */
|
||||
#define IDNF_ERR bit (4) /* ID Not Found */
|
||||
#define MCR_ERR bit (3) /* Media Change Requested */
|
||||
#define ABRT_ERR bit (2) /* Aborted Command */
|
||||
#define TK0NF_ERR bit (1) /* Track 0 Not Found */
|
||||
#define AMNF_ERR bit (0) /* Address Mark Not Found */
|
||||
|
||||
//
|
||||
// ATAPI Err Reg bitmap
|
||||
//
|
||||
#define SENSE_KEY_ERR (bit (7) | bit (6) | bit (5) | bit (4))
|
||||
#define EOM_ERR bit (1) /* End of Media Detected */
|
||||
#define ILI_ERR bit (0) /* Illegal Length Indication */
|
||||
|
||||
//
|
||||
// Device/Head Reg
|
||||
//
|
||||
#define LBA_MODE bit (6)
|
||||
#define DEV bit (4)
|
||||
#define HS3 bit (3)
|
||||
#define HS2 bit (2)
|
||||
#define HS1 bit (1)
|
||||
#define HS0 bit (0)
|
||||
#define CHS_MODE (0)
|
||||
#define DRV0 (0)
|
||||
#define DRV1 (1)
|
||||
#define MST_DRV DRV0
|
||||
#define SLV_DRV DRV1
|
||||
|
||||
//
|
||||
// Status Reg
|
||||
//
|
||||
#define BSY bit (7) /* Controller Busy */
|
||||
#define DRDY bit (6) /* Drive Ready */
|
||||
#define DWF bit (5) /* Drive Write Fault */
|
||||
#define DSC bit (4) /* Disk Seek Complete */
|
||||
#define DRQ bit (3) /* Data Request */
|
||||
#define CORR bit (2) /* Corrected Data */
|
||||
#define IDX bit (1) /* Index */
|
||||
#define ERR bit (0) /* Error */
|
||||
#define CHECK bit (0) /* Check bit for ATAPI Status Reg */
|
||||
|
||||
//
|
||||
// Device Control Reg
|
||||
//
|
||||
#define SRST bit (2) /* Software Reset */
|
||||
#define IEN_L bit (1) /* Interrupt Enable #*/
|
||||
|
||||
//
|
||||
// ATAPI Feature Register
|
||||
//
|
||||
#define OVERLAP bit (1)
|
||||
#define DMA bit (0)
|
||||
|
||||
//
|
||||
// ATAPI Interrupt Reason Reson Reg (ATA Sector Count Register)
|
||||
//
|
||||
#define RELEASE bit (2)
|
||||
#define IO bit (1)
|
||||
#define CoD bit (0)
|
||||
|
||||
#define PACKET_CMD 0xA0
|
||||
|
||||
#define DEFAULT_CMD (0xa0)
|
||||
//
|
||||
// default content of device control register, disable INT
|
||||
//
|
||||
#define DEFAULT_CTL (0x0a)
|
||||
#define MAX_ATAPI_BYTE_COUNT (0xfffe)
|
||||
|
||||
//
|
||||
// function prototype
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtapiScsiPassThruDriverEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - TODO: add argument description
|
||||
SystemTable - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RegisterAtapiScsiPassThru (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Controller - TODO: add argument description
|
||||
PciIo - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtapiScsiPassThruFunction (
|
||||
IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT32 Target,
|
||||
IN UINT64 Lun,
|
||||
IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
|
||||
IN EFI_EVENT Event OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Target - TODO: add argument description
|
||||
Lun - TODO: add argument description
|
||||
Packet - TODO: add argument description
|
||||
Event - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtapiScsiPassThruGetNextDevice (
|
||||
IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN OUT UINT32 *Target,
|
||||
IN OUT UINT64 *Lun
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Target - TODO: add argument description
|
||||
Lun - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtapiScsiPassThruBuildDevicePath (
|
||||
IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT32 Target,
|
||||
IN UINT64 Lun,
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Target - TODO: add argument description
|
||||
Lun - TODO: add argument description
|
||||
DevicePath - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtapiScsiPassThruGetTargetLun (
|
||||
IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT UINT32 *Target,
|
||||
OUT UINT64 *Lun
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
DevicePath - TODO: add argument description
|
||||
Target - TODO: add argument description
|
||||
Lun - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtapiScsiPassThruResetChannel (
|
||||
IN EFI_SCSI_PASS_THRU_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtapiScsiPassThruResetTarget (
|
||||
IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT32 Target,
|
||||
IN UINT64 Lun
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Target - TODO: add argument description
|
||||
Lun - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CheckSCSIRequestPacket (
|
||||
EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Packet - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SubmitBlockingIoCommand (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
|
||||
UINT32 Target,
|
||||
EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
Target - TODO: add argument description
|
||||
Packet - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
IsCommandValid (
|
||||
EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Packet - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RequestSenseCommand (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
|
||||
UINT32 Target,
|
||||
UINT64 Timeout,
|
||||
VOID *SenseData,
|
||||
UINT8 *SenseDataLength
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
Target - TODO: add argument description
|
||||
Timeout - TODO: add argument description
|
||||
SenseData - TODO: add argument description
|
||||
SenseDataLength - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AtapiPacketCommand (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
|
||||
UINT32 Target,
|
||||
UINT8 *PacketCommand,
|
||||
VOID *Buffer,
|
||||
UINT32 *ByteCount,
|
||||
DATA_DIRECTION Direction,
|
||||
UINT64 TimeOutInMicroSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
Target - TODO: add argument description
|
||||
PacketCommand - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
ByteCount - TODO: add argument description
|
||||
Direction - TODO: add argument description
|
||||
TimeOutInMicroSeconds - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
UINT8
|
||||
ReadPortB (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT16 Port
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIo - TODO: add argument description
|
||||
Port - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
UINT16
|
||||
ReadPortW (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT16 Port
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIo - TODO: add argument description
|
||||
Port - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
VOID
|
||||
WritePortB (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT16 Port,
|
||||
IN UINT8 Data
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIo - TODO: add argument description
|
||||
Port - TODO: add argument description
|
||||
Data - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
VOID
|
||||
WritePortW (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT16 Port,
|
||||
IN UINT16 Data
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIo - TODO: add argument description
|
||||
Port - TODO: add argument description
|
||||
Data - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
StatusDRQClear (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
|
||||
UINT64 TimeOutInMicroSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
TimeOutInMicroSeconds - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AltStatusDRQClear (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
|
||||
UINT64 TimeOutInMicroSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
TimeOutInMicroSeconds - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
StatusDRQReady (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
|
||||
UINT64 TimeOutInMicroSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
TimeOutInMicroSeconds - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AltStatusDRQReady (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
|
||||
UINT64 TimeOutInMicroSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
TimeOutInMicroSeconds - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
StatusWaitForBSYClear (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
|
||||
UINT64 TimeoutInMicroSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
TimeoutInMicroSeconds - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AltStatusWaitForBSYClear (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
|
||||
UINT64 TimeoutInMicroSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
TimeoutInMicroSeconds - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
StatusDRDYReady (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
|
||||
UINT64 TimeoutInMicroSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
TimeoutInMicroSeconds - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AltStatusDRDYReady (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
|
||||
UINT64 TimeoutInMicroSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
TimeoutInMicroSeconds - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AtapiPassThruPioReadWriteData (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
|
||||
UINT16 *Buffer,
|
||||
UINT32 *ByteCount,
|
||||
DATA_DIRECTION Direction,
|
||||
UINT64 TimeOutInMicroSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
ByteCount - TODO: add argument description
|
||||
Direction - TODO: add argument description
|
||||
TimeOutInMicroSeconds - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AtapiPassThruCheckErrorStatus (
|
||||
ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AtapiScsiPrivate - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
#endif
|
42
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.mbd
Normal file
42
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.mbd
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>AtapiPassThru</BaseName>
|
||||
<Guid>E49061CE-99A7-41d3-AB3A-36E5CFBAD63E</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Modified>2006-03-19 15:18</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>UefiDriverModelLib</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>EdkDxePrintLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
</Libraries>
|
||||
</ModuleBuildDescription>
|
65
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.msa
Normal file
65
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.msa
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>AtapiPassThru</BaseName>
|
||||
<ModuleType>UEFI_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>E49061CE-99A7-41d3-AB3A-36E5CFBAD63E</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Description file for the Atapi Passthru component.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>0</Specification>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Updated>2006-03-19 15:18</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverModelLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>AtapiPassThru.h</Filename>
|
||||
<Filename>AtapiPassThru.c</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="TO_START">PciIo</Protocol>
|
||||
<Protocol Usage="BY_START">ScsiPassThru</Protocol>
|
||||
</Protocols>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint></ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gAtapiScsiPassThruDriverBinding</DriverBinding>
|
||||
<ComponentName>gAtapiScsiPassThruComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
154
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/ComponentName.c
Normal file
154
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/ComponentName.c
Normal file
@ -0,0 +1,154 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
ComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
#include "AtapiPassThru.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtapiScsiPassThruComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtapiScsiPassThruComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName = {
|
||||
AtapiScsiPassThruComponentNameGetDriverName,
|
||||
AtapiScsiPassThruComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
static EFI_UNICODE_STRING_TABLE mAtapiScsiPassThruDriverNameTable[] = {
|
||||
{ "eng", (CHAR16 *) L"ATAPI SCSI Pass Thru Driver" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtapiScsiPassThruComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
Language - A pointer to a three character ISO 639-2 language identifier.
|
||||
This is the language of the driver name that that the caller
|
||||
is requesting, and it must match one of the languages specified
|
||||
in SupportedLanguages. The number of languages supported by a
|
||||
driver is up to the driver writer.
|
||||
DriverName - A pointer to the Unicode string to return. This Unicode string
|
||||
is the name of the driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the Driver specified by This
|
||||
and the language specified by Language was returned
|
||||
in DriverName.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - DriverName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gAtapiScsiPassThruComponentName.SupportedLanguages,
|
||||
mAtapiScsiPassThruDriverNameTable,
|
||||
DriverName
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AtapiScsiPassThruComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
ControllerHandle - The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
ChildHandle - The handle of the child controller to retrieve the name
|
||||
of. This is an optional parameter that may be NULL. It
|
||||
will be NULL for device drivers. It will also be NULL
|
||||
for a bus drivers that wish to retrieve the name of the
|
||||
bus controller. It will not be NULL for a bus driver
|
||||
that wishes to retrieve the name of a child controller.
|
||||
Language - A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that that the caller is requesting, and it must match one
|
||||
of the languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up to the
|
||||
driver writer.
|
||||
ControllerName - A pointer to the Unicode string to return. This Unicode
|
||||
string is the name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the language
|
||||
specified by Language from the point of view of the
|
||||
driver specified by This.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the user readable name in the
|
||||
language specified by Language for the driver
|
||||
specified by This was returned in DriverName.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - ControllerName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
47
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/build.xml
Normal file
47
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/build.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
|
||||
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.-->
|
||||
<project basedir="." default="AtapiPassThru"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Bus\Pci\AtapiPassThru\Dxe"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="AtapiPassThru">
|
||||
<GenBuild baseName="AtapiPassThru" mbdFilename="${MODULE_DIR}\AtapiPassThru.mbd" msaFilename="${MODULE_DIR}\AtapiPassThru.msa"/>
|
||||
</target>
|
||||
<target depends="AtapiPassThru_clean" name="clean"/>
|
||||
<target depends="AtapiPassThru_cleanall" name="cleanall"/>
|
||||
<target name="AtapiPassThru_clean">
|
||||
<OutputDirSetup baseName="AtapiPassThru" mbdFilename="${MODULE_DIR}\AtapiPassThru.mbd" msaFilename="${MODULE_DIR}\AtapiPassThru.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\AtapiPassThru_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\AtapiPassThru_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="AtapiPassThru_cleanall">
|
||||
<OutputDirSetup baseName="AtapiPassThru" mbdFilename="${MODULE_DIR}\AtapiPassThru.mbd" msaFilename="${MODULE_DIR}\AtapiPassThru.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\AtapiPassThru_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\AtapiPassThru_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**AtapiPassThru*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
346
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.c
Normal file
346
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.c
Normal file
@ -0,0 +1,346 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
CirrusLogic5430.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Cirrus Logic 5430 Controller Driver.
|
||||
This driver is a sample implementation of the UGA Draw Protocol for the
|
||||
Cirrus Logic 5430 family of PCI video controllers. This driver is only
|
||||
usable in the EFI pre-boot environment. This sample is intended to show
|
||||
how the UGA Draw Protocol is able to function. The UGA I/O Protocol is not
|
||||
implemented in this sample. A fully compliant EFI UGA driver requires both
|
||||
the UGA Draw and the UGA I/O Protocol. Please refer to Microsoft's
|
||||
documentation on UGA for details on how to write a UGA driver that is able
|
||||
to function both in the EFI pre-boot environment and from the OS runtime.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Cirrus Logic 5430 Controller Driver
|
||||
//
|
||||
|
||||
#include "CirrusLogic5430.h"
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gCirrusLogic5430DriverBinding = {
|
||||
CirrusLogic5430ControllerDriverSupported,
|
||||
CirrusLogic5430ControllerDriverStart,
|
||||
CirrusLogic5430ControllerDriverStop,
|
||||
0x10,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CirrusLogic5430ControllerDriverSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: Controller - add argument and description to function comment
|
||||
// TODO: RemainingDevicePath - add argument and description to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
PCI_TYPE00 Pci;
|
||||
|
||||
//
|
||||
// Open the PCI I/O Protocol
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &PciIo,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Read the PCI Configuration Header from the PCI Device
|
||||
//
|
||||
Status = PciIo->Pci.Read (
|
||||
PciIo,
|
||||
EfiPciIoWidthUint32,
|
||||
0,
|
||||
sizeof (Pci) / sizeof (UINT32),
|
||||
&Pci
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
Status = EFI_UNSUPPORTED;
|
||||
//
|
||||
// See if the I/O enable is on. Most systems only allow one VGA device to be turned on
|
||||
// at a time, so see if this is one that is turned on.
|
||||
//
|
||||
// if (((Pci.Hdr.Command & 0x01) == 0x01)) {
|
||||
//
|
||||
// See if this is a Cirrus Logic PCI controller
|
||||
//
|
||||
if (Pci.Hdr.VendorId == CIRRUS_LOGIC_VENDOR_ID) {
|
||||
//
|
||||
// See if this is a 5430 or a 5446 PCI controller
|
||||
//
|
||||
if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_DEVICE_ID) {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID) {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5446_DEVICE_ID) {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
Done:
|
||||
//
|
||||
// Close the PCI I/O Protocol
|
||||
//
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CirrusLogic5430ControllerDriverStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: Controller - add argument and description to function comment
|
||||
// TODO: RemainingDevicePath - add argument and description to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;
|
||||
|
||||
//
|
||||
// Allocate Private context data for UGA Draw inteface.
|
||||
//
|
||||
Private = NULL;
|
||||
Private = AllocateZeroPool (sizeof (CIRRUS_LOGIC_5430_PRIVATE_DATA));
|
||||
if (Private == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
//
|
||||
// Set up context record
|
||||
//
|
||||
Private->Signature = CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE;
|
||||
Private->Handle = Controller;
|
||||
|
||||
//
|
||||
// Open PCI I/O Protocol
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
Private->Handle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &Private->PciIo,
|
||||
This->DriverBindingHandle,
|
||||
Private->Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
Status = Private->PciIo->Attributes (
|
||||
Private->PciIo,
|
||||
EfiPciIoAttributeOperationEnable,
|
||||
EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
//
|
||||
// Start the UGA Draw software stack.
|
||||
//
|
||||
Status = CirrusLogic5430UgaDrawConstructor (Private);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
//
|
||||
// Publish the UGA Draw interface to the world
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Private->Handle,
|
||||
&gEfiUgaDrawProtocolGuid,
|
||||
&Private->UgaDraw,
|
||||
NULL
|
||||
);
|
||||
|
||||
Error:
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Private) {
|
||||
if (Private->PciIo) {
|
||||
Private->PciIo->Attributes (
|
||||
Private->PciIo,
|
||||
EfiPciIoAttributeOperationDisable,
|
||||
EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Close the PCI I/O Protocol
|
||||
//
|
||||
gBS->CloseProtocol (
|
||||
Private->Handle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Private->Handle
|
||||
);
|
||||
if (Private) {
|
||||
gBS->FreePool (Private);
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CirrusLogic5430ControllerDriverStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: Controller - add argument and description to function comment
|
||||
// TODO: NumberOfChildren - add argument and description to function comment
|
||||
// TODO: ChildHandleBuffer - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
||||
EFI_STATUS Status;
|
||||
CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiUgaDrawProtocolGuid,
|
||||
(VOID **) &UgaDraw,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// If the UGA Draw interface does not exist the driver is not started
|
||||
//
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Get our private context information
|
||||
//
|
||||
Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (UgaDraw);
|
||||
|
||||
//
|
||||
// Remove the UGA Draw interface from the system
|
||||
//
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
Private->Handle,
|
||||
&gEfiUgaDrawProtocolGuid,
|
||||
&Private->UgaDraw,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Shutdown the hardware
|
||||
//
|
||||
CirrusLogic5430UgaDrawDestructor (Private);
|
||||
|
||||
Private->PciIo->Attributes (
|
||||
Private->PciIo,
|
||||
EfiPciIoAttributeOperationDisable,
|
||||
EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO,
|
||||
NULL
|
||||
);
|
||||
|
||||
//
|
||||
// Close the PCI I/O Protocol
|
||||
//
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
//
|
||||
// Free our instance data
|
||||
//
|
||||
gBS->FreePool (Private);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
254
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.h
Normal file
254
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.h
Normal file
@ -0,0 +1,254 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
CirrusLogic5430.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Cirrus Logic 5430 Controller Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Cirrus Logic 5430 Controller Driver
|
||||
//
|
||||
|
||||
#ifndef _CIRRUS_LOGIC_5430_H_
|
||||
#define _CIRRUS_LOGIC_5430_H_
|
||||
|
||||
|
||||
#include <IndustryStandard/Pci22.h>
|
||||
//
|
||||
// Cirrus Logic 5430 PCI Configuration Header values
|
||||
//
|
||||
#define CIRRUS_LOGIC_VENDOR_ID 0x1013
|
||||
#define CIRRUS_LOGIC_5430_DEVICE_ID 0x00a8
|
||||
#define CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID 0x00a0
|
||||
#define CIRRUS_LOGIC_5446_DEVICE_ID 0x00b8
|
||||
|
||||
//
|
||||
// Cirrus Logic Graphical Mode Data
|
||||
//
|
||||
#define CIRRUS_LOGIC_5430_UGA_DRAW_MODE_COUNT 3
|
||||
|
||||
typedef struct {
|
||||
UINT32 HorizontalResolution;
|
||||
UINT32 VerticalResolution;
|
||||
UINT32 ColorDepth;
|
||||
UINT32 RefreshRate;
|
||||
} CIRRUS_LOGIC_5430_UGA_DRAW_MODE_DATA;
|
||||
|
||||
//
|
||||
// Cirrus Logic 5440 Private Data Structure
|
||||
//
|
||||
#define CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('C', 'L', '5', '4')
|
||||
|
||||
typedef struct {
|
||||
UINT64 Signature;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
EFI_UGA_DRAW_PROTOCOL UgaDraw;
|
||||
|
||||
//
|
||||
// UGA Draw Private Data
|
||||
//
|
||||
BOOLEAN HardwareNeedsStarting;
|
||||
UINTN CurrentMode;
|
||||
UINTN MaxMode;
|
||||
CIRRUS_LOGIC_5430_UGA_DRAW_MODE_DATA ModeData[CIRRUS_LOGIC_5430_UGA_DRAW_MODE_COUNT];
|
||||
UINT8 *LineBuffer;
|
||||
} CIRRUS_LOGIC_5430_PRIVATE_DATA;
|
||||
|
||||
#define CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS(a) \
|
||||
CR(a, CIRRUS_LOGIC_5430_PRIVATE_DATA, UgaDraw, CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE)
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gCirrusLogic5430DriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gCirrusLogic5430ComponentName;
|
||||
|
||||
//
|
||||
// Io Registers defined by VGA
|
||||
//
|
||||
#define CRTC_ADDRESS_REGISTER 0x3d4
|
||||
#define CRTC_DATA_REGISTER 0x3d5
|
||||
#define SEQ_ADDRESS_REGISTER 0x3c4
|
||||
#define SEQ_DATA_REGISTER 0x3c5
|
||||
#define GRAPH_ADDRESS_REGISTER 0x3ce
|
||||
#define GRAPH_DATA_REGISTER 0x3cf
|
||||
#define ATT_ADDRESS_REGISTER 0x3c0
|
||||
#define MISC_OUTPUT_REGISTER 0x3c2
|
||||
#define INPUT_STATUS_1_REGISTER 0x3da
|
||||
#define DAC_PIXEL_MASK_REGISTER 0x3c6
|
||||
#define PALETTE_INDEX_REGISTER 0x3c8
|
||||
#define PALETTE_DATA_REGISTER 0x3c9
|
||||
|
||||
//
|
||||
// UGA Draw Hardware abstraction internal worker functions
|
||||
//
|
||||
EFI_STATUS
|
||||
CirrusLogic5430UgaDrawConstructor (
|
||||
CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Private - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CirrusLogic5430UgaDrawDestructor (
|
||||
CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Private - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
//
|
||||
// EFI 1.1 driver model prototypes for Cirrus Logic 5430 UGA Draw
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CirrusLogic5430DriverEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - TODO: add argument description
|
||||
SystemTable - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
//
|
||||
// EFI_DRIVER_BINDING_PROTOCOL Protocol Interface
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CirrusLogic5430ControllerDriverSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Controller - TODO: add argument description
|
||||
RemainingDevicePath - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CirrusLogic5430ControllerDriverStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Controller - TODO: add argument description
|
||||
RemainingDevicePath - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CirrusLogic5430ControllerDriverStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Controller - TODO: add argument description
|
||||
NumberOfChildren - TODO: add argument description
|
||||
ChildHandleBuffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
42
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.mbd
Normal file
42
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.mbd
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>CirrusLogic5430UgaDraw</BaseName>
|
||||
<Guid>555F76EA-785F-40d7-9174-153C43636C68</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Modified>2006-03-19 15:18</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>UefiDriverModelLib</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>EdkDxePrintLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
</Libraries>
|
||||
</ModuleBuildDescription>
|
66
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.msa
Normal file
66
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.msa
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>CirrusLogic5430UgaDraw</BaseName>
|
||||
<ModuleType>UEFI_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>555F76EA-785F-40d7-9174-153C43636C68</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for CirrusLogic5430 module</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>0</Specification>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Updated>2006-03-19 15:18</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverModelLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>CirrusLogic5430.h</Filename>
|
||||
<Filename>CirrusLogic5430.c</Filename>
|
||||
<Filename>CirrusLogic5430UgaDraw.c</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="TO_START">PciIo</Protocol>
|
||||
<Protocol Usage="ALWAYS_PRODUCED">UgaDraw</Protocol>
|
||||
</Protocols>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint></ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gCirrusLogic5430DriverBinding</DriverBinding>
|
||||
<ComponentName>gCirrusLogic5430ComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
1036
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430UgaDraw.c
Normal file
1036
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430UgaDraw.c
Normal file
File diff suppressed because it is too large
Load Diff
222
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/ComponentName.c
Normal file
222
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/ComponentName.c
Normal file
@ -0,0 +1,222 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
ComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include "CirrusLogic5430.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CirrusLogic5430ComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CirrusLogic5430ComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gCirrusLogic5430ComponentName = {
|
||||
CirrusLogic5430ComponentNameGetDriverName,
|
||||
CirrusLogic5430ComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
static EFI_UNICODE_STRING_TABLE mCirrusLogic5430DriverNameTable[] = {
|
||||
{ "eng", (CHAR16 *) L"Cirrus Logic 5430 UGA Driver" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
static EFI_UNICODE_STRING_TABLE mCirrusLogic5430ControllerNameTable[] = {
|
||||
{ "eng", (CHAR16 *) L"Cirrus Logic 5430 PCI Adapter" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CirrusLogic5430ComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
Language - A pointer to a three character ISO 639-2 language identifier.
|
||||
This is the language of the driver name that that the caller
|
||||
is requesting, and it must match one of the languages specified
|
||||
in SupportedLanguages. The number of languages supported by a
|
||||
driver is up to the driver writer.
|
||||
DriverName - A pointer to the Unicode string to return. This Unicode string
|
||||
is the name of the driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the Driver specified by This
|
||||
and the language specified by Language was returned
|
||||
in DriverName.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - DriverName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gCirrusLogic5430ComponentName.SupportedLanguages,
|
||||
mCirrusLogic5430DriverNameTable,
|
||||
DriverName
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CirrusLogic5430ComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
ControllerHandle - The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
ChildHandle - The handle of the child controller to retrieve the name
|
||||
of. This is an optional parameter that may be NULL. It
|
||||
will be NULL for device drivers. It will also be NULL
|
||||
for a bus drivers that wish to retrieve the name of the
|
||||
bus controller. It will not be NULL for a bus driver
|
||||
that wishes to retrieve the name of a child controller.
|
||||
Language - A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that that the caller is requesting, and it must match one
|
||||
of the languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up to the
|
||||
driver writer.
|
||||
ControllerName - A pointer to the Unicode string to return. This Unicode
|
||||
string is the name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the language specified
|
||||
by Language from the point of view of the driver specified
|
||||
by This.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the user readable name in the
|
||||
language specified by Language for the driver
|
||||
specified by This was returned in DriverName.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - ControllerName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This is not currently managing
|
||||
the controller specified by ControllerHandle and
|
||||
ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
||||
EFI_STATUS Status;
|
||||
CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;
|
||||
EFI_PCI_IO_PROTOCOL *PciIoProtocol;
|
||||
|
||||
//
|
||||
// This is a device driver, so ChildHandle must be NULL.
|
||||
//
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Controller's handle
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &PciIoProtocol,
|
||||
gCirrusLogic5430DriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
gCirrusLogic5430DriverBinding.DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (Status != EFI_ALREADY_STARTED) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the UGA Draw Protocol on Controller
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiUgaDrawProtocolGuid,
|
||||
(VOID **) &UgaDraw,
|
||||
gCirrusLogic5430DriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the Cirrus Logic 5430's Device structure
|
||||
//
|
||||
Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (UgaDraw);
|
||||
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gCirrusLogic5430ComponentName.SupportedLanguages,
|
||||
mCirrusLogic5430ControllerNameTable,
|
||||
ControllerName
|
||||
);
|
||||
}
|
47
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/build.xml
Normal file
47
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/build.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
|
||||
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.-->
|
||||
<project basedir="." default="CirrusLogic5430UgaDraw"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Bus\Pci\CirrusLogic\Dxe"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="CirrusLogic5430UgaDraw">
|
||||
<GenBuild baseName="CirrusLogic5430UgaDraw" mbdFilename="${MODULE_DIR}\CirrusLogic5430.mbd" msaFilename="${MODULE_DIR}\CirrusLogic5430.msa"/>
|
||||
</target>
|
||||
<target depends="CirrusLogic5430UgaDraw_clean" name="clean"/>
|
||||
<target depends="CirrusLogic5430UgaDraw_cleanall" name="cleanall"/>
|
||||
<target name="CirrusLogic5430UgaDraw_clean">
|
||||
<OutputDirSetup baseName="CirrusLogic5430UgaDraw" mbdFilename="${MODULE_DIR}\CirrusLogic5430.mbd" msaFilename="${MODULE_DIR}\CirrusLogic5430.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\CirrusLogic5430UgaDraw_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\CirrusLogic5430UgaDraw_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="CirrusLogic5430UgaDraw_cleanall">
|
||||
<OutputDirSetup baseName="CirrusLogic5430UgaDraw" mbdFilename="${MODULE_DIR}\CirrusLogic5430.mbd" msaFilename="${MODULE_DIR}\CirrusLogic5430.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\CirrusLogic5430UgaDraw_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\CirrusLogic5430UgaDraw_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**CirrusLogic5430UgaDraw*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
224
EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.c
Normal file
224
EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.c
Normal file
@ -0,0 +1,224 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
ComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include "IDEBus.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gIDEBusComponentName = {
|
||||
IDEBusComponentNameGetDriverName,
|
||||
IDEBusComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
STATIC EFI_UNICODE_STRING_TABLE mIDEBusDriverNameTable[] = {
|
||||
{ "eng", (CHAR16 *) L"PCI IDE/ATAPI Bus Driver" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
STATIC EFI_UNICODE_STRING_TABLE mIDEBusControllerNameTable[] = {
|
||||
{ "eng", (CHAR16 *) L"PCI IDE/ATAPI Controller" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
Language - A pointer to a three character ISO 639-2 language identifier.
|
||||
This is the language of the driver name that that the caller
|
||||
is requesting, and it must match one of the languages specified
|
||||
in SupportedLanguages. The number of languages supported by a
|
||||
driver is up to the driver writer.
|
||||
DriverName - A pointer to the Unicode string to return. This Unicode string
|
||||
is the name of the driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the Driver specified by This
|
||||
and the language specified by Language was returned
|
||||
in DriverName.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - DriverName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gIDEBusComponentName.SupportedLanguages,
|
||||
mIDEBusDriverNameTable,
|
||||
DriverName
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
ControllerHandle - The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
ChildHandle - The handle of the child controller to retrieve the name
|
||||
of. This is an optional parameter that may be NULL. It
|
||||
will be NULL for device drivers. It will also be NULL
|
||||
for a bus drivers that wish to retrieve the name of the
|
||||
bus controller. It will not be NULL for a bus driver
|
||||
that wishes to retrieve the name of a child controller.
|
||||
Language - A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that that the caller is requesting, and it must match one
|
||||
of the languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up to the
|
||||
driver writer.
|
||||
ControllerName - A pointer to the Unicode string to return. This Unicode
|
||||
string is the name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the language
|
||||
specified by Language from the point of view of the
|
||||
driver specified by This.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the user readable name in the
|
||||
language specified by Language for the driver
|
||||
specified by This was returned in DriverName.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - ControllerName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_BLOCK_IO_PROTOCOL *BlockIo;
|
||||
IDE_BLK_IO_DEV *IdeBlkIoDevice;
|
||||
|
||||
//
|
||||
// Get the controller context
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiCallerIdGuid,
|
||||
NULL,
|
||||
gIDEBusDriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (ChildHandle == NULL) {
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gIDEBusComponentName.SupportedLanguages,
|
||||
mIDEBusControllerNameTable,
|
||||
ControllerName
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Get the child context
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandle,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
(VOID **) &BlockIo,
|
||||
gIDEBusDriverBinding.DriverBindingHandle,
|
||||
ChildHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (BlockIo);
|
||||
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gIDEBusComponentName.SupportedLanguages,
|
||||
IdeBlkIoDevice->ControllerNameTable,
|
||||
ControllerName
|
||||
);
|
||||
}
|
||||
|
||||
VOID
|
||||
AddName (
|
||||
IN IDE_BLK_IO_DEV *IdeBlkIoDevicePtr
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Add the component name for the IDE/ATAPI device
|
||||
|
||||
Arguments:
|
||||
IdeBlkIoDevicePtr - A pointer to the IDE_BLK_IO_DEV instance.
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN StringIndex;
|
||||
CHAR16 ModelName[41];
|
||||
|
||||
//
|
||||
// Add Component Name for the IDE/ATAPI device that was discovered.
|
||||
//
|
||||
IdeBlkIoDevicePtr->ControllerNameTable = NULL;
|
||||
for (StringIndex = 0; StringIndex < 41; StringIndex++) {
|
||||
ModelName[StringIndex] = IdeBlkIoDevicePtr->ModelName[StringIndex];
|
||||
}
|
||||
|
||||
AddUnicodeString (
|
||||
"eng",
|
||||
gIDEBusComponentName.SupportedLanguages,
|
||||
&IdeBlkIoDevicePtr->ControllerNameTable,
|
||||
ModelName
|
||||
);
|
||||
}
|
118
EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.h
Normal file
118
EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.h
Normal file
@ -0,0 +1,118 @@
|
||||
/*++
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
ComponentName.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Revision History
|
||||
--*/
|
||||
|
||||
#ifndef _IDE_BUS_COMPONENT_NAME_H
|
||||
#define _IDE_BUS_COMPONENT_NAME_H
|
||||
|
||||
|
||||
#ifndef EFI_SIZE_REDUCTION_APPLIED
|
||||
|
||||
#define ADD_NAME(x) AddName ((x));
|
||||
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gIDEBusComponentName;
|
||||
|
||||
#else
|
||||
|
||||
#define ADD_NAME(x)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Language - TODO: add argument description
|
||||
DriverName - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
ControllerHandle - TODO: add argument description
|
||||
ChildHandle - TODO: add argument description
|
||||
Language - TODO: add argument description
|
||||
ControllerName - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID
|
||||
AddName (
|
||||
IN IDE_BLK_IO_DEV *IdeBlkIoDevicePtr
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
IdeBlkIoDevicePtr - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
378
EdkModulePkg/Bus/Pci/IdeBus/Dxe/DriverConfiguration.c
Normal file
378
EdkModulePkg/Bus/Pci/IdeBus/Dxe/DriverConfiguration.c
Normal file
@ -0,0 +1,378 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
DriverConfiguration.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include "IDEBus.h"
|
||||
|
||||
CHAR16 *OptionString[4] = {
|
||||
L"Enable Primary Master (Y/N)? -->",
|
||||
L"Enable Primary Slave (Y/N)? -->",
|
||||
L"Enable Secondary Master (Y/N)? -->",
|
||||
L"Enable Secondary Slave (Y/N)? -->"
|
||||
};
|
||||
//
|
||||
// EFI Driver Configuration Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
IDEBusDriverConfigurationSetOptions (
|
||||
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
IDEBusDriverConfigurationOptionsValid (
|
||||
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
IDEBusDriverConfigurationForceDefaults (
|
||||
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN UINT32 DefaultType,
|
||||
OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
|
||||
);
|
||||
|
||||
//
|
||||
// EFI Driver Configuration Protocol
|
||||
//
|
||||
EFI_DRIVER_CONFIGURATION_PROTOCOL gIDEBusDriverConfiguration = {
|
||||
IDEBusDriverConfigurationSetOptions,
|
||||
IDEBusDriverConfigurationOptionsValid,
|
||||
IDEBusDriverConfigurationForceDefaults,
|
||||
"eng"
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
GetResponse (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_ABORTED - TODO: Add description for return value
|
||||
EFI_SUCCESS - TODO: Add description for return value
|
||||
EFI_NOT_FOUND - TODO: Add description for return value
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_INPUT_KEY Key;
|
||||
|
||||
while (TRUE) {
|
||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if (Key.ScanCode == SCAN_ESC) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
switch (Key.UnicodeChar) {
|
||||
|
||||
//
|
||||
// fall through
|
||||
//
|
||||
case L'y':
|
||||
case L'Y':
|
||||
gST->ConOut->OutputString (gST->ConOut, L"Y\n");
|
||||
return EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// fall through
|
||||
//
|
||||
case L'n':
|
||||
case L'N':
|
||||
gST->ConOut->OutputString (gST->ConOut, L"N\n");
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
IDEBusDriverConfigurationSetOptions (
|
||||
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Allows the user to set controller specific options for a controller that a
|
||||
driver is currently managing.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL
|
||||
instance.
|
||||
ControllerHandle - The handle of the controller to set options on.
|
||||
ChildHandle - The handle of the child controller to set options on.
|
||||
This is an optional parameter that may be NULL.
|
||||
It will be NULL for device drivers, and for a bus drivers
|
||||
that wish to set options for the bus controller.
|
||||
It will not be NULL for a bus driver that wishes to set
|
||||
options for one of its child controllers.
|
||||
Language - A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the user interface
|
||||
that should be presented to the user, and it must match
|
||||
one of the languages specified in SupportedLanguages.
|
||||
The number of languages supported by a driver is up to
|
||||
the driver writer.
|
||||
ActionRequired - A pointer to the action that the calling agent is
|
||||
required to perform when this function returns.
|
||||
See "Related Definitions" for a list of the actions that
|
||||
the calling agent is required to perform prior to
|
||||
accessing ControllerHandle again.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The driver specified by This successfully set the
|
||||
configuration options for the controller specified
|
||||
by ControllerHandle..
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a
|
||||
valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ActionRequired is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support
|
||||
setting configuration options for the controller
|
||||
specified by ControllerHandle and ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
EFI_DEVICE_ERROR - A device error occurred while attempt to set the
|
||||
configuration options for the controller specified
|
||||
by ControllerHandle and ChildHandle.
|
||||
EFI_OUT_RESOURCES - There are not enough resources available to set the
|
||||
configuration options for the controller specified
|
||||
by ControllerHandle and ChildHandle.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8 Value;
|
||||
UINT8 NewValue;
|
||||
UINTN DataSize;
|
||||
UINTN Index;
|
||||
UINT32 Attributes;
|
||||
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
*ActionRequired = EfiDriverConfigurationActionNone;
|
||||
|
||||
DataSize = sizeof (Value);
|
||||
Status = gRT->GetVariable (
|
||||
L"Configuration",
|
||||
&gEfiCallerIdGuid,
|
||||
&Attributes,
|
||||
&DataSize,
|
||||
&Value
|
||||
);
|
||||
|
||||
gST->ConOut->OutputString (gST->ConOut, L"IDE Bus Driver Configuration\n");
|
||||
gST->ConOut->OutputString (gST->ConOut, L"===============================\n");
|
||||
|
||||
NewValue = 0;
|
||||
for (Index = 0; Index < 4; Index++) {
|
||||
gST->ConOut->OutputString (gST->ConOut, OptionString[Index]);
|
||||
|
||||
Status = GetResponse ();
|
||||
if (Status == EFI_ABORTED) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
NewValue |= (UINT8) (1 << Index);
|
||||
}
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status) || (NewValue != Value)) {
|
||||
gRT->SetVariable (
|
||||
L"Configuration",
|
||||
&gEfiCallerIdGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (NewValue),
|
||||
&NewValue
|
||||
);
|
||||
|
||||
*ActionRequired = EfiDriverConfigurationActionRestartController;
|
||||
} else {
|
||||
*ActionRequired = EfiDriverConfigurationActionNone;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
IDEBusDriverConfigurationOptionsValid (
|
||||
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Tests to see if a controller's current configuration options are valid.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_DRIVER_CONFIGURATION_PROTOCOL
|
||||
instance.
|
||||
ControllerHandle - The handle of the controller to test if it's current
|
||||
configuration options are valid.
|
||||
ChildHandle - The handle of the child controller to test if it's
|
||||
current
|
||||
configuration options are valid. This is an optional
|
||||
parameter that may be NULL. It will be NULL for device
|
||||
drivers. It will also be NULL for a bus drivers that
|
||||
wish to test the configuration options for the bus
|
||||
controller. It will not be NULL for a bus driver that
|
||||
wishes to test configuration options for one of
|
||||
its child controllers.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The controller specified by ControllerHandle and
|
||||
ChildHandle that is being managed by the driver
|
||||
specified by This has a valid set of configuration
|
||||
options.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
EFI_UNSUPPORTED - The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
EFI_DEVICE_ERROR - The controller specified by ControllerHandle and
|
||||
ChildHandle that is being managed by the driver
|
||||
specified by This has an invalid set of
|
||||
configuration options.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8 Value;
|
||||
UINTN DataSize;
|
||||
UINT32 Attributes;
|
||||
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
DataSize = sizeof (Value);
|
||||
Status = gRT->GetVariable (
|
||||
L"Configuration",
|
||||
&gEfiCallerIdGuid,
|
||||
&Attributes,
|
||||
&DataSize,
|
||||
&Value
|
||||
);
|
||||
if (EFI_ERROR (Status) || Value > 0x0f) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
IDEBusDriverConfigurationForceDefaults (
|
||||
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN UINT32 DefaultType,
|
||||
OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Forces a driver to set the default configuration options for a controller.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL
|
||||
instance.
|
||||
ControllerHandle - The handle of the controller to force default
|
||||
configuration options on.
|
||||
ChildHandle - The handle of the child controller to force default
|
||||
configuration options on This is an optional parameter
|
||||
that may be NULL. It will be NULL for device drivers.
|
||||
It will also be NULL for a bus drivers that wish to
|
||||
force default configuration options for the bus
|
||||
controller. It will not be NULL for a bus driver that
|
||||
wishes to force default configuration options for one
|
||||
of its child controllers.
|
||||
DefaultType - The type of default configuration options to force on
|
||||
the controller specified by ControllerHandle and
|
||||
ChildHandle. See Table 9-1 for legal values.
|
||||
A DefaultType of 0x00000000 must be supported
|
||||
by this protocol.
|
||||
ActionRequired - A pointer to the action that the calling agent
|
||||
is required to perform when this function returns.
|
||||
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The driver specified by This successfully forced
|
||||
the default configuration options on the
|
||||
controller specified by ControllerHandle and
|
||||
ChildHandle.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a
|
||||
valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ActionRequired is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support
|
||||
forcing the default configuration options on
|
||||
the controller specified by ControllerHandle
|
||||
and ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support
|
||||
the configuration type specified by DefaultType.
|
||||
EFI_DEVICE_ERROR - A device error occurred while attempt to force
|
||||
the default configuration options on the controller
|
||||
specified by ControllerHandle and ChildHandle.
|
||||
EFI_OUT_RESOURCES - There are not enough resources available to force
|
||||
the default configuration options on the controller
|
||||
specified by ControllerHandle and ChildHandle.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT8 Value;
|
||||
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Value = 0x0f;
|
||||
gRT->SetVariable (
|
||||
L"Configuration",
|
||||
&gEfiCallerIdGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (Value),
|
||||
&Value
|
||||
);
|
||||
*ActionRequired = EfiDriverConfigurationActionRestartController;
|
||||
return EFI_SUCCESS;
|
||||
}
|
225
EdkModulePkg/Bus/Pci/IdeBus/Dxe/DriverDiagnostics.c
Normal file
225
EdkModulePkg/Bus/Pci/IdeBus/Dxe/DriverDiagnostics.c
Normal file
@ -0,0 +1,225 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
DriverDiagnostics.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include "IDEBus.h"
|
||||
|
||||
#define IDE_BUS_DIAGNOSTIC_ERROR L"PCI IDE/ATAPI Driver Diagnostics Failed"
|
||||
|
||||
//
|
||||
// EFI Driver Diagnostics Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
IDEBusDriverDiagnosticsRunDiagnostics (
|
||||
IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
|
||||
IN CHAR8 *Language,
|
||||
OUT EFI_GUID **ErrorType,
|
||||
OUT UINTN *BufferSize,
|
||||
OUT CHAR16 **Buffer
|
||||
);
|
||||
|
||||
//
|
||||
// EFI Driver Diagnostics Protocol
|
||||
//
|
||||
EFI_DRIVER_DIAGNOSTICS_PROTOCOL gIDEBusDriverDiagnostics = {
|
||||
IDEBusDriverDiagnosticsRunDiagnostics,
|
||||
"eng"
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
IDEBusDriverDiagnosticsRunDiagnostics (
|
||||
IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
|
||||
IN CHAR8 *Language,
|
||||
OUT EFI_GUID **ErrorType,
|
||||
OUT UINTN *BufferSize,
|
||||
OUT CHAR16 **Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Runs diagnostics on a controller.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_DRIVER_DIAGNOSTICS_PROTOCOL
|
||||
instance.
|
||||
ControllerHandle - The handle of the controller to run diagnostics on.
|
||||
ChildHandle - The handle of the child controller to run diagnostics on
|
||||
This is an optional parameter that may be NULL. It will
|
||||
be NULL for device drivers. It will also be NULL for a
|
||||
bus drivers that wish to run diagnostics on the bus
|
||||
controller. It will not be NULL for a bus driver that
|
||||
wishes to run diagnostics on one of its child
|
||||
controllers.
|
||||
DiagnosticType - Indicates type of diagnostics to perform on the
|
||||
controller specified by ControllerHandle and ChildHandle.
|
||||
See "Related Definitions" for the list of supported
|
||||
types.
|
||||
Language - A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language in which the optional
|
||||
error message should be returned in Buffer, and it must
|
||||
match one of the languages specified in
|
||||
SupportedLanguages. The number of languages supported by
|
||||
a driver is up to the driver writer.
|
||||
ErrorType - A GUID that defines the format of the data returned in
|
||||
Buffer.
|
||||
BufferSize - The size, in bytes, of the data returned in Buffer.
|
||||
Buffer - A buffer that contains a Null-terminated Unicode string
|
||||
plus some additional data whose format is defined by
|
||||
ErrorType. Buffer is allocated by this function with
|
||||
AllocatePool(), and it is the caller's responsibility
|
||||
to free it with a call to FreePool().
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The controller specified by ControllerHandle and
|
||||
ChildHandle passed the diagnostic.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - ErrorType is NULL.
|
||||
EFI_INVALID_PARAMETER - BufferType is NULL.
|
||||
EFI_INVALID_PARAMETER - Buffer is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support
|
||||
running diagnostics for the controller specified
|
||||
by ControllerHandle and ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
type of diagnostic specified by DiagnosticType.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
EFI_OUT_OF_RESOURCES - There are not enough resources available to complete
|
||||
the diagnostics.
|
||||
EFI_OUT_OF_RESOURCES - There are not enough resources available to return
|
||||
the status information in ErrorType, BufferSize,
|
||||
and Buffer.
|
||||
EFI_DEVICE_ERROR - The controller specified by ControllerHandle and
|
||||
ChildHandle did not pass the diagnostic.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
EFI_BLOCK_IO_PROTOCOL *BlkIo;
|
||||
IDE_BLK_IO_DEV *IdeBlkIoDevice;
|
||||
UINT32 VendorDeviceId;
|
||||
VOID *BlockBuffer;
|
||||
|
||||
*ErrorType = NULL;
|
||||
*BufferSize = 0;
|
||||
|
||||
if (ChildHandle == NULL) {
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiCallerIdGuid,
|
||||
NULL,
|
||||
gIDEBusDriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &PciIo,
|
||||
gIDEBusDriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Use services of PCI I/O Protocol to test the PCI IDE/ATAPI Controller
|
||||
// The following test simply reads the Device ID and Vendor ID.
|
||||
// It should never fail. A real test would perform more advanced
|
||||
// diagnostics.
|
||||
//
|
||||
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0, 1, &VendorDeviceId);
|
||||
if (EFI_ERROR (Status) || VendorDeviceId == 0xffffffff) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandle,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
(VOID **) &BlkIo,
|
||||
gIDEBusDriverBinding.DriverBindingHandle,
|
||||
ChildHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (BlkIo);
|
||||
|
||||
//
|
||||
// Use services available from IdeBlkIoDevice to test the IDE/ATAPI device
|
||||
//
|
||||
Status = gBS->AllocatePool (
|
||||
EfiBootServicesData,
|
||||
IdeBlkIoDevice->BlkMedia.BlockSize,
|
||||
(VOID **) &BlockBuffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = IdeBlkIoDevice->BlkIo.ReadBlocks (
|
||||
&IdeBlkIoDevice->BlkIo,
|
||||
IdeBlkIoDevice->BlkMedia.MediaId,
|
||||
0,
|
||||
IdeBlkIoDevice->BlkMedia.BlockSize,
|
||||
BlockBuffer
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
*ErrorType = &gEfiCallerIdGuid;
|
||||
*BufferSize = sizeof (IDE_BUS_DIAGNOSTIC_ERROR);
|
||||
|
||||
Status = gBS->AllocatePool (
|
||||
EfiBootServicesData,
|
||||
(UINTN) (*BufferSize),
|
||||
(VOID **) Buffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
EfiCopyMem (*Buffer, IDE_BUS_DIAGNOSTIC_ERROR, *BufferSize);
|
||||
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
gBS->FreePool (BlockBuffer);
|
||||
|
||||
return Status;
|
||||
}
|
3690
EdkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c
Normal file
3690
EdkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c
Normal file
File diff suppressed because it is too large
Load Diff
2591
EdkModulePkg/Bus/Pci/IdeBus/Dxe/atapi.c
Normal file
2591
EdkModulePkg/Bus/Pci/IdeBus/Dxe/atapi.c
Normal file
File diff suppressed because it is too large
Load Diff
74
EdkModulePkg/Bus/Pci/IdeBus/Dxe/build.xml
Normal file
74
EdkModulePkg/Bus/Pci/IdeBus/Dxe/build.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
|
||||
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.-->
|
||||
<project basedir="." default="IdeBus"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Bus\Pci\IdeBus\Dxe"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="IdeBusLite">
|
||||
<GenBuild baseName="IdeBusLite" mbdFilename="${MODULE_DIR}\idebusLite.mbd" msaFilename="${MODULE_DIR}\idebusLite.msa"/>
|
||||
</target>
|
||||
<target name="IdeBus">
|
||||
<GenBuild baseName="IdeBus" mbdFilename="${MODULE_DIR}\idebus.mbd" msaFilename="${MODULE_DIR}\idebus.msa"/>
|
||||
</target>
|
||||
<target depends="IdeBus_clean" name="clean"/>
|
||||
<target depends="IdeBus_cleanall" name="cleanall"/>
|
||||
<target name="IdeBusLite_clean">
|
||||
<OutputDirSetup baseName="IdeBusLite" mbdFilename="${MODULE_DIR}\idebusLite.mbd" msaFilename="${MODULE_DIR}\idebusLite.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\IdeBusLite_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\IdeBusLite_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="IdeBus_clean">
|
||||
<OutputDirSetup baseName="IdeBus" mbdFilename="${MODULE_DIR}\idebus.mbd" msaFilename="${MODULE_DIR}\idebus.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\IdeBus_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\IdeBus_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="IdeBusLite_cleanall">
|
||||
<OutputDirSetup baseName="IdeBusLite" mbdFilename="${MODULE_DIR}\idebusLite.mbd" msaFilename="${MODULE_DIR}\idebusLite.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\IdeBusLite_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\IdeBusLite_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**IdeBusLite*"/>
|
||||
</delete>
|
||||
</target>
|
||||
<target name="IdeBus_cleanall">
|
||||
<OutputDirSetup baseName="IdeBus" mbdFilename="${MODULE_DIR}\idebus.mbd" msaFilename="${MODULE_DIR}\idebus.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\IdeBus_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\IdeBus_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**IdeBus*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
1964
EdkModulePkg/Bus/Pci/IdeBus/Dxe/ide.c
Normal file
1964
EdkModulePkg/Bus/Pci/IdeBus/Dxe/ide.c
Normal file
File diff suppressed because it is too large
Load Diff
1806
EdkModulePkg/Bus/Pci/IdeBus/Dxe/ide.h
Normal file
1806
EdkModulePkg/Bus/Pci/IdeBus/Dxe/ide.h
Normal file
File diff suppressed because it is too large
Load Diff
1400
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.c
Normal file
1400
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.c
Normal file
File diff suppressed because it is too large
Load Diff
439
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.h
Normal file
439
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.h
Normal file
@ -0,0 +1,439 @@
|
||||
/*++
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
idebus.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Header file for IDE Bus Driver.
|
||||
|
||||
Revision History
|
||||
++*/
|
||||
|
||||
// TODO: fix comment to end with --*/
|
||||
#ifndef _IDE_BUS_H
|
||||
#define _IDE_BUS_H
|
||||
|
||||
|
||||
#include <IndustryStandard/Pci22.h>
|
||||
#include "idedata.h"
|
||||
|
||||
//
|
||||
// Extra Definition to porting
|
||||
//
|
||||
#define EFI_MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
#define MAX_IDE_DEVICE 4
|
||||
#define MAX_IDE_CHANNELS 2
|
||||
#define MAX_IDE_DRIVES 2
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN HaveScannedDevice[MAX_IDE_DEVICE];
|
||||
BOOLEAN DeviceFound[MAX_IDE_DEVICE];
|
||||
BOOLEAN DeviceProcessed[MAX_IDE_DEVICE];
|
||||
} IDE_BUS_DRIVER_PRIVATE_DATA;
|
||||
|
||||
#define IDE_BLK_IO_DEV_SIGNATURE EFI_SIGNATURE_32 ('i', 'b', 'i', 'd')
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
|
||||
EFI_HANDLE Handle;
|
||||
EFI_BLOCK_IO_PROTOCOL BlkIo;
|
||||
EFI_BLOCK_IO_MEDIA BlkMedia;
|
||||
EFI_DISK_INFO_PROTOCOL DiskInfo;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;
|
||||
|
||||
//
|
||||
// Local Data for IDE interface goes here
|
||||
//
|
||||
EFI_IDE_CHANNEL Channel;
|
||||
EFI_IDE_DEVICE Device;
|
||||
UINT16 Lun;
|
||||
IDE_DEVICE_TYPE Type;
|
||||
|
||||
IDE_BASE_REGISTERS *IoPort;
|
||||
UINT16 AtapiError;
|
||||
|
||||
INQUIRY_DATA *pInquiryData;
|
||||
EFI_IDENTIFY_DATA *pIdData;
|
||||
ATA_PIO_MODE PioMode;
|
||||
ATA_UDMA_MODE UDma_Mode;
|
||||
CHAR8 ModelName[41];
|
||||
REQUEST_SENSE_DATA *SenseData;
|
||||
UINT8 SenseDataNumber;
|
||||
UINT8 *Cache;
|
||||
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
} IDE_BLK_IO_DEV;
|
||||
|
||||
#include "ComponentName.h"
|
||||
|
||||
#define IDE_BLOCK_IO_DEV_FROM_THIS(a) CR (a, IDE_BLK_IO_DEV, BlkIo, IDE_BLK_IO_DEV_SIGNATURE)
|
||||
#define IDE_BLOCK_IO_DEV_FROM_DISK_INFO_THIS(a) CR (a, IDE_BLK_IO_DEV, DiskInfo, IDE_BLK_IO_DEV_SIGNATURE)
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gIDEBusDriverBinding;
|
||||
|
||||
#include "ide.h"
|
||||
|
||||
//
|
||||
// Prototypes
|
||||
// Driver model protocol interface
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusControllerDriverEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - TODO: add argument description
|
||||
SystemTable - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Controller - TODO: add argument description
|
||||
RemainingDevicePath - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Controller - TODO: add argument description
|
||||
RemainingDevicePath - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Controller - TODO: add argument description
|
||||
NumberOfChildren - TODO: add argument description
|
||||
ChildHandleBuffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
//
|
||||
// Block I/O Protocol Interface
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBlkIoReset (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
ExtendedVerification - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBlkIoReadBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA LBA,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
MediaId - TODO: add argument description
|
||||
LBA - TODO: add argument description
|
||||
BufferSize - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBlkIoWriteBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA LBA,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
MediaId - TODO: add argument description
|
||||
LBA - TODO: add argument description
|
||||
BufferSize - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBlkIoFlushBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
IDERegisterDecodeEnableorDisable (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN BOOLEAN Enable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIo - TODO: add argument description
|
||||
Enable - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEDiskInfoInquiry (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *InquiryData,
|
||||
IN OUT UINT32 *IntquiryDataSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
InquiryData - TODO: add argument description
|
||||
IntquiryDataSize - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEDiskInfoIdentify (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *IdentifyData,
|
||||
IN OUT UINT32 *IdentifyDataSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
IdentifyData - TODO: add argument description
|
||||
IdentifyDataSize - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEDiskInfoSenseData (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *SenseData,
|
||||
IN OUT UINT32 *SenseDataSize,
|
||||
OUT UINT8 *SenseDataNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
SenseData - TODO: add argument description
|
||||
SenseDataSize - TODO: add argument description
|
||||
SenseDataNumber - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEDiskInfoWhichIde (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
OUT UINT32 *IdeChannel,
|
||||
OUT UINT32 *IdeDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
IdeChannel - TODO: add argument description
|
||||
IdeDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
45
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.mbd
Normal file
45
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.mbd
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>IdeBus</BaseName>
|
||||
<Guid>69FD8E47-A161-4550-B01A-5594CEB2B2B2</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Modified>2006-03-22 16:27</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>UefiRuntimeServicesTableLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>UefiDriverModelLib</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>EdkDxePrintLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
<Library>UefiDevicePathLib</Library>
|
||||
<Library>BasePerformanceLibNull</Library>
|
||||
</Libraries>
|
||||
</ModuleBuildDescription>
|
90
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.msa
Normal file
90
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.msa
Normal file
@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>IdeBus</BaseName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>69FD8E47-A161-4550-B01A-5594CEB2B2B2</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for PS2 keyboard module.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>0</Specification>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Updated>2006-03-22 16:27</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverModelLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">ReportStatusCodeLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">PerformanceLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiRuntimeServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DevicePathLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>idebus.h</Filename>
|
||||
<Filename>ide.h</Filename>
|
||||
<Filename>idedata.h</Filename>
|
||||
<Filename>idebus.c</Filename>
|
||||
<Filename>ide.c</Filename>
|
||||
<Filename>ata.c</Filename>
|
||||
<Filename>atapi.c</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
<Filename>ComponentName.h</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="TO_START">DevicePath</Protocol>
|
||||
<Protocol Usage="TO_START">PciIo</Protocol>
|
||||
<Protocol Usage="TO_START">IdeControllerInit</Protocol>
|
||||
<Protocol Usage="BY_START">BlockIo</Protocol>
|
||||
<Protocol Usage="BY_START">DiskInfo</Protocol>
|
||||
</Protocols>
|
||||
<Variables>
|
||||
<Variable Usage="ALWAYS_CONSUMED">
|
||||
<String>Configuration</String>
|
||||
<Guid>0x69fd8e47, 0xa161, 0x4550, 0xb0, 0x1a, 0x55, 0x94, 0xce, 0xb2, 0xb2, 0xb2</Guid>
|
||||
</Variable>
|
||||
</Variables>
|
||||
<Guids>
|
||||
<GuidEntry Usage="SOMETIMES_CONSUMED">
|
||||
<C_Name>DiskInfoIde</C_Name>
|
||||
</GuidEntry>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint></ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gIDEBusDriverBinding</DriverBinding>
|
||||
<ComponentName>gIDEBusComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
44
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebusLite.mbd
Normal file
44
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebusLite.mbd
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>IdeBusLite</BaseName>
|
||||
<Guid>69FD8E47-A161-4550-B01A-5594CEB2B2B2</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Modified>2006-03-19 15:18</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>UefiRuntimeServicesTableLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>UefiDriverModelLib</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibNull</Library>
|
||||
<Library>EdkDxePrintLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>UefiDevicePathLib</Library>
|
||||
<Library>BasePerformanceLibNull</Library>
|
||||
</Libraries>
|
||||
</ModuleBuildDescription>
|
86
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebusLite.msa
Normal file
86
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebusLite.msa
Normal file
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>IdeBusLite</BaseName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>69FD8E47-A161-4550-B01A-5594CEB2B2B2</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for PS2 keyboard module.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>0</Specification>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Updated>2006-03-19 15:18</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverModelLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">PerformanceLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiRuntimeServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DevicePathLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>idebus.h</Filename>
|
||||
<Filename>ide.h</Filename>
|
||||
<Filename>idedata.h</Filename>
|
||||
<Filename>idebus.c</Filename>
|
||||
<Filename>ide.c</Filename>
|
||||
<Filename>ata.c</Filename>
|
||||
<Filename>atapi.c</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">DevicePath</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciIo</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">IdeControllerInit</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">BlockIo</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">DiskInfo</Protocol>
|
||||
</Protocols>
|
||||
<Guids>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>DiskInfoIde</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>DiskInfoScsi</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>DiskInfoUsb</C_Name>
|
||||
</GuidEntry>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint></ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gIDEBusDriverBinding</DriverBinding>
|
||||
<ComponentName>gIDEBusComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
879
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idedata.h
Normal file
879
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idedata.h
Normal file
@ -0,0 +1,879 @@
|
||||
/*++
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
idedata.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Header file for IDE Bus Driver's Data Structures
|
||||
|
||||
Revision History
|
||||
++*/
|
||||
|
||||
// TODO: fix comment to end with --*/
|
||||
#ifndef _IDE_DATA_H
|
||||
#define _IDE_DATA_H
|
||||
|
||||
//
|
||||
// bit definition
|
||||
//
|
||||
#define bit0 (1 << 0)
|
||||
#define bit1 (1 << 1)
|
||||
#define bit2 (1 << 2)
|
||||
#define bit3 (1 << 3)
|
||||
#define bit4 (1 << 4)
|
||||
#define bit5 (1 << 5)
|
||||
#define bit6 (1 << 6)
|
||||
#define bit7 (1 << 7)
|
||||
#define bit8 (1 << 8)
|
||||
#define bit9 (1 << 9)
|
||||
#define bit10 (1 << 10)
|
||||
#define bit11 (1 << 11)
|
||||
#define bit12 (1 << 12)
|
||||
#define bit13 (1 << 13)
|
||||
#define bit14 (1 << 14)
|
||||
#define bit15 (1 << 15)
|
||||
#define bit16 (1 << 16)
|
||||
#define bit17 (1 << 17)
|
||||
#define bit18 (1 << 18)
|
||||
#define bit19 (1 << 19)
|
||||
#define bit20 (1 << 20)
|
||||
#define bit21 (1 << 21)
|
||||
#define bit22 (1 << 22)
|
||||
#define bit23 (1 << 23)
|
||||
#define bit24 (1 << 24)
|
||||
#define bit25 (1 << 25)
|
||||
#define bit26 (1 << 26)
|
||||
#define bit27 (1 << 27)
|
||||
#define bit28 (1 << 28)
|
||||
#define bit29 (1 << 29)
|
||||
#define bit30 (1 << 30)
|
||||
#define bit31 (1 << 31)
|
||||
|
||||
//
|
||||
// common constants
|
||||
//
|
||||
#define STALL_1_MILLI_SECOND 1000 // stall 1 ms
|
||||
#define STALL_1_SECOND 1000000 // stall 1 second
|
||||
typedef enum {
|
||||
IdePrimary = 0,
|
||||
IdeSecondary = 1,
|
||||
IdeMaxChannel = 2
|
||||
} EFI_IDE_CHANNEL;
|
||||
|
||||
typedef enum {
|
||||
IdeMaster = 0,
|
||||
IdeSlave = 1,
|
||||
IdeMaxDevice = 2
|
||||
} EFI_IDE_DEVICE;
|
||||
|
||||
typedef enum {
|
||||
IdeMagnetic, /* ZIP Drive or LS120 Floppy Drive */
|
||||
IdeCdRom, /* ATAPI CDROM */
|
||||
IdeHardDisk, /* Hard Disk */
|
||||
Ide48bitAddressingHardDisk, /* Hard Disk larger than 120GB */
|
||||
IdeUnknown
|
||||
} IDE_DEVICE_TYPE;
|
||||
|
||||
//
|
||||
// IDE Registers
|
||||
//
|
||||
typedef union {
|
||||
UINT16 Command; /* when write */
|
||||
UINT16 Status; /* when read */
|
||||
} IDE_CMD_OR_STATUS;
|
||||
|
||||
typedef union {
|
||||
UINT16 Error; /* when read */
|
||||
UINT16 Feature; /* when write */
|
||||
} IDE_ERROR_OR_FEATURE;
|
||||
|
||||
typedef union {
|
||||
UINT16 AltStatus; /* when read */
|
||||
UINT16 DeviceControl; /* when write */
|
||||
} IDE_AltStatus_OR_DeviceControl;
|
||||
|
||||
//
|
||||
// IDE registers set
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 Data;
|
||||
IDE_ERROR_OR_FEATURE Reg1;
|
||||
UINT16 SectorCount;
|
||||
UINT16 SectorNumber;
|
||||
UINT16 CylinderLsb;
|
||||
UINT16 CylinderMsb;
|
||||
UINT16 Head;
|
||||
IDE_CMD_OR_STATUS Reg;
|
||||
|
||||
IDE_AltStatus_OR_DeviceControl Alt;
|
||||
UINT16 DriveAddress;
|
||||
|
||||
UINT16 MasterSlave;
|
||||
UINT16 BusMasterBaseAddr;
|
||||
} IDE_BASE_REGISTERS;
|
||||
|
||||
//
|
||||
// IDE registers' base addresses
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 CommandBlockBaseAddr;
|
||||
UINT16 ControlBlockBaseAddr;
|
||||
UINT16 BusMasterBaseAddr;
|
||||
} IDE_REGISTERS_BASE_ADDR;
|
||||
|
||||
//
|
||||
// Bit definitions in Programming Interface byte of the Class Code field
|
||||
// in PCI IDE controller's Configuration Space
|
||||
//
|
||||
#define IDE_PRIMARY_OPERATING_MODE bit0
|
||||
#define IDE_PRIMARY_PROGRAMMABLE_INDICATOR bit1
|
||||
#define IDE_SECONDARY_OPERATING_MODE bit2
|
||||
#define IDE_SECONDARY_PROGRAMMABLE_INDICATOR bit3
|
||||
|
||||
//
|
||||
// IDE registers bit definitions
|
||||
//
|
||||
|
||||
//
|
||||
// Err Reg
|
||||
//
|
||||
#define BBK_ERR bit7 /* Bad block detected */
|
||||
#define UNC_ERR bit6 /* Uncorrectable Data */
|
||||
#define MC_ERR bit5 /* Media Change */
|
||||
#define IDNF_ERR bit4 /* ID Not Found */
|
||||
#define MCR_ERR bit3 /* Media Change Requested */
|
||||
#define ABRT_ERR bit2 /* Aborted Command */
|
||||
#define TK0NF_ERR bit1 /* Track 0 Not Found */
|
||||
#define AMNF_ERR bit0 /* Address Mark Not Found */
|
||||
|
||||
//
|
||||
// Device/Head Reg
|
||||
//
|
||||
#define LBA_MODE bit6
|
||||
#define DEV bit4
|
||||
#define HS3 bit3
|
||||
#define HS2 bit2
|
||||
#define HS1 bit1
|
||||
#define HS0 bit0
|
||||
#define CHS_MODE (0)
|
||||
#define DRV0 (0)
|
||||
#define DRV1 (1)
|
||||
#define MST_DRV DRV0
|
||||
#define SLV_DRV DRV1
|
||||
|
||||
//
|
||||
// Status Reg
|
||||
//
|
||||
#define BSY bit7 /* Controller Busy */
|
||||
#define DRDY bit6 /* Drive Ready */
|
||||
#define DWF bit5 /* Drive Write Fault */
|
||||
#define DSC bit4 /* Disk Seek Complete */
|
||||
#define DRQ bit3 /* Data Request */
|
||||
#define CORR bit2 /* Corrected Data */
|
||||
#define IDX bit1 /* Index */
|
||||
#define ERR bit0 /* Error */
|
||||
|
||||
//
|
||||
// Device Control Reg
|
||||
//
|
||||
#define SRST bit2 /* Software Reset */
|
||||
#define IEN_L bit1 /* Interrupt Enable #*/
|
||||
|
||||
//
|
||||
// Bus Master Reg
|
||||
//
|
||||
#define BMIC_nREAD bit3
|
||||
#define BMIC_START bit0
|
||||
#define BMIS_INTERRUPT bit2
|
||||
#define BMIS_ERROR bit1
|
||||
|
||||
#define BMICP_OFFSET 0x00
|
||||
#define BMISP_OFFSET 0x02
|
||||
#define BMIDP_OFFSET 0x04
|
||||
#define BMICS_OFFSET 0x08
|
||||
#define BMISS_OFFSET 0x0A
|
||||
#define BMIDS_OFFSET 0x0C
|
||||
|
||||
//
|
||||
// Time Out Value For IDE Device Polling
|
||||
//
|
||||
|
||||
//
|
||||
// ATATIMEOUT is used for waiting time out for ATA device
|
||||
//
|
||||
|
||||
//
|
||||
// 1 second
|
||||
//
|
||||
#define ATATIMEOUT 1000
|
||||
|
||||
//
|
||||
// ATAPITIMEOUT is used for waiting operation
|
||||
// except read and write time out for ATAPI device
|
||||
//
|
||||
|
||||
//
|
||||
// 1 second
|
||||
//
|
||||
#define ATAPITIMEOUT 1000
|
||||
|
||||
//
|
||||
// ATAPILONGTIMEOUT is used for waiting read and
|
||||
// write operation timeout for ATAPI device
|
||||
//
|
||||
|
||||
//
|
||||
// 2 seconds
|
||||
//
|
||||
#define CDROMLONGTIMEOUT 2000
|
||||
|
||||
//
|
||||
// 5 seconds
|
||||
//
|
||||
#define ATAPILONGTIMEOUT 5000
|
||||
|
||||
//
|
||||
// ATA Commands Code
|
||||
//
|
||||
#define ATA_INITIALIZE_DEVICE 0x91
|
||||
|
||||
//
|
||||
// Class 1
|
||||
//
|
||||
#define IDENTIFY_DRIVE_CMD 0xec
|
||||
#define READ_BUFFER_CMD 0xe4
|
||||
#define READ_SECTORS_CMD 0x20
|
||||
#define READ_SECTORS_WITH_RETRY_CMD 0x21
|
||||
#define READ_LONG_CMD 0x22
|
||||
#define READ_LONG_WITH_RETRY_CMD 0x23
|
||||
//
|
||||
// Class 1 - Atapi6 enhanced commands
|
||||
//
|
||||
#define READ_SECTORS_EXT_CMD 0x24
|
||||
|
||||
//
|
||||
// Class 2
|
||||
//
|
||||
#define FORMAT_TRACK_CMD 0x50
|
||||
#define WRITE_BUFFER_CMD 0xe8
|
||||
#define WRITE_SECTORS_CMD 0x30
|
||||
#define WRITE_SECTORS_WITH_RETRY_CMD 0x31
|
||||
#define WRITE_LONG_CMD 0x32
|
||||
#define WRITE_LONG_WITH_RETRY_CMD 0x33
|
||||
#define WRITE_VERIFY_CMD 0x3c
|
||||
//
|
||||
// Class 2 - Atapi6 enhanced commands
|
||||
//
|
||||
#define WRITE_SECTORS_EXT_CMD 0x34
|
||||
|
||||
//
|
||||
// Class 3
|
||||
//
|
||||
#define ACK_MEDIA_CHANGE_CMD 0xdb
|
||||
#define BOOT_POST_BOOT_CMD 0xdc
|
||||
#define BOOT_PRE_BOOT_CMD 0xdd
|
||||
#define CHECK_POWER_MODE_CMD 0x98
|
||||
#define CHECK_POWER_MODE_CMD_ALIAS 0xe5
|
||||
#define DOOR_LOCK_CMD 0xde
|
||||
#define DOOR_UNLOCK_CMD 0xdf
|
||||
#define EXEC_DRIVE_DIAG_CMD 0x90
|
||||
#define IDLE_CMD_ALIAS 0x97
|
||||
#define IDLE_CMD 0xe3
|
||||
#define IDLE_IMMEDIATE_CMD 0x95
|
||||
#define IDLE_IMMEDIATE_CMD_ALIAS 0xe1
|
||||
#define INIT_DRIVE_PARAM_CMD 0x91
|
||||
#define RECALIBRATE_CMD 0x10 /* aliased to 1x */
|
||||
#define READ_DRIVE_STATE_CMD 0xe9
|
||||
#define SET_MULTIPLE_MODE_CMD 0xC6
|
||||
#define READ_DRIVE_STATE_CMD 0xe9
|
||||
#define READ_VERIFY_CMD 0x40
|
||||
#define READ_VERIFY_WITH_RETRY_CMD 0x41
|
||||
#define SEEK_CMD 0x70 /* aliased to 7x */
|
||||
#define SET_FEATURES_CMD 0xef
|
||||
#define STANDBY_CMD 0x96
|
||||
#define STANDBY_CMD_ALIAS 0xe2
|
||||
#define STANDBY_IMMEDIATE_CMD 0x94
|
||||
#define STANDBY_IMMEDIATE_CMD_ALIAS 0xe0
|
||||
|
||||
//
|
||||
// Class 4
|
||||
//
|
||||
#define READ_DMA_CMD 0xc8
|
||||
#define READ_DMA_WITH_RETRY_CMD 0xc9
|
||||
#define READ_DMA_EXT_CMD 0x25
|
||||
#define WRITE_DMA_CMD 0xca
|
||||
#define WRITE_DMA_WITH_RETRY_CMD 0xcb
|
||||
#define WRITE_DMA_EXT_CMD 0x35
|
||||
|
||||
//
|
||||
// Class 5
|
||||
//
|
||||
#define READ_MULTIPLE_CMD 0xc4
|
||||
#define REST_CMD 0xe7
|
||||
#define RESTORE_DRIVE_STATE_CMD 0xea
|
||||
#define SET_SLEEP_MODE_CMD 0x99
|
||||
#define SET_SLEEP_MODE_CMD_ALIAS 0xe6
|
||||
#define WRITE_MULTIPLE_CMD 0xc5
|
||||
#define WRITE_SAME_CMD 0xe9
|
||||
|
||||
//
|
||||
// Class 6 - Host protected area access feature set
|
||||
//
|
||||
#define READ_NATIVE_MAX_ADDRESS_CMD 0xf8
|
||||
#define SET_MAX_ADDRESS_CMD 0xf9
|
||||
|
||||
//
|
||||
// Class 6 - ATA/ATAPI-6 enhanced commands
|
||||
//
|
||||
#define READ_NATIVE_MAX_ADDRESS_EXT_CMD 0x27
|
||||
#define SET_MAX_ADDRESS_CMD_EXT 0x37
|
||||
|
||||
//
|
||||
// Class 6 - SET_MAX related sub command (in feature register)
|
||||
//
|
||||
#define PARTIES_SET_MAX_ADDRESS_SUB_CMD 0x00
|
||||
#define PARTIES_SET_PASSWORD_SUB_CMD 0x01
|
||||
#define PARTIES_LOCK_SUB_CMD 0x02
|
||||
#define PARTIES_UNLOCK_SUB_CMD 0x03
|
||||
#define PARTIES_FREEZE_SUB_CMD 0x04
|
||||
|
||||
//
|
||||
// S.M.A.R.T
|
||||
//
|
||||
#define ATA_SMART_CMD 0xb0
|
||||
#define ATA_CONSTANT_C2 0xc2
|
||||
#define ATA_CONSTANT_4F 0x4f
|
||||
#define ATA_SMART_ENABLE_OPERATION 0xd8
|
||||
#define ATA_SMART_RETURN_STATUS 0xda
|
||||
|
||||
//
|
||||
// Error codes for Exec Drive Diag
|
||||
//
|
||||
#define DRIV_DIAG_NO_ERROR (0x01)
|
||||
#define DRIV_DIAG_FORMATTER_ERROR (0x02)
|
||||
#define DRIV_DIAG_DATA_BUFFER_ERROR (0x03)
|
||||
#define DRIV_DIAG_ECC_CKT_ERRROR (0x04)
|
||||
#define DRIV_DIAG_UP_ERROR (0x05)
|
||||
#define DRIV_DIAG_SLAVE_DRV_ERROR (0x80) /* aliased to 0x8x */
|
||||
|
||||
//
|
||||
// Codes for Format Track
|
||||
//
|
||||
#define FORMAT_GOOD_SECTOR (0x00)
|
||||
#define FORMAT_SUSPEND_ALLOC (0x01)
|
||||
#define FORMAT_REALLOC_SECTOR (0x02)
|
||||
#define FORMAT_MARK_SECTOR_DEFECTIVE (0x03)
|
||||
|
||||
//
|
||||
// IDE_IDENTIFY bits
|
||||
// config bits :
|
||||
//
|
||||
#define ID_CONFIG_RESERVED0 bit0
|
||||
#define ID_CONFIG_HARD_SECTORED_DRIVE bit1
|
||||
#define ID_CONFIG_SOFT_SECTORED_DRIVE bit2
|
||||
#define ID_CONFIG_NON_MFM bit3
|
||||
#define ID_CONFIG_15uS_HEAD_SWITCHING bit4
|
||||
#define ID_CONFIG_SPINDLE_MOTOR_CONTROL bit5
|
||||
#define ID_CONFIG_HARD_DRIVE bit6
|
||||
#define ID_CONFIG_CHANGEABLE_MEDIUM bit7
|
||||
#define ID_CONFIG_DATA_RATE_TO_5MHZ bit8
|
||||
#define ID_CONFIG_DATA_RATE_5_TO_10MHZ bit9
|
||||
#define ID_CONFIG_DATA_RATE_ABOVE_10MHZ bit10
|
||||
#define ID_CONFIG_MOTOR_SPEED_TOLERANCE_ABOVE_0_5_PERC bit11
|
||||
#define ID_CONFIG_DATA_CLK_OFFSET_AVAIL bit12
|
||||
#define ID_CONFIG_TRACK_OFFSET_AVAIL bit13
|
||||
#define ID_CONFIG_SPEED_TOLERANCE_GAP_NECESSARY bit14
|
||||
#define ID_CONFIG_RESERVED1 bit15
|
||||
|
||||
#define ID_DOUBLE_WORD_IO_POSSIBLE bit01
|
||||
#define ID_LBA_SUPPORTED bit9
|
||||
#define ID_DMA_SUPPORTED bit8
|
||||
|
||||
#define SET_FEATURE_ENABLE_8BIT_TRANSFER (0x01)
|
||||
#define SET_FEATURE_ENABLE_WRITE_CACHE (0x02)
|
||||
#define SET_FEATURE_TRANSFER_MODE (0x03)
|
||||
#define SET_FEATURE_WRITE_SAME_WRITE_SPECIFIC_AREA (0x22)
|
||||
#define SET_FEATURE_DISABLE_RETRIES (0x33)
|
||||
//
|
||||
// for Read & Write Longs
|
||||
//
|
||||
#define SET_FEATURE_VENDOR_SPEC_ECC_LENGTH (0x44)
|
||||
#define SET_FEATURE_PLACE_NO_OF_CACHE_SEGMENTS_IN_SECTOR_NO_REG (0x54)
|
||||
#define SET_FEATURE_DISABLE_READ_AHEAD (0x55)
|
||||
#define SET_FEATURE_MAINTAIN_PARAM_AFTER_RESET (0x66)
|
||||
#define SET_FEATURE_DISABLE_ECC (0x77)
|
||||
#define SET_FEATURE_DISABLE_8BIT_TRANSFER (0x81)
|
||||
#define SET_FEATURE_DISABLE_WRITE_CACHE (0x82)
|
||||
#define SET_FEATURE_ENABLE_ECC (0x88)
|
||||
#define SET_FEATURE_ENABLE_RETRIES (0x99)
|
||||
#define SET_FEATURE_ENABLE_READ_AHEAD (0xaa)
|
||||
#define SET_FEATURE_SET_SECTOR_CNT_REG_AS_NO_OF_READ_AHEAD_SECTORS (0xab)
|
||||
#define SET_FEATURE_ALLOW_REST_MODE (0xac)
|
||||
//
|
||||
// for Read & Write Longs
|
||||
//
|
||||
#define SET_FEATURE_4BYTE_ECC (0xbb)
|
||||
#define SET_FEATURE_DEFALUT_FEATURES_ON_SOFTWARE_RESET (0xcc)
|
||||
#define SET_FEATURE_WRITE_SAME_TO_WRITE_ENTIRE_MEDIUM (0xdd)
|
||||
|
||||
#define BLOCK_TRANSFER_MODE (0x00)
|
||||
#define SINGLE_WORD_DMA_TRANSFER_MODE (0x10)
|
||||
#define MULTI_WORD_DMA_TRANSFER_MODE (0x20)
|
||||
#define TRANSFER_MODE_MASK (0x07) // 3 LSBs
|
||||
|
||||
//
|
||||
// Drive 0 - Head 0
|
||||
//
|
||||
#define DEFAULT_DRIVE (0x00)
|
||||
#define DEFAULT_CMD (0xa0)
|
||||
//
|
||||
// default content of device control register, disable INT
|
||||
//
|
||||
#define DEFAULT_CTL (0x0a)
|
||||
#define DEFAULT_IDE_BM_IO_BASE_ADR (0xffa0)
|
||||
|
||||
//
|
||||
// ATAPI6 related data structure definition
|
||||
//
|
||||
|
||||
//
|
||||
// The maximum sectors count in 28 bit addressing mode
|
||||
//
|
||||
#define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff
|
||||
|
||||
//
|
||||
// Move the IDENTIFY section to DXE\Protocol\IdeControllerInit
|
||||
//
|
||||
|
||||
//
|
||||
// ATAPI Command
|
||||
//
|
||||
#define ATAPI_SOFT_RESET_CMD 0x08
|
||||
#define ATAPI_PACKET_CMD 0xA0
|
||||
#define PACKET_CMD 0xA0
|
||||
#define ATAPI_IDENTIFY_DEVICE_CMD 0xA1
|
||||
#define ATAPI_SERVICE_CMD 0xA2
|
||||
|
||||
//
|
||||
// ATAPI Packet Command
|
||||
//
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
UINT8 opcode;
|
||||
UINT8 reserved_1;
|
||||
UINT8 reserved_2;
|
||||
UINT8 reserved_3;
|
||||
UINT8 reserved_4;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 reserved_7;
|
||||
UINT8 reserved_8;
|
||||
UINT8 reserved_9;
|
||||
UINT8 reserved_10;
|
||||
UINT8 reserved_11;
|
||||
} TEST_UNIT_READY_CMD;
|
||||
|
||||
typedef struct {
|
||||
UINT8 opcode;
|
||||
UINT8 reserved_1 : 4;
|
||||
UINT8 lun : 4;
|
||||
UINT8 page_code;
|
||||
UINT8 reserved_3;
|
||||
UINT8 allocation_length;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 reserved_7;
|
||||
UINT8 reserved_8;
|
||||
UINT8 reserved_9;
|
||||
UINT8 reserved_10;
|
||||
UINT8 reserved_11;
|
||||
} INQUIRY_CMD;
|
||||
|
||||
typedef struct {
|
||||
UINT8 opcode;
|
||||
UINT8 reserved_1 : 4;
|
||||
UINT8 lun : 4;
|
||||
UINT8 reserved_2;
|
||||
UINT8 reserved_3;
|
||||
UINT8 allocation_length;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 reserved_7;
|
||||
UINT8 reserved_8;
|
||||
UINT8 reserved_9;
|
||||
UINT8 reserved_10;
|
||||
UINT8 reserved_11;
|
||||
} REQUEST_SENSE_CMD;
|
||||
|
||||
typedef struct {
|
||||
UINT8 opcode;
|
||||
UINT8 reserved_1 : 4;
|
||||
UINT8 lun : 4;
|
||||
UINT8 page_code : 4;
|
||||
UINT8 page_control : 4;
|
||||
UINT8 reserved_3;
|
||||
UINT8 reserved_4;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 parameter_list_length_hi;
|
||||
UINT8 parameter_list_length_lo;
|
||||
UINT8 reserved_9;
|
||||
UINT8 reserved_10;
|
||||
UINT8 reserved_11;
|
||||
} MODE_SENSE_CMD;
|
||||
|
||||
typedef struct {
|
||||
UINT8 opcode;
|
||||
UINT8 reserved_1 : 5;
|
||||
UINT8 lun : 3;
|
||||
UINT8 Lba0;
|
||||
UINT8 Lba1;
|
||||
UINT8 Lba2;
|
||||
UINT8 Lba3;
|
||||
UINT8 reserved_6;
|
||||
UINT8 TranLen0;
|
||||
UINT8 TranLen1;
|
||||
UINT8 reserved_9;
|
||||
UINT8 reserved_10;
|
||||
UINT8 reserved_11;
|
||||
} READ10_CMD;
|
||||
|
||||
typedef struct {
|
||||
UINT8 opcode;
|
||||
UINT8 reserved_1;
|
||||
UINT8 reserved_2;
|
||||
UINT8 reserved_3;
|
||||
UINT8 reserved_4;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 allocation_length_hi;
|
||||
UINT8 allocation_length_lo;
|
||||
UINT8 reserved_9;
|
||||
UINT8 reserved_10;
|
||||
UINT8 reserved_11;
|
||||
} READ_FORMAT_CAP_CMD;
|
||||
|
||||
typedef union {
|
||||
UINT16 Data16[6];
|
||||
TEST_UNIT_READY_CMD TestUnitReady;
|
||||
READ10_CMD Read10;
|
||||
REQUEST_SENSE_CMD RequestSence;
|
||||
INQUIRY_CMD Inquiry;
|
||||
MODE_SENSE_CMD ModeSense;
|
||||
READ_FORMAT_CAP_CMD ReadFormatCapacity;
|
||||
} ATAPI_PACKET_COMMAND;
|
||||
|
||||
typedef struct {
|
||||
UINT32 RegionBaseAddr;
|
||||
UINT16 ByteCount;
|
||||
UINT16 EndOfTable;
|
||||
} IDE_DMA_PRD;
|
||||
|
||||
#define MAX_DMA_EXT_COMMAND_SECTORS 0x10000
|
||||
#define MAX_DMA_COMMAND_SECTORS 0x100
|
||||
|
||||
#pragma pack()
|
||||
|
||||
//
|
||||
// Packet Command Code
|
||||
//
|
||||
#define TEST_UNIT_READY 0x00
|
||||
#define REZERO 0x01
|
||||
#define REQUEST_SENSE 0x03
|
||||
#define FORMAT_UNIT 0x04
|
||||
#define REASSIGN_BLOCKS 0x07
|
||||
#define INQUIRY 0x12
|
||||
#define START_STOP_UNIT 0x1B
|
||||
#define PREVENT_ALLOW_MEDIA_REMOVAL 0x1E
|
||||
#define READ_FORMAT_CAPACITY 0x23
|
||||
#define OLD_FORMAT_UNIT 0x24
|
||||
#define READ_CAPACITY 0x25
|
||||
#define READ_10 0x28
|
||||
#define WRITE_10 0x2A
|
||||
#define SEEK 0x2B
|
||||
#define SEND_DIAGNOSTICS 0x3D
|
||||
#define WRITE_VERIFY 0x2E
|
||||
#define VERIFY 0x2F
|
||||
#define READ_DEFECT_DATA 0x37
|
||||
#define WRITE_BUFFER 0x38
|
||||
#define READ_BUFFER 0x3C
|
||||
#define READ_LONG 0x3E
|
||||
#define WRITE_LONG 0x3F
|
||||
#define MODE_SELECT 0x55
|
||||
#define MODE_SENSE 0x5A
|
||||
#define READ_12 0xA8
|
||||
#define WRITE_12 0xAA
|
||||
#define MAX_ATAPI_BYTE_COUNT (0xfffe)
|
||||
|
||||
//
|
||||
// Sense Key
|
||||
//
|
||||
#define REQUEST_SENSE_ERROR (0x70)
|
||||
#define SK_NO_SENSE (0x0)
|
||||
#define SK_RECOVERY_ERROR (0x1)
|
||||
#define SK_NOT_READY (0x2)
|
||||
#define SK_MEDIUM_ERROR (0x3)
|
||||
#define SK_HARDWARE_ERROR (0x4)
|
||||
#define SK_ILLEGAL_REQUEST (0x5)
|
||||
#define SK_UNIT_ATTENTION (0x6)
|
||||
#define SK_DATA_PROTECT (0x7)
|
||||
#define SK_BLANK_CHECK (0x8)
|
||||
#define SK_VENDOR_SPECIFIC (0x9)
|
||||
#define SK_RESERVED_A (0xA)
|
||||
#define SK_ABORT (0xB)
|
||||
#define SK_RESERVED_C (0xC)
|
||||
#define SK_OVERFLOW (0xD)
|
||||
#define SK_MISCOMPARE (0xE)
|
||||
#define SK_RESERVED_F (0xF)
|
||||
|
||||
//
|
||||
// Additional Sense Codes
|
||||
//
|
||||
#define ASC_NOT_READY (0x04)
|
||||
#define ASC_MEDIA_ERR1 (0x10)
|
||||
#define ASC_MEDIA_ERR2 (0x11)
|
||||
#define ASC_MEDIA_ERR3 (0x14)
|
||||
#define ASC_MEDIA_ERR4 (0x30)
|
||||
#define ASC_MEDIA_UPSIDE_DOWN (0x06)
|
||||
#define ASC_INVALID_CMD (0x20)
|
||||
#define ASC_LBA_OUT_OF_RANGE (0x21)
|
||||
#define ASC_INVALID_FIELD (0x24)
|
||||
#define ASC_WRITE_PROTECTED (0x27)
|
||||
#define ASC_MEDIA_CHANGE (0x28)
|
||||
#define ASC_RESET (0x29) /* Power On Reset or Bus Reset occurred */
|
||||
#define ASC_ILLEGAL_FIELD (0x26)
|
||||
#define ASC_NO_MEDIA (0x3A)
|
||||
#define ASC_ILLEGAL_MODE_FOR_THIS_TRACK (0x64)
|
||||
|
||||
//
|
||||
// Additional Sense Code Qualifier
|
||||
//
|
||||
#define ASCQ_IN_PROGRESS (0x01)
|
||||
|
||||
#define SETFEATURE TRUE
|
||||
#define CLEARFEATURE FALSE
|
||||
|
||||
//
|
||||
// ATAPI Data structure
|
||||
//
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
UINT8 peripheral_type;
|
||||
UINT8 RMB;
|
||||
UINT8 version;
|
||||
UINT8 response_data_format;
|
||||
UINT8 addnl_length;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 reserved_7;
|
||||
UINT8 vendor_info[8];
|
||||
UINT8 product_id[12];
|
||||
UINT8 eeprom_product_code[4];
|
||||
UINT8 firmware_rev_level[4];
|
||||
UINT8 firmware_sub_rev_level[1];
|
||||
UINT8 reserved_37;
|
||||
UINT8 reserved_38;
|
||||
UINT8 reserved_39;
|
||||
UINT8 max_capacity_hi;
|
||||
UINT8 max_capacity_mid;
|
||||
UINT8 max_capacity_lo;
|
||||
UINT8 reserved_43_95[95 - 43 + 1];
|
||||
} INQUIRY_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT8 peripheral_type;
|
||||
UINT8 RMB;
|
||||
UINT8 version;
|
||||
UINT8 response_data_format;
|
||||
UINT8 addnl_length;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 reserved_7;
|
||||
UINT8 vendor_info[8];
|
||||
UINT8 product_id[16];
|
||||
UINT8 product_revision_level[4];
|
||||
UINT8 vendor_specific[20];
|
||||
UINT8 reserved_56_95[40];
|
||||
} CDROM_INQUIRY_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT8 error_code : 7;
|
||||
UINT8 valid : 1;
|
||||
UINT8 reserved_1;
|
||||
UINT8 sense_key : 4;
|
||||
UINT8 reserved_21 : 1;
|
||||
UINT8 ILI : 1;
|
||||
UINT8 reserved_22 : 2;
|
||||
UINT8 vendor_specific_3;
|
||||
UINT8 vendor_specific_4;
|
||||
UINT8 vendor_specific_5;
|
||||
UINT8 vendor_specific_6;
|
||||
UINT8 addnl_sense_length; // n - 7
|
||||
UINT8 vendor_specific_8;
|
||||
UINT8 vendor_specific_9;
|
||||
UINT8 vendor_specific_10;
|
||||
UINT8 vendor_specific_11;
|
||||
UINT8 addnl_sense_code; // mandatory
|
||||
UINT8 addnl_sense_code_qualifier; // mandatory
|
||||
UINT8 field_replaceable_unit_code; // optional
|
||||
UINT8 reserved_15;
|
||||
UINT8 reserved_16;
|
||||
UINT8 reserved_17;
|
||||
//
|
||||
// Followed by additional sense bytes : FIXME
|
||||
//
|
||||
} REQUEST_SENSE_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT8 LastLba3;
|
||||
UINT8 LastLba2;
|
||||
UINT8 LastLba1;
|
||||
UINT8 LastLba0;
|
||||
UINT8 BlockSize3;
|
||||
UINT8 BlockSize2;
|
||||
UINT8 BlockSize1;
|
||||
UINT8 BlockSize0;
|
||||
} READ_CAPACITY_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT8 reserved_0;
|
||||
UINT8 reserved_1;
|
||||
UINT8 reserved_2;
|
||||
UINT8 Capacity_Length;
|
||||
UINT8 LastLba3;
|
||||
UINT8 LastLba2;
|
||||
UINT8 LastLba1;
|
||||
UINT8 LastLba0;
|
||||
UINT8 DesCode : 2;
|
||||
UINT8 reserved_9 : 6;
|
||||
UINT8 BlockSize2;
|
||||
UINT8 BlockSize1;
|
||||
UINT8 BlockSize0;
|
||||
} READ_FORMAT_CAPACITY_DATA;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
//
|
||||
// PIO mode definition
|
||||
//
|
||||
typedef enum {
|
||||
ATA_PIO_MODE_BELOW_2,
|
||||
ATA_PIO_MODE_2,
|
||||
ATA_PIO_MODE_3,
|
||||
ATA_PIO_MODE_4
|
||||
} ATA_PIO_MODE;
|
||||
|
||||
//
|
||||
// Multi word DMA definition
|
||||
//
|
||||
typedef enum {
|
||||
ATA_MDMA_MODE_0,
|
||||
ATA_MDMA_MODE_1,
|
||||
ATA_MDMA_MODE_2
|
||||
} ATA_MDMA_MODE;
|
||||
|
||||
//
|
||||
// UDMA mode definition
|
||||
//
|
||||
typedef enum {
|
||||
ATA_UDMA_MODE_0,
|
||||
ATA_UDMA_MODE_1,
|
||||
ATA_UDMA_MODE_2,
|
||||
ATA_UDMA_MODE_3,
|
||||
ATA_UDMA_MODE_4,
|
||||
ATA_UDMA_MODE_5
|
||||
} ATA_UDMA_MODE;
|
||||
|
||||
#define ATA_MODE_CATEGORY_DEFAULT_PIO 0x00
|
||||
#define ATA_MODE_CATEGORY_FLOW_PIO 0x01
|
||||
#define ATA_MODE_CATEGORY_MDMA 0x04
|
||||
#define ATA_MODE_CATEGORY_UDMA 0x08
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
UINT8 ModeNumber : 3;
|
||||
UINT8 ModeCategory : 5;
|
||||
} ATA_TRANSFER_MODE;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Sector;
|
||||
UINT8 Heads;
|
||||
UINT8 MultipleSector;
|
||||
} ATA_DRIVE_PARMS;
|
||||
|
||||
#pragma pack()
|
||||
//
|
||||
// IORDY Sample Point field value
|
||||
//
|
||||
#define ISP_5_CLK 0
|
||||
#define ISP_4_CLK 1
|
||||
#define ISP_3_CLK 2
|
||||
#define ISP_2_CLK 3
|
||||
|
||||
//
|
||||
// Recovery Time field value
|
||||
//
|
||||
#define RECVY_4_CLK 0
|
||||
#define RECVY_3_CLK 1
|
||||
#define RECVY_2_CLK 2
|
||||
#define RECVY_1_CLK 3
|
||||
|
||||
//
|
||||
// Slave IDE Timing Register Enable
|
||||
//
|
||||
#define SITRE bit14
|
||||
|
||||
//
|
||||
// DMA Timing Enable Only Select 1
|
||||
//
|
||||
#define DTE1 bit7
|
||||
|
||||
//
|
||||
// Pre-fetch and Posting Enable Select 1
|
||||
//
|
||||
#define PPE1 bit6
|
||||
|
||||
//
|
||||
// IORDY Sample Point Enable Select 1
|
||||
//
|
||||
#define IE1 bit5
|
||||
|
||||
//
|
||||
// Fast Timing Bank Drive Select 1
|
||||
//
|
||||
#define TIME1 bit4
|
||||
|
||||
//
|
||||
// DMA Timing Enable Only Select 0
|
||||
//
|
||||
#define DTE0 bit3
|
||||
|
||||
//
|
||||
// Pre-fetch and Posting Enable Select 0
|
||||
//
|
||||
#define PPE0 bit2
|
||||
|
||||
//
|
||||
// IOREY Sample Point Enable Select 0
|
||||
//
|
||||
#define IE0 bit1
|
||||
|
||||
//
|
||||
// Fast Timing Bank Drive Select 0
|
||||
//
|
||||
#define TIME0 bit0
|
||||
|
||||
#endif
|
133
EdkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.c
Normal file
133
EdkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.c
Normal file
@ -0,0 +1,133 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
ComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include "PciBus.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName = {
|
||||
PciBusComponentNameGetDriverName,
|
||||
PciBusComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
STATIC EFI_UNICODE_STRING_TABLE mPciBusDriverNameTable[] = {
|
||||
{ "eng", (CHAR16 *) L"PCI Bus Driver" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
Language - A pointer to a three character ISO 639-2 language identifier.
|
||||
This is the language of the driver name that that the caller
|
||||
is requesting, and it must match one of the languages specified
|
||||
in SupportedLanguages. The number of languages supported by a
|
||||
driver is up to the driver writer.
|
||||
DriverName - A pointer to the Unicode string to return. This Unicode string
|
||||
is the name of the driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the Driver specified by This
|
||||
and the language specified by Language was returned
|
||||
in DriverName.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - DriverName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gPciBusComponentName.SupportedLanguages,
|
||||
mPciBusDriverNameTable,
|
||||
DriverName
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
ControllerHandle - The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
ChildHandle - The handle of the child controller to retrieve the name
|
||||
of. This is an optional parameter that may be NULL. It
|
||||
will be NULL for device drivers. It will also be NULL
|
||||
for a bus drivers that wish to retrieve the name of the
|
||||
bus controller. It will not be NULL for a bus driver
|
||||
that wishes to retrieve the name of a child controller.
|
||||
Language - A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that that the caller is requesting, and it must match one
|
||||
of the languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up to the
|
||||
driver writer.
|
||||
ControllerName - A pointer to the Unicode string to return. This Unicode
|
||||
string is the name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the language specified
|
||||
by Language from the point of view of the driver specified
|
||||
by This.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the user readable name in the
|
||||
language specified by Language for the driver
|
||||
specified by This was returned in DriverName.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - ControllerName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This is not currently managing
|
||||
the controller specified by ControllerHandle and
|
||||
ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
91
EdkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.h
Normal file
91
EdkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.h
Normal file
@ -0,0 +1,91 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
ComponentName.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_BUS_COMPONENT_NAME_H
|
||||
#define _EFI_PCI_BUS_COMPONENT_NAME_H
|
||||
|
||||
#ifndef EFI_SIZE_REDUCTION_APPLIED
|
||||
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName;
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Language - TODO: add argument description
|
||||
DriverName - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
ControllerHandle - TODO: add argument description
|
||||
ChildHandle - TODO: add argument description
|
||||
Language - TODO: add argument description
|
||||
ControllerName - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
43
EdkModulePkg/Bus/Pci/PciBus/Dxe/LightPciBus.mbd
Normal file
43
EdkModulePkg/Bus/Pci/PciBus/Dxe/LightPciBus.mbd
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>LightPciBusPciBus</BaseName>
|
||||
<Guid>C0734D12-7927-432b-986B-A7E3A35BA005</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Modified>2006-03-19 15:18</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>UefiDriverModelLib</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>EdkDxePrintLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>UefiDevicePathLib</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
</Libraries>
|
||||
</ModuleBuildDescription>
|
112
EdkModulePkg/Bus/Pci/PciBus/Dxe/LightPciBus.msa
Normal file
112
EdkModulePkg/Bus/Pci/PciBus/Dxe/LightPciBus.msa
Normal file
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>LightPciBusPciBus</BaseName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>C0734D12-7927-432b-986B-A7E3A35BA005</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for LightPciBus module.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>0</Specification>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Updated>2006-03-19 15:18</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverModelLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">ReportStatusCodeLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DevicePathLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>PciBus.h</Filename>
|
||||
<Filename>PciIo.h</Filename>
|
||||
<Filename>PciCommand.h</Filename>
|
||||
<Filename>PciDeviceSupport.h</Filename>
|
||||
<Filename>PciResourceSupport.h</Filename>
|
||||
<Filename>PciEnumerator.h</Filename>
|
||||
<Filename>PciEnumeratorSupport.h</Filename>
|
||||
<Filename>PciOptionRomSupport.h</Filename>
|
||||
<Filename>PciRomTable.h</Filename>
|
||||
<Filename>PciLib.h</Filename>
|
||||
<Filename>PciRomTable.c</Filename>
|
||||
<Filename>PciDriverOverride.h</Filename>
|
||||
<Filename>PciPowerManagement.h</Filename>
|
||||
<Filename>PciPowerManagement.c</Filename>
|
||||
<Filename>PciDriverOverride.c</Filename>
|
||||
<Filename>PciOptionRomSupport.c</Filename>
|
||||
<Filename>PciEnumerator.c</Filename>
|
||||
<Filename>PciEnumeratorSupport.c</Filename>
|
||||
<Filename>PciResourceSupport.c</Filename>
|
||||
<Filename>PciCOmmand.c</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
<Filename>PciDeviceSupport.c</Filename>
|
||||
<Filename>PciHotPlugSupport.c</Filename>
|
||||
<Filename>PciBus.c</Filename>
|
||||
<Filename>PciIo.c</Filename>
|
||||
<Filename>LightPciLib.c</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">DevicePath</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciRootBridgeIo</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">Decompress</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">UgaIo</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciPlatform</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciIo</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">BusSpecificDriverOverride</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciHotPlugRequest</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">IncompatiblePciDeviceSupport</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciHotPlugInit</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciHostBridgeResourceAllocation</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">LoadedImage</Protocol>
|
||||
</Protocols>
|
||||
<Guids>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PciOptionRomTable</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PciHotplugDevice</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>StatusCodeSpecificData</C_Name>
|
||||
</GuidEntry>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>PciBusEntryPoint</ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gPciBusDriverBinding</DriverBinding>
|
||||
<ComponentName>gPciBusComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
881
EdkModulePkg/Bus/Pci/PciBus/Dxe/LightPciLib.c
Normal file
881
EdkModulePkg/Bus/Pci/PciBus/Dxe/LightPciLib.c
Normal file
@ -0,0 +1,881 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
LightPciLib.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Light PCI Bus Driver Lib file
|
||||
It abstracts some functions that can be different
|
||||
between light PCI bus driver and full PCI bus driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "pcibus.h"
|
||||
|
||||
//
|
||||
// Light PCI bus driver woundn't support hotplug device
|
||||
// So just return
|
||||
//
|
||||
VOID
|
||||
InstallHotPlugRequestProtocol (
|
||||
IN EFI_STATUS *Status
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: Status - add argument and description to function comment
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
//
|
||||
// Light PCI bus driver woundn't support hotplug device
|
||||
// So just skip install this GUID
|
||||
//
|
||||
VOID
|
||||
InstallPciHotplugGuid (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
//
|
||||
// Light PCI bus driver woundn't support hotplug device
|
||||
// So just skip uninstall the GUID
|
||||
//
|
||||
VOID
|
||||
UninstallPciHotplugGuid (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
//
|
||||
// Light PCI bus driver woundn't support PCCard
|
||||
// So it needn't get the bar of CardBus
|
||||
//
|
||||
VOID
|
||||
GetBackPcCardBar (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
//
|
||||
// Light PCI bus driver woundn't support resource reallocation
|
||||
// So just return
|
||||
//
|
||||
EFI_STATUS
|
||||
RemoveRejectedPciDevices (
|
||||
EFI_HANDLE RootBridgeHandle,
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - TODO: Add description for return value
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Light PCI bus driver woundn't support resource reallocation
|
||||
// Simplified the code
|
||||
//
|
||||
EFI_STATUS
|
||||
PciHostBridgeResourceAllocator (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciResAlloc - add argument and description to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
PCI_IO_DEVICE *RootBridgeDev;
|
||||
EFI_HANDLE RootBridgeHandle;
|
||||
VOID *AcpiConfig;
|
||||
EFI_STATUS Status;
|
||||
UINT64 IoBase;
|
||||
UINT64 Mem32Base;
|
||||
UINT64 PMem32Base;
|
||||
UINT64 Mem64Base;
|
||||
UINT64 PMem64Base;
|
||||
UINT64 MaxOptionRomSize;
|
||||
PCI_RESOURCE_NODE *IoBridge;
|
||||
PCI_RESOURCE_NODE *Mem32Bridge;
|
||||
PCI_RESOURCE_NODE *PMem32Bridge;
|
||||
PCI_RESOURCE_NODE *Mem64Bridge;
|
||||
PCI_RESOURCE_NODE *PMem64Bridge;
|
||||
PCI_RESOURCE_NODE IoPool;
|
||||
PCI_RESOURCE_NODE Mem32Pool;
|
||||
PCI_RESOURCE_NODE PMem32Pool;
|
||||
PCI_RESOURCE_NODE Mem64Pool;
|
||||
PCI_RESOURCE_NODE PMem64Pool;
|
||||
REPORT_STATUS_CODE_LIBRARY_DEVICE_HANDLE_EXTENDED_DATA ExtendedData;
|
||||
|
||||
//
|
||||
// Initialize resource pool
|
||||
//
|
||||
|
||||
InitializeResourcePool (&IoPool, PciBarTypeIo16);
|
||||
InitializeResourcePool (&Mem32Pool, PciBarTypeMem32);
|
||||
InitializeResourcePool (&PMem32Pool, PciBarTypePMem32);
|
||||
InitializeResourcePool (&Mem64Pool, PciBarTypeMem64);
|
||||
InitializeResourcePool (&PMem64Pool, PciBarTypePMem64);
|
||||
|
||||
RootBridgeDev = NULL;
|
||||
RootBridgeHandle = 0;
|
||||
|
||||
while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
|
||||
//
|
||||
// Get RootBridg Device by handle
|
||||
//
|
||||
RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
|
||||
|
||||
if (RootBridgeDev == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// Get host bridge handle for status report
|
||||
//
|
||||
ExtendedData.Handle = RootBridgeDev->PciRootBridgeIo->ParentHandle;
|
||||
|
||||
//
|
||||
// Create the entire system resource map from the information collected by
|
||||
// enumerator. Several resource tree was created
|
||||
//
|
||||
|
||||
IoBridge = CreateResourceNode (
|
||||
RootBridgeDev,
|
||||
0,
|
||||
0xFFF,
|
||||
0,
|
||||
PciBarTypeIo16,
|
||||
PciResUsageTypical
|
||||
);
|
||||
|
||||
Mem32Bridge = CreateResourceNode (
|
||||
RootBridgeDev,
|
||||
0,
|
||||
0xFFFFF,
|
||||
0,
|
||||
PciBarTypeMem32,
|
||||
PciResUsageTypical
|
||||
);
|
||||
|
||||
PMem32Bridge = CreateResourceNode (
|
||||
RootBridgeDev,
|
||||
0,
|
||||
0xFFFFF,
|
||||
0,
|
||||
PciBarTypePMem32,
|
||||
PciResUsageTypical
|
||||
);
|
||||
|
||||
Mem64Bridge = CreateResourceNode (
|
||||
RootBridgeDev,
|
||||
0,
|
||||
0xFFFFF,
|
||||
0,
|
||||
PciBarTypeMem64,
|
||||
PciResUsageTypical
|
||||
);
|
||||
|
||||
PMem64Bridge = CreateResourceNode (
|
||||
RootBridgeDev,
|
||||
0,
|
||||
0xFFFFF,
|
||||
0,
|
||||
PciBarTypePMem64,
|
||||
PciResUsageTypical
|
||||
);
|
||||
|
||||
//
|
||||
// Create resourcemap by going through all the devices subject to this root bridge
|
||||
//
|
||||
Status = CreateResourceMap (
|
||||
RootBridgeDev,
|
||||
IoBridge,
|
||||
Mem32Bridge,
|
||||
PMem32Bridge,
|
||||
Mem64Bridge,
|
||||
PMem64Bridge
|
||||
);
|
||||
|
||||
//
|
||||
// Get the max ROM size that the root bridge can process
|
||||
//
|
||||
RootBridgeDev->RomSize = Mem32Bridge->Length;
|
||||
|
||||
//
|
||||
// Get Max Option Rom size for current root bridge
|
||||
//
|
||||
MaxOptionRomSize = GetMaxOptionRomSize (RootBridgeDev);
|
||||
|
||||
//
|
||||
// Enlarger the mem32 resource to accomdate the option rom
|
||||
// if the mem32 resource is not enough to hold the rom
|
||||
//
|
||||
if (MaxOptionRomSize > Mem32Bridge->Length) {
|
||||
|
||||
Mem32Bridge->Length = MaxOptionRomSize;
|
||||
RootBridgeDev->RomSize = MaxOptionRomSize;
|
||||
|
||||
//
|
||||
// Alignment should be adjusted as well
|
||||
//
|
||||
if (Mem32Bridge->Alignment < MaxOptionRomSize - 1) {
|
||||
Mem32Bridge->Alignment = MaxOptionRomSize - 1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Based on the all the resource tree, contruct ACPI resource node to
|
||||
// submit the resource aperture to pci host bridge protocol
|
||||
//
|
||||
Status = ConstructAcpiResourceRequestor (
|
||||
RootBridgeDev,
|
||||
IoBridge,
|
||||
Mem32Bridge,
|
||||
PMem32Bridge,
|
||||
Mem64Bridge,
|
||||
PMem64Bridge,
|
||||
&AcpiConfig
|
||||
);
|
||||
|
||||
//
|
||||
// Insert these resource nodes into the database
|
||||
//
|
||||
InsertResourceNode (&IoPool, IoBridge);
|
||||
InsertResourceNode (&Mem32Pool, Mem32Bridge);
|
||||
InsertResourceNode (&PMem32Pool, PMem32Bridge);
|
||||
InsertResourceNode (&Mem64Pool, Mem64Bridge);
|
||||
InsertResourceNode (&PMem64Pool, PMem64Bridge);
|
||||
|
||||
if (Status == EFI_SUCCESS) {
|
||||
//
|
||||
// Submit the resource requirement
|
||||
//
|
||||
Status = PciResAlloc->SubmitResources (
|
||||
PciResAlloc,
|
||||
RootBridgeDev->Handle,
|
||||
AcpiConfig
|
||||
);
|
||||
}
|
||||
//
|
||||
// Free acpi resource node
|
||||
//
|
||||
if (AcpiConfig) {
|
||||
gBS->FreePool (AcpiConfig);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Destroy all the resource tree
|
||||
//
|
||||
DestroyResourceTree (&IoPool);
|
||||
DestroyResourceTree (&Mem32Pool);
|
||||
DestroyResourceTree (&PMem32Pool);
|
||||
DestroyResourceTree (&Mem64Pool);
|
||||
DestroyResourceTree (&PMem64Pool);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
//
|
||||
// End while
|
||||
//
|
||||
|
||||
//
|
||||
// Notify pci bus driver starts to program the resource
|
||||
//
|
||||
Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeAllocateResources);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Allocation failed, then return
|
||||
//
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
//
|
||||
// Raise the EFI_IOB_PCI_RES_ALLOC status code
|
||||
//
|
||||
REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
|
||||
EFI_PROGRESS_CODE,
|
||||
EFI_IO_BUS_PCI | EFI_IOB_PCI_PC_RES_ALLOC,
|
||||
(VOID *) &ExtendedData,
|
||||
sizeof (ExtendedData)
|
||||
);
|
||||
|
||||
//
|
||||
// Notify pci bus driver starts to program the resource
|
||||
//
|
||||
NotifyPhase (PciResAlloc, EfiPciHostBridgeSetResources);
|
||||
|
||||
RootBridgeDev = NULL;
|
||||
|
||||
RootBridgeHandle = 0;
|
||||
|
||||
while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
|
||||
//
|
||||
// Get RootBridg Device by handle
|
||||
//
|
||||
RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
|
||||
|
||||
if (RootBridgeDev == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// Get acpi resource node for all the resource types
|
||||
//
|
||||
AcpiConfig = NULL;
|
||||
Status = PciResAlloc->GetProposedResources (
|
||||
PciResAlloc,
|
||||
RootBridgeDev->Handle,
|
||||
&AcpiConfig
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the resource base by interpreting acpi resource node
|
||||
//
|
||||
//
|
||||
GetResourceBase (
|
||||
AcpiConfig,
|
||||
&IoBase,
|
||||
&Mem32Base,
|
||||
&PMem32Base,
|
||||
&Mem64Base,
|
||||
&PMem64Base
|
||||
);
|
||||
|
||||
//
|
||||
// Process option rom for this root bridge
|
||||
//
|
||||
Status = ProcessOptionRom (RootBridgeDev, Mem32Base, RootBridgeDev->RomSize);
|
||||
|
||||
//
|
||||
// Create the entire system resource map from the information collected by
|
||||
// enumerator. Several resource tree was created
|
||||
//
|
||||
Status = GetResourceMap (
|
||||
RootBridgeDev,
|
||||
&IoBridge,
|
||||
&Mem32Bridge,
|
||||
&PMem32Bridge,
|
||||
&Mem64Bridge,
|
||||
&PMem64Bridge,
|
||||
&IoPool,
|
||||
&Mem32Pool,
|
||||
&PMem32Pool,
|
||||
&Mem64Pool,
|
||||
&PMem64Pool
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Program IO resources
|
||||
//
|
||||
ProgramResource (
|
||||
IoBase,
|
||||
IoBridge
|
||||
);
|
||||
|
||||
//
|
||||
// Program Mem32 resources
|
||||
//
|
||||
ProgramResource (
|
||||
Mem32Base,
|
||||
Mem32Bridge
|
||||
);
|
||||
|
||||
//
|
||||
// Program PMem32 resources
|
||||
//
|
||||
ProgramResource (
|
||||
PMem32Base,
|
||||
PMem32Bridge
|
||||
);
|
||||
|
||||
//
|
||||
// Program Mem64 resources
|
||||
//
|
||||
ProgramResource (
|
||||
Mem64Base,
|
||||
Mem64Bridge
|
||||
);
|
||||
|
||||
//
|
||||
// Program PMem64 resources
|
||||
//
|
||||
ProgramResource (
|
||||
PMem64Base,
|
||||
PMem64Bridge
|
||||
);
|
||||
|
||||
if (AcpiConfig != NULL) {
|
||||
gBS->FreePool (AcpiConfig);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Destroy all the resource tree
|
||||
//
|
||||
DestroyResourceTree (&IoPool);
|
||||
DestroyResourceTree (&Mem32Pool);
|
||||
DestroyResourceTree (&PMem32Pool);
|
||||
DestroyResourceTree (&Mem64Pool);
|
||||
DestroyResourceTree (&PMem64Pool);
|
||||
|
||||
//
|
||||
// Notify the resource allocation phase is to end
|
||||
//
|
||||
NotifyPhase (PciResAlloc, EfiPciHostBridgeEndResourceAllocation);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
PciScanBus (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT8 StartBusNumber,
|
||||
OUT UINT8 *SubBusNumber,
|
||||
OUT UINT8 *PaddedBusRange
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine is used to assign bus number to the given PCI bus system
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: Bridge - add argument and description to function comment
|
||||
// TODO: StartBusNumber - add argument and description to function comment
|
||||
// TODO: SubBusNumber - add argument and description to function comment
|
||||
// TODO: PaddedBusRange - add argument and description to function comment
|
||||
// TODO: EFI_DEVICE_ERROR - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
PCI_TYPE00 Pci;
|
||||
UINT8 Device;
|
||||
UINT8 Func;
|
||||
UINT64 Address;
|
||||
UINTN SecondBus;
|
||||
UINT16 Register;
|
||||
PCI_IO_DEVICE *PciDevice;
|
||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||
|
||||
PciRootBridgeIo = Bridge->PciRootBridgeIo;
|
||||
SecondBus = 0;
|
||||
Register = 0;
|
||||
|
||||
ResetAllPpbBusReg (Bridge, StartBusNumber);
|
||||
|
||||
for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
|
||||
for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
|
||||
|
||||
//
|
||||
// Check to see whether a pci device is present
|
||||
//
|
||||
Status = PciDevicePresent (
|
||||
PciRootBridgeIo,
|
||||
&Pci,
|
||||
StartBusNumber,
|
||||
Device,
|
||||
Func
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status) &&
|
||||
(IS_PCI_BRIDGE (&Pci) ||
|
||||
IS_CARDBUS_BRIDGE (&Pci))) {
|
||||
|
||||
//
|
||||
// Get the bridge information
|
||||
//
|
||||
Status = PciSearchDevice (
|
||||
Bridge,
|
||||
&Pci,
|
||||
StartBusNumber,
|
||||
Device,
|
||||
Func,
|
||||
&PciDevice
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
(*SubBusNumber)++;
|
||||
|
||||
SecondBus = (*SubBusNumber);
|
||||
|
||||
Register = (UINT16) ((SecondBus << 8) | (UINT16) StartBusNumber);
|
||||
|
||||
Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);
|
||||
|
||||
Status = PciRootBridgeIo->Pci.Write (
|
||||
PciRootBridgeIo,
|
||||
EfiPciWidthUint16,
|
||||
Address,
|
||||
1,
|
||||
&Register
|
||||
);
|
||||
|
||||
//
|
||||
// Initialize SubBusNumber to SecondBus
|
||||
//
|
||||
Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
|
||||
Status = PciRootBridgeIo->Pci.Write (
|
||||
PciRootBridgeIo,
|
||||
EfiPciWidthUint8,
|
||||
Address,
|
||||
1,
|
||||
SubBusNumber
|
||||
);
|
||||
//
|
||||
// If it is PPB, resursively search down this bridge
|
||||
//
|
||||
if (IS_PCI_BRIDGE (&Pci)) {
|
||||
//
|
||||
// Temporarily initialize SubBusNumber to maximum bus number to ensure the
|
||||
// PCI configuration transaction to go through any PPB
|
||||
//
|
||||
Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
|
||||
Register = 0xFF;
|
||||
Status = PciRootBridgeIo->Pci.Write (
|
||||
PciRootBridgeIo,
|
||||
EfiPciWidthUint8,
|
||||
Address,
|
||||
1,
|
||||
&Register
|
||||
);
|
||||
|
||||
PreprocessController (
|
||||
PciDevice,
|
||||
PciDevice->BusNumber,
|
||||
PciDevice->DeviceNumber,
|
||||
PciDevice->FunctionNumber,
|
||||
EfiPciBeforeChildBusEnumeration
|
||||
);
|
||||
|
||||
Status = PciScanBus (
|
||||
PciDevice,
|
||||
(UINT8) (SecondBus),
|
||||
SubBusNumber,
|
||||
PaddedBusRange
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Set the current maximum bus number under the PPB
|
||||
//
|
||||
|
||||
Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
|
||||
|
||||
Status = PciRootBridgeIo->Pci.Write (
|
||||
PciRootBridgeIo,
|
||||
EfiPciWidthUint8,
|
||||
Address,
|
||||
1,
|
||||
SubBusNumber
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
if (Func == 0 && !IS_PCI_MULTI_FUNC (&Pci)) {
|
||||
|
||||
//
|
||||
// Skip sub functions, this is not a multi function device
|
||||
//
|
||||
|
||||
Func = PCI_MAX_FUNC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Light PCI bus driver woundn't support P2C
|
||||
// Return instead
|
||||
//
|
||||
EFI_STATUS
|
||||
PciHostBridgeP2CProcess (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciResAlloc - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Light PCI bus driver woundn't support hotplug device
|
||||
// Simplified the code
|
||||
//
|
||||
EFI_STATUS
|
||||
PciHostBridgeEnumerator (
|
||||
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function is used to enumerate the entire host bridge
|
||||
in a given platform
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc A pointer to the protocol to allocate resource.
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_HANDLE RootBridgeHandle;
|
||||
PCI_IO_DEVICE *RootBridgeDev;
|
||||
EFI_STATUS Status;
|
||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||
UINT16 MinBus;
|
||||
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
|
||||
|
||||
InitializeHotPlugSupport ();
|
||||
|
||||
//
|
||||
// Notify the bus allocation phase is about to start
|
||||
//
|
||||
NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
|
||||
|
||||
RootBridgeHandle = NULL;
|
||||
while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
|
||||
|
||||
//
|
||||
// if a root bridge instance is found, create root bridge device for it
|
||||
//
|
||||
|
||||
RootBridgeDev = CreateRootBridge (RootBridgeHandle);
|
||||
|
||||
if (RootBridgeDev == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// Enumerate all the buses under this root bridge
|
||||
//
|
||||
|
||||
Status = PciRootBridgeEnumerator (
|
||||
PciResAlloc,
|
||||
RootBridgeDev
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
DestroyRootBridge (RootBridgeDev);
|
||||
|
||||
//
|
||||
// Error proccess here
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// Notify the bus allocation phase is to end
|
||||
//
|
||||
NotifyPhase (PciResAlloc, EfiPciHostBridgeEndBusAllocation);
|
||||
|
||||
//
|
||||
// Notify the resource allocation phase is to start
|
||||
//
|
||||
NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginResourceAllocation);
|
||||
|
||||
RootBridgeHandle = NULL;
|
||||
while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
|
||||
|
||||
//
|
||||
// if a root bridge instance is found, create root bridge device for it
|
||||
//
|
||||
|
||||
RootBridgeDev = CreateRootBridge (RootBridgeHandle);
|
||||
|
||||
if (RootBridgeDev == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Status = StartManagingRootBridge (RootBridgeDev);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
PciRootBridgeIo = RootBridgeDev->PciRootBridgeIo;
|
||||
Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **) &Descriptors);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = PciGetBusRange (&Descriptors, &MinBus, NULL, NULL);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Determine root bridge attribute by calling interface of Pcihostbridge
|
||||
// protocol
|
||||
//
|
||||
DetermineRootBridgeAttributes (
|
||||
PciResAlloc,
|
||||
RootBridgeDev
|
||||
);
|
||||
|
||||
//
|
||||
// Collect all the resource information under this root bridge
|
||||
// A database that records all the information about pci device subject to this
|
||||
// root bridge will then be created
|
||||
//
|
||||
Status = PciPciDeviceInfoCollector (
|
||||
RootBridgeDev,
|
||||
(UINT8) MinBus
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
InsertRootBridge (RootBridgeDev);
|
||||
|
||||
//
|
||||
// Record the hostbridge handle
|
||||
//
|
||||
AddHostBridgeEnumerator (RootBridgeDev->PciRootBridgeIo->ParentHandle);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
43
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.mbd
Normal file
43
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.mbd
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>PciBus</BaseName>
|
||||
<Guid>93B80004-9FB3-11d4-9A3A-0090273FC14D</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Modified>2006-03-19 15:18</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>UefiDriverModelLib</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>EdkDxePrintLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
<Library>UefiDevicePathLib</Library>
|
||||
</Libraries>
|
||||
</ModuleBuildDescription>
|
121
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa
Normal file
121
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa
Normal file
@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>PciBus</BaseName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>93B80004-9FB3-11d4-9A3A-0090273FC14D</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for PciBus module.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>0</Specification>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Updated>2006-03-19 15:18</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverModelLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">ReportStatusCodeLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DevicePathLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>PciBus.h</Filename>
|
||||
<Filename>PciIo.h</Filename>
|
||||
<Filename>PciCommand.h</Filename>
|
||||
<Filename>PciDeviceSupport.h</Filename>
|
||||
<Filename>PciResourceSupport.h</Filename>
|
||||
<Filename>PciEnumerator.h</Filename>
|
||||
<Filename>PciEnumeratorSupport.h</Filename>
|
||||
<Filename>PciOptionRomSupport.h</Filename>
|
||||
<Filename>PciRomTable.h</Filename>
|
||||
<Filename>PciHotPlugSupport.h</Filename>
|
||||
<Filename>PciLib.h</Filename>
|
||||
<Filename>PciHotPlugSupport.c</Filename>
|
||||
<Filename>PciRomTable.c</Filename>
|
||||
<Filename>PciDriverOverride.h</Filename>
|
||||
<Filename>PciPowerManagement.h</Filename>
|
||||
<Filename>PciPowerManagement.c</Filename>
|
||||
<Filename>PciDriverOverride.c</Filename>
|
||||
<Filename>PciOptionRomSupport.c</Filename>
|
||||
<Filename>PciEnumerator.c</Filename>
|
||||
<Filename>PciEnumeratorSupport.c</Filename>
|
||||
<Filename>PciResourceSupport.c</Filename>
|
||||
<Filename>PciCOmmand.c</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
<Filename>PciDeviceSupport.c</Filename>
|
||||
<Filename>PciBus.c</Filename>
|
||||
<Filename>PciIo.c</Filename>
|
||||
<Filename>PciLib.c</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="TO_START">DevicePath</Protocol>
|
||||
<Protocol Usage="TO_START">PciRootBridgeIo</Protocol>
|
||||
<Protocol Usage="TO_START">PciPlatform</Protocol>
|
||||
<Protocol Usage="TO_START">IncompatiblePciDeviceSupport</Protocol>
|
||||
<Protocol Usage="TO_START">PciHostBridgeResourceAllocation</Protocol>
|
||||
<Protocol Usage="TO_START">PciHotPlugInit</Protocol>
|
||||
<Protocol Usage="TO_START">Decompress</Protocol>
|
||||
<Protocol Usage="TO_START">LoadedImage</Protocol>
|
||||
<Protocol Usage="TO_START">UgaIo</Protocol>
|
||||
<Protocol Usage="BY_START">PciIo</Protocol>
|
||||
<Protocol Usage="BY_START">BusSpecificDriverOverride</Protocol>
|
||||
<Protocol Usage="ALWAYS_PRODUCED">PciHotPlugRequest</Protocol>
|
||||
</Protocols>
|
||||
<SystemTables>
|
||||
<SystemTable Usage="ALWAYS_CONSUMED">
|
||||
<Entry>gEfiUgaIoProtocolGuid</Entry>
|
||||
</SystemTable>
|
||||
<SystemTable Usage="SOMETIMES_CONSUMED">
|
||||
<Entry>gEfiPciOptionRomTableGuid</Entry>
|
||||
</SystemTable>
|
||||
</SystemTables>
|
||||
<Guids>
|
||||
<GuidEntry Usage="SOMETIMES_CONSUMED">
|
||||
<C_Name>PciOptionRomTable</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="SOMETIMES_CONSUMED">
|
||||
<C_Name>StatusCodeSpecificData</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="PRIVATE">
|
||||
<C_Name>PciHotplugDevice</C_Name>
|
||||
</GuidEntry>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>PciBusEntryPoint</ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gPciBusDriverBinding</DriverBinding>
|
||||
<ComponentName>gPciBusComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
43
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBusLite.mbd
Normal file
43
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBusLite.mbd
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>PciBusPciBusLite</BaseName>
|
||||
<Guid>C0734D12-7927-432b-986B-A7E3A35BA005</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Modified>2006-03-19 15:18</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>UefiDriverModelLib</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>EdkDxePrintLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>UefiDevicePathLib</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
</Libraries>
|
||||
</ModuleBuildDescription>
|
111
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBusLite.msa
Normal file
111
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBusLite.msa
Normal file
@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>PciBusPciBusLite</BaseName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>C0734D12-7927-432b-986B-A7E3A35BA005</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for LightPciBus module.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>0</Specification>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Updated>2006-03-19 15:18</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverModelLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">ReportStatusCodeLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DevicePathLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>PciBus.h</Filename>
|
||||
<Filename>PciIo.h</Filename>
|
||||
<Filename>PciCommand.h</Filename>
|
||||
<Filename>PciDeviceSupport.h</Filename>
|
||||
<Filename>PciResourceSupport.h</Filename>
|
||||
<Filename>PciEnumerator.h</Filename>
|
||||
<Filename>PciEnumeratorSupport.h</Filename>
|
||||
<Filename>PciOptionRomSupport.h</Filename>
|
||||
<Filename>PciRomTable.h</Filename>
|
||||
<Filename>PciLib.h</Filename>
|
||||
<Filename>PciRomTable.c</Filename>
|
||||
<Filename>PciDriverOverride.h</Filename>
|
||||
<Filename>PciPowerManagement.h</Filename>
|
||||
<Filename>PciPowerManagement.c</Filename>
|
||||
<Filename>PciDriverOverride.c</Filename>
|
||||
<Filename>PciOptionRomSupport.c</Filename>
|
||||
<Filename>PciEnumerator.c</Filename>
|
||||
<Filename>PciEnumeratorSupport.c</Filename>
|
||||
<Filename>PciResourceSupport.c</Filename>
|
||||
<Filename>PciCOmmand.c</Filename>
|
||||
<Filename>PciDeviceSupport.c</Filename>
|
||||
<Filename>PciHotPlugSupport.c</Filename>
|
||||
<Filename>PciBus.c</Filename>
|
||||
<Filename>PciIo.c</Filename>
|
||||
<Filename>LightPciLib.c</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">DevicePath</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciRootBridgeIo</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">Decompress</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">UgaIo</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciPlatform</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciIo</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">BusSpecificDriverOverride</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciHotPlugRequest</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">IncompatiblePciDeviceSupport</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciHotPlugInit</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">PciHostBridgeResourceAllocation</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">LoadedImage</Protocol>
|
||||
</Protocols>
|
||||
<Guids>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PciOptionRomTable</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PciHotplugDevice</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>StatusCodeSpecificData</C_Name>
|
||||
</GuidEntry>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>PciBusEntryPoint</ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gPciBusDriverBinding</DriverBinding>
|
||||
<ComponentName>gPciBusComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
207
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.c
Normal file
207
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.c
Normal file
@ -0,0 +1,207 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciCommand.c
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "Pcibus.h"
|
||||
|
||||
EFI_STATUS
|
||||
PciOperateRegister (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT16 Command,
|
||||
IN UINT8 Offset,
|
||||
IN UINT8 Operation,
|
||||
OUT UINT16 *PtrCommand
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: Command - add argument and description to function comment
|
||||
// TODO: Offset - add argument and description to function comment
|
||||
// TODO: Operation - add argument and description to function comment
|
||||
// TODO: PtrCommand - add argument and description to function comment
|
||||
{
|
||||
UINT16 OldCommand;
|
||||
EFI_STATUS Status;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
|
||||
OldCommand = 0;
|
||||
PciIo = &PciIoDevice->PciIo;
|
||||
|
||||
if (Operation != EFI_SET_REGISTER) {
|
||||
Status = PciIo->Pci.Read (
|
||||
PciIo,
|
||||
EfiPciIoWidthUint16,
|
||||
Offset,
|
||||
1,
|
||||
&OldCommand
|
||||
);
|
||||
|
||||
if (Operation == EFI_GET_REGISTER) {
|
||||
*PtrCommand = OldCommand;
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
if (Operation == EFI_ENABLE_REGISTER) {
|
||||
OldCommand |= Command;
|
||||
} else if (Operation == EFI_DISABLE_REGISTER) {
|
||||
OldCommand &= ~(Command);
|
||||
} else {
|
||||
OldCommand = Command;
|
||||
}
|
||||
|
||||
return PciIo->Pci.Write (
|
||||
PciIo,
|
||||
EfiPciIoWidthUint16,
|
||||
Offset,
|
||||
1,
|
||||
&OldCommand
|
||||
);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
PciCapabilitySupport (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
{
|
||||
|
||||
if (PciIoDevice->Pci.Hdr.Status & EFI_PCI_STATUS_CAPABILITY) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
LocateCapabilityRegBlock (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT8 CapId,
|
||||
IN OUT UINT8 *Offset,
|
||||
OUT UINT8 *NextRegBlock OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Locate cap reg.
|
||||
|
||||
Arguments:
|
||||
PciIoDevice - A pointer to the PCI_IO_DEVICE.
|
||||
CapId - The cap ID.
|
||||
Offset - A pointer to the offset.
|
||||
NextRegBlock - A pointer to the next block.
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: EFI_UNSUPPORTED - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
{
|
||||
UINT8 CapabilityPtr;
|
||||
UINT16 CapabilityEntry;
|
||||
UINT8 CapabilityID;
|
||||
|
||||
//
|
||||
// To check the cpability of this device supports
|
||||
//
|
||||
if (!PciCapabilitySupport (PciIoDevice)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (*Offset != 0) {
|
||||
CapabilityPtr = *Offset;
|
||||
} else {
|
||||
|
||||
CapabilityPtr = 0;
|
||||
if (IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {
|
||||
|
||||
PciIoDevice->PciIo.Pci.Read (
|
||||
&PciIoDevice->PciIo,
|
||||
EfiPciIoWidthUint8,
|
||||
EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR,
|
||||
1,
|
||||
&CapabilityPtr
|
||||
);
|
||||
} else {
|
||||
|
||||
PciIoDevice->PciIo.Pci.Read (
|
||||
&PciIoDevice->PciIo,
|
||||
EfiPciIoWidthUint8,
|
||||
EFI_PCI_CAPABILITY_PTR,
|
||||
1,
|
||||
&CapabilityPtr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
while (CapabilityPtr > 0x3F) {
|
||||
//
|
||||
// Mask it to DWORD alignment per PCI spec
|
||||
//
|
||||
CapabilityPtr &= 0xFC;
|
||||
PciIoDevice->PciIo.Pci.Read (
|
||||
&PciIoDevice->PciIo,
|
||||
EfiPciIoWidthUint16,
|
||||
CapabilityPtr,
|
||||
1,
|
||||
&CapabilityEntry
|
||||
);
|
||||
|
||||
CapabilityID = (UINT8) CapabilityEntry;
|
||||
|
||||
if (CapabilityID == CapId) {
|
||||
*Offset = CapabilityPtr;
|
||||
if (NextRegBlock != NULL) {
|
||||
*NextRegBlock = (UINT8) (CapabilityEntry >> 8);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
CapabilityPtr = (UINT8) (CapabilityEntry >> 8);
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
134
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.h
Normal file
134
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.h
Normal file
@ -0,0 +1,134 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciCommand.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_COMMAND_H
|
||||
#define _EFI_PCI_COMMAND_H
|
||||
|
||||
#define EFI_GET_REGISTER 1
|
||||
#define EFI_SET_REGISTER 2
|
||||
#define EFI_ENABLE_REGISTER 3
|
||||
#define EFI_DISABLE_REGISTER 4
|
||||
|
||||
EFI_STATUS
|
||||
PciOperateRegister (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT16 Command,
|
||||
IN UINT8 Offset,
|
||||
IN UINT8 Operation,
|
||||
OUT UINT16 *PtrCommand
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Command - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
PtrCommand - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
PciCapabilitySupport (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
LocateCapabilityRegBlock (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT8 CapId,
|
||||
IN OUT UINT8 *Offset,
|
||||
OUT UINT8 *NextRegBlock OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
CapId - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
NextRegBlock - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
#define PciReadCommandRegister(a,b) \
|
||||
PciOperateRegister (a,0, PCI_COMMAND_OFFSET, EFI_GET_REGISTER, b)
|
||||
|
||||
#define PciSetCommandRegister(a,b) \
|
||||
PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_SET_REGISTER, NULL)
|
||||
|
||||
#define PciEnableCommandRegister(a,b) \
|
||||
PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_ENABLE_REGISTER, NULL)
|
||||
|
||||
#define PciDisableCommandRegister(a,b) \
|
||||
PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_DISABLE_REGISTER, NULL)
|
||||
|
||||
#define PciReadBridgeControlRegister(a,b) \
|
||||
PciOperateRegister (a,0, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_GET_REGISTER, b)
|
||||
|
||||
#define PciSetBridgeControlRegister(a,b) \
|
||||
PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_SET_REGISTER, NULL)
|
||||
|
||||
#define PciEnableBridgeControlRegister(a,b) \
|
||||
PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_ENABLE_REGISTER, NULL)
|
||||
|
||||
#define PciDisableBridgeControlRegister(a,b) \
|
||||
PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_DISABLE_REGISTER, NULL)
|
||||
|
||||
#endif
|
1345
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c
Normal file
1345
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c
Normal file
File diff suppressed because it is too large
Load Diff
477
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.h
Normal file
477
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.h
Normal file
@ -0,0 +1,477 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciDeviceSupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_DEVICE_SUPPORT_H
|
||||
#define _EFI_PCI_DEVICE_SUPPORT_H
|
||||
|
||||
EFI_STATUS
|
||||
InitializePciDevicePool (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InsertRootBridge (
|
||||
PCI_IO_DEVICE *RootBridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InsertPciDevice (
|
||||
PCI_IO_DEVICE *Bridge,
|
||||
PCI_IO_DEVICE *PciDeviceNode
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
PciDeviceNode - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DestroyRootBridge (
|
||||
IN PCI_IO_DEVICE *RootBridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DestroyPciDeviceTree (
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DestroyRootBridgeByHandle (
|
||||
EFI_HANDLE Controller
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RegisterPciDevice (
|
||||
IN EFI_HANDLE Controller,
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
OUT EFI_HANDLE *Handle OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
PciIoDevice - TODO: add argument description
|
||||
Handle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RemoveAllPciDeviceOnBridge (
|
||||
EFI_HANDLE RootBridgeHandle,
|
||||
PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DeRegisterPciDevice (
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_HANDLE Handle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
Handle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
StartPciDevicesOnBridge (
|
||||
IN EFI_HANDLE Controller,
|
||||
IN PCI_IO_DEVICE *RootBridge,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
|
||||
IN OUT UINT8 *NumberOfChildren,
|
||||
IN OUT EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
RootBridge - TODO: add argument description
|
||||
RemainingDevicePath - TODO: add argument description
|
||||
NumberOfChildren - TODO: add argument description
|
||||
ChildHandleBuffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
StartPciDevices (
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
RemainingDevicePath - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
CreateRootBridge (
|
||||
IN EFI_HANDLE RootBridgeHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
GetRootBridgeByHandle (
|
||||
EFI_HANDLE RootBridgeHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
RootBridgeExisted (
|
||||
IN EFI_HANDLE RootBridgeHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
PciDeviceExisted (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
ActiveVGADeviceOnTheSameSegment (
|
||||
IN PCI_IO_DEVICE *VgaDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
VgaDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
ActiveVGADeviceOnTheRootBridge (
|
||||
IN PCI_IO_DEVICE *RootBridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetHpcPciAddress (
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
|
||||
OUT UINT64 *PciAddress
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciRootBridgeIo - TODO: add argument description
|
||||
HpcDevicePath - TODO: add argument description
|
||||
PciAddress - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetHpcPciAddressFromRootBridge (
|
||||
IN PCI_IO_DEVICE *RootBridge,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
|
||||
OUT UINT64 *PciAddress
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridge - TODO: add argument description
|
||||
RemainingDevicePath - TODO: add argument description
|
||||
PciAddress - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FreePciDevice (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
290
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
Normal file
290
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
Normal file
@ -0,0 +1,290 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciDriverOverride.c
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "pcibus.h"
|
||||
|
||||
EFI_STATUS
|
||||
InitializePciDriverOverrideInstance (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initializes a PCI Driver Override Instance
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
PciIoDevice->PciDriverOverride.GetDriver = GetDriver;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetDriver (
|
||||
IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *This,
|
||||
IN OUT EFI_HANDLE *DriverImageHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Get a overriding driver image
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: DriverImageHandle - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_INVALID_PARAMETER - add return value to function comment
|
||||
{
|
||||
PCI_IO_DEVICE *PciIoDevice;
|
||||
LIST_ENTRY *CurrentLink;
|
||||
PCI_DRIVER_OVERRIDE_LIST *Node;
|
||||
|
||||
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_DRIVER_OVERRIDE_THIS (This);
|
||||
|
||||
CurrentLink = PciIoDevice->OptionRomDriverList.ForwardLink;
|
||||
|
||||
while (CurrentLink && CurrentLink != &PciIoDevice->OptionRomDriverList) {
|
||||
|
||||
Node = DRIVER_OVERRIDE_FROM_LINK (CurrentLink);
|
||||
|
||||
if (*DriverImageHandle == NULL) {
|
||||
|
||||
*DriverImageHandle = Node->DriverImageHandle;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (*DriverImageHandle == Node->DriverImageHandle) {
|
||||
|
||||
if (CurrentLink->ForwardLink == &PciIoDevice->OptionRomDriverList ||
|
||||
CurrentLink->ForwardLink == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// Get next node
|
||||
//
|
||||
Node = DRIVER_OVERRIDE_FROM_LINK (CurrentLink->ForwardLink);
|
||||
*DriverImageHandle = Node->DriverImageHandle;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
CurrentLink = CurrentLink->ForwardLink;
|
||||
}
|
||||
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
AddDriver (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN EFI_HANDLE DriverImageHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Add a overriding driver image
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: DriverImageHandle - add argument and description to function comment
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_IMAGE_DOS_HEADER *DosHdr;
|
||||
EFI_IMAGE_NT_HEADERS *PeHdr;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||
PCI_DRIVER_OVERRIDE_LIST *Node;
|
||||
EFI_DRIVER_OS_HANDOFF_HEADER *DriverOsHandoffHeader;
|
||||
EFI_DRIVER_OS_HANDOFF_HEADER *NewDriverOsHandoffHeader;
|
||||
EFI_DRIVER_OS_HANDOFF *DriverOsHandoff;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_HANDLE DeviceHandle;
|
||||
UINTN NumberOfEntries;
|
||||
UINTN Size;
|
||||
UINTN Index;
|
||||
|
||||
Status = gBS->HandleProtocol (DriverImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Node = AllocatePool (sizeof (PCI_DRIVER_OVERRIDE_LIST));
|
||||
if (Node == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Node->Signature = DRIVER_OVERRIDE_SIGNATURE;
|
||||
Node->DriverImageHandle = DriverImageHandle;
|
||||
|
||||
InsertTailList (&PciIoDevice->OptionRomDriverList, &(Node->Link));
|
||||
|
||||
PciIoDevice->BusOverride = TRUE;
|
||||
|
||||
DosHdr = (EFI_IMAGE_DOS_HEADER *) LoadedImage->ImageBase;
|
||||
if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
PeHdr = (EFI_IMAGE_NT_HEADERS *) ((UINTN) LoadedImage->ImageBase + DosHdr->e_lfanew);
|
||||
|
||||
if (PeHdr->FileHeader.Machine != EFI_IMAGE_MACHINE_EBC) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
DriverOsHandoffHeader = NULL;
|
||||
Status = EfiGetSystemConfigurationTable (&gEfiUgaIoProtocolGuid, (VOID **) &DriverOsHandoffHeader);
|
||||
if (!EFI_ERROR (Status) && DriverOsHandoffHeader != NULL) {
|
||||
for (Index = 0; Index < DriverOsHandoffHeader->NumberOfEntries; Index++) {
|
||||
DriverOsHandoff = (EFI_DRIVER_OS_HANDOFF *)((UINTN)(DriverOsHandoffHeader) +
|
||||
DriverOsHandoffHeader->HeaderSize +
|
||||
Index * DriverOsHandoffHeader->SizeOfEntries);
|
||||
DevicePath = DriverOsHandoff->DevicePath;
|
||||
Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, &DeviceHandle);
|
||||
if (!EFI_ERROR (Status) && DeviceHandle != NULL && IsDevicePathEnd (DevicePath)) {
|
||||
if (DeviceHandle == PciIoDevice->Handle) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NumberOfEntries = DriverOsHandoffHeader->NumberOfEntries + 1;
|
||||
} else {
|
||||
NumberOfEntries = 1;
|
||||
}
|
||||
|
||||
Status = gBS->AllocatePool (
|
||||
EfiRuntimeServicesData,
|
||||
sizeof (EFI_DRIVER_OS_HANDOFF_HEADER) + NumberOfEntries * sizeof (EFI_DRIVER_OS_HANDOFF),
|
||||
(VOID **) &NewDriverOsHandoffHeader
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (DriverOsHandoffHeader == NULL) {
|
||||
NewDriverOsHandoffHeader->Version = 0;
|
||||
NewDriverOsHandoffHeader->HeaderSize = sizeof (EFI_DRIVER_OS_HANDOFF_HEADER);
|
||||
NewDriverOsHandoffHeader->SizeOfEntries = sizeof (EFI_DRIVER_OS_HANDOFF);
|
||||
NewDriverOsHandoffHeader->NumberOfEntries = (UINT32) NumberOfEntries;
|
||||
} else {
|
||||
gBS->CopyMem (
|
||||
NewDriverOsHandoffHeader,
|
||||
DriverOsHandoffHeader,
|
||||
DriverOsHandoffHeader->HeaderSize + (NumberOfEntries - 1) * DriverOsHandoffHeader->SizeOfEntries
|
||||
);
|
||||
NewDriverOsHandoffHeader->NumberOfEntries = (UINT32) NumberOfEntries;
|
||||
}
|
||||
|
||||
DriverOsHandoff = (EFI_DRIVER_OS_HANDOFF *)((UINTN)NewDriverOsHandoffHeader +
|
||||
NewDriverOsHandoffHeader->HeaderSize +
|
||||
(NumberOfEntries - 1) * NewDriverOsHandoffHeader->SizeOfEntries);
|
||||
|
||||
//
|
||||
// Fill in the EFI_DRIVER_OS_HANDOFF structure
|
||||
//
|
||||
DriverOsHandoff->Type = EfiUgaDriverFromPciRom;
|
||||
|
||||
//
|
||||
// Compute the size of the device path
|
||||
//
|
||||
Size = GetDevicePathSize (PciIoDevice->DevicePath);
|
||||
if (Size == 0) {
|
||||
DriverOsHandoff->DevicePath = NULL;
|
||||
} else {
|
||||
|
||||
//
|
||||
// Allocate space for duplicate device path
|
||||
//
|
||||
Status = gBS->AllocatePool (
|
||||
EfiRuntimeServicesData,
|
||||
Size,
|
||||
(VOID **) &DriverOsHandoff->DevicePath
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (NewDriverOsHandoffHeader);
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Make copy of device path
|
||||
//
|
||||
CopyMem (DriverOsHandoff->DevicePath, PciIoDevice->DevicePath, Size);
|
||||
}
|
||||
|
||||
DriverOsHandoff->PciRomSize = (UINT64) PciIoDevice->PciIo.RomSize;
|
||||
Status = gBS->AllocatePool (
|
||||
EfiRuntimeServicesData,
|
||||
(UINTN) DriverOsHandoff->PciRomSize,
|
||||
(VOID **) &DriverOsHandoff->PciRomImage
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (NewDriverOsHandoffHeader);
|
||||
return Status;
|
||||
}
|
||||
|
||||
gBS->CopyMem (
|
||||
DriverOsHandoff->PciRomImage,
|
||||
PciIoDevice->PciIo.RomImage,
|
||||
(UINTN) DriverOsHandoff->PciRomSize
|
||||
);
|
||||
|
||||
Status = gBS->InstallConfigurationTable (&gEfiUgaIoProtocolGuid, NewDriverOsHandoffHeader);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (DriverOsHandoffHeader != NULL) {
|
||||
gBS->FreePool (DriverOsHandoffHeader);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
108
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.h
Normal file
108
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.h
Normal file
@ -0,0 +1,108 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciDriverOverride.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_DRIVER_OVERRRIDE_H
|
||||
#define _EFI_PCI_DRIVER_OVERRRIDE_H
|
||||
|
||||
#define DRIVER_OVERRIDE_SIGNATURE EFI_SIGNATURE_32 ('d', 'r', 'o', 'v')
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
EFI_HANDLE DriverImageHandle;
|
||||
} PCI_DRIVER_OVERRIDE_LIST;
|
||||
|
||||
|
||||
#define DRIVER_OVERRIDE_FROM_LINK(a) \
|
||||
CR (a, PCI_DRIVER_OVERRIDE_LIST, Link, DRIVER_OVERRIDE_SIGNATURE)
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
InitializePciDriverOverrideInstance (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AddDriver (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN EFI_HANDLE DriverImageHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
DriverImageHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetDriver (
|
||||
IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *This,
|
||||
IN OUT EFI_HANDLE *DriverImageHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
DriverImageHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
2164
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.c
Normal file
2164
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.c
Normal file
File diff suppressed because it is too large
Load Diff
628
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.h
Normal file
628
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.h
Normal file
@ -0,0 +1,628 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciEnumerator.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_ENUMERATOR_H
|
||||
#define _EFI_PCI_ENUMERATOR_H
|
||||
|
||||
#include "PciResourceSupport.h"
|
||||
|
||||
EFI_STATUS
|
||||
PciEnumerator (
|
||||
IN EFI_HANDLE Controller
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciRootBridgeEnumerator (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
|
||||
IN PCI_IO_DEVICE *RootBridgeDev
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
RootBridgeDev - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProcessOptionRom (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT64 RomBase,
|
||||
IN UINT64 MaxLength
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
RomBase - TODO: add argument description
|
||||
MaxLength - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciAssignBusNumber (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT8 StartBusNumber,
|
||||
OUT UINT8 *SubBusNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
StartBusNumber - TODO: add argument description
|
||||
SubBusNumber - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DetermineRootBridgeAttributes (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
|
||||
IN PCI_IO_DEVICE *RootBridgeDev
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
RootBridgeDev - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
UINT64
|
||||
GetMaxOptionRomSize (
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeDeviceAttribute (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetResourceAllocationStatus (
|
||||
VOID *AcpiConfig,
|
||||
OUT UINT64 *IoResStatus,
|
||||
OUT UINT64 *Mem32ResStatus,
|
||||
OUT UINT64 *PMem32ResStatus,
|
||||
OUT UINT64 *Mem64ResStatus,
|
||||
OUT UINT64 *PMem64ResStatus
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AcpiConfig - TODO: add argument description
|
||||
IoResStatus - TODO: add argument description
|
||||
Mem32ResStatus - TODO: add argument description
|
||||
PMem32ResStatus - TODO: add argument description
|
||||
Mem64ResStatus - TODO: add argument description
|
||||
PMem64ResStatus - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RejectPciDevice (
|
||||
IN PCI_IO_DEVICE *PciDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
IsRejectiveDevice (
|
||||
IN PCI_RESOURCE_NODE *PciResNode
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResNode - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_RESOURCE_NODE *
|
||||
GetLargerConsumerDevice (
|
||||
IN PCI_RESOURCE_NODE *PciResNode1,
|
||||
IN PCI_RESOURCE_NODE *PciResNode2
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResNode1 - TODO: add argument description
|
||||
PciResNode2 - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_RESOURCE_NODE *
|
||||
GetMaxResourceConsumerDevice (
|
||||
IN PCI_RESOURCE_NODE *ResPool
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ResPool - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeAdjustAllocation (
|
||||
IN PCI_RESOURCE_NODE *IoPool,
|
||||
IN PCI_RESOURCE_NODE *Mem32Pool,
|
||||
IN PCI_RESOURCE_NODE *PMem32Pool,
|
||||
IN PCI_RESOURCE_NODE *Mem64Pool,
|
||||
IN PCI_RESOURCE_NODE *PMem64Pool,
|
||||
IN UINT64 IoResStatus,
|
||||
IN UINT64 Mem32ResStatus,
|
||||
IN UINT64 PMem32ResStatus,
|
||||
IN UINT64 Mem64ResStatus,
|
||||
IN UINT64 PMem64ResStatus
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
IoPool - TODO: add argument description
|
||||
Mem32Pool - TODO: add argument description
|
||||
PMem32Pool - TODO: add argument description
|
||||
Mem64Pool - TODO: add argument description
|
||||
PMem64Pool - TODO: add argument description
|
||||
IoResStatus - TODO: add argument description
|
||||
Mem32ResStatus - TODO: add argument description
|
||||
PMem32ResStatus - TODO: add argument description
|
||||
Mem64ResStatus - TODO: add argument description
|
||||
PMem64ResStatus - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ConstructAcpiResourceRequestor (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_RESOURCE_NODE *IoNode,
|
||||
IN PCI_RESOURCE_NODE *Mem32Node,
|
||||
IN PCI_RESOURCE_NODE *PMem32Node,
|
||||
IN PCI_RESOURCE_NODE *Mem64Node,
|
||||
IN PCI_RESOURCE_NODE *PMem64Node,
|
||||
OUT VOID **pConfig
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
IoNode - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
pConfig - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetResourceBase (
|
||||
IN VOID *pConfig,
|
||||
OUT UINT64 *IoBase,
|
||||
OUT UINT64 *Mem32Base,
|
||||
OUT UINT64 *PMem32Base,
|
||||
OUT UINT64 *Mem64Base,
|
||||
OUT UINT64 *PMem64Base
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
pConfig - TODO: add argument description
|
||||
IoBase - TODO: add argument description
|
||||
Mem32Base - TODO: add argument description
|
||||
PMem32Base - TODO: add argument description
|
||||
Mem64Base - TODO: add argument description
|
||||
PMem64Base - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciBridgeEnumerator (
|
||||
IN PCI_IO_DEVICE *BridgeDev
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
BridgeDev - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciBridgeResourceAllocator (
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetResourceBaseFromBridge (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
OUT UINT64 *IoBase,
|
||||
OUT UINT64 *Mem32Base,
|
||||
OUT UINT64 *PMem32Base,
|
||||
OUT UINT64 *Mem64Base,
|
||||
OUT UINT64 *PMem64Base
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
IoBase - TODO: add argument description
|
||||
Mem32Base - TODO: add argument description
|
||||
PMem32Base - TODO: add argument description
|
||||
Mem64Base - TODO: add argument description
|
||||
PMem64Base - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeP2CProcess (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
NotifyPhase (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
|
||||
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
Phase - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PreprocessController (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT8 Bus,
|
||||
IN UINT8 Device,
|
||||
IN UINT8 Func,
|
||||
IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
Phase - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciHotPlugRequestNotify (
|
||||
IN EFI_PCI_HOTPLUG_REQUEST_PROTOCOL * This,
|
||||
IN EFI_PCI_HOTPLUG_OPERATION Operation,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL,
|
||||
IN OUT UINT8 *NumberOfChildren,
|
||||
IN OUT EFI_HANDLE * ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
Controller - TODO: add argument description
|
||||
RemainingDevicePath - TODO: add argument description
|
||||
NumberOfChildren - TODO: add argument description
|
||||
ChildHandleBuffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
SearchHostBridgeHandle (
|
||||
IN EFI_HANDLE RootBridgeHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AddHostBridgeEnumerator (
|
||||
IN EFI_HANDLE HostBridgeHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
HostBridgeHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
2261
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.c
Normal file
2261
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.c
Normal file
File diff suppressed because it is too large
Load Diff
598
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.h
Normal file
598
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.h
Normal file
@ -0,0 +1,598 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciEnumeratorSupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_ENUMERATOR_SUPPORT_H
|
||||
#define _EFI_PCI_ENUMERATOR_SUPPORT_H
|
||||
|
||||
EFI_STATUS
|
||||
PciDevicePresent (
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||
PCI_TYPE00 *Pci,
|
||||
UINT8 Bus,
|
||||
UINT8 Device,
|
||||
UINT8 Func
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciRootBridgeIo - TODO: add argument description
|
||||
Pci - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciPciDeviceInfoCollector (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
UINT8 StartBusNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
StartBusNumber - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciSearchDevice (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
PCI_TYPE00 *Pci,
|
||||
UINT8 Bus,
|
||||
UINT8 Device,
|
||||
UINT8 Func,
|
||||
PCI_IO_DEVICE **PciDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Pci - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
PciDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
GatherDeviceInfo (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_TYPE00 *Pci,
|
||||
UINT8 Bus,
|
||||
UINT8 Device,
|
||||
UINT8 Func
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Pci - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
GatherPpbInfo (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_TYPE00 *Pci,
|
||||
UINT8 Bus,
|
||||
UINT8 Device,
|
||||
UINT8 Func
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Pci - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
GatherP2CInfo (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_TYPE00 *Pci,
|
||||
UINT8 Bus,
|
||||
UINT8 Device,
|
||||
UINT8 Func
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Pci - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
CreatePciDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ParentDevicePath - TODO: add argument description
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
BarExisted (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINTN Offset,
|
||||
OUT UINT32 *BarLengthValue,
|
||||
OUT UINT32 *OriginalBarValue
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
BarLengthValue - TODO: add argument description
|
||||
OriginalBarValue - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciTestSupportedAttribute (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT16 *Command,
|
||||
IN UINT16 *BridgeControl,
|
||||
IN UINT16 *OldCommand,
|
||||
IN UINT16 *OldBridgeControl
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Command - TODO: add argument description
|
||||
BridgeControl - TODO: add argument description
|
||||
OldCommand - TODO: add argument description
|
||||
OldBridgeControl - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciSetDeviceAttribute (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT16 Command,
|
||||
IN UINT16 BridgeControl,
|
||||
IN UINTN Option
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Command - TODO: add argument description
|
||||
BridgeControl - TODO: add argument description
|
||||
Option - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetFastBackToBackSupport (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT8 StatusIndex
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
StatusIndex - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DetermineDeviceAttribute (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
UpdatePciInfo (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID
|
||||
SetNewAlign (
|
||||
IN UINT64 *Alignment,
|
||||
IN UINT64 NewAlignment
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Alignment - TODO: add argument description
|
||||
NewAlignment - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
UINTN
|
||||
PciParseBar (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINTN Offset,
|
||||
IN UINTN BarIndex
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializePciDevice (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializePpb (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializeP2C (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
CreatePciIoDevice (
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||
IN PCI_TYPE00 *Pci,
|
||||
UINT8 Bus,
|
||||
UINT8 Device,
|
||||
UINT8 Func
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciRootBridgeIo - TODO: add argument description
|
||||
Pci - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciEnumeratorLight (
|
||||
IN EFI_HANDLE Controller
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciGetBusRange (
|
||||
IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,
|
||||
OUT UINT16 *MinBus,
|
||||
OUT UINT16 *MaxBus,
|
||||
OUT UINT16 *BusRange
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Descriptors - TODO: add argument description
|
||||
MinBus - TODO: add argument description
|
||||
MaxBus - TODO: add argument description
|
||||
BusRange - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
StartManagingRootBridge (
|
||||
IN PCI_IO_DEVICE *RootBridgeDev
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeDev - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
IsPciDeviceRejected (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
462
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.c
Normal file
462
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.c
Normal file
@ -0,0 +1,462 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciHotPlugSupport.c
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "Pcibus.h"
|
||||
#include "PciHotPlugSupport.h"
|
||||
|
||||
EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
|
||||
EFI_HPC_LOCATION *gPciRootHpcPool;
|
||||
UINTN gPciRootHpcCount;
|
||||
ROOT_HPC_DATA *gPciRootHpcData;
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
PciHPCInitialized (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: Event - add argument and description to function comment
|
||||
// TODO: Context - add argument and description to function comment
|
||||
{
|
||||
ROOT_HPC_DATA *HpcData;
|
||||
|
||||
HpcData = (ROOT_HPC_DATA *) Context;
|
||||
HpcData->Initialized = TRUE;
|
||||
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
EfiCompareDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: DevicePath1 - add argument and description to function comment
|
||||
// TODO: DevicePath2 - add argument and description to function comment
|
||||
{
|
||||
UINTN Size1;
|
||||
UINTN Size2;
|
||||
|
||||
Size1 = GetDevicePathSize (DevicePath1);
|
||||
Size2 = GetDevicePathSize (DevicePath2);
|
||||
|
||||
if (Size1 != Size2) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (CompareMem (DevicePath1, DevicePath2, Size1)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
InitializeHotPlugSupport (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: EFI_UNSUPPORTED - add return value to function comment
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HPC_LOCATION *HpcList;
|
||||
UINTN HpcCount;
|
||||
|
||||
//
|
||||
// Locate the PciHotPlugInit Protocol
|
||||
// If it doesn't exist, that means there is no
|
||||
// hot plug controller supported on the platform
|
||||
// the PCI Bus driver is running on. HotPlug Support
|
||||
// is an optional feature, so absence of the protocol
|
||||
// won't incur the penalty
|
||||
//
|
||||
gPciHotPlugInit = NULL;
|
||||
gPciRootHpcPool = NULL;
|
||||
gPciRootHpcCount = 0;
|
||||
gPciRootHpcData = NULL;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiPciHotPlugInitProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &gPciHotPlugInit
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = gPciHotPlugInit->GetRootHpcList (
|
||||
gPciHotPlugInit,
|
||||
&HpcCount,
|
||||
&HpcList
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
|
||||
gPciRootHpcPool = HpcList;
|
||||
gPciRootHpcCount = HpcCount;
|
||||
gPciRootHpcData = AllocateZeroPool (sizeof (ROOT_HPC_DATA) * gPciRootHpcCount);
|
||||
if (gPciRootHpcData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsRootPciHotPlugBus (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
|
||||
OUT UINTN *HpIndex
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
HpcDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCOL.
|
||||
HpIndex - A pointer to the Index.
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: HpbDevicePath - add argument and description to function comment
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; Index < gPciRootHpcCount; Index++) {
|
||||
|
||||
if (EfiCompareDevicePath (gPciRootHpcPool[Index].HpbDevicePath, HpbDevicePath)) {
|
||||
|
||||
if (HpIndex != NULL) {
|
||||
*HpIndex = Index;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsRootPciHotPlugController (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
|
||||
OUT UINTN *HpIndex
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
HpcDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCOL.
|
||||
HpIndex - A pointer to the Index.
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; Index < gPciRootHpcCount; Index++) {
|
||||
|
||||
if (EfiCompareDevicePath (gPciRootHpcPool[Index].HpcDevicePath, HpcDevicePath)) {
|
||||
|
||||
if (HpIndex != NULL) {
|
||||
*HpIndex = Index;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateEventForHpc (
|
||||
IN UINTN HpIndex,
|
||||
OUT EFI_EVENT *Event
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: HpIndex - add argument and description to function comment
|
||||
// TODO: Event - add argument and description to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->CreateEvent (
|
||||
EFI_EVENT_NOTIFY_SIGNAL,
|
||||
EFI_TPL_CALLBACK,
|
||||
PciHPCInitialized,
|
||||
gPciRootHpcData + HpIndex,
|
||||
&((gPciRootHpcData + HpIndex)->Event)
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
*Event = (gPciRootHpcData + HpIndex)->Event;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
AllRootHPCInitialized (
|
||||
IN UINTN TimeoutInMilliSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: TimeoutInMilliSeconds - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_TIMEOUT - add return value to function comment
|
||||
{
|
||||
UINT32 Delay;
|
||||
UINTN Index;
|
||||
|
||||
Delay = (UINT32) (((TimeoutInMilliSeconds * STALL_1_MILLI_SECOND) / 30) + 1);
|
||||
do {
|
||||
|
||||
for (Index = 0; Index < gPciRootHpcCount; Index++) {
|
||||
|
||||
if (!gPciRootHpcData[Index].Initialized) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Index == gPciRootHpcCount) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Stall for 30 us
|
||||
//
|
||||
gBS->Stall (30);
|
||||
|
||||
Delay--;
|
||||
|
||||
} while (Delay);
|
||||
|
||||
return EFI_TIMEOUT;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
IsSHPC (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
{
|
||||
|
||||
EFI_STATUS Status;
|
||||
UINT8 Offset;
|
||||
|
||||
if (!PciIoDevice) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Offset = 0;
|
||||
Status = LocateCapabilityRegBlock (
|
||||
PciIoDevice,
|
||||
EFI_PCI_CAPABILITY_ID_HOTPLUG,
|
||||
&Offset,
|
||||
NULL
|
||||
);
|
||||
|
||||
//
|
||||
// If the PPB has the hot plug controller build-in,
|
||||
// then return TRUE;
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
GetResourcePaddingForHpb (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HPC_STATE State;
|
||||
UINT64 PciAddress;
|
||||
EFI_HPC_PADDING_ATTRIBUTES Attributes;
|
||||
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
|
||||
|
||||
Status = IsPciHotPlugBus (PciIoDevice);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
PciAddress = EFI_PCI_ADDRESS (PciIoDevice->BusNumber, PciIoDevice->DeviceNumber, PciIoDevice->FunctionNumber, 0);
|
||||
Status = gPciHotPlugInit->GetResourcePadding (
|
||||
gPciHotPlugInit,
|
||||
PciIoDevice->DevicePath,
|
||||
PciAddress,
|
||||
&State,
|
||||
(VOID **) &Descriptors,
|
||||
&Attributes
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if ((State & EFI_HPC_STATE_ENABLED) && (State & EFI_HPC_STATE_INITIALIZED)) {
|
||||
PciIoDevice->ResourcePaddingDescriptors = Descriptors;
|
||||
PciIoDevice->PaddingAttributes = Attributes;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
IsPciHotPlugBus (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
{
|
||||
BOOLEAN Result;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = IsSHPC (PciIoDevice);
|
||||
|
||||
//
|
||||
// If the PPB has the hot plug controller build-in,
|
||||
// then return TRUE;
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Otherwise, see if it is a Root HPC
|
||||
//
|
||||
Result = IsRootPciHotPlugBus (PciIoDevice->DevicePath, NULL);
|
||||
|
||||
if (Result) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
269
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.h
Normal file
269
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.h
Normal file
@ -0,0 +1,269 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciHotPlugSupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_HOT_PLUG_SUPPORT_H
|
||||
#define _EFI_PCI_HOT_PLUG_SUPPORT_H
|
||||
|
||||
//
|
||||
// stall 1 ms
|
||||
//
|
||||
#define STALL_1_MILLI_SECOND 1000
|
||||
|
||||
//
|
||||
// stall 1 second
|
||||
//
|
||||
#define STALL_1_SECOND 1000000
|
||||
|
||||
typedef struct {
|
||||
EFI_EVENT Event;
|
||||
BOOLEAN Initialized;
|
||||
VOID *Padding;
|
||||
} ROOT_HPC_DATA;
|
||||
|
||||
extern EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
|
||||
extern EFI_HPC_LOCATION *gPciRootHpcPool;
|
||||
extern UINTN gPciRootHpcCount;
|
||||
extern ROOT_HPC_DATA *gPciRootHpcData;
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
PciHPCInitialized (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Event - TODO: add argument description
|
||||
Context - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
EfiCompareDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
DevicePath1 - TODO: add argument description
|
||||
DevicePath2 - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializeHotPlugSupport (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
IsPciHotPlugBus (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
IsRootPciHotPlugBus (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
|
||||
OUT UINTN *HpIndex
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
HpbDevicePath - TODO: add argument description
|
||||
HpIndex - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
IsRootPciHotPlugController (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
|
||||
OUT UINTN *HpIndex
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
HpcDevicePath - TODO: add argument description
|
||||
HpIndex - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CreateEventForHpc (
|
||||
IN UINTN HpIndex,
|
||||
OUT EFI_EVENT *Event
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
HpIndex - TODO: add argument description
|
||||
Event - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AllRootHPCInitialized (
|
||||
IN UINTN TimeoutInMilliSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
TimeoutInMilliSeconds - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
IsSHPC (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetResourcePaddingForHpb (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
1964
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.c
Normal file
1964
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.c
Normal file
File diff suppressed because it is too large
Load Diff
773
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.h
Normal file
773
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.h
Normal file
@ -0,0 +1,773 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciIo.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_IO_PROTOCOL_H
|
||||
#define _EFI_PCI_IO_PROTOCOL_H
|
||||
|
||||
EFI_STATUS
|
||||
InitializePciIoInstance (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciIoVerifyBarAccess (
|
||||
PCI_IO_DEVICE *PciIoDevice,
|
||||
UINT8 BarIndex,
|
||||
PCI_BAR_TYPE Type,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINTN Count,
|
||||
UINT64 *Offset
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Type - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciIoVerifyConfigAccess (
|
||||
PCI_IO_DEVICE *PciIoDevice,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINTN Count,
|
||||
IN UINT64 *Offset
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoPollMem (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINT64 Mask,
|
||||
IN UINT64 Value,
|
||||
IN UINT64 Delay,
|
||||
OUT UINT64 *Result
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Mask - TODO: add argument description
|
||||
Value - TODO: add argument description
|
||||
Delay - TODO: add argument description
|
||||
Result - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoPollIo (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINT64 Mask,
|
||||
IN UINT64 Value,
|
||||
IN UINT64 Delay,
|
||||
OUT UINT64 *Result
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Mask - TODO: add argument description
|
||||
Value - TODO: add argument description
|
||||
Delay - TODO: add argument description
|
||||
Result - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoMemRead (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoMemWrite (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoIoRead (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoIoWrite (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoConfigRead (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT32 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoConfigWrite (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT32 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoCopyMem (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 DestBarIndex,
|
||||
IN UINT64 DestOffset,
|
||||
IN UINT8 SrcBarIndex,
|
||||
IN UINT64 SrcOffset,
|
||||
IN UINTN Count
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
DestBarIndex - TODO: add argument description
|
||||
DestOffset - TODO: add argument description
|
||||
SrcBarIndex - TODO: add argument description
|
||||
SrcOffset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoMap (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_OPERATION Operation,
|
||||
IN VOID *HostAddress,
|
||||
IN OUT UINTN *NumberOfBytes,
|
||||
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
|
||||
OUT VOID **Mapping
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
HostAddress - TODO: add argument description
|
||||
NumberOfBytes - TODO: add argument description
|
||||
DeviceAddress - TODO: add argument description
|
||||
Mapping - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoUnmap (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN VOID *Mapping
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Mapping - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoAllocateBuffer (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_ALLOCATE_TYPE Type,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN Pages,
|
||||
OUT VOID **HostAddress,
|
||||
IN UINT64 Attributes
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Type - TODO: add argument description
|
||||
MemoryType - TODO: add argument description
|
||||
Pages - TODO: add argument description
|
||||
HostAddress - TODO: add argument description
|
||||
Attributes - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoFreeBuffer (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN UINTN Pages,
|
||||
IN VOID *HostAddress
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Pages - TODO: add argument description
|
||||
HostAddress - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoFlush (
|
||||
IN EFI_PCI_IO_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoGetLocation (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
OUT UINTN *Segment,
|
||||
OUT UINTN *Bus,
|
||||
OUT UINTN *Device,
|
||||
OUT UINTN *Function
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Segment - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Function - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
CheckBarType (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
UINT8 BarIndex,
|
||||
PCI_BAR_TYPE BarType
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
BarType - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ModifyRootBridgeAttributes (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT64 Attributes,
|
||||
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Attributes - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SupportPaletteSnoopAttributes (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoAttributes (
|
||||
IN EFI_PCI_IO_PROTOCOL * This,
|
||||
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
|
||||
IN UINT64 Attributes,
|
||||
OUT UINT64 *Result OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
Attributes - TODO: add argument description
|
||||
Result - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoGetBarAttributes (
|
||||
IN EFI_PCI_IO_PROTOCOL * This,
|
||||
IN UINT8 BarIndex,
|
||||
OUT UINT64 *Supports, OPTIONAL
|
||||
OUT VOID **Resources OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Supports - TODO: add argument description
|
||||
Resources - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoSetBarAttributes (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN UINT64 Attributes,
|
||||
IN UINT8 BarIndex,
|
||||
IN OUT UINT64 *Offset,
|
||||
IN OUT UINT64 *Length
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Attributes - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Length - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
UpStreamBridgesAttributes (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
|
||||
IN UINT64 Attributes
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
Attributes - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
PciDevicesOnTheSamePath (
|
||||
IN PCI_IO_DEVICE *PciDevice1,
|
||||
IN PCI_IO_DEVICE *PciDevice2
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDevice1 - TODO: add argument description
|
||||
PciDevice2 - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
1398
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.c
Normal file
1398
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.c
Normal file
File diff suppressed because it is too large
Load Diff
247
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.h
Normal file
247
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.h
Normal file
@ -0,0 +1,247 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciLib.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver Lib header file
|
||||
It abstracts some functions that can be different
|
||||
between light PCI bus driver and full PCI bus driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_LIB_H
|
||||
#define _EFI_PCI_LIB_H
|
||||
|
||||
VOID
|
||||
InstallHotPlugRequestProtocol (
|
||||
IN EFI_STATUS *Status
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Status - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID
|
||||
InstallPciHotplugGuid (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID
|
||||
UninstallPciHotplugGuid (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID
|
||||
GetBackPcCardBar (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RemoveRejectedPciDevices (
|
||||
EFI_HANDLE RootBridgeHandle,
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeResourceAllocator (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciScanBus (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT8 StartBusNumber,
|
||||
OUT UINT8 *SubBusNumber,
|
||||
OUT UINT8 *PaddedBusRange
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
StartBusNumber - TODO: add argument description
|
||||
SubBusNumber - TODO: add argument description
|
||||
PaddedBusRange - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciRootBridgeP2CProcess (
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeP2CProcess (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeEnumerator (
|
||||
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
543
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.c
Normal file
543
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.c
Normal file
@ -0,0 +1,543 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciOptionRomSupport.c
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "PciBus.h"
|
||||
#include "PciResourceSupport.h"
|
||||
|
||||
EFI_STATUS
|
||||
GetOpRomInfo (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
UINT8 RomBarIndex;
|
||||
UINT32 AllOnes;
|
||||
UINT64 Address;
|
||||
EFI_STATUS Status;
|
||||
UINT8 Bus;
|
||||
UINT8 Device;
|
||||
UINT8 Function;
|
||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||
|
||||
Bus = PciIoDevice->BusNumber;
|
||||
Device = PciIoDevice->DeviceNumber;
|
||||
Function = PciIoDevice->FunctionNumber;
|
||||
|
||||
PciRootBridgeIo = PciIoDevice->PciRootBridgeIo;
|
||||
|
||||
//
|
||||
// offset is 48 if is not ppb
|
||||
//
|
||||
|
||||
//
|
||||
// 0x30
|
||||
//
|
||||
RomBarIndex = PCI_DEVICE_ROMBAR;
|
||||
|
||||
if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) {
|
||||
//
|
||||
// if is ppb
|
||||
//
|
||||
|
||||
//
|
||||
// 0x38
|
||||
//
|
||||
RomBarIndex = PCI_BRIDGE_ROMBAR;
|
||||
}
|
||||
//
|
||||
// the bit0 is 0 to prevent the enabling of the Rom address decoder
|
||||
//
|
||||
AllOnes = 0xfffffffe;
|
||||
Address = EFI_PCI_ADDRESS (Bus, Device, Function, RomBarIndex);
|
||||
|
||||
Status = PciRootBridgeIo->Pci.Write (
|
||||
PciRootBridgeIo,
|
||||
EfiPciWidthUint32,
|
||||
Address,
|
||||
1,
|
||||
&AllOnes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// read back
|
||||
//
|
||||
Status = PciRootBridgeIo->Pci.Read (
|
||||
PciRootBridgeIo,
|
||||
EfiPciWidthUint32,
|
||||
Address,
|
||||
1,
|
||||
&AllOnes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
AllOnes &= 0xFFFFFFFC;
|
||||
if ((AllOnes == 0) || (AllOnes == 0xFFFFFFFC)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
PciIoDevice->RomSize = (UINT64) ((~AllOnes) + 1);
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
LoadOpRomImage (
|
||||
IN PCI_IO_DEVICE *PciDevice,
|
||||
IN UINT64 RomBase
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Load option rom image for specified PCI device
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: PciDevice - add argument and description to function comment
|
||||
// TODO: RomBase - add argument and description to function comment
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
{
|
||||
UINT8 RomBarIndex;
|
||||
UINT8 Indicator;
|
||||
UINT16 OffsetPcir;
|
||||
UINT32 RomBarOffset;
|
||||
UINT32 RomBar;
|
||||
UINT64 Temp;
|
||||
EFI_STATUS retStatus;
|
||||
BOOLEAN FirstCheck;
|
||||
UINT8 *Image;
|
||||
PCI_EXPANSION_ROM_HEADER *RomHeader;
|
||||
PCI_DATA_STRUCTURE *RomPcir;
|
||||
UINT64 RomSize;
|
||||
UINT64 RomImageSize;
|
||||
UINT8 *RomInMemory;
|
||||
|
||||
RomSize = PciDevice->RomSize;
|
||||
|
||||
Indicator = 0;
|
||||
RomImageSize = 0;
|
||||
RomInMemory = NULL;
|
||||
Temp = 0;
|
||||
|
||||
//
|
||||
// Get the RomBarIndex
|
||||
//
|
||||
|
||||
//
|
||||
// 0x30
|
||||
//
|
||||
RomBarIndex = PCI_DEVICE_ROMBAR;
|
||||
if (IS_PCI_BRIDGE (&(PciDevice->Pci))) {
|
||||
//
|
||||
// if is ppb
|
||||
//
|
||||
|
||||
//
|
||||
// 0x38
|
||||
//
|
||||
RomBarIndex = PCI_BRIDGE_ROMBAR;
|
||||
}
|
||||
//
|
||||
// Allocate memory for Rom header and PCIR
|
||||
//
|
||||
RomHeader = AllocatePool (sizeof (PCI_EXPANSION_ROM_HEADER));
|
||||
if (RomHeader == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
RomPcir = AllocatePool (sizeof (PCI_DATA_STRUCTURE));
|
||||
if (RomPcir == NULL) {
|
||||
gBS->FreePool (RomHeader);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
RomBar = (UINT32) RomBase;
|
||||
|
||||
//
|
||||
// Enable RomBar
|
||||
//
|
||||
RomDecode (PciDevice, RomBarIndex, RomBar, TRUE);
|
||||
|
||||
RomBarOffset = RomBar;
|
||||
retStatus = EFI_NOT_FOUND;
|
||||
FirstCheck = TRUE;
|
||||
|
||||
do {
|
||||
PciDevice->PciRootBridgeIo->Mem.Read (
|
||||
PciDevice->PciRootBridgeIo,
|
||||
EfiPciWidthUint8,
|
||||
RomBarOffset,
|
||||
sizeof (PCI_EXPANSION_ROM_HEADER),
|
||||
(UINT8 *) RomHeader
|
||||
);
|
||||
|
||||
if (RomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
|
||||
RomBarOffset = RomBarOffset + 512;
|
||||
if (FirstCheck) {
|
||||
break;
|
||||
} else {
|
||||
RomImageSize = RomImageSize + 512;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
FirstCheck = FALSE;
|
||||
OffsetPcir = RomHeader->PcirOffset;
|
||||
PciDevice->PciRootBridgeIo->Mem.Read (
|
||||
PciDevice->PciRootBridgeIo,
|
||||
EfiPciWidthUint8,
|
||||
RomBarOffset + OffsetPcir,
|
||||
sizeof (PCI_DATA_STRUCTURE),
|
||||
(UINT8 *) RomPcir
|
||||
);
|
||||
Indicator = RomPcir->Indicator;
|
||||
RomImageSize = RomImageSize + RomPcir->ImageLength * 512;
|
||||
RomBarOffset = RomBarOffset + RomPcir->ImageLength * 512;
|
||||
} while (((Indicator & 0x80) == 0x00) && ((RomBarOffset - RomBar) < RomSize));
|
||||
|
||||
if (RomImageSize > 0) {
|
||||
retStatus = EFI_SUCCESS;
|
||||
Image = AllocatePool ((UINT32) RomImageSize);
|
||||
if (Image == NULL) {
|
||||
RomDecode (PciDevice, RomBarIndex, RomBar, FALSE);
|
||||
gBS->FreePool (RomHeader);
|
||||
gBS->FreePool (RomPcir);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// Copy Rom image into memory
|
||||
//
|
||||
PciDevice->PciRootBridgeIo->Mem.Read (
|
||||
PciDevice->PciRootBridgeIo,
|
||||
EfiPciWidthUint8,
|
||||
RomBar,
|
||||
(UINT32) RomImageSize,
|
||||
Image
|
||||
);
|
||||
RomInMemory = Image;
|
||||
}
|
||||
|
||||
RomDecode (PciDevice, RomBarIndex, RomBar, FALSE);
|
||||
|
||||
PciDevice->PciIo.RomSize = RomImageSize;
|
||||
PciDevice->PciIo.RomImage = RomInMemory;
|
||||
|
||||
PciRomAddImageMapping (
|
||||
NULL,
|
||||
PciDevice->PciRootBridgeIo->SegmentNumber,
|
||||
PciDevice->BusNumber,
|
||||
PciDevice->DeviceNumber,
|
||||
PciDevice->FunctionNumber,
|
||||
(UINT64) (UINTN) PciDevice->PciIo.RomImage,
|
||||
PciDevice->PciIo.RomSize
|
||||
);
|
||||
|
||||
//
|
||||
// Free allocated memory
|
||||
//
|
||||
gBS->FreePool (RomHeader);
|
||||
gBS->FreePool (RomPcir);
|
||||
|
||||
return retStatus;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
RomDecode (
|
||||
IN PCI_IO_DEVICE *PciDevice,
|
||||
IN UINT8 RomBarIndex,
|
||||
IN UINT32 RomBar,
|
||||
IN BOOLEAN Enable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: PciDevice - add argument and description to function comment
|
||||
// TODO: RomBarIndex - add argument and description to function comment
|
||||
// TODO: RomBar - add argument and description to function comment
|
||||
// TODO: Enable - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
UINT32 Value32;
|
||||
UINT32 Offset;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
|
||||
PciIo = &PciDevice->PciIo;
|
||||
if (Enable) {
|
||||
//
|
||||
// Clear all bars
|
||||
//
|
||||
for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {
|
||||
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllZero);
|
||||
}
|
||||
|
||||
//
|
||||
// set the Rom base address: now is hardcode
|
||||
// enable its decoder
|
||||
//
|
||||
Value32 = RomBar | 0x1;
|
||||
PciIo->Pci.Write (
|
||||
PciIo,
|
||||
(EFI_PCI_IO_PROTOCOL_WIDTH) EfiPciWidthUint32,
|
||||
RomBarIndex,
|
||||
1,
|
||||
&Value32
|
||||
);
|
||||
|
||||
//
|
||||
// Programe all upstream bridge
|
||||
//
|
||||
ProgrameUpstreamBridgeForRom(PciDevice, RomBar, TRUE);
|
||||
|
||||
//
|
||||
// Setting the memory space bit in the function's command register
|
||||
//
|
||||
PciEnableCommandRegister(PciDevice, EFI_PCI_COMMAND_MEMORY_SPACE);
|
||||
|
||||
} else {
|
||||
|
||||
//
|
||||
// disable command register decode to memory
|
||||
//
|
||||
PciDisableCommandRegister(PciDevice, EFI_PCI_COMMAND_MEMORY_SPACE);
|
||||
|
||||
//
|
||||
// Destroy the programmed bar in all the upstream bridge.
|
||||
//
|
||||
ProgrameUpstreamBridgeForRom(PciDevice, RomBar, FALSE);
|
||||
|
||||
//
|
||||
// disable rom decode
|
||||
//
|
||||
Value32 = 0xFFFFFFFE;
|
||||
PciIo->Pci.Write (
|
||||
PciIo,
|
||||
(EFI_PCI_IO_PROTOCOL_WIDTH) EfiPciWidthUint32,
|
||||
RomBarIndex,
|
||||
1,
|
||||
&Value32
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ProcessOpRomImage (
|
||||
PCI_IO_DEVICE *PciDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Process the oprom image.
|
||||
|
||||
Arguments:
|
||||
PciDevice A pointer to a pci device.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI Status.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT8 Indicator;
|
||||
UINT32 ImageSize;
|
||||
UINT16 ImageOffset;
|
||||
VOID *RomBar;
|
||||
UINT8 *RomBarOffset;
|
||||
EFI_HANDLE ImageHandle;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS retStatus;
|
||||
BOOLEAN FirstCheck;
|
||||
BOOLEAN SkipImage;
|
||||
UINT32 DestinationSize;
|
||||
UINT32 ScratchSize;
|
||||
UINT8 *Scratch;
|
||||
VOID *ImageBuffer;
|
||||
VOID *DecompressedImageBuffer;
|
||||
UINT32 ImageLength;
|
||||
EFI_DECOMPRESS_PROTOCOL *Decompress;
|
||||
EFI_PCI_EXPANSION_ROM_HEADER *EfiRomHeader;
|
||||
PCI_DATA_STRUCTURE *Pcir;
|
||||
|
||||
Indicator = 0;
|
||||
|
||||
//
|
||||
// Get the Address of the Rom image
|
||||
//
|
||||
RomBar = PciDevice->PciIo.RomImage;
|
||||
RomBarOffset = (UINT8 *) RomBar;
|
||||
retStatus = EFI_NOT_FOUND;
|
||||
FirstCheck = TRUE;
|
||||
|
||||
do {
|
||||
EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *) RomBarOffset;
|
||||
if (EfiRomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
|
||||
RomBarOffset = RomBarOffset + 512;
|
||||
if (FirstCheck) {
|
||||
break;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
FirstCheck = FALSE;
|
||||
Pcir = (PCI_DATA_STRUCTURE *) (RomBarOffset + EfiRomHeader->PcirOffset);
|
||||
ImageSize = (UINT32) (Pcir->ImageLength * 512);
|
||||
Indicator = Pcir->Indicator;
|
||||
|
||||
if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
|
||||
(EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE)) {
|
||||
|
||||
if ((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||
|
||||
(EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER)) {
|
||||
|
||||
ImageOffset = EfiRomHeader->EfiImageHeaderOffset;
|
||||
ImageSize = (UINT32) (EfiRomHeader->InitializationSize * 512);
|
||||
|
||||
ImageBuffer = (VOID *) (RomBarOffset + ImageOffset);
|
||||
ImageLength = ImageSize - (UINT32)ImageOffset;
|
||||
DecompressedImageBuffer = NULL;
|
||||
|
||||
//
|
||||
// decompress here if needed
|
||||
//
|
||||
SkipImage = FALSE;
|
||||
if (EfiRomHeader->CompressionType > EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
|
||||
SkipImage = TRUE;
|
||||
}
|
||||
|
||||
if (EfiRomHeader->CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
|
||||
Status = gBS->LocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **) &Decompress);
|
||||
if (EFI_ERROR (Status)) {
|
||||
SkipImage = TRUE;
|
||||
} else {
|
||||
SkipImage = TRUE;
|
||||
Status = Decompress->GetInfo (
|
||||
Decompress,
|
||||
ImageBuffer,
|
||||
ImageLength,
|
||||
&DestinationSize,
|
||||
&ScratchSize
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
DecompressedImageBuffer = NULL;
|
||||
DecompressedImageBuffer = AllocatePool (DestinationSize);
|
||||
if (DecompressedImageBuffer != NULL) {
|
||||
Scratch = AllocatePool (ScratchSize);
|
||||
if (Scratch != NULL) {
|
||||
Status = Decompress->Decompress (
|
||||
Decompress,
|
||||
ImageBuffer,
|
||||
ImageLength,
|
||||
DecompressedImageBuffer,
|
||||
DestinationSize,
|
||||
Scratch,
|
||||
ScratchSize
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ImageBuffer = DecompressedImageBuffer;
|
||||
ImageLength = DestinationSize;
|
||||
SkipImage = FALSE;
|
||||
}
|
||||
|
||||
gBS->FreePool (Scratch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!SkipImage) {
|
||||
//
|
||||
// load image and start image
|
||||
//
|
||||
Status = gBS->LoadImage (
|
||||
FALSE,
|
||||
gPciBusDriverBinding.DriverBindingHandle,
|
||||
PciDevice->Handle,
|
||||
ImageBuffer,
|
||||
ImageLength,
|
||||
&ImageHandle
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = gBS->StartImage (ImageHandle, NULL, NULL);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
AddDriver (PciDevice, ImageHandle);
|
||||
PciRomAddImageMapping (
|
||||
ImageHandle,
|
||||
PciDevice->PciRootBridgeIo->SegmentNumber,
|
||||
PciDevice->BusNumber,
|
||||
PciDevice->DeviceNumber,
|
||||
PciDevice->FunctionNumber,
|
||||
(UINT64) (UINTN) PciDevice->PciIo.RomImage,
|
||||
PciDevice->PciIo.RomSize
|
||||
);
|
||||
retStatus = EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RomBarOffset = RomBarOffset + ImageSize;
|
||||
} else {
|
||||
RomBarOffset = RomBarOffset + ImageSize;
|
||||
}
|
||||
} else {
|
||||
RomBarOffset = RomBarOffset + ImageSize;
|
||||
}
|
||||
|
||||
} while (((Indicator & 0x80) == 0x00) && ((UINTN) (RomBarOffset - (UINT8 *) RomBar) < PciDevice->RomSize));
|
||||
|
||||
return retStatus;
|
||||
|
||||
}
|
119
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.h
Normal file
119
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.h
Normal file
@ -0,0 +1,119 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciOptionRomSupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_OP_ROM_SUPPORT_H
|
||||
#define _EFI_PCI_OP_ROM_SUPPORT_H
|
||||
|
||||
EFI_STATUS
|
||||
GetOpRomInfo (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
LoadOpRomImage (
|
||||
IN PCI_IO_DEVICE *PciDevice,
|
||||
IN UINT64 RomBase
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDevice - TODO: add argument description
|
||||
RomBase - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RomDecode (
|
||||
IN PCI_IO_DEVICE *PciDevice,
|
||||
IN UINT8 RomBarIndex,
|
||||
IN UINT32 RomBar,
|
||||
IN BOOLEAN Enable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDevice - TODO: add argument description
|
||||
RomBarIndex - TODO: add argument description
|
||||
RomBar - TODO: add argument description
|
||||
Enable - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProcessOpRomImage (
|
||||
PCI_IO_DEVICE *PciDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
83
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.c
Normal file
83
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.c
Normal file
@ -0,0 +1,83 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciPowerManagement.c
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "Pcibus.h"
|
||||
|
||||
EFI_STATUS
|
||||
ResetPowerManagementFeature (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function is intended to turn off PWE assertion and
|
||||
put the device to D0 state if the device supports
|
||||
PCI Power Management.
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_UNSUPPORTED - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8 PowerManagementRegBlock;
|
||||
UINT16 PMCSR;
|
||||
|
||||
PowerManagementRegBlock = 0;
|
||||
|
||||
Status = LocateCapabilityRegBlock (
|
||||
PciIoDevice,
|
||||
EFI_PCI_CAPABILITY_ID_PMI,
|
||||
&PowerManagementRegBlock,
|
||||
NULL
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Turn off the PWE assertion and put the device into D0 State
|
||||
//
|
||||
PMCSR = 0x8000;
|
||||
|
||||
//
|
||||
// Write PMCSR
|
||||
//
|
||||
PciIoDevice->PciIo.Pci.Write (
|
||||
&PciIoDevice->PciIo,
|
||||
EfiPciIoWidthUint16,
|
||||
PowerManagementRegBlock + 4,
|
||||
1,
|
||||
&PMCSR
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
48
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.h
Normal file
48
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciPowerManagement.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_POWER_MANAGEMENT_H
|
||||
#define _EFI_PCI_POWER_MANAGEMENT_H
|
||||
|
||||
EFI_STATUS
|
||||
ResetPowerManagementFeature (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
2276
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.c
Normal file
2276
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.c
Normal file
File diff suppressed because it is too large
Load Diff
740
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.h
Normal file
740
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.h
Normal file
@ -0,0 +1,740 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciResourceSupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_RESOURCE_SUPPORT_H
|
||||
#define _EFI_PCI_RESOURCE_SUPPORT_H
|
||||
|
||||
#define RESERVED_RESOURCE_SIGNATURE EFI_SIGNATURE_32 ('r', 's', 'v', 'd')
|
||||
|
||||
typedef struct {
|
||||
UINT64 Base;
|
||||
UINT64 Length;
|
||||
PCI_BAR_TYPE ResType;
|
||||
} PCI_RESERVED_RESOURCE_NODE;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
PCI_RESERVED_RESOURCE_NODE Node;
|
||||
} PCI_RESERVED_RESOURCE_LIST;
|
||||
|
||||
#define RESOURCED_LIST_FROM_NODE(a) \
|
||||
CR (a, PCI_RESERVED_RESOURCE_LIST, Node, RESERVED_RESOURCE_SIGNATURE)
|
||||
|
||||
#define RESOURCED_LIST_FROM_LINK(a) \
|
||||
CR (a, PCI_RESERVED_RESOURCE_LIST, Link, RESERVED_RESOURCE_SIGNATURE)
|
||||
|
||||
typedef enum {
|
||||
PciResUsageTypical = 0,
|
||||
PciResUsagePadding,
|
||||
PciResUsageOptionRomProcessing
|
||||
} PCI_RESOURCE_USAGE;
|
||||
|
||||
#define PCI_RESOURCE_SIGNATURE EFI_SIGNATURE_32 ('p', 'c', 'r', 'c')
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
LIST_ENTRY ChildList;
|
||||
PCI_IO_DEVICE *PciDev;
|
||||
UINT64 Alignment;
|
||||
UINT64 Offset;
|
||||
UINT8 Bar;
|
||||
PCI_BAR_TYPE ResType;
|
||||
UINT64 Length;
|
||||
BOOLEAN Reserved;
|
||||
PCI_RESOURCE_USAGE ResourceUsage;
|
||||
} PCI_RESOURCE_NODE;
|
||||
|
||||
#define RESOURCE_NODE_FROM_LINK(a) \
|
||||
CR (a, PCI_RESOURCE_NODE, Link, PCI_RESOURCE_SIGNATURE)
|
||||
|
||||
EFI_STATUS
|
||||
SkipVGAAperture (
|
||||
OUT UINT64 *Start,
|
||||
IN UINT64 Length
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Start - TODO: add argument description
|
||||
Length - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SkipIsaAliasAperture (
|
||||
OUT UINT64 *Start,
|
||||
IN UINT64 Length
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Start - TODO: add argument description
|
||||
Length - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InsertResourceNode (
|
||||
PCI_RESOURCE_NODE *Bridge,
|
||||
PCI_RESOURCE_NODE *ResNode
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
ResNode - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
MergeResourceTree (
|
||||
PCI_RESOURCE_NODE *Dst,
|
||||
PCI_RESOURCE_NODE *Res,
|
||||
BOOLEAN TypeMerge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Dst - TODO: add argument description
|
||||
Res - TODO: add argument description
|
||||
TypeMerge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CalculateApertureIo16 (
|
||||
IN PCI_RESOURCE_NODE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CalculateResourceAperture (
|
||||
IN PCI_RESOURCE_NODE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetResourceFromDevice (
|
||||
PCI_IO_DEVICE *PciDev,
|
||||
PCI_RESOURCE_NODE *IoNode,
|
||||
PCI_RESOURCE_NODE *Mem32Node,
|
||||
PCI_RESOURCE_NODE *PMem32Node,
|
||||
PCI_RESOURCE_NODE *Mem64Node,
|
||||
PCI_RESOURCE_NODE *PMem64Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDev - TODO: add argument description
|
||||
IoNode - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_RESOURCE_NODE *
|
||||
CreateResourceNode (
|
||||
IN PCI_IO_DEVICE *PciDev,
|
||||
IN UINT64 Length,
|
||||
IN UINT64 Alignment,
|
||||
IN UINT8 Bar,
|
||||
IN PCI_BAR_TYPE ResType,
|
||||
IN PCI_RESOURCE_USAGE ResUsage
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDev - TODO: add argument description
|
||||
Length - TODO: add argument description
|
||||
Alignment - TODO: add argument description
|
||||
Bar - TODO: add argument description
|
||||
ResType - TODO: add argument description
|
||||
ResUsage - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CreateResourceMap (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_RESOURCE_NODE *IoNode,
|
||||
IN PCI_RESOURCE_NODE *Mem32Node,
|
||||
IN PCI_RESOURCE_NODE *PMem32Node,
|
||||
IN PCI_RESOURCE_NODE *Mem64Node,
|
||||
IN PCI_RESOURCE_NODE *PMem64Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
IoNode - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ResourcePaddingPolicy (
|
||||
PCI_IO_DEVICE *PciDev,
|
||||
PCI_RESOURCE_NODE *IoNode,
|
||||
PCI_RESOURCE_NODE *Mem32Node,
|
||||
PCI_RESOURCE_NODE *PMem32Node,
|
||||
PCI_RESOURCE_NODE *Mem64Node,
|
||||
PCI_RESOURCE_NODE *PMem64Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDev - TODO: add argument description
|
||||
IoNode - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DegradeResource (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_RESOURCE_NODE *Mem32Node,
|
||||
IN PCI_RESOURCE_NODE *PMem32Node,
|
||||
IN PCI_RESOURCE_NODE *Mem64Node,
|
||||
IN PCI_RESOURCE_NODE *PMem64Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
BridgeSupportResourceDecode (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT32 Decode
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Decode - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProgramResource (
|
||||
IN UINT64 Base,
|
||||
IN PCI_RESOURCE_NODE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Base - TODO: add argument description
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProgramBar (
|
||||
IN UINT64 Base,
|
||||
IN PCI_RESOURCE_NODE *Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Base - TODO: add argument description
|
||||
Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProgramPpbApperture (
|
||||
IN UINT64 Base,
|
||||
IN PCI_RESOURCE_NODE *Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Base - TODO: add argument description
|
||||
Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProgrameUpstreamBridgeForRom (
|
||||
IN PCI_IO_DEVICE *PciDevice,
|
||||
IN UINT32 OptionRomBase,
|
||||
IN BOOLEAN Enable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDevice - TODO: add argument description
|
||||
OptionRomBase - TODO: add argument description
|
||||
Enable - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
ResourceRequestExisted (
|
||||
IN PCI_RESOURCE_NODE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializeResourcePool (
|
||||
PCI_RESOURCE_NODE *ResourcePool,
|
||||
PCI_BAR_TYPE ResourceType
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ResourcePool - TODO: add argument description
|
||||
ResourceType - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetResourceMap (
|
||||
PCI_IO_DEVICE *PciDev,
|
||||
PCI_RESOURCE_NODE **IoBridge,
|
||||
PCI_RESOURCE_NODE **Mem32Bridge,
|
||||
PCI_RESOURCE_NODE **PMem32Bridge,
|
||||
PCI_RESOURCE_NODE **Mem64Bridge,
|
||||
PCI_RESOURCE_NODE **PMem64Bridge,
|
||||
PCI_RESOURCE_NODE *IoPool,
|
||||
PCI_RESOURCE_NODE *Mem32Pool,
|
||||
PCI_RESOURCE_NODE *PMem32Pool,
|
||||
PCI_RESOURCE_NODE *Mem64Pool,
|
||||
PCI_RESOURCE_NODE *PMem64Pool
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDev - TODO: add argument description
|
||||
IoBridge - TODO: add argument description
|
||||
Mem32Bridge - TODO: add argument description
|
||||
PMem32Bridge - TODO: add argument description
|
||||
Mem64Bridge - TODO: add argument description
|
||||
PMem64Bridge - TODO: add argument description
|
||||
IoPool - TODO: add argument description
|
||||
Mem32Pool - TODO: add argument description
|
||||
PMem32Pool - TODO: add argument description
|
||||
Mem64Pool - TODO: add argument description
|
||||
PMem64Pool - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DestroyResourceTree (
|
||||
IN PCI_RESOURCE_NODE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RecordReservedResource (
|
||||
IN UINT64 Base,
|
||||
IN UINT64 Length,
|
||||
IN PCI_BAR_TYPE ResType,
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Base - TODO: add argument description
|
||||
Length - TODO: add argument description
|
||||
ResType - TODO: add argument description
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ResourcePaddingForCardBusBridge (
|
||||
PCI_IO_DEVICE *PciDev,
|
||||
PCI_RESOURCE_NODE *IoNode,
|
||||
PCI_RESOURCE_NODE *Mem32Node,
|
||||
PCI_RESOURCE_NODE *PMem32Node,
|
||||
PCI_RESOURCE_NODE *Mem64Node,
|
||||
PCI_RESOURCE_NODE *PMem64Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDev - TODO: add argument description
|
||||
IoNode - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProgramP2C (
|
||||
IN UINT64 Base,
|
||||
IN PCI_RESOURCE_NODE *Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Base - TODO: add argument description
|
||||
Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ApplyResourcePadding (
|
||||
PCI_IO_DEVICE *PciDev,
|
||||
PCI_RESOURCE_NODE *IoNode,
|
||||
PCI_RESOURCE_NODE *Mem32Node,
|
||||
PCI_RESOURCE_NODE *PMem32Node,
|
||||
PCI_RESOURCE_NODE *Mem64Node,
|
||||
PCI_RESOURCE_NODE *PMem64Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDev - TODO: add argument description
|
||||
IoNode - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID
|
||||
GetResourcePaddingPpb (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ResetAllPpbBusReg (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT8 StartBusNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Reset bus register
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - a pointer to the PCI_IO_DEVICE
|
||||
StartBusNumber - the number of bus
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
457
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.c
Normal file
457
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.c
Normal file
@ -0,0 +1,457 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciRomTable.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Option Rom Support for PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "pcibus.h"
|
||||
#include "PciRomTable.h"
|
||||
|
||||
typedef struct {
|
||||
EFI_HANDLE ImageHandle;
|
||||
UINTN Seg;
|
||||
UINT8 Bus;
|
||||
UINT8 Dev;
|
||||
UINT8 Func;
|
||||
UINT64 RomAddress;
|
||||
UINT64 RomLength;
|
||||
} EFI_PCI_ROM_IMAGE_MAPPING;
|
||||
|
||||
static UINTN mNumberOfPciRomImages = 0;
|
||||
static UINTN mMaxNumberOfPciRomImages = 0;
|
||||
static EFI_PCI_ROM_IMAGE_MAPPING *mRomImageTable = NULL;
|
||||
|
||||
VOID
|
||||
PciRomAddImageMapping (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN UINTN Seg,
|
||||
IN UINT8 Bus,
|
||||
IN UINT8 Dev,
|
||||
IN UINT8 Func,
|
||||
IN UINT64 RomAddress,
|
||||
IN UINT64 RomLength
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - TODO: add argument description
|
||||
Seg - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Dev - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
RomAddress - TODO: add argument description
|
||||
RomLength - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_PCI_ROM_IMAGE_MAPPING *TempMapping;
|
||||
|
||||
if (mNumberOfPciRomImages >= mMaxNumberOfPciRomImages) {
|
||||
|
||||
mMaxNumberOfPciRomImages += 0x20;
|
||||
|
||||
TempMapping = NULL;
|
||||
TempMapping = AllocatePool (mMaxNumberOfPciRomImages * sizeof (EFI_PCI_ROM_IMAGE_MAPPING));
|
||||
if (TempMapping == NULL) {
|
||||
return ;
|
||||
}
|
||||
|
||||
CopyMem (TempMapping, mRomImageTable, mNumberOfPciRomImages * sizeof (EFI_PCI_ROM_IMAGE_MAPPING));
|
||||
|
||||
if (mRomImageTable != NULL) {
|
||||
gBS->FreePool (mRomImageTable);
|
||||
}
|
||||
|
||||
mRomImageTable = TempMapping;
|
||||
}
|
||||
|
||||
mRomImageTable[mNumberOfPciRomImages].ImageHandle = ImageHandle;
|
||||
mRomImageTable[mNumberOfPciRomImages].Seg = Seg;
|
||||
mRomImageTable[mNumberOfPciRomImages].Bus = Bus;
|
||||
mRomImageTable[mNumberOfPciRomImages].Dev = Dev;
|
||||
mRomImageTable[mNumberOfPciRomImages].Func = Func;
|
||||
mRomImageTable[mNumberOfPciRomImages].RomAddress = RomAddress;
|
||||
mRomImageTable[mNumberOfPciRomImages].RomLength = RomLength;
|
||||
mNumberOfPciRomImages++;
|
||||
}
|
||||
|
||||
VOID
|
||||
HexToString (
|
||||
CHAR16 *String,
|
||||
UINTN Value,
|
||||
UINTN Digits
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
String - TODO: add argument description
|
||||
Value - TODO: add argument description
|
||||
Digits - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
{
|
||||
for (; Digits > 0; Digits--, String++) {
|
||||
*String = (CHAR16) ((Value >> (4 * (Digits - 1))) & 0x0f);
|
||||
if (*String > 9) {
|
||||
(*String) += ('A' - 10);
|
||||
} else {
|
||||
(*String) += '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
EFI_STATUS
|
||||
PciRomLoadEfiDriversFromRomImage (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_PCI_OPTION_ROM_DESCRIPTOR *PciOptionRomDescriptor
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: PciOptionRomDescriptor - add argument and description to function comment
|
||||
{
|
||||
VOID *RomBar;
|
||||
UINTN RomSize;
|
||||
CHAR16 *FileName;
|
||||
EFI_PCI_EXPANSION_ROM_HEADER *EfiRomHeader;
|
||||
PCI_DATA_STRUCTURE *Pcir;
|
||||
UINTN ImageIndex;
|
||||
UINTN RomBarOffset;
|
||||
UINT32 ImageSize;
|
||||
UINT16 ImageOffset;
|
||||
EFI_HANDLE ImageHandle;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS retStatus;
|
||||
EFI_DEVICE_PATH_PROTOCOL *FilePath;
|
||||
BOOLEAN SkipImage;
|
||||
UINT32 DestinationSize;
|
||||
UINT32 ScratchSize;
|
||||
UINT8 *Scratch;
|
||||
VOID *ImageBuffer;
|
||||
VOID *DecompressedImageBuffer;
|
||||
UINT32 ImageLength;
|
||||
EFI_DECOMPRESS_PROTOCOL *Decompress;
|
||||
|
||||
RomBar = (VOID *) (UINTN) PciOptionRomDescriptor->RomAddress;
|
||||
RomSize = (UINTN) PciOptionRomDescriptor->RomLength;
|
||||
FileName = L"PciRom Seg=00000000 Bus=00 Dev=00 Func=00 Image=0000";
|
||||
|
||||
HexToString (&FileName[11], PciOptionRomDescriptor->Seg, 8);
|
||||
HexToString (&FileName[24], PciOptionRomDescriptor->Bus, 2);
|
||||
HexToString (&FileName[31], PciOptionRomDescriptor->Dev, 2);
|
||||
HexToString (&FileName[39], PciOptionRomDescriptor->Func, 2);
|
||||
|
||||
ImageIndex = 0;
|
||||
retStatus = EFI_NOT_FOUND;
|
||||
RomBarOffset = (UINTN) RomBar;
|
||||
|
||||
do {
|
||||
|
||||
EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *) (UINTN) RomBarOffset;
|
||||
|
||||
if (EfiRomHeader->Signature != 0xaa55) {
|
||||
return retStatus;
|
||||
}
|
||||
|
||||
Pcir = (PCI_DATA_STRUCTURE *) (UINTN) (RomBarOffset + EfiRomHeader->PcirOffset);
|
||||
ImageSize = Pcir->ImageLength * 512;
|
||||
|
||||
if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
|
||||
(EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE) ) {
|
||||
|
||||
if ((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||
|
||||
(EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) ) {
|
||||
|
||||
ImageOffset = EfiRomHeader->EfiImageHeaderOffset;
|
||||
ImageSize = EfiRomHeader->InitializationSize * 512;
|
||||
|
||||
ImageBuffer = (VOID *) (UINTN) (RomBarOffset + ImageOffset);
|
||||
ImageLength = ImageSize - ImageOffset;
|
||||
DecompressedImageBuffer = NULL;
|
||||
|
||||
//
|
||||
// decompress here if needed
|
||||
//
|
||||
SkipImage = FALSE;
|
||||
if (EfiRomHeader->CompressionType > EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
|
||||
SkipImage = TRUE;
|
||||
}
|
||||
|
||||
if (EfiRomHeader->CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
|
||||
Status = gBS->LocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **) &Decompress);
|
||||
if (EFI_ERROR (Status)) {
|
||||
SkipImage = TRUE;
|
||||
} else {
|
||||
SkipImage = TRUE;
|
||||
Status = Decompress->GetInfo (
|
||||
Decompress,
|
||||
ImageBuffer,
|
||||
ImageLength,
|
||||
&DestinationSize,
|
||||
&ScratchSize
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
DecompressedImageBuffer = NULL;
|
||||
DecompressedImageBuffer = AllocatePool (DestinationSize);
|
||||
if (DecompressedImageBuffer != NULL) {
|
||||
Scratch = AllocatePool (ScratchSize);
|
||||
if (Scratch != NULL) {
|
||||
Status = Decompress->Decompress (
|
||||
Decompress,
|
||||
ImageBuffer,
|
||||
ImageLength,
|
||||
DecompressedImageBuffer,
|
||||
DestinationSize,
|
||||
Scratch,
|
||||
ScratchSize
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ImageBuffer = DecompressedImageBuffer;
|
||||
ImageLength = DestinationSize;
|
||||
SkipImage = FALSE;
|
||||
}
|
||||
|
||||
gBS->FreePool (Scratch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!SkipImage) {
|
||||
|
||||
//
|
||||
// load image and start image
|
||||
//
|
||||
|
||||
HexToString (&FileName[48], ImageIndex, 4);
|
||||
FilePath = FileDevicePath (NULL, FileName);
|
||||
|
||||
Status = gBS->LoadImage (
|
||||
FALSE,
|
||||
This->ImageHandle,
|
||||
FilePath,
|
||||
ImageBuffer,
|
||||
ImageLength,
|
||||
&ImageHandle
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = gBS->StartImage (ImageHandle, NULL, NULL);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
PciRomAddImageMapping (
|
||||
ImageHandle,
|
||||
PciOptionRomDescriptor->Seg,
|
||||
PciOptionRomDescriptor->Bus,
|
||||
PciOptionRomDescriptor->Dev,
|
||||
PciOptionRomDescriptor->Func,
|
||||
PciOptionRomDescriptor->RomAddress,
|
||||
PciOptionRomDescriptor->RomLength
|
||||
);
|
||||
retStatus = Status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (DecompressedImageBuffer != NULL) {
|
||||
gBS->FreePool (DecompressedImageBuffer);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
RomBarOffset = RomBarOffset + ImageSize;
|
||||
ImageIndex++;
|
||||
} while (((Pcir->Indicator & 0x80) == 0x00) && ((RomBarOffset - (UINTN) RomBar) < RomSize));
|
||||
|
||||
return retStatus;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
PciRomLoadEfiDriversFromOptionRomTable (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: PciRootBridgeIo - add argument and description to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PCI_OPTION_ROM_TABLE *PciOptionRomTable;
|
||||
EFI_PCI_OPTION_ROM_DESCRIPTOR *PciOptionRomDescriptor;
|
||||
UINTN Index;
|
||||
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
|
||||
UINT16 MinBus;
|
||||
UINT16 MaxBus;
|
||||
|
||||
Status = EfiGetSystemConfigurationTable (&gEfiPciOptionRomTableGuid, (VOID **) &PciOptionRomTable);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Status = EFI_NOT_FOUND;
|
||||
|
||||
for (Index = 0; Index < PciOptionRomTable->PciOptionRomCount; Index++) {
|
||||
PciOptionRomDescriptor = &PciOptionRomTable->PciOptionRomDescriptors[Index];
|
||||
if (!PciOptionRomDescriptor->DontLoadEfiRom) {
|
||||
if (PciOptionRomDescriptor->Seg == PciRootBridgeIo->SegmentNumber) {
|
||||
Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **) &Descriptors);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
PciGetBusRange (&Descriptors, &MinBus, &MaxBus, NULL);
|
||||
if ((MinBus <= PciOptionRomDescriptor->Bus) && (PciOptionRomDescriptor->Bus <= MaxBus)) {
|
||||
Status = PciRomLoadEfiDriversFromRomImage (This, PciOptionRomDescriptor);
|
||||
PciOptionRomDescriptor->DontLoadEfiRom |= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
PciRomGetRomResourceFromPciOptionRomTable (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: PciRootBridgeIo - add argument and description to function comment
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PCI_OPTION_ROM_TABLE *PciOptionRomTable;
|
||||
EFI_PCI_OPTION_ROM_DESCRIPTOR *PciOptionRomDescriptor;
|
||||
UINTN Index;
|
||||
|
||||
Status = EfiGetSystemConfigurationTable (&gEfiPciOptionRomTableGuid, (VOID **) &PciOptionRomTable);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < PciOptionRomTable->PciOptionRomCount; Index++) {
|
||||
PciOptionRomDescriptor = &PciOptionRomTable->PciOptionRomDescriptors[Index];
|
||||
if (PciOptionRomDescriptor->Seg == PciRootBridgeIo->SegmentNumber &&
|
||||
PciOptionRomDescriptor->Bus == PciIoDevice->BusNumber &&
|
||||
PciOptionRomDescriptor->Dev == PciIoDevice->DeviceNumber &&
|
||||
PciOptionRomDescriptor->Func == PciIoDevice->FunctionNumber ) {
|
||||
|
||||
PciIoDevice->PciIo.RomImage = (VOID *) (UINTN) PciOptionRomDescriptor->RomAddress;
|
||||
PciIoDevice->PciIo.RomSize = (UINTN) PciOptionRomDescriptor->RomLength;
|
||||
}
|
||||
}
|
||||
|
||||
for (Index = 0; Index < mNumberOfPciRomImages; Index++) {
|
||||
if (mRomImageTable[Index].Seg == PciRootBridgeIo->SegmentNumber &&
|
||||
mRomImageTable[Index].Bus == PciIoDevice->BusNumber &&
|
||||
mRomImageTable[Index].Dev == PciIoDevice->DeviceNumber &&
|
||||
mRomImageTable[Index].Func == PciIoDevice->FunctionNumber ) {
|
||||
|
||||
AddDriver (PciIoDevice, mRomImageTable[Index].ImageHandle);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
PciRomGetImageMapping (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||
UINTN Index;
|
||||
|
||||
PciRootBridgeIo = PciIoDevice->PciRootBridgeIo;
|
||||
|
||||
for (Index = 0; Index < mNumberOfPciRomImages; Index++) {
|
||||
if (mRomImageTable[Index].Seg == PciRootBridgeIo->SegmentNumber &&
|
||||
mRomImageTable[Index].Bus == PciIoDevice->BusNumber &&
|
||||
mRomImageTable[Index].Dev == PciIoDevice->DeviceNumber &&
|
||||
mRomImageTable[Index].Func == PciIoDevice->FunctionNumber ) {
|
||||
|
||||
if (mRomImageTable[Index].ImageHandle != NULL) {
|
||||
AddDriver (PciIoDevice, mRomImageTable[Index].ImageHandle);
|
||||
} else {
|
||||
PciIoDevice->PciIo.RomImage = (VOID *) (UINTN) mRomImageTable[Index].RomAddress;
|
||||
PciIoDevice->PciIo.RomSize = (UINTN) mRomImageTable[Index].RomLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
107
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.h
Normal file
107
EdkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.h
Normal file
@ -0,0 +1,107 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciRomTable.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Option Rom Support for PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_ROM_TABLE_H
|
||||
#define _EFI_PCI_ROM_TABLE_H
|
||||
|
||||
VOID
|
||||
PciRomAddImageMapping (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN UINTN Seg,
|
||||
IN UINT8 Bus,
|
||||
IN UINT8 Dev,
|
||||
IN UINT8 Func,
|
||||
IN UINT64 RomAddress,
|
||||
IN UINT64 RomLength
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - TODO: add argument description
|
||||
Seg - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Dev - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
RomAddress - TODO: add argument description
|
||||
RomLength - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
PciRomGetRomResourceFromPciOptionRomTable (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
PciRootBridgeIo - TODO: add argument description
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciRomGetImageMapping (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
101
EdkModulePkg/Bus/Pci/PciBus/Dxe/build.xml
Normal file
101
EdkModulePkg/Bus/Pci/PciBus/Dxe/build.xml
Normal file
@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
|
||||
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.-->
|
||||
<project basedir="." default="PciBus"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Bus\Pci\PciBus\Dxe"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="PciBus">
|
||||
<GenBuild baseName="PciBus" mbdFilename="${MODULE_DIR}\PciBus.mbd" msaFilename="${MODULE_DIR}\PciBus.msa"/>
|
||||
</target>
|
||||
<target name="LightPciBusPciBus">
|
||||
<GenBuild baseName="LightPciBusPciBus" mbdFilename="${MODULE_DIR}\LightPciBus.mbd" msaFilename="${MODULE_DIR}\LightPciBus.msa"/>
|
||||
</target>
|
||||
<target name="PciBusPciBusLite">
|
||||
<GenBuild baseName="PciBusPciBusLite" mbdFilename="${MODULE_DIR}\PciBusLite.mbd" msaFilename="${MODULE_DIR}\PciBusLite.msa"/>
|
||||
</target>
|
||||
<target depends="PciBus_clean" name="clean"/>
|
||||
<target depends="PciBus_cleanall" name="cleanall"/>
|
||||
<target name="PciBus_clean">
|
||||
<OutputDirSetup baseName="PciBus" mbdFilename="${MODULE_DIR}\PciBus.mbd" msaFilename="${MODULE_DIR}\PciBus.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\PciBus_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\PciBus_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="LightPciBusPciBus_clean">
|
||||
<OutputDirSetup baseName="LightPciBusPciBus" mbdFilename="${MODULE_DIR}\LightPciBus.mbd" msaFilename="${MODULE_DIR}\LightPciBus.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\LightPciBusPciBus_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\LightPciBusPciBus_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="PciBusPciBusLite_clean">
|
||||
<OutputDirSetup baseName="PciBusPciBusLite" mbdFilename="${MODULE_DIR}\PciBusLite.mbd" msaFilename="${MODULE_DIR}\PciBusLite.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\PciBusPciBusLite_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\PciBusPciBusLite_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="PciBus_cleanall">
|
||||
<OutputDirSetup baseName="PciBus" mbdFilename="${MODULE_DIR}\PciBus.mbd" msaFilename="${MODULE_DIR}\PciBus.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\PciBus_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\PciBus_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**PciBus*"/>
|
||||
</delete>
|
||||
</target>
|
||||
<target name="LightPciBusPciBus_cleanall">
|
||||
<OutputDirSetup baseName="LightPciBusPciBus" mbdFilename="${MODULE_DIR}\LightPciBus.mbd" msaFilename="${MODULE_DIR}\LightPciBus.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\LightPciBusPciBus_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\LightPciBusPciBus_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**LightPciBusPciBus*"/>
|
||||
</delete>
|
||||
</target>
|
||||
<target name="PciBusPciBusLite_cleanall">
|
||||
<OutputDirSetup baseName="PciBusPciBusLite" mbdFilename="${MODULE_DIR}\PciBusLite.mbd" msaFilename="${MODULE_DIR}\PciBusLite.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\PciBusPciBusLite_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\PciBusPciBusLite_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**PciBusPciBusLite*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
375
EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c
Normal file
375
EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c
Normal file
@ -0,0 +1,375 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciBus.c
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "PciBus.h"
|
||||
|
||||
//
|
||||
// PCI Bus Support Function Prototypes
|
||||
//
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
//
|
||||
// PCI Bus Driver Global Variables
|
||||
//
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gPciBusDriverBinding = {
|
||||
PciBusDriverBindingSupported,
|
||||
PciBusDriverBindingStart,
|
||||
PciBusDriverBindingStop,
|
||||
0x10,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL *gEfiIncompatiblePciDeviceSupport = NULL;
|
||||
EFI_HANDLE gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];
|
||||
UINTN gPciHostBridgeNumber;
|
||||
BOOLEAN gFullEnumeration;
|
||||
UINT64 gAllOne = 0xFFFFFFFFFFFFFFFFULL;
|
||||
UINT64 gAllZero = 0;
|
||||
|
||||
EFI_PCI_PLATFORM_PROTOCOL *gPciPlatformProtocol;
|
||||
|
||||
//
|
||||
// PCI Bus Driver Support Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize the global variables
|
||||
publish the driver binding protocol
|
||||
|
||||
Arguments:
|
||||
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS
|
||||
EFI_DEVICE_ERROR
|
||||
|
||||
--*/
|
||||
// TODO: ImageHandle - add argument and description to function comment
|
||||
// TODO: SystemTable - add argument and description to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
InitializePciDevicePool ();
|
||||
|
||||
gFullEnumeration = TRUE;
|
||||
|
||||
gPciHostBridgeNumber = 0;
|
||||
|
||||
InstallHotPlugRequestProtocol (&Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Check to see if pci bus driver supports the given controller
|
||||
|
||||
Arguments:
|
||||
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: Controller - add argument and description to function comment
|
||||
// TODO: RemainingDevicePath - add argument and description to function comment
|
||||
// TODO: EFI_UNSUPPORTED - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||
EFI_DEV_PATH_PTR Node;
|
||||
|
||||
if (RemainingDevicePath != NULL) {
|
||||
Node.DevPath = RemainingDevicePath;
|
||||
if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||
|
||||
Node.DevPath->SubType != HW_PCI_DP ||
|
||||
DevicePathNodeLength(Node.DevPath) != sizeof(PCI_DEVICE_PATH)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Open the IO Abstraction(s) needed to perform the supported test
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &ParentDevicePath,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (Status == EFI_ALREADY_STARTED) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiPciRootBridgeIoProtocolGuid,
|
||||
(VOID **) &PciRootBridgeIo,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (Status == EFI_ALREADY_STARTED) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiPciRootBridgeIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Start to management the controller passed in
|
||||
|
||||
Arguments:
|
||||
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: Controller - add argument and description to function comment
|
||||
// TODO: RemainingDevicePath - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiIncompatiblePciDeviceSupportProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &gEfiIncompatiblePciDeviceSupport
|
||||
);
|
||||
|
||||
//
|
||||
// If PCI Platform protocol is available, get it now.
|
||||
// If the platform implements this, it must be installed before BDS phase
|
||||
//
|
||||
gPciPlatformProtocol = NULL;
|
||||
gBS->LocateProtocol (
|
||||
&gEfiPciPlatformProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &gPciPlatformProtocol
|
||||
);
|
||||
|
||||
gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));
|
||||
|
||||
//
|
||||
// Enumerate the entire host bridge
|
||||
// After enumeration, a database that records all the device information will be created
|
||||
//
|
||||
//
|
||||
Status = PciEnumerator (Controller);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Enable PCI device specified by remaining device path. BDS or other driver can call the
|
||||
// start more than once.
|
||||
//
|
||||
|
||||
StartPciDevices (Controller, RemainingDevicePath);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Stop one or more children created at start of pci bus driver
|
||||
if all the the children get closed, close the protocol
|
||||
|
||||
Arguments:
|
||||
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: Controller - add argument and description to function comment
|
||||
// TODO: NumberOfChildren - add argument and description to function comment
|
||||
// TODO: ChildHandleBuffer - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_DEVICE_ERROR - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
BOOLEAN AllChildrenStopped;
|
||||
|
||||
if (NumberOfChildren == 0) {
|
||||
//
|
||||
// Close the bus driver
|
||||
//
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiPciRootBridgeIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
DestroyRootBridgeByHandle (
|
||||
Controller
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Stop all the children
|
||||
//
|
||||
|
||||
AllChildrenStopped = TRUE;
|
||||
|
||||
for (Index = 0; Index < NumberOfChildren; Index++) {
|
||||
|
||||
//
|
||||
// De register all the pci device
|
||||
//
|
||||
Status = DeRegisterPciDevice (Controller, ChildHandleBuffer[Index]);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
AllChildrenStopped = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!AllChildrenStopped) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
243
EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.h
Normal file
243
EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.h
Normal file
@ -0,0 +1,243 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
PciBus.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_BUS_H
|
||||
#define _EFI_PCI_BUS_H
|
||||
|
||||
|
||||
#include <IndustryStandard/Pci22.h>
|
||||
#include <IndustryStandard/Acpi.h>
|
||||
#include "ComponentName.h"
|
||||
|
||||
//
|
||||
// Driver Produced Protocol Prototypes
|
||||
//
|
||||
|
||||
#define VGABASE1 0x3B0
|
||||
#define VGALIMIT1 0x3BB
|
||||
|
||||
#define VGABASE2 0x3C0
|
||||
#define VGALIMIT2 0x3DF
|
||||
|
||||
#define ISABASE 0x100
|
||||
#define ISALIMIT 0x3FF
|
||||
|
||||
typedef enum {
|
||||
PciBarTypeUnknown = 0,
|
||||
PciBarTypeIo16,
|
||||
PciBarTypeIo32,
|
||||
PciBarTypeMem32,
|
||||
PciBarTypePMem32,
|
||||
PciBarTypeMem64,
|
||||
PciBarTypePMem64,
|
||||
PciBarTypeIo,
|
||||
PciBarTypeMem,
|
||||
PciBarTypeMaxType
|
||||
} PCI_BAR_TYPE;
|
||||
|
||||
typedef struct {
|
||||
UINT64 BaseAddress;
|
||||
UINT64 Length;
|
||||
UINT64 Alignment;
|
||||
PCI_BAR_TYPE BarType;
|
||||
BOOLEAN Prefetchable;
|
||||
UINT8 MemType;
|
||||
UINT8 Offset;
|
||||
} PCI_BAR;
|
||||
|
||||
#define PPB_BAR_0 0
|
||||
#define PPB_BAR_1 1
|
||||
#define PPB_IO_RANGE 2
|
||||
#define PPB_MEM32_RANGE 3
|
||||
#define PPB_PMEM32_RANGE 4
|
||||
#define PPB_PMEM64_RANGE 5
|
||||
#define PPB_MEM64_RANGE 0xFF
|
||||
|
||||
#define P2C_BAR_0 0
|
||||
#define P2C_MEM_1 1
|
||||
#define P2C_MEM_2 2
|
||||
#define P2C_IO_1 3
|
||||
#define P2C_IO_2 4
|
||||
|
||||
#define PCI_IO_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('p', 'c', 'i', 'o')
|
||||
|
||||
#define EFI_BRIDGE_IO32_DECODE_SUPPORTED 0x0001
|
||||
#define EFI_BRIDGE_PMEM32_DECODE_SUPPORTED 0x0002
|
||||
#define EFI_BRIDGE_PMEM64_DECODE_SUPPORTED 0x0004
|
||||
#define EFI_BRIDGE_IO16_DECODE_SUPPORTED 0x0008
|
||||
#define EFI_BRIDGE_PMEM_MEM_COMBINE_SUPPORTED 0x0010
|
||||
#define EFI_BRIDGE_MEM64_DECODE_SUPPORTED 0x0020
|
||||
#define EFI_BRIDGE_MEM32_DECODE_SUPPORTED 0x0040
|
||||
|
||||
#define PCI_MAX_HOST_BRIDGE_NUM 0x0010
|
||||
//
|
||||
// Define resource status constant
|
||||
//
|
||||
#define EFI_RESOURCE_NONEXISTENT 0xFFFFFFFFFFFFFFFFULL
|
||||
#define EFI_RESOURCE_LESS 0xFFFFFFFFFFFFFFFEULL
|
||||
#define EFI_RESOURCE_SATISFIED 0x0000000000000000ULL
|
||||
|
||||
//
|
||||
// Define option for attribute
|
||||
//
|
||||
#define EFI_SET_SUPPORTS 0
|
||||
#define EFI_SET_ATTRIBUTES 1
|
||||
|
||||
typedef struct _PCI_IO_DEVICE {
|
||||
UINT32 Signature;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_PCI_IO_PROTOCOL PciIo;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL PciDriverOverride;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||
|
||||
//
|
||||
// PCI configuration space header type
|
||||
//
|
||||
PCI_TYPE00 Pci;
|
||||
|
||||
//
|
||||
// Bus number, Device number, Function number
|
||||
//
|
||||
UINT8 BusNumber;
|
||||
UINT8 DeviceNumber;
|
||||
UINT8 FunctionNumber;
|
||||
|
||||
//
|
||||
// BAR for this PCI Device
|
||||
//
|
||||
PCI_BAR PciBar[PCI_MAX_BAR];
|
||||
|
||||
//
|
||||
// The bridge device this pci device is subject to
|
||||
//
|
||||
struct _PCI_IO_DEVICE *Parent;
|
||||
|
||||
//
|
||||
// A linked list for children Pci Device if it is bridge device
|
||||
//
|
||||
LIST_ENTRY ChildList;
|
||||
|
||||
//
|
||||
// TURE if the PCI bus driver creates the handle for this PCI device
|
||||
//
|
||||
BOOLEAN Registered;
|
||||
|
||||
//
|
||||
// TRUE if the PCI bus driver successfully allocates the resource required by
|
||||
// this PCI device
|
||||
//
|
||||
BOOLEAN Allocated;
|
||||
|
||||
//
|
||||
// The attribute this PCI device currently set
|
||||
//
|
||||
UINT64 Attributes;
|
||||
|
||||
//
|
||||
// The attributes this PCI device actually supports
|
||||
//
|
||||
UINT64 Supports;
|
||||
|
||||
//
|
||||
// The resource decode the bridge supports
|
||||
//
|
||||
UINT32 Decodes;
|
||||
|
||||
//
|
||||
// The OptionRom Size
|
||||
//
|
||||
UINT64 RomSize;
|
||||
|
||||
//
|
||||
// The OptionRom Size
|
||||
//
|
||||
UINT64 RomBase;
|
||||
|
||||
//
|
||||
// TRUE if all OpROM (in device or in platform specific position) have been processed
|
||||
//
|
||||
BOOLEAN AllOpRomProcessed;
|
||||
|
||||
//
|
||||
// TRUE if there is any EFI driver in the OptionRom
|
||||
//
|
||||
BOOLEAN BusOverride;
|
||||
|
||||
//
|
||||
// A list tracking reserved resource on a bridge device
|
||||
//
|
||||
LIST_ENTRY ReservedResourceList;
|
||||
|
||||
//
|
||||
// A list tracking image handle of platform specific overriding driver
|
||||
//
|
||||
LIST_ENTRY OptionRomDriverList;
|
||||
|
||||
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *ResourcePaddingDescriptors;
|
||||
EFI_HPC_PADDING_ATTRIBUTES PaddingAttributes;
|
||||
|
||||
BOOLEAN IsPciExp;
|
||||
|
||||
} PCI_IO_DEVICE;
|
||||
|
||||
|
||||
#define PCI_IO_DEVICE_FROM_PCI_IO_THIS(a) \
|
||||
CR (a, PCI_IO_DEVICE, PciIo, PCI_IO_DEVICE_SIGNATURE)
|
||||
|
||||
#define PCI_IO_DEVICE_FROM_PCI_DRIVER_OVERRIDE_THIS(a) \
|
||||
CR (a, PCI_IO_DEVICE, PciDriverOverride, PCI_IO_DEVICE_SIGNATURE)
|
||||
|
||||
#define PCI_IO_DEVICE_FROM_LINK(a) \
|
||||
CR (a, PCI_IO_DEVICE, Link, PCI_IO_DEVICE_SIGNATURE)
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
extern EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL *gEfiIncompatiblePciDeviceSupport;
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gPciBusDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName;
|
||||
extern LIST_ENTRY gPciDevicePool;
|
||||
extern BOOLEAN gFullEnumeration;
|
||||
extern UINTN gPciHostBridgeNumber;
|
||||
extern EFI_HANDLE gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];
|
||||
extern UINT64 gAllOne;
|
||||
extern UINT64 gAllZero;
|
||||
|
||||
extern EFI_PCI_PLATFORM_PROTOCOL *gPciPlatformProtocol;
|
||||
|
||||
#include "PciIo.h"
|
||||
#include "PciCommand.h"
|
||||
#include "PciDeviceSupport.h"
|
||||
#include "PciEnumerator.h"
|
||||
#include "PciEnumeratorSupport.h"
|
||||
#include "PciDriverOverride.h"
|
||||
#include "PciRomTable.h"
|
||||
#include "PciOptionRomSupport.h"
|
||||
#include "PciPowerManagement.h"
|
||||
#include "PciHotPlugSupport.h"
|
||||
#include "PciLib.h"
|
||||
|
||||
#endif
|
189
EdkModulePkg/Bus/Pci/Uhci/Dxe/ComponentName.c
Normal file
189
EdkModulePkg/Bus/Pci/Uhci/Dxe/ComponentName.c
Normal file
@ -0,0 +1,189 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
ComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include "uhci.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UhciComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UhciComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle, OPTIONAL
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName = {
|
||||
UhciComponentNameGetDriverName,
|
||||
UhciComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
static EFI_UNICODE_STRING_TABLE mUhciDriverNameTable[] = {
|
||||
{ "eng", (CHAR16 *) L"Usb Uhci Driver" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UhciComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
Language - A pointer to a three character ISO 639-2 language identifier.
|
||||
This is the language of the driver name that that the caller
|
||||
is requesting, and it must match one of the languages specified
|
||||
in SupportedLanguages. The number of languages supported by a
|
||||
driver is up to the driver writer.
|
||||
DriverName - A pointer to the Unicode string to return. This Unicode string
|
||||
is the name of the driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the Driver specified by This
|
||||
and the language specified by Language was returned
|
||||
in DriverName.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - DriverName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gUhciComponentName.SupportedLanguages,
|
||||
mUhciDriverNameTable,
|
||||
DriverName
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UhciComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle, OPTIONAL
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
ControllerHandle - The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
ChildHandle - The handle of the child controller to retrieve the name
|
||||
of. This is an optional parameter that may be NULL. It
|
||||
will be NULL for device drivers. It will also be NULL
|
||||
for a bus drivers that wish to retrieve the name of the
|
||||
bus controller. It will not be NULL for a bus driver
|
||||
that wishes to retrieve the name of a child controller.
|
||||
Language - A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that that the caller is requesting, and it must match one
|
||||
of the languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up to the
|
||||
driver writer.
|
||||
ControllerName - A pointer to the Unicode string to return. This Unicode
|
||||
string is the name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the language
|
||||
specified by Language from the point of view of the
|
||||
driver specified by This.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the user readable name in the
|
||||
language specified by Language for the driver
|
||||
specified by This was returned in DriverName.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - ControllerName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
USB_HC_DEV *UhciDev;
|
||||
EFI_USB_HC_PROTOCOL *UsbHc;
|
||||
|
||||
//
|
||||
// This is a device driver, so ChildHandle must be NULL.
|
||||
//
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
//
|
||||
// Get the device context
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiUsbHcProtocolGuid,
|
||||
(VOID **) &UsbHc,
|
||||
gUhciDriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
UhciDev = USB_HC_DEV_FROM_THIS (UsbHc);
|
||||
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gUhciComponentName.SupportedLanguages,
|
||||
UhciDev->ControllerNameTable,
|
||||
ControllerName
|
||||
);
|
||||
|
||||
}
|
42
EdkModulePkg/Bus/Pci/Uhci/Dxe/Uhci.mbd
Normal file
42
EdkModulePkg/Bus/Pci/Uhci/Dxe/Uhci.mbd
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>Uhci</BaseName>
|
||||
<Guid>2FB92EFA-2EE0-4bae-9EB6-7464125E1EF7</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Modified>2006-03-19 15:18</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>UefiDriverModelLib</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>EdkDxePrintLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
</Libraries>
|
||||
</ModuleBuildDescription>
|
66
EdkModulePkg/Bus/Pci/Uhci/Dxe/Uhci.msa
Normal file
66
EdkModulePkg/Bus/Pci/Uhci/Dxe/Uhci.msa
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>Uhci</BaseName>
|
||||
<ModuleType>UEFI_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>2FB92EFA-2EE0-4bae-9EB6-7464125E1EF7</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for Uhci module</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>0</Specification>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Updated>2006-03-19 15:18</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverModelLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>uhci.c</Filename>
|
||||
<Filename>uhchlp.c</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
<Filename>uhci.h</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="TO_START">PciIo</Protocol>
|
||||
<Protocol Usage="BY_START">UsbHc</Protocol>
|
||||
</Protocols>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint></ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gUhciDriverBinding</DriverBinding>
|
||||
<ComponentName>gUhciComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
47
EdkModulePkg/Bus/Pci/Uhci/Dxe/build.xml
Normal file
47
EdkModulePkg/Bus/Pci/Uhci/Dxe/build.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
|
||||
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.-->
|
||||
<project basedir="." default="Uhci"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Bus\Pci\Uhci\Dxe"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="Uhci">
|
||||
<GenBuild baseName="Uhci" mbdFilename="${MODULE_DIR}\Uhci.mbd" msaFilename="${MODULE_DIR}\Uhci.msa"/>
|
||||
</target>
|
||||
<target depends="Uhci_clean" name="clean"/>
|
||||
<target depends="Uhci_cleanall" name="cleanall"/>
|
||||
<target name="Uhci_clean">
|
||||
<OutputDirSetup baseName="Uhci" mbdFilename="${MODULE_DIR}\Uhci.mbd" msaFilename="${MODULE_DIR}\Uhci.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\Uhci_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\Uhci_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="Uhci_cleanall">
|
||||
<OutputDirSetup baseName="Uhci" mbdFilename="${MODULE_DIR}\Uhci.mbd" msaFilename="${MODULE_DIR}\Uhci.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\Uhci_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\Uhci_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**Uhci*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
4237
EdkModulePkg/Bus/Pci/Uhci/Dxe/uhchlp.c
Normal file
4237
EdkModulePkg/Bus/Pci/Uhci/Dxe/uhchlp.c
Normal file
File diff suppressed because it is too large
Load Diff
3498
EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c
Normal file
3498
EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c
Normal file
File diff suppressed because it is too large
Load Diff
1187
EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h
Normal file
1187
EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h
Normal file
File diff suppressed because it is too large
Load Diff
1661
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Decode.c
Normal file
1661
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Decode.c
Normal file
File diff suppressed because it is too large
Load Diff
3772
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/E100b.c
Normal file
3772
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/E100b.c
Normal file
File diff suppressed because it is too large
Load Diff
668
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/E100b.h
Normal file
668
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/E100b.h
Normal file
@ -0,0 +1,668 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
E100B.H
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
// pci config offsets:
|
||||
|
||||
#define RX_BUFFER_COUNT 32
|
||||
#define TX_BUFFER_COUNT 32
|
||||
|
||||
#define PCI_VENDOR_ID_INTEL 0x8086
|
||||
#define PCI_DEVICE_ID_INTEL_82557 0x1229
|
||||
#define D100_VENDOR_ID 0x8086
|
||||
#define D100_DEVICE_ID 0x1229
|
||||
#define D102_DEVICE_ID 0x2449
|
||||
|
||||
#define ICH3_DEVICE_ID_1 0x1031
|
||||
#define ICH3_DEVICE_ID_2 0x1032
|
||||
#define ICH3_DEVICE_ID_3 0x1033
|
||||
#define ICH3_DEVICE_ID_4 0x1034
|
||||
#define ICH3_DEVICE_ID_5 0x1035
|
||||
#define ICH3_DEVICE_ID_6 0x1036
|
||||
#define ICH3_DEVICE_ID_7 0x1037
|
||||
#define ICH3_DEVICE_ID_8 0x1038
|
||||
|
||||
#define SPEEDO_DEVICE_ID 0x1227
|
||||
#define SPLASH1_DEVICE_ID 0x1226
|
||||
|
||||
|
||||
// bit fields for the command
|
||||
#define PCI_COMMAND_MASTER 0x04 // bit 2
|
||||
#define PCI_COMMAND_IO 0x01 // bit 0
|
||||
#define PCI_COMMAND 0x04
|
||||
#define PCI_LATENCY_TIMER 0x0D
|
||||
|
||||
#define ETHER_MAC_ADDR_LEN 6
|
||||
#ifdef AVL_XXX
|
||||
#define ETHER_HEADER_LEN 14
|
||||
// media interface type
|
||||
// #define INTERFACE_TYPE "
|
||||
|
||||
// Hardware type values
|
||||
#define HW_ETHER_TYPE 1
|
||||
#define HW_EXPERIMENTAL_ETHER_TYPE 2
|
||||
#define HW_IEEE_TYPE 6
|
||||
#define HW_ARCNET_TYPE 7
|
||||
|
||||
#endif // AVL_XXX
|
||||
|
||||
#define MAX_ETHERNET_PKT_SIZE 1514 // including eth header
|
||||
#define RX_BUFFER_SIZE 1536 // including crc and padding
|
||||
#define TX_BUFFER_SIZE 64
|
||||
#define ETH_MTU 1500 // does not include ethernet header length
|
||||
|
||||
#define SPEEDO3_TOTAL_SIZE 0x20
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct eth {
|
||||
UINT8 dest_addr[PXE_HWADDR_LEN_ETHER];
|
||||
UINT8 src_addr[PXE_HWADDR_LEN_ETHER];
|
||||
UINT16 type;
|
||||
} EtherHeader;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct CONFIG_HEADER {
|
||||
UINT16 VendorID;
|
||||
UINT16 DeviceID;
|
||||
UINT16 Command;
|
||||
UINT16 Status;
|
||||
UINT16 RevID;
|
||||
UINT16 ClassID;
|
||||
UINT8 CacheLineSize;
|
||||
UINT8 LatencyTimer;
|
||||
UINT8 HeaderType; // must be zero to impose this structure...
|
||||
UINT8 BIST; // built-in self test
|
||||
UINT32 BaseAddressReg_0; // memory mapped address
|
||||
UINT32 BaseAddressReg_1; //io mapped address, Base IO address
|
||||
UINT32 BaseAddressReg_2; // option rom address
|
||||
UINT32 BaseAddressReg_3;
|
||||
UINT32 BaseAddressReg_4;
|
||||
UINT32 BaseAddressReg_5;
|
||||
UINT32 CardBusCISPtr;
|
||||
UINT16 SubVendorID;
|
||||
UINT16 SubSystemID;
|
||||
UINT32 ExpansionROMBaseAddr;
|
||||
UINT8 CapabilitiesPtr;
|
||||
UINT8 reserved1;
|
||||
UINT16 Reserved2;
|
||||
UINT32 Reserved3;
|
||||
UINT8 int_line;
|
||||
UINT8 int_pin;
|
||||
UINT8 Min_gnt;
|
||||
UINT8 Max_lat;
|
||||
} PCI_CONFIG_HEADER;
|
||||
#pragma pack()
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Offsets to the various registers.
|
||||
// All accesses need not be longword aligned.
|
||||
//-------------------------------------------------------------------------
|
||||
enum speedo_offsets {
|
||||
SCBStatus = 0, SCBCmd = 2, // Rx/Command Unit command and status.
|
||||
SCBPointer = 4, // General purpose pointer.
|
||||
SCBPort = 8, // Misc. commands and operands.
|
||||
SCBflash = 12, SCBeeprom = 14, // EEPROM and flash memory control.
|
||||
SCBCtrlMDI = 16, // MDI interface control.
|
||||
SCBEarlyRx = 20, // Early receive byte count.
|
||||
SCBEarlyRxInt = 24, SCBFlowCtrlReg = 25, SCBPmdr = 27,
|
||||
// offsets for general control registers (GCRs)
|
||||
SCBGenCtrl = 28, SCBGenStatus = 29, SCBGenCtrl2 = 30, SCBRsvd = 31,
|
||||
};
|
||||
|
||||
#define GCR2_EEPROM_ACCESS_SEMAPHORE 0x80 // bit offset into the gcr2
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Action commands - Commands that can be put in a command list entry.
|
||||
//-------------------------------------------------------------------------
|
||||
enum commands {
|
||||
CmdNOp = 0, CmdIASetup = 1, CmdConfigure = 2, CmdMulticastList = 3,
|
||||
CmdTx = 4, CmdTDR = 5, CmdDump = 6, CmdDiagnose = 7,
|
||||
CmdSuspend = 0x4000, /* Suspend after completion. */
|
||||
CmdIntr = 0x2000, /* Interrupt after completion. */
|
||||
CmdTxFlex = 0x0008, /* Use "Flexible mode" for CmdTx command. */
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// port commands
|
||||
//-------------------------------------------------------------------------
|
||||
#define PORT_RESET 0
|
||||
#define PORT_SELF_TEST 1
|
||||
#define POR_SELECTIVE_RESET 2
|
||||
#define PORT_DUMP_POINTER 2
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// SCB Command Word bit definitions
|
||||
//-------------------------------------------------------------------------
|
||||
//- CUC fields
|
||||
#define CU_START 0x0010
|
||||
#define CU_RESUME 0x0020
|
||||
#define CU_STATSADDR 0x0040
|
||||
#define CU_SHOWSTATS 0x0050 /* Dump statistics counters. */
|
||||
#define CU_CMD_BASE 0x0060 /* Base address to add to add CU commands. */
|
||||
#define CU_DUMPSTATS 0x0070 /* Dump then reset stats counters. */
|
||||
|
||||
//- RUC fields
|
||||
#define RX_START 0x0001
|
||||
#define RX_RESUME 0x0002
|
||||
#define RX_ABORT 0x0004
|
||||
#define RX_ADDR_LOAD 0x0006 /* load ru_base_reg */
|
||||
#define RX_RESUMENR 0x0007
|
||||
|
||||
// Interrupt fields (assuming byte addressing)
|
||||
#define INT_MASK 0x0100
|
||||
#define DRVR_INT 0x0200 /* Driver generated interrupt. */
|
||||
|
||||
//- CB Status Word
|
||||
#define CMD_STATUS_COMPLETE 0x8000
|
||||
#define RX_STATUS_COMPLETE 0x8000
|
||||
#define CMD_STATUS_MASK 0xF000
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//- SCB Status bits:
|
||||
// Interrupts are ACKed by writing to the upper 6 interrupt bits
|
||||
//-------------------------------------------------------------------------
|
||||
#define SCB_STATUS_MASK 0xFC00 // bits 2-7 - STATUS/ACK Mask
|
||||
#define SCB_STATUS_CX_TNO 0x8000 // BIT_15 - CX or TNO Interrupt
|
||||
#define SCB_STATUS_FR 0x4000 // BIT_14 - FR Interrupt
|
||||
#define SCB_STATUS_CNA 0x2000 // BIT_13 - CNA Interrupt
|
||||
#define SCB_STATUS_RNR 0x1000 // BIT_12 - RNR Interrupt
|
||||
#define SCB_STATUS_MDI 0x0800 // BIT_11 - MDI R/W Done Interrupt
|
||||
#define SCB_STATUS_SWI 0x0400 // BIT_10 - SWI Interrupt
|
||||
|
||||
// CU STATUS: bits 6 & 7
|
||||
#define SCB_STATUS_CU_MASK 0x00C0 // bits 6 & 7
|
||||
#define SCB_STATUS_CU_IDLE 0x0000 // 00
|
||||
#define SCB_STATUS_CU_SUSPEND 0x0040 // 01
|
||||
#define SCB_STATUS_CU_ACTIVE 0x0080 // 10
|
||||
|
||||
// RU STATUS: bits 2-5
|
||||
#define SCB_RUS_IDLE 0x0000
|
||||
#define SCB_RUS_SUSPENDED 0x0004 // bit 2
|
||||
#define SCB_RUS_NO_RESOURCES 0x0008 // bit 3
|
||||
#define SCB_RUS_READY 0x0010 // bit 4
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Bit Mask definitions
|
||||
//-------------------------------------------------------------------------
|
||||
#define BIT_0 0x0001
|
||||
#define BIT_1 0x0002
|
||||
#define BIT_2 0x0004
|
||||
#define BIT_3 0x0008
|
||||
#define BIT_4 0x0010
|
||||
#define BIT_5 0x0020
|
||||
#define BIT_6 0x0040
|
||||
#define BIT_7 0x0080
|
||||
#define BIT_8 0x0100
|
||||
#define BIT_9 0x0200
|
||||
#define BIT_10 0x0400
|
||||
#define BIT_11 0x0800
|
||||
#define BIT_12 0x1000
|
||||
#define BIT_13 0x2000
|
||||
#define BIT_14 0x4000
|
||||
#define BIT_15 0x8000
|
||||
#define BIT_24 0x01000000
|
||||
#define BIT_28 0x10000000
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// MDI Control register bit definitions
|
||||
//-------------------------------------------------------------------------
|
||||
#define MDI_DATA_MASK BIT_0_15 // MDI Data port
|
||||
#define MDI_REG_ADDR BIT_16_20 // which MDI register to read/write
|
||||
#define MDI_PHY_ADDR BIT_21_25 // which PHY to read/write
|
||||
#define MDI_PHY_OPCODE BIT_26_27 // which PHY to read/write
|
||||
#define MDI_PHY_READY BIT_28 // PHY is ready for another MDI cycle
|
||||
#define MDI_PHY_INT_ENABLE BIT_29 // Assert INT at MDI cycle completion
|
||||
|
||||
#define BIT_0_2 0x0007
|
||||
#define BIT_0_3 0x000F
|
||||
#define BIT_0_4 0x001F
|
||||
#define BIT_0_5 0x003F
|
||||
#define BIT_0_6 0x007F
|
||||
#define BIT_0_7 0x00FF
|
||||
#define BIT_0_8 0x01FF
|
||||
#define BIT_0_13 0x3FFF
|
||||
#define BIT_0_15 0xFFFF
|
||||
#define BIT_1_2 0x0006
|
||||
#define BIT_1_3 0x000E
|
||||
#define BIT_2_5 0x003C
|
||||
#define BIT_3_4 0x0018
|
||||
#define BIT_4_5 0x0030
|
||||
#define BIT_4_6 0x0070
|
||||
#define BIT_4_7 0x00F0
|
||||
#define BIT_5_7 0x00E0
|
||||
#define BIT_5_9 0x03E0
|
||||
#define BIT_5_12 0x1FE0
|
||||
#define BIT_5_15 0xFFE0
|
||||
#define BIT_6_7 0x00c0
|
||||
#define BIT_7_11 0x0F80
|
||||
#define BIT_8_10 0x0700
|
||||
#define BIT_9_13 0x3E00
|
||||
#define BIT_12_15 0xF000
|
||||
|
||||
#define BIT_16_20 0x001F0000
|
||||
#define BIT_21_25 0x03E00000
|
||||
#define BIT_26_27 0x0C000000
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// MDI Control register opcode definitions
|
||||
//-------------------------------------------------------------------------
|
||||
#define MDI_WRITE 1 // Phy Write
|
||||
#define MDI_READ 2 // Phy read
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// PHY 100 MDI Register/Bit Definitions
|
||||
//-------------------------------------------------------------------------
|
||||
// MDI register set
|
||||
#define MDI_CONTROL_REG 0x00 // MDI control register
|
||||
#define MDI_STATUS_REG 0x01 // MDI Status regiser
|
||||
#define PHY_ID_REG_1 0x02 // Phy indentification reg (word 1)
|
||||
#define PHY_ID_REG_2 0x03 // Phy indentification reg (word 2)
|
||||
#define AUTO_NEG_ADVERTISE_REG 0x04 // Auto-negotiation advertisement
|
||||
#define AUTO_NEG_LINK_PARTNER_REG 0x05 // Auto-negotiation link partner ability
|
||||
#define AUTO_NEG_EXPANSION_REG 0x06 // Auto-negotiation expansion
|
||||
#define AUTO_NEG_NEXT_PAGE_REG 0x07 // Auto-negotiation next page transmit
|
||||
#define EXTENDED_REG_0 0x10 // Extended reg 0 (Phy 100 modes)
|
||||
#define EXTENDED_REG_1 0x14 // Extended reg 1 (Phy 100 error indications)
|
||||
#define NSC_CONG_CONTROL_REG 0x17 // National (TX) congestion control
|
||||
#define NSC_SPEED_IND_REG 0x19 // National (TX) speed indication
|
||||
|
||||
// MDI Control register bit definitions
|
||||
#define MDI_CR_COLL_TEST_ENABLE BIT_7 // Collision test enable
|
||||
#define MDI_CR_FULL_HALF BIT_8 // FDX =1, half duplex =0
|
||||
#define MDI_CR_RESTART_AUTO_NEG BIT_9 // Restart auto negotiation
|
||||
#define MDI_CR_ISOLATE BIT_10 // Isolate PHY from MII
|
||||
#define MDI_CR_POWER_DOWN BIT_11 // Power down
|
||||
#define MDI_CR_AUTO_SELECT BIT_12 // Auto speed select enable
|
||||
#define MDI_CR_10_100 BIT_13 // 0 = 10Mbs, 1 = 100Mbs
|
||||
#define MDI_CR_LOOPBACK BIT_14 // 0 = normal, 1 = loopback
|
||||
#define MDI_CR_RESET BIT_15 // 0 = normal, 1 = PHY reset
|
||||
|
||||
// MDI Status register bit definitions
|
||||
#define MDI_SR_EXT_REG_CAPABLE BIT_0 // Extended register capabilities
|
||||
#define MDI_SR_JABBER_DETECT BIT_1 // Jabber detected
|
||||
#define MDI_SR_LINK_STATUS BIT_2 // Link Status -- 1 = link
|
||||
#define MDI_SR_AUTO_SELECT_CAPABLE BIT_3 // Auto speed select capable
|
||||
#define MDI_SR_REMOTE_FAULT_DETECT BIT_4 // Remote fault detect
|
||||
#define MDI_SR_AUTO_NEG_COMPLETE BIT_5 // Auto negotiation complete
|
||||
#define MDI_SR_10T_HALF_DPX BIT_11 // 10BaseT Half Duplex capable
|
||||
#define MDI_SR_10T_FULL_DPX BIT_12 // 10BaseT full duplex capable
|
||||
#define MDI_SR_TX_HALF_DPX BIT_13 // TX Half Duplex capable
|
||||
#define MDI_SR_TX_FULL_DPX BIT_14 // TX full duplex capable
|
||||
#define MDI_SR_T4_CAPABLE BIT_15 // T4 capable
|
||||
|
||||
// Auto-Negotiation advertisement register bit definitions
|
||||
#define NWAY_AD_SELCTOR_FIELD BIT_0_4 // identifies supported protocol
|
||||
#define NWAY_AD_ABILITY BIT_5_12 // technologies that are supported
|
||||
#define NWAY_AD_10T_HALF_DPX BIT_5 // 10BaseT Half Duplex capable
|
||||
#define NWAY_AD_10T_FULL_DPX BIT_6 // 10BaseT full duplex capable
|
||||
#define NWAY_AD_TX_HALF_DPX BIT_7 // TX Half Duplex capable
|
||||
#define NWAY_AD_TX_FULL_DPX BIT_8 // TX full duplex capable
|
||||
#define NWAY_AD_T4_CAPABLE BIT_9 // T4 capable
|
||||
#define NWAY_AD_REMOTE_FAULT BIT_13 // indicates local remote fault
|
||||
#define NWAY_AD_RESERVED BIT_14 // reserved
|
||||
#define NWAY_AD_NEXT_PAGE BIT_15 // Next page (not supported)
|
||||
|
||||
// Auto-Negotiation link partner ability register bit definitions
|
||||
#define NWAY_LP_SELCTOR_FIELD BIT_0_4 // identifies supported protocol
|
||||
#define NWAY_LP_ABILITY BIT_5_9 // technologies that are supported
|
||||
#define NWAY_LP_REMOTE_FAULT BIT_13 // indicates partner remote fault
|
||||
#define NWAY_LP_ACKNOWLEDGE BIT_14 // acknowledge
|
||||
#define NWAY_LP_NEXT_PAGE BIT_15 // Next page (not supported)
|
||||
|
||||
// Auto-Negotiation expansion register bit definitions
|
||||
#define NWAY_EX_LP_NWAY BIT_0 // link partner is NWAY
|
||||
#define NWAY_EX_PAGE_RECEIVED BIT_1 // link code word received
|
||||
#define NWAY_EX_NEXT_PAGE_ABLE BIT_2 // local is next page able
|
||||
#define NWAY_EX_LP_NEXT_PAGE_ABLE BIT_3 // partner is next page able
|
||||
#define NWAY_EX_PARALLEL_DET_FLT BIT_4 // parallel detection fault
|
||||
#define NWAY_EX_RESERVED BIT_5_15 // reserved
|
||||
|
||||
|
||||
// PHY 100 Extended Register 0 bit definitions
|
||||
#define PHY_100_ER0_FDX_INDIC BIT_0 // 1 = FDX, 0 = half duplex
|
||||
#define PHY_100_ER0_SPEED_INDIC BIT_1 // 1 = 100mbs, 0= 10mbs
|
||||
#define PHY_100_ER0_WAKE_UP BIT_2 // Wake up DAC
|
||||
#define PHY_100_ER0_RESERVED BIT_3_4 // Reserved
|
||||
#define PHY_100_ER0_REV_CNTRL BIT_5_7 // Revsion control (A step = 000)
|
||||
#define PHY_100_ER0_FORCE_FAIL BIT_8 // Force Fail is enabled
|
||||
#define PHY_100_ER0_TEST BIT_9_13 // Revsion control (A step = 000)
|
||||
#define PHY_100_ER0_LINKDIS BIT_14 // Link integrity test is disabled
|
||||
#define PHY_100_ER0_JABDIS BIT_15 // Jabber function is disabled
|
||||
|
||||
|
||||
// PHY 100 Extended Register 1 bit definitions
|
||||
#define PHY_100_ER1_RESERVED BIT_0_8 // Reserved
|
||||
#define PHY_100_ER1_CH2_DET_ERR BIT_9 // Channel 2 EOF detection error
|
||||
#define PHY_100_ER1_MANCH_CODE_ERR BIT_10 // Manchester code error
|
||||
#define PHY_100_ER1_EOP_ERR BIT_11 // EOP error
|
||||
#define PHY_100_ER1_BAD_CODE_ERR BIT_12 // bad code error
|
||||
#define PHY_100_ER1_INV_CODE_ERR BIT_13 // invalid code error
|
||||
#define PHY_100_ER1_DC_BAL_ERR BIT_14 // DC balance error
|
||||
#define PHY_100_ER1_PAIR_SKEW_ERR BIT_15 // Pair skew error
|
||||
|
||||
// National Semiconductor TX phy congestion control register bit definitions
|
||||
#define NSC_TX_CONG_TXREADY BIT_10 // Makes TxReady an input
|
||||
#define NSC_TX_CONG_ENABLE BIT_8 // Enables congestion control
|
||||
#define NSC_TX_CONG_F_CONNECT BIT_5 // Enables congestion control
|
||||
|
||||
// National Semiconductor TX phy speed indication register bit definitions
|
||||
#define NSC_TX_SPD_INDC_SPEED BIT_6 // 0 = 100mb, 1=10mb
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Phy related constants
|
||||
//-------------------------------------------------------------------------
|
||||
#define PHY_503 0
|
||||
#define PHY_100_A 0x000003E0
|
||||
#define PHY_100_C 0x035002A8
|
||||
#define PHY_TX_ID 0x015002A8
|
||||
#define PHY_NSC_TX 0x5c002000
|
||||
#define PHY_OTHER 0xFFFF
|
||||
|
||||
#define PHY_MODEL_REV_ID_MASK 0xFFF0FFFF
|
||||
#define PARALLEL_DETECT 0
|
||||
#define N_WAY 1
|
||||
|
||||
#define RENEGOTIATE_TIME 35 // (3.5 Seconds)
|
||||
|
||||
#define CONNECTOR_AUTO 0
|
||||
#define CONNECTOR_TPE 1
|
||||
#define CONNECTOR_MII 2
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/* The Speedo3 Rx and Tx frame/buffer descriptors. */
|
||||
#pragma pack(1)
|
||||
struct CB_Header { /* A generic descriptor. */
|
||||
UINT16 status; /* Offset 0. */
|
||||
UINT16 command; /* Offset 2. */
|
||||
UINT32 link; /* struct descriptor * */
|
||||
};
|
||||
|
||||
/* transmit command block structure */
|
||||
#pragma pack(1)
|
||||
typedef struct s_TxCB {
|
||||
struct CB_Header cb_header;
|
||||
UINT32 PhysTBDArrayAddres; /* address of an array that contains
|
||||
physical TBD pointers */
|
||||
UINT16 ByteCount; /* immediate data count = 0 always */
|
||||
UINT8 Threshold;
|
||||
UINT8 TBDCount;
|
||||
UINT8 ImmediateData[TX_BUFFER_SIZE];
|
||||
/* following fields are not seen by the 82557 */
|
||||
struct TBD {
|
||||
UINT32 phys_buf_addr;
|
||||
UINT32 buf_len;
|
||||
} TBDArray[MAX_XMIT_FRAGMENTS];
|
||||
UINT32 PhysArrayAddr; /* in case the one in the header is lost */
|
||||
UINT32 PhysTCBAddress; /* for this TCB */
|
||||
struct s_TxCB *NextTCBVirtualLinkPtr;
|
||||
struct s_TxCB *PrevTCBVirtualLinkPtr;
|
||||
UINT64 free_data_ptr; // to be given to the upper layer when this xmit completes1
|
||||
}TxCB;
|
||||
|
||||
/* The Speedo3 Rx and Tx buffer descriptors. */
|
||||
#pragma pack(1)
|
||||
typedef struct s_RxFD { /* Receive frame descriptor. */
|
||||
struct CB_Header cb_header;
|
||||
UINT32 rx_buf_addr; /* VOID * */
|
||||
UINT16 ActualCount;
|
||||
UINT16 RFDSize;
|
||||
UINT8 RFDBuffer[RX_BUFFER_SIZE];
|
||||
UINT8 forwarded;
|
||||
UINT8 junk[3];
|
||||
}RxFD;
|
||||
|
||||
/* Elements of the RxFD.status word. */
|
||||
#define RX_COMPLETE 0x8000
|
||||
#define RX_FRAME_OK 0x2000
|
||||
|
||||
/* Elements of the dump_statistics block. This block must be lword aligned. */
|
||||
#pragma pack(1)
|
||||
struct speedo_stats {
|
||||
UINT32 tx_good_frames;
|
||||
UINT32 tx_coll16_errs;
|
||||
UINT32 tx_late_colls;
|
||||
UINT32 tx_underruns;
|
||||
UINT32 tx_lost_carrier;
|
||||
UINT32 tx_deferred;
|
||||
UINT32 tx_one_colls;
|
||||
UINT32 tx_multi_colls;
|
||||
UINT32 tx_total_colls;
|
||||
UINT32 rx_good_frames;
|
||||
UINT32 rx_crc_errs;
|
||||
UINT32 rx_align_errs;
|
||||
UINT32 rx_resource_errs;
|
||||
UINT32 rx_overrun_errs;
|
||||
UINT32 rx_colls_errs;
|
||||
UINT32 rx_runt_errs;
|
||||
UINT32 done_marker;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
|
||||
struct Krn_Mem{
|
||||
RxFD rx_ring[RX_BUFFER_COUNT];
|
||||
TxCB tx_ring[TX_BUFFER_COUNT];
|
||||
struct speedo_stats statistics;
|
||||
};
|
||||
#define MEMORY_NEEDED sizeof(struct Krn_Mem)
|
||||
|
||||
/* The parameters for a CmdConfigure operation.
|
||||
There are so many options that it would be difficult to document each bit.
|
||||
We mostly use the default or recommended settings.
|
||||
*/
|
||||
|
||||
/*
|
||||
*--------------------------------------------------------------------------
|
||||
* Configuration CB Parameter Bit Definitions
|
||||
*--------------------------------------------------------------------------
|
||||
*/
|
||||
// - Byte 0 (Default Value = 16h)
|
||||
#define CFIG_BYTE_COUNT 0x16 // 22 Configuration Bytes
|
||||
|
||||
//- Byte 1 (Default Value = 88h)
|
||||
#define CFIG_TXRX_FIFO_LIMIT 0x88
|
||||
|
||||
//- Byte 2 (Default Value = 0)
|
||||
#define CFIG_ADAPTIVE_IFS 0
|
||||
|
||||
//- Byte 3 (Default Value = 0, ALWAYS. This byte is RESERVED)
|
||||
#define CFIG_RESERVED 0
|
||||
|
||||
//- Byte 4 (Default Value = 0. Default implies that Rx DMA cannot be
|
||||
//- preempted).
|
||||
#define CFIG_RXDMA_BYTE_COUNT 0
|
||||
|
||||
//- Byte 5 (Default Value = 80h. Default implies that Tx DMA cannot be
|
||||
//- preempted. However, setting these counters is enabled.)
|
||||
#define CFIG_DMBC_ENABLE 0x80
|
||||
|
||||
//- Byte 6 (Default Value = 33h. Late SCB enabled, No TNO interrupts,
|
||||
//- CNA interrupts and do not save bad frames.)
|
||||
#define CFIG_LATE_SCB 1 // BIT 0
|
||||
#define CFIG_TNO_INTERRUPT 0x4 // BIT 2
|
||||
#define CFIG_CI_INTERRUPT 0x8 // BIT 3
|
||||
#define CFIG_SAVE_BAD_FRAMES 0x80 // BIT_7
|
||||
|
||||
//- Byte 7 (Default Value = 7h. Discard short frames automatically and
|
||||
//- attempt upto 3 retries on transmit.)
|
||||
#define CFIG_DISCARD_SHORTRX 0x00001
|
||||
#define CFIG_URUN_RETRY BIT_1 OR BIT_2
|
||||
|
||||
//- Byte 8 (Default Value = 1. Enable MII mode.)
|
||||
#define CFIG_503_MII BIT_0
|
||||
|
||||
//- Byte 9 (Default Value = 0, ALWAYS)
|
||||
|
||||
//- Byte 10 (Default Value = 2Eh)
|
||||
#define CFIG_NSAI BIT_3
|
||||
#define CFIG_PREAMBLE_LENGTH BIT_5 ;- Bit 5-4 = 1-0
|
||||
#define CFIG_NO_LOOPBACK 0
|
||||
#define CFIG_INTERNAL_LOOPBACK BIT_6
|
||||
#define CFIG_EXT_LOOPBACK BIT_7
|
||||
#define CFIG_EXT_PIN_LOOPBACK BIT_6 OR BIT_7
|
||||
|
||||
//- Byte 11 (Default Value = 0)
|
||||
#define CFIG_LINEAR_PRIORITY 0
|
||||
|
||||
//- Byte 12 (Default Value = 60h)
|
||||
#define CFIG_LPRIORITY_MODE 0
|
||||
#define CFIG_IFS 6 ;- 6 * 16 = 96
|
||||
|
||||
//- Byte 13 (Default Value = 0, ALWAYS)
|
||||
|
||||
//- Byte 14 (Default Value = 0F2h, ALWAYS)
|
||||
|
||||
//- Byte 15 (Default Value = E8h)
|
||||
#define CFIG_PROMISCUOUS_MODE BIT_0
|
||||
#define CFIG_BROADCAST_DISABLE BIT_1
|
||||
#define CFIG_CRS_CDT BIT_7
|
||||
|
||||
//- Byte 16 (Default Value = 0, ALWAYS)
|
||||
|
||||
//- Byte 17 (Default Value = 40h, ALWAYS)
|
||||
|
||||
//- Byte 18 (Default Value = F2h)
|
||||
#define CFIG_STRIPPING BIT_0
|
||||
#define CFIG_PADDING BIT_1
|
||||
#define CFIG_RX_CRC_TRANSFER BIT_2
|
||||
|
||||
//- Byte 19 (Default Value = 80h)
|
||||
#define CFIG_FORCE_FDX BIT_6
|
||||
#define CFIG_FDX_PIN_ENABLE BIT_7
|
||||
|
||||
//- Byte 20 (Default Value = 3Fh)
|
||||
#define CFIG_MULTI_IA BIT_6
|
||||
|
||||
//- Byte 21 (Default Value = 05)
|
||||
#define CFIG_MC_ALL BIT_3
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
#define D102_REVID 0x0b
|
||||
|
||||
#define HALF_DUPLEX 1
|
||||
#define FULL_DUPLEX 2
|
||||
|
||||
typedef struct s_data_instance {
|
||||
|
||||
UINT16 State; // stopped, started or initialized
|
||||
UINT16 Bus;
|
||||
UINT8 Device;
|
||||
UINT8 Function;
|
||||
UINT16 VendorID;
|
||||
UINT16 DeviceID;
|
||||
UINT16 RevID;
|
||||
UINT16 SubVendorID;
|
||||
UINT16 SubSystemID;
|
||||
|
||||
UINT8 PermNodeAddress[PXE_MAC_LENGTH];
|
||||
UINT8 CurrentNodeAddress[PXE_MAC_LENGTH];
|
||||
UINT8 BroadcastNodeAddress[PXE_MAC_LENGTH];
|
||||
UINT32 Config[MAX_PCI_CONFIG_LEN];
|
||||
UINT32 NVData[MAX_EEPROM_LEN];
|
||||
|
||||
UINT32 ioaddr;
|
||||
UINT32 flash_addr;
|
||||
|
||||
UINT16 LinkSpeed; // actual link speed setting
|
||||
UINT16 LinkSpeedReq; // requested (forced) link speed
|
||||
UINT8 DuplexReq; // requested duplex
|
||||
UINT8 Duplex; // Duplex set
|
||||
UINT8 CableDetect; // 1 to detect and 0 not to detect the cable
|
||||
UINT8 LoopBack;
|
||||
|
||||
UINT16 TxBufCnt;
|
||||
UINT16 TxBufSize;
|
||||
UINT16 RxBufCnt;
|
||||
UINT16 RxBufSize;
|
||||
UINT32 RxTotals;
|
||||
UINT32 TxTotals;
|
||||
|
||||
UINT16 int_mask;
|
||||
UINT16 Int_Status;
|
||||
UINT16 PhyRecord[2]; // primary and secondary PHY record registers from eeprom
|
||||
UINT8 PhyAddress;
|
||||
UINT8 int_num;
|
||||
UINT16 NVData_Len;
|
||||
UINT32 MemoryLength;
|
||||
|
||||
RxFD *rx_ring; // array of rx buffers
|
||||
TxCB *tx_ring; // array of tx buffers
|
||||
struct speedo_stats *statistics;
|
||||
TxCB *FreeTxHeadPtr;
|
||||
TxCB *FreeTxTailPtr;
|
||||
RxFD *RFDTailPtr;
|
||||
|
||||
UINT64 rx_phy_addr; // physical addresses
|
||||
UINT64 tx_phy_addr;
|
||||
UINT64 stat_phy_addr;
|
||||
UINT64 MemoryPtr;
|
||||
UINT64 Mapped_MemoryPtr;
|
||||
|
||||
UINT64 xmit_done[TX_BUFFER_COUNT << 1]; // circular buffer
|
||||
UINT16 xmit_done_head; // index into the xmit_done array
|
||||
UINT16 xmit_done_tail; // where are we filling now (index into xmit_done)
|
||||
UINT16 cur_rx_ind; // current RX Q head index
|
||||
UINT16 FreeCBCount;
|
||||
|
||||
BOOLEAN in_interrupt;
|
||||
BOOLEAN in_transmit;
|
||||
BOOLEAN Receive_Started;
|
||||
UINT8 Rx_Filter;
|
||||
UINT8 VersionFlag; // UNDI30 or UNDI31??
|
||||
UINT8 rsvd[3];
|
||||
|
||||
struct mc{
|
||||
UINT16 reserved [3]; // padding for this structure to make it 8 byte aligned
|
||||
UINT16 list_len;
|
||||
UINT8 mc_list[MAX_MCAST_ADDRESS_CNT][PXE_MAC_LENGTH]; // 8*32 is the size
|
||||
} mcast_list;
|
||||
|
||||
UINT64 Unique_ID;
|
||||
|
||||
EFI_PCI_IO_PROTOCOL *Io_Function;
|
||||
|
||||
VOID (*Delay_30)(UINTN); // call back routine
|
||||
VOID (*Virt2Phys_30)(UINT64 virtual_addr, UINT64 physical_ptr); // call back routine
|
||||
VOID (*Block_30)(UINT32 enable); // call back routine
|
||||
VOID (*Mem_Io_30)(UINT8 read_write, UINT8 len, UINT64 port, UINT64 buf_addr);
|
||||
VOID (*Delay)(UINT64, UINTN); // call back routine
|
||||
VOID (*Virt2Phys)(UINT64 unq_id, UINT64 virtual_addr, UINT64 physical_ptr); // call back routine
|
||||
VOID (*Block)(UINT64 unq_id, UINT32 enable); // call back routine
|
||||
VOID (*Mem_Io)(UINT64 unq_id, UINT8 read_write, UINT8 len, UINT64 port,
|
||||
UINT64 buf_addr);
|
||||
VOID (*Map_Mem)(UINT64 unq_id, UINT64 virtual_addr, UINT32 size,
|
||||
UINT32 Direction, UINT64 mapped_addr);
|
||||
VOID (*UnMap_Mem)(UINT64 unq_id, UINT64 virtual_addr, UINT32 size,
|
||||
UINT32 Direction, UINT64 mapped_addr);
|
||||
VOID (*Sync_Mem)(UINT64 unq_id, UINT64 virtual_addr,
|
||||
UINT32 size, UINT32 Direction, UINT64 mapped_addr);
|
||||
} NIC_DATA_INSTANCE;
|
||||
|
||||
#pragma pack(1)
|
||||
struct MC_CB_STRUCT{
|
||||
UINT16 count;
|
||||
UINT8 m_list[MAX_MCAST_ADDRESS_CNT][ETHER_MAC_ADDR_LEN];
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
#define FOUR_GIGABYTE (UINT64)0x100000000ULL
|
1162
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Init.c
Normal file
1162
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Init.c
Normal file
File diff suppressed because it is too large
Load Diff
47
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi.mbd
Normal file
47
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi.mbd
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>Undi</BaseName>
|
||||
<Guid>A1f436EA-A127-4EF8-957C-8048606FF670</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Modified>2006-03-19 15:18</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>BaseMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibNull</Library>
|
||||
<Library>BasePrintLib</Library>
|
||||
<Library>EdkDxeRuntimeDriverLib</Library>
|
||||
<Library>UefiDriverModelLib</Library>
|
||||
<Library>DxeHobLib</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
<Arch ArchType="IPF">
|
||||
<Library>EdkDxeSalLib</Library>
|
||||
</Arch>
|
||||
</Libraries>
|
||||
</ModuleBuildDescription>
|
92
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi.msa
Normal file
92
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi.msa
Normal file
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>Undi</BaseName>
|
||||
<ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
|
||||
<ComponentType>RT_DRIVER</ComponentType>
|
||||
<Guid>A1f436EA-A127-4EF8-957C-8048606FF670</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for DiskIo module.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>0</Specification>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Updated>2006-03-19 15:18</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverModelLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DxeRuntimeDriverLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">HobLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>Init.c</Filename>
|
||||
<Filename>Decode.c</Filename>
|
||||
<Filename>E100b.c</Filename>
|
||||
<Filename>E100b.h</Filename>
|
||||
<Filename>Undi32.h</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="TO_START">DevicePath</Protocol>
|
||||
<Protocol Usage="TO_START">PciIo</Protocol>
|
||||
<Protocol Usage="BY_START">NetworkInterfaceIdentifier</Protocol>
|
||||
<Protocol Usage="BY_START">NetworkInterfaceIdentifier31</Protocol>
|
||||
</Protocols>
|
||||
<Events>
|
||||
<CreateEvents>
|
||||
<Event Usage="ALWAYS_CONSUMED" EventGroup="EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE">
|
||||
<C_Name>gEfiEventVirtualAddressChangeGuid</C_Name>
|
||||
<Guid>0x13fa7698, 0xc831, 0x49c7, 0x87, 0xea, 0x8f, 0x43, 0xfc, 0xc2, 0x51, 0x96</Guid>
|
||||
</Event>
|
||||
<Event Usage="ALWAYS_CONSUMED" EventGroup="EVENT_GROUP_EXIT_BOOT_SERVICES">
|
||||
<C_Name>gEfiEventExitBootServicesGuid</C_Name>
|
||||
<Guid>0x27abf055, 0xb1b8, 0x4c26, 0x80, 0x48, 0x74, 0x8f, 0x37, 0xba, 0xa2, 0xdf</Guid>
|
||||
</Event>
|
||||
</CreateEvents>
|
||||
</Events>
|
||||
<SystemTables>
|
||||
<SystemTable Usage="SOMETIMES_PRODUCED">
|
||||
<Entry>gEfiNetworkInterfaceIdentifierProtocolGuid_31</Entry>
|
||||
</SystemTable>
|
||||
</SystemTables>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>InitializeUNDIDriver</ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gUndiDriverBinding</DriverBinding>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<SetVirtualAddressMapCallBack>UndiNotifyVirtual</SetVirtualAddressMapCallBack>
|
||||
<ExitBootServicesCallBack></ExitBootServicesCallBack>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
208
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi32.h
Normal file
208
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi32.h
Normal file
@ -0,0 +1,208 @@
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 2004, Intel Corporation
|
||||
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:
|
||||
|
||||
undi32.h
|
||||
|
||||
Abstract:
|
||||
|
||||
EFI internal structures for the EFI UNDI driver
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _UNDI_32_H_
|
||||
#define _UNDI_32_H_
|
||||
|
||||
|
||||
#include "E100b.h"
|
||||
#include <IndustryStandard\pci22.h>
|
||||
|
||||
#define MAX_NIC_INTERFACES 16
|
||||
|
||||
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION_31 0x00010001
|
||||
#define PXE_ROMID_MINORVER_31 0x10
|
||||
#define PXE_STATFLAGS_DB_WRITE_TRUNCATED 0x2000
|
||||
|
||||
//
|
||||
// UNDI_CALL_TABLE.state can have the following values
|
||||
//
|
||||
#define DONT_CHECK -1
|
||||
#define ANY_STATE -1
|
||||
#define MUST_BE_STARTED 1
|
||||
#define MUST_BE_INITIALIZED 2
|
||||
|
||||
#define UNDI_DEV_SIGNATURE EFI_SIGNATURE_32('u','n','d','i')
|
||||
#define UNDI_DEV_FROM_THIS(a) CR(a, UNDI32_DEV, NIIProtocol, UNDI_DEV_SIGNATURE)
|
||||
#define UNDI_DEV_FROM_NIC(a) CR(a, UNDI32_DEV, NicInfo, UNDI_DEV_SIGNATURE)
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol;
|
||||
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol_31;
|
||||
EFI_HANDLE DeviceHandle;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Undi32BaseDevPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Undi32DevPath;
|
||||
NIC_DATA_INSTANCE NicInfo;
|
||||
} UNDI32_DEV;
|
||||
|
||||
typedef struct {
|
||||
UINT16 cpbsize;
|
||||
UINT16 dbsize;
|
||||
UINT16 opflags;
|
||||
UINT16 state;
|
||||
VOID (*api_ptr)();
|
||||
} UNDI_CALL_TABLE;
|
||||
|
||||
typedef struct {
|
||||
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *InterfacePointer;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathPointer;
|
||||
} NII_ENTRY;
|
||||
|
||||
typedef struct NII_CONFIG_ENTRY {
|
||||
UINT32 NumEntries;
|
||||
UINT32 Reserved; // padding for alignment
|
||||
struct NII_CONFIG_ENTRY *NextLink;
|
||||
NII_ENTRY NiiEntry[1];
|
||||
} NII_TABLE;
|
||||
|
||||
typedef VOID (*ptr)(VOID);
|
||||
typedef VOID (*bsptr_30)(UINTN);
|
||||
typedef VOID (*virtphys_30)(UINT64, UINT64);
|
||||
typedef VOID (*block_30)(UINT32);
|
||||
typedef VOID (*mem_io_30)(UINT8, UINT8, UINT64, UINT64);
|
||||
|
||||
typedef VOID (*bsptr)(UINT64, UINTN);
|
||||
typedef VOID (*virtphys)(UINT64, UINT64, UINT64);
|
||||
typedef VOID (*block)(UINT64, UINT32);
|
||||
typedef VOID (*mem_io)(UINT64, UINT8, UINT8, UINT64, UINT64);
|
||||
|
||||
typedef VOID (*map_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
|
||||
typedef VOID (*unmap_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
|
||||
typedef VOID (*sync_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
|
||||
|
||||
//
|
||||
// functions defined in e100b.c
|
||||
//
|
||||
UINT8 InByte (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);
|
||||
UINT16 InWord (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);
|
||||
UINT32 InLong (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);
|
||||
VOID OutByte (NIC_DATA_INSTANCE *AdapterInfo, UINT8 Data, UINT32 Port);
|
||||
VOID OutWord (NIC_DATA_INSTANCE *AdapterInfo, UINT16 Data, UINT32 Port);
|
||||
VOID OutLong (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Data, UINT32 Port);
|
||||
|
||||
UINTN E100bInit (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
UINTN E100bReset (NIC_DATA_INSTANCE *AdapterInfo, INT32 OpFlags);
|
||||
UINTN E100bShutdown (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
UINTN E100bTransmit (NIC_DATA_INSTANCE *AdapterInfo, UINT64 cpb, UINT16 opflags);
|
||||
UINTN E100bReceive (NIC_DATA_INSTANCE *AdapterInfo, UINT64 cpb, UINT64 db);
|
||||
UINTN E100bSetfilter (NIC_DATA_INSTANCE *AdapterInfo, UINT16 New_filter,
|
||||
UINT64 cpb, UINT32 cpbsize);
|
||||
UINTN E100bStatistics(NIC_DATA_INSTANCE *AdapterInfo, UINT64 db, UINT16 dbsize);
|
||||
UINT8 E100bSetupIAAddr (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
UINT8 E100bSetInterruptState (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
|
||||
UINT8 E100bGetEepromAddrLen (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
UINT16 E100bReadEeprom (NIC_DATA_INSTANCE *AdapterInfo, INT32 Location, UINT8 address_len);
|
||||
INT16 E100bReadEepromAndStationAddress (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
|
||||
UINT16 next(UINT16);
|
||||
UINT8 SetupCBlink (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
VOID SetFreeCB (NIC_DATA_INSTANCE *AdapterInfo,TxCB *);
|
||||
TxCB *GetFreeCB (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
UINT16 CheckCBList (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
|
||||
UINT8 SelectiveReset (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
UINT16 InitializeChip (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
UINT8 SetupReceiveQueues (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
VOID Recycle_RFD (NIC_DATA_INSTANCE *AdapterInfo, UINT16);
|
||||
VOID XmitWaitForCompletion (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
INT8 CommandWaitForCompletion (TxCB *cmd_ptr, NIC_DATA_INSTANCE *AdapterInfo);
|
||||
|
||||
BOOLEAN PhyDetect (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
VOID PhyReset (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
VOID
|
||||
MdiWrite (
|
||||
IN NIC_DATA_INSTANCE *AdapterInfo,
|
||||
IN UINT8 RegAddress,
|
||||
IN UINT8 PhyAddress,
|
||||
IN UINT16 DataValue
|
||||
);
|
||||
|
||||
VOID
|
||||
MdiRead(
|
||||
IN NIC_DATA_INSTANCE *AdapterInfo,
|
||||
IN UINT8 RegAddress,
|
||||
IN UINT8 PhyAddress,
|
||||
IN OUT UINT16 *DataValue
|
||||
);
|
||||
|
||||
BOOLEAN SetupPhy (NIC_DATA_INSTANCE *AdapterInfo);
|
||||
VOID FindPhySpeedAndDpx (NIC_DATA_INSTANCE *AdapterInfo, UINT32 PhyId);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// functions defined in init.c
|
||||
//
|
||||
VOID
|
||||
TmpDelay (
|
||||
IN UINT64 UnqId,
|
||||
IN UINTN MicroSeconds
|
||||
);
|
||||
|
||||
VOID
|
||||
TmpMemIo (
|
||||
IN UINT64 UnqId,
|
||||
IN UINT8 ReadWrite,
|
||||
IN UINT8 Len,
|
||||
IN UINT64 Port,
|
||||
IN UINT64 BufAddr
|
||||
);
|
||||
|
||||
//
|
||||
// functions defined in decode.c
|
||||
//
|
||||
VOID UNDI_GetState();
|
||||
VOID UNDI_Start();
|
||||
VOID UNDI_Stop();
|
||||
VOID UNDI_GetInitInfo();
|
||||
VOID UNDI_GetConfigInfo();
|
||||
VOID UNDI_Initialize();
|
||||
VOID UNDI_Reset();
|
||||
VOID UNDI_Shutdown();
|
||||
VOID UNDI_Interrupt();
|
||||
VOID UNDI_RecFilter();
|
||||
VOID UNDI_StnAddr();
|
||||
VOID UNDI_Statistics();
|
||||
VOID UNDI_ip2mac();
|
||||
VOID UNDI_NVData();
|
||||
VOID UNDI_Status();
|
||||
VOID UNDI_FillHeader();
|
||||
VOID UNDI_Transmit();
|
||||
VOID UNDI_Receive();
|
||||
|
||||
VOID UNDI_APIEntry_new(UINT64);
|
||||
VOID UNDI_APIEntry_old(UINT64);
|
||||
VOID UNDI_APIEntry_Common(UINT64);
|
||||
|
||||
PXE_IPV4 convert_mcip(PXE_MAC_ADDR *);
|
||||
INT32 validate_mcip (PXE_MAC_ADDR *MCastAddr);
|
||||
|
||||
VOID PxeStructInit (PXE_SW_UNDI *PxePtr, UINTN VersionFlag);
|
||||
VOID PxeUpdate (NIC_DATA_INSTANCE *NicPtr, PXE_SW_UNDI *PxePtr);
|
||||
|
||||
#endif
|
47
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/build.xml
Normal file
47
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/build.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
|
||||
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.-->
|
||||
<project basedir="." default="Undi"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Bus\Pci\Undi\RuntimeDxe"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="Undi">
|
||||
<GenBuild baseName="Undi" mbdFilename="${MODULE_DIR}\Undi.mbd" msaFilename="${MODULE_DIR}\Undi.msa"/>
|
||||
</target>
|
||||
<target depends="Undi_clean" name="clean"/>
|
||||
<target depends="Undi_cleanall" name="cleanall"/>
|
||||
<target name="Undi_clean">
|
||||
<OutputDirSetup baseName="Undi" mbdFilename="${MODULE_DIR}\Undi.mbd" msaFilename="${MODULE_DIR}\Undi.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\Undi_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\Undi_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="Undi_cleanall">
|
||||
<OutputDirSetup baseName="Undi" mbdFilename="${MODULE_DIR}\Undi.mbd" msaFilename="${MODULE_DIR}\Undi.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\Undi_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\Undi_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**Undi*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
155
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ComponentName.c
Normal file
155
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ComponentName.c
Normal file
@ -0,0 +1,155 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
ComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include "ScsiBus.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiBusComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiBusComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName = {
|
||||
ScsiBusComponentNameGetDriverName,
|
||||
ScsiBusComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
static EFI_UNICODE_STRING_TABLE mScsiBusDriverNameTable[] = {
|
||||
{ "eng", (CHAR16 *) L"SCSI Bus Driver" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiBusComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
Language - A pointer to a three character ISO 639-2 language identifier.
|
||||
This is the language of the driver name that that the caller
|
||||
is requesting, and it must match one of the languages specified
|
||||
in SupportedLanguages. The number of languages supported by a
|
||||
driver is up to the driver writer.
|
||||
DriverName - A pointer to the Unicode string to return. This Unicode string
|
||||
is the name of the driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the Driver specified by This
|
||||
and the language specified by Language was returned
|
||||
in DriverName.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - DriverName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gScsiBusComponentName.SupportedLanguages,
|
||||
mScsiBusDriverNameTable,
|
||||
DriverName
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiBusComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
ControllerHandle - The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
ChildHandle - The handle of the child controller to retrieve the name
|
||||
of. This is an optional parameter that may be NULL. It
|
||||
will be NULL for device drivers. It will also be NULL
|
||||
for a bus drivers that wish to retrieve the name of the
|
||||
bus controller. It will not be NULL for a bus driver
|
||||
that wishes to retrieve the name of a child controller.
|
||||
Language - A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that that the caller is requesting, and it must match one
|
||||
of the languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up to the
|
||||
driver writer.
|
||||
ControllerName - A pointer to the Unicode string to return. This Unicode
|
||||
string is the name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the language
|
||||
specified by Language from the point of view of the
|
||||
driver specified by This.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the user readable name in the
|
||||
language specified by Language for the driver
|
||||
specified by This was returned in DriverName.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - ControllerName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
751
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.c
Normal file
751
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.c
Normal file
@ -0,0 +1,751 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
scsibus.c
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Revision History
|
||||
--*/
|
||||
|
||||
#include "scsibus.h"
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SCSIBusDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SCSIBusDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SCSIBusDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gSCSIBusDriverBinding = {
|
||||
SCSIBusDriverBindingSupported,
|
||||
SCSIBusDriverBindingStart,
|
||||
SCSIBusDriverBindingStop,
|
||||
0x10,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SCSIBusDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: Controller - add argument and description to function comment
|
||||
// TODO: RemainingDevicePath - add argument and description to function comment
|
||||
// TODO: EFI_UNSUPPORTED - add return value to function comment
|
||||
// TODO: EFI_UNSUPPORTED - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// If RemainingDevicePath is not NULL, it should verify that the first device
|
||||
// path node in RemainingDevicePath is an ATAPI Device path node.
|
||||
//
|
||||
if (RemainingDevicePath != NULL) {
|
||||
if ((RemainingDevicePath->Type != MESSAGING_DEVICE_PATH) ||
|
||||
(RemainingDevicePath->SubType != MSG_ATAPI_DP) ||
|
||||
(DevicePathNodeLength (RemainingDevicePath) != sizeof(ATAPI_DEVICE_PATH))) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
//
|
||||
// check for the existence of SCSI Pass Thru Protocol
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiScsiPassThruProtocolGuid,
|
||||
NULL,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SCSIBusDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: Controller - add argument and description to function comment
|
||||
// TODO: RemainingDevicePath - add argument and description to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru;
|
||||
UINT32 StartPun;
|
||||
UINT64 StartLun;
|
||||
UINT32 Pun;
|
||||
UINT64 Lun;
|
||||
BOOLEAN ScanOtherPuns;
|
||||
|
||||
StartPun = 0;
|
||||
StartLun = 0;
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &ParentDevicePath,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Consume SCSI Pass Thru protocol.
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiScsiPassThruProtocolGuid,
|
||||
(VOID **) &ScsiPassThru,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (RemainingDevicePath == NULL) {
|
||||
StartPun = 0xFFFFFFFF;
|
||||
StartLun = 0;
|
||||
} else {
|
||||
ScsiPassThru->GetTargetLun (ScsiPassThru, RemainingDevicePath, &StartPun, &StartLun);
|
||||
}
|
||||
|
||||
for (Pun = StartPun, ScanOtherPuns = TRUE; ScanOtherPuns;) {
|
||||
|
||||
if (StartPun == 0xFFFFFFFF) {
|
||||
//
|
||||
// Remaining Device Path is NULL, scan all the possible Puns in the
|
||||
// SCSI Channel.
|
||||
//
|
||||
Status = ScsiPassThru->GetNextDevice (ScsiPassThru, &Pun, &Lun);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// no legal Pun and Lun found any more
|
||||
//
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Remaining Device Path is not NULL, only scan the specified Pun.
|
||||
//
|
||||
Pun = StartPun;
|
||||
Lun = StartLun;
|
||||
ScanOtherPuns = FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// Avoid creating handle for the host adapter.
|
||||
//
|
||||
if (Pun == ScsiPassThru->Mode->AdapterId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Scan for the scsi device, if it attaches to the scsi bus,
|
||||
// then create handle and install scsi i/o protocol.
|
||||
//
|
||||
Status = ScsiScanCreateDevice (This, Controller, Pun, Lun, ScsiPassThru, ParentDevicePath);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SCSIBusDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: Controller - add argument and description to function comment
|
||||
// TODO: NumberOfChildren - add argument and description to function comment
|
||||
// TODO: ChildHandleBuffer - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_DEVICE_ERROR - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN AllChildrenStopped;
|
||||
UINTN Index;
|
||||
EFI_SCSI_IO_PROTOCOL *ScsiIo;
|
||||
SCSI_IO_DEV *ScsiIoDevice;
|
||||
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru;
|
||||
|
||||
if (NumberOfChildren == 0) {
|
||||
//
|
||||
// Close the bus driver
|
||||
//
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiScsiPassThruProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
AllChildrenStopped = TRUE;
|
||||
|
||||
for (Index = 0; Index < NumberOfChildren; Index++) {
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandleBuffer[Index],
|
||||
&gEfiScsiIoProtocolGuid,
|
||||
(VOID **) &ScsiIo,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
AllChildrenStopped = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (ScsiIo);
|
||||
//
|
||||
// Close the child handle
|
||||
//
|
||||
Status = gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiScsiPassThruProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ChildHandleBuffer[Index]
|
||||
);
|
||||
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
ChildHandleBuffer[Index],
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
ScsiIoDevice->DevicePath,
|
||||
&gEfiScsiIoProtocolGuid,
|
||||
&ScsiIoDevice->ScsiIo,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
AllChildrenStopped = FALSE;
|
||||
gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiScsiPassThruProtocolGuid,
|
||||
(VOID **) &ScsiPassThru,
|
||||
This->DriverBindingHandle,
|
||||
ChildHandleBuffer[Index],
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
} else {
|
||||
gBS->FreePool (ScsiIoDevice);
|
||||
}
|
||||
}
|
||||
|
||||
if (!AllChildrenStopped) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiGetDeviceType (
|
||||
IN EFI_SCSI_IO_PROTOCOL *This,
|
||||
OUT UINT8 *DeviceType
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves the device type information of the SCSI Controller.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
DeviceType - A pointer to the device type information
|
||||
retrieved from the SCSI Controller.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Retrieves the device type information successfully.
|
||||
EFI_INVALID_PARAMETER - The DeviceType is NULL.
|
||||
--*/
|
||||
{
|
||||
SCSI_IO_DEV *ScsiIoDevice;
|
||||
|
||||
if (DeviceType == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
|
||||
*DeviceType = ScsiIoDevice->ScsiDeviceType;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiGetDeviceLocation (
|
||||
IN EFI_SCSI_IO_PROTOCOL *This,
|
||||
OUT UINT8 **Target,
|
||||
OUT UINT64 *Lun
|
||||
)
|
||||
/*++
|
||||
Routine Description:
|
||||
Retrieves the device location in the SCSI channel.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
Target - A pointer to the Target ID of a SCSI device
|
||||
on the SCSI channel.
|
||||
Lun - A pointer to the LUN of the SCSI device on
|
||||
the SCSI channel.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Retrieves the device location successfully.
|
||||
EFI_INVALID_PARAMETER - The Target or Lun is NULL.
|
||||
--*/
|
||||
{
|
||||
SCSI_IO_DEV *ScsiIoDevice;
|
||||
|
||||
if (Target == NULL || Lun == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
|
||||
|
||||
*Target = (UINT8 *) (UINTN) ScsiIoDevice->Pun;
|
||||
*Lun = ScsiIoDevice->Lun;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiResetBus (
|
||||
IN EFI_SCSI_IO_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Resets the SCSI Bus that the SCSI Controller is attached to.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The SCSI bus is reset successfully.
|
||||
EFI_DEVICE_ERROR - Errors encountered when resetting the SCSI bus.
|
||||
EFI_UNSUPPORTED - The bus reset operation is not supported by the
|
||||
SCSI Host Controller.
|
||||
EFI_TIMEOUT - A timeout occurred while attempting to reset
|
||||
the SCSI bus.
|
||||
--*/
|
||||
{
|
||||
SCSI_IO_DEV *ScsiIoDevice;
|
||||
|
||||
ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
|
||||
|
||||
return ScsiIoDevice->ScsiPassThru->ResetChannel (ScsiIoDevice->ScsiPassThru);
|
||||
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiResetDevice (
|
||||
IN EFI_SCSI_IO_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Resets the SCSI Controller that the device handle specifies.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Reset the SCSI controller successfully.
|
||||
EFI_DEVICE_ERROR - Errors are encountered when resetting the
|
||||
SCSI Controller.
|
||||
EFI_UNSUPPORTED - The SCSI bus does not support a device
|
||||
reset operation.
|
||||
EFI_TIMEOUT - A timeout occurred while attempting to
|
||||
reset the SCSI Controller.
|
||||
--*/
|
||||
{
|
||||
SCSI_IO_DEV *ScsiIoDevice;
|
||||
|
||||
ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
|
||||
|
||||
return ScsiIoDevice->ScsiPassThru->ResetTarget (
|
||||
ScsiIoDevice->ScsiPassThru,
|
||||
ScsiIoDevice->Pun,
|
||||
ScsiIoDevice->Lun
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiExecuteSCSICommand (
|
||||
IN EFI_SCSI_IO_PROTOCOL *This,
|
||||
IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,
|
||||
IN EFI_EVENT Event OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Sends a SCSI Request Packet to the SCSI Controller for execution.
|
||||
|
||||
Arguments:
|
||||
This - Protocol instance pointer.
|
||||
Packet - The SCSI request packet to send to the SCSI
|
||||
Controller specified by the device handle.
|
||||
Event - If the SCSI bus where the SCSI device is attached
|
||||
does not support non-blocking I/O, then Event is
|
||||
ignored, and blocking I/O is performed.
|
||||
If Event is NULL, then blocking I/O is performed.
|
||||
If Event is not NULL and non-blocking I/O is
|
||||
supported, then non-blocking I/O is performed,
|
||||
and Event will be signaled when the SCSI Request
|
||||
Packet completes.
|
||||
Returns:
|
||||
EFI_SUCCESS - The SCSI Request Packet was sent by the host
|
||||
successfully, and TransferLength bytes were
|
||||
transferred to/from DataBuffer.See
|
||||
HostAdapterStatus, TargetStatus,
|
||||
SenseDataLength, and SenseData in that order
|
||||
for additional status information.
|
||||
EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
|
||||
but the entire DataBuffer could not be transferred.
|
||||
The actual number of bytes transferred is returned
|
||||
in TransferLength. See HostAdapterStatus,
|
||||
TargetStatus, SenseDataLength, and SenseData in
|
||||
that order for additional status information.
|
||||
EFI_NOT_READY - The SCSI Request Packet could not be sent because
|
||||
there are too many SCSI Command Packets already
|
||||
queued.The caller may retry again later.
|
||||
EFI_DEVICE_ERROR - A device error occurred while attempting to send
|
||||
the SCSI Request Packet. See HostAdapterStatus,
|
||||
TargetStatus, SenseDataLength, and SenseData in
|
||||
that order for additional status information.
|
||||
EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
|
||||
The SCSI Request Packet was not sent, so no
|
||||
additional status information is available.
|
||||
EFI_UNSUPPORTED - The command described by the SCSI Request Packet
|
||||
is not supported by the SCSI initiator(i.e., SCSI
|
||||
Host Controller). The SCSI Request Packet was not
|
||||
sent, so no additional status information is
|
||||
available.
|
||||
EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
|
||||
Request Packet to execute. See HostAdapterStatus,
|
||||
TargetStatus, SenseDataLength, and SenseData in
|
||||
that order for additional status information.
|
||||
--*/
|
||||
{
|
||||
SCSI_IO_DEV *ScsiIoDevice;
|
||||
EFI_STATUS Status;
|
||||
|
||||
EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *RequestPacket;
|
||||
|
||||
if (Packet == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
|
||||
|
||||
RequestPacket = (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *) Packet;
|
||||
|
||||
Status = ScsiIoDevice->ScsiPassThru->PassThru (
|
||||
ScsiIoDevice->ScsiPassThru,
|
||||
ScsiIoDevice->Pun,
|
||||
ScsiIoDevice->Lun,
|
||||
RequestPacket,
|
||||
Event
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ScsiScanCreateDevice (
|
||||
EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
EFI_HANDLE Controller,
|
||||
UINT32 Pun,
|
||||
UINT64 Lun,
|
||||
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru,
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Controller - TODO: add argument description
|
||||
Pun - TODO: add argument description
|
||||
Lun - TODO: add argument description
|
||||
ScsiPassThru - TODO: add argument description
|
||||
ParentDevicePath - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - TODO: Add description for return value
|
||||
EFI_OUT_OF_RESOURCES - TODO: Add description for return value
|
||||
EFI_SUCCESS - TODO: Add description for return value
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
SCSI_IO_DEV *ScsiIoDevice;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ScsiDevicePath;
|
||||
|
||||
Status = gBS->AllocatePool (
|
||||
EfiBootServicesData,
|
||||
sizeof (SCSI_IO_DEV),
|
||||
(VOID **) &ScsiIoDevice
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
ZeroMem (ScsiIoDevice, sizeof (SCSI_IO_DEV));
|
||||
|
||||
ScsiIoDevice->Signature = SCSI_IO_DEV_SIGNATURE;
|
||||
ScsiIoDevice->ScsiPassThru = ScsiPassThru;
|
||||
ScsiIoDevice->Pun = Pun;
|
||||
ScsiIoDevice->Lun = Lun;
|
||||
|
||||
ScsiIoDevice->ScsiIo.GetDeviceType = ScsiGetDeviceType;
|
||||
ScsiIoDevice->ScsiIo.GetDeviceLocation = ScsiGetDeviceLocation;
|
||||
ScsiIoDevice->ScsiIo.ResetBus = ScsiResetBus;
|
||||
ScsiIoDevice->ScsiIo.ResetDevice = ScsiResetDevice;
|
||||
ScsiIoDevice->ScsiIo.ExecuteSCSICommand = ScsiExecuteSCSICommand;
|
||||
|
||||
if (!DiscoverScsiDevice (ScsiIoDevice)) {
|
||||
gBS->FreePool (ScsiIoDevice);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Set Device Path
|
||||
//
|
||||
Status = ScsiIoDevice->ScsiPassThru->BuildDevicePath (
|
||||
ScsiIoDevice->ScsiPassThru,
|
||||
ScsiIoDevice->Pun,
|
||||
ScsiIoDevice->Lun,
|
||||
&ScsiDevicePath
|
||||
);
|
||||
if (Status == EFI_OUT_OF_RESOURCES) {
|
||||
gBS->FreePool (ScsiIoDevice);
|
||||
return Status;
|
||||
}
|
||||
|
||||
ScsiIoDevice->DevicePath = AppendDevicePathNode (
|
||||
ParentDevicePath,
|
||||
ScsiDevicePath
|
||||
);
|
||||
//
|
||||
// The memory space for ScsiDevicePath is allocated in
|
||||
// ScsiPassThru->BuildDevicePath() function; It is no longer used
|
||||
// after EfiAppendDevicePathNode,so free the memory it occupies.
|
||||
//
|
||||
gBS->FreePool (ScsiDevicePath);
|
||||
|
||||
if (ScsiIoDevice->DevicePath == NULL) {
|
||||
gBS->FreePool (ScsiIoDevice);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&ScsiIoDevice->Handle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
ScsiIoDevice->DevicePath,
|
||||
&gEfiScsiIoProtocolGuid,
|
||||
&ScsiIoDevice->ScsiIo,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (ScsiIoDevice);
|
||||
} else {
|
||||
gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiScsiPassThruProtocolGuid,
|
||||
(VOID **) &ScsiPassThru,
|
||||
This->DriverBindingHandle,
|
||||
ScsiIoDevice->Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
DiscoverScsiDevice (
|
||||
SCSI_IO_DEV *ScsiIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ScsiIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SCSI_INQUIRY_DATA InquiryData;
|
||||
UINT32 InquiryDataLength;
|
||||
EFI_SCSI_SENSE_DATA SenseData;
|
||||
UINT8 SenseDataLength;
|
||||
UINT8 HostAdapterStatus;
|
||||
UINT8 TargetStatus;
|
||||
|
||||
HostAdapterStatus = 0;
|
||||
TargetStatus = 0;
|
||||
//
|
||||
// Using Inquiry command to scan for the device
|
||||
//
|
||||
InquiryDataLength = sizeof (EFI_SCSI_INQUIRY_DATA);
|
||||
SenseDataLength = sizeof (EFI_SCSI_SENSE_DATA);
|
||||
|
||||
Status = SubmitInquiryCommand (
|
||||
&ScsiIoDevice->ScsiIo,
|
||||
EfiScsiStallSeconds (1),
|
||||
(VOID *) &SenseData,
|
||||
&SenseDataLength,
|
||||
&HostAdapterStatus,
|
||||
&TargetStatus,
|
||||
(VOID *) &InquiryData,
|
||||
&InquiryDataLength,
|
||||
FALSE
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// ParseSenseData (&SenseData,SenseDataLength);
|
||||
//
|
||||
return FALSE;
|
||||
}
|
||||
//
|
||||
// Retrieved inquiry data successfully
|
||||
//
|
||||
if ((InquiryData.Peripheral_Qualifier != 0) &&
|
||||
(InquiryData.Peripheral_Qualifier != 3)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (InquiryData.Peripheral_Qualifier == 3) {
|
||||
if (InquiryData.Peripheral_Type != 0x1f) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((0x1e >= InquiryData.Peripheral_Type) && (InquiryData.Peripheral_Type >= 0xa)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// valid device type and peripheral qualifier combination.
|
||||
//
|
||||
ScsiIoDevice->ScsiDeviceType = InquiryData.Peripheral_Type;
|
||||
ScsiIoDevice->RemovableDevice = InquiryData.RMB;
|
||||
if (InquiryData.Version == 0) {
|
||||
ScsiIoDevice->ScsiVersion = 0;
|
||||
} else {
|
||||
//
|
||||
// ANSI-approved version
|
||||
//
|
||||
ScsiIoDevice->ScsiVersion = (UINT8) (InquiryData.Version & 0x03);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
266
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.h
Normal file
266
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.h
Normal file
@ -0,0 +1,266 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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:
|
||||
|
||||
scsibus.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Header file for SCSI Bus Driver.
|
||||
|
||||
Revision History
|
||||
++*/
|
||||
|
||||
// TODO: fix comment to end with --*/
|
||||
#ifndef _SCSI_BUS_H
|
||||
#define _SCSI_BUS_H
|
||||
|
||||
|
||||
#include <IndustryStandard/scsi.h>
|
||||
//
|
||||
// 1000 * 1000 * 10
|
||||
//
|
||||
#define ONE_SECOND_TIMER 10000000
|
||||
|
||||
#define SCSI_IO_DEV_SIGNATURE EFI_SIGNATURE_32 ('s', 'c', 'i', 'o')
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
|
||||
EFI_HANDLE Handle;
|
||||
EFI_SCSI_IO_PROTOCOL ScsiIo;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru;
|
||||
|
||||
UINT32 Pun;
|
||||
UINT64 Lun;
|
||||
UINT8 ScsiDeviceType;
|
||||
UINT8 ScsiVersion;
|
||||
BOOLEAN RemovableDevice;
|
||||
} SCSI_IO_DEV;
|
||||
|
||||
#define SCSI_IO_DEV_FROM_THIS(a) CR (a, SCSI_IO_DEV, ScsiIo, SCSI_IO_DEV_SIGNATURE)
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gScsiBusDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiGetDeviceType (
|
||||
IN EFI_SCSI_IO_PROTOCOL *This,
|
||||
OUT UINT8 *DeviceType
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
DeviceType - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiResetBus (
|
||||
IN EFI_SCSI_IO_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiResetDevice (
|
||||
IN EFI_SCSI_IO_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ScsiExecuteSCSICommand (
|
||||
IN EFI_SCSI_IO_PROTOCOL *This,
|
||||
IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket,
|
||||
IN EFI_EVENT Event
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
CommandPacket - TODO: add argument description
|
||||
Event - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ScsiScanCreateDevice (
|
||||
EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
EFI_HANDLE Controller,
|
||||
UINT32 Pun,
|
||||
UINT64 Lun,
|
||||
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru,
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Controller - TODO: add argument description
|
||||
Pun - TODO: add argument description
|
||||
Lun - TODO: add argument description
|
||||
ScsiPassThru - TODO: add argument description
|
||||
ParentDevicePath - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
DiscoverScsiDevice (
|
||||
SCSI_IO_DEV *ScsiIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ScsiIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetLunList (
|
||||
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru,
|
||||
UINT32 Target,
|
||||
UINT64 **LunArray,
|
||||
UINTN *NumberOfLuns
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ScsiPassThru - TODO: add argument description
|
||||
Target - TODO: add argument description
|
||||
LunArray - TODO: add argument description
|
||||
NumberOfLuns - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ScsiBusSubmitReportLunCommand (
|
||||
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru,
|
||||
UINT32 Target,
|
||||
UINTN AllocationLength,
|
||||
VOID *Buffer,
|
||||
EFI_SCSI_SENSE_DATA *SenseData,
|
||||
UINT8 *SenseDataLength,
|
||||
UINT8 *HostAdapterStatus,
|
||||
UINT8 *TargetStatus
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ScsiPassThru - TODO: add argument description
|
||||
Target - TODO: add argument description
|
||||
AllocationLength - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
SenseData - TODO: add argument description
|
||||
SenseDataLength - TODO: add argument description
|
||||
HostAdapterStatus - TODO: add argument description
|
||||
TargetStatus - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
#endif
|
44
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.mbd
Normal file
44
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.mbd
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>ScsiBus</BaseName>
|
||||
<Guid>0167CCC4-D0F7-4f21-A3EF-9E64B7CDCE8B</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Modified>2006-03-19 15:18</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>UefiDriverModelLib</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>EdkDxePrintLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>EdkScsiLib</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
<Library>UefiDevicePathLib</Library>
|
||||
</Libraries>
|
||||
</ModuleBuildDescription>
|
68
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.msa
Normal file
68
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.msa
Normal file
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>ScsiBus</BaseName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>0167CCC4-D0F7-4f21-A3EF-9E64B7CDCE8B</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for Scsi Bus module.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, Intel Corporation</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>0</Specification>
|
||||
<Created>2006-03-12 17:09</Created>
|
||||
<Updated>2006-03-19 15:18</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverModelLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">EdkScsiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DevicePathLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>ScsiBus.h</Filename>
|
||||
<Filename>ScsiBus.c</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="TO_START">ScsiPassThru</Protocol>
|
||||
<Protocol Usage="TO_START">DevicePath</Protocol>
|
||||
<Protocol Usage="BY_START">ScsiIo</Protocol>
|
||||
</Protocols>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint></ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gSCSIBusDriverBinding</DriverBinding>
|
||||
<ComponentName>gScsiBusComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
47
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/build.xml
Normal file
47
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/build.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
|
||||
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.-->
|
||||
<project basedir="." default="ScsiBus"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Bus\Scsi\ScsiBus\Dxe"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="ScsiBus">
|
||||
<GenBuild baseName="ScsiBus" mbdFilename="${MODULE_DIR}\ScsiBus.mbd" msaFilename="${MODULE_DIR}\ScsiBus.msa"/>
|
||||
</target>
|
||||
<target depends="ScsiBus_clean" name="clean"/>
|
||||
<target depends="ScsiBus_cleanall" name="cleanall"/>
|
||||
<target name="ScsiBus_clean">
|
||||
<OutputDirSetup baseName="ScsiBus" mbdFilename="${MODULE_DIR}\ScsiBus.mbd" msaFilename="${MODULE_DIR}\ScsiBus.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\ScsiBus_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\ScsiBus_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="ScsiBus_cleanall">
|
||||
<OutputDirSetup baseName="ScsiBus" mbdFilename="${MODULE_DIR}\ScsiBus.mbd" msaFilename="${MODULE_DIR}\ScsiBus.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\ScsiBus_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\ScsiBus_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**ScsiBus*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user