hvlog.c 955 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (C) 2001 Mike Corrigan IBM Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. */
  9. #include <asm/page.h>
  10. #include <asm/abs_addr.h>
  11. #include <asm/iseries/hv_call.h>
  12. #include <asm/iseries/hv_call_sc.h>
  13. #include <asm/iseries/hv_types.h>
  14. void HvCall_writeLogBuffer(const void *buffer, u64 len)
  15. {
  16. struct HvLpBufferList hv_buf;
  17. u64 left_this_page;
  18. u64 cur = virt_to_abs(buffer);
  19. while (len) {
  20. hv_buf.addr = cur;
  21. left_this_page = ((cur & HW_PAGE_MASK) + HW_PAGE_SIZE) - cur;
  22. if (left_this_page > len)
  23. left_this_page = len;
  24. hv_buf.len = left_this_page;
  25. len -= left_this_page;
  26. HvCall2(HvCallBaseWriteLogBuffer,
  27. virt_to_abs(&hv_buf),
  28. left_this_page);
  29. cur = (cur & HW_PAGE_MASK) + HW_PAGE_SIZE;
  30. }
  31. }