aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Geiselbrecht <geist@foobox.com>2024-04-18 23:51:38 -0700
committerTravis Geiselbrecht <geist@foobox.com>2024-04-19 00:07:49 -0700
commit9a4fae0714875a60ac7cc483888788df5fb33c46 (patch)
tree06518899815fed2c127d90c7b499d949a1e2cd87
parent6ed6f36fa060430f4a951c2f4ad459a2c850ba33 (diff)
downloadlk-9a4fae0714875a60ac7cc483888788df5fb33c46.tar.gz
[warnings] remove some extraneous __PACKED attributes
Also remove a few extra data structures that were marked packed but not otherwise used anywhere.
-rw-r--r--dev/bus/pci/include/dev/bus/pci.h21
-rw-r--r--dev/include/hw/pci.h2
-rw-r--r--lib/partition/include/lib/partition.h4
-rw-r--r--lib/partition/partition.c9
-rw-r--r--lib/tga/tga.c1
5 files changed, 12 insertions, 25 deletions
diff --git a/dev/bus/pci/include/dev/bus/pci.h b/dev/bus/pci/include/dev/bus/pci.h
index 10e90d19..0368205e 100644
--- a/dev/bus/pci/include/dev/bus/pci.h
+++ b/dev/bus/pci/include/dev/bus/pci.h
@@ -36,27 +36,6 @@ typedef struct {
bool valid;
} pci_bar_t;
-typedef struct {
- uint8_t id;
- uint8_t next;
-} __PACKED pci_capability_t;
-
-typedef struct {
- uint8_t bus;
- uint8_t device;
- uint8_t link_int_a;
- uint16_t irq_int_a;
- uint8_t link_int_b;
- uint16_t irq_int_b;
- uint8_t link_int_c;
- uint16_t irq_int_c;
- uint8_t link_int_d;
- uint16_t irq_int_d;
- uint8_t slot;
- uint8_t reserved;
-} __PACKED irq_routing_entry;
-
-
// only use one of these two:
// try to detect PCI based on legacy PC PCI accessor methods
status_t pci_init_legacy(void);
diff --git a/dev/include/hw/pci.h b/dev/include/hw/pci.h
index 55b5c04d..5fa3f9f7 100644
--- a/dev/include/hw/pci.h
+++ b/dev/include/hw/pci.h
@@ -141,7 +141,7 @@ typedef struct {
uint16_t bridge_control;
} type1; // configuration for bridge devices
};
-} __PACKED pci_config_t;
+} pci_config_t;
static_assert(sizeof(pci_config_t) == 0x40, "");
/* Class/subclass codes (incomplete) */
diff --git a/lib/partition/include/lib/partition.h b/lib/partition/include/lib/partition.h
index 585a4e7a..69b91a34 100644
--- a/lib/partition/include/lib/partition.h
+++ b/lib/partition/include/lib/partition.h
@@ -7,11 +7,15 @@
*/
#pragma once
+#include <lk/compiler.h>
#include <sys/types.h>
+__BEGIN_CDECLS
+
/* examine and try to publish partitions on a particular device at a particular offset */
int partition_publish(const char *device, off_t offset);
/* remove any published subdevices on this device */
int partition_unpublish(const char *device);
+__END_CDECLS
diff --git a/lib/partition/partition.c b/lib/partition/partition.c
index 30bad978..0db56c74 100644
--- a/lib/partition/partition.c
+++ b/lib/partition/partition.c
@@ -5,6 +5,8 @@
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
+#include "lib/partition.h"
+
#include <lk/debug.h>
#include <stdio.h>
#include <string.h>
@@ -12,13 +14,13 @@
#include <stdlib.h>
#include <arch.h>
#include <lib/bio.h>
-#include <lib/partition.h>
+#include <assert.h>
struct chs {
uint8_t c;
uint8_t h;
uint8_t s;
-} __PACKED;
+};
struct mbr_part {
uint8_t status;
@@ -27,7 +29,8 @@ struct mbr_part {
struct chs end;
uint32_t lba_start;
uint32_t lba_length;
-} __PACKED;
+};
+static_assert(sizeof(struct mbr_part) == 16, "");
static status_t validate_mbr_partition(bdev_t *dev, const struct mbr_part *part) {
/* check for invalid types */
diff --git a/lib/tga/tga.c b/lib/tga/tga.c
index 7b652937..4af3e92a 100644
--- a/lib/tga/tga.c
+++ b/lib/tga/tga.c
@@ -35,6 +35,7 @@ struct tga_header {
uint8_t bitsperpixel;
uint8_t imagedescriptor;
} __PACKED;
+static_assert(sizeof(struct tga_header) == 18, "");
static void print_tga_info(const struct tga_header *header) {
LTRACEF("idlength %hhd\n", header->idlength);