coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
acpi_pld.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef __ACPI_ACPI_PLD_H__
4 #define __ACPI_ACPI_PLD_H__
5 
6 #include <acpi/acpi.h>
7 #include <stdint.h>
8 
17 };
18 
23 };
24 
25 /*
26  * The ACPI spec 6.2A does not define the horizontal position field.
27  * These values are taken from the IASL compiler:
28  * https://github.com/acpica/acpica/blob/master/source/components/utilities/utglobal.c#L321
29  */
30 
35 };
36 
47 };
48 
52 };
53 
63 };
64 
65 #define ACPI_PLD_GROUP(__token, __position) \
66  { \
67  .token = __token, \
68  .position = __position, \
69  }
70 
71 /*
72  * ACPI specification 6.3 third paragraph of section 6.1.8:
73  * All Panel references (Top, Bottom, Right, Left, etc.) are interpreted
74  * as though the user is facing the front of the system.
75  *
76  * A `_PLD` describes the offset and rotation of a single device connection point
77  * from an `origin` that resides in the lower left hand corner of its Panel.
78  */
79 
80 #define ACPI_PLD_TYPE_A(__panel, __horiz, __grp) \
81  { \
82  .visible = true, \
83  .panel = PLD_PANEL_##__panel, \
84  .shape = PLD_SHAPE_HORIZONTAL_RECTANGLE, \
85  .horizontal_position = PLD_HORIZONTAL_POSITION_##__horiz, \
86  .group = __grp, \
87  }
88 
89 #define ACPI_PLD_TYPE_C(__panel, __horiz, __grp) \
90  { \
91  .visible = true, \
92  .panel = PLD_PANEL_##__panel, \
93  .shape = PLD_SHAPE_OVAL, \
94  .horizontal_position = PLD_HORIZONTAL_POSITION_##__horiz, \
95  .group = __grp, \
96  }
97 
101 };
102 
103 struct acpi_pld {
104  /* Color field can be explicitly ignored */
109 
110  /* Port characteristics */
111  bool visible; /* Can be seen by the user */
112  bool lid; /* Port is on lid of device */
113  bool dock; /* Port is in a docking station */
114  bool bay; /* Port is in a bay */
115  bool ejectable; /* Device is ejectable, has _EJx objects */
116  bool ejectable_ospm; /* Device needs OSPM to eject */
117  uint16_t width; /* Width in mm */
118  uint16_t height; /* Height in mm */
121  enum acpi_pld_panel panel;
124  enum acpi_pld_shape shape;
126 
127  /* Port grouping */
129  struct acpi_pld_group group;
133 
134  /* Set if this PLD defines a reference shape */
136 };
137 
138 /* Fill out PLD structure with defaults based on USB port type */
139 int acpi_pld_fill_usb(struct acpi_pld *pld, enum acpi_upc_type type,
140  struct acpi_pld_group *group);
141 
142 /* Turn PLD structure into a 20 byte ACPI buffer */
143 int acpi_pld_to_buffer(const struct acpi_pld *pld, uint8_t *buf, int buf_len);
144 
145 #endif /* __ACPI_ACPI_PLD_H__ */
int acpi_pld_to_buffer(const struct acpi_pld *pld, uint8_t *buf, int buf_len)
Definition: pld.c:56
acpi_pld_orientation
Definition: acpi_pld.h:49
@ PLD_ORIENTATION_HORIZONTAL
Definition: acpi_pld.h:50
@ PLD_ORIENTATION_VERTICAL
Definition: acpi_pld.h:51
acpi_pld_shape
Definition: acpi_pld.h:37
@ PLD_SHAPE_UNKNOWN
Definition: acpi_pld.h:45
@ PLD_SHAPE_VERTICAL_TRAPEZOID
Definition: acpi_pld.h:43
@ PLD_SHAPE_ROUND
Definition: acpi_pld.h:38
@ PLD_SHAPE_CHAMFERED
Definition: acpi_pld.h:46
@ PLD_SHAPE_OVAL
Definition: acpi_pld.h:39
@ PLD_SHAPE_SQUARE
Definition: acpi_pld.h:40
@ PLD_SHAPE_HORIZONTAL_TRAPEZOID
Definition: acpi_pld.h:44
@ PLD_SHAPE_VERTICAL_RECTANGLE
Definition: acpi_pld.h:41
@ PLD_SHAPE_HORIZONTAL_RECTANGLE
Definition: acpi_pld.h:42
acpi_pld_horizontal_position
Definition: acpi_pld.h:31
@ PLD_HORIZONTAL_POSITION_LEFT
Definition: acpi_pld.h:32
@ PLD_HORIZONTAL_POSITION_RIGHT
Definition: acpi_pld.h:34
@ PLD_HORIZONTAL_POSITION_CENTER
Definition: acpi_pld.h:33
int acpi_pld_fill_usb(struct acpi_pld *pld, enum acpi_upc_type type, struct acpi_pld_group *group)
Definition: pld.c:8
acpi_pld_panel
Definition: acpi_pld.h:9
@ PLD_PANEL_RIGHT
Definition: acpi_pld.h:13
@ PLD_PANEL_BACK
Definition: acpi_pld.h:15
@ PLD_PANEL_TOP
Definition: acpi_pld.h:10
@ PLD_PANEL_FRONT
Definition: acpi_pld.h:14
@ PLD_PANEL_BOTTOM
Definition: acpi_pld.h:11
@ PLD_PANEL_LEFT
Definition: acpi_pld.h:12
@ PLD_PANEL_UNKNOWN
Definition: acpi_pld.h:16
acpi_pld_vertical_position
Definition: acpi_pld.h:19
@ PLD_VERTICAL_POSITION_LOWER
Definition: acpi_pld.h:22
@ PLD_VERTICAL_POSITION_CENTER
Definition: acpi_pld.h:21
@ PLD_VERTICAL_POSITION_UPPER
Definition: acpi_pld.h:20
acpi_pld_rotate
Definition: acpi_pld.h:54
@ PLD_ROTATE_225
Definition: acpi_pld.h:60
@ PLD_ROTATE_0
Definition: acpi_pld.h:55
@ PLD_ROTATE_45
Definition: acpi_pld.h:56
@ PLD_ROTATE_180
Definition: acpi_pld.h:59
@ PLD_ROTATE_90
Definition: acpi_pld.h:57
@ PLD_ROTATE_135
Definition: acpi_pld.h:58
@ PLD_ROTATE_270
Definition: acpi_pld.h:61
@ PLD_ROTATE_315
Definition: acpi_pld.h:62
acpi_upc_type
Definition: acpi.h:1038
unsigned int type
Definition: edid.c:57
static uint8_t * buf
Definition: uart.c:7
unsigned short uint16_t
Definition: stdint.h:11
unsigned char uint8_t
Definition: stdint.h:8
uint8_t position
Definition: acpi_pld.h:100
uint8_t token
Definition: acpi_pld.h:99
uint8_t card_cage_number
Definition: acpi_pld.h:132
uint8_t color_red
Definition: acpi_pld.h:106
enum acpi_pld_vertical_position vertical_position
Definition: acpi_pld.h:123
uint16_t height
Definition: acpi_pld.h:118
enum acpi_pld_horizontal_position horizontal_position
Definition: acpi_pld.h:122
uint8_t color_blue
Definition: acpi_pld.h:107
uint8_t color_green
Definition: acpi_pld.h:108
enum acpi_pld_orientation orientation
Definition: acpi_pld.h:128
bool ejectable
Definition: acpi_pld.h:115
uint16_t horizontal_offset
Definition: acpi_pld.h:120
enum acpi_pld_panel panel
Definition: acpi_pld.h:121
uint16_t width
Definition: acpi_pld.h:117
bool reference_shape
Definition: acpi_pld.h:135
bool ejectable_ospm
Definition: acpi_pld.h:116
bool bay
Definition: acpi_pld.h:114
bool lid
Definition: acpi_pld.h:112
struct acpi_pld_group group
Definition: acpi_pld.h:129
uint16_t vertical_offset
Definition: acpi_pld.h:119
bool visible
Definition: acpi_pld.h:111
bool ignore_color
Definition: acpi_pld.h:105
bool dock
Definition: acpi_pld.h:113
uint8_t draw_order
Definition: acpi_pld.h:130
enum acpi_pld_shape shape
Definition: acpi_pld.h:124
uint8_t cabinet_number
Definition: acpi_pld.h:131
enum acpi_pld_rotate rotation
Definition: acpi_pld.h:125