summaryrefslogtreecommitdiffstats
path: root/pcilib/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcilib/pci.c')
-rw-r--r--pcilib/pci.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/pcilib/pci.c b/pcilib/pci.c
index 3a0073b..8bbee2f 100644
--- a/pcilib/pci.c
+++ b/pcilib/pci.c
@@ -1,7 +1,6 @@
//#define PCILIB_FILE_IO
#define _XOPEN_SOURCE 700
#define _BSD_SOURCE
-#define _DEFAULT_SOURCE
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
@@ -173,7 +172,7 @@ pcilib_t *pcilib_open(const char *device, const char *model) {
if (!ctx->model)
ctx->model = strdup(model?model:"pci");
- pcilib_init_xml(ctx);
+ pcilib_init_xml(ctx, ctx->model);
ctx->model_info.registers = ctx->registers;
ctx->model_info.banks = ctx->banks;
@@ -282,7 +281,6 @@ int pcilib_map_data_space(pcilib_t *ctx, uintptr_t addr) {
char *pcilib_resolve_register_address(pcilib_t *ctx, pcilib_bar_t bar, uintptr_t addr) {
if (bar == PCILIB_BAR_DETECT) {
- printf("bar = PCILIB_BAR_DETECT\n");
// First checking the default register bar
size_t offset = addr - ctx->board_info.bar_start[ctx->reg_bar];
if ((addr > ctx->board_info.bar_start[ctx->reg_bar])&&(offset < ctx->board_info.bar_length[ctx->reg_bar])) {
@@ -297,7 +295,6 @@ char *pcilib_resolve_register_address(pcilib_t *ctx, pcilib_bar_t bar, uintptr_t
// Otherwise trying to detect
bar = pcilib_detect_bar(ctx, addr, 1);
if (bar != PCILIB_BAR_INVALID) {
- printf("bar pas ainvalid\n");
size_t offset = addr - ctx->board_info.bar_start[bar];
if ((offset < ctx->board_info.bar_length[bar])&&(ctx->bar_space[bar])) {
if (!ctx->bar_space[bar]) {
@@ -308,21 +305,16 @@ char *pcilib_resolve_register_address(pcilib_t *ctx, pcilib_bar_t bar, uintptr_t
}
}
} else {
- printf("bar internal :%i\n",bar);
- // printf("bar invalid\n");
if (!ctx->bar_space[bar]) {
pcilib_error("The requested bar (%i) is not mapped", bar);
return NULL;
}
if (addr < ctx->board_info.bar_length[bar]) {
- printf("path1\n");
- // printf("apres: %s\n",ctx->bar_space[bar] + addr);
return ctx->bar_space[bar] + addr + (ctx->board_info.bar_start[bar] & ctx->page_mask);
}
if ((addr >= ctx->board_info.bar_start[bar])&&(addr < (ctx->board_info.bar_start[bar] + ctx->board_info.bar_length[ctx->reg_bar]))) {
- printf("path2\n");
return ctx->bar_space[bar] + (addr - ctx->board_info.bar_start[bar]) + (ctx->board_info.bar_start[bar] & ctx->page_mask);
}
}