Patrick Venture | 22e3875 | 2018-11-21 08:52:49 -0800 | [diff] [blame] | 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 | |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 17 | #include "firmware_handler.hpp" |
| 18 | |
Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 19 | #include "image_handler.hpp" |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 20 | #include "util.hpp" |
Patrick Venture | 26a1726 | 2019-05-20 11:03:35 -0700 | [diff] [blame] | 21 | #include "verify.hpp" |
Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 22 | |
Patrick Venture | 137ad2c | 2018-11-06 11:30:43 -0800 | [diff] [blame] | 23 | #include <algorithm> |
Patrick Venture | 192d60f | 2018-11-06 11:11:59 -0800 | [diff] [blame] | 24 | #include <cstdint> |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 25 | #include <cstring> |
Patrick Venture | b3b4db7 | 2019-05-15 11:30:24 -0700 | [diff] [blame] | 26 | #include <fstream> |
Patrick Venture | 68cf64f | 2018-11-06 10:46:51 -0800 | [diff] [blame] | 27 | #include <memory> |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 28 | #include <phosphor-logging/log.hpp> |
Patrick Venture | fa6c4d9 | 2018-11-02 18:34:53 -0700 | [diff] [blame] | 29 | #include <string> |
| 30 | #include <vector> |
| 31 | |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 32 | using namespace phosphor::logging; |
| 33 | |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 34 | namespace ipmi_flash |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 35 | { |
Patrick Venture | b3b4db7 | 2019-05-15 11:30:24 -0700 | [diff] [blame] | 36 | |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 37 | std::unique_ptr<blobs::GenericBlobInterface> |
Patrick Venture | 148cd65 | 2018-11-06 10:59:47 -0800 | [diff] [blame] | 38 | FirmwareBlobHandler::CreateFirmwareBlobHandler( |
Patrick Venture | 3ecb350 | 2019-05-17 11:03:51 -0700 | [diff] [blame] | 39 | const std::vector<HandlerPack>& firmwares, |
Patrick Venture | 74059d6 | 2019-05-17 10:40:26 -0700 | [diff] [blame] | 40 | const std::vector<DataHandlerPack>& transports, |
Patrick Venture | 27ac582 | 2019-05-20 17:39:31 -0700 | [diff] [blame^] | 41 | std::unique_ptr<VerificationInterface> verification, |
| 42 | std::unique_ptr<UpdateInterface> update) |
Patrick Venture | 68cf64f | 2018-11-06 10:46:51 -0800 | [diff] [blame] | 43 | { |
Patrick Venture | 5285462 | 2018-11-06 12:30:00 -0800 | [diff] [blame] | 44 | /* There must be at least one. */ |
| 45 | if (!firmwares.size()) |
| 46 | { |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 47 | log<level::ERR>("Must provide at least one firmware handler."); |
Patrick Venture | 5285462 | 2018-11-06 12:30:00 -0800 | [diff] [blame] | 48 | return nullptr; |
| 49 | } |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 50 | if (!transports.size()) |
| 51 | { |
| 52 | return nullptr; |
| 53 | } |
Patrick Venture | 5285462 | 2018-11-06 12:30:00 -0800 | [diff] [blame] | 54 | |
Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 55 | std::vector<std::string> blobs; |
| 56 | for (const auto& item : firmwares) |
| 57 | { |
| 58 | blobs.push_back(item.blobName); |
| 59 | } |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 60 | blobs.push_back(verifyBlobId); /* Add blob_id to always exist. */ |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 61 | |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 62 | if (0 == std::count(blobs.begin(), blobs.end(), hashBlobId)) |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 63 | { |
| 64 | return nullptr; |
| 65 | } |
Patrick Venture | 4cceb8e | 2018-11-06 11:56:48 -0800 | [diff] [blame] | 66 | |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 67 | std::uint16_t bitmask = 0; |
| 68 | for (const auto& item : transports) |
| 69 | { |
| 70 | /* TODO: can use std::accumulate() unless I'm mistaken. :D */ |
| 71 | bitmask |= item.bitmask; |
| 72 | } |
| 73 | |
Patrick Venture | 3ecb350 | 2019-05-17 11:03:51 -0700 | [diff] [blame] | 74 | return std::make_unique<FirmwareBlobHandler>( |
Patrick Venture | 27ac582 | 2019-05-20 17:39:31 -0700 | [diff] [blame^] | 75 | firmwares, blobs, transports, bitmask, std::move(verification), |
| 76 | std::move(update)); |
Patrick Venture | 68cf64f | 2018-11-06 10:46:51 -0800 | [diff] [blame] | 77 | } |
| 78 | |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 79 | /* Check if the path is in our supported list (or active list). */ |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 80 | bool FirmwareBlobHandler::canHandleBlob(const std::string& path) |
| 81 | { |
Patrick Venture | 6032dc0 | 2019-05-17 11:01:44 -0700 | [diff] [blame] | 82 | return (std::count(blobIDs.begin(), blobIDs.end(), path) > 0); |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 83 | } |
Patrick Venture | 5397796 | 2018-11-02 18:59:35 -0700 | [diff] [blame] | 84 | |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 85 | /* |
| 86 | * Grab the list of supported firmware. |
| 87 | * |
| 88 | * If there's an open firmware session, it'll already be present in the |
| 89 | * list as "/flash/active/image", and if the hash has started, |
| 90 | * "/flash/active/hash" regardless of mechanism. This is done in the open |
| 91 | * comamnd, no extra work is required here. |
| 92 | */ |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 93 | std::vector<std::string> FirmwareBlobHandler::getBlobIds() |
| 94 | { |
Patrick Venture | 4cceb8e | 2018-11-06 11:56:48 -0800 | [diff] [blame] | 95 | return blobIDs; |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 96 | } |
Patrick Venture | 5397796 | 2018-11-02 18:59:35 -0700 | [diff] [blame] | 97 | |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 98 | /* |
| 99 | * Per the design, this mean abort, and this will trigger whatever |
| 100 | * appropriate actions are required to abort the process. |
Patrick Venture | 9e5aab2 | 2018-11-09 20:49:28 -0800 | [diff] [blame] | 101 | * |
| 102 | * You cannot delete a blob that has an open handle in the system, therefore |
| 103 | * this is never called if there's an open session. Guaranteed by the blob |
| 104 | * manager. |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 105 | */ |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 106 | bool FirmwareBlobHandler::deleteBlob(const std::string& path) |
| 107 | { |
Patrick Venture | 9e5aab2 | 2018-11-09 20:49:28 -0800 | [diff] [blame] | 108 | const std::string* toDelete; |
| 109 | |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 110 | /* You cannot delete the verify blob -- trying to delete it, currently has |
| 111 | * no impact. |
| 112 | * TODO: Should trying to delete this cause an abort? |
| 113 | */ |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 114 | if (path == verifyBlobId) |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 115 | { |
| 116 | return false; |
| 117 | } |
| 118 | |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 119 | if (path == hashBlobId || path == activeHashBlobId) |
Patrick Venture | 9e5aab2 | 2018-11-09 20:49:28 -0800 | [diff] [blame] | 120 | { |
| 121 | /* They're deleting the hash. */ |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 122 | toDelete = &activeHashBlobId; |
Patrick Venture | 9e5aab2 | 2018-11-09 20:49:28 -0800 | [diff] [blame] | 123 | } |
| 124 | else |
| 125 | { |
| 126 | /* They're deleting the image. */ |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 127 | toDelete = &activeImageBlobId; |
Patrick Venture | 9e5aab2 | 2018-11-09 20:49:28 -0800 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | auto it = std::find_if( |
| 131 | blobIDs.begin(), blobIDs.end(), |
| 132 | [toDelete](const auto& iter) { return (iter == *toDelete); }); |
| 133 | if (it == blobIDs.end()) |
| 134 | { |
| 135 | /* Somehow they've asked to delete something we didn't say we could |
| 136 | * handle. |
| 137 | */ |
| 138 | return false; |
| 139 | } |
| 140 | |
| 141 | blobIDs.erase(it); |
| 142 | |
| 143 | /* TODO: Handle aborting the process and fixing up the state. */ |
| 144 | |
| 145 | return true; |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 146 | } |
Patrick Venture | 5397796 | 2018-11-02 18:59:35 -0700 | [diff] [blame] | 147 | |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 148 | /* |
| 149 | * Stat on the files will return information such as what supported |
| 150 | * transport mechanisms are available. |
| 151 | * |
| 152 | * Stat on an active file or hash will return information such as the size |
| 153 | * of the data cached, and any additional pertinent information. The |
| 154 | * blob_state on the active files will return the state of the update. |
| 155 | */ |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 156 | bool FirmwareBlobHandler::stat(const std::string& path, |
| 157 | struct blobs::BlobMeta* meta) |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 158 | { |
Patrick Venture | 46637c8 | 2018-11-06 15:20:24 -0800 | [diff] [blame] | 159 | /* We know we support this path because canHandle is called ahead */ |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 160 | if (path == verifyBlobId) |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 161 | { |
Patrick Venture | 699750d | 2019-05-15 09:24:09 -0700 | [diff] [blame] | 162 | /* TODO: We need to return information for the verify state -- did they |
| 163 | * call commit() did things start? |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 164 | */ |
| 165 | } |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 166 | else if (path == activeImageBlobId) |
Patrick Venture | 46637c8 | 2018-11-06 15:20:24 -0800 | [diff] [blame] | 167 | { |
Patrick Venture | 699750d | 2019-05-15 09:24:09 -0700 | [diff] [blame] | 168 | /* TODO: We need to return information for the image that's staged. */ |
Patrick Venture | 46637c8 | 2018-11-06 15:20:24 -0800 | [diff] [blame] | 169 | } |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 170 | else if (path == activeHashBlobId) |
Patrick Venture | 46637c8 | 2018-11-06 15:20:24 -0800 | [diff] [blame] | 171 | { |
Patrick Venture | 699750d | 2019-05-15 09:24:09 -0700 | [diff] [blame] | 172 | /* TODO: We need to return information for the hash that's staged. */ |
Patrick Venture | 46637c8 | 2018-11-06 15:20:24 -0800 | [diff] [blame] | 173 | } |
| 174 | else |
| 175 | { |
| 176 | /* They are requesting information about the generic blob_id. */ |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 177 | meta->blobState = bitmask; |
Patrick Venture | 46637c8 | 2018-11-06 15:20:24 -0800 | [diff] [blame] | 178 | meta->size = 0; |
| 179 | |
| 180 | /* The generic blob_ids state is only the bits related to the transport |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 181 | * mechanisms. |
| 182 | */ |
Patrick Venture | 46637c8 | 2018-11-06 15:20:24 -0800 | [diff] [blame] | 183 | return true; |
| 184 | } |
| 185 | |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 186 | return false; |
| 187 | } |
Patrick Venture | 5397796 | 2018-11-02 18:59:35 -0700 | [diff] [blame] | 188 | |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 189 | /* |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 190 | * Return stat information on an open session. It therefore must be an active |
| 191 | * handle to either the active image or active hash. |
| 192 | * |
| 193 | * The stat() and sessionstat() commands will return the same information in |
| 194 | * many cases, therefore the logic will be combined. |
| 195 | * |
| 196 | * TODO: combine the logic for stat and sessionstat(). |
| 197 | */ |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 198 | bool FirmwareBlobHandler::stat(uint16_t session, struct blobs::BlobMeta* meta) |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 199 | { |
Patrick Venture | cc7d160 | 2018-11-15 13:58:33 -0800 | [diff] [blame] | 200 | auto item = lookup.find(session); |
| 201 | if (item == lookup.end()) |
| 202 | { |
| 203 | return false; |
| 204 | } |
| 205 | |
Patrick Venture | b3b4db7 | 2019-05-15 11:30:24 -0700 | [diff] [blame] | 206 | /* The size here refers to the size of the file -- of something analagous. |
| 207 | */ |
| 208 | meta->size = (item->second->imageHandler) |
| 209 | ? item->second->imageHandler->getSize() |
| 210 | : 0; |
| 211 | |
| 212 | meta->metadata.clear(); |
| 213 | |
Patrick Venture | 699750d | 2019-05-15 09:24:09 -0700 | [diff] [blame] | 214 | /* TODO: Implement this for the verification blob, which is what we expect. |
| 215 | * Calling stat() on the verify blob without an active session should not |
| 216 | * provide insight. |
| 217 | */ |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 218 | if (item->second->activePath == verifyBlobId) |
Patrick Venture | b3b4db7 | 2019-05-15 11:30:24 -0700 | [diff] [blame] | 219 | { |
Patrick Venture | 3ecb350 | 2019-05-17 11:03:51 -0700 | [diff] [blame] | 220 | auto value = verification->checkVerificationState(); |
Patrick Venture | 699750d | 2019-05-15 09:24:09 -0700 | [diff] [blame] | 221 | |
Patrick Venture | e955e07 | 2019-05-15 16:16:46 -0700 | [diff] [blame] | 222 | meta->metadata.push_back(static_cast<std::uint8_t>(value)); |
| 223 | |
| 224 | /* Change the firmware handler's state and the blob's stat value |
| 225 | * depending. |
| 226 | */ |
| 227 | if (value == VerifyCheckResponses::success || |
| 228 | value == VerifyCheckResponses::failed) |
| 229 | { |
| 230 | state = UpdateState::verificationCompleted; |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 231 | item->second->flags &= ~blobs::StateFlags::committing; |
Patrick Venture | e955e07 | 2019-05-15 16:16:46 -0700 | [diff] [blame] | 232 | |
| 233 | if (value == VerifyCheckResponses::success) |
| 234 | { |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 235 | item->second->flags |= blobs::StateFlags::committed; |
Patrick Venture | e955e07 | 2019-05-15 16:16:46 -0700 | [diff] [blame] | 236 | } |
| 237 | else |
| 238 | { |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 239 | item->second->flags |= blobs::StateFlags::commit_error; |
Patrick Venture | e955e07 | 2019-05-15 16:16:46 -0700 | [diff] [blame] | 240 | } |
| 241 | } |
Patrick Venture | b3b4db7 | 2019-05-15 11:30:24 -0700 | [diff] [blame] | 242 | } |
Patrick Venture | cc7d160 | 2018-11-15 13:58:33 -0800 | [diff] [blame] | 243 | |
Patrick Venture | e955e07 | 2019-05-15 16:16:46 -0700 | [diff] [blame] | 244 | /* The blobState here relates to an active sesion, so we should return the |
| 245 | * flags used to open this session. |
| 246 | */ |
| 247 | meta->blobState = item->second->flags; |
| 248 | |
Patrick Venture | cc7d160 | 2018-11-15 13:58:33 -0800 | [diff] [blame] | 249 | /* The metadata blob returned comes from the data handler... it's used for |
| 250 | * instance, in P2A bridging to get required information about the mapping, |
| 251 | * and is the "opposite" of the lpc writemeta requirement. |
| 252 | */ |
Patrick Venture | cc7d160 | 2018-11-15 13:58:33 -0800 | [diff] [blame] | 253 | if (item->second->dataHandler) |
| 254 | { |
Patrick Venture | 7430464 | 2019-01-17 09:31:04 -0800 | [diff] [blame] | 255 | auto bytes = item->second->dataHandler->readMeta(); |
Patrick Venture | cc7d160 | 2018-11-15 13:58:33 -0800 | [diff] [blame] | 256 | meta->metadata.insert(meta->metadata.begin(), bytes.begin(), |
| 257 | bytes.end()); |
| 258 | } |
| 259 | |
Patrick Venture | cc7d160 | 2018-11-15 13:58:33 -0800 | [diff] [blame] | 260 | return true; |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | /* |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 264 | * If you open /flash/image or /flash/tarball, or /flash/hash it will |
| 265 | * interpret the open flags and perform whatever actions are required for |
| 266 | * that update process. The session returned can be used immediately for |
| 267 | * sending data down, without requiring one to open the new active file. |
| 268 | * |
| 269 | * If you open the active flash image or active hash it will let you |
| 270 | * overwrite pieces, depending on the state. |
| 271 | * |
| 272 | * Once the verification process has started the active files cannot be |
| 273 | * opened. |
| 274 | * |
| 275 | * You can only have one open session at a time. Which means, you can only |
| 276 | * have one file open at a time. Trying to open the hash blob_id while you |
| 277 | * still have the flash image blob_id open will fail. Opening the flash |
| 278 | * blob_id when it is already open will fail. |
| 279 | */ |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 280 | bool FirmwareBlobHandler::open(uint16_t session, uint16_t flags, |
| 281 | const std::string& path) |
| 282 | { |
Patrick Venture | 6e307a7 | 2018-11-09 18:21:17 -0800 | [diff] [blame] | 283 | /* Check that they've opened for writing - read back not currently |
| 284 | * supported. |
| 285 | */ |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 286 | if ((flags & blobs::OpenFlags::write) == 0) |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 287 | { |
| 288 | return false; |
| 289 | } |
| 290 | |
Patrick Venture | b1b68fc | 2018-11-09 09:37:04 -0800 | [diff] [blame] | 291 | /* Is the verification process underway? */ |
| 292 | if (state == UpdateState::verificationStarted) |
| 293 | { |
| 294 | return false; |
| 295 | } |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 296 | |
| 297 | /* Is there an open session already? We only allow one at a time. |
Patrick Venture | 6e307a7 | 2018-11-09 18:21:17 -0800 | [diff] [blame] | 298 | * |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 299 | * TODO: Temporarily using a simple boolean flag until there's a full |
| 300 | * session object to check. |
Patrick Venture | 7c8b97e | 2018-11-08 09:14:30 -0800 | [diff] [blame] | 301 | * |
| 302 | * Further on this, if there's an active session to the hash we don't allow |
| 303 | * re-opening the image, and if we have the image open, we don't allow |
| 304 | * opening the hash. This design decision may be re-evaluated, and changed |
| 305 | * to only allow one session per object type (of the two types). But, |
| 306 | * consider if the hash is open, do we want to allow writing to the image? |
| 307 | * And why would we? But, really, the point of no-return is once the |
| 308 | * verification process has begun -- which is done via commit() on the hash |
| 309 | * blob_id, we no longer want to allow updating the contents. |
Patrick Venture | 5397796 | 2018-11-02 18:59:35 -0700 | [diff] [blame] | 310 | */ |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 311 | if (fileOpen) |
| 312 | { |
| 313 | return false; |
| 314 | } |
| 315 | |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 316 | /* Handle opening the verifyBlobId --> we know the image and hash aren't |
| 317 | * open because of the fileOpen check. |
| 318 | * |
| 319 | * The file must be opened for writing, but no transport mechanism specified |
| 320 | * since it's irrelevant. |
| 321 | */ |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 322 | if (path == verifyBlobId) |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 323 | { |
| 324 | /* In this case, there's no image handler to use, or data handler, |
| 325 | * simply set up a session. |
| 326 | */ |
| 327 | verifyImage.flags = flags; |
| 328 | verifyImage.state = Session::State::open; |
| 329 | |
| 330 | lookup[session] = &verifyImage; |
| 331 | |
| 332 | fileOpen = true; |
| 333 | |
| 334 | return true; |
| 335 | } |
| 336 | |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 337 | /* There are two abstractions at play, how you get the data and how you |
| 338 | * handle that data. such that, whether the data comes from the PCI bridge |
| 339 | * or LPC bridge is not connected to whether the data goes into a static |
| 340 | * layout flash update or a UBI tarball. |
| 341 | */ |
| 342 | |
| 343 | /* Check the flags for the transport mechanism: if none match we don't |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 344 | * support what they request. |
| 345 | */ |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 346 | if ((flags & bitmask) == 0) |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 347 | { |
| 348 | return false; |
| 349 | } |
| 350 | |
| 351 | /* 2) there isn't, so what are they opening? */ |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 352 | if (path == activeImageBlobId) |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 353 | { |
| 354 | /* 2a) are they opening the active image? this can only happen if they |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 355 | * already started one (due to canHandleBlob's behavior). |
| 356 | */ |
Patrick Venture | 21c62c1 | 2018-11-09 17:46:58 -0800 | [diff] [blame] | 357 | return false; |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 358 | } |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 359 | else if (path == activeHashBlobId) |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 360 | { |
| 361 | /* 2b) are they opening the active hash? this can only happen if they |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 362 | * already started one (due to canHandleBlob's behavior). |
| 363 | */ |
Patrick Venture | 21c62c1 | 2018-11-09 17:46:58 -0800 | [diff] [blame] | 364 | return false; |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 365 | } |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 366 | |
| 367 | /* How are they expecting to copy this data? */ |
| 368 | auto d = std::find_if( |
| 369 | transports.begin(), transports.end(), |
| 370 | [&flags](const auto& iter) { return (iter.bitmask & flags); }); |
| 371 | if (d == transports.end()) |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 372 | { |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 373 | return false; |
| 374 | } |
| 375 | |
| 376 | /* We found the transport handler they requested, no surprise since |
| 377 | * above we verify they selected at least one we wanted. |
| 378 | */ |
Patrick Venture | c02849b | 2018-11-06 17:31:15 -0800 | [diff] [blame] | 379 | |
Patrick Venture | 6e307a7 | 2018-11-09 18:21:17 -0800 | [diff] [blame] | 380 | /* Elsewhere I do this check by checking "if ::ipmi" because that's the |
| 381 | * only non-external data pathway -- but this is just a more generic |
| 382 | * approach to that. |
| 383 | */ |
| 384 | if (d->handler) |
| 385 | { |
| 386 | /* If the data handler open call fails, open fails. */ |
| 387 | if (!d->handler->open()) |
| 388 | { |
| 389 | return false; |
| 390 | } |
| 391 | } |
| 392 | |
Patrick Venture | 70e30bf | 2019-01-17 10:29:28 -0800 | [diff] [blame] | 393 | /* Do we have a file handler for the type of file they're opening. |
| 394 | * Note: This should only fail if something is somehow crazy wrong. |
| 395 | * Since the canHandle() said yes, and that's tied into the list of explicit |
| 396 | * firmware handers (and file handlers, like this'll know where to write the |
| 397 | * tarball, etc). |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 398 | */ |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 399 | auto h = std::find_if( |
| 400 | handlers.begin(), handlers.end(), |
| 401 | [&path](const auto& iter) { return (iter.blobName == path); }); |
| 402 | if (h == handlers.end()) |
| 403 | { |
| 404 | return false; |
| 405 | } |
| 406 | |
| 407 | /* Ok, so we found a handler that matched, so call open() */ |
| 408 | if (!h->handler->open(path)) |
| 409 | { |
| 410 | return false; |
| 411 | } |
| 412 | |
Patrick Venture | 70e30bf | 2019-01-17 10:29:28 -0800 | [diff] [blame] | 413 | Session* curr; |
| 414 | const std::string* active; |
| 415 | |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 416 | if (path == hashBlobId) |
Patrick Venture | 70e30bf | 2019-01-17 10:29:28 -0800 | [diff] [blame] | 417 | { |
| 418 | /* 2c) are they opening the /flash/hash ? (to start the process) */ |
| 419 | curr = &activeHash; |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 420 | active = &activeHashBlobId; |
Patrick Venture | 70e30bf | 2019-01-17 10:29:28 -0800 | [diff] [blame] | 421 | } |
| 422 | else |
| 423 | { |
| 424 | curr = &activeImage; |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 425 | active = &activeImageBlobId; |
Patrick Venture | 70e30bf | 2019-01-17 10:29:28 -0800 | [diff] [blame] | 426 | } |
| 427 | |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 428 | curr->flags = flags; |
| 429 | curr->dataHandler = d->handler; |
| 430 | curr->imageHandler = h->handler; |
Patrick Venture | cd31022 | 2018-11-09 18:47:13 -0800 | [diff] [blame] | 431 | curr->state = Session::State::open; |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 432 | |
| 433 | lookup[session] = curr; |
| 434 | |
Patrick Venture | daf4707 | 2019-05-10 15:21:55 -0700 | [diff] [blame] | 435 | /* This may be them re-opening a blob, so let's only push it onto the list |
| 436 | * when appropriate. |
| 437 | */ |
| 438 | auto blobIdMatch = |
| 439 | std::find_if(blobIDs.begin(), blobIDs.end(), |
| 440 | [active](const auto& iter) { return (iter == *active); }); |
| 441 | if (blobIdMatch == blobIDs.end()) |
| 442 | { |
| 443 | blobIDs.push_back(*active); |
| 444 | } |
Patrick Venture | db253bf | 2018-11-09 19:36:03 -0800 | [diff] [blame] | 445 | |
Patrick Venture | 12233c5 | 2019-05-16 09:26:59 -0700 | [diff] [blame] | 446 | state = UpdateState::uploadInProgress; |
Patrick Venture | 991910a | 2018-11-09 19:43:48 -0800 | [diff] [blame] | 447 | fileOpen = true; |
| 448 | |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 449 | return true; |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 450 | } |
Patrick Venture | 5397796 | 2018-11-02 18:59:35 -0700 | [diff] [blame] | 451 | |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 452 | /** |
| 453 | * The write command really just grabs the data from wherever it is and sends it |
| 454 | * to the image handler. It's the image handler's responsibility to deal with |
| 455 | * the data provided. |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 456 | * |
| 457 | * This receives a session from the blob manager, therefore it is always called |
| 458 | * between open() and close(). |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 459 | */ |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 460 | bool FirmwareBlobHandler::write(uint16_t session, uint32_t offset, |
| 461 | const std::vector<uint8_t>& data) |
| 462 | { |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 463 | auto item = lookup.find(session); |
| 464 | if (item == lookup.end()) |
| 465 | { |
| 466 | return false; |
| 467 | } |
| 468 | |
Patrick Venture | b1b68fc | 2018-11-09 09:37:04 -0800 | [diff] [blame] | 469 | /* Prevent writing during verification. */ |
| 470 | if (state == UpdateState::verificationStarted) |
| 471 | { |
| 472 | return false; |
| 473 | } |
| 474 | |
Patrick Venture | 8af15eb | 2019-05-15 09:39:22 -0700 | [diff] [blame] | 475 | /* Prevent writing to the verification blob before they trigger |
Patrick Venture | 699750d | 2019-05-15 09:24:09 -0700 | [diff] [blame] | 476 | * verification. |
| 477 | */ |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 478 | if (item->second->activePath == verifyBlobId) |
Patrick Venture | 8af15eb | 2019-05-15 09:39:22 -0700 | [diff] [blame] | 479 | { |
| 480 | return false; |
| 481 | } |
Patrick Venture | 699750d | 2019-05-15 09:24:09 -0700 | [diff] [blame] | 482 | |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 483 | std::vector<std::uint8_t> bytes; |
| 484 | |
Patrick Venture | 05abf7e | 2018-11-09 11:02:56 -0800 | [diff] [blame] | 485 | if (item->second->flags & UpdateFlags::ipmi) |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 486 | { |
| 487 | bytes = data; |
| 488 | } |
| 489 | else |
| 490 | { |
| 491 | /* little endian required per design, and so on, but TODO: do endianness |
| 492 | * with boost. |
| 493 | */ |
| 494 | struct ExtChunkHdr header; |
| 495 | |
| 496 | if (data.size() != sizeof(header)) |
| 497 | { |
| 498 | return false; |
| 499 | } |
| 500 | |
| 501 | std::memcpy(&header, data.data(), data.size()); |
| 502 | bytes = item->second->dataHandler->copyFrom(header.length); |
| 503 | } |
| 504 | |
| 505 | return item->second->imageHandler->write(offset, bytes); |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 506 | } |
Patrick Venture | 18235e6 | 2018-11-08 10:21:09 -0800 | [diff] [blame] | 507 | |
Patrick Venture | 8c53533 | 2018-11-08 15:58:00 -0800 | [diff] [blame] | 508 | /* |
| 509 | * If the active session (image or hash) is over LPC, this allows |
| 510 | * configuring it. This option is only available before you start |
| 511 | * writing data for the given item (image or hash). This will return |
| 512 | * false at any other part. -- the lpc handler portion will know to return |
| 513 | * false. |
| 514 | */ |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 515 | bool FirmwareBlobHandler::writeMeta(uint16_t session, uint32_t offset, |
| 516 | const std::vector<uint8_t>& data) |
| 517 | { |
Patrick Venture | 8c53533 | 2018-11-08 15:58:00 -0800 | [diff] [blame] | 518 | auto item = lookup.find(session); |
| 519 | if (item == lookup.end()) |
| 520 | { |
| 521 | return false; |
| 522 | } |
| 523 | |
Patrick Venture | 05abf7e | 2018-11-09 11:02:56 -0800 | [diff] [blame] | 524 | if (item->second->flags & UpdateFlags::ipmi) |
Patrick Venture | 8c53533 | 2018-11-08 15:58:00 -0800 | [diff] [blame] | 525 | { |
| 526 | return false; |
| 527 | } |
| 528 | |
Patrick Venture | d56097a | 2019-05-15 09:47:55 -0700 | [diff] [blame] | 529 | /* Prevent writing meta to the verification blob (it has no data handler). |
| 530 | */ |
| 531 | if (item->second->dataHandler) |
| 532 | { |
| 533 | return item->second->dataHandler->writeMeta(data); |
| 534 | } |
Patrick Venture | 699750d | 2019-05-15 09:24:09 -0700 | [diff] [blame] | 535 | |
Patrick Venture | d56097a | 2019-05-15 09:47:55 -0700 | [diff] [blame] | 536 | return false; |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 537 | } |
Patrick Venture | 8c53533 | 2018-11-08 15:58:00 -0800 | [diff] [blame] | 538 | |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 539 | /* |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 540 | * If this command is called on the session for the verifyBlobId, it'll |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 541 | * trigger a systemd service `verify_image.service` to attempt to verify |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 542 | * the image. |
| 543 | * |
| 544 | * For this file to have opened, the other two must be closed, which means any |
| 545 | * out-of-band transport mechanism involved is closed. |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 546 | */ |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 547 | bool FirmwareBlobHandler::commit(uint16_t session, |
| 548 | const std::vector<uint8_t>& data) |
| 549 | { |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 550 | auto item = lookup.find(session); |
| 551 | if (item == lookup.end()) |
| 552 | { |
| 553 | return false; |
| 554 | } |
| 555 | |
| 556 | /* You can only commit on the verifyBlodId */ |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 557 | if (item->second->activePath != verifyBlobId) |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 558 | { |
| 559 | return false; |
| 560 | } |
| 561 | |
Patrick Venture | be19870 | 2019-05-15 09:46:02 -0700 | [diff] [blame] | 562 | /* Calling repeatedly has no effect within an update process. */ |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 563 | if (state == UpdateState::verificationStarted) |
| 564 | { |
Patrick Venture | be19870 | 2019-05-15 09:46:02 -0700 | [diff] [blame] | 565 | return true; |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 566 | } |
| 567 | |
| 568 | /* Set state to committing. */ |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 569 | item->second->flags |= blobs::StateFlags::committing; |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 570 | |
| 571 | return triggerVerification(); |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 572 | } |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 573 | |
| 574 | /* |
| 575 | * Close must be called on the firmware image before triggering |
| 576 | * verification via commit. Once the verification is complete, you can |
| 577 | * then close the hash file. |
| 578 | * |
| 579 | * If the `verify_image.service` returned success, closing the hash file |
| 580 | * will have a specific behavior depending on the update. If it's UBI, |
| 581 | * it'll perform the install. If it's static layout, it'll do nothing. The |
| 582 | * verify_image service in the static layout case is responsible for placing |
| 583 | * the file in the correct staging position. |
| 584 | */ |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 585 | bool FirmwareBlobHandler::close(uint16_t session) |
| 586 | { |
Patrick Venture | 68bb143 | 2018-11-09 20:08:48 -0800 | [diff] [blame] | 587 | auto item = lookup.find(session); |
| 588 | if (item == lookup.end()) |
| 589 | { |
| 590 | return false; |
| 591 | } |
| 592 | |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 593 | /* Are you closing the verify blob? */ |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 594 | if (item->second->activePath == verifyBlobId) |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 595 | { |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 596 | if (state == UpdateState::verificationStarted) |
| 597 | { |
Patrick Venture | 12233c5 | 2019-05-16 09:26:59 -0700 | [diff] [blame] | 598 | /* TODO: If they close this blob before verification finishes, |
| 599 | * that's an abort. |
| 600 | */ |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 601 | return false; |
| 602 | } |
Patrick Venture | 12233c5 | 2019-05-16 09:26:59 -0700 | [diff] [blame] | 603 | else if (state == UpdateState::verificationCompleted) |
| 604 | { |
| 605 | /* TODO: Should this delete the verification artifact? */ |
| 606 | state = UpdateState::notYetStarted; |
| 607 | |
| 608 | /* A this point, delete the active blob IDs from the blob_list. */ |
| 609 | blobIDs.erase( |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 610 | std::remove(blobIDs.begin(), blobIDs.end(), activeImageBlobId)); |
Patrick Venture | 12233c5 | 2019-05-16 09:26:59 -0700 | [diff] [blame] | 611 | blobIDs.erase( |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 612 | std::remove(blobIDs.begin(), blobIDs.end(), activeHashBlobId)); |
Patrick Venture | 12233c5 | 2019-05-16 09:26:59 -0700 | [diff] [blame] | 613 | } |
| 614 | /* Must be verificationPending... not yet started, they may re-open and |
| 615 | * trigger verification. |
| 616 | */ |
| 617 | } |
| 618 | else |
| 619 | { |
| 620 | /* They are closing a data pathway (image, tarball, hash). */ |
| 621 | state = UpdateState::verificationPending; |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 622 | } |
| 623 | |
Patrick Venture | 68bb143 | 2018-11-09 20:08:48 -0800 | [diff] [blame] | 624 | if (item->second->dataHandler) |
| 625 | { |
| 626 | item->second->dataHandler->close(); |
| 627 | } |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 628 | if (item->second->imageHandler) |
| 629 | { |
| 630 | item->second->imageHandler->close(); |
| 631 | } |
| 632 | |
Patrick Venture | 68bb143 | 2018-11-09 20:08:48 -0800 | [diff] [blame] | 633 | item->second->state = Session::State::closed; |
| 634 | /* Do not delete the active blob_id from the list of blob_ids, because that |
| 635 | * blob_id indicates there is data stored. Delete will destroy it. |
| 636 | */ |
| 637 | |
| 638 | lookup.erase(item); |
| 639 | |
Patrick Venture | 991910a | 2018-11-09 19:43:48 -0800 | [diff] [blame] | 640 | fileOpen = false; |
| 641 | |
Patrick Venture | 68bb143 | 2018-11-09 20:08:48 -0800 | [diff] [blame] | 642 | return true; |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 643 | } |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 644 | |
Patrick Venture | c7ca291 | 2018-11-02 11:38:33 -0700 | [diff] [blame] | 645 | bool FirmwareBlobHandler::expire(uint16_t session) |
| 646 | { |
| 647 | return false; |
| 648 | } |
Patrick Venture | d6461d6 | 2018-11-09 17:30:25 -0800 | [diff] [blame] | 649 | |
| 650 | /* |
| 651 | * Currently, the design does not provide this with a function, however, |
| 652 | * it will likely change to support reading data back. |
| 653 | */ |
| 654 | std::vector<uint8_t> FirmwareBlobHandler::read(uint16_t session, |
| 655 | uint32_t offset, |
| 656 | uint32_t requestedSize) |
| 657 | { |
| 658 | return {}; |
| 659 | } |
| 660 | |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 661 | bool FirmwareBlobHandler::triggerVerification() |
| 662 | { |
Patrick Venture | 3ecb350 | 2019-05-17 11:03:51 -0700 | [diff] [blame] | 663 | bool result = verification->triggerVerification(); |
| 664 | if (result) |
Patrick Venture | cabc117 | 2018-11-16 16:14:26 -0800 | [diff] [blame] | 665 | { |
Patrick Venture | 453f06a | 2019-01-17 10:02:12 -0800 | [diff] [blame] | 666 | state = UpdateState::verificationStarted; |
Patrick Venture | cabc117 | 2018-11-16 16:14:26 -0800 | [diff] [blame] | 667 | } |
Patrick Venture | cabc117 | 2018-11-16 16:14:26 -0800 | [diff] [blame] | 668 | |
Patrick Venture | 3ecb350 | 2019-05-17 11:03:51 -0700 | [diff] [blame] | 669 | return result; |
Patrick Venture | ffcc550 | 2018-11-16 12:32:38 -0800 | [diff] [blame] | 670 | } |
| 671 | |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 672 | } // namespace ipmi_flash |