Arc type cleanup
This commit is contained in:
parent
cdcfe2a95f
commit
96a29d188b
3 changed files with 76 additions and 61 deletions
|
@ -22,7 +22,7 @@
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/arc/arc.h>
|
#include <grub/arc/arc.h>
|
||||||
|
|
||||||
static unsigned last_handle = 0;
|
static grub_arc_fileno_t last_handle = 0;
|
||||||
static char *last_path = NULL;
|
static char *last_path = NULL;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -45,7 +45,7 @@ grub_arcdisk_iterate (int (*hook_in) (const char *name))
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
reopen (const char *name)
|
reopen (const char *name)
|
||||||
{
|
{
|
||||||
unsigned handle;
|
grub_arc_fileno_t handle;
|
||||||
|
|
||||||
if (last_path && grub_strcmp (last_path, name) == 0)
|
if (last_path && grub_strcmp (last_path, name) == 0)
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ grub_arcdisk_open (const char *name, grub_disk_t disk)
|
||||||
const char *iptr;
|
const char *iptr;
|
||||||
int state = 0;
|
int state = 0;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
int r;
|
grub_arc_err_t r;
|
||||||
struct grub_arc_fileinfo info;
|
struct grub_arc_fileinfo info;
|
||||||
if (grub_memcmp (name, "arc/", 4) != 0)
|
if (grub_memcmp (name, "arc/", 4) != 0)
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not arc device");
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not arc device");
|
||||||
|
@ -124,7 +124,7 @@ grub_arcdisk_open (const char *name, grub_disk_t disk)
|
||||||
grub_uint64_t res = 0;
|
grub_uint64_t res = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
grub_dprintf ("arcdisk", "couldn't retrieve size: %d\n", r);
|
grub_dprintf ("arcdisk", "couldn't retrieve size: %ld\n", r);
|
||||||
for (i = 40; i >= 9; i--)
|
for (i = 40; i >= 9; i--)
|
||||||
{
|
{
|
||||||
grub_uint64_t pos = res | (1ULL << i);
|
grub_uint64_t pos = res | (1ULL << i);
|
||||||
|
@ -165,7 +165,7 @@ grub_arcdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
grub_uint64_t pos = sector << 9;
|
grub_uint64_t pos = sector << 9;
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
grub_uint64_t totl = size << 9;
|
grub_uint64_t totl = size << 9;
|
||||||
int r;
|
grub_arc_err_t r;
|
||||||
|
|
||||||
err = reopen (disk->data);
|
err = reopen (disk->data);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -173,7 +173,7 @@ grub_arcdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
r = GRUB_ARC_FIRMWARE_VECTOR->seek (last_handle, &pos, 0);
|
r = GRUB_ARC_FIRMWARE_VECTOR->seek (last_handle, &pos, 0);
|
||||||
if (r)
|
if (r)
|
||||||
{
|
{
|
||||||
grub_dprintf ("arcdisk", "seek to 0x%" PRIxGRUB_UINT64_T " failed: %d\n",
|
grub_dprintf ("arcdisk", "seek to 0x%" PRIxGRUB_UINT64_T " failed: %ld\n",
|
||||||
pos, r);
|
pos, r);
|
||||||
return grub_error (GRUB_ERR_IO, "couldn't seek");
|
return grub_error (GRUB_ERR_IO, "couldn't seek");
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,9 +61,9 @@ iterate_rec (const char *prefix, const struct grub_arc_component *parent,
|
||||||
if (!cname)
|
if (!cname)
|
||||||
cname = "unknown";
|
cname = "unknown";
|
||||||
if (alt_names)
|
if (alt_names)
|
||||||
name = grub_xasprintf ("%s/%s%d", prefix, cname, comp->key);
|
name = grub_xasprintf ("%s/%s%lu", prefix, cname, comp->key);
|
||||||
else
|
else
|
||||||
name = grub_xasprintf ("%s%s(%d)", prefix, cname, comp->key);
|
name = grub_xasprintf ("%s%s(%lu)", prefix, cname, comp->key);
|
||||||
if (!name)
|
if (!name)
|
||||||
return 1;
|
return 1;
|
||||||
if (hook (name, comp))
|
if (hook (name, comp))
|
||||||
|
|
|
@ -22,11 +22,21 @@
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
|
|
||||||
|
typedef unsigned grub_arc_enum_t;
|
||||||
|
typedef grub_uint64_t grub_arc_ularge_t;
|
||||||
|
typedef unsigned long grub_arc_ulong_t;
|
||||||
|
typedef long grub_arc_long_t;
|
||||||
|
typedef unsigned short grub_arc_ushort_t;
|
||||||
|
typedef unsigned char grub_arc_uchar_t;
|
||||||
|
|
||||||
|
typedef grub_arc_long_t grub_arc_err_t;
|
||||||
|
typedef grub_arc_ulong_t grub_arc_fileno_t;
|
||||||
|
|
||||||
struct grub_arc_memory_descriptor
|
struct grub_arc_memory_descriptor
|
||||||
{
|
{
|
||||||
grub_uint32_t type;
|
grub_arc_enum_t type;
|
||||||
grub_uint32_t start_page;
|
grub_arc_ulong_t start_page;
|
||||||
grub_uint32_t num_pages;
|
grub_arc_ulong_t num_pages;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum grub_arc_memory_type
|
enum grub_arc_memory_type
|
||||||
|
@ -47,39 +57,39 @@ enum grub_arc_memory_type
|
||||||
|
|
||||||
struct grub_arc_timeinfo
|
struct grub_arc_timeinfo
|
||||||
{
|
{
|
||||||
grub_uint16_t y;
|
grub_arc_ushort_t y;
|
||||||
grub_uint16_t m;
|
grub_arc_ushort_t m;
|
||||||
grub_uint16_t d;
|
grub_arc_ushort_t d;
|
||||||
grub_uint16_t h;
|
grub_arc_ushort_t h;
|
||||||
grub_uint16_t min;
|
grub_arc_ushort_t min;
|
||||||
grub_uint16_t s;
|
grub_arc_ushort_t s;
|
||||||
grub_uint16_t ms;
|
grub_arc_ushort_t ms;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct grub_arc_display_status
|
struct grub_arc_display_status
|
||||||
{
|
{
|
||||||
grub_uint16_t x;
|
grub_arc_ushort_t x;
|
||||||
grub_uint16_t y;
|
grub_arc_ushort_t y;
|
||||||
grub_uint16_t w;
|
grub_arc_ushort_t w;
|
||||||
grub_uint16_t h;
|
grub_arc_ushort_t h;
|
||||||
grub_uint8_t fgcolor;
|
grub_arc_uchar_t fgcolor;
|
||||||
grub_uint8_t bgcolor;
|
grub_arc_uchar_t bgcolor;
|
||||||
grub_uint8_t high_intensity;
|
grub_arc_uchar_t high_intensity;
|
||||||
grub_uint8_t underscored;
|
grub_arc_uchar_t underscored;
|
||||||
grub_uint8_t reverse_video;
|
grub_arc_uchar_t reverse_video;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct grub_arc_component
|
struct grub_arc_component
|
||||||
{
|
{
|
||||||
unsigned class;
|
grub_arc_enum_t class;
|
||||||
unsigned type;
|
grub_arc_enum_t type;
|
||||||
unsigned flags;
|
grub_arc_enum_t flags;
|
||||||
grub_uint16_t version;
|
grub_arc_ushort_t version;
|
||||||
grub_uint16_t rev;
|
grub_arc_ushort_t rev;
|
||||||
grub_uint32_t key;
|
grub_arc_ulong_t key;
|
||||||
grub_uint32_t affinity;
|
grub_arc_ulong_t affinity;
|
||||||
grub_uint32_t configdatasize;
|
grub_arc_ulong_t configdatasize;
|
||||||
grub_uint32_t idlen;
|
grub_arc_ulong_t idlen;
|
||||||
const char *idstr;
|
const char *idstr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -131,12 +141,12 @@ enum
|
||||||
|
|
||||||
struct grub_arc_fileinfo
|
struct grub_arc_fileinfo
|
||||||
{
|
{
|
||||||
grub_uint64_t start;
|
grub_arc_ularge_t start;
|
||||||
grub_uint64_t end;
|
grub_arc_ularge_t end;
|
||||||
grub_uint64_t current;
|
grub_arc_ularge_t current;
|
||||||
grub_uint32_t type;
|
grub_arc_enum_t type;
|
||||||
grub_uint32_t fnamelength;
|
grub_arc_ulong_t fnamelength;
|
||||||
grub_uint8_t attr;
|
grub_arc_uchar_t attr;
|
||||||
char filename[32];
|
char filename[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -176,54 +186,59 @@ struct grub_arc_firmware_vector
|
||||||
struct grub_arc_timeinfo *(*gettime) (void);
|
struct grub_arc_timeinfo *(*gettime) (void);
|
||||||
void *getrelativetime;
|
void *getrelativetime;
|
||||||
void *getdirectoryentry;
|
void *getdirectoryentry;
|
||||||
int (*open) (const char *path, int mode, unsigned *fileno);
|
grub_arc_err_t (*open) (const char *path, grub_arc_enum_t mode,
|
||||||
|
grub_arc_fileno_t *fileno);
|
||||||
|
|
||||||
/* 0x60. */
|
/* 0x60. */
|
||||||
int (*close) (unsigned fileno);
|
grub_arc_err_t (*close) (grub_arc_fileno_t fileno);
|
||||||
int (*read) (unsigned fileno, void *buf, unsigned long n,
|
grub_arc_err_t (*read) (grub_arc_fileno_t fileno, void *buf,
|
||||||
unsigned long *count);
|
grub_arc_ulong_t n,
|
||||||
int (*get_read_status) (unsigned fileno);
|
grub_arc_ulong_t *count);
|
||||||
int (*write) (unsigned fileno, void *buf, unsigned long n,
|
grub_arc_err_t (*get_read_status) (grub_arc_fileno_t fileno);
|
||||||
unsigned long *count);
|
grub_arc_err_t (*write) (grub_arc_fileno_t fileno, void *buf,
|
||||||
|
grub_arc_ulong_t n,
|
||||||
|
grub_arc_ulong_t *count);
|
||||||
|
|
||||||
/* 0x70. */
|
/* 0x70. */
|
||||||
int (*seek) (unsigned fileno, grub_uint64_t *pos, int mode);
|
grub_arc_err_t (*seek) (grub_arc_fileno_t fileno,
|
||||||
|
grub_arc_ularge_t *pos, grub_arc_enum_t mode);
|
||||||
void *mount;
|
void *mount;
|
||||||
void *getenvironmentvariable;
|
void *getenvironmentvariable;
|
||||||
void *setenvironmentvariable;
|
void *setenvironmentvariable;
|
||||||
|
|
||||||
/* 0x80. */
|
/* 0x80. */
|
||||||
int (*getfileinformation) (unsigned fileno, struct grub_arc_fileinfo *info);
|
grub_arc_err_t (*getfileinformation) (grub_arc_fileno_t fileno,
|
||||||
|
struct grub_arc_fileinfo *info);
|
||||||
void *setfileinformation;
|
void *setfileinformation;
|
||||||
void *flushallcaches;
|
void *flushallcaches;
|
||||||
void *testunicodecharacter;
|
void *testunicodecharacter;
|
||||||
|
|
||||||
/* 0x90. */
|
/* 0x90. */
|
||||||
struct grub_arc_display_status * (*getdisplaystatus) (unsigned fileno);
|
struct grub_arc_display_status * (*getdisplaystatus) (grub_arc_fileno_t fileno);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct grub_arc_adapter
|
struct grub_arc_adapter
|
||||||
{
|
{
|
||||||
grub_uint32_t adapter_type;
|
grub_arc_ulong_t adapter_type;
|
||||||
grub_uint32_t adapter_vector_length;
|
grub_arc_ulong_t adapter_vector_length;
|
||||||
void *adapter_vector;
|
void *adapter_vector;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct grub_arc_system_parameter_block
|
struct grub_arc_system_parameter_block
|
||||||
{
|
{
|
||||||
grub_uint32_t signature;
|
grub_arc_ulong_t signature;
|
||||||
grub_uint32_t length;
|
grub_arc_ulong_t length;
|
||||||
grub_uint16_t version;
|
grub_arc_ushort_t version;
|
||||||
grub_uint16_t revision;
|
grub_arc_ushort_t revision;
|
||||||
void *restartblock;
|
void *restartblock;
|
||||||
void *debugblock;
|
void *debugblock;
|
||||||
void *gevector;
|
void *gevector;
|
||||||
void *utlbmissvector;
|
void *utlbmissvector;
|
||||||
grub_uint32_t firmware_vector_length;
|
grub_arc_ulong_t firmware_vector_length;
|
||||||
struct grub_arc_firmware_vector *firmwarevector;
|
struct grub_arc_firmware_vector *firmwarevector;
|
||||||
grub_uint32_t private_vector_length;
|
grub_arc_ulong_t private_vector_length;
|
||||||
void *private_vector;
|
void *private_vector;
|
||||||
grub_uint32_t adapter_count;
|
grub_arc_ulong_t adapter_count;
|
||||||
struct grub_arc_adapter adapters[0];
|
struct grub_arc_adapter adapters[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue