voyager.c 989 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* -*- linux-c -*- ------------------------------------------------------- *
  2. *
  3. * Copyright (C) 1991, 1992 Linus Torvalds
  4. * Copyright 2007 rPath, Inc. - All Rights Reserved
  5. *
  6. * This file is part of the Linux kernel, and is made available under
  7. * the terms of the GNU General Public License version 2.
  8. *
  9. * ----------------------------------------------------------------------- */
  10. /*
  11. * arch/i386/boot/voyager.c
  12. *
  13. * Get the Voyager config information
  14. */
  15. #include "boot.h"
  16. int query_voyager(void)
  17. {
  18. u8 err;
  19. u16 es, di;
  20. /* Abuse the apm_bios_info area for this */
  21. u8 *data_ptr = (u8 *)&boot_params.apm_bios_info;
  22. data_ptr[0] = 0xff; /* Flag on config not found(?) */
  23. asm("pushw %%es ; "
  24. "int $0x15 ; "
  25. "setc %0 ; "
  26. "movw %%es, %1 ; "
  27. "popw %%es"
  28. : "=q" (err), "=r" (es), "=D" (di)
  29. : "a" (0xffc0));
  30. if (err)
  31. return -1; /* Not Voyager */
  32. set_fs(es);
  33. copy_from_fs(data_ptr, di, 7); /* Table is 7 bytes apparently */
  34. return 0;
  35. }