ia64/xen-unstable

view tools/xenstore/xenstored_netbsd.c @ 19731:01748ccc4da3

Intel VT-d: fix Stoakley boot issue with iommu=1

Signed-off-by: Weidong Han <Weidong.han@intel.com>
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 05 09:25:50 2009 +0100 (2009-06-05)
parents f673460e0701
children
line source
1 /******************************************************************************
2 *
3 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
4 * Use is subject to license terms.
5 *
6 * Copyright (C) 2005 Rusty Russell IBM Corporation
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation, version 2 of the
11 * License.
12 */
14 #include <fcntl.h>
15 #include <unistd.h>
16 #include <stdlib.h>
17 #include <sys/mman.h>
19 #include "xenstored_core.h"
21 #define XENSTORED_PROC_KVA "/dev/xsd_kva"
22 #define XENSTORED_PROC_PORT "/kern/xen/xsd_port"
24 evtchn_port_t xenbus_evtchn(void)
25 {
26 int fd;
27 int rc;
28 evtchn_port_t port;
29 char str[20];
31 fd = open(XENSTORED_PROC_PORT, O_RDONLY);
32 if (fd == -1)
33 return -1;
35 rc = read(fd, str, sizeof(str));
36 if (rc == -1)
37 {
38 int err = errno;
39 close(fd);
40 errno = err;
41 return -1;
42 }
44 str[rc] = '\0';
45 port = strtoul(str, NULL, 0);
47 close(fd);
48 return port;
49 }
51 void *xenbus_map(void)
52 {
53 int fd;
54 void *addr;
56 fd = open(XENSTORED_PROC_KVA, O_RDWR);
57 if (fd == -1)
58 return NULL;
60 addr = mmap(NULL, getpagesize(), PROT_READ|PROT_WRITE,
61 MAP_SHARED, fd, 0);
63 if (addr == MAP_FAILED)
64 addr = NULL;
66 close(fd);
68 return addr;
69 }
71 void xenbus_notify_running(void)
72 {
73 }