Implement new command cmosdump.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-02-24 19:44:17 +01:00
parent b5ea6ce03a
commit d55ffb0249
7 changed files with 100 additions and 4 deletions

View file

@ -61,16 +61,32 @@ grub_num_to_bcd (grub_uint8_t a)
static inline grub_err_t
grub_cmos_read (grub_uint8_t index, grub_uint8_t *val)
{
grub_outb (index, GRUB_CMOS_ADDR_REG);
*val = grub_inb (GRUB_CMOS_DATA_REG);
if (index & 0x80)
{
grub_outb (index & 0x7f, GRUB_CMOS_ADDR_REG_HI);
*val = grub_inb (GRUB_CMOS_DATA_REG_HI);
}
else
{
grub_outb (index & 0x7f, GRUB_CMOS_ADDR_REG);
*val = grub_inb (GRUB_CMOS_DATA_REG);
}
return GRUB_ERR_NONE;
}
static inline grub_err_t
grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
{
grub_outb (index, GRUB_CMOS_ADDR_REG);
grub_outb (value, GRUB_CMOS_DATA_REG);
if (index & 0x80)
{
grub_outb (index & 0x7f, GRUB_CMOS_ADDR_REG_HI);
grub_outb (value, GRUB_CMOS_DATA_REG_HI);
}
else
{
grub_outb (index & 0x7f, GRUB_CMOS_ADDR_REG);
grub_outb (value, GRUB_CMOS_DATA_REG);
}
return GRUB_ERR_NONE;
}
#else

View file

@ -24,5 +24,7 @@
#define GRUB_CMOS_ADDR_REG 0x70
#define GRUB_CMOS_DATA_REG 0x71
#define GRUB_CMOS_ADDR_REG_HI 0x72
#define GRUB_CMOS_DATA_REG_HI 0x73
#endif /* GRUB_CPU_CMOS_H */

View file

@ -24,5 +24,7 @@
#define GRUB_CMOS_ADDR_REG 0xbfd00070
#define GRUB_CMOS_DATA_REG 0xbfd00071
#define GRUB_CMOS_ADDR_REG 0xbfd00072
#define GRUB_CMOS_DATA_REG 0xbfd00073
#endif /* GRUB_CPU_CMOS_H */

View file

@ -24,5 +24,7 @@
#define GRUB_CMOS_ADDR_REG 0xb4000070
#define GRUB_CMOS_DATA_REG 0xb4000071
#define GRUB_CMOS_ADDR_REG_HI 0xb4000072
#define GRUB_CMOS_DATA_REG_HI 0xb4000073
#endif /* GRUB_CPU_CMOS_H */