# define DEBUG(_format_, args...) (void)0
#endif
-#define INTEL_FB_PAGES ((16 * 1024 * 1024) / (4 * 1024))
-#define INTEL_FB_BASE 0xd8000
+#define NB_SLOTS 10
static void dom0_read(void *opaque);
unsigned long len;
int pos = 0;
- for (int i = 0; i < DOM0_OUT; i++)
- positions[i] = 0;
+ memset(positions, 0, NB_SLOTS * 4);
/* Get all the positions */
domids = xenstore_get_domids(&num);
continue;
pos = strtol(tmp, NULL, 10);
free(tmp);
- assert(pos >= 0 && pos <= 5);
positions[pos] = domids[i];
}
free(domids);
- for (pos = 0; pos < DOM0_OUT; pos++)
+ for (pos = 0; pos < NB_SLOTS; pos++)
DEBUG("pos %d -> %d\n", pos, positions[pos]);
}
static int dom0_get_next_domid(int dir, int id)
{
int pos = 0, next_pos = 0;
- int positions[6];
+ int positions[NB_SLOTS];
dom0_get_positions(positions);
/* Find current domain pos */
return (i < len);
}
-static void dom0_probe_xenstore(void *opaque)
+static void dom0_probe_xenstore_location(void *opaque)
{
char *tmp = NULL;
char *dir = NULL;
qemu_mod_timer(driver.xs_timer, qemu_get_clock(rt_clock) + XS_REFRESH_INTERVAL);
}
-static void dom0_driver_event_init(const char *position)
+static void dom0_driver_location_init(const char *arg)
{
- char dev_name[strlen(EVENT_PATH) + 3];
- int fd = -1;
int pos = 0, i = 0;
- int positions[6];
+ int positions[NB_SLOTS];
char str[10];
+
+
+ /* Register the xenstore probing */
+ driver.xs_timer = qemu_new_timer(rt_clock, dom0_probe_xenstore, NULL);
+ qemu_mod_timer(driver.xs_timer, qemu_get_clock(rt_clock) + XS_REFRESH_INTERVAL);
+}
+
+static void dom0_driver_slot_init(int slot)
+{
+
+}
+
+static void dom0_driver_event_init(const char *str_arg)
+{
+ char dev_name[strlen(EVENT_PATH) + 3];
+ int fd = -1;
+ int arg = 0;
+
do
{
snprintf(dev_name, sizeof (dev_name), "%s%d", EVENT_PATH, i++);
if (driver.event_nb == 0)
return;
-
+
+ pos = strtol(str_arg, NULL, 10);
/* Register position */
- DEBUG("Register the position inside xenstore\n");
- for (pos = 0; pos < DOM0_OUT; pos++)
- if (strcmp(str2pos[pos], position) == 0)
- break;
- DEBUG("Get the position %s\n", str2pos[pos]);
- if (pos == DOM0_OUT)
+ if (errno == EINVAL) // position mode
{
- DEBUG("position must be left, right, center, top or bottom\n");
- exit(1);
+ DEBUG("Register the position inside xenstore\n");
+ for (pos = 0; pos < DOM0_OUT; pos++)
+ if (strcmp(str2pos[pos], str_arg) == 0)
+ break;
+ DEBUG("Get the position %s\n", str2pos[pos]);
+ if (pos == DOM0_OUT)
+ {
+ DEBUG("position must be left, right, center, top or bottom\n");
+ exit(1);
+ }
}
+
dom0_get_positions(positions);
if (positions[pos])
{
xenstore_dom_write(domid, "dom0_input", str);
}
- /* Register the xenstore probing */
- driver.xs_timer = qemu_new_timer(rt_clock, dom0_probe_xenstore, NULL);
- qemu_mod_timer(driver.xs_timer, qemu_get_clock(rt_clock) + XS_REFRESH_INTERVAL);
+ arg = strtol(str_arg, NULL, 10);
+ if (errno == EINVAL)
+ dom0_driver_location_init(str_arg);
+ else
+ dom0_driver_slot_init(arg);
}
static void dom0_driver_cleanup(void)