More sonarlint work

This commit is contained in:
Jasmine Iwanek
2023-06-09 23:46:54 -04:00
parent 0d1d069af4
commit ee695e71f9
218 changed files with 6282 additions and 3845 deletions

View File

@@ -161,54 +161,54 @@ enum {
* block is transferred.
*/
#pragma pack(push, 1)
typedef struct {
typedef struct ssb_t {
/* Status byte 0. */
uint8_t track_0 : 1, /* T0 */
mbz1 : 1, /* 0 */
mbz2 : 1, /* 0 */
cylinder_err : 1, /* CE */
write_fault : 1, /* WF */
mbz3 : 1, /* 0 */
seek_end : 1, /* SE */
not_ready : 1; /* NR */
uint8_t track_0 : 1; /* T0 */
uint8_t mbz1 : 1; /* 0 */
uint8_t mbz2 : 1; /* 0 */
uint8_t cylinder_err : 1; /* CE */
uint8_t write_fault : 1; /* WF */
uint8_t mbz3 : 1; /* 0 */
uint8_t seek_end : 1; /* SE */
uint8_t not_ready : 1; /* NR */
/* Status byte 1. */
uint8_t id_not_found : 1, /* ID */
mbz4 : 1, /* 0 */
mbz5 : 1, /* 0 */
wrong_cyl : 1, /* WC */
all_bit_set : 1, /* BT */
mark_not_found : 1, /* AM */
ecc_crc_err : 1, /* ET */
ecc_crc_field : 1; /* EF */
uint8_t id_not_found : 1; /* ID */
uint8_t mbz4 : 1; /* 0 */
uint8_t mbz5 : 1; /* 0 */
uint8_t wrong_cyl : 1; /* WC */
uint8_t all_bit_set : 1; /* BT */
uint8_t mark_not_found : 1; /* AM */
uint8_t ecc_crc_err : 1; /* ET */
uint8_t ecc_crc_field : 1; /* EF */
/* Status byte 2. */
uint8_t headsel_state : 4, /* headsel state[4] */
defective_sector : 1, /* DS */
retried_ok : 1, /* RG */
need_reset : 1, /* RR */
uint8_t headsel_state : 4; /* headsel state[4] */
uint8_t defective_sector : 1; /* DS */
uint8_t retried_ok : 1; /* RG */
uint8_t need_reset : 1; /* RR */
#if 1
valid : 1; /* 0 (abused as VALID) */
uint8_t valid : 1; /* 0 (abused as VALID) */
#else
mbz6 : 1; /* 0 */
uint8_t mbz6 : 1; /* 0 */
#endif
/* Most recent ID field seen. */
uint8_t last_cyl_low; /* Cyl_Low[8] */
uint8_t last_head : 4, /* HD[4] */
mbz7 : 1, /* 0 */
last_cyl_high : 2, /* Cyl_high[2] */
last_def_sect : 1; /* DS */
uint8_t last_sect; /* Sect[8] */
uint8_t last_cyl_low; /* Cyl_Low[8] */
uint8_t last_head : 4; /* HD[4] */
uint8_t mbz7 : 1; /* 0 */
uint8_t last_cyl_high : 2; /* Cyl_high[2] */
uint8_t last_def_sect : 1; /* DS */
uint8_t last_sect; /* Sect[8] */
uint8_t sect_size; /* Size[8] = 02 */
/* Current position. */
uint8_t curr_cyl_high : 2, /* Cyl_High_[2] */
mbz8 : 1, /* 0 */
mbz9 : 1, /* 0 */
curr_head : 4; /* HD_2[4] */
uint8_t curr_cyl_low; /* Cyl_Low_2[8] */
uint8_t curr_cyl_high : 2; /* Cyl_High_[2] */
uint8_t mbz8 : 1; /* 0 */
uint8_t mbz9 : 1; /* 0 */
uint8_t curr_head : 4; /* HD_2[4] */
uint8_t curr_cyl_low; /* Cyl_Low_2[8] */
uint8_t sect_corr; /* sectors corrected */
@@ -290,21 +290,21 @@ typedef struct {
* bits 0.
*/
#pragma pack(push, 1)
typedef struct {
uint8_t cyl_high : 2, /* cylinder [9:8] bits */
defective_sector : 1, /* DS */
mbz1 : 1, /* 0 */
head : 4; /* head number */
typedef struct fcb_t {
uint8_t cyl_high : 2; /* cylinder [9:8] bits */
uint8_t defective_sector : 1; /* DS */
uint8_t mbz1 : 1; /* 0 */
uint8_t head : 4; /* head number */
uint8_t cyl_low; /* cylinder [7:0] bits */
uint8_t cyl_low; /* cylinder [7:0] bits */
uint8_t sector; /* sector number */
uint8_t sector; /* sector number */
uint8_t mbz2 : 1, /* 0 */
mbo : 1, /* 1 */
mbz3 : 6; /* 000000 */
uint8_t mbz2 : 1; /* 0 */
uint8_t mbo : 1; /* 1 */
uint8_t mbz3 : 6; /* 000000 */
uint8_t fill; /* filler byte */
uint8_t fill; /* filler byte */
} fcb_t;
#pragma pack(pop)
@@ -316,31 +316,31 @@ typedef struct {
* through a DMA or PIO operation.
*/
#pragma pack(push, 1)
typedef struct {
uint8_t ec_p : 1, /* EC/P (ecc/park) */
mbz1 : 1, /* 0 */
auto_seek : 1, /* AS (auto-seek) */
no_data : 1, /* ND (no data) */
cmd : 4; /* command code[4] */
typedef struct ccb_t{
uint8_t ec_p : 1; /* EC/P (ecc/park) */
uint8_t mbz1 : 1; /* 0 */
uint8_t auto_seek : 1; /* AS (auto-seek) */
uint8_t no_data : 1; /* ND (no data) */
uint8_t cmd : 4; /* command code[4] */
uint8_t cyl_high : 2, /* cylinder [9:8] bits */
mbz2 : 2, /* 00 */
head : 4; /* head number */
uint8_t cyl_high : 2; /* cylinder [9:8] bits */
uint8_t mbz2 : 2; /* 00 */
uint8_t head : 4; /* head number */
uint8_t cyl_low; /* cylinder [7:0] bits */
uint8_t sector; /* sector number */
uint8_t mbz3 : 1, /* 0 */
mbo1 : 1, /* 1 */
mbz4 : 6; /* 000000 */
uint8_t mbz3 : 1; /* 0 */
uint8_t mbo1 : 1; /* 1 */
uint8_t mbz4 : 6; /* 000000 */
uint8_t count; /* blk count/interleave */
} ccb_t;
#pragma pack(pop)
/* Define the hard drive geometry table. */
typedef struct {
typedef struct geom_t {
uint16_t cyl;
uint8_t hpc;
uint8_t spt;
@@ -349,54 +349,54 @@ typedef struct {
} geom_t;
/* Define an attached drive. */
typedef struct {
int8_t id, /* drive ID on bus */
present, /* drive is present */
hdd_num, /* index to global disk table */
type; /* drive type ID */
typedef struct drive_t {
int8_t id; /* drive ID on bus */
int8_t present; /* drive is present */
int8_t hdd_num; /* index to global disk table */
int8_t type; /* drive type ID */
uint16_t cur_cyl; /* last known position of heads */
uint8_t spt, /* active drive parameters */
hpc;
uint8_t spt; /* active drive parameters */
uint8_t hpc;
uint16_t tracks;
uint8_t cfg_spt, /* configured drive parameters */
cfg_hpc;
uint8_t cfg_spt; /* configured drive parameters */
uint8_t cfg_hpc;
uint16_t cfg_tracks;
} drive_t;
typedef struct {
typedef struct hdc_t {
uint16_t base; /* controller base I/O address */
int8_t irq; /* controller IRQ channel */
int8_t dma; /* controller DMA channel */
/* Registers. */
uint8_t attn, /* ATTENTION register */
ctrl, /* Control register (ACR) */
status, /* Status register (ASR) */
intstat; /* Interrupt Status register (ISR) */
uint8_t attn; /* ATTENTION register */
uint8_t ctrl; /* Control register (ACR) */
uint8_t status; /* Status register (ASR) */
uint8_t intstat; /* Interrupt Status register (ISR) */
uint8_t *reg_91; /* handle to system board's register 0x91 */
/* Controller state. */
uint64_t callback;
pc_timer_t timer;
int8_t state, /* controller state */
reset; /* reset state counter */
int8_t state; /* controller state */
int8_t reset; /* reset state counter */
/* Data transfer. */
int16_t buf_idx, /* buffer index and pointer */
buf_len;
int16_t buf_idx; /* buffer index and pointer */
int16_t buf_len;
uint8_t *buf_ptr;
/* Current operation parameters. */
ssb_t ssb; /* sense block */
ccb_t ccb; /* command control block */
uint16_t track; /* requested track# */
uint8_t head, /* requested head# */
sector; /* requested sector# */
int count; /* requested sector count */
ssb_t ssb; /* sense block */
ccb_t ccb; /* command control block */
uint16_t track; /* requested track# */
uint8_t head; /* requested head# */
uint8_t sector; /* requested sector# */
int count; /* requested sector count */
drive_t drives[XTA_NUM]; /* the attached drive(s) */
@@ -602,8 +602,10 @@ do_seek(hdc_t *dev, drive_t *drive, uint16_t cyl)
static void
do_format(hdc_t *dev, drive_t *drive, ccb_t *ccb)
{
int start_cyl, end_cyl;
int intr = 0, val;
int start_cyl;
int end_cyl;
int intr = 0;
int val;
off64_t addr;
#if 0
fcb_t *fcb;
@@ -697,8 +699,7 @@ do_fmt:
/* Done with this track. */
dev->state = STATE_FDONE;
/*FALLTHROUGH*/
[[fallthrough]];
case STATE_FDONE:
/* One more track done. */
if (++start_cyl == end_cyl) {
@@ -712,6 +713,9 @@ do_fmt:
/* This saves us a LOT of code. */
dev->state = STATE_FINIT;
goto do_fmt;
default:
break;
}
/* If we errored out, go back idle. */
@@ -870,6 +874,9 @@ do_send:
/* This saves us a LOT of code. */
dev->state = STATE_SEND;
goto do_send;
default:
break;
}
break;
@@ -1012,6 +1019,9 @@ do_recv:
/* This saves us a LOT of code. */
dev->state = STATE_RECV;
goto do_recv;
default:
break;
}
break;
@@ -1125,6 +1135,9 @@ hdc_read(uint16_t port, void *priv)
ret = dev->intstat;
dev->intstat = 0x00;
break;
default:
break;
}
return ret;
@@ -1231,11 +1244,14 @@ hdc_write(uint16_t port, uint8_t val, void *priv)
set_intr(dev, 1);
}
break;
default:
break;
}
}
static void *
ps1_hdc_init(const device_t *info)
ps1_hdc_init(UNUSED(const device_t *info))
{
drive_t *drive;
hdc_t *dev;