diff options
author | Richard Lowe <richlowe@richlowe.net> | 2021-06-04 15:15:12 -0500 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2021-08-16 12:46:39 -0500 |
commit | f0089e391b2bc4be2755f1a1b51fb4cd9b8f3988 (patch) | |
tree | c4ac2f5e703ed459d50bcee7ddb38a993d961520 /usr/src/uts/intel/os/bootdev.c | |
parent | d083fed0c91296a88878f7a468910ad5b5c888ea (diff) | |
download | illumos-gate-f0089e391b2bc4be2755f1a1b51fb4cd9b8f3988.tar.gz |
13941 intel code and headers should not look ia32 specific
Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Patrick Mooney <pmooney@pfmooney.com>
Approved by: Garret D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src/uts/intel/os/bootdev.c')
-rw-r--r-- | usr/src/uts/intel/os/bootdev.c | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/usr/src/uts/intel/os/bootdev.c b/usr/src/uts/intel/os/bootdev.c new file mode 100644 index 0000000000..02f31efd56 --- /dev/null +++ b/usr/src/uts/intel/os/bootdev.c @@ -0,0 +1,100 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include <sys/modctl.h> +#include <sys/sunddi.h> + +/* internal global data */ +static struct modlmisc modlmisc = { + &mod_miscops, "bootdev misc module" +}; + +static struct modlinkage modlinkage = { + MODREV_1, (void *)&modlmisc, NULL +}; + +int +_init() +{ + return (mod_install(&modlinkage)); +} + +int +_fini() +{ + return (mod_remove(&modlinkage)); +} + +int +_info(struct modinfo *modinfop) +{ + return (mod_info(&modlinkage, modinfop)); +} + +/* + * convert a prom device path to an equivalent path in /devices + * Does not deal with aliases. Does deal with pathnames which + * are not fully qualified. This routine is generalized + * to work across several flavors of OBP + */ +int +i_promname_to_devname(char *prom_name, char *ret_buf) +{ + if (prom_name == NULL || ret_buf == NULL || + (strlen(prom_name) >= MAXPATHLEN)) { + return (EINVAL); + } + if (i_ddi_prompath_to_devfspath(prom_name, ret_buf) != DDI_SUCCESS) + return (EINVAL); + + return (0); +} + +/* + * If bootstring contains a device path, we need to convert to a format + * the prom will understand. To do so, we convert the existing path to + * a prom-compatible path and return the value of new_path. If the + * caller specifies new_path as NULL, we allocate an appropriately + * sized new_path on behalf of the caller. If the caller invokes this + * function with new_path = NULL, they must do so from a context in + * which it is safe to perform a sleeping memory allocation. + * + * NOTE: Intel does not have a real PROM, so the implementation + * simply returns a copy of the string passed in. + */ +char * +i_convert_boot_device_name(char *cur_path, char *new_path, size_t *len) +{ + if (new_path != NULL) { + (void) snprintf(new_path, *len, "%s", cur_path); + return (new_path); + } else { + *len = strlen(cur_path) + 1; + new_path = kmem_alloc(*len, KM_SLEEP); + (void) snprintf(new_path, *len, "%s", cur_path); + return (new_path); + } +} |