summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/xgi_cmdlist.c10
-rw-r--r--linux-core/xgi_drv.c7
-rw-r--r--linux-core/xgi_drv.h37
-rw-r--r--linux-core/xgi_fb.c10
-rw-r--r--linux-core/xgi_pcie.c25
5 files changed, 39 insertions, 50 deletions
diff --git a/linux-core/xgi_cmdlist.c b/linux-core/xgi_cmdlist.c
index 04ee6e82..f7730d89 100644
--- a/linux-core/xgi_cmdlist.c
+++ b/linux-core/xgi_cmdlist.c
@@ -42,12 +42,12 @@ static void xgi_cmdlist_reset(void);
int xgi_cmdlist_initialize(struct xgi_info * info, size_t size)
{
- //struct xgi_mem_req mem_req;
- struct xgi_mem_alloc mem_alloc;
+ struct xgi_mem_alloc mem_alloc = {
+ .size = size,
+ .owner = PCIE_2D,
+ };
- //mem_req.size = size;
-
- xgi_pcie_alloc(info, size, PCIE_2D, &mem_alloc);
+ xgi_pcie_alloc(info, &mem_alloc, 0);
if ((mem_alloc.size == 0) && (mem_alloc.hw_addr == 0)) {
return -1;
diff --git a/linux-core/xgi_drv.c b/linux-core/xgi_drv.c
index 081db19e..3608c747 100644
--- a/linux-core/xgi_drv.c
+++ b/linux-core/xgi_drv.c
@@ -894,7 +894,7 @@ int xgi_kern_ioctl(struct inode *inode, struct file *filp,
break;
case XGI_ESC_FB_ALLOC:
XGI_INFO("Jong-xgi_ioctl_fb_alloc \n");
- xgi_fb_alloc(info, (struct xgi_mem_req *)arg_copy, alloc);
+ xgi_fb_alloc(info, alloc, 0);
break;
case XGI_ESC_FB_FREE:
XGI_INFO("Jong-xgi_ioctl_fb_free \n");
@@ -906,8 +906,7 @@ int xgi_kern_ioctl(struct inode *inode, struct file *filp,
break;
case XGI_ESC_PCIE_ALLOC:
XGI_INFO("Jong-xgi_ioctl_pcie_alloc \n");
- xgi_pcie_alloc(info, ((struct xgi_mem_req *) arg_copy)->size,
- ((struct xgi_mem_req *) arg_copy)->owner, alloc);
+ xgi_pcie_alloc(info, alloc, 0);
break;
case XGI_ESC_PCIE_FREE:
XGI_INFO("Jong-xgi_ioctl_pcie_free: bus_addr = 0x%lx \n",
@@ -945,8 +944,6 @@ int xgi_kern_ioctl(struct inode *inode, struct file *filp,
case XGI_ESC_DEBUG_INFO:
XGI_INFO("Jong-xgi_ioctl_restore_registers \n");
xgi_restore_registers(info);
- //xgi_write_pcie_mem(info, (struct xgi_mem_req *) arg_copy);
- //xgi_read_pcie_mem(info, (struct xgi_mem_req *) arg_copy);
break;
case XGI_ESC_SUBMIT_CMDLIST:
XGI_INFO("Jong-xgi_ioctl_submit_cmdlist \n");
diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h
index 248377aa..361a1e96 100644
--- a/linux-core/xgi_drv.h
+++ b/linux-core/xgi_drv.h
@@ -177,19 +177,23 @@ enum PcieOwner {
};
struct xgi_mem_req {
- enum xgi_mem_location location;
- unsigned long size;
- unsigned long is_front;
- enum PcieOwner owner;
- unsigned long pid;
};
struct xgi_mem_alloc {
- enum xgi_mem_location location;
- unsigned long size;
+ unsigned int location;
+ unsigned int size;
+ unsigned int is_front;
+ unsigned int owner;
+
+ /**
+ * Address of the memory from the graphics hardware's point of view.
+ */
+ u32 hw_addr;
+
+ /**
+ * Physical address of the memory from the processor's point of view.
+ */
unsigned long bus_addr;
- unsigned long hw_addr;
- unsigned long pid;
};
struct xgi_chip_info {
@@ -274,11 +278,11 @@ struct xgi_mem_pid {
#define XGI_IOCTL_POST_VBIOS _IO(XGI_IOCTL_MAGIC, XGI_ESC_POST_VBIOS)
#define XGI_IOCTL_FB_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_FB_INIT)
-#define XGI_IOCTL_FB_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_FB_ALLOC, struct xgi_mem_req)
+#define XGI_IOCTL_FB_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_FB_ALLOC, struct xgi_mem_alloc)
#define XGI_IOCTL_FB_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_FB_FREE, unsigned long)
#define XGI_IOCTL_PCIE_INIT _IO(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_INIT)
-#define XGI_IOCTL_PCIE_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_ALLOC, struct xgi_mem_req)
+#define XGI_IOCTL_PCIE_ALLOC _IOWR(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_ALLOC, struct xgi_mem_alloc)
#define XGI_IOCTL_PCIE_FREE _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PCIE_FREE, unsigned long)
#define XGI_IOCTL_PUT_SCREEN_INFO _IOW(XGI_IOCTL_MAGIC, XGI_ESC_PUT_SCREEN_INFO, struct xgi_screen_info)
@@ -332,25 +336,22 @@ struct xgi_mem_pid {
extern int xgi_fb_heap_init(struct xgi_info * info);
extern void xgi_fb_heap_cleanup(struct xgi_info * info);
-extern void xgi_fb_alloc(struct xgi_info * info, struct xgi_mem_req * req,
- struct xgi_mem_alloc * alloc);
+extern void xgi_fb_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc,
+ pid_t pid);
extern void xgi_fb_free(struct xgi_info * info, unsigned long offset);
extern void xgi_mem_collect(struct xgi_info * info, unsigned int *pcnt);
extern int xgi_pcie_heap_init(struct xgi_info * info);
extern void xgi_pcie_heap_cleanup(struct xgi_info * info);
-extern void xgi_pcie_alloc(struct xgi_info * info, unsigned long size,
- enum PcieOwner owner, struct xgi_mem_alloc * alloc);
+extern void xgi_pcie_alloc(struct xgi_info * info,
+ struct xgi_mem_alloc * alloc, pid_t pid);
extern void xgi_pcie_free(struct xgi_info * info, unsigned long offset);
extern void xgi_pcie_heap_check(void);
extern struct xgi_pcie_block *xgi_find_pcie_block(struct xgi_info * info,
unsigned long address);
extern void *xgi_find_pcie_virt(struct xgi_info * info, unsigned long address);
-extern void xgi_read_pcie_mem(struct xgi_info * info, struct xgi_mem_req * req);
-extern void xgi_write_pcie_mem(struct xgi_info * info, struct xgi_mem_req * req);
-
extern void xgi_test_rwinkernel(struct xgi_info * info, unsigned long address);
#endif
diff --git a/linux-core/xgi_fb.c b/linux-core/xgi_fb.c
index d7e9285d..ac73b41a 100644
--- a/linux-core/xgi_fb.c
+++ b/linux-core/xgi_fb.c
@@ -41,13 +41,13 @@ static struct xgi_mem_block *xgi_mem_new_node(void);
static struct xgi_mem_block *xgi_mem_alloc(struct xgi_info * info, unsigned long size);
static struct xgi_mem_block *xgi_mem_free(struct xgi_info * info, unsigned long offset);
-void xgi_fb_alloc(struct xgi_info * info,
- struct xgi_mem_req * req, struct xgi_mem_alloc * alloc)
+void xgi_fb_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc,
+ pid_t pid)
{
struct xgi_mem_block *block;
struct xgi_mem_pid *mempid_block;
- if (req->is_front) {
+ if (alloc->is_front) {
alloc->location = XGI_MEMLOC_LOCAL;
alloc->bus_addr = info->fb.base;
alloc->hw_addr = 0;
@@ -55,7 +55,7 @@ void xgi_fb_alloc(struct xgi_info * info,
("Video RAM allocation on front buffer successfully! \n");
} else {
xgi_down(info->fb_sem);
- block = xgi_mem_alloc(info, req->size);
+ block = xgi_mem_alloc(info, alloc->size);
xgi_up(info->fb_sem);
if (block == NULL) {
@@ -77,7 +77,7 @@ void xgi_fb_alloc(struct xgi_info * info,
kmalloc(sizeof(struct xgi_mem_pid), GFP_KERNEL);
mempid_block->location = XGI_MEMLOC_LOCAL;
mempid_block->bus_addr = alloc->bus_addr;
- mempid_block->pid = alloc->pid;
+ mempid_block->pid = pid;
if (!mempid_block)
XGI_ERROR("mempid_block alloc failed\n");
diff --git a/linux-core/xgi_pcie.c b/linux-core/xgi_pcie.c
index 82111249..0f82e4ec 100644
--- a/linux-core/xgi_pcie.c
+++ b/linux-core/xgi_pcie.c
@@ -764,14 +764,13 @@ static struct xgi_pcie_block *xgi_pcie_mem_free(struct xgi_info * info,
return (used_block);
}
-void xgi_pcie_alloc(struct xgi_info * info, unsigned long size,
- enum PcieOwner owner, struct xgi_mem_alloc * alloc)
+void xgi_pcie_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc,
+ pid_t pid)
{
struct xgi_pcie_block *block;
- struct xgi_mem_pid *mempid_block;
xgi_down(info->pcie_sem);
- block = xgi_pcie_mem_alloc(info, size, owner);
+ block = xgi_pcie_mem_alloc(info, alloc->size, alloc->owner);
xgi_up(info->pcie_sem);
if (block == NULL) {
@@ -794,17 +793,18 @@ void xgi_pcie_alloc(struct xgi_info * info, unsigned long size,
PCIE_3D request means a opengl process created.
PCIE_3D_TEXTURE request means texture cannot alloc from fb.
*/
- if (owner == PCIE_3D || owner == PCIE_3D_TEXTURE) {
- mempid_block =
+ if ((alloc->owner == PCIE_3D)
+ || (alloc->owner == PCIE_3D_TEXTURE)) {
+ struct xgi_mem_pid *mempid_block =
kmalloc(sizeof(struct xgi_mem_pid), GFP_KERNEL);
if (!mempid_block)
XGI_ERROR("mempid_block alloc failed\n");
mempid_block->location = XGI_MEMLOC_NON_LOCAL;
- if (owner == PCIE_3D)
+ if (alloc->owner == PCIE_3D)
mempid_block->bus_addr = 0xFFFFFFFF; /*xgi_pcie_vertex_block has the address */
else
mempid_block->bus_addr = alloc->bus_addr;
- mempid_block->pid = alloc->pid;
+ mempid_block->pid = pid;
XGI_INFO
("Memory ProcessID add one pcie block pid:%ld successfully! \n",
@@ -944,15 +944,6 @@ void *xgi_find_pcie_virt(struct xgi_info * info, unsigned long address)
return NULL;
}
-void xgi_read_pcie_mem(struct xgi_info * info, struct xgi_mem_req * req)
-{
-
-}
-
-void xgi_write_pcie_mem(struct xgi_info * info, struct xgi_mem_req * req)
-{
-}
-
/*
address -- GE hw address
*/