linux/drivers/platform/x86/hp/hp-bioscfg/bioscfg.h

/* SPDX-License-Identifier: GPL-2.0
 *
 * Definitions for kernel modules using hp_bioscfg driver
 *
 *  Copyright (c) 2022 HP Development Company, L.P.
 */

#ifndef _HP_BIOSCFG_H_
#define _HP_BIOSCFG_H_

#include <linux/wmi.h>
#include <linux/types.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/nls.h>

#define DRIVER_NAME

#define MAX_BUFF_SIZE
#define MAX_KEY_MOD_SIZE
#define MAX_PASSWD_SIZE
#define MAX_PREREQUISITES_SIZE
#define MAX_REQ_ELEM_SIZE
#define MAX_VALUES_SIZE
#define MAX_ENCODINGS_SIZE
#define MAX_ELEMENTS_SIZE

#define SPM_STR_DESC
#define SPM_STR
#define SURE_START_DESC
#define SURE_START_STR
#define SETUP_PASSWD
#define POWER_ON_PASSWD

#define LANG_CODE_STR
#define SCHEDULE_POWER_ON

#define COMMA_SEP
#define SEMICOLON_SEP

/* Sure Admin Functions */

#define UTF_PREFIX
#define BEAM_PREFIX

enum mechanism_values {};

#define BIOS_ADMIN
#define POWER_ON
#define BIOS_SPM

#define PASSWD_MECHANISM_TYPES

#define HP_WMI_BIOS_GUID

#define HP_WMI_BIOS_STRING_GUID
#define HP_WMI_BIOS_INTEGER_GUID
#define HP_WMI_BIOS_ENUMERATION_GUID
#define HP_WMI_BIOS_ORDERED_LIST_GUID
#define HP_WMI_BIOS_PASSWORD_GUID
#define HP_WMI_SET_BIOS_SETTING_GUID

enum hp_wmi_spm_commandtype {};

enum hp_wmi_surestart_commandtype {};

enum hp_wmi_command {};

struct bios_return {};

enum wmi_error_values {};

struct common_data {};

struct string_data {};

struct integer_data {};

struct enumeration_data {};

struct ordered_list_data {};

struct password_data {};

struct secure_platform_data {};

struct bioscfg_priv {};

/* global structure used by multiple WMI interfaces */
extern struct bioscfg_priv bioscfg_drv;

enum hp_wmi_data_type {};

enum hp_wmi_data_elements {};

#define GET_INSTANCE_ID(type)

#define ATTRIBUTE_S_PROPERTY_SHOW(name, type)

#define ATTRIBUTE_N_PROPERTY_SHOW(name, type)

#define ATTRIBUTE_PROPERTY_STORE(curr_val, type)

#define ATTRIBUTE_SPM_N_PROPERTY_SHOW(name, type)

#define ATTRIBUTE_SPM_S_PROPERTY_SHOW(name, type)

#define ATTRIBUTE_VALUES_PROPERTY_SHOW(name, type, sep)

#define ATTRIBUTE_S_COMMON_PROPERTY_SHOW(name, type)

extern struct kobj_attribute common_display_langcode;

/* Prototypes */

/* String attributes */
int hp_populate_string_buffer_data(u8 *buffer_ptr, u32 *buffer_size,
				   int instance_id,
				   struct kobject *attr_name_kobj);
int hp_alloc_string_data(void);
void hp_exit_string_attributes(void);
int hp_populate_string_package_data(union acpi_object *str_obj,
				    int instance_id,
				    struct kobject *attr_name_kobj);

/* Integer attributes */
int hp_populate_integer_buffer_data(u8 *buffer_ptr, u32 *buffer_size,
				    int instance_id,
				    struct kobject *attr_name_kobj);
int hp_alloc_integer_data(void);
void hp_exit_integer_attributes(void);
int hp_populate_integer_package_data(union acpi_object *integer_obj,
				     int instance_id,
				     struct kobject *attr_name_kobj);

/* Enumeration attributes */
int hp_populate_enumeration_buffer_data(u8 *buffer_ptr, u32 *buffer_size,
					int instance_id,
					struct kobject *attr_name_kobj);
int hp_alloc_enumeration_data(void);
void hp_exit_enumeration_attributes(void);
int hp_populate_enumeration_package_data(union acpi_object *enum_obj,
					 int instance_id,
					 struct kobject *attr_name_kobj);

/* Ordered list */
int hp_populate_ordered_list_buffer_data(u8 *buffer_ptr,
					 u32 *buffer_size,
					 int instance_id,
					 struct kobject *attr_name_kobj);
int hp_alloc_ordered_list_data(void);
void hp_exit_ordered_list_attributes(void);
int hp_populate_ordered_list_package_data(union acpi_object *order_obj,
					  int instance_id,
					  struct kobject *attr_name_kobj);

/* Password authentication attributes */
int hp_populate_password_buffer_data(u8 *buffer_ptr, u32 *buffer_size,
				     int instance_id,
				     struct kobject *attr_name_kobj);
int hp_populate_password_package_data(union acpi_object *password_obj,
				      int instance_id,
				      struct kobject *attr_name_kobj);
int hp_alloc_password_data(void);
int hp_get_password_instance_for_type(const char *name);
int hp_clear_all_credentials(void);
int hp_set_attribute(const char *a_name, const char *a_value);

/* SPM attributes */
void hp_exit_password_attributes(void);
void hp_exit_secure_platform_attributes(void);
int hp_populate_secure_platform_data(struct kobject *attr_name_kobj);
int hp_populate_security_buffer(u16 *buffer, const char *authentication);

/* Bios Attributes interface */
int hp_wmi_set_bios_setting(u16 *input_buffer, u32 input_size);
int hp_wmi_perform_query(int query, enum hp_wmi_command command,
			 void *buffer, u32 insize, u32 outsize);

/* Sure Start attributes */
void hp_exit_sure_start_attributes(void);
int hp_populate_sure_start_data(struct kobject *attr_name_kobj);

/* Bioscfg */

void hp_exit_attr_set_interface(void);
int hp_init_attr_set_interface(void);
size_t hp_calculate_string_buffer(const char *str);
size_t hp_calculate_security_buffer(const char *authentication);
void *hp_ascii_to_utf16_unicode(u16 *p, const u8 *str);
int hp_get_integer_from_buffer(u8 **buffer, u32 *buffer_size, u32 *integer);
int hp_get_string_from_buffer(u8 **buffer, u32 *buffer_size, char *dst, u32 dst_size);
int hp_convert_hexstr_to_str(const char *input, u32 input_len, char **str, int *len);
int hp_encode_outsize_for_pvsz(int outsize);
int hp_enforce_single_line_input(char *buf, size_t count);
void hp_set_reboot_and_signal_event(void);
ssize_t display_name_language_code_show(struct kobject *kobj,
					struct kobj_attribute *attr,
					char *buf);
union acpi_object *hp_get_wmiobj_pointer(int instance_id, const char *guid_string);
int hp_get_instance_count(const char *guid_string);
void hp_update_attribute_permissions(bool isreadonly, struct kobj_attribute *current_val);
void hp_friendly_user_name_update(char *path, const char *attr_name,
				  char *attr_display, int attr_size);
int hp_wmi_error_and_message(int error_code);
int hp_get_common_data_from_buffer(u8 **buffer_ptr, u32 *buffer_size, struct common_data *common);

#endif