/** @file
Produces the SMM CPU I/O Protocol.
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "CpuIo2Smm.h"
//
// Handle for the SMM CPU I/O Protocol
//
//
// SMM CPU I/O Protocol instance
//
{
},
{
}
};
//
// Lookup table for increment values based on transfer widths
//
1, // SMM_IO_UINT8
2, // SMM_IO_UINT16
4, // SMM_IO_UINT32
8 // SMM_IO_UINT64
};
/**
Check parameters to a SMM CPU I/O Protocol service request.
@param[in] MmioOperation TRUE for an MMIO operation, FALSE for I/O Port operation.
@param[in] Width Signifies the width of the I/O operations.
@param[in] Address The base address of the I/O operations. The caller is
responsible for aligning the Address if required.
@param[in] Count The number of I/O operations to perform.
@param[in] Buffer For read operations, the destination buffer to store
the results. For write operations, the source buffer
from which to write data.
@retval EFI_SUCCESS The data was read from or written to the device.
@retval EFI_UNSUPPORTED The Address is not valid for this system.
@retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
**/
)
{
//
// Check to see if Buffer is NULL
//
return EFI_INVALID_PARAMETER;
}
//
// Check to see if Width is in the valid range
//
return EFI_INVALID_PARAMETER;
}
//
// Check to see if Width is in the valid range for I/O Port operations
//
return EFI_INVALID_PARAMETER;
}
//
// Check to see if any address associated with this transfer exceeds the maximum
// allowed address. The maximum address implied by the parameters passed in is
// Address + Size * Count. If the following condition is met, then the transfer
// is not supported.
//
// Address + Size * Count > (MmioOperation ? MAX_ADDRESS : MAX_IO_PORT_ADDRESS) + 1
//
// Since MAX_ADDRESS can be the maximum integer value supported by the CPU and Count
// can also be the maximum integer value supported by the CPU, this range
// check must be adjusted to avoid all overflow conditions.
//
// The following form of the range check is equivalent but assumes that
// MAX_ADDRESS and MAX_IO_PORT_ADDRESS are of the form (2^n - 1).
//
if (Count == 0) {
return EFI_UNSUPPORTED;
}
} else {
return EFI_UNSUPPORTED;
}
return EFI_UNSUPPORTED;
}
}
//
// Check to see if Address is aligned
//
return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
}
/**
Reads memory-mapped registers.
The I/O operations are carried out exactly as requested. The caller is
responsible for any alignment and I/O width issues that the bus, device,
platform, or type of I/O might require.
@param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
@param[in] Width Signifies the width of the I/O operations.
@param[in] Address The base address of the I/O operations. The caller is
responsible for aligning the Address if required.
@param[in] Count The number of I/O operations to perform.
@param[out] Buffer For read operations, the destination buffer to store
the results. For write operations, the source buffer
from which to write data.
@retval EFI_SUCCESS The data was read from or written to the device.
@retval EFI_UNSUPPORTED The Address is not valid for this system.
@retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
lack of resources
**/
)
{
return Status;
}
//
// Select loop based on the width of the transfer
//
if (Width == SMM_IO_UINT8) {
} else if (Width == SMM_IO_UINT16) {
} else if (Width == SMM_IO_UINT32) {
} else if (Width == SMM_IO_UINT64) {
}
}
return EFI_SUCCESS;
}
/**
Writes memory-mapped registers.
The I/O operations are carried out exactly as requested. The caller is
responsible for any alignment and I/O width issues that the bus, device,
platform, or type of I/O might require.
@param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
@param[in] Width Signifies the width of the I/O operations.
@param[in] Address The base address of the I/O operations. The caller is
responsible for aligning the Address if required.
@param[in] Count The number of I/O operations to perform.
@param[in] Buffer For read operations, the destination buffer to store
the results. For write operations, the source buffer
from which to write data.
@retval EFI_SUCCESS The data was read from or written to the device.
@retval EFI_UNSUPPORTED The Address is not valid for this system.
@retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
lack of resources
**/
)
{
return Status;
}
//
// Select loop based on the width of the transfer
//
if (Width == SMM_IO_UINT8) {
} else if (Width == SMM_IO_UINT16) {
} else if (Width == SMM_IO_UINT32) {
} else if (Width == SMM_IO_UINT64) {
}
}
return EFI_SUCCESS;
}
/**
Reads I/O registers.
The I/O operations are carried out exactly as requested. The caller is
responsible for any alignment and I/O width issues that the bus, device,
platform, or type of I/O might require.
@param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
@param[in] Width Signifies the width of the I/O operations.
@param[in] Address The base address of the I/O operations. The caller is
responsible for aligning the Address if required.
@param[in] Count The number of I/O operations to perform.
@param[out] Buffer For read operations, the destination buffer to store
the results. For write operations, the source buffer
from which to write data.
@retval EFI_SUCCESS The data was read from or written to the device.
@retval EFI_UNSUPPORTED The Address is not valid for this system.
@retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
lack of resources
**/
)
{
return Status;
}
//
// Select loop based on the width of the transfer
//
if (Width == SMM_IO_UINT8) {
} else if (Width == SMM_IO_UINT16) {
} else if (Width == SMM_IO_UINT32) {
}
}
return EFI_SUCCESS;
}
/**
Write I/O registers.
The I/O operations are carried out exactly as requested. The caller is
responsible for any alignment and I/O width issues that the bus, device,
platform, or type of I/O might require.
@param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
@param[in] Width Signifies the width of the I/O operations.
@param[in] Address The base address of the I/O operations. The caller is
responsible for aligning the Address if required.
@param[in] Count The number of I/O operations to perform.
@param[in] Buffer For read operations, the destination buffer to store
the results. For write operations, the source buffer
from which to write data.
@retval EFI_SUCCESS The data was read from or written to the device.
@retval EFI_UNSUPPORTED The Address is not valid for this system.
@retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
lack of resources
**/
)
{
//
// Make sure the parameters are valid
//
return Status;
}
//
// Select loop based on the width of the transfer
//
if (Width == SMM_IO_UINT8) {
} else if (Width == SMM_IO_UINT16) {
} else if (Width == SMM_IO_UINT32) {
}
}
return EFI_SUCCESS;
}
/**
The module Entry Point SmmCpuIoProtocol driver
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The entry point is executed successfully.
@retval Other Some error occurs when executing this entry point.
**/
)
{
//
// Copy the SMM CPU I/O Protocol instance into the System Management System Table
//
//
// Install the SMM CPU I/O Protocol into the SMM protocol database
//
&mHandle,
);
return Status;
}