197edfc1bSMark Johnston /*- 297edfc1bSMark Johnston * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 397edfc1bSMark Johnston * 497edfc1bSMark Johnston * Copyright (c) 2018 The FreeBSD Foundation 597edfc1bSMark Johnston * 697edfc1bSMark Johnston * This software was developed by Mark Johnston under sponsorship from 797edfc1bSMark Johnston * the FreeBSD Foundation. 897edfc1bSMark Johnston * 997edfc1bSMark Johnston * Redistribution and use in source and binary forms, with or without 1097edfc1bSMark Johnston * modification, are permitted provided that the following conditions 1197edfc1bSMark Johnston * are met: 1297edfc1bSMark Johnston * 1. Redistributions of source code must retain the above copyright 1397edfc1bSMark Johnston * notice, this list of conditions and the following disclaimer. 1497edfc1bSMark Johnston * 2. Redistributions in binary form must reproduce the above copyright 1597edfc1bSMark Johnston * notice, this list of conditions and the following disclaimer in the 1697edfc1bSMark Johnston * documentation and/or other materials provided with the distribution. 1797edfc1bSMark Johnston * 1897edfc1bSMark Johnston * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1997edfc1bSMark Johnston * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2097edfc1bSMark Johnston * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2197edfc1bSMark Johnston * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2297edfc1bSMark Johnston * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2397edfc1bSMark Johnston * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2497edfc1bSMark Johnston * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2597edfc1bSMark Johnston * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2697edfc1bSMark Johnston * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2797edfc1bSMark Johnston * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2897edfc1bSMark Johnston * SUCH DAMAGE. 2997edfc1bSMark Johnston * 3097edfc1bSMark Johnston * $FreeBSD$ 3197edfc1bSMark Johnston */ 3297edfc1bSMark Johnston 3397edfc1bSMark Johnston #ifndef _MACHINE_UCODE_H_ 3497edfc1bSMark Johnston #define _MACHINE_UCODE_H_ 3597edfc1bSMark Johnston 3697edfc1bSMark Johnston struct ucode_intel_header { 3797edfc1bSMark Johnston uint32_t header_version; 3897edfc1bSMark Johnston int32_t update_revision; 3997edfc1bSMark Johnston uint32_t dat; 4097edfc1bSMark Johnston uint32_t processor_signature; 4197edfc1bSMark Johnston uint32_t checksum; 4297edfc1bSMark Johnston uint32_t loader_revision; 4397edfc1bSMark Johnston uint32_t processor_flags; 4497edfc1bSMark Johnston #define UCODE_INTEL_DEFAULT_DATA_SIZE 2000 4597edfc1bSMark Johnston uint32_t data_size; 4697edfc1bSMark Johnston uint32_t total_size; 4797edfc1bSMark Johnston uint32_t reserved[3]; 4897edfc1bSMark Johnston }; 4997edfc1bSMark Johnston 5097edfc1bSMark Johnston struct ucode_intel_extsig_table { 5197edfc1bSMark Johnston uint32_t signature_count; 5297edfc1bSMark Johnston uint32_t signature_table_checksum; 5397edfc1bSMark Johnston uint32_t reserved[3]; 5497edfc1bSMark Johnston struct ucode_intel_extsig { 5597edfc1bSMark Johnston uint32_t processor_signature; 5697edfc1bSMark Johnston uint32_t processor_flags; 5797edfc1bSMark Johnston uint32_t checksum; 5897edfc1bSMark Johnston } entries[0]; 5997edfc1bSMark Johnston }; 6097edfc1bSMark Johnston 61*d5089b3aSMark Johnston int ucode_intel_load(void *data, bool unsafe, 62*d5089b3aSMark Johnston uint64_t *nrevp, uint64_t *orevp); 6397edfc1bSMark Johnston size_t ucode_load_bsp(uintptr_t free); 6497edfc1bSMark Johnston void ucode_load_ap(int cpu); 6597edfc1bSMark Johnston void ucode_reload(void); 6697edfc1bSMark Johnston void * ucode_update(void *data); 6797edfc1bSMark Johnston 6897edfc1bSMark Johnston #endif /* _MACHINE_UCODE_H_ */ 69