Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 1 | #include "pci_handler.hpp" |
| 2 | |
| 3 | #include <cstdint> |
Patrick Venture | a8a99ae | 2018-11-09 11:14:58 -0800 | [diff] [blame] | 4 | #include <cstring> |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 5 | #include <vector> |
| 6 | |
| 7 | namespace blobs |
| 8 | { |
| 9 | |
Patrick Venture | 0d2a813 | 2018-11-09 11:34:21 -0800 | [diff] [blame] | 10 | bool PciDataHandler::open() |
| 11 | { |
Patrick Venture | 0fbabf2 | 2018-11-09 11:54:12 -0800 | [diff] [blame^] | 12 | /* TODO: For the ASPEED P2A driver, this method will enable the memory |
| 13 | * region to use. |
| 14 | */ |
| 15 | return false; |
| 16 | } |
| 17 | |
| 18 | bool PciDataHandler::close() |
| 19 | { |
| 20 | /* TODO: Turn off the P2A bridge and region to disable host-side access. |
Patrick Venture | 0d2a813 | 2018-11-09 11:34:21 -0800 | [diff] [blame] | 21 | */ |
| 22 | return false; |
| 23 | } |
| 24 | |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 25 | std::vector<std::uint8_t> PciDataHandler::copyFrom(std::uint32_t length) |
| 26 | { |
| 27 | /* TODO: implement this. */ |
| 28 | return {}; |
| 29 | } |
| 30 | |
Patrick Venture | 8c53533 | 2018-11-08 15:58:00 -0800 | [diff] [blame] | 31 | bool 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 | |
| 37 | std::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 Venture | a8a99ae | 2018-11-09 11:14:58 -0800 | [diff] [blame] | 45 | std::memcpy(bytes.data(), &reply, sizeof(reply)); |
Patrick Venture | 8c53533 | 2018-11-08 15:58:00 -0800 | [diff] [blame] | 46 | |
| 47 | return bytes; |
| 48 | } |
| 49 | |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 50 | } // namespace blobs |