blob: dce10982fb32476921785b2c8223e13c6e7edd71 [file] [log] [blame]
Patrick Venture1cde5f92018-11-07 08:26:47 -08001#include "pci_handler.hpp"
2
3#include <cstdint>
Patrick Venturea8a99ae2018-11-09 11:14:58 -08004#include <cstring>
Patrick Venture1cde5f92018-11-07 08:26:47 -08005#include <vector>
6
7namespace blobs
8{
9
Patrick Venture0d2a8132018-11-09 11:34:21 -080010bool PciDataHandler::open()
11{
Patrick Venture0fbabf22018-11-09 11:54:12 -080012 /* TODO: For the ASPEED P2A driver, this method will enable the memory
13 * region to use.
14 */
15 return false;
16}
17
18bool PciDataHandler::close()
19{
20 /* TODO: Turn off the P2A bridge and region to disable host-side access.
Patrick Venture0d2a8132018-11-09 11:34:21 -080021 */
22 return false;
23}
24
Patrick Venture1cde5f92018-11-07 08:26:47 -080025std::vector<std::uint8_t> PciDataHandler::copyFrom(std::uint32_t length)
26{
27 /* TODO: implement this. */
28 return {};
29}
30
Patrick Venture8c535332018-11-08 15:58:00 -080031bool PciDataHandler::write(const std::vector<std::uint8_t>& configuration)
32{
33 /* PCI handler doesn't require configuration write, only read. */
34 return false;
35}
36
37std::vector<std::uint8_t> PciDataHandler::read()
38{
39 /* PCI handler does require returning a configuration from read. */
40 struct PciConfigResponse reply;
41 reply.address = 0;
42
43 std::vector<std::uint8_t> bytes;
44 bytes.resize(sizeof(reply));
Patrick Venturea8a99ae2018-11-09 11:14:58 -080045 std::memcpy(bytes.data(), &reply, sizeof(reply));
Patrick Venture8c535332018-11-08 15:58:00 -080046
47 return bytes;
48}
49
Patrick Venture1cde5f92018-11-07 08:26:47 -080050} // namespace blobs