1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright (c) 2018, Joyent, Inc.
14  */
15 
16 #ifndef	_TOPO_USB_INT_H
17 #define	_TOPO_USB_INT_H
18 
19 #include <stdint.h>
20 #include <sys/types.h>
21 #include <fm/topo_list.h>
22 #include <fm/topo_mod.h>
23 #include <sys/fm/protocol.h>
24 
25 #include "acpi.h"
26 #include "accommon.h"
27 #include "acbuffer.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 typedef enum topo_usb_path_type {
34 	TOPO_USB_T_ACPI
35 } topo_usb_path_type_t;
36 
37 typedef struct topo_usb_meta_port_path {
38 	topo_list_t		tmpp_link;
39 	topo_usb_path_type_t	tmpp_type;
40 	char			*tmpp_path;
41 } topo_usb_meta_port_path_t;
42 
43 typedef enum topo_usb_meta_port_flags {
44 	TOPO_USB_F_INTERNAL	= 1 << 0,
45 	TOPO_USB_F_EXTERNAL	= 1 << 1,
46 	TOPO_USB_F_CHASSIS	= 1 << 2,
47 } topo_usb_meta_port_flags_t;
48 
49 typedef struct topo_usb_meta_port {
50 	topo_list_t			tmp_link;
51 	topo_usb_meta_port_flags_t	tmp_flags;
52 	uint_t				tmp_port_type;
53 	char				*tmp_label;
54 	topo_list_t			tmp_paths;
55 } topo_usb_meta_port_t;
56 
57 typedef enum topo_usb_meta_flags {
58 	TOPO_USB_M_ACPI_MATCH	= 1 << 0,
59 	TOPO_USB_M_NO_ACPI	= 1 << 1,
60 	TOPO_USB_M_METADATA_MATCH = 1 << 2
61 } topo_usb_meta_flags_t;
62 
63 extern int topo_usb_load_metadata(topo_mod_t *, tnode_t *, topo_list_t *,
64     topo_usb_meta_flags_t *);
65 extern void topo_usb_free_metadata(topo_mod_t *, topo_list_t *);
66 
67 typedef ACPI_PLD_INFO	acpi_pld_info_t;
68 extern boolean_t usbtopo_decode_pld(uint8_t *, size_t, acpi_pld_info_t *);
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif /* _TOPO_USB_INT_H */
75