3 * Copyright (c) 2009, Microsoft Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
28 #include <linux/workqueue.h>
31 #define ALIGN_UP(value, align) (((value) & (align-1)) ? \
32 (((value) + (align-1)) & ~(align-1)) : \
34 #define ALIGN_DOWN(value, align) ((value) & ~(align-1))
35 #define NUM_PAGES_SPANNED(addr, len) ((ALIGN_UP(addr+len, PAGE_SIZE) - \
36 ALIGN_DOWN(addr, PAGE_SIZE)) >> \
39 #define LOWORD(dw) ((unsigned short)(dw))
40 #define HIWORD(dw) ((unsigned short)(((unsigned int) (dw) >> 16) & 0xFFFF))
43 unsigned char data
[16];
46 struct osd_waitevent
{
48 wait_queue_head_t event
;
53 extern void *osd_VirtualAllocExec(unsigned int size
);
55 extern void *osd_PageAlloc(unsigned int count
);
56 extern void osd_PageFree(void *page
, unsigned int count
);
58 extern struct osd_waitevent
*osd_WaitEventCreate(void);
59 extern void osd_WaitEventSet(struct osd_waitevent
*waitEvent
);
60 extern int osd_WaitEventWait(struct osd_waitevent
*waitEvent
);
62 /* If >0, waitEvent got signaled. If ==0, timeout. If < 0, error */
63 extern int osd_WaitEventWaitEx(struct osd_waitevent
*waitEvent
,
66 int osd_schedule_callback(struct workqueue_struct
*wq
,