summaryrefslogtreecommitdiffstats
path: root/pcilib/pci.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2016-03-01 18:53:29 +0100
committerSuren A. Chilingaryan <csa@suren.me>2016-03-01 18:53:29 +0100
commitd85316d3201bfda47efae12ff824ecf68835020e (patch)
tree63777d6576ce565734a593cd065287c034c69dd9 /pcilib/pci.c
parent7a4cc129345545be4f326b62d266809c4db9105e (diff)
downloadpcitool-d85316d3201bfda47efae12ff824ecf68835020e.tar.gz
pcitool-d85316d3201bfda47efae12ff824ecf68835020e.tar.bz2
pcitool-d85316d3201bfda47efae12ff824ecf68835020e.tar.xz
pcitool-d85316d3201bfda47efae12ff824ecf68835020e.zip
Detect page mask before any kmem operations (locks, softregs, etc.)
Diffstat (limited to 'pcilib/pci.c')
-rw-r--r--pcilib/pci.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pcilib/pci.c b/pcilib/pci.c
index eaf41ac..6ec8c9d 100644
--- a/pcilib/pci.c
+++ b/pcilib/pci.c
@@ -131,7 +131,7 @@ pcilib_t *pcilib_open(const char *device, const char *model) {
return NULL;
}
- ctx->page_mask = (uintptr_t)-1;
+ ctx->page_mask = pcilib_get_page_mask();
if ((model)&&(!strcasecmp(model, "maintenance"))) {
ctx->model = strdup("maintenance");
@@ -263,14 +263,14 @@ const pcilib_driver_version_t *pcilib_get_driver_version(pcilib_t *ctx) {
const pcilib_board_info_t *pcilib_get_board_info(pcilib_t *ctx) {
int ret;
- if (ctx->page_mask == (uintptr_t)-1) {
+ if (!ctx->board_info_ready) {
ret = ioctl( ctx->handle, PCIDRIVER_IOC_PCI_INFO, &ctx->board_info );
if (ret) {
pcilib_error("PCIDRIVER_IOC_PCI_INFO ioctl have failed");
return NULL;
}
- ctx->page_mask = pcilib_get_page_mask();
+ ctx->board_info_ready = 1;
}
return &ctx->board_info;