summaryrefslogtreecommitdiff
path: root/sys/src/9/kw/uncached.h
blob: 9fffd31fcdf2eec2527431b25992168cc8b1862f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * running the l2 cache as write-back and using cached memory for
 * usb data structures yields spurious errors such as
 *
 *	qhintr: td 0x60ee3d80 csw 0x8824a error 0x48 transaction error
 *
 * from usbehci.  so, at least for now, we will use uncached memory until
 * we sort out the write-back problems.
 */
#define free			ucfree
#define malloc			myucalloc
#define mallocz			ucallocz
#define smalloc			myucalloc
#define xspanalloc		ucallocalign

#define allocb			ucallocb
#define iallocb			uciallocb
#define freeb			ucfreeb

static void *
ucallocz(uint n, int)
{
	char *p = ucalloc(n);

	if (p)
		memset(p, 0, n);
	else
		panic("ucalloc: out of memory");
	return p;
}

static void *
myucalloc(uint n)
{
	return ucallocz(n, 1);
}