/*
 * Copyright 2014, Michael Ellerman, IBM Corp.
 * Licensed under GPLv2.
 */

#include <stdio.h>
#include <stdlib.h>

#include "event.h"
#include "utils.h"

#define MALLOC_SIZE     (0x10000 * 10)  /* Ought to be enough .. */

/*
 * Tests that the L3 bank handling is correct. We fixed it in commit e9aaac1.
 */
static int l3_bank_test(void)
{
	struct event event;
	char *p;
	int i;

	p = malloc(MALLOC_SIZE);
	FAIL_IF(!p);

	event_init(&event, 0x84918F);

	FAIL_IF(event_open(&event));

	for (i = 0; i < MALLOC_SIZE; i += 0x10000)
		p[i] = i;

	event_read(&event);
	event_report(&event);

	FAIL_IF(event.result.running == 0);
	FAIL_IF(event.result.enabled == 0);

	event_close(&event);
	free(p);

	return 0;
}

int main(void)
{
	return test_harness(l3_bank_test, "l3_bank_test");
}
/net-next.git/'>net-next.git</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='bd05a5bd6b11d7fd26a668de83c5cb996de05f8f'/><select name='h' onchange='this.form.submit();'>
<option value='emaclite-cleanup'>emaclite-cleanup</option>
<option value='master'>master</option>
<option value='nds-private-remove' selected='selected'>nds-private-remove</option>
<option value='packet-loop-back'>packet-loop-back</option>
<option value='packet-rx-pump-back'>packet-rx-pump-back</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/?h=nds-private-remove'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?h=nds-private-remove&amp;id=bd05a5bd6b11d7fd26a668de83c5cb996de05f8f'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/sound/isa/cmi8330.c?h=nds-private-remove'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/sound/isa/cmi8330.c?h=nds-private-remove&amp;id=bd05a5bd6b11d7fd26a668de83c5cb996de05f8f'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/sound/isa/cmi8330.c?h=nds-private-remove&amp;id=bd05a5bd6b11d7fd26a668de83c5cb996de05f8f'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/sound/isa/cmi8330.c?h=nds-private-remove&amp;id=bd05a5bd6b11d7fd26a668de83c5cb996de05f8f'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/sound/isa/cmi8330.c'>
<input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='bd05a5bd6b11d7fd26a668de83c5cb996de05f8f'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?h=nds-private-remove&amp;id=bd05a5bd6b11d7fd26a668de83c5cb996de05f8f'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/sound?h=nds-private-remove&amp;id=bd05a5bd6b11d7fd26a668de83c5cb996de05f8f'>sound</a>/<a href='/cgit.cgi/linux/net-next.git/log/sound/isa?h=nds-private-remove&amp;id=bd05a5bd6b11d7fd26a668de83c5cb996de05f8f'>isa</a>/<a href='/cgit.cgi/linux/net-next.git/log/sound/isa/cmi8330.c?h=nds-private-remove&amp;id=bd05a5bd6b11d7fd26a668de83c5cb996de05f8f'>cmi8330.c</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/sound/isa/cmi8330.c?h=nds-private-remove&amp;id=bd05a5bd6b11d7fd26a668de83c5cb996de05f8f&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>