diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-07-16 19:37:59 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-07-16 19:37:59 +0000 |
commit | 5bfe628b2a9046acc6e6e65b403897cc33cd3cfe (patch) | |
tree | 9a4e36852ff302bc937471961f970670c5bbe547 /sys/arch/powerpc64/include | |
parent | 67d6e8ffc7d11b8df98ca92e2828a8095b473326 (diff) |
Add a pseudo-driver to "kexec" an OpenBSD/powerpc64 kernel. Heavily
based on the octboot driver that we use for octeon. To be used in the
bootloader kernel.
Diffstat (limited to 'sys/arch/powerpc64/include')
-rw-r--r-- | sys/arch/powerpc64/include/conf.h | 8 | ||||
-rw-r--r-- | sys/arch/powerpc64/include/kexec.h | 36 |
2 files changed, 44 insertions, 0 deletions
diff --git a/sys/arch/powerpc64/include/conf.h b/sys/arch/powerpc64/include/conf.h index 62f960b0155..28f660fe733 100644 --- a/sys/arch/powerpc64/include/conf.h +++ b/sys/arch/powerpc64/include/conf.h @@ -7,10 +7,18 @@ cdev_decl(mm); cdev_decl(opalcons); /* open, close, ioctl */ +#define cdev_kexec_init(c,n) { \ + dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ + (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ + (dev_type_stop((*))) nullop, 0, selfalse, \ + (dev_type_mmap((*))) enodev } + +/* open, close, ioctl */ #define cdev_openprom_init(c,n) { \ dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ (dev_type_stop((*))) nullop, 0, selfalse, \ (dev_type_mmap((*))) enodev } +cdev_decl(kexec); cdev_decl(openprom); diff --git a/sys/arch/powerpc64/include/kexec.h b/sys/arch/powerpc64/include/kexec.h new file mode 100644 index 00000000000..ca018e00b0b --- /dev/null +++ b/sys/arch/powerpc64/include/kexec.h @@ -0,0 +1,36 @@ +/* $OpenBSD: kexec.h,v 1.1 2020/07/16 19:37:58 kettenis Exp $ */ + +/* + * Copyright (c) 2019-2020 Visa Hankala + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_KEXEC_H_ +#define _MACHINE_KEXEC_H_ + +#include <sys/ioccom.h> + +#define KEXEC_MAX_ARGS 8 /* maximum number of boot arguments */ + +struct kexec_args { + char *kimg; /* kernel image buffer */ + size_t klen; /* size of kernel image */ + char *argv[KEXEC_MAX_ARGS]; + /* kernel boot arguments */ +}; + +#define KIOC_KEXEC _IOW('K', 1, struct kexec_args) +#define KIOC_GETBOOTDUID _IOW('K', 2, char[8]) + +#endif /* _MACHINE_KEXEC_H_ */ |