<commit_before>/*
 * Copyright (C) 2012 <NAME> <<EMAIL>>
 * All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

#include "nva.h"
#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv) {
	if (nva_init()) {
		fprintf (stderr, "PCI init failure!\n");
		return 1;
	}
	int c;
	int cnum =0;
	while ((c = getopt (argc, argv, "c:")) != -1)
		switch (c) {
			case 'c':
				sscanf(optarg, "%d", &cnum);
				break;
		}
	if (cnum >= nva_cardsnum) {
		if (nva_cardsnum)
			fprintf (stderr, "No such card.\n");
		else
			fprintf (stderr, "No cards found.\n");
		return 1;
	}
	int i;
	uint32_t pmc_enable = nva_rd32(cnum, 0x200);

	printf("PMC:\n");
	printf("\tID: %08x\n", nva_rd32(cnum, 0));
	printf("\tINTR: %08x\n", nva_rd32(cnum, 0x100));
	printf("\tINTR_EN: %08x\n", nva_rd32(cnum, 0x140));
	printf("\tINTR_LN: %08x\n", nva_rd32(cnum, 0x160));
	printf("\tENABLE: %08x\n", nva_rd32(cnum, 0x200));

	printf("PBUS:\n");
	printf("\tUNK1200: %08x\n", nva_rd32(cnum, 0x1200));
	printf("\tUNK1400: %08x\n", nva_rd32(cnum, 0x1400));
	printf("\tPCI_0:\n");
	for (i = 0; i < 16; i++)
		printf("\t\t%02x: %08x\n", i * 4, nva_rd32(cnum, 0x1800 + i * 4));
	printf("\tPCI_1:\n");
	for (i = 0; i < 16; i++)
		printf("\t\t%02x: %08x\n", i * 4, nva_rd32(cnum, 0x1900 + i * 4));

	if (pmc_enable & 0x100) {
		printf("PFIFO:\n");
		printf("\tWAIT_RETRY: %08x\n", nva_rd32(cnum, 0x2040));
		printf("\tCACHE_ERROR: %08x\n", nva_rd32(cnum, 0x2080));
		printf("\tINTR: %08x/%08x\n", nva_rd32(cnum, 0x2100), nva_rd32(cnum, 0x2140));
		printf("\tCONFIG: %08x\n", nva_rd32(cnum, 0x2200));
		printf("\tRUNOUT_STATUS: %08x\n", nva_rd32(cnum, 0x2400));
		printf("\tRUNOUT_PUT: %08x\n", nva_rd32(cnum, 0x2410));
		printf("\tRUNOUT_GET: %08x\n", nva_rd32(cnum, 0x2420));
		printf("\tCACHES: %08x\n", nva_rd32(cnum, 0x2500));
		printf("\tDEVICE: %08x\n", nva_rd32(cnum, 0x2800));
		printf("\tCACHE0:\n");
		printf("\t\tPUSH_CTRL: %08x\n", nva_rd32(cnum, 0x3000));
		printf("\t\tCHID: %08x\n", nva_rd32(cnum, 0x3010));
		printf("\t\tSTATUS: %08x\n", nva_rd32(cnum, 0x3020));
		printf("\t\tPUT: %08x\n", nva_rd32(cnum, 0x3030));
		printf("\t\tPULL_CTRL: %08x\n", nva_rd32(cnum, 0x3040));
		printf("\t\tPULL_STATE: %08x\n", nva_rd32(cnum, 0x3050));
		printf("\t\tGET: %08x\n", nva_rd32(cnum, 0x3070));
		printf("\t\tCONTEXT: %08x\n", nva_rd32(cnum, 0x3080));
		printf("\t\tADDR: %08x\n", nva_rd32(cnum, 0x3100));
		printf("\t\tDATA: %08x\n", nva_rd32(cnum, 0x3104));
		printf("\tCACHE1:\n");
		printf("\t\tPUSH_CTRL: %08x\n", nva_rd32(cnum, 0x3200));
		printf("\t\tCHID: %08x\n", nva_rd32(cnum, 0x3210));
		printf("\t\tSTATUS: %08x\n", nva_rd32(cnum, 0x3220));
		printf("\t\tPUT: %08x\n", nva_rd32(cnum, 0x3230));
		printf("\t\tPULL_CTRL: %08x\n", nva_rd32(cnum, 0x3240));
		printf("\t\tPULL_STATE: %08x\n", nva_rd32(cnum, 0x3250));
		printf("\t\tGET: %08x\n", nva_rd32(cnum, 0x3270));
		for (i = 0; i < 8; i++)
			printf("\t\tCONTEXT[%d]: %08x\n", i, nva_rd32(cnum, 0x3280 + i * 0x10));
		for (i = 0; i < 32; i++) {
			nva_rd32(cnum, 0x3200);
			printf("\t\tADDR[%d]: %08x\n", i, nva_rd32(cnum, 0x3300 + i * 8));
			printf("\t\tDATA[%d]: %08x\n", i, nva_rd32(cnum, 0x3304 + i * 8));
		}
	}

	if (pmc_enable & 0x10) {
		printf("PDMA:\n");
		printf("\tUNK0:\n");
		printf("\t\tINTR: %08x/%08x\n", nva_rd32(cnum, 0x100100), nva_rd32(cnum, 0x100140));
		printf("\t\tUNK040: %08x\n", nva_rd32(cnum, 0x100440));
		printf("\t\tUNK100: %08x\n", nva_rd32(cnum, 0x100500));
		for (i = 0; i < 8; i++)
			printf("\t\tUNK180[%d]: %08x\n", i, nva_rd32(cnum, 0x100580 + i * 4));
		printf("\tAUDIO:\n");
		printf("\t\tINTR: %08x/%08x\n", nva_rd32(cnum, 0x100108), nva_rd32(cnum, 0x100148));
		printf("\t\tUNK000: %08x\n", nva_rd32(cnum, 0x100600));
		printf("\t\tUNK004: %08x\n", nva_rd32(cnum, 0x100604));
		printf("\t\tUNK008: %08x\n", nva_rd32(cnum, 0x100608));
		printf("\t\tACCESS: %08x\n", nva_rd32(cnum, 0x100610));
		printf("\t\tUNK018: %08x\n", nva_rd32(cnum, 0x100618));
		printf("\t\tUNK020: %08x\n", nva_rd32(cnum, 0x100620));
		printf("\t\tUNK030: %08x\n", nva_rd32(cnum, 0x100630));
		printf("\t\tUNK040: %08x\n", nva_rd32(cnum, 0x100640));
		printf("\t\tUNK080: %08x\n", nva_rd32(cnum, 0x100680));
		for (i = 0; i < 4; i++)
			printf("\t\tUNK100[%d]: %08x\n", i, nva_rd32(cnum, 0x100700 + i * 4));
		printf("\tGRAPH:\n");
		printf("\t\tINTR: %08x/%08x\n", nva_rd32(cnum, 0x100110), nva_rd32(cnum, 0x100150));
		printf("\t\tUNK000: %08x\n", nva_rd32(cnum, 0x100800));
		printf("\t\tUNK004: %08x\n", nva_rd32(cnum, 0x100804));
		printf("\t\tUNK008: %08x\n", nva_rd32(cnum, 0x100808));
		printf("\t\tACCESS: %08x\n", nva_rd32(cnum, 0x100810));
		printf("\t\tUNK018: %08x\n", nva_rd32(cnum, 0x100818));
		printf("\t\tUNK020: %08x\n", nva_rd32(cnum, 0x100820));
		printf("\t\tUNK030: %08x\n", nva_rd32(cnum, 0x100830));
		printf("\t\tUNK040: %08x\n", nva_rd32(cnum, 0x100840));
		printf("\t\tUNK080: %08x\n", nva_rd32(cnum, 0x100880));
		for (i = 0; i < 8; i++)
			printf("\t\tUNK100[%d]: %08x\n", i, nva_rd32(cnum, 0x100900 + i * 4));
<commit_msg>nv01dump: Add register names for PDMA.<commit_after>/*
 * Copyright (C) 2012 <NAME> <<EMAIL>>
 * All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

#include "nva.h"
#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv) {
	if (nva_init()) {
		fprintf (stderr, "PCI init failure!\n");
		return 1;
	}
	int c;
	int cnum =0;
	while ((c = getopt (argc, argv, "c:")) != -1)
		switch (c) {
			case 'c':
				sscanf(optarg, "%d", &cnum);
				break;
		}
	if (cnum >= nva_cardsnum) {
		if (nva_cardsnum)
			fprintf (stderr, "No such card.\n");
		else
			fprintf (stderr, "No cards found.\n");
		return 1;
	}
	int i;
	uint32_t pmc_enable = nva_rd32(cnum, 0x200);

	printf("PMC:\n");
	printf("\tID: %08x\n", nva_rd32(cnum, 0));
	printf("\tINTR: %08x\n", nva_rd32(cnum, 0x100));
	printf("\tINTR_EN: %08x\n", nva_rd32(cnum, 0x140));
	printf("\tINTR_LN: %08x\n", nva_rd32(cnum, 0x160));
	printf("\tENABLE: %08x\n", nva_rd32(cnum, 0x200));

	printf("PBUS:\n");
	printf("\tUNK1200: %08x\n", nva_rd32(cnum, 0x1200));
	printf("\tUNK1400: %08x\n", nva_rd32(cnum, 0x1400));
	printf("\tPCI_0:\n");
	for (i = 0; i < 16; i++)
		printf("\t\t%02x: %08x\n", i * 4, nva_rd32(cnum, 0x1800 + i * 4));
	printf("\tPCI_1:\n");
	for (i = 0; i < 16; i++)
		printf("\t\t%02x: %08x\n", i * 4, nva_rd32(cnum, 0x1900 + i * 4));

	if (pmc_enable & 0x100) {
		printf("PFIFO:\n");
		printf("\tWAIT_RETRY: %08x\n", nva_rd32(cnum, 0x2040));
		printf("\tCACHE_ERROR: %08x\n", nva_rd32(cnum, 0x2080));
		printf("\tINTR: %08x/%08x\n", nva_rd32(cnum, 0x2100), nva_rd32(cnum, 0x2140));
		printf("\tCONFIG: %08x\n", nva_rd32(cnum, 0x2200));
		printf("\tRUNOUT_STATUS: %08x\n", nva_rd32(cnum, 0x2400));
		printf("\tRUNOUT_PUT: %08x\n", nva_rd32(cnum, 0x2410));
		printf("\tRUNOUT_GET: %08x\n", nva_rd32(cnum, 0x2420));
		printf("\tCACHES: %08x\n", nva_rd32(cnum, 0x2500));
		printf("\tDEVICE: %08x\n", nva_rd32(cnum, 0x2800));
		printf("\tCACHE0:\n");
		printf("\t\tPUSH_CTRL: %08x\n", nva_rd32(cnum, 0x3000));
		printf("\t\tCHID: %08x\n", nva_rd32(cnum, 0x3010));
		printf("\t\tSTATUS: %08x\n", nva_rd32(cnum, 0x3020));
		printf("\t\tPUT: %08x\n", nva_rd32(cnum, 0x3030));
		printf("\t\tPULL_CTRL: %08x\n", nva_rd32(cnum, 0x3040));
		printf("\t\tPULL_STATE: %08x\n", nva_rd32(cnum, 0x3050));
		printf("\t\tGET: %08x\n", nva_rd32(cnum, 0x3070));
		printf("\t\tCONTEXT: %08x\n", nva_rd32(cnum, 0x3080));
		printf("\t\tADDR: %08x\n", nva_rd32(cnum, 0x3100));
		printf("\t\tDATA: %08x\n", nva_rd32(cnum, 0x3104));
		printf("\tCACHE1:\n");
		printf("\t\tPUSH_CTRL: %08x\n", nva_rd32(cnum, 0x3200));
		printf("\t\tCHID: %08x\n", nva_rd32(cnum, 0x3210));
		printf("\t\tSTATUS: %08x\n", nva_rd32(cnum, 0x3220));
		printf("\t\tPUT: %08x\n", nva_rd32(cnum, 0x3230));
		printf("\t\tPULL_CTRL: %08x\n", nva_rd32(cnum, 0x3240));
		printf("\t\tPULL_STATE: %08x\n", nva_rd32(cnum, 0x3250));
		printf("\t\tGET: %08x\n", nva_rd32(cnum, 0x3270));
		for (i = 0; i < 8; i++)
			printf("\t\tCONTEXT[%d]: %08x\n", i, nva_rd32(cnum, 0x3280 + i * 0x10));
		for (i = 0; i < 32; i++) {
			nva_rd32(cnum, 0x3200);
			printf("\t\tADDR[%d]: %08x\n", i, nva_rd32(cnum, 0x3300 + i * 8));
			printf("\t\tDATA[%d]: %08x\n", i, nva_rd32(cnum, 0x3304 + i * 8));
		}
	}

	if (pmc_enable & 0x10) {
		printf("PDMA:\n");
		printf("\tUNK0:\n");
		printf("\t\tINTR: %08x/%08x\n", nva_rd32(cnum, 0x100100), nva_rd32(cnum, 0x100140));
		printf("\t\tSTATUS: %08x\n", nva_rd32(cnum, 0x100414));
		printf("\t\tPHYS_ADDR: %08x\n", nva_rd32(cnum, 0x100440));
		printf("\t\tUNK100: %08x\n", nva_rd32(cnum, 0x100500));
		for (i = 0; i < 8; i++)
			printf("\t\tREAD_BUF[%d]: %08x\n", i, nva_rd32(cnum, 0x100580 + i * 4));
		printf("\tAUDIO:\n");
		printf("\t\tINTR: %08x/%08x\n", nva_rd32(cnum, 0x100108), nva_rd32(cnum, 0x100148));
		printf("\t\tFLAGS: %08x\n", nva_rd32(cnum, 0x100600));
		printf("\t\tLIMIT: %08x\n", nva_rd32(cnum, 0x100604));
		printf("\t\tPTE: %08x\n", nva_rd32(cnum, 0x100608));
		printf("\t\tACCESS: %08x\n", nva_rd32(cnum, 0x100610));
		printf("\t\tSTATUS: %08x\n", nva_rd32(cnum, 0x100614));
		printf("\t\tVALID: %08x\n", nva_rd32(cnum, 0x100618));
		printf("\t\tPTE_TAG: %08x\n", nva_rd32(cnum, 0x100620));
		printf("\t\tADDR_VIRT_ADJ: %08x\n", nva_rd32(cnum, 0x100630));
		printf("\t\tADDR_PHYS: %08x\n", nva_rd32(cnum, 0x100640));
		printf("\t\tINST: %08x\n", nva_rd32(cnum, 0x100680));
		for (i = 0; i < 4; i++)
			printf("\t\tWRITE_BUF[%d]: %08x\n", i, nva_rd32(cnum, 0x100700 + i * 4));
		printf("\tGRAPH:\n");
		printf("\t\tINTR: %08x/%08x\n", nva_rd32(cnum, 0x100110), nva_rd32(cnum, 0x100150));
		printf("\t\tFLAGS: %08x\n", nva_rd32(cnum, 0x100800));
		printf("\t\tLIMIT: %08x\n", nva_rd32(cnum, 0x100804));
		printf("\t\tPTE: %08x\n", nva_rd32(cnum, 0x100808));
		printf("\t\tACCESS: %08x\n", nva_rd32(cnum, 0x100810));
		printf("\t\tSTATUS: %08x\n", nva_rd32(cnum, 0x100814));
		printf("\t\tVALID: %08x\n", nva_rd32(cnum, 0x100818));
		printf("\t\tPTE_TAG: %08x\n", nva_rd32(cnum, 0x100820));
		printf("\t\tADDR_VIRT_ADJ: %08x\n", nva_rd32(cnum, 0x100830));
		printf("\t\tADDR_PHYS: %08x\n", nva_rd32(cnum, 0x100840));
		printf("\t\tINST: %08x\n", nva_rd32(cnum, 0x100880));
		for (i = 0; i < 8; i++)
			printf("\t\tWRITE_BUF[%d]: %08x\n", i, nva_rd32(cnum, 0x100900 + i * 4));

{'fraction_non_alphanumeric': 0.20907774022211492, 'fraction_numerical': 0.12691131498470948, 'mean_word_length': 4.5035429583702395, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6223095', 'n_tokens_mistral': 6943, 'n_tokens_neox': 5741, 'n_words': 1199}