voyager.c 958 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. * Get the Voyager config information
  12. */
  13. #include "boot.h"
  14. int query_voyager(void)
  15. {
  16. u8 err;
  17. u16 es, di;
  18. /* Abuse the apm_bios_info area for this */
  19. u8 *data_ptr = (u8 *)&boot_params.apm_bios_info;
  20. data_ptr[0] = 0xff; /* Flag on config not found(?) */
  21. asm("pushw %%es ; "
  22. "int $0x15 ; "
  23. "setc %0 ; "
  24. "movw %%es, %1 ; "
  25. "popw %%es"
  26. : "=q" (err), "=r" (es), "=D" (di)
  27. : "a" (0xffc0));
  28. if (err)
  29. return -1; /* Not Voyager */
  30. set_fs(es);
  31. copy_from_fs(data_ptr, di, 7); /* Table is 7 bytes apparently */
  32. return 0;
  33. }