To reduce code and improve performance of the embedded controller firmware, pragma __aligned(2) or __aligned(4) are used when alignment to 16 or 32 bit boundary is expected. Define all ec_align to packed when compiling kernel.
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -188,12 +188,46 @@ · 187 unmodified lines | ||
| 188 | 188 | #ifndef __ACPI__ |
| 189 | 189 | |
| 190 | 190 | /* |
| 191 | − * Define __packed if someone hasn't beat us to it. Linux kernel style | |
| 192 | − * checking prefers __packed over __attribute__((packed)). | |
| 191 | + * Attributes for EC request and response packets. Just defining __packed | |
| 192 | + * results in inefficient assembly code on ARM, if the structure is actually | |
| 193 | + * 32-bit aligned, as it should be for all buffers. | |
| 194 | + * | |
| 195 | + * Be very careful when adding these to existing structures. They will round | |
| 196 | + * up the structure size to the specified boundary. | |
| 197 | + * | |
| 198 | + * Also be very careful to make that if a structure is included in some other | |
| 199 | + * parent structure that the alignment will still be true given the packing of | |
| 200 | + * the parent structure. This is particularly important if the sub-structure | |
| 201 | + * will be passed as a pointer to another function, since that function will | |
| 202 | + * not know about the misaligment caused by the parent structure's packing. | |
| 203 | + * | |
| 204 | + * Also be very careful using __packed - particularly when nesting non-packed | |
| 205 | + * structures inside packed ones. In fact, DO NOT use __packed directly; | |
| 206 | + * always use one of these attributes. | |
| 207 | + * | |
| 208 | + * Once everything is annotated properly, the following search strings should | |
| 209 | + * not return ANY matches in this file other than right here: | |
| 210 | + * | |
| 211 | + * "__packed" - generates inefficient code; all sub-structs must also be packed | |
| 212 | + * | |
| 213 | + * "struct [^_]" - all structs should be annotated, except for structs that are | |
| 214 | + * members of other structs/unions (and their original declarations should be | |
| 215 | + * annotated). | |
| 193 | 216 | */ |
| 194 | −#ifndef __packed | |
| 195 | −#define __packed __attribute__((packed)) | |
| 196 | −#endif | |
| 217 | + | |
| 218 | +/* | |
| 219 | + * Packed structures make no assumption about alignment, so they do inefficient | |
| 220 | + * byte-wise reads. | |
| 221 | + */ | |
| 222 | +#define __ec_align1 __packed | |
| 223 | +#define __ec_align2 __packed | |
| 224 | +#define __ec_align4 __packed | |
| 225 | +#define __ec_align_size1 __packed | |
| 226 | +#define __ec_align_offset1 __packed | |
| 227 | +#define __ec_align_offset2 __packed | |
| 228 | +#define __ec_todo_packed __packed | |
| 229 | +#define __ec_todo_unpacked | |
| 230 | + | |
| 197 | 231 | |
| 198 | 232 | /* LPC command status byte masks */ |
| 199 | 233 | /* EC has written a byte in the data register and host hasn't read it yet */ |
| @@ -317,7 +351,7 @@ struct ec_lpc_host_args { · 117 unmodified lines | ||
| 317 | 351 | uint8_t command_version; |
| 318 | 352 | uint8_t data_size; |
| 319 | 353 | uint8_t checksum; |
| 320 | −} __packed; | |
| 354 | +} __ec_align4; | |
| 321 | 355 | |
| 322 | 356 | /* Flags for ec_lpc_host_args.flags */ |
| 323 | 357 | /* |
| @@ -488,7 +522,7 @@ struct ec_host_request { · 164 unmodified lines | ||
| 488 | 522 | uint8_t command_version; |
| 489 | 523 | uint8_t reserved; |
| 490 | 524 | uint16_t data_len; |
| 491 | −} __packed; | |
| 525 | +} __ec_align4; | |
| 492 | 526 | |
| 493 | 527 | #define EC_HOST_RESPONSE_VERSION 3 |
| 494 | 528 | |
| @@ -507,7 +541,7 @@ struct ec_host_response { · 12 unmodified lines | ||
| 507 | 541 | uint16_t result; |
| 508 | 542 | uint16_t data_len; |
| 509 | 543 | uint16_t reserved; |
| 510 | −} __packed; | |
| 544 | +} __ec_align4; | |
| 511 | 545 | |
| 512 | 546 | /*****************************************************************************/ |
| 513 | 547 | /* |
| @@ -536,7 +570,7 @@ struct ec_host_response { · 22 unmodified lines | ||
| 536 | 570 | */ |
| 537 | 571 | struct ec_response_proto_version { |
| 538 | 572 | uint32_t version; |
| 539 | −} __packed; | |
| 573 | +} __ec_align4; | |
| 540 | 574 | |
| 541 | 575 | /* |
| 542 | 576 | * Hello. This is a simple command to test the EC is responsive to |
| @@ -550,7 +584,7 @@ struct ec_response_proto_version { · 7 unmodified lines | ||
| 550 | 584 | */ |
| 551 | 585 | struct ec_params_hello { |
| 552 | 586 | uint32_t in_data; |
| 553 | −} __packed; | |
| 587 | +} __ec_align4; | |
| 554 | 588 | |
| 555 | 589 | /** |
| 556 | 590 | * struct ec_response_hello - Response to the hello command. |
| @@ -558,7 +592,7 @@ struct ec_params_hello { · 1 unmodified line | ||
| 558 | 592 | */ |
| 559 | 593 | struct ec_response_hello { |
| 560 | 594 | uint32_t out_data; |
| 561 | −} __packed; | |
| 595 | +} __ec_align4; | |
| 562 | 596 | |
| 563 | 597 | /* Get version number */ |
| 564 | 598 | #define EC_CMD_GET_VERSION 0x02 |
| @@ -581,7 +615,7 @@ struct ec_response_get_version { · 16 unmodified lines | ||
| 581 | 615 | char version_string_rw[32]; |
| 582 | 616 | char reserved[32]; |
| 583 | 617 | uint32_t current_image; |
| 584 | −} __packed; | |
| 618 | +} __ec_align4; | |
| 585 | 619 | |
| 586 | 620 | /* Read test */ |
| 587 | 621 | #define EC_CMD_READ_TEST 0x03 |
| @@ -594,7 +628,7 @@ struct ec_response_get_version { · 6 unmodified lines | ||
| 594 | 628 | struct ec_params_read_test { |
| 595 | 629 | uint32_t offset; |
| 596 | 630 | uint32_t size; |
| 597 | −} __packed; | |
| 631 | +} __ec_align4; | |
| 598 | 632 | |
| 599 | 633 | /** |
| 600 | 634 | * struct ec_response_read_test - Response to the read test command. |
| @@ -602,7 +636,7 @@ struct ec_params_read_test { · 1 unmodified line | ||
| 602 | 636 | */ |
| 603 | 637 | struct ec_response_read_test { |
| 604 | 638 | uint32_t data[32]; |
| 605 | −} __packed; | |
| 639 | +} __ec_align4; | |
| 606 | 640 | |
| 607 | 641 | /* |
| 608 | 642 | * Get build information |
| @@ -624,7 +658,7 @@ struct ec_response_get_chip_info { · 15 unmodified lines | ||
| 624 | 658 | char vendor[32]; |
| 625 | 659 | char name[32]; |
| 626 | 660 | char revision[32]; |
| 627 | −} __packed; | |
| 661 | +} __ec_align4; | |
| 628 | 662 | |
| 629 | 663 | /* Get board HW version */ |
| 630 | 664 | #define EC_CMD_GET_BOARD_VERSION 0x06 |
| @@ -635,7 +669,7 @@ struct ec_response_get_chip_info { · 4 unmodified lines | ||
| 635 | 669 | */ |
| 636 | 670 | struct ec_response_board_version { |
| 637 | 671 | uint16_t board_version; |
| 638 | −} __packed; | |
| 672 | +} __ec_align2; | |
| 639 | 673 | |
| 640 | 674 | /* |
| 641 | 675 | * Read memory-mapped data. |
| @@ -655,7 +689,7 @@ struct ec_response_board_version { · 13 unmodified lines | ||
| 655 | 689 | struct ec_params_read_memmap { |
| 656 | 690 | uint8_t offset; |
| 657 | 691 | uint8_t size; |
| 658 | −} __packed; | |
| 692 | +} __ec_align1; | |
| 659 | 693 | |
| 660 | 694 | /* Read versions supported for a command */ |
| 661 | 695 | #define EC_CMD_GET_CMD_VERSIONS 0x08 |
| @@ -666,7 +700,7 @@ struct ec_params_read_memmap { · 4 unmodified lines | ||
| 666 | 700 | */ |
| 667 | 701 | struct ec_params_get_cmd_versions { |
| 668 | 702 | uint8_t cmd; |
| 669 | −} __packed; | |
| 703 | +} __ec_align1; | |
| 670 | 704 | |
| 671 | 705 | /** |
| 672 | 706 | * struct ec_params_get_cmd_versions_v1 - Parameters for the get command |
| @@ -675,7 +709,7 @@ struct ec_params_get_cmd_versions { · 2 unmodified lines | ||
| 675 | 709 | */ |
| 676 | 710 | struct ec_params_get_cmd_versions_v1 { |
| 677 | 711 | uint16_t cmd; |
| 678 | −} __packed; | |
| 712 | +} __ec_align2; | |
| 679 | 713 | |
| 680 | 714 | /** |
| 681 | 715 | * struct ec_response_get_cmd_version - Response to the get command versions. |
| @@ -684,7 +718,7 @@ struct ec_params_get_cmd_versions_v1 { · 2 unmodified lines | ||
| 684 | 718 | */ |
| 685 | 719 | struct ec_response_get_cmd_versions { |
| 686 | 720 | uint32_t version_mask; |
| 687 | −} __packed; | |
| 721 | +} __ec_align4; | |
| 688 | 722 | |
| 689 | 723 | /* |
| 690 | 724 | * Check EC communications status (busy). This is needed on i2c/spi but not |
| @@ -707,7 +741,7 @@ enum ec_comms_status { · 16 unmodified lines | ||
| 707 | 741 | */ |
| 708 | 742 | struct ec_response_get_comms_status { |
| 709 | 743 | uint32_t flags; /* Mask of enum ec_comms_status */ |
| 710 | −} __packed; | |
| 744 | +} __ec_align4; | |
| 711 | 745 | |
| 712 | 746 | /* Fake a variety of responses, purely for testing purposes. */ |
| 713 | 747 | #define EC_CMD_TEST_PROTOCOL 0x0a |
| @@ -717,12 +751,12 @@ struct ec_params_test_protocol { · 3 unmodified lines | ||
| 717 | 751 | uint32_t ec_result; |
| 718 | 752 | uint32_t ret_len; |
| 719 | 753 | uint8_t buf[32]; |
| 720 | −} __packed; | |
| 754 | +} __ec_align4; | |
| 721 | 755 | |
| 722 | 756 | /* Here it comes... */ |
| 723 | 757 | struct ec_response_test_protocol { |
| 724 | 758 | uint8_t buf[32]; |
| 725 | −} __packed; | |
| 759 | +} __ec_align4; | |
| 726 | 760 | |
| 727 | 761 | /* Get protocol information */ |
| 728 | 762 | #define EC_CMD_GET_PROTOCOL_INFO 0x0b |
| @@ -745,7 +779,7 @@ struct ec_response_get_protocol_info { · 16 unmodified lines | ||
| 745 | 779 | uint16_t max_request_packet_size; |
| 746 | 780 | uint16_t max_response_packet_size; |
| 747 | 781 | uint32_t flags; |
| 748 | −} __packed; | |
| 782 | +} __ec_align4; | |
| 749 | 783 | |
| 750 | 784 | |
| 751 | 785 | /*****************************************************************************/ |
| @@ -763,12 +797,12 @@ struct ec_response_get_protocol_info { · 11 unmodified lines | ||
| 763 | 797 | struct ec_params_get_set_value { |
| 764 | 798 | uint32_t flags; |
| 765 | 799 | uint32_t value; |
| 766 | −} __packed; | |
| 800 | +} __ec_align4; | |
| 767 | 801 | |
| 768 | 802 | struct ec_response_get_set_value { |
| 769 | 803 | uint32_t flags; |
| 770 | 804 | uint32_t value; |
| 771 | −} __packed; | |
| 805 | +} __ec_align4; | |
| 772 | 806 | |
| 773 | 807 | /* More than one command can use these structs to get/set parameters. */ |
| 774 | 808 | #define EC_CMD_GSV_PAUSE_IN_S5 0x0c |
| @@ -893,7 +927,7 @@ enum ec_feature_code { · 118 unmodified lines | ||
| 893 | 927 | |
| 894 | 928 | struct ec_response_get_features { |
| 895 | 929 | uint32_t flags[2]; |
| 896 | −} __packed; | |
| 930 | +} __ec_align4; | |
| 897 | 931 | |
| 898 | 932 | /*****************************************************************************/ |
| 899 | 933 | /* Flash commands */ |
| @@ -918,7 +952,7 @@ struct ec_response_flash_info { · 18 unmodified lines | ||
| 918 | 952 | uint32_t write_block_size; |
| 919 | 953 | uint32_t erase_block_size; |
| 920 | 954 | uint32_t protect_block_size; |
| 921 | −} __packed; | |
| 955 | +} __ec_align4; | |
| 922 | 956 | |
| 923 | 957 | /* |
| 924 | 958 | * Flags for version 1+ flash info command |
| @@ -959,7 +993,7 @@ struct ec_response_flash_info_1 { · 34 unmodified lines | ||
| 959 | 993 | /* Version 1 adds these fields: */ |
| 960 | 994 | uint32_t write_ideal_size; |
| 961 | 995 | uint32_t flags; |
| 962 | −} __packed; | |
| 996 | +} __ec_align4; | |
| 963 | 997 | |
| 964 | 998 | /* |
| 965 | 999 | * Read flash |
| @@ -976,7 +1010,7 @@ struct ec_response_flash_info_1 { · 10 unmodified lines | ||
| 976 | 1010 | struct ec_params_flash_read { |
| 977 | 1011 | uint32_t offset; |
| 978 | 1012 | uint32_t size; |
| 979 | −} __packed; | |
| 1013 | +} __ec_align4; | |
| 980 | 1014 | |
| 981 | 1015 | /* Write flash */ |
| 982 | 1016 | #define EC_CMD_FLASH_WRITE 0x12 |
| @@ -994,7 +1028,7 @@ struct ec_params_flash_write { · 11 unmodified lines | ||
| 994 | 1028 | uint32_t offset; |
| 995 | 1029 | uint32_t size; |
| 996 | 1030 | /* Followed by data to write */ |
| 997 | −} __packed; | |
| 1031 | +} __ec_align4; | |
| 998 | 1032 | |
| 999 | 1033 | /* Erase flash */ |
| 1000 | 1034 | #define EC_CMD_FLASH_ERASE 0x13 |
| @@ -1007,7 +1041,7 @@ struct ec_params_flash_write { · 6 unmodified lines | ||
| 1007 | 1041 | struct ec_params_flash_erase { |
| 1008 | 1042 | uint32_t offset; |
| 1009 | 1043 | uint32_t size; |
| 1010 | −} __packed; | |
| 1044 | +} __ec_align4; | |
| 1011 | 1045 | |
| 1012 | 1046 | /* |
| 1013 | 1047 | * Get/set flash protection. |
| @@ -1053,7 +1087,7 @@ struct ec_params_flash_erase { · 39 unmodified lines | ||
| 1053 | 1087 | struct ec_params_flash_protect { |
| 1054 | 1088 | uint32_t mask; |
| 1055 | 1089 | uint32_t flags; |
| 1056 | −} __packed; | |
| 1090 | +} __ec_align4; | |
| 1057 | 1091 | |
| 1058 | 1092 | /** |
| 1059 | 1093 | * struct ec_response_flash_protect - Response to the flash protect command. |
| @@ -1068,7 +1102,7 @@ struct ec_response_flash_protect { · 8 unmodified lines | ||
| 1068 | 1102 | uint32_t flags; |
| 1069 | 1103 | uint32_t valid_flags; |
| 1070 | 1104 | uint32_t writable_flags; |
| 1071 | −} __packed; | |
| 1105 | +} __ec_align4; | |
| 1072 | 1106 | |
| 1073 | 1107 | /* |
| 1074 | 1108 | * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash |
| @@ -1100,12 +1134,12 @@ enum ec_flash_region { · 25 unmodified lines | ||
| 1100 | 1134 | */ |
| 1101 | 1135 | struct ec_params_flash_region_info { |
| 1102 | 1136 | uint32_t region; |
| 1103 | −} __packed; | |
| 1137 | +} __ec_align4; | |
| 1104 | 1138 | |
| 1105 | 1139 | struct ec_response_flash_region_info { |
| 1106 | 1140 | uint32_t offset; |
| 1107 | 1141 | uint32_t size; |
| 1108 | −} __packed; | |
| 1142 | +} __ec_align4; | |
| 1109 | 1143 | |
| 1110 | 1144 | /* Read/write VbNvContext */ |
| 1111 | 1145 | #define EC_CMD_VBNV_CONTEXT 0x17 |
| @@ -1120,11 +1154,11 @@ enum ec_vbnvcontext_op { · 8 unmodified lines | ||
| 1120 | 1154 | struct ec_params_vbnvcontext { |
| 1121 | 1155 | uint32_t op; |
| 1122 | 1156 | uint8_t block[EC_VBNV_BLOCK_SIZE]; |
| 1123 | −} __packed; | |
| 1157 | +} __ec_align4; | |
| 1124 | 1158 | |
| 1125 | 1159 | struct ec_response_vbnvcontext { |
| 1126 | 1160 | uint8_t block[EC_VBNV_BLOCK_SIZE]; |
| 1127 | −} __packed; | |
| 1161 | +} __ec_align4; | |
| 1128 | 1162 | |
| 1129 | 1163 | /*****************************************************************************/ |
| 1130 | 1164 | /* PWM commands */ |
| @@ -1134,14 +1168,14 @@ struct ec_response_vbnvcontext { · 3 unmodified lines | ||
| 1134 | 1168 | |
| 1135 | 1169 | struct ec_response_pwm_get_fan_rpm { |
| 1136 | 1170 | uint32_t rpm; |
| 1137 | −} __packed; | |
| 1171 | +} __ec_align4; | |
| 1138 | 1172 | |
| 1139 | 1173 | /* Set target fan RPM */ |
| 1140 | −#define EC_CMD_PWM_SET_FAN_TARGET_RPM 0x21 | |
| 1174 | +#define EC_CMD_PWM_SET_FAN_TARGET_RPM 0x0021 | |
| 1141 | 1175 | |
| 1142 | 1176 | struct ec_params_pwm_set_fan_target_rpm { |
| 1143 | 1177 | uint32_t rpm; |
| 1144 | −} __packed; | |
| 1178 | +} __ec_align_size1; | |
| 1145 | 1179 | |
| 1146 | 1180 | /* Get keyboard backlight */ |
| 1147 | 1181 | #define EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT 0x22 |
| @@ -1149,21 +1183,21 @@ struct ec_params_pwm_set_fan_target_rpm { · 1 unmodified line | ||
| 1149 | 1183 | struct ec_response_pwm_get_keyboard_backlight { |
| 1150 | 1184 | uint8_t percent; |
| 1151 | 1185 | uint8_t enabled; |
| 1152 | −} __packed; | |
| 1186 | +} __ec_align1; | |
| 1153 | 1187 | |
| 1154 | 1188 | /* Set keyboard backlight */ |
| 1155 | 1189 | #define EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT 0x23 |
| 1156 | 1190 | |
| 1157 | 1191 | struct ec_params_pwm_set_keyboard_backlight { |
| 1158 | 1192 | uint8_t percent; |
| 1159 | −} __packed; | |
| 1193 | +} __ec_align1; | |
| 1160 | 1194 | |
| 1161 | 1195 | /* Set target fan PWM duty cycle */ |
| 1162 | 1196 | #define EC_CMD_PWM_SET_FAN_DUTY 0x24 |
| 1163 | 1197 | |
| 1164 | 1198 | struct ec_params_pwm_set_fan_duty { |
| 1165 | 1199 | uint32_t percent; |
| 1166 | −} __packed; | |
| 1200 | +} __ec_align4; | |
| 1167 | 1201 | |
| 1168 | 1202 | #define EC_CMD_PWM_SET_DUTY 0x25 |
| 1169 | 1203 | /* 16 bit duty cycle, 0xffff = 100% */ |
| @@ -1183,18 +1217,18 @@ struct ec_params_pwm_set_duty { · 13 unmodified lines | ||
| 1183 | 1217 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ |
| 1184 | 1218 | uint8_t pwm_type; /* ec_pwm_type */ |
| 1185 | 1219 | uint8_t index; /* Type-specific index, or 0 if unique */ |
| 1186 | −} __packed; | |
| 1220 | +} __ec_align4; | |
| 1187 | 1221 | |
| 1188 | 1222 | #define EC_CMD_PWM_GET_DUTY 0x26 |
| 1189 | 1223 | |
| 1190 | 1224 | struct ec_params_pwm_get_duty { |
| 1191 | 1225 | uint8_t pwm_type; /* ec_pwm_type */ |
| 1192 | 1226 | uint8_t index; /* Type-specific index, or 0 if unique */ |
| 1193 | −} __packed; | |
| 1227 | +} __ec_align1; | |
| 1194 | 1228 | |
| 1195 | 1229 | struct ec_response_pwm_get_duty { |
| 1196 | 1230 | uint16_t duty; /* Duty cycle, EC_PWM_MAX_DUTY = 100% */ |
| 1197 | −} __packed; | |
| 1231 | +} __ec_align2; | |
| 1198 | 1232 | |
| 1199 | 1233 | /*****************************************************************************/ |
| 1200 | 1234 | /* |
| @@ -1207,7 +1241,7 @@ struct ec_response_pwm_get_duty { · 6 unmodified lines | ||
| 1207 | 1241 | |
| 1208 | 1242 | struct rgb_s { |
| 1209 | 1243 | uint8_t r, g, b; |
| 1210 | −}; | |
| 1244 | +} __ec_todo_unpacked; | |
| 1211 | 1245 | |
| 1212 | 1246 | #define LB_BATTERY_LEVELS 4 |
| 1213 | 1247 | |
| @@ -1247,7 +1281,7 @@ struct lightbar_params_v0 { · 33 unmodified lines | ||
| 1247 | 1281 | |
| 1248 | 1282 | /* Color palette */ |
| 1249 | 1283 | struct rgb_s color[8]; /* 0-3 are Google colors */ |
| 1250 | −} __packed; | |
| 1284 | +} __ec_todo_packed; | |
| 1251 | 1285 | |
| 1252 | 1286 | struct lightbar_params_v1 { |
| 1253 | 1287 | /* Timing */ |
| @@ -1290,14 +1324,14 @@ struct lightbar_params_v1 { · 36 unmodified lines | ||
| 1290 | 1324 | |
| 1291 | 1325 | /* Color palette */ |
| 1292 | 1326 | struct rgb_s color[8]; /* 0-3 are Google colors */ |
| 1293 | −} __packed; | |
| 1327 | +} __ec_todo_packed; | |
| 1294 | 1328 | |
| 1295 | 1329 | /* Lightbar program */ |
| 1296 | 1330 | #define EC_LB_PROG_LEN 192 |
| 1297 | 1331 | struct lightbar_program { |
| 1298 | 1332 | uint8_t size; |
| 1299 | 1333 | uint8_t data[EC_LB_PROG_LEN]; |
| 1300 | −}; | |
| 1334 | +} __ec_todo_unpacked; | |
| 1301 | 1335 | |
| 1302 | 1336 | struct ec_params_lightbar { |
| 1303 | 1337 | uint8_t cmd; /* Command (see enum lightbar_command) */ |
| @@ -1307,23 +1341,23 @@ struct ec_params_lightbar { · 3 unmodified lines | ||
| 1307 | 1341 | } dump, off, on, init, get_seq, get_params_v0, get_params_v1, |
| 1308 | 1342 | version, get_brightness, get_demo, suspend, resume; |
| 1309 | 1343 | |
| 1310 | − struct { | |
| 1344 | + struct __ec_todo_unpacked { | |
| 1311 | 1345 | uint8_t num; |
| 1312 | 1346 | } set_brightness, seq, demo; |
| 1313 | 1347 | |
| 1314 | − struct { | |
| 1348 | + struct __ec_todo_unpacked { | |
| 1315 | 1349 | uint8_t ctrl, reg, value; |
| 1316 | 1350 | } reg; |
| 1317 | 1351 | |
| 1318 | − struct { | |
| 1352 | + struct __ec_todo_unpacked { | |
| 1319 | 1353 | uint8_t led, red, green, blue; |
| 1320 | 1354 | } set_rgb; |
| 1321 | 1355 | |
| 1322 | − struct { | |
| 1356 | + struct __ec_todo_unpacked { | |
| 1323 | 1357 | uint8_t led; |
| 1324 | 1358 | } get_rgb; |
| 1325 | 1359 | |
| 1326 | − struct { | |
| 1360 | + struct __ec_todo_unpacked { | |
| 1327 | 1361 | uint8_t enable; |
| 1328 | 1362 | } manual_suspend_ctrl; |
| 1329 | 1363 | |
| @@ -1331,31 +1365,31 @@ struct ec_params_lightbar { · 1 unmodified line | ||
| 1331 | 1365 | struct lightbar_params_v1 set_params_v1; |
| 1332 | 1366 | struct lightbar_program set_program; |
| 1333 | 1367 | }; |
| 1334 | −} __packed; | |
| 1368 | +} __ec_todo_packed; | |
| 1335 | 1369 | |
| 1336 | 1370 | struct ec_response_lightbar { |
| 1337 | 1371 | union { |
| 1338 | − struct { | |
| 1339 | − struct { | |
| 1372 | + struct __ec_todo_unpacked { | |
| 1373 | + struct __ec_todo_unpacked { | |
| 1340 | 1374 | uint8_t reg; |
| 1341 | 1375 | uint8_t ic0; |
| 1342 | 1376 | uint8_t ic1; |
| 1343 | 1377 | } vals[23]; |
| 1344 | 1378 | } dump; |
| 1345 | 1379 | |
| 1346 | − struct { | |
| 1380 | + struct __ec_todo_unpacked { | |
| 1347 | 1381 | uint8_t num; |
| 1348 | 1382 | } get_seq, get_brightness, get_demo; |
| 1349 | 1383 | |
| 1350 | 1384 | struct lightbar_params_v0 get_params_v0; |
| 1351 | 1385 | struct lightbar_params_v1 get_params_v1; |
| 1352 | 1386 | |
| 1353 | − struct { | |
| 1387 | + struct __ec_todo_unpacked { | |
| 1354 | 1388 | uint32_t num; |
| 1355 | 1389 | uint32_t flags; |
| 1356 | 1390 | } version; |
| 1357 | 1391 | |
| 1358 | − struct { | |
| 1392 | + struct __ec_todo_unpacked { | |
| 1359 | 1393 | uint8_t red, green, blue; |
| 1360 | 1394 | } get_rgb; |
| 1361 | 1395 | |
| @@ -1365,7 +1399,7 @@ struct ec_response_lightbar { · 3 unmodified lines | ||
| 1365 | 1399 | demo, set_params_v0, set_params_v1, |
| 1366 | 1400 | set_program, manual_suspend_ctrl, suspend, resume; |
| 1367 | 1401 | }; |
| 1368 | −} __packed; | |
| 1402 | +} __ec_todo_packed; | |
| 1369 | 1403 | |
| 1370 | 1404 | /* Lightbar commands */ |
| 1371 | 1405 | enum lightbar_command { |
| @@ -1432,7 +1466,7 @@ struct ec_params_led_control { · 60 unmodified lines | ||
| 1432 | 1466 | uint8_t flags; /* Control flags */ |
| 1433 | 1467 | |
| 1434 | 1468 | uint8_t brightness[EC_LED_COLOR_COUNT]; |
| 1435 | −} __packed; | |
| 1469 | +} __ec_align1; | |
| 1436 | 1470 | |
| 1437 | 1471 | struct ec_response_led_control { |
| 1438 | 1472 | /* |
| @@ -1443,7 +1477,7 @@ struct ec_response_led_control { · 4 unmodified lines | ||
| 1443 | 1477 | * Other values means the LED is control by PWM. |
| 1444 | 1478 | */ |
| 1445 | 1479 | uint8_t brightness_range[EC_LED_COLOR_COUNT]; |
| 1446 | −} __packed; | |
| 1480 | +} __ec_align1; | |
| 1447 | 1481 | |
| 1448 | 1482 | /*****************************************************************************/ |
| 1449 | 1483 | /* Verified boot commands */ |
| @@ -1464,7 +1498,7 @@ struct ec_params_vboot_hash { · 14 unmodified lines | ||
| 1464 | 1498 | uint32_t offset; /* Offset in flash to hash */ |
| 1465 | 1499 | uint32_t size; /* Number of bytes to hash */ |
| 1466 | 1500 | uint8_t nonce_data[64]; /* Nonce data; ignored if nonce_size=0 */ |
| 1467 | −} __packed; | |
| 1501 | +} __ec_align4; | |
| 1468 | 1502 | |
| 1469 | 1503 | struct ec_response_vboot_hash { |
| 1470 | 1504 | uint8_t status; /* enum ec_vboot_hash_status */ |
| @@ -1474,7 +1508,7 @@ struct ec_response_vboot_hash { · 3 unmodified lines | ||
| 1474 | 1508 | uint32_t offset; /* Offset in flash which was hashed */ |
| 1475 | 1509 | uint32_t size; /* Number of bytes hashed */ |
| 1476 | 1510 | uint8_t hash_digest[64]; /* Hash digest data */ |
| 1477 | −} __packed; | |
| 1511 | +} __ec_align4; | |
| 1478 | 1512 | |
| 1479 | 1513 | enum ec_vboot_hash_cmd { |
| 1480 | 1514 | EC_VBOOT_HASH_GET = 0, /* Get current hash status */ |
| @@ -1634,23 +1668,23 @@ struct ec_response_motion_sensor_data { · 153 unmodified lines | ||
| 1634 | 1668 | /* Each sensor is up to 3-axis. */ |
| 1635 | 1669 | union { |
| 1636 | 1670 | int16_t data[3]; |
| 1637 | − struct { | |
| 1671 | + struct __ec_todo_packed { | |
| 1638 | 1672 | uint16_t reserved; |
| 1639 | 1673 | uint32_t timestamp; |
| 1640 | − } __packed; | |
| 1641 | − struct { | |
| 1674 | + }; | |
| 1675 | + struct __ec_todo_unpacked { | |
| 1642 | 1676 | uint8_t activity; /* motionsensor_activity */ |
| 1643 | 1677 | uint8_t state; |
| 1644 | 1678 | int16_t add_info[2]; |
| 1645 | 1679 | }; |
| 1646 | 1680 | }; |
| 1647 | −} __packed; | |
| 1681 | +} __ec_todo_packed; | |
| 1648 | 1682 | |
| 1649 | 1683 | struct ec_params_motion_sense { |
| 1650 | 1684 | uint8_t cmd; |
| 1651 | 1685 | union { |
| 1652 | 1686 | /* Used for MOTIONSENSE_CMD_DUMP. */ |
| 1653 | − struct { | |
| 1687 | + struct __ec_todo_unpacked { | |
| 1654 | 1688 | /* no args */ |
| 1655 | 1689 | } dump; |
| 1656 | 1690 | |
| @@ -1658,13 +1692,13 @@ struct ec_params_motion_sense { · 1 unmodified line | ||
| 1658 | 1692 | * Used for MOTIONSENSE_CMD_EC_RATE and |
| 1659 | 1693 | * MOTIONSENSE_CMD_KB_WAKE_ANGLE. |
| 1660 | 1694 | */ |
| 1661 | − struct { | |
| 1695 | + struct __ec_todo_unpacked { | |
| 1662 | 1696 | /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */ |
| 1663 | 1697 | int16_t data; |
| 1664 | 1698 | } ec_rate, kb_wake_angle; |
| 1665 | 1699 | |
| 1666 | 1700 | /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */ |
| 1667 | − struct { | |
| 1701 | + struct __ec_todo_packed { | |
| 1668 | 1702 | uint8_t sensor_num; |
| 1669 | 1703 | |
| 1670 | 1704 | /* |
| @@ -1690,10 +1724,10 @@ struct ec_params_motion_sense { · 19 unmodified lines | ||
| 1690 | 1724 | * Compass: 1/16 uT |
| 1691 | 1725 | */ |
| 1692 | 1726 | int16_t offset[3]; |
| 1693 | − } __packed sensor_offset; | |
| 1727 | + } sensor_offset; | |
| 1694 | 1728 | |
| 1695 | 1729 | /* Used for MOTIONSENSE_CMD_INFO. */ |
| 1696 | − struct { | |
| 1730 | + struct __ec_todo_packed { | |
| 1697 | 1731 | uint8_t sensor_num; |
| 1698 | 1732 | } info; |
| 1699 | 1733 | |
| @@ -1714,12 +1748,12 @@ struct ec_params_motion_sense { · 14 unmodified lines | ||
| 1714 | 1748 | int32_t data; |
| 1715 | 1749 | } sensor_odr, sensor_range; |
| 1716 | 1750 | }; |
| 1717 | −} __packed; | |
| 1751 | +} __ec_todo_packed; | |
| 1718 | 1752 | |
| 1719 | 1753 | struct ec_response_motion_sense { |
| 1720 | 1754 | union { |
| 1721 | 1755 | /* Used for MOTIONSENSE_CMD_DUMP. */ |
| 1722 | − struct { | |
| 1756 | + struct __ec_todo_unpacked { | |
| 1723 | 1757 | /* Flags representing the motion sensor module. */ |
| 1724 | 1758 | uint8_t module_flags; |
| 1725 | 1759 | |
| @@ -1734,7 +1768,7 @@ struct ec_response_motion_sense { · 8 unmodified lines | ||
| 1734 | 1768 | } dump; |
| 1735 | 1769 | |
| 1736 | 1770 | /* Used for MOTIONSENSE_CMD_INFO. */ |
| 1737 | − struct { | |
| 1771 | + struct __ec_todo_unpacked { | |
| 1738 | 1772 | /* Should be element of enum motionsensor_type. */ |
| 1739 | 1773 | uint8_t type; |
| 1740 | 1774 | |
| @@ -1753,18 +1787,18 @@ struct ec_response_motion_sense { · 12 unmodified lines | ||
| 1753 | 1787 | * MOTIONSENSE_CMD_SENSOR_RANGE, and |
| 1754 | 1788 | * MOTIONSENSE_CMD_KB_WAKE_ANGLE. |
| 1755 | 1789 | */ |
| 1756 | − struct { | |
| 1790 | + struct __ec_todo_unpacked { | |
| 1757 | 1791 | /* Current value of the parameter queried. */ |
| 1758 | 1792 | int32_t ret; |
| 1759 | 1793 | } ec_rate, sensor_odr, sensor_range, kb_wake_angle; |
| 1760 | 1794 | |
| 1761 | 1795 | /* Used for MOTIONSENSE_CMD_SENSOR_OFFSET */ |
| 1762 | − struct { | |
| 1796 | + struct __ec_todo_unpacked { | |
| 1763 | 1797 | int16_t temp; |
| 1764 | 1798 | int16_t offset[3]; |
| 1765 | 1799 | } sensor_offset, perform_calib; |
| 1766 | 1800 | }; |
| 1767 | −} __packed; | |
| 1801 | +} __ec_todo_packed; | |
| 1768 | 1802 | |
| 1769 | 1803 | /*****************************************************************************/ |
| 1770 | 1804 | /* USB charging control commands */ |
| @@ -1775,7 +1809,7 @@ struct ec_response_motion_sense { · 4 unmodified lines | ||
| 1775 | 1809 | struct ec_params_usb_charge_set_mode { |
| 1776 | 1810 | uint8_t usb_port_id; |
| 1777 | 1811 | uint8_t mode; |
| 1778 | −} __packed; | |
| 1812 | +} __ec_align1; | |
| 1779 | 1813 | |
| 1780 | 1814 | /*****************************************************************************/ |
| 1781 | 1815 | /* Persistent storage for host */ |
| @@ -1791,7 +1825,7 @@ struct ec_response_pstore_info { · 9 unmodified lines | ||
| 1791 | 1825 | uint32_t pstore_size; |
| 1792 | 1826 | /* Access size; read/write offset and size must be a multiple of this */ |
| 1793 | 1827 | uint32_t access_size; |
| 1794 | −} __packed; | |
| 1828 | +} __ec_align4; | |
| 1795 | 1829 | |
| 1796 | 1830 | /* |
| 1797 | 1831 | * Read persistent storage |
| @@ -1803,7 +1837,7 @@ struct ec_response_pstore_info { · 5 unmodified lines | ||
| 1803 | 1837 | struct ec_params_pstore_read { |
| 1804 | 1838 | uint32_t offset; /* Byte offset to read */ |
| 1805 | 1839 | uint32_t size; /* Size to read in bytes */ |
| 1806 | −} __packed; | |
| 1840 | +} __ec_align4; | |
| 1807 | 1841 | |
| 1808 | 1842 | /* Write persistent storage */ |
| 1809 | 1843 | #define EC_CMD_PSTORE_WRITE 0x42 |
| @@ -1812,7 +1846,7 @@ struct ec_params_pstore_write { · 2 unmodified lines | ||
| 1812 | 1846 | uint32_t offset; /* Byte offset to write */ |
| 1813 | 1847 | uint32_t size; /* Size to write in bytes */ |
| 1814 | 1848 | uint8_t data[EC_PSTORE_SIZE_MAX]; |
| 1815 | −} __packed; | |
| 1849 | +} __ec_align4; | |
| 1816 | 1850 | |
| 1817 | 1851 | /*****************************************************************************/ |
| 1818 | 1852 | /* Real-time clock */ |
| @@ -1820,11 +1854,11 @@ struct ec_params_pstore_write { · 1 unmodified line | ||
| 1820 | 1854 | /* RTC params and response structures */ |
| 1821 | 1855 | struct ec_params_rtc { |
| 1822 | 1856 | uint32_t time; |
| 1823 | −} __packed; | |
| 1857 | +} __ec_align4; | |
| 1824 | 1858 | |
| 1825 | 1859 | struct ec_response_rtc { |
| 1826 | 1860 | uint32_t time; |
| 1827 | −} __packed; | |
| 1861 | +} __ec_align4; | |
| 1828 | 1862 | |
| 1829 | 1863 | /* These use ec_response_rtc */ |
| 1830 | 1864 | #define EC_CMD_RTC_GET_VALUE 0x44 |
| @@ -1855,29 +1889,29 @@ enum ec_port80_subcmd { · 24 unmodified lines | ||
| 1855 | 1889 | struct ec_params_port80_read { |
| 1856 | 1890 | uint16_t subcmd; |
| 1857 | 1891 | union { |
| 1858 | − struct { | |
| 1892 | + struct __ec_todo_unpacked { | |
| 1859 | 1893 | uint32_t offset; |
| 1860 | 1894 | uint32_t num_entries; |
| 1861 | 1895 | } read_buffer; |
| 1862 | 1896 | }; |
| 1863 | −} __packed; | |
| 1897 | +} __ec_todo_packed; | |
| 1864 | 1898 | |
| 1865 | 1899 | struct ec_response_port80_read { |
| 1866 | 1900 | union { |
| 1867 | − struct { | |
| 1901 | + struct __ec_todo_unpacked { | |
| 1868 | 1902 | uint32_t writes; |
| 1869 | 1903 | uint32_t history_size; |
| 1870 | 1904 | uint32_t last_boot; |
| 1871 | 1905 | } get_info; |
| 1872 | − struct { | |
| 1906 | + struct __ec_todo_unpacked { | |
| 1873 | 1907 | uint16_t codes[EC_PORT80_SIZE_MAX]; |
| 1874 | 1908 | } data; |
| 1875 | 1909 | }; |
| 1876 | −} __packed; | |
| 1910 | +} __ec_todo_packed; | |
| 1877 | 1911 | |
| 1878 | 1912 | struct ec_response_port80_last_boot { |
| 1879 | 1913 | uint16_t code; |
| 1880 | −} __packed; | |
| 1914 | +} __ec_align2; | |
| 1881 | 1915 | |
| 1882 | 1916 | /*****************************************************************************/ |
| 1883 | 1917 | /* Thermal engine commands. Note that there are two implementations. We'll |
| @@ -1898,17 +1932,17 @@ struct ec_params_thermal_set_threshold { · 14 unmodified lines | ||
| 1898 | 1932 | uint8_t sensor_type; |
| 1899 | 1933 | uint8_t threshold_id; |
| 1900 | 1934 | uint16_t value; |
| 1901 | −} __packed; | |
| 1935 | +} __ec_align2; | |
| 1902 | 1936 | |
| 1903 | 1937 | /* Version 0 - get */ |
| 1904 | 1938 | struct ec_params_thermal_get_threshold { |
| 1905 | 1939 | uint8_t sensor_type; |
| 1906 | 1940 | uint8_t threshold_id; |
| 1907 | −} __packed; | |
| 1941 | +} __ec_align1; | |
| 1908 | 1942 | |
| 1909 | 1943 | struct ec_response_thermal_get_threshold { |
| 1910 | 1944 | uint16_t value; |
| 1911 | −} __packed; | |
| 1945 | +} __ec_align2; | |
| 1912 | 1946 | |
| 1913 | 1947 | |
| 1914 | 1948 | /* The version 1 structs are visible. */ |
| @@ -1928,12 +1962,12 @@ struct ec_thermal_config { · 13 unmodified lines | ||
| 1928 | 1962 | uint32_t temp_host[EC_TEMP_THRESH_COUNT]; /* levels of hotness */ |
| 1929 | 1963 | uint32_t temp_fan_off; /* no active cooling needed */ |
| 1930 | 1964 | uint32_t temp_fan_max; /* max active cooling needed */ |
| 1931 | −} __packed; | |
| 1965 | +} __ec_align4; | |
| 1932 | 1966 | |
| 1933 | 1967 | /* Version 1 - get config for one sensor. */ |
| 1934 | 1968 | struct ec_params_thermal_get_threshold_v1 { |
| 1935 | 1969 | uint32_t sensor_num; |
| 1936 | −} __packed; | |
| 1970 | +} __ec_align4; | |
| 1937 | 1971 | /* This returns a struct ec_thermal_config */ |
| 1938 | 1972 | |
| 1939 | 1973 | /* |
| @@ -1943,7 +1977,7 @@ struct ec_params_thermal_get_threshold_v1 { · 3 unmodified lines | ||
| 1943 | 1977 | struct ec_params_thermal_set_threshold_v1 { |
| 1944 | 1978 | uint32_t sensor_num; |
| 1945 | 1979 | struct ec_thermal_config cfg; |
| 1946 | −} __packed; | |
| 1980 | +} __ec_align4; | |
| 1947 | 1981 | /* This returns no data */ |
| 1948 | 1982 | |
| 1949 | 1983 | /****************************************************************************/ |
| @@ -1956,14 +1990,14 @@ struct ec_params_thermal_set_threshold_v1 { · 6 unmodified lines | ||
| 1956 | 1990 | |
| 1957 | 1991 | struct ec_params_tmp006_get_calibration { |
| 1958 | 1992 | uint8_t index; |
| 1959 | −} __packed; | |
| 1993 | +} __ec_align1; | |
| 1960 | 1994 | |
| 1961 | 1995 | struct ec_response_tmp006_get_calibration { |
| 1962 | 1996 | float s0; |
| 1963 | 1997 | float b0; |
| 1964 | 1998 | float b1; |
| 1965 | 1999 | float b2; |
| 1966 | −} __packed; | |
| 2000 | +} __ec_align4; | |
| 1967 | 2001 | |
| 1968 | 2002 | /* Set TMP006 calibration data */ |
| 1969 | 2003 | #define EC_CMD_TMP006_SET_CALIBRATION 0x54 |
| @@ -1975,19 +2009,19 @@ struct ec_params_tmp006_set_calibration { · 5 unmodified lines | ||
| 1975 | 2009 | float b0; |
| 1976 | 2010 | float b1; |
| 1977 | 2011 | float b2; |
| 1978 | −} __packed; | |
| 2012 | +} __ec_align4; | |
| 1979 | 2013 | |
| 1980 | 2014 | /* Read raw TMP006 data */ |
| 1981 | 2015 | #define EC_CMD_TMP006_GET_RAW 0x55 |
| 1982 | 2016 | |
| 1983 | 2017 | struct ec_params_tmp006_get_raw { |
| 1984 | 2018 | uint8_t index; |
| 1985 | −} __packed; | |
| 2019 | +} __ec_align1; | |
| 1986 | 2020 | |
| 1987 | 2021 | struct ec_response_tmp006_get_raw { |
| 1988 | 2022 | int32_t t; /* In 1/100 K */ |
| 1989 | 2023 | int32_t v; /* In nV */ |
| 1990 | −}; | |
| 2024 | +} __ec_align4; | |
| 1991 | 2025 | |
| 1992 | 2026 | /*****************************************************************************/ |
| 1993 | 2027 | /* MKBP - Matrix KeyBoard Protocol */ |
| @@ -2014,12 +2048,12 @@ struct ec_response_mkbp_info { · 20 unmodified lines | ||
| 2014 | 2048 | uint32_t cols; |
| 2015 | 2049 | /* Formerly "switches", which was 0. */ |
| 2016 | 2050 | uint8_t reserved; |
| 2017 | −} __packed; | |
| 2051 | +} __ec_align_size1; | |
| 2018 | 2052 | |
| 2019 | 2053 | struct ec_params_mkbp_info { |
| 2020 | 2054 | uint8_t info_type; |
| 2021 | 2055 | uint8_t event_type; |
| 2022 | −} __packed; | |
| 2056 | +} __ec_align1; | |
| 2023 | 2057 | |
| 2024 | 2058 | enum ec_mkbp_info_type { |
| 2025 | 2059 | /* |
| @@ -2067,7 +2101,7 @@ struct ec_params_mkbp_simulate_key { · 41 unmodified lines | ||
| 2067 | 2101 | uint8_t col; |
| 2068 | 2102 | uint8_t row; |
| 2069 | 2103 | uint8_t pressed; |
| 2070 | −} __packed; | |
| 2104 | +} __ec_align1; | |
| 2071 | 2105 | |
| 2072 | 2106 | /* Configure keyboard scanning */ |
| 2073 | 2107 | #define EC_CMD_MKBP_SET_CONFIG 0x64 |
| @@ -2113,15 +2147,15 @@ struct ec_mkbp_config { · 39 unmodified lines | ||
| 2113 | 2147 | uint16_t debounce_up_us; /* time for debounce on key up */ |
| 2114 | 2148 | /* maximum depth to allow for fifo (0 = no keyscan output) */ |
| 2115 | 2149 | uint8_t fifo_max_depth; |
| 2116 | −} __packed; | |
| 2150 | +} __ec_align_size1; | |
| 2117 | 2151 | |
| 2118 | 2152 | struct ec_params_mkbp_set_config { |
| 2119 | 2153 | struct ec_mkbp_config config; |
| 2120 | −} __packed; | |
| 2154 | +} __ec_align_size1; | |
| 2121 | 2155 | |
| 2122 | 2156 | struct ec_response_mkbp_get_config { |
| 2123 | 2157 | struct ec_mkbp_config config; |
| 2124 | −} __packed; | |
| 2158 | +} __ec_align_size1; | |
| 2125 | 2159 | |
| 2126 | 2160 | /* Run the key scan emulation */ |
| 2127 | 2161 | #define EC_CMD_KEYSCAN_SEQ_CTRL 0x66 |
| @@ -2144,18 +2178,18 @@ enum ec_collect_flags { · 16 unmodified lines | ||
| 2144 | 2178 | |
| 2145 | 2179 | struct ec_collect_item { |
| 2146 | 2180 | uint8_t flags; /* some flags (enum ec_collect_flags) */ |
| 2147 | −}; | |
| 2181 | +} __ec_align1; | |
| 2148 | 2182 | |
| 2149 | 2183 | struct ec_params_keyscan_seq_ctrl { |
| 2150 | 2184 | uint8_t cmd; /* Command to send (enum ec_keyscan_seq_cmd) */ |
| 2151 | 2185 | union { |
| 2152 | − struct { | |
| 2186 | + struct __ec_align1 { | |
| 2153 | 2187 | uint8_t active; /* still active */ |
| 2154 | 2188 | uint8_t num_items; /* number of items */ |
| 2155 | 2189 | /* Current item being presented */ |
| 2156 | 2190 | uint8_t cur_item; |
| 2157 | 2191 | } status; |
| 2158 | − struct { | |
| 2192 | + struct __ec_todo_unpacked { | |
| 2159 | 2193 | /* |
| 2160 | 2194 | * Absolute time for this scan, measured from the |
| 2161 | 2195 | * start of the sequence. |
| @@ -2163,22 +2197,22 @@ struct ec_params_keyscan_seq_ctrl { · 1 unmodified line | ||
| 2163 | 2197 | uint32_t time_us; |
| 2164 | 2198 | uint8_t scan[0]; /* keyscan data */ |
| 2165 | 2199 | } add; |
| 2166 | − struct { | |
| 2200 | + struct __ec_align1 { | |
| 2167 | 2201 | uint8_t start_item; /* First item to return */ |
| 2168 | 2202 | uint8_t num_items; /* Number of items to return */ |
| 2169 | 2203 | } collect; |
| 2170 | 2204 | }; |
| 2171 | −} __packed; | |
| 2205 | +} __ec_todo_packed; | |
| 2172 | 2206 | |
| 2173 | 2207 | struct ec_result_keyscan_seq_ctrl { |
| 2174 | 2208 | union { |
| 2175 | − struct { | |
| 2209 | + struct __ec_todo_unpacked { | |
| 2176 | 2210 | uint8_t num_items; /* Number of items */ |
| 2177 | 2211 | /* Data for each item */ |
| 2178 | 2212 | struct ec_collect_item item[0]; |
| 2179 | 2213 | } collect; |
| 2180 | 2214 | }; |
| 2181 | −} __packed; | |
| 2215 | +} __ec_todo_packed; | |
| 2182 | 2216 | |
| 2183 | 2217 | /* |
| 2184 | 2218 | * Command for retrieving the next pending MKBP event from the EC device |
| @@ -2216,8 +2250,8 @@ enum ec_mkbp_event { · 31 unmodified lines | ||
| 2216 | 2250 | EC_MKBP_EVENT_COUNT, |
| 2217 | 2251 | }; |
| 2218 | 2252 | |
| 2219 | −union ec_response_get_next_data { | |
| 2220 | − uint8_t key_matrix[13]; | |
| 2253 | +union __ec_align_offset1 ec_response_get_next_data { | |
| 2254 | + uint8_t key_matrix[13]; | |
| 2221 | 2255 | |
| 2222 | 2256 | /* Unaligned */ |
| 2223 | 2257 | uint32_t host_event; |
| @@ -2225,9 +2259,9 @@ union ec_response_get_next_data { · 1 unmodified line | ||
| 2225 | 2259 | uint32_t buttons; |
| 2226 | 2260 | uint32_t switches; |
| 2227 | 2261 | uint32_t sysrq; |
| 2228 | −} __packed; | |
| 2262 | +}; | |
| 2229 | 2263 | |
| 2230 | −union ec_response_get_next_data_v1 { | |
| 2264 | +union __ec_align_offset1 ec_response_get_next_data_v1 { | |
| 2231 | 2265 | uint8_t key_matrix[16]; |
| 2232 | 2266 | uint32_t host_event; |
| 2233 | 2267 | uint32_t buttons; |
| @@ -2235,19 +2269,19 @@ union ec_response_get_next_data_v1 { · 1 unmodified line | ||
| 2235 | 2269 | uint32_t sysrq; |
| 2236 | 2270 | uint32_t cec_events; |
| 2237 | 2271 | uint8_t cec_message[16]; |
| 2238 | −} __packed; | |
| 2272 | +}; | |
| 2239 | 2273 | |
| 2240 | 2274 | struct ec_response_get_next_event { |
| 2241 | 2275 | uint8_t event_type; |
| 2242 | 2276 | /* Followed by event data if any */ |
| 2243 | 2277 | union ec_response_get_next_data data; |
| 2244 | −} __packed; | |
| 2278 | +} __ec_align1; | |
| 2245 | 2279 | |
| 2246 | 2280 | struct ec_response_get_next_event_v1 { |
| 2247 | 2281 | uint8_t event_type; |
| 2248 | 2282 | /* Followed by event data if any */ |
| 2249 | 2283 | union ec_response_get_next_data_v1 data; |
| 2250 | −} __packed; | |
| 2284 | +} __ec_align1; | |
| 2251 | 2285 | |
| 2252 | 2286 | /* Bit indices for buttons and switches.*/ |
| 2253 | 2287 | /* Buttons */ |
| @@ -2268,12 +2302,12 @@ struct ec_response_get_next_event_v1 { · 14 unmodified lines | ||
| 2268 | 2302 | |
| 2269 | 2303 | struct ec_params_temp_sensor_get_info { |
| 2270 | 2304 | uint8_t id; |
| 2271 | −} __packed; | |
| 2305 | +} __ec_align1; | |
| 2272 | 2306 | |
| 2273 | 2307 | struct ec_response_temp_sensor_get_info { |
| 2274 | 2308 | char sensor_name[32]; |
| 2275 | 2309 | uint8_t sensor_type; |
| 2276 | −} __packed; | |
| 2310 | +} __ec_align1; | |
| 2277 | 2311 | |
| 2278 | 2312 | /*****************************************************************************/ |
| 2279 | 2313 | |
| @@ -2292,11 +2326,11 @@ struct ec_response_temp_sensor_get_info { · 12 unmodified lines | ||
| 2292 | 2326 | */ |
| 2293 | 2327 | struct ec_params_host_event_mask { |
| 2294 | 2328 | uint32_t mask; |
| 2295 | −} __packed; | |
| 2329 | +} __ec_align4; | |
| 2296 | 2330 | |
| 2297 | 2331 | struct ec_response_host_event_mask { |
| 2298 | 2332 | uint32_t mask; |
| 2299 | −} __packed; | |
| 2333 | +} __ec_align4; | |
| 2300 | 2334 | |
| 2301 | 2335 | /* These all use ec_response_host_event_mask */ |
| 2302 | 2336 | #define EC_CMD_HOST_EVENT_GET_B 0x87 |
| @@ -2319,7 +2353,7 @@ struct ec_response_host_event_mask { · 16 unmodified lines | ||
| 2319 | 2353 | |
| 2320 | 2354 | struct ec_params_switch_enable_backlight { |
| 2321 | 2355 | uint8_t enabled; |
| 2322 | −} __packed; | |
| 2356 | +} __ec_align1; | |
| 2323 | 2357 | |
| 2324 | 2358 | /* Enable/disable WLAN/Bluetooth */ |
| 2325 | 2359 | #define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91 |
| @@ -2328,7 +2362,7 @@ struct ec_params_switch_enable_backlight { · 2 unmodified lines | ||
| 2328 | 2362 | /* Version 0 params; no response */ |
| 2329 | 2363 | struct ec_params_switch_enable_wireless_v0 { |
| 2330 | 2364 | uint8_t enabled; |
| 2331 | −} __packed; | |
| 2365 | +} __ec_align1; | |
| 2332 | 2366 | |
| 2333 | 2367 | /* Version 1 params */ |
| 2334 | 2368 | struct ec_params_switch_enable_wireless_v1 { |
| @@ -2347,7 +2381,7 @@ struct ec_params_switch_enable_wireless_v1 { · 12 unmodified lines | ||
| 2347 | 2381 | |
| 2348 | 2382 | /* Which flags to copy from suspend_flags */ |
| 2349 | 2383 | uint8_t suspend_mask; |
| 2350 | −} __packed; | |
| 2384 | +} __ec_align1; | |
| 2351 | 2385 | |
| 2352 | 2386 | /* Version 1 response */ |
| 2353 | 2387 | struct ec_response_switch_enable_wireless_v1 { |
| @@ -2356,7 +2390,7 @@ struct ec_response_switch_enable_wireless_v1 { · 2 unmodified lines | ||
| 2356 | 2390 | |
| 2357 | 2391 | /* Flags to leave enabled in S3 */ |
| 2358 | 2392 | uint8_t suspend_flags; |
| 2359 | −} __packed; | |
| 2393 | +} __ec_align1; | |
| 2360 | 2394 | |
| 2361 | 2395 | /*****************************************************************************/ |
| 2362 | 2396 | /* GPIO commands. Only available on EC if write protect has been disabled. */ |
| @@ -2367,7 +2401,7 @@ struct ec_response_switch_enable_wireless_v1 { · 4 unmodified lines | ||
| 2367 | 2401 | struct ec_params_gpio_set { |
| 2368 | 2402 | char name[32]; |
| 2369 | 2403 | uint8_t val; |
| 2370 | −} __packed; | |
| 2404 | +} __ec_align1; | |
| 2371 | 2405 | |
| 2372 | 2406 | /* Get GPIO value */ |
| 2373 | 2407 | #define EC_CMD_GPIO_GET 0x93 |
| @@ -2375,37 +2409,37 @@ struct ec_params_gpio_set { · 1 unmodified line | ||
| 2375 | 2409 | /* Version 0 of input params and response */ |
| 2376 | 2410 | struct ec_params_gpio_get { |
| 2377 | 2411 | char name[32]; |
| 2378 | −} __packed; | |
| 2412 | +} __ec_align1; | |
| 2379 | 2413 | |
| 2380 | 2414 | struct ec_response_gpio_get { |
| 2381 | 2415 | uint8_t val; |
| 2382 | −} __packed; | |
| 2416 | +} __ec_align1; | |
| 2383 | 2417 | |
| 2384 | 2418 | /* Version 1 of input params and response */ |
| 2385 | 2419 | struct ec_params_gpio_get_v1 { |
| 2386 | 2420 | uint8_t subcmd; |
| 2387 | 2421 | union { |
| 2388 | − struct { | |
| 2422 | + struct __ec_align1 { | |
| 2389 | 2423 | char name[32]; |
| 2390 | 2424 | } get_value_by_name; |
| 2391 | − struct { | |
| 2425 | + struct __ec_align1 { | |
| 2392 | 2426 | uint8_t index; |
| 2393 | 2427 | } get_info; |
| 2394 | 2428 | }; |
| 2395 | −} __packed; | |
| 2429 | +} __ec_align1; | |
| 2396 | 2430 | |
| 2397 | 2431 | struct ec_response_gpio_get_v1 { |
| 2398 | 2432 | union { |
| 2399 | − struct { | |
| 2433 | + struct __ec_align1 { | |
| 2400 | 2434 | uint8_t val; |
| 2401 | 2435 | } get_value_by_name, get_count; |
| 2402 | − struct { | |
| 2436 | + struct __ec_todo_unpacked { | |
| 2403 | 2437 | uint8_t val; |
| 2404 | 2438 | char name[32]; |
| 2405 | 2439 | uint32_t flags; |
| 2406 | 2440 | } get_info; |
| 2407 | 2441 | }; |
| 2408 | −} __packed; | |
| 2442 | +} __ec_todo_packed; | |
| 2409 | 2443 | |
| 2410 | 2444 | enum gpio_get_subcmd { |
| 2411 | 2445 | EC_GPIO_GET_BY_NAME = 0, |
| @@ -2431,11 +2465,11 @@ struct ec_params_i2c_read { · 19 unmodified lines | ||
| 2431 | 2465 | uint8_t read_size; /* Either 8 or 16. */ |
| 2432 | 2466 | uint8_t port; |
| 2433 | 2467 | uint8_t offset; |
| 2434 | −} __packed; | |
| 2468 | +} __ec_align_size1; | |
| 2435 | 2469 | |
| 2436 | 2470 | struct ec_response_i2c_read { |
| 2437 | 2471 | uint16_t data; |
| 2438 | −} __packed; | |
| 2472 | +} __ec_align2; | |
| 2439 | 2473 | |
| 2440 | 2474 | /* Write I2C bus */ |
| 2441 | 2475 | #define EC_CMD_I2C_WRITE 0x95 |
| @@ -2446,7 +2480,7 @@ struct ec_params_i2c_write { · 4 unmodified lines | ||
| 2446 | 2480 | uint8_t write_size; /* Either 8 or 16. */ |
| 2447 | 2481 | uint8_t port; |
| 2448 | 2482 | uint8_t offset; |
| 2449 | −} __packed; | |
| 2483 | +} __ec_align_size1; | |
| 2450 | 2484 | |
| 2451 | 2485 | /*****************************************************************************/ |
| 2452 | 2486 | /* Charge state commands. Only available when flash write protect unlocked. */ |
| @@ -2465,7 +2499,7 @@ enum ec_charge_control_mode { · 12 unmodified lines | ||
| 2465 | 2499 | |
| 2466 | 2500 | struct ec_params_charge_control { |
| 2467 | 2501 | uint32_t mode; /* enum charge_control_mode */ |
| 2468 | −} __packed; | |
| 2502 | +} __ec_align4; | |
| 2469 | 2503 | |
| 2470 | 2504 | /*****************************************************************************/ |
| 2471 | 2505 | |
| @@ -2493,7 +2527,7 @@ enum ec_console_read_subcmd { · 21 unmodified lines | ||
| 2493 | 2527 | |
| 2494 | 2528 | struct ec_params_console_read_v1 { |
| 2495 | 2529 | uint8_t subcmd; /* enum ec_console_read_subcmd */ |
| 2496 | −} __packed; | |
| 2530 | +} __ec_align1; | |
| 2497 | 2531 | |
| 2498 | 2532 | /*****************************************************************************/ |
| 2499 | 2533 | |
| @@ -2511,7 +2545,7 @@ struct ec_params_console_read_v1 { · 11 unmodified lines | ||
| 2511 | 2545 | |
| 2512 | 2546 | struct ec_params_battery_cutoff { |
| 2513 | 2547 | uint8_t flags; |
| 2514 | −} __packed; | |
| 2548 | +} __ec_align1; | |
| 2515 | 2549 | |
| 2516 | 2550 | /*****************************************************************************/ |
| 2517 | 2551 | /* USB port mux control. */ |
| @@ -2523,7 +2557,7 @@ struct ec_params_battery_cutoff { · 5 unmodified lines | ||
| 2523 | 2557 | |
| 2524 | 2558 | struct ec_params_usb_mux { |
| 2525 | 2559 | uint8_t mux; |
| 2526 | −} __packed; | |
| 2560 | +} __ec_align1; | |
| 2527 | 2561 | |
| 2528 | 2562 | /*****************************************************************************/ |
| 2529 | 2563 | /* LDOs / FETs control. */ |
| @@ -2541,7 +2575,7 @@ enum ec_ldo_state { · 11 unmodified lines | ||
| 2541 | 2575 | struct ec_params_ldo_set { |
| 2542 | 2576 | uint8_t index; |
| 2543 | 2577 | uint8_t state; |
| 2544 | −} __packed; | |
| 2578 | +} __ec_align1; | |
| 2545 | 2579 | |
| 2546 | 2580 | /* |
| 2547 | 2581 | * Get LDO state. |
| @@ -2550,11 +2584,11 @@ struct ec_params_ldo_set { · 2 unmodified lines | ||
| 2550 | 2584 | |
| 2551 | 2585 | struct ec_params_ldo_get { |
| 2552 | 2586 | uint8_t index; |
| 2553 | −} __packed; | |
| 2587 | +} __ec_align1; | |
| 2554 | 2588 | |
| 2555 | 2589 | struct ec_response_ldo_get { |
| 2556 | 2590 | uint8_t state; |
| 2557 | −} __packed; | |
| 2591 | +} __ec_align1; | |
| 2558 | 2592 | |
| 2559 | 2593 | /*****************************************************************************/ |
| 2560 | 2594 | /* Power info. */ |
| @@ -2570,7 +2604,7 @@ struct ec_response_power_info { · 9 unmodified lines | ||
| 2570 | 2604 | uint16_t voltage_system; |
| 2571 | 2605 | uint16_t current_system; |
| 2572 | 2606 | uint16_t usb_current_limit; |
| 2573 | −} __packed; | |
| 2607 | +} __ec_align4; | |
| 2574 | 2608 | |
| 2575 | 2609 | /*****************************************************************************/ |
| 2576 | 2610 | /* I2C passthru command */ |
| @@ -2592,20 +2626,20 @@ struct ec_response_power_info { · 15 unmodified lines | ||
| 2592 | 2626 | struct ec_params_i2c_passthru_msg { |
| 2593 | 2627 | uint16_t addr_flags; /* I2C slave address (7 or 10 bits) and flags */ |
| 2594 | 2628 | uint16_t len; /* Number of bytes to read or write */ |
| 2595 | −} __packed; | |
| 2629 | +} __ec_align2; | |
| 2596 | 2630 | |
| 2597 | 2631 | struct ec_params_i2c_passthru { |
| 2598 | 2632 | uint8_t port; /* I2C port number */ |
| 2599 | 2633 | uint8_t num_msgs; /* Number of messages */ |
| 2600 | 2634 | struct ec_params_i2c_passthru_msg msg[]; |
| 2601 | 2635 | /* Data to write for all messages is concatenated here */ |
| 2602 | −} __packed; | |
| 2636 | +} __ec_align2; | |
| 2603 | 2637 | |
| 2604 | 2638 | struct ec_response_i2c_passthru { |
| 2605 | 2639 | uint8_t i2c_status; /* Status flags (EC_I2C_STATUS_...) */ |
| 2606 | 2640 | uint8_t num_msgs; /* Number of messages processed */ |
| 2607 | 2641 | uint8_t data[]; /* Data read by messages concatenated here */ |
| 2608 | −} __packed; | |
| 2642 | +} __ec_align1; | |
| 2609 | 2643 | |
| 2610 | 2644 | /*****************************************************************************/ |
| 2611 | 2645 | /* Power button hang detect */ |
| @@ -2660,7 +2694,7 @@ struct ec_params_hang_detect { · 48 unmodified lines | ||
| 2660 | 2694 | |
| 2661 | 2695 | /* Timeout in msec before generating warm reboot, if enabled */ |
| 2662 | 2696 | uint16_t warm_reboot_timeout_msec; |
| 2663 | −} __packed; | |
| 2697 | +} __ec_align4; | |
| 2664 | 2698 | |
| 2665 | 2699 | /*****************************************************************************/ |
| 2666 | 2700 | /* Commands for battery charging */ |
| @@ -2706,20 +2740,20 @@ struct ec_params_charge_state { · 39 unmodified lines | ||
| 2706 | 2740 | /* no args */ |
| 2707 | 2741 | } get_state; |
| 2708 | 2742 | |
| 2709 | − struct { | |
| 2743 | + struct __ec_todo_unpacked { | |
| 2710 | 2744 | uint32_t param; /* enum charge_state_param */ |
| 2711 | 2745 | } get_param; |
| 2712 | 2746 | |
| 2713 | − struct { | |
| 2747 | + struct __ec_todo_unpacked { | |
| 2714 | 2748 | uint32_t param; /* param to set */ |
| 2715 | 2749 | uint32_t value; /* value to set */ |
| 2716 | 2750 | } set_param; |
| 2717 | 2751 | }; |
| 2718 | −} __packed; | |
| 2752 | +} __ec_todo_packed; | |
| 2719 | 2753 | |
| 2720 | 2754 | struct ec_response_charge_state { |
| 2721 | 2755 | union { |
| 2722 | − struct { | |
| 2756 | + struct __ec_align4 { | |
| 2723 | 2757 | int ac; |
| 2724 | 2758 | int chg_voltage; |
| 2725 | 2759 | int chg_current; |
| @@ -2727,14 +2761,14 @@ struct ec_response_charge_state { · 1 unmodified line | ||
| 2727 | 2761 | int batt_state_of_charge; |
| 2728 | 2762 | } get_state; |
| 2729 | 2763 | |
| 2730 | − struct { | |
| 2764 | + struct __ec_align4 { | |
| 2731 | 2765 | uint32_t value; |
| 2732 | 2766 | } get_param; |
| 2733 | 2767 | struct { |
| 2734 | 2768 | /* no return values */ |
| 2735 | 2769 | } set_param; |
| 2736 | 2770 | }; |
| 2737 | −} __packed; | |
| 2771 | +} __ec_align4; | |
| 2738 | 2772 | |
| 2739 | 2773 | |
| 2740 | 2774 | /* |
| @@ -2744,7 +2778,7 @@ struct ec_response_charge_state { · 3 unmodified lines | ||
| 2744 | 2778 | |
| 2745 | 2779 | struct ec_params_current_limit { |
| 2746 | 2780 | uint32_t limit; /* in mA */ |
| 2747 | −} __packed; | |
| 2781 | +} __ec_align4; | |
| 2748 | 2782 | |
| 2749 | 2783 | /* |
| 2750 | 2784 | * Set maximum external voltage / current. |
| @@ -2755,7 +2789,7 @@ struct ec_params_current_limit { · 4 unmodified lines | ||
| 2755 | 2789 | struct ec_params_external_power_limit_v1 { |
| 2756 | 2790 | uint16_t current_lim; /* in mA, or EC_POWER_LIMIT_NONE to clear limit */ |
| 2757 | 2791 | uint16_t voltage_lim; /* in mV, or EC_POWER_LIMIT_NONE to clear limit */ |
| 2758 | −} __packed; | |
| 2792 | +} __ec_align2; | |
| 2759 | 2793 | |
| 2760 | 2794 | #define EC_POWER_LIMIT_NONE 0xffff |
| 2761 | 2795 | |
| @@ -2771,7 +2805,7 @@ enum host_sleep_event { · 9 unmodified lines | ||
| 2771 | 2805 | |
| 2772 | 2806 | struct ec_params_host_sleep_event { |
| 2773 | 2807 | uint8_t sleep_event; |
| 2774 | −} __packed; | |
| 2808 | +} __ec_align1; | |
| 2775 | 2809 | |
| 2776 | 2810 | /* |
| 2777 | 2811 | * Use a default timeout value (CONFIG_SLEEP_TIMEOUT_MS) for detecting sleep |
| @@ -2802,7 +2836,7 @@ struct ec_params_host_sleep_event_v1 { · 24 unmodified lines | ||
| 2802 | 2836 | |
| 2803 | 2837 | /* No parameters for non-suspend messages. */ |
| 2804 | 2838 | }; |
| 2805 | −} __packed; | |
| 2839 | +} __ec_align2; | |
| 2806 | 2840 | |
| 2807 | 2841 | /* A timeout occurred when this bit is set */ |
| 2808 | 2842 | #define EC_HOST_RESUME_SLEEP_TIMEOUT 0x80000000 |
| @@ -2828,7 +2862,7 @@ struct ec_response_host_sleep_event_v1 { · 19 unmodified lines | ||
| 2828 | 2862 | |
| 2829 | 2863 | /* No response fields for non-resume messages. */ |
| 2830 | 2864 | }; |
| 2831 | −} __packed; | |
| 2865 | +} __ec_align4; | |
| 2832 | 2866 | |
| 2833 | 2867 | /*****************************************************************************/ |
| 2834 | 2868 | /* Smart battery pass-through */ |
| @@ -2845,25 +2879,25 @@ struct ec_response_host_sleep_event_v1 { · 10 unmodified lines | ||
| 2845 | 2879 | |
| 2846 | 2880 | struct ec_params_sb_rd { |
| 2847 | 2881 | uint8_t reg; |
| 2848 | −} __packed; | |
| 2882 | +} __ec_align1; | |
| 2849 | 2883 | |
| 2850 | 2884 | struct ec_response_sb_rd_word { |
| 2851 | 2885 | uint16_t value; |
| 2852 | −} __packed; | |
| 2886 | +} __ec_align2; | |
| 2853 | 2887 | |
| 2854 | 2888 | struct ec_params_sb_wr_word { |
| 2855 | 2889 | uint8_t reg; |
| 2856 | 2890 | uint16_t value; |
| 2857 | −} __packed; | |
| 2891 | +} __ec_align1; | |
| 2858 | 2892 | |
| 2859 | 2893 | struct ec_response_sb_rd_block { |
| 2860 | 2894 | uint8_t data[32]; |
| 2861 | −} __packed; | |
| 2895 | +} __ec_align1; | |
| 2862 | 2896 | |
| 2863 | 2897 | struct ec_params_sb_wr_block { |
| 2864 | 2898 | uint8_t reg; |
| 2865 | 2899 | uint16_t data[32]; |
| 2866 | −} __packed; | |
| 2900 | +} __ec_align1; | |
| 2867 | 2901 | |
| 2868 | 2902 | /*****************************************************************************/ |
| 2869 | 2903 | /* Battery vendor parameters |
| @@ -2885,11 +2919,11 @@ struct ec_params_battery_vendor_param { · 15 unmodified lines | ||
| 2885 | 2919 | uint32_t param; |
| 2886 | 2920 | uint32_t value; |
| 2887 | 2921 | uint8_t mode; |
| 2888 | −} __packed; | |
| 2922 | +} __ec_align_size1; | |
| 2889 | 2923 | |
| 2890 | 2924 | struct ec_response_battery_vendor_param { |
| 2891 | 2925 | uint32_t value; |
| 2892 | −} __packed; | |
| 2926 | +} __ec_align4; | |
| 2893 | 2927 | |
| 2894 | 2928 | /*****************************************************************************/ |
| 2895 | 2929 | /* Commands for I2S recording on audio codec. */ |
| @@ -2920,7 +2954,7 @@ enum ec_i2s_config { · 24 unmodified lines | ||
| 2920 | 2954 | EC_DAI_FMT_PCM_TDM = 5, |
| 2921 | 2955 | }; |
| 2922 | 2956 | |
| 2923 | −struct ec_param_codec_i2s { | |
| 2957 | +struct __ec_todo_packed ec_param_codec_i2s { | |
| 2924 | 2958 | /* enum ec_codec_i2s_subcmd */ |
| 2925 | 2959 | uint8_t cmd; |
| 2926 | 2960 | union { |
| @@ -2934,10 +2968,10 @@ struct ec_param_codec_i2s { · 7 unmodified lines | ||
| 2934 | 2968 | * EC_CODEC_SET_GAIN |
| 2935 | 2969 | * Value should be 0~43 for both channels. |
| 2936 | 2970 | */ |
| 2937 | − struct ec_param_codec_i2s_set_gain { | |
| 2971 | + struct __ec_align1 ec_param_codec_i2s_set_gain { | |
| 2938 | 2972 | uint8_t left; |
| 2939 | 2973 | uint8_t right; |
| 2940 | − } __packed gain; | |
| 2974 | + } gain; | |
| 2941 | 2975 | |
| 2942 | 2976 | /* |
| 2943 | 2977 | * EC_CODEC_I2S_ENABLE |
| @@ -2955,7 +2989,7 @@ struct ec_param_codec_i2s { · 11 unmodified lines | ||
| 2955 | 2989 | * EC_CODEC_I2S_SET_TDM_CONFIG |
| 2956 | 2990 | * Value should be one of ec_i2s_config. |
| 2957 | 2991 | */ |
| 2958 | − struct ec_param_codec_i2s_tdm { | |
| 2992 | + struct __ec_todo_unpacked ec_param_codec_i2s_tdm { | |
| 2959 | 2993 | /* |
| 2960 | 2994 | * 0 to 496 |
| 2961 | 2995 | */ |
| @@ -2966,14 +3000,14 @@ struct ec_param_codec_i2s { · 4 unmodified lines | ||
| 2966 | 3000 | int16_t ch1_delay; |
| 2967 | 3001 | uint8_t adjacent_to_ch0; |
| 2968 | 3002 | uint8_t adjacent_to_ch1; |
| 2969 | − } __packed tdm_param; | |
| 3003 | + } tdm_param; | |
| 2970 | 3004 | |
| 2971 | 3005 | /* |
| 2972 | 3006 | * EC_CODEC_I2S_SET_BCLK |
| 2973 | 3007 | */ |
| 2974 | 3008 | uint32_t bclk; |
| 2975 | 3009 | }; |
| 2976 | −} __packed; | |
| 3010 | +}; | |
| 2977 | 3011 | |
| 2978 | 3012 | /* |
| 2979 | 3013 | * For subcommand EC_CODEC_GET_GAIN. |
| @@ -2981,7 +3015,7 @@ struct ec_param_codec_i2s { · 1 unmodified line | ||
| 2981 | 3015 | struct ec_response_codec_gain { |
| 2982 | 3016 | uint8_t left; |
| 2983 | 3017 | uint8_t right; |
| 2984 | −} __packed; | |
| 3018 | +} __ec_align1; | |
| 2985 | 3019 | |
| 2986 | 3020 | /*****************************************************************************/ |
| 2987 | 3021 | /* System commands */ |
| @@ -3010,7 +3044,7 @@ enum ec_reboot_cmd { · 22 unmodified lines | ||
| 3010 | 3044 | struct ec_params_reboot_ec { |
| 3011 | 3045 | uint8_t cmd; /* enum ec_reboot_cmd */ |
| 3012 | 3046 | uint8_t flags; /* See EC_REBOOT_FLAG_* */ |
| 3013 | −} __packed; | |
| 3047 | +} __ec_align1; | |
| 3014 | 3048 | |
| 3015 | 3049 | /* |
| 3016 | 3050 | * Get information on last EC panic. |
| @@ -3153,7 +3187,7 @@ struct ec_params_reboot_ec { · 136 unmodified lines | ||
| 3153 | 3187 | */ |
| 3154 | 3188 | struct ec_params_cec_write { |
| 3155 | 3189 | uint8_t msg[EC_MAX_CEC_MSG_LEN]; |
| 3156 | −} __packed; | |
| 3190 | +} __ec_align1; | |
| 3157 | 3191 | |
| 3158 | 3192 | /* Set various CEC parameters */ |
| 3159 | 3193 | #define EC_CMD_CEC_SET 0x00BA |
| @@ -3169,7 +3203,7 @@ struct ec_params_cec_write { · 9 unmodified lines | ||
| 3169 | 3203 | struct ec_params_cec_set { |
| 3170 | 3204 | uint8_t cmd; /* enum cec_command */ |
| 3171 | 3205 | uint8_t val; |
| 3172 | −} __packed; | |
| 3206 | +} __ec_align1; | |
| 3173 | 3207 | |
| 3174 | 3208 | /* Read various CEC parameters */ |
| 3175 | 3209 | #define EC_CMD_CEC_GET 0x00BB |
| @@ -3180,7 +3214,7 @@ struct ec_params_cec_set { · 4 unmodified lines | ||
| 3180 | 3214 | */ |
| 3181 | 3215 | struct ec_params_cec_get { |
| 3182 | 3216 | uint8_t cmd; /* enum cec_command */ |
| 3183 | −} __packed; | |
| 3217 | +} __ec_align1; | |
| 3184 | 3218 | |
| 3185 | 3219 | /** |
| 3186 | 3220 | * struct ec_response_cec_get - CEC parameters get response |
| @@ -3191,7 +3225,7 @@ struct ec_params_cec_get { · 4 unmodified lines | ||
| 3191 | 3225 | */ |
| 3192 | 3226 | struct ec_response_cec_get { |
| 3193 | 3227 | uint8_t val; |
| 3194 | −} __packed; | |
| 3228 | +} __ec_align1; | |
| 3195 | 3229 | |
| 3196 | 3230 | /* CEC parameters command */ |
| 3197 | 3231 | enum ec_cec_command { |
| @@ -3264,13 +3298,13 @@ enum mkbp_cec_event { · 66 unmodified lines | ||
| 3264 | 3298 | /* Status of EC being sent to PD */ |
| 3265 | 3299 | struct ec_params_pd_status { |
| 3266 | 3300 | int8_t batt_soc; /* battery state of charge */ |
| 3267 | −} __packed; | |
| 3301 | +} __ec_align1; | |
| 3268 | 3302 | |
| 3269 | 3303 | /* Status of PD being sent back to EC */ |
| 3270 | 3304 | struct ec_response_pd_status { |
| 3271 | 3305 | int8_t status; /* PD MCU status */ |
| 3272 | 3306 | uint32_t curr_lim_ma; /* input current limit */ |
| 3273 | −} __packed; | |
| 3307 | +} __ec_align_size1; | |
| 3274 | 3308 | |
| 3275 | 3309 | /* Set USB type-C port role and muxes */ |
| 3276 | 3310 | #define EC_CMD_USB_PD_CONTROL 0x101 |
| @@ -3305,7 +3339,7 @@ struct ec_params_usb_pd_control { · 28 unmodified lines | ||
| 3305 | 3339 | uint8_t role; |
| 3306 | 3340 | uint8_t mux; |
| 3307 | 3341 | uint8_t swap; |
| 3308 | −} __packed; | |
| 3342 | +} __ec_align1; | |
| 3309 | 3343 | |
| 3310 | 3344 | #define PD_CTRL_RESP_ENABLED_COMMS (1 << 0) /* Communication enabled */ |
| 3311 | 3345 | #define PD_CTRL_RESP_ENABLED_CONNECTED (1 << 1) /* Device connected */ |
| @@ -3324,7 +3358,7 @@ struct ec_response_usb_pd_control_v1 { · 12 unmodified lines | ||
| 3324 | 3358 | uint8_t role; |
| 3325 | 3359 | uint8_t polarity; |
| 3326 | 3360 | char state[32]; |
| 3327 | −} __packed; | |
| 3361 | +} __ec_align1; | |
| 3328 | 3362 | |
| 3329 | 3363 | #define EC_CMD_USB_PD_PORTS 0x102 |
| 3330 | 3364 | |
| @@ -3333,14 +3367,14 @@ struct ec_response_usb_pd_control_v1 { · 2 unmodified lines | ||
| 3333 | 3367 | |
| 3334 | 3368 | struct ec_response_usb_pd_ports { |
| 3335 | 3369 | uint8_t num_ports; |
| 3336 | −} __packed; | |
| 3370 | +} __ec_align1; | |
| 3337 | 3371 | |
| 3338 | 3372 | #define EC_CMD_USB_PD_POWER_INFO 0x103 |
| 3339 | 3373 | |
| 3340 | 3374 | #define PD_POWER_CHARGING_PORT 0xff |
| 3341 | 3375 | struct ec_params_usb_pd_power_info { |
| 3342 | 3376 | uint8_t port; |
| 3343 | −} __packed; | |
| 3377 | +} __ec_align1; | |
| 3344 | 3378 | |
| 3345 | 3379 | enum usb_chg_type { |
| 3346 | 3380 | USB_CHG_TYPE_NONE, |
| @@ -3366,7 +3400,7 @@ struct usb_chg_measures { · 19 unmodified lines | ||
| 3366 | 3400 | uint16_t voltage_now; |
| 3367 | 3401 | uint16_t current_max; |
| 3368 | 3402 | uint16_t current_lim; |
| 3369 | −} __packed; | |
| 3403 | +} __ec_align2; | |
| 3370 | 3404 | |
| 3371 | 3405 | struct ec_response_usb_pd_power_info { |
| 3372 | 3406 | uint8_t role; |
| @@ -3375,11 +3409,11 @@ struct ec_response_usb_pd_power_info { · 2 unmodified lines | ||
| 3375 | 3409 | uint8_t reserved1; |
| 3376 | 3410 | struct usb_chg_measures meas; |
| 3377 | 3411 | uint32_t max_power; |
| 3378 | −} __packed; | |
| 3412 | +} __ec_align4; | |
| 3379 | 3413 | |
| 3380 | 3414 | struct ec_params_usb_pd_info_request { |
| 3381 | 3415 | uint8_t port; |
| 3382 | −} __packed; | |
| 3416 | +} __ec_align1; | |
| 3383 | 3417 | |
| 3384 | 3418 | /* |
| 3385 | 3419 | * This command will return the number of USB PD charge port + the number |
| @@ -3389,7 +3423,7 @@ struct ec_params_usb_pd_info_request { · 3 unmodified lines | ||
| 3389 | 3423 | #define EC_CMD_CHARGE_PORT_COUNT 0x0105 |
| 3390 | 3424 | struct ec_response_charge_port_count { |
| 3391 | 3425 | uint8_t port_count; |
| 3392 | −} __packed; | |
| 3426 | +} __ec_align1; | |
| 3393 | 3427 | |
| 3394 | 3428 | /* Read USB-PD Device discovery info */ |
| 3395 | 3429 | #define EC_CMD_USB_PD_DISCOVERY 0x0113 |
| @@ -3397,7 +3431,7 @@ struct ec_params_usb_pd_discovery_entry { · 1 unmodified line | ||
| 3397 | 3431 | uint16_t vid; /* USB-IF VID */ |
| 3398 | 3432 | uint16_t pid; /* USB-IF PID */ |
| 3399 | 3433 | uint8_t ptype; /* product type (hub,periph,cable,ama) */ |
| 3400 | −} __packed; | |
| 3434 | +} __ec_align_size1; | |
| 3401 | 3435 | |
| 3402 | 3436 | /* Override default charge behavior */ |
| 3403 | 3437 | #define EC_CMD_PD_CHARGE_PORT_OVERRIDE 0x0114 |
| @@ -3411,7 +3445,7 @@ enum usb_pd_override_ports { · 7 unmodified lines | ||
| 3411 | 3445 | |
| 3412 | 3446 | struct ec_params_charge_port_override { |
| 3413 | 3447 | int16_t override_port; /* Override port# */ |
| 3414 | −} __packed; | |
| 3448 | +} __ec_align2; | |
| 3415 | 3449 | |
| 3416 | 3450 | /* Read (and delete) one entry of PD event log */ |
| 3417 | 3451 | #define EC_CMD_PD_GET_LOG_ENTRY 0x0115 |
| @@ -3422,7 +3456,7 @@ struct ec_response_pd_log { · 4 unmodified lines | ||
| 3422 | 3456 | uint8_t size_port; /* [7:5] port number [4:0] payload size in bytes */ |
| 3423 | 3457 | uint16_t data; /* type-defined data payload */ |
| 3424 | 3458 | uint8_t payload[0]; /* optional additional data payload: 0..16 bytes */ |
| 3425 | −} __packed; | |
| 3459 | +} __ec_align4; | |
| 3426 | 3460 | |
| 3427 | 3461 | /* The timestamp is the microsecond counter shifted to get about a ms. */ |
| 3428 | 3462 | #define PD_LOG_TIMESTAMP_SHIFT 10 /* 1 LSB = 1024us */ |
| @@ -3488,14 +3522,14 @@ struct mcdp_version { · 59 unmodified lines | ||
| 3488 | 3522 | uint8_t major; |
| 3489 | 3523 | uint8_t minor; |
| 3490 | 3524 | uint16_t build; |
| 3491 | −} __packed; | |
| 3525 | +} __ec_align4; | |
| 3492 | 3526 | |
| 3493 | 3527 | struct mcdp_info { |
| 3494 | 3528 | uint8_t family[2]; |
| 3495 | 3529 | uint8_t chipid[2]; |
| 3496 | 3530 | struct mcdp_version irom; |
| 3497 | 3531 | struct mcdp_version fw; |
| 3498 | −} __packed; | |
| 3532 | +} __ec_align4; | |
| 3499 | 3533 | |
| 3500 | 3534 | /* struct mcdp_info field decoding */ |
| 3501 | 3535 | #define MCDP_CHIPID(chipid) ((chipid[0] << 8) | chipid[1]) |
| @@ -3506,7 +3540,7 @@ struct mcdp_info { · 4 unmodified lines | ||
| 3506 | 3540 | |
| 3507 | 3541 | struct ec_params_usb_pd_mux_info { |
| 3508 | 3542 | uint8_t port; /* USB-C port number */ |
| 3509 | −} __packed; | |
| 3543 | +} __ec_align1; | |
| 3510 | 3544 | |
| 3511 | 3545 | /* Flags representing mux state */ |
| 3512 | 3546 | #define USB_PD_MUX_USB_ENABLED (1 << 0) |
| @@ -3516,7 +3550,7 @@ struct ec_params_usb_pd_mux_info { · 3 unmodified lines | ||
| 3516 | 3550 | |
| 3517 | 3551 | struct ec_response_usb_pd_mux_info { |
| 3518 | 3552 | uint8_t flags; /* USB_PD_MUX_*-encoded USB mux state */ |
| 3519 | −} __packed; | |
| 3553 | +} __ec_align1; | |
| 3520 | 3554 | |
| 3521 | 3555 | /*****************************************************************************/ |
| 3522 | 3556 | /* |