1246145Shselasky/* $FreeBSD: releng/11.0/sys/boot/kshim/sysinit.h 269541 2014-08-04 23:00:13Z brooks $ */ 2246145Shselasky/*- 3246145Shselasky * Copyright (c) 2013 Hans Petter Selasky. All rights reserved. 4246145Shselasky * 5246145Shselasky * Redistribution and use in source and binary forms, with or without 6246145Shselasky * modification, are permitted provided that the following conditions 7246145Shselasky * are met: 8246145Shselasky * 1. Redistributions of source code must retain the above copyright 9246145Shselasky * notice, this list of conditions and the following disclaimer. 10246145Shselasky * 2. Redistributions in binary form must reproduce the above copyright 11246145Shselasky * notice, this list of conditions and the following disclaimer in the 12246145Shselasky * documentation and/or other materials provided with the distribution. 13246145Shselasky * 14246145Shselasky * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15246145Shselasky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16246145Shselasky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17246145Shselasky * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18246145Shselasky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19246145Shselasky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20246145Shselasky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21246145Shselasky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22246145Shselasky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23246145Shselasky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24246145Shselasky * SUCH DAMAGE. 25246145Shselasky */ 26246145Shselasky 27246145Shselasky#ifndef _SYSINIT_H_ 28246145Shselasky#define _SYSINIT_H_ 29246145Shselasky 30246145Shselaskystruct sysinit_data { 31246145Shselasky uint8_t b_keyword_name[64]; 32246145Shselasky uint8_t b_debug_info[128]; 33246145Shselasky uint8_t b_global_type[128]; 34246145Shselasky uint8_t b_global_name[128]; 35246145Shselasky uint8_t b_file_name[256]; 36246145Shselasky uint32_t dw_endian32; 37246145Shselasky uint32_t dw_msb_value; /* must be non-zero, else entry is skipped */ 38246145Shselasky uint32_t dw_lsb_value; 39246145Shselasky uint32_t dw_file_line; 40246145Shselasky} __attribute__((__packed__)); 41246145Shselasky 42246145Shselasky#define SYSINIT_ENTRY(uniq, keyword, msb, lsb, g_type, g_name, debug) \ 43246145Shselasky static const struct sysinit_data sysinit_##uniq \ 44246145Shselasky __attribute__((__section__(".debug.sysinit"), \ 45246145Shselasky __used__, __aligned__(1))) = { \ 46246145Shselasky .b_keyword_name = { keyword }, \ 47246145Shselasky .b_debug_info = { debug }, \ 48246145Shselasky .b_global_type = { g_type }, \ 49246145Shselasky .b_global_name = { g_name }, \ 50246145Shselasky .b_file_name = { __FILE__ }, \ 51246145Shselasky .dw_endian32 = 0x76543210U, \ 52246145Shselasky .dw_msb_value = (msb), \ 53246145Shselasky .dw_lsb_value = (lsb), \ 54246145Shselasky .dw_file_line = __LINE__ \ 55246145Shselasky} 56246145Shselasky 57246145Shselasky#endif /* _SYSINIT_H_ */ 58