本文整理匯總了C++中GET_GLOBAL函數的典型用法代碼示例。如果您正苦於以下問題:C++ GET_GLOBAL函數的具體用法?C++ GET_GLOBAL怎麽用?C++ GET_GLOBAL使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GET_GLOBAL函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: stdvga_find_mode
struct vgamode_s *bochsvga_find_mode(int mode)
{
struct bochsvga_mode *m = bochsvga_modes;
if (GET_GLOBAL(dispi_found))
for (; m < &bochsvga_modes[ARRAY_SIZE(bochsvga_modes)]; m++)
if (GET_GLOBAL(m->mode) == mode)
return &m->info;
return stdvga_find_mode(mode);
}
示例2: get_translation
static u8
get_translation(struct drive_s *drive_g)
{
u8 type = GET_GLOBAL(drive_g->type);
if (! CONFIG_COREBOOT && type == DTYPE_ATA) {
// Emulators pass in the translation info via nvram.
u8 ataid = GET_GLOBAL(drive_g->cntl_id);
u8 channel = ataid / 2;
u8 translation = inb_cmos(CMOS_BIOS_DISKTRANSFLAG + channel/2);
translation >>= 2 * (ataid % 4);
translation &= 0x03;
return translation;
}
示例3: via_155f18
static void
via_155f18(struct bregs *regs)
{
int fbsize = GET_GLOBAL(ViaFBsize), ramspeed = GET_GLOBAL(ViaRamSpeed);
if (fbsize < 0 || ramspeed < 0) {
set_code_invalid(regs, RET_EUNSUPPORTED);
return;
}
regs->eax = 0x5f;
regs->ebx = 0x500 | (ramspeed << 4) | fbsize;
regs->ecx = 0x060;
set_success(regs);
}
示例4: ata_reset
// Reset a drive
static void
ata_reset(struct atadrive_s *adrive_g)
{
struct ata_channel_s *chan_gf = GET_GLOBAL(adrive_g->chan_gf);
u8 slave = GET_GLOBAL(adrive_g->slave);
u16 iobase1 = GET_GLOBALFLAT(chan_gf->iobase1);
u16 iobase2 = GET_GLOBALFLAT(chan_gf->iobase2);
dprintf(6, "ata_reset drive=%p\n", &adrive_g->drive);
// Pulse SRST
outb(ATA_CB_DC_HD15 | ATA_CB_DC_NIEN | ATA_CB_DC_SRST, iobase2+ATA_CB_DC);
udelay(5);
outb(ATA_CB_DC_HD15 | ATA_CB_DC_NIEN, iobase2+ATA_CB_DC);
msleep(2);
// wait for device to become not busy.
int status = await_not_bsy(iobase1);
if (status < 0)
goto done;
if (slave) {
// Change device.
u64 end = calc_future_tsc(IDE_TIMEOUT);
for (;;) {
outb(ATA_CB_DH_DEV1, iobase1 + ATA_CB_DH);
status = ndelay_await_not_bsy(iobase1);
if (status < 0)
goto done;
if (inb(iobase1 + ATA_CB_DH) == ATA_CB_DH_DEV1)
break;
// Change drive request failed to take effect - retry.
if (check_tsc(end)) {
warn_timeout();
goto done;
}
}
} else {
// QEMU doesn't reset dh on reset, so set it explicitly.
outb(ATA_CB_DH_DEV0, iobase1 + ATA_CB_DH);
}
// On a user-reset request, wait for RDY if it is an ATA device.
u8 type=GET_GLOBAL(adrive_g->drive.type);
if (type == DTYPE_ATA)
status = await_rdy(iobase1);
done:
// Enable interrupts
outb(ATA_CB_DC_HD15, iobase2+ATA_CB_DC);
dprintf(6, "ata_reset exit status=%x\n", status);
}
示例5: disk_1308
// read disk drive parameters
static void noinline
disk_1308(struct bregs *regs, struct drive_s *drive_g)
{
u16 ebda_seg = get_ebda_seg();
// Get logical geometry from table
u16 nlc, nlh, nlspt;
fillLCHS(drive_g, &nlc, &nlh, &nlspt);
nlc--;
nlh--;
u8 count;
if (regs->dl < EXTSTART_HD) {
// Floppy
count = GET_GLOBAL(FloppyCount);
if (CONFIG_CDROM_EMU
&& drive_g == GLOBALFLAT2GLOBAL(GET_GLOBAL(cdemu_drive_gf)))
regs->bx = GET_EBDA2(ebda_seg, cdemu.media) * 2;
else
regs->bx = GET_GLOBAL(drive_g->floppy_type);
// set es & di to point to 11 byte diskette param table in ROM
regs->es = SEG_BIOS;
regs->di = (u32)&diskette_param_table2;
} else if (regs->dl < EXTSTART_CD) {
// Hard drive
count = GET_BDA(hdcount);
nlc--; // last sector reserved
} else {
// Not supported on CDROM
disk_ret(regs, DISK_RET_EPARAM);
return;
}
if (CONFIG_CDROM_EMU && GET_EBDA2(ebda_seg, cdemu.active)) {
u8 emudrive = GET_EBDA2(ebda_seg, cdemu.emulated_extdrive);
if (((emudrive ^ regs->dl) & 0x80) == 0)
// Note extra drive due to emulation.
count++;
if (regs->dl < EXTSTART_HD && count > 2)
// Max of two floppy drives.
count = 2;
}
regs->al = 0;
regs->ch = nlc & 0xff;
regs->cl = ((nlc >> 2) & 0xc0) | (nlspt & 0x3f);
regs->dh = nlh;
disk_ret(regs, DISK_RET_SUCCESS);
regs->dl = count;
}
示例6: bochsvga_list_modes
void
bochsvga_list_modes(u16 seg, u16 *dest, u16 *last)
{
struct bochsvga_mode *m = bochsvga_modes;
if (GET_GLOBAL(dispi_found)) {
for (; m < &bochsvga_modes[ARRAY_SIZE(bochsvga_modes)] && dest<last; m++) {
u16 mode = GET_GLOBAL(m->mode);
if (mode == 0xffff)
continue;
SET_FARVAR(seg, *dest, mode);
dest++;
}
}
stdvga_list_modes(seg, dest, last);
}
示例7: vbe_104f06
static void
vbe_104f06(struct bregs *regs)
{
if (regs->bl > 0x02)
goto fail;
struct vgamode_s *vmode_g = get_current_mode();
if (! vmode_g)
goto fail;
int bpp = vga_bpp(vmode_g);
if (regs->bl == 0x00) {
int ret = vgahw_set_linelength(vmode_g, DIV_ROUND_UP(regs->cx * bpp, 8));
if (ret)
goto fail;
} else if (regs->bl == 0x02) {
int ret = vgahw_set_linelength(vmode_g, regs->cx);
if (ret)
goto fail;
}
int linelength = vgahw_get_linelength(vmode_g);
if (linelength < 0)
goto fail;
regs->bx = linelength;
regs->cx = (linelength * 8) / bpp;
regs->dx = GET_GLOBAL(VBE_total_memory) / linelength;
regs->ax = 0x004f;
return;
fail:
regs->ax = 0x014f;
}
示例8: ata_cmd_nondata
// Send an ata command that does not transfer any further data.
int
ata_cmd_nondata(struct atadrive_s *adrive_g, struct ata_pio_command *cmd)
{
struct ata_channel_s *chan_gf = GET_GLOBAL(adrive_g->chan_gf);
u16 iobase1 = GET_GLOBALFLAT(chan_gf->iobase1);
u16 iobase2 = GET_GLOBALFLAT(chan_gf->iobase2);
// Disable interrupts
outb(ATA_CB_DC_HD15 | ATA_CB_DC_NIEN, iobase2 + ATA_CB_DC);
int ret = send_cmd(adrive_g, cmd);
if (ret)
goto fail;
ret = ndelay_await_not_bsy(iobase1);
if (ret < 0)
goto fail;
if (ret & ATA_CB_STAT_ERR) {
dprintf(6, "nondata cmd : read error (status=%02x err=%02x)\n"
, ret, inb(iobase1 + ATA_CB_ERR));
ret = -4;
goto fail;
}
if (ret & ATA_CB_STAT_DRQ) {
dprintf(6, "nondata cmd : DRQ set (status %02x)\n", ret);
ret = -5;
goto fail;
}
fail:
// Enable interrupts
outb(ATA_CB_DC_HD15, iobase2+ATA_CB_DC);
return ret;
}
示例9: vbe_104f08
static void
vbe_104f08(struct bregs *regs)
{
struct vgamode_s *vmode_g = get_current_mode();
if (! vmode_g)
goto fail;
u8 memmodel = GET_GLOBAL(vmode_g->memmodel);
if (memmodel == MM_DIRECT || memmodel == MM_YUV) {
regs->ax = 0x034f;
return;
}
if (regs->bl > 1)
goto fail;
if (regs->bl == 0) {
int ret = vgahw_set_dacformat(vmode_g, regs->bh);
if (ret < 0)
goto fail;
}
int ret = vgahw_get_dacformat(vmode_g);
if (ret < 0)
goto fail;
regs->bh = ret;
regs->ax = 0x004f;
return;
fail:
regs->ax = 0x014f;
}
示例10: usb_kbd_active
// Test if USB keyboard is active.
inline int
usb_kbd_active(void)
{
if (! CONFIG_USB_KEYBOARD)
return 0;
return GET_GLOBAL(keyboard_pipe) != NULL;
}
示例11: usb_mouse_active
// Test if USB mouse is active.
inline int
usb_mouse_active(void)
{
if (! CONFIG_USB_MOUSE)
return 0;
return GET_GLOBAL(mouse_pipe) != NULL;
}
示例12: getDrive
struct drive_s *
getDrive(u8 exttype, u8 extdriveoffset)
{
if (extdriveoffset >= ARRAY_SIZE(IDMap[0]))
return NULL;
return GET_GLOBAL(IDMap[exttype][extdriveoffset]);
}
示例13: extended_access
// Perform read/write/verify using new-style "int13ext" accesses.
static void noinline
extended_access(struct bregs *regs, struct drive_s *drive_g, u16 command)
{
struct disk_op_s dop;
// Get lba and check.
dop.lba = GET_INT13EXT(regs, lba);
dop.command = command;
dop.drive_g = drive_g;
if (dop.lba >= GET_GLOBAL(drive_g->sectors)) {
warn_invalid(regs);
disk_ret(regs, DISK_RET_EPARAM);
return;
}
dop.buf_fl = SEGOFF_TO_FLATPTR(GET_INT13EXT(regs, data));
dop.count = GET_INT13EXT(regs, count);
if (! dop.count) {
// Nothing to do.
disk_ret(regs, DISK_RET_SUCCESS);
return;
}
int status = send_disk_op(&dop);
SET_INT13EXT(regs, count, dop.count);
disk_ret(regs, status);
}
示例14: intel_155f40
static void
intel_155f40(struct bregs *regs)
{
regs->ax = 0x005f;
regs->cl = GET_GLOBAL(IntelDisplayId);
set_success(regs);
}
示例15: cdb_cmd_data
// Route command to low-level handler.
static int
cdb_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize)
{
u8 type = GET_GLOBAL(op->drive_g->type);
switch (type) {
case DTYPE_ATA_ATAPI:
return atapi_cmd_data(op, cdbcmd, blocksize);
case DTYPE_USB:
return usb_cmd_data(op, cdbcmd, blocksize);
case DTYPE_UAS:
return uas_cmd_data(op, cdbcmd, blocksize);
case DTYPE_AHCI_ATAPI:
return ahci_cmd_data(op, cdbcmd, blocksize);
case DTYPE_VIRTIO_SCSI:
return virtio_scsi_cmd_data(op, cdbcmd, blocksize);
case DTYPE_LSI_SCSI:
return lsi_scsi_cmd_data(op, cdbcmd, blocksize);
case DTYPE_ESP_SCSI:
return esp_scsi_cmd_data(op, cdbcmd, blocksize);
case DTYPE_MEGASAS:
return megasas_cmd_data(op, cdbcmd, blocksize);
default:
op->count = 0;
return DISK_RET_EPARAM;
}
}