Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


reformatted device include files
Jack Lange [Tue, 3 Mar 2009 23:41:07 +0000 (17:41 -0600)]
palacios/include/devices/apic_regs.h
palacios/include/devices/cdrom.h
palacios/include/devices/ide.h

index c21debe..4d4f540 100644 (file)
 
 
 struct lapic_id_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t rsvd          : 24;
-      uint_t apic_id       : 8;
+    union {
+       uint32_t val;
+       struct {
+           uint_t rsvd          : 24;
+           uint_t apic_id       : 8;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 struct apic_ver_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t ver           : 8;
-      uint_t rsvd1         : 8;
-      uint_t max_lvts      : 8;
-      uint_t rsvd2         : 7;
-      uint_t ext_reg_present : 1;
+    union {
+       uint32_t val;
+       struct {
+           uint_t ver           : 8;
+           uint_t rsvd1         : 8;
+           uint_t max_lvts      : 8;
+           uint_t rsvd2         : 7;
+           uint_t ext_reg_present : 1;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct ext_apic_ctrl_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t ver           : 1;
-      uint_t seoi_enable   : 1;
-      uint_t ext_id_enable : 1;
-      uint_t rsvd2         : 29;
+    union {
+       uint32_t val;
+       struct {
+           uint_t ver           : 1;
+           uint_t seoi_enable   : 1;
+           uint_t ext_id_enable : 1;
+           uint_t rsvd2         : 29;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 
 struct local_vec_tbl_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t vec           : 8;
-      uint_t msg_type      : 3;
-      uint_t rsvd1         : 1;
-      uint_t del_status    : 1;
-      uint_t rsvd2         : 1;
-      uint_t rem_irr       : 1;
-      uint_t trig_mode     : 1;
-      uint_t mask          : 1;
-      uint_t tmr_mode      : 1;
-      uint_t rsvd3         : 14;
+    union {
+       uint32_t val;
+       struct {
+           uint_t vec           : 8;
+           uint_t msg_type      : 3;
+           uint_t rsvd1         : 1;
+           uint_t del_status    : 1;
+           uint_t rsvd2         : 1;
+           uint_t rem_irr       : 1;
+           uint_t trig_mode     : 1;
+           uint_t mask          : 1;
+           uint_t tmr_mode      : 1;
+           uint_t rsvd3         : 14;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct tmr_vec_tbl_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t vec           : 8;
-      uint_t rsvd          : 4;
-      uint_t del_status    : 1;
-      uint_t rsvd2         : 3;
-      uint_t mask          : 1;
+    union {
+       uint32_t val;
+       struct {
+           uint_t vec           : 8;
+           uint_t rsvd          : 4;
+           uint_t del_status    : 1;
+           uint_t rsvd2         : 3;
+           uint_t mask          : 1;
 #define APIC_TMR_ONESHOT  0
 #define APIC_TMR_PERIODIC 1
-      uint_t tmr_mode      : 1;
-      uint_t rsvd3         : 14;
+           uint_t tmr_mode      : 1;
+           uint_t rsvd3         : 14;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
@@ -103,221 +103,221 @@ struct tmr_div_cfg_reg {
 #define APIC_TMR_DIV32   0x8 // 1000
 #define APIC_TMR_DIV64   0x9 // 1001
 #define APIC_TMR_DIV128  0xa // 1010
-  union {
-    uint32_t val;
-    struct {
-      uint_t div_val       : 2;
-      uint_t rsvd1         : 1;
-      uint_t div_val2      : 1;
-      uint_t rsvd2         : 28;
+    union {
+       uint32_t val;
+       struct {
+           uint_t div_val       : 2;
+           uint_t rsvd1         : 1;
+           uint_t div_val2      : 1;
+           uint_t rsvd2         : 28;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct lint_vec_tbl_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t vec           : 8;
-      uint_t msg_type      : 3;
-      uint_t rsvd1         : 1;
-      uint_t del_status    : 1;
-      uint_t rsvd2         : 1;
-      uint_t rem_irr       : 1;
-      uint_t trig_mode     : 1;
-      uint_t mask          : 1;
-      uint_t rsvd3         : 15;
+    union {
+       uint32_t val;
+       struct {
+           uint_t vec           : 8;
+           uint_t msg_type      : 3;
+           uint_t rsvd1         : 1;
+           uint_t del_status    : 1;
+           uint_t rsvd2         : 1;
+           uint_t rem_irr       : 1;
+           uint_t trig_mode     : 1;
+           uint_t mask          : 1;
+           uint_t rsvd3         : 15;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct perf_ctr_loc_vec_tbl_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t vec           : 8;
-      uint_t msg_type      : 3;
-      uint_t rsvd1         : 1;
-      uint_t del_status    : 1;
-      uint_t rsvd2         : 3;
-      uint_t mask          : 1;
-      uint_t rsvd3         : 15;
+    union {
+       uint32_t val;
+       struct {
+           uint_t vec           : 8;
+           uint_t msg_type      : 3;
+           uint_t rsvd1         : 1;
+           uint_t del_status    : 1;
+           uint_t rsvd2         : 3;
+           uint_t mask          : 1;
+           uint_t rsvd3         : 15;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct therm_loc_vec_tbl_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t vec           : 8;
-      uint_t msg_type      : 3;
-      uint_t rsvd1         : 1;
-      uint_t del_status    : 1;
-      uint_t rsvd2         : 3;
-      uint_t mask          : 1;
-      uint_t rsvd3         : 15;
+    union {
+       uint32_t val;
+       struct {
+           uint_t vec           : 8;
+           uint_t msg_type      : 3;
+           uint_t rsvd1         : 1;
+           uint_t del_status    : 1;
+           uint_t rsvd2         : 3;
+           uint_t mask          : 1;
+           uint_t rsvd3         : 15;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 struct err_vec_tbl_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t vec           : 8;
-      uint_t msg_type      : 3;
-      uint_t rsvd1         : 1;
-      uint_t del_status    : 1;
-      uint_t rsvd2         : 3;
-      uint_t mask          : 1;
-      uint_t rsvd3         : 15;
+    union {
+       uint32_t val;
+       struct {
+           uint_t vec           : 8;
+           uint_t msg_type      : 3;
+           uint_t rsvd1         : 1;
+           uint_t del_status    : 1;
+           uint_t rsvd2         : 3;
+           uint_t mask          : 1;
+           uint_t rsvd3         : 15;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct err_status_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t rsvd1         : 2;
-      uint_t sent_acc_err  : 1;
-      uint_t recv_acc_err  : 1;
-      uint_t rsvd2         : 1;
-      uint_t sent_ill_err  : 1;
-      uint_t recv_ill_err  : 1;
-      uint_t ill_reg_addr  : 1;
-      uint_t rsvd3         : 24;
+    union {
+       uint32_t val;
+       struct {
+           uint_t rsvd1         : 2;
+           uint_t sent_acc_err  : 1;
+           uint_t recv_acc_err  : 1;
+           uint_t rsvd2         : 1;
+           uint_t sent_ill_err  : 1;
+           uint_t recv_ill_err  : 1;
+           uint_t ill_reg_addr  : 1;
+           uint_t rsvd3         : 24;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct spurious_int_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t vec           : 8;
-      uint_t apic_soft_en  : 1;
-      uint_t foc_cpu_chk   : 1;
-      uint_t rsvd1         : 22;
+    union {
+       uint32_t val;
+       struct {
+           uint_t vec           : 8;
+           uint_t apic_soft_en  : 1;
+           uint_t foc_cpu_chk   : 1;
+           uint_t rsvd1         : 22;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 struct int_cmd_reg {
-  union {
-    uint64_t val;
-
-    struct {
-      uint32_t lo;
-      uint32_t hi;
-    } __attribute__((packed));
-
-    struct {
-      uint_t vec           : 8;
-      uint_t msg_type      : 3;
-      uint_t dst_mode      : 1;
-      uint_t del_status    : 1;
-      uint_t rsvd1         : 1;
-      uint_t lvl           : 1;
-      uint_t trig_mode     : 1;
-      uint_t rem_rd_status : 2;
-      uint_t dst_shorthand : 2;
-      uint64_t rsvd2       : 36;
-      uint32_t dst         : 8;
+    union {
+       uint64_t val;
+
+       struct {
+           uint32_t lo;
+           uint32_t hi;
+       } __attribute__((packed));
+
+       struct {
+           uint_t vec           : 8;
+           uint_t msg_type      : 3;
+           uint_t dst_mode      : 1;
+           uint_t del_status    : 1;
+           uint_t rsvd1         : 1;
+           uint_t lvl           : 1;
+           uint_t trig_mode     : 1;
+           uint_t rem_rd_status : 2;
+           uint_t dst_shorthand : 2;
+           uint64_t rsvd2       : 36;
+           uint32_t dst         : 8;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct log_dst_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t rsvd1         : 24;
-      uint_t dst_log_id    : 8;
+    union {
+       uint32_t val;
+       struct {
+           uint_t rsvd1         : 24;
+           uint_t dst_log_id    : 8;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct dst_fmt_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t rsvd1         : 28;
-      uint_t model         : 4;
+    union {
+       uint32_t val;
+       struct {
+           uint_t rsvd1         : 28;
+           uint_t model         : 4;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct arb_prio_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t arb_prio_sub  : 4;
-      uint_t arb_prio      : 4;
-      uint_t rsvd1         : 24;
+    union {
+       uint32_t val;
+       struct {
+           uint_t arb_prio_sub  : 4;
+           uint_t arb_prio      : 4;
+           uint_t rsvd1         : 24;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 
 
 struct task_prio_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t task_prio_sub  : 4;
-      uint_t task_prio      : 4;
-      uint_t rsvd1         : 24;
+    union {
+       uint32_t val;
+       struct {
+           uint_t task_prio_sub  : 4;
+           uint_t task_prio      : 4;
+           uint_t rsvd1         : 24;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 
 struct proc_prio_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t proc_prio_sub  : 4;
-      uint_t proc_prio      : 4;
-      uint_t rsvd1         : 24;
+    union {
+       uint32_t val;
+       struct {
+           uint_t proc_prio_sub  : 4;
+           uint_t proc_prio      : 4;
+           uint_t rsvd1         : 24;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 struct ext_apic_feature_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t int_en_reg_cap : 1;
-      uint_t spec_eoi_cap   : 1;
-      uint_t ext_apic_id_cap: 1;
-      uint_t rsvd1          : 13;
-      uint_t ext_lvt_cnt    : 8;
-      uint_t rsvd2          : 8;
+    union {
+       uint32_t val;
+       struct {
+           uint_t int_en_reg_cap : 1;
+           uint_t spec_eoi_cap   : 1;
+           uint_t ext_apic_id_cap: 1;
+           uint_t rsvd1          : 13;
+           uint_t ext_lvt_cnt    : 8;
+           uint_t rsvd2          : 8;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
 struct spec_eoi_reg {
-  union {
-    uint32_t val;
-    struct {
-      uint_t vec           : 8;
-      uint_t rsvd1         : 24;
+    union {
+       uint32_t val;
+       struct {
+           uint_t vec           : 8;
+           uint_t rsvd1         : 24;
+       } __attribute__((packed));
     } __attribute__((packed));
-  } __attribute__((packed));
 } __attribute__((packed));
 
 
index c4f5b46..ea4d9c5 100644 (file)
 
 
 struct cdrom_ops {
-  /* 
-   * Load CD-ROM. Returns false if CD is not ready. 
-   */
-  rd_bool (*insert_cdrom)(void * private_data);
-
-  /* 
-   * Logically eject the CD.
-   */
-  void (*eject_cdrom)(void * private_data);
+    /* 
+     * Load CD-ROM. Returns false if CD is not ready. 
+     */
+    rd_bool (*insert_cdrom)(void * private_data);
+
+    /* 
+     * Logically eject the CD.
+     */
+    void (*eject_cdrom)(void * private_data);
   
-  /* 
-   * Read CD TOC. Returns false if start track is out of bounds.
-   */
-  rd_bool (*read_toc)(void * private_data, uchar_t * buf, int * length, rd_bool msf, int start_track);
+    /* 
+     * Read CD TOC. Returns false if start track is out of bounds.
+     */
+    rd_bool (*read_toc)(void * private_data, uchar_t * buf, int * length, rd_bool msf, int start_track);
   
-  /* 
-   * Return CD-ROM capacity (in 2048 byte frames)
-   */
-  uint32_t (*capacity)(void * private_data);
+    /* 
+     * Return CD-ROM capacity (in 2048 byte frames)
+     */
+    uint32_t (*capacity)(void * private_data);
   
-  /*
-   * Read a single block from the CD
-   */
-  void (*read_block)(void * private_data, uchar_t * buf, int lba);
+    /*
+     * Read a single block from the CD
+     */
+    void (*read_block)(void * private_data, uchar_t * buf, int lba);
   
-  /*
-   * Start (spin up) the CD.
-   */
-  int (*start_cdrom)(void * private_data);
+    /*
+     * Start (spin up) the CD.
+     */
+    int (*start_cdrom)(void * private_data);
 
-  void (*set_LBA)(void * private_data, uchar_t lba);
+    void (*set_LBA)(void * private_data, uchar_t lba);
 };
 
 
index 03d8a48..b43d4a6 100644 (file)
@@ -56,48 +56,48 @@ typedef uint64_t Bit64u;
 #define MAX_ATA_CHANNEL 4
 
 typedef enum _sense {
-      SENSE_NONE = 0, 
-      SENSE_NOT_READY = 2, 
-      SENSE_ILLEGAL_REQUEST = 5,
-      SENSE_UNIT_ATTENTION = 6
+    SENSE_NONE = 0, 
+    SENSE_NOT_READY = 2, 
+    SENSE_ILLEGAL_REQUEST = 5,
+    SENSE_UNIT_ATTENTION = 6
 } sense_t ;
 
 typedef enum _asc {
-      ASC_INV_FIELD_IN_CMD_PACKET = 0x24,
-      ASC_MEDIUM_NOT_PRESENT = 0x3a,
-      ASC_SAVING_PARAMETERS_NOT_SUPPORTED = 0x39,
-      ASC_LOGICAL_BLOCK_OOR = 0x21
+    ASC_INV_FIELD_IN_CMD_PACKET = 0x24,
+    ASC_MEDIUM_NOT_PRESENT = 0x3a,
+    ASC_SAVING_PARAMETERS_NOT_SUPPORTED = 0x39,
+    ASC_LOGICAL_BLOCK_OOR = 0x21
 } asc_t ;
 
 
 
 typedef struct  {
-  unsigned cylinders;
-  unsigned heads;
-  unsigned sectors;
+    unsigned cylinders;
+    unsigned heads;
+    unsigned sectors;
 } device_image_t;
 
 
 
 
 struct interrupt_reason_t {
-  unsigned  c_d : 1; 
-  unsigned  i_o : 1; 
-  unsigned  rel : 1; 
-  unsigned  tag : 5; 
+    unsigned  c_d : 1; 
+    unsigned  i_o : 1; 
+    unsigned  rel : 1; 
+    unsigned  tag : 5; 
 };
 
 
 struct controller_status {
-  rd_bool busy;
-  rd_bool drive_ready;
-  rd_bool write_fault;
-  rd_bool seek_complete;
-  rd_bool drq;
-  rd_bool corrected_data;
-  rd_bool index_pulse;
-  unsigned int index_pulse_count;
-  rd_bool err;
+    rd_bool busy;
+    rd_bool drive_ready;
+    rd_bool write_fault;
+    rd_bool seek_complete;
+    rd_bool drq;
+    rd_bool corrected_data;
+    rd_bool index_pulse;
+    unsigned int index_pulse_count;
+    rd_bool err;
 };
 
 
@@ -105,110 +105,110 @@ struct controller_status {
 
 
 struct  sense_info_t {
-  sense_t sense_key;
+    sense_t sense_key;
 
-  struct  {
-    Bit8u arr[4];
-  } information;
+    struct  {
+       Bit8u arr[4];
+    } information;
 
-  struct  {
-    Bit8u arr[4];
-  } specific_inf;
+    struct  {
+       Bit8u arr[4];
+    } specific_inf;
 
-  struct  {
-    Bit8u arr[3];
-  } key_spec;
+    struct  {
+       Bit8u arr[3];
+    } key_spec;
 
-  Bit8u fruc;
-  Bit8u asc;
-  Bit8u ascq;
+    Bit8u fruc;
+    Bit8u asc;
+    Bit8u ascq;
 };
 
 
 struct  error_recovery_t {
-  unsigned char data[8];
+    unsigned char data[8];
 };
 
 struct  cdrom_t {
-  rd_bool ready;
-  rd_bool locked;
+    rd_bool ready;
+    rd_bool locked;
 
-  struct cdrom_ops * cd;
+    struct cdrom_ops * cd;
 
-  uint32_t capacity;
-  int next_lba;
-  int remaining_blocks;
+    uint32_t capacity;
+    int next_lba;
+    int remaining_blocks;
 
-  struct  currentStruct {
-    struct error_recovery_t error_recovery;
-  } current;
+    struct  currentStruct {
+       struct error_recovery_t error_recovery;
+    } current;
 
 };
 
 struct  atapi_t {
-  uint8_t command;
-  int drq_bytes;
-  int total_bytes_remaining;
+    uint8_t command;
+    int drq_bytes;
+    int total_bytes_remaining;
 };
 
 
 typedef enum { IDE_NONE, IDE_DISK, IDE_CDROM } device_type_t;
 
 struct controller_t  {
-  struct controller_status status;
-  Bit8u    error_register;
-  Bit8u    head_no;
+    struct controller_status status;
+    Bit8u    error_register;
+    Bit8u    head_no;
 
-  union {
-    Bit8u    sector_count;
-    struct interrupt_reason_t interrupt_reason;
-  };
+    union {
+       Bit8u    sector_count;
+       struct interrupt_reason_t interrupt_reason;
+    };
 
 
-  Bit8u    sector_no;
+    Bit8u    sector_no;
 
-  union  {
-    Bit16u   cylinder_no;
-    Bit16u   byte_count;
-  };
+    union  {
+       Bit16u   cylinder_no;
+       Bit16u   byte_count;
+    };
 
-  Bit8u    buffer[2048]; 
-  Bit32u   buffer_index;
-  Bit32u   drq_index;
-  Bit8u    current_command;
-  Bit8u    sectors_per_block;
-  Bit8u    lba_mode;
+    Bit8u    buffer[2048]; 
+    Bit32u   buffer_index;
+    Bit32u   drq_index;
+    Bit8u    current_command;
+    Bit8u    sectors_per_block;
+    Bit8u    lba_mode;
 
-  struct  {
-    rd_bool reset;       // 0=normal, 1=reset controller
-    rd_bool disable_irq;     // 0=allow irq, 1=disable irq
-  } control;
+    struct  {
+       rd_bool reset;       // 0=normal, 1=reset controller
+       rd_bool disable_irq;     // 0=allow irq, 1=disable irq
+    } control;
 
-  Bit8u    reset_in_progress;
-  Bit8u    features;
+    Bit8u    reset_in_progress;
+    Bit8u    features;
 };
 
 
 
 
 struct  drive_t {
-  device_image_t  hard_drive;
-  device_type_t device_type;
-  // 512 byte buffer for ID drive command
-  // These words are stored in native word endian format, as
-  // they are fetched and returned via a return(), so
-  // there's no need to keep them in x86 endian format.
-  Bit16u id_drive[256];
+    device_image_t  hard_drive;
+    device_type_t device_type;
+    // 512 byte buffer for ID drive command
+    // These words are stored in native word endian format, as
+    // they are fetched and returned via a return(), so
+    // there's no need to keep them in x86 endian format.
+    Bit16u id_drive[256];
   
-  struct controller_t controller;
-  struct cdrom_t cdrom;
-  struct sense_info_t sense;
-  struct atapi_t atapi;
+    struct controller_t controller;
+    struct cdrom_t cdrom;
+    struct sense_info_t sense;
+    struct atapi_t atapi;
   
-  /* JRL */
-  void * private_data;
+    /* JRL */
+    void * private_data;
 
-  Bit8u model_no[41];
+    Bit8u model_no[41];
 };
 
 
@@ -216,18 +216,18 @@ struct  drive_t {
 // For each ATA channel we should have one controller struct
 // and an array of two drive structs
 struct  channel_t {
-  struct drive_t drives[2];
-  unsigned drive_select;
+    struct drive_t drives[2];
+    unsigned drive_select;
   
-  Bit16u ioaddr1;
-  Bit16u ioaddr2;
-  Bit8u  irq;
+    Bit16u ioaddr1;
+    Bit16u ioaddr2;
+    Bit8u  irq;
 };
 
 
 
 struct  ramdisk_t {
-  struct channel_t channels[MAX_ATA_CHANNEL];
+    struct channel_t channels[MAX_ATA_CHANNEL];
 };