From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Leonard Subject: [PATCH 5/7] mini-os: Moved arch-specific xenbus code under arch Date: Wed, 4 Jun 2014 17:06:36 +0100 Message-ID: <1401897998-29569-6-git-send-email-talex5@gmail.com> References: <538D9161.6090402@linaro.org> <1401897998-29569-1-git-send-email-talex5@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WsDjQ-0005Lp-8n for xen-devel@lists.xenproject.org; Wed, 04 Jun 2014 16:08:04 +0000 Received: by mail-wi0-f172.google.com with SMTP id hi2so8862113wib.5 for ; Wed, 04 Jun 2014 09:08:02 -0700 (PDT) In-Reply-To: <1401897998-29569-1-git-send-email-talex5@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Thomas Leonard List-Id: xen-devel@lists.xenproject.org From: Karim Raslan Signed-off-by: Karim Allah Ahmed [talex5@gmail.com: separated from big ARM commit] Signed-off-by: Thomas Leonard --- extras/mini-os/arch/x86/xenbus.c | 10 ++++++++++ extras/mini-os/xenbus/xenbus.c | 17 +++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 extras/mini-os/arch/x86/xenbus.c diff --git a/extras/mini-os/arch/x86/xenbus.c b/extras/mini-os/arch/x86/xenbus.c new file mode 100644 index 0000000..5cda78d --- /dev/null +++ b/extras/mini-os/arch/x86/xenbus.c @@ -0,0 +1,10 @@ +#include +#include +#include +#include +#include + +void arch_init_xenbus(struct xenstore_domain_interface **xenstore_buf, uint32_t *store_evtchn) { + *xenstore_buf = mfn_to_virt(start_info.store_mfn); + *store_evtchn = start_info.store_evtchn; +} diff --git a/extras/mini-os/xenbus/xenbus.c b/extras/mini-os/xenbus/xenbus.c index 934f23b..d995020 100644 --- a/extras/mini-os/xenbus/xenbus.c +++ b/extras/mini-os/xenbus/xenbus.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #define min(x,y) ({ \ @@ -43,6 +44,7 @@ #endif static struct xenstore_domain_interface *xenstore_buf; +static uint32_t store_evtchn; static DECLARE_WAIT_QUEUE_HEAD(xb_waitq); DECLARE_WAIT_QUEUE_HEAD(xenbus_watch_queue); @@ -325,20 +327,23 @@ static int allocate_xenbus_id(void) return o_probe; } +void arch_init_xenbus(struct xenstore_domain_interface **xenstore_buf, uint32_t *store_evtchn); + /* Initialise xenbus. */ void init_xenbus(void) { int err; DEBUG("init_xenbus called.\n"); - xenstore_buf = mfn_to_virt(start_info.store_mfn); + + arch_init_xenbus(&xenstore_buf, &store_evtchn); + create_thread("xenstore", xenbus_thread_func, NULL); DEBUG("buf at %p.\n", xenstore_buf); - err = bind_evtchn(start_info.store_evtchn, + err = bind_evtchn(store_evtchn, xenbus_evtchn_handler, NULL); - unmask_evtchn(start_info.store_evtchn); - printk("xenbus initialised on irq %d mfn %#lx\n", - err, start_info.store_mfn); + unmask_evtchn(store_evtchn); + printk("xenbus initialised on event %d\n", err); } void fini_xenbus(void) @@ -420,7 +425,7 @@ static void xb_write(int type, int req_id, xenbus_transaction_t trans_id, xenstore_buf->req_prod += len; /* Send evtchn to notify remote */ - notify_remote_via_evtchn(start_info.store_evtchn); + notify_remote_via_evtchn(store_evtchn); } /* Send a mesasge to xenbus, in the same fashion as xb_write, and -- 2.0.0