xref: /openbmc/phosphor-ipmi-flash/tools/lpc.cpp (revision 9efef5d9)
1 /*
2  * Copyright 2018 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "lpc.hpp"
18 
19 #include <cstring>
20 
21 namespace host_tool
22 {
23 
24 bool LpcDataHandler::sendContents(const std::string& input,
25                                   std::uint16_t session)
26 {
27     /* TODO: Add mechanism for configuring this. */
28     LpcRegion host_lpc_buf;
29 
30     /* TODO: Remove hard-coded configuration used with test machine. */
31     host_lpc_buf.address = 0xfedc1000;
32     host_lpc_buf.length = 0x1000;
33 
34     std::vector<std::uint8_t> payload(sizeof(host_lpc_buf));
35     std::memcpy(payload.data(), &host_lpc_buf, sizeof(host_lpc_buf));
36 
37     blob->writeMeta(session, 0x00, payload);
38 
39     /* TODO: Call sessionstat and see if the metadata confirms the region was
40      * mapped successfully, once the lpc data handler implements it.
41      */
42 
43     /* todo:
44      * configure memory region (somehow)
45      * copy contents from file to memory region
46      * send external chunk (writeBlob) until it's all sent.
47      */
48     return false;
49 }
50 
51 } // namespace host_tool
52