mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Add endianess kludge code, so that bitfields work on the sparc64 as well.
Bad GCC, no cookies...
This commit is contained in:
parent
99bb242b53
commit
e8a0928f7e
2 changed files with 150 additions and 18 deletions
156
sys/sys/ata.h
156
sys/sys/ata.h
|
|
@ -33,31 +33,58 @@
|
|||
|
||||
#include <sys/ioccom.h>
|
||||
|
||||
/* ATA/ATAPI device parameter information */
|
||||
struct ata_params {
|
||||
/*000*/ u_int16_t packet_size :2; /* packet command size */
|
||||
#define ATAPI_PSIZE_12 0 /* 12 bytes */
|
||||
#define ATAPI_PSIZE_16 1 /* 16 bytes */
|
||||
|
||||
u_int16_t incomplete :1;
|
||||
u_int16_t :2;
|
||||
u_int16_t drq_type :2; /* DRQ type */
|
||||
#define ATAPI_DRQT_MPROC 0 /* cpu 3 ms delay */
|
||||
#define ATAPI_DRQT_INTR 1 /* intr 10 ms delay */
|
||||
#define ATAPI_DRQT_ACCEL 2 /* accel 50 us delay */
|
||||
|
||||
u_int16_t removable :1; /* device is removable */
|
||||
u_int16_t type :5; /* device type */
|
||||
#define ATAPI_TYPE_DIRECT 0 /* disk/floppy */
|
||||
#define ATAPI_TYPE_TAPE 1 /* streaming tape */
|
||||
#define ATAPI_TYPE_CDROM 5 /* CD-ROM device */
|
||||
#define ATAPI_TYPE_OPTICAL 7 /* optical disk */
|
||||
|
||||
u_int16_t :2;
|
||||
u_int16_t cmd_protocol :1; /* command protocol */
|
||||
#define ATA_PROTO_ATA 0
|
||||
#define ATA_PROTO_ATAPI 1
|
||||
|
||||
#define ATA_BT_SINGLEPORTSECTOR 1 /* 1 port, 1 sector buffer */
|
||||
#define ATA_BT_DUALPORTMULTI 2 /* 2 port, mult sector buffer */
|
||||
#define ATA_BT_DUALPORTMULTICACHE 3 /* above plus track cache */
|
||||
|
||||
#define ATA_FLAG_54_58 1 /* words 54-58 valid */
|
||||
#define ATA_FLAG_64_70 2 /* words 64-70 valid */
|
||||
#define ATA_FLAG_88 4 /* word 88 valid */
|
||||
|
||||
/* ATA/ATAPI device parameter information */
|
||||
struct ata_params {
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
/*000*/ u_int16_t packet_size :2; /* packet command size */
|
||||
|
||||
u_int16_t incomplete :1;
|
||||
u_int16_t :2;
|
||||
u_int16_t drq_type :2; /* DRQ type */
|
||||
|
||||
u_int16_t removable :1; /* device is removable */
|
||||
u_int16_t type :5; /* device type */
|
||||
|
||||
u_int16_t :2;
|
||||
u_int16_t cmd_protocol :1; /* command protocol */
|
||||
#else
|
||||
u_int16_t cmd_protocol :1; /* command protocol */
|
||||
u_int16_t :2;
|
||||
|
||||
u_int16_t type :5; /* device type */
|
||||
u_int16_t removable :1; /* device is removable */
|
||||
|
||||
u_int16_t drq_type :2; /* DRQ type */
|
||||
u_int16_t :2;
|
||||
u_int16_t incomplete :1;
|
||||
|
||||
u_int16_t packet_size :2; /* packet command size */
|
||||
#endif
|
||||
|
||||
/*001*/ u_int16_t cylinders; /* # of cylinders */
|
||||
u_int16_t reserved2;
|
||||
/*003*/ u_int16_t heads; /* # heads */
|
||||
|
|
@ -71,10 +98,18 @@ struct ata_params {
|
|||
u_int16_t obsolete22;
|
||||
/*023*/ u_int8_t revision[8]; /* firmware revision */
|
||||
/*027*/ u_int8_t model[40]; /* model name */
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
/*047*/ u_int16_t sectors_intr:8; /* sectors per interrupt */
|
||||
u_int16_t :8;
|
||||
#else
|
||||
u_int16_t :8;
|
||||
u_int16_t sectors_intr:8; /* sectors per interrupt */
|
||||
#endif
|
||||
|
||||
/*048*/ u_int16_t usedmovsd; /* double word read/write? */
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
/*049*/ u_int16_t retired49:8;
|
||||
u_int16_t support_dma :1; /* DMA supported */
|
||||
u_int16_t support_lba :1; /* LBA supported */
|
||||
|
|
@ -94,17 +129,44 @@ struct ata_params {
|
|||
u_int16_t retired_piomode:8; /* PIO modes 0-2 */
|
||||
/*052*/ u_int16_t vendor52:8;
|
||||
u_int16_t retired_dmamode:8; /* DMA modes, not ATA-3 */
|
||||
#else
|
||||
u_int16_t support_idma :1; /* interleaved DMA supported */
|
||||
u_int16_t support_queueing:1; /* supports queuing overlap */
|
||||
u_int16_t stdby_ovlap :1; /* standby/overlap supported */
|
||||
u_int16_t softreset :1; /* needs softreset when busy */
|
||||
u_int16_t support_iordy :1; /* IORDY supported */
|
||||
u_int16_t disable_iordy :1; /* IORDY may be disabled */
|
||||
u_int16_t support_lba :1; /* LBA supported */
|
||||
u_int16_t support_dma :1; /* DMA supported */
|
||||
u_int16_t retired49:8;
|
||||
|
||||
u_int16_t capability_zero:1;
|
||||
u_int16_t capability_one:1;
|
||||
u_int16_t :13;
|
||||
u_int16_t device_stdby_min:1;
|
||||
|
||||
u_int16_t retired_piomode:8; /* PIO modes 0-2 */
|
||||
u_int16_t vendor51:8;
|
||||
u_int16_t retired_dmamode:8; /* DMA modes, not ATA-3 */
|
||||
u_int16_t vendor52:8;
|
||||
#endif
|
||||
|
||||
/*053*/ u_int16_t atavalid; /* fields valid */
|
||||
#define ATA_FLAG_54_58 1 /* words 54-58 valid */
|
||||
#define ATA_FLAG_64_70 2 /* words 64-70 valid */
|
||||
#define ATA_FLAG_88 4 /* word 88 valid */
|
||||
|
||||
u_int16_t obsolete54[5];
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
/*059*/ u_int16_t multi_count:8;
|
||||
u_int16_t multi_valid:1;
|
||||
u_int16_t :7;
|
||||
#else
|
||||
u_int16_t :7;
|
||||
u_int16_t multi_valid:1;
|
||||
u_int16_t multi_count:8;
|
||||
#endif
|
||||
|
||||
/*060*/ u_int32_t lba_size;
|
||||
/*060*/ u_int16_t lba_size_lo;
|
||||
u_int16_t lba_size_hi;
|
||||
u_int16_t obsolete62;
|
||||
/*063*/ u_int16_t mwdmamodes; /* multiword DMA modes */
|
||||
/*064*/ u_int16_t apiomodes; /* advanced PIO modes */
|
||||
|
|
@ -120,8 +182,13 @@ struct ata_params {
|
|||
u_int16_t reserved73;
|
||||
u_int16_t reserved74;
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
/*075*/ u_int16_t queuelen:5;
|
||||
u_int16_t :11;
|
||||
#else
|
||||
u_int16_t :11;
|
||||
u_int16_t queuelen:5;
|
||||
#endif
|
||||
|
||||
u_int16_t reserved76;
|
||||
u_int16_t reserved77;
|
||||
|
|
@ -130,6 +197,7 @@ struct ata_params {
|
|||
/*080*/ u_int16_t version_major;
|
||||
/*081*/ u_int16_t version_minor;
|
||||
struct {
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
/*082/085*/ u_int16_t smart:1;
|
||||
u_int16_t security:1;
|
||||
u_int16_t removable:1;
|
||||
|
|
@ -173,6 +241,51 @@ struct ata_params {
|
|||
u_int16_t :8;
|
||||
u_int16_t extended_one:1;
|
||||
u_int16_t extended_zero:1;
|
||||
#else
|
||||
u_int16_t :1;
|
||||
u_int16_t nop:1;
|
||||
u_int16_t read_buffer:1;
|
||||
u_int16_t write_buffer:1;
|
||||
u_int16_t :1;
|
||||
u_int16_t protected:1;
|
||||
u_int16_t reset:1;
|
||||
u_int16_t service_irq:1;
|
||||
u_int16_t release_irq:1;
|
||||
u_int16_t look_ahead:1;
|
||||
u_int16_t write_cache:1;
|
||||
u_int16_t packet:1;
|
||||
u_int16_t power_mngt:1;
|
||||
u_int16_t removable:1;
|
||||
u_int16_t security:1;
|
||||
u_int16_t smart:1;
|
||||
|
||||
u_int16_t support_zero:1;
|
||||
u_int16_t support_one:1;
|
||||
u_int16_t flush_cache48:1;
|
||||
u_int16_t flush_cache:1;
|
||||
u_int16_t config_overlay:1;
|
||||
u_int16_t address48:1;
|
||||
u_int16_t auto_acoustic:1;
|
||||
u_int16_t max_security:1;
|
||||
u_int16_t :1;
|
||||
u_int16_t spinup:1;
|
||||
u_int16_t standby:1;
|
||||
u_int16_t notify:1;
|
||||
u_int16_t apm:1;
|
||||
u_int16_t cfa:1;
|
||||
u_int16_t queued:1;
|
||||
u_int16_t microcode:1;
|
||||
|
||||
u_int16_t extended_zero:1;
|
||||
u_int16_t extended_one:1;
|
||||
u_int16_t :8;
|
||||
u_int16_t logging:1;
|
||||
u_int16_t streaming:1;
|
||||
u_int16_t media_card_pass:1;
|
||||
u_int16_t media_serial_no:1;
|
||||
u_int16_t smart_self_test:1;
|
||||
u_int16_t smart_error_log:1;
|
||||
#endif
|
||||
} support, enabled;
|
||||
|
||||
/*088*/ u_int16_t udmamodes; /* UltraDMA modes */
|
||||
|
|
@ -181,6 +294,7 @@ struct ata_params {
|
|||
/*091*/ u_int16_t apm_value;
|
||||
/*092*/ u_int16_t master_passwd_revision;
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
/*093*/ u_int16_t hwres_master :8;
|
||||
u_int16_t hwres_slave :5;
|
||||
u_int16_t hwres_cblid :1;
|
||||
|
|
@ -188,12 +302,24 @@ struct ata_params {
|
|||
|
||||
/*094*/ u_int16_t current_acoustic:8;
|
||||
u_int16_t vendor_acoustic:8;
|
||||
#else
|
||||
u_int16_t hwres_valid:2;
|
||||
u_int16_t hwres_cblid :1;
|
||||
u_int16_t hwres_slave :5;
|
||||
u_int16_t hwres_master :8;
|
||||
|
||||
u_int16_t vendor_acoustic:8;
|
||||
u_int16_t current_acoustic:8;
|
||||
#endif
|
||||
|
||||
/*095*/ u_int16_t stream_min_req_size;
|
||||
/*096*/ u_int16_t stream_transfer_time;
|
||||
/*097*/ u_int16_t stream_access_latency;
|
||||
/*098*/ u_int32_t stream_granularity;
|
||||
/*100*/ u_int64_t lba_size48;
|
||||
/*100*/ u_int16_t lba_size48_1;
|
||||
u_int16_t lba_size48_2;
|
||||
u_int16_t lba_size48_3;
|
||||
u_int16_t lba_size48_4;
|
||||
u_int16_t reserved104[23];
|
||||
/*127*/ u_int16_t removable_status;
|
||||
/*128*/ u_int16_t security_status;
|
||||
|
|
|
|||
|
|
@ -43,9 +43,15 @@ union msf_lba {
|
|||
};
|
||||
|
||||
struct cd_toc_entry {
|
||||
u_int :8;
|
||||
u_int control:4;
|
||||
u_int addr_type:4;
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
u_int16_t :8;
|
||||
u_int16_t control:4;
|
||||
u_int16_t addr_type:4;
|
||||
#else
|
||||
u_int16_t :8;
|
||||
u_int16_t addr_type:4;
|
||||
u_int16_t control:4;
|
||||
#endif
|
||||
u_char track;
|
||||
u_int :8;
|
||||
union msf_lba addr;
|
||||
|
|
|
|||
Loading…
Reference in a new issue