copy.c revision 113038
177943Sdfr/*-
277943Sdfr * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
377943Sdfr * All rights reserved.
477943Sdfr *
577943Sdfr * Redistribution and use in source and binary forms, with or without
677943Sdfr * modification, are permitted provided that the following conditions
777943Sdfr * are met:
877943Sdfr * 1. Redistributions of source code must retain the above copyright
977943Sdfr *    notice, this list of conditions and the following disclaimer.
1077943Sdfr * 2. Redistributions in binary form must reproduce the above copyright
1177943Sdfr *    notice, this list of conditions and the following disclaimer in the
1277943Sdfr *    documentation and/or other materials provided with the distribution.
1377943Sdfr *
1477943Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1577943Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1677943Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1777943Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1877943Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1977943Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2077943Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2177943Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2277943Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2377943Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2477943Sdfr * SUCH DAMAGE.
2577943Sdfr */
2678320Sobrien
27113038Sobrien#include <sys/cdefs.h>
28113038Sobrien__FBSDID("$FreeBSD: head/sys/boot/ia64/common/copy.c 113038 2003-04-03 21:36:33Z obrien $");
2978320Sobrien
3077943Sdfr/*
3177943Sdfr * MD primitives supporting placement of module data
3277943Sdfr */
3377943Sdfr#include <stand.h>
3477943Sdfr
3577943Sdfr#include <efi.h>
3677943Sdfr#include <efilib.h>
3777943Sdfr#include <machine/ia64_cpu.h>
3896912Smarcel#include <machine/vmparam.h>
3977943Sdfr
4077943Sdfrint
4177943Sdfrefi_copyin(void *src, vm_offset_t dest, size_t len)
4277943Sdfr{
4383437Sdfr	EFI_PHYSICAL_ADDRESS p = IA64_RR_MASK(dest);
4483437Sdfr#if 0
4583437Sdfr	BS->AllocatePages(AllocateAddress, EfiRuntimeServicesData,
4683437Sdfr			  len >> 12, &p);
4783437Sdfr#endif
4883437Sdfr	bcopy(src, (void*) p, len);
4978320Sobrien	return (len);
5077943Sdfr}
5177943Sdfr
5277943Sdfrint
5377943Sdfrefi_copyout(vm_offset_t src, void *dest, size_t len)
5477943Sdfr{
5583437Sdfr	bcopy((void*) IA64_RR_MASK(src), dest, len);
5678320Sobrien	return (len);
5777943Sdfr}
5877943Sdfr
5977943Sdfrint
6077943Sdfrefi_readin(int fd, vm_offset_t dest, size_t len)
6177943Sdfr{
6283437Sdfr	EFI_PHYSICAL_ADDRESS p = IA64_RR_MASK(dest);
6383437Sdfr#if 0
6483437Sdfr	BS->AllocatePages(AllocateAddress, EfiRuntimeServicesData,
6583437Sdfr			  len >> 12, &p);
6683437Sdfr#endif
6783437Sdfr	return (read(fd, (void*) p, len));
6877943Sdfr}
69