Module Name: src Committed By: jakllsch Date: Wed Nov 2 16:54:51 UTC 2011
Modified Files: src/sys/dev/ic: ahcisatareg.h Log Message: Additionally apply __aligned(8) to all __packed hardware data structures. (The hardware actually requires much larger alignment on these structures (128 to 1024 bytes), but 8 is big enough for the compiler to generate more efficient code on strict alignment architectures.) To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/ahcisatareg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ic/ahcisatareg.h diff -u src/sys/dev/ic/ahcisatareg.h:1.10 src/sys/dev/ic/ahcisatareg.h:1.11 --- src/sys/dev/ic/ahcisatareg.h:1.10 Sat Aug 20 16:10:02 2011 +++ src/sys/dev/ic/ahcisatareg.h Wed Nov 2 16:54:50 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisatareg.h,v 1.10 2011/08/20 16:10:02 jakllsch Exp $ */ +/* $NetBSD: ahcisatareg.h,v 1.11 2011/11/02 16:54:50 jakllsch Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -39,7 +39,7 @@ struct ahci_dma_prd { uint32_t prd_dbc; /* data byte count */ #define AHCI_PRD_DBC_MASK 0x003fffff #define AHCI_PRD_DBC_IPC 0x80000000 /* interrupt on completion */ -} __packed; +} __packed __aligned(8); #define AHCI_NPRD ((MAXPHYS/PAGE_SIZE) + 1) @@ -49,7 +49,7 @@ struct ahci_cmd_tbl { uint8_t cmdt_acmd[16]; /* ATAPI command */ uint8_t cmdt_res[48]; /* reserved */ struct ahci_dma_prd cmdt_prd[1]; /* extended to AHCI_NPRD */ -} __packed; +} __packed __aligned(8); #define AHCI_CMDTBL_ALIGN 0x7f @@ -77,7 +77,7 @@ struct ahci_cmd_header { uint32_t cmdh_prdbc; /* physical region descriptor byte count */ uint64_t cmdh_cmdtba; /* phys. addr. of cmd_tbl, 128bytes aligned */ uint32_t cmdh_res[4]; /* reserved */ -} __packed; +} __packed __aligned(8); #define AHCI_CMDH_SIZE (sizeof(struct ahci_cmd_header) * AHCI_MAX_CMDS) @@ -89,7 +89,7 @@ struct ahci_r_fis { uint8_t rfis_sdbfis[8]; /* set device bit FIS */ uint8_t rfis_ukfis[64]; /* unknown FIS */ uint8_t rfis_res[96]; /* reserved */ -} __packed; +} __packed __aligned(8); #define AHCI_RFIS_SIZE (sizeof(struct ahci_r_fis))