| 1 | /*	$OpenBSD: kexec.h,v 1.1 2025/11/12 11:34:36 hshoexer Exp $	*/ |
| 2 | |
| 3 | /* |
| 4 | * Copyright (c) 2019-2020 Visa Hankala |
| 5 | * Copyright (c) 2025 Hans-Joerg Hoexer <hshoexer@yerbouti.franken.de> |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for any |
| 8 | * purpose with or without fee is hereby granted, provided that the above |
| 9 | * copyright notice and this permission notice appear in all copies. |
| 10 | * |
| 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 18 | */ |
| 19 | |
| 20 | #ifndef _MACHINE_KEXEC_H_ |
| 21 | #define _MACHINE_KEXEC_H_ |
| 22 | |
| 23 | #include <sys/ioccom.h> |
| 24 | |
| 25 | #define KEXEC_TRAMPOLINE	(35 * NBPG)	/* @ 140 Kb */ |
| 26 | #define KEXEC_TRAMP_DATA	(36 * NBPG) |
| 27 | #define PA_KERN			(16*1024*1024)	/* @ 16 Mb */ |
| 28 | |
| 29 | #ifndef _LOCORE |
| 30 | |
| 31 | #define KEXEC_MAX_ARGS	8	/* maximum number of boot arguments */ |
| 32 | |
| 33 | struct kexec_args { |
| 34 | 	char		*kimg;		/* kernel image buffer */ |
| 35 | 	size_t		klen;		/* size of kernel image */ |
| 36 | 	int		boothowto; |
| 37 | 	u_char		bootduid[8]; |
| 38 | }; |
| 39 | |
| 40 | #define KIOC_KEXEC		_IOW('K', 1, struct kexec_args) |
| 41 | #define KIOC_GETBOOTDUID	_IOR('K', 2, u_char[8]) |
| 42 | |
| 43 | extern unsigned int	kexec_size; |
| 44 | extern void		kexec_tramp(vaddr_t, vaddr_t, paddr_t, size_t, vaddr_t); |
| 45 | |
| 46 | #endif	/* !_LOCORE */ |
| 47 | |
| 48 | #endif /* _MACHINE_KEXEC_H_ */ |