2898 void *
2899 defcons_init(size_t size)
2900 {
2901 static char *p = NULL;
2902
2903 p = do_bsys_alloc(NULL, NULL, size, MMU_PAGESIZE);
2904 *p = 0;
2905 bsetprop32("deferred-console-buf", (uint32_t)((uintptr_t)&p));
2906 return (p);
2907 }
2908
2909 /*ARGSUSED*/
2910 int
2911 boot_compinfo(int fd, struct compinfo *cbp)
2912 {
2913 cbp->iscmp = 0;
2914 cbp->blksize = MAXBSIZE;
2915 return (0);
2916 }
2917
2918 #define BP_MAX_STRLEN 32
2919
2920 /*
2921 * Get value for given boot property
2922 */
2923 int
2924 bootprop_getval(const char *prop_name, u_longlong_t *prop_value)
2925 {
2926 int boot_prop_len;
2927 char str[BP_MAX_STRLEN];
2928 u_longlong_t value;
2929
2930 boot_prop_len = BOP_GETPROPLEN(bootops, prop_name);
2931 if (boot_prop_len < 0 || boot_prop_len > sizeof (str) ||
2932 BOP_GETPROP(bootops, prop_name, str) < 0 ||
2933 kobj_getvalue(str, &value) == -1)
2934 return (-1);
2935
2936 if (prop_value)
2937 *prop_value = value;
2938
2939 return (0);
2940 }
|
2898 void *
2899 defcons_init(size_t size)
2900 {
2901 static char *p = NULL;
2902
2903 p = do_bsys_alloc(NULL, NULL, size, MMU_PAGESIZE);
2904 *p = 0;
2905 bsetprop32("deferred-console-buf", (uint32_t)((uintptr_t)&p));
2906 return (p);
2907 }
2908
2909 /*ARGSUSED*/
2910 int
2911 boot_compinfo(int fd, struct compinfo *cbp)
2912 {
2913 cbp->iscmp = 0;
2914 cbp->blksize = MAXBSIZE;
2915 return (0);
2916 }
2917
2918 /*
2919 * Get an integer value for given boot property
2920 */
2921 int
2922 bootprop_getval(const char *prop_name, u_longlong_t *prop_value)
2923 {
2924 int boot_prop_len;
2925 char str[BP_MAX_STRLEN];
2926 u_longlong_t value;
2927
2928 boot_prop_len = BOP_GETPROPLEN(bootops, prop_name);
2929 if (boot_prop_len < 0 || boot_prop_len >= sizeof (str) ||
2930 BOP_GETPROP(bootops, prop_name, str) < 0 ||
2931 kobj_getvalue(str, &value) == -1)
2932 return (-1);
2933
2934 if (prop_value)
2935 *prop_value = value;
2936
2937 return (0);
2938 }
2939
2940 int
2941 bootprop_getstr(const char *prop_name, char *buf, size_t buflen)
2942 {
2943 int boot_prop_len = BOP_GETPROPLEN(bootops, prop_name);
2944
2945 if (boot_prop_len < 0 || boot_prop_len >= buflen ||
2946 BOP_GETPROP(bootops, prop_name, buf) < 0)
2947 return (-1);
2948
2949 return (0);
2950 }
|