dos2unix and Lindent

main
Ian Romanick 2007-06-26 13:10:30 -07:00
parent 7af9d67037
commit 434657a258
13 changed files with 5765 additions and 5913 deletions

View File

@ -26,7 +26,6 @@
* DEALINGS IN THE SOFTWARE.
***************************************************************************/
#include "xgi_types.h"
#include "xgi_linux.h"
#include "xgi_drv.h"
@ -34,18 +33,14 @@
#include "xgi_misc.h"
#include "xgi_cmdlist.h"
U32 s_emptyBegin[AGPCMDLIST_BEGIN_SIZE] =
{
0x10000000, // 3D Type Begin, Invalid
0x80000004, // Length = 4;
0x00000000,
0x00000000
U32 s_emptyBegin[AGPCMDLIST_BEGIN_SIZE] = {
0x10000000, // 3D Type Begin, Invalid
0x80000004, // Length = 4;
0x00000000,
0x00000000
};
U32 s_flush2D[AGPCMDLIST_FLUSH_CMD_LEN] =
{
U32 s_flush2D[AGPCMDLIST_FLUSH_CMD_LEN] = {
FLUSH_2D,
FLUSH_2D,
FLUSH_2D,
@ -54,171 +49,195 @@ U32 s_flush2D[AGPCMDLIST_FLUSH_CMD_LEN] =
xgi_cmdring_info_t s_cmdring;
static void addFlush2D(xgi_info_t *info);
static U32 getCurBatchBeginPort(xgi_cmd_info_t *pCmdInfo);
static void triggerHWCommandList(xgi_info_t *info, U32 triggerCounter);
static void addFlush2D(xgi_info_t * info);
static U32 getCurBatchBeginPort(xgi_cmd_info_t * pCmdInfo);
static void triggerHWCommandList(xgi_info_t * info, U32 triggerCounter);
static void xgi_cmdlist_reset(void);
int xgi_cmdlist_initialize(xgi_info_t *info, U32 size)
int xgi_cmdlist_initialize(xgi_info_t * info, U32 size)
{
//xgi_mem_req_t mem_req;
xgi_mem_alloc_t mem_alloc;
//xgi_mem_req_t mem_req;
xgi_mem_alloc_t mem_alloc;
//mem_req.size = size;
//mem_req.size = size;
xgi_pcie_alloc(info, size, PCIE_2D, &mem_alloc);
xgi_pcie_alloc(info, size, PCIE_2D, &mem_alloc);
if ((mem_alloc.size == 0) && (mem_alloc.hw_addr == 0))
{
return -1;
}
if ((mem_alloc.size == 0) && (mem_alloc.hw_addr == 0)) {
return -1;
}
s_cmdring._cmdRingSize = mem_alloc.size;
s_cmdring._cmdRingBuffer = mem_alloc.hw_addr;
s_cmdring._cmdRingBusAddr = mem_alloc.bus_addr;
s_cmdring._lastBatchStartAddr = 0;
s_cmdring._cmdRingOffset = 0;
s_cmdring._cmdRingSize = mem_alloc.size;
s_cmdring._cmdRingBuffer = mem_alloc.hw_addr;
s_cmdring._cmdRingBusAddr = mem_alloc.bus_addr;
s_cmdring._lastBatchStartAddr = 0;
s_cmdring._cmdRingOffset = 0;
return 1;
return 1;
}
void xgi_submit_cmdlist(xgi_info_t *info, xgi_cmd_info_t *pCmdInfo)
void xgi_submit_cmdlist(xgi_info_t * info, xgi_cmd_info_t * pCmdInfo)
{
U32 beginPort;
U32 beginPort;
/** XGI_INFO("Jong-xgi_submit_cmdlist-Begin \n"); **/
/* Jong 05/25/2006 */
/* return; */
beginPort = getCurBatchBeginPort(pCmdInfo);
XGI_INFO("Jong-xgi_submit_cmdlist-After getCurBatchBeginPort() \n");
beginPort = getCurBatchBeginPort(pCmdInfo);
XGI_INFO("Jong-xgi_submit_cmdlist-After getCurBatchBeginPort() \n");
/* Jong 05/25/2006 */
/* return; */
if (s_cmdring._lastBatchStartAddr == 0)
{
U32 portOffset;
if (s_cmdring._lastBatchStartAddr == 0) {
U32 portOffset;
/* Jong 06/13/2006; remove marked for system hang test */
/* xgi_waitfor_pci_idle(info); */
/* xgi_waitfor_pci_idle(info); */
/* Jong 06132006; BASE_3D_ENG=0x2800 */
/* beginPort: 2D: 0x30 */
portOffset = BASE_3D_ENG + beginPort;
portOffset = BASE_3D_ENG + beginPort;
// Enable PCI Trigger Mode
XGI_INFO("Jong-xgi_submit_cmdlist-Enable PCI Trigger Mode \n");
// Enable PCI Trigger Mode
XGI_INFO("Jong-xgi_submit_cmdlist-Enable PCI Trigger Mode \n");
/* Jong 05/25/2006 */
/* return; */
/* Jong 06/13/2006; M2REG_AUTO_LINK_SETTING_ADDRESS=0x10 */
XGI_INFO("Jong-M2REG_AUTO_LINK_SETTING_ADDRESS=0x%lx \n", M2REG_AUTO_LINK_SETTING_ADDRESS);
XGI_INFO("Jong-M2REG_CLEAR_COUNTERS_MASK=0x%lx \n", M2REG_CLEAR_COUNTERS_MASK);
XGI_INFO("Jong-(M2REG_AUTO_LINK_SETTING_ADDRESS << 22)=0x%lx \n", (M2REG_AUTO_LINK_SETTING_ADDRESS << 22));
XGI_INFO("Jong-M2REG_PCI_TRIGGER_MODE_MASK=0x%lx \n\n", M2REG_PCI_TRIGGER_MODE_MASK);
XGI_INFO("Jong-M2REG_AUTO_LINK_SETTING_ADDRESS=0x%lx \n",
M2REG_AUTO_LINK_SETTING_ADDRESS);
XGI_INFO("Jong-M2REG_CLEAR_COUNTERS_MASK=0x%lx \n",
M2REG_CLEAR_COUNTERS_MASK);
XGI_INFO
("Jong-(M2REG_AUTO_LINK_SETTING_ADDRESS << 22)=0x%lx \n",
(M2REG_AUTO_LINK_SETTING_ADDRESS << 22));
XGI_INFO("Jong-M2REG_PCI_TRIGGER_MODE_MASK=0x%lx \n\n",
M2REG_PCI_TRIGGER_MODE_MASK);
/* Jong 06/14/2006; 0x400001a */
XGI_INFO("Jong-(M2REG_AUTO_LINK_SETTING_ADDRESS << 22)|M2REG_CLEAR_COUNTERS_MASK|0x08|M2REG_PCI_TRIGGER_MODE_MASK=0x%lx \n",
(M2REG_AUTO_LINK_SETTING_ADDRESS << 22)|M2REG_CLEAR_COUNTERS_MASK|0x08|M2REG_PCI_TRIGGER_MODE_MASK);
dwWriteReg(BASE_3D_ENG + M2REG_AUTO_LINK_SETTING_ADDRESS,
(M2REG_AUTO_LINK_SETTING_ADDRESS << 22) |
M2REG_CLEAR_COUNTERS_MASK |
0x08 |
M2REG_PCI_TRIGGER_MODE_MASK);
XGI_INFO
("Jong-(M2REG_AUTO_LINK_SETTING_ADDRESS << 22)|M2REG_CLEAR_COUNTERS_MASK|0x08|M2REG_PCI_TRIGGER_MODE_MASK=0x%lx \n",
(M2REG_AUTO_LINK_SETTING_ADDRESS << 22) |
M2REG_CLEAR_COUNTERS_MASK | 0x08 |
M2REG_PCI_TRIGGER_MODE_MASK);
dwWriteReg(BASE_3D_ENG + M2REG_AUTO_LINK_SETTING_ADDRESS,
(M2REG_AUTO_LINK_SETTING_ADDRESS << 22) |
M2REG_CLEAR_COUNTERS_MASK | 0x08 |
M2REG_PCI_TRIGGER_MODE_MASK);
/* Jong 05/25/2006 */
XGI_INFO("Jong-xgi_submit_cmdlist-After dwWriteReg() \n");
/* return; */ /* OK */
XGI_INFO("Jong-xgi_submit_cmdlist-After dwWriteReg() \n");
/* return; *//* OK */
/* Jong 06/14/2006; 0x400000a */
XGI_INFO("Jong-(M2REG_AUTO_LINK_SETTING_ADDRESS << 22)|0x08|M2REG_PCI_TRIGGER_MODE_MASK=0x%lx \n",
(M2REG_AUTO_LINK_SETTING_ADDRESS << 22)|0x08|M2REG_PCI_TRIGGER_MODE_MASK);
dwWriteReg(BASE_3D_ENG + M2REG_AUTO_LINK_SETTING_ADDRESS,
(M2REG_AUTO_LINK_SETTING_ADDRESS << 22) |
0x08 |
M2REG_PCI_TRIGGER_MODE_MASK);
XGI_INFO
("Jong-(M2REG_AUTO_LINK_SETTING_ADDRESS << 22)|0x08|M2REG_PCI_TRIGGER_MODE_MASK=0x%lx \n",
(M2REG_AUTO_LINK_SETTING_ADDRESS << 22) | 0x08 |
M2REG_PCI_TRIGGER_MODE_MASK);
dwWriteReg(BASE_3D_ENG + M2REG_AUTO_LINK_SETTING_ADDRESS,
(M2REG_AUTO_LINK_SETTING_ADDRESS << 22) | 0x08 |
M2REG_PCI_TRIGGER_MODE_MASK);
// Send PCI begin command
XGI_INFO("Jong-xgi_submit_cmdlist-Send PCI begin command \n");
// Send PCI begin command
XGI_INFO("Jong-xgi_submit_cmdlist-Send PCI begin command \n");
/* return; */
XGI_INFO("Jong-xgi_submit_cmdlist-portOffset=%d \n", portOffset);
XGI_INFO("Jong-xgi_submit_cmdlist-beginPort=%d \n", beginPort);
XGI_INFO("Jong-xgi_submit_cmdlist-portOffset=%d \n",
portOffset);
XGI_INFO("Jong-xgi_submit_cmdlist-beginPort=%d \n", beginPort);
/* beginPort = 48; */
/* 0xc100000 */
dwWriteReg(portOffset, (beginPort<<22) + (BEGIN_VALID_MASK) + pCmdInfo->_curDebugID);
XGI_INFO("Jong-(beginPort<<22)=0x%lx \n", (beginPort<<22));
XGI_INFO("Jong-(BEGIN_VALID_MASK)=0x%lx \n", BEGIN_VALID_MASK);
XGI_INFO("Jong- pCmdInfo->_curDebugID=0x%lx \n", pCmdInfo->_curDebugID);
XGI_INFO("Jong- (beginPort<<22) + (BEGIN_VALID_MASK) + pCmdInfo->_curDebugID=0x%lx \n", (beginPort<<22) + (BEGIN_VALID_MASK) + pCmdInfo->_curDebugID);
XGI_INFO("Jong-xgi_submit_cmdlist-Send PCI begin command- After \n");
/* return; */ /* OK */
dwWriteReg(portOffset,
(beginPort << 22) + (BEGIN_VALID_MASK) +
pCmdInfo->_curDebugID);
XGI_INFO("Jong-(beginPort<<22)=0x%lx \n", (beginPort << 22));
XGI_INFO("Jong-(BEGIN_VALID_MASK)=0x%lx \n", BEGIN_VALID_MASK);
XGI_INFO("Jong- pCmdInfo->_curDebugID=0x%lx \n",
pCmdInfo->_curDebugID);
XGI_INFO
("Jong- (beginPort<<22) + (BEGIN_VALID_MASK) + pCmdInfo->_curDebugID=0x%lx \n",
(beginPort << 22) + (BEGIN_VALID_MASK) +
pCmdInfo->_curDebugID);
XGI_INFO
("Jong-xgi_submit_cmdlist-Send PCI begin command- After \n");
/* return; *//* OK */
/* 0x80000024 */
dwWriteReg(portOffset+4, BEGIN_LINK_ENABLE_MASK + pCmdInfo->_firstSize);
XGI_INFO("Jong- BEGIN_LINK_ENABLE_MASK=0x%lx \n", BEGIN_LINK_ENABLE_MASK);
XGI_INFO("Jong- pCmdInfo->_firstSize=0x%lx \n", pCmdInfo->_firstSize);
XGI_INFO("Jong- BEGIN_LINK_ENABLE_MASK + pCmdInfo->_firstSize=0x%lx \n", BEGIN_LINK_ENABLE_MASK + pCmdInfo->_firstSize);
XGI_INFO("Jong-xgi_submit_cmdlist-dwWriteReg-1 \n");
dwWriteReg(portOffset + 4,
BEGIN_LINK_ENABLE_MASK + pCmdInfo->_firstSize);
XGI_INFO("Jong- BEGIN_LINK_ENABLE_MASK=0x%lx \n",
BEGIN_LINK_ENABLE_MASK);
XGI_INFO("Jong- pCmdInfo->_firstSize=0x%lx \n",
pCmdInfo->_firstSize);
XGI_INFO
("Jong- BEGIN_LINK_ENABLE_MASK + pCmdInfo->_firstSize=0x%lx \n",
BEGIN_LINK_ENABLE_MASK + pCmdInfo->_firstSize);
XGI_INFO("Jong-xgi_submit_cmdlist-dwWriteReg-1 \n");
/* 0x1010000 */
dwWriteReg(portOffset+8, (pCmdInfo->_firstBeginAddr >> 4));
XGI_INFO("Jong- pCmdInfo->_firstBeginAddr=0x%lx \n", pCmdInfo->_firstBeginAddr);
XGI_INFO("Jong- (pCmdInfo->_firstBeginAddr >> 4)=0x%lx \n", (pCmdInfo->_firstBeginAddr >> 4));
XGI_INFO("Jong-xgi_submit_cmdlist-dwWriteReg-2 \n");
/* 0x1010000 */
dwWriteReg(portOffset + 8, (pCmdInfo->_firstBeginAddr >> 4));
XGI_INFO("Jong- pCmdInfo->_firstBeginAddr=0x%lx \n",
pCmdInfo->_firstBeginAddr);
XGI_INFO("Jong- (pCmdInfo->_firstBeginAddr >> 4)=0x%lx \n",
(pCmdInfo->_firstBeginAddr >> 4));
XGI_INFO("Jong-xgi_submit_cmdlist-dwWriteReg-2 \n");
/* Jong 06/13/2006 */
xgi_dump_register(info);
xgi_dump_register(info);
/* Jong 06/12/2006; system hang; marked for test */
dwWriteReg(portOffset+12, 0);
XGI_INFO("Jong-xgi_submit_cmdlist-dwWriteReg-3 \n");
dwWriteReg(portOffset + 12, 0);
XGI_INFO("Jong-xgi_submit_cmdlist-dwWriteReg-3 \n");
/* Jong 06/13/2006; remove marked for system hang test */
/* xgi_waitfor_pci_idle(info); */
}
else
{
XGI_INFO("Jong-xgi_submit_cmdlist-s_cmdring._lastBatchStartAddr != 0 \n");
U32 *lastBatchVirtAddr;
/* xgi_waitfor_pci_idle(info); */
} else {
XGI_INFO
("Jong-xgi_submit_cmdlist-s_cmdring._lastBatchStartAddr != 0 \n");
U32 *lastBatchVirtAddr;
/* Jong 05/25/2006 */
/* return; */
if (pCmdInfo->_firstBeginType == BTYPE_3D)
{
addFlush2D(info);
}
if (pCmdInfo->_firstBeginType == BTYPE_3D) {
addFlush2D(info);
}
lastBatchVirtAddr = (U32*) xgi_find_pcie_virt(info, s_cmdring._lastBatchStartAddr);
lastBatchVirtAddr =
(U32 *) xgi_find_pcie_virt(info,
s_cmdring._lastBatchStartAddr);
lastBatchVirtAddr[1] = BEGIN_LINK_ENABLE_MASK + pCmdInfo->_firstSize;
lastBatchVirtAddr[2] = pCmdInfo->_firstBeginAddr >> 4;
lastBatchVirtAddr[3] = 0;
//barrier();
lastBatchVirtAddr[0] = (beginPort<<22) + (BEGIN_VALID_MASK) + (0xffff & pCmdInfo->_curDebugID);
lastBatchVirtAddr[1] =
BEGIN_LINK_ENABLE_MASK + pCmdInfo->_firstSize;
lastBatchVirtAddr[2] = pCmdInfo->_firstBeginAddr >> 4;
lastBatchVirtAddr[3] = 0;
//barrier();
lastBatchVirtAddr[0] =
(beginPort << 22) + (BEGIN_VALID_MASK) +
(0xffff & pCmdInfo->_curDebugID);
/* Jong 06/12/2006; system hang; marked for test */
triggerHWCommandList(info, pCmdInfo->_beginCount);
triggerHWCommandList(info, pCmdInfo->_beginCount);
XGI_INFO("Jong-xgi_submit_cmdlist-s_cmdring._lastBatchStartAddr != 0 - End\n");
}
XGI_INFO
("Jong-xgi_submit_cmdlist-s_cmdring._lastBatchStartAddr != 0 - End\n");
}
s_cmdring._lastBatchStartAddr = pCmdInfo->_lastBeginAddr;
XGI_INFO("Jong-xgi_submit_cmdlist-End \n");
s_cmdring._lastBatchStartAddr = pCmdInfo->_lastBeginAddr;
XGI_INFO("Jong-xgi_submit_cmdlist-End \n");
}
/*
state: 0 - console
1 - graphic
2 - fb
3 - logout
*/
void xgi_state_change(xgi_info_t *info, xgi_state_info_t *pStateInfo)
void xgi_state_change(xgi_info_t * info, xgi_state_info_t * pStateInfo)
{
#define STATE_CONSOLE 0
#define STATE_GRAPHIC 1
@ -227,122 +246,112 @@ void xgi_state_change(xgi_info_t *info, xgi_state_info_t *pStateInfo)
#define STATE_REBOOT 4
#define STATE_SHUTDOWN 5
if ((pStateInfo->_fromState == STATE_GRAPHIC)
&& (pStateInfo->_toState == STATE_CONSOLE))
{
XGI_INFO("[kd] I see, now is to leaveVT\n");
// stop to received batch
}
else if ((pStateInfo->_fromState == STATE_CONSOLE)
&& (pStateInfo->_toState == STATE_GRAPHIC))
{
XGI_INFO("[kd] I see, now is to enterVT\n");
xgi_cmdlist_reset();
}
else if ((pStateInfo->_fromState == STATE_GRAPHIC)
&& ( (pStateInfo->_toState == STATE_LOGOUT)
||(pStateInfo->_toState == STATE_REBOOT)
||(pStateInfo->_toState == STATE_SHUTDOWN)))
{
XGI_INFO("[kd] I see, not is to exit from X\n");
// stop to received batch
}
else
{
XGI_ERROR("[kd] Should not happen\n");
}
if ((pStateInfo->_fromState == STATE_GRAPHIC)
&& (pStateInfo->_toState == STATE_CONSOLE)) {
XGI_INFO("[kd] I see, now is to leaveVT\n");
// stop to received batch
} else if ((pStateInfo->_fromState == STATE_CONSOLE)
&& (pStateInfo->_toState == STATE_GRAPHIC)) {
XGI_INFO("[kd] I see, now is to enterVT\n");
xgi_cmdlist_reset();
} else if ((pStateInfo->_fromState == STATE_GRAPHIC)
&& ((pStateInfo->_toState == STATE_LOGOUT)
|| (pStateInfo->_toState == STATE_REBOOT)
|| (pStateInfo->_toState == STATE_SHUTDOWN))) {
XGI_INFO("[kd] I see, not is to exit from X\n");
// stop to received batch
} else {
XGI_ERROR("[kd] Should not happen\n");
}
}
void xgi_cmdlist_reset(void)
{
s_cmdring._lastBatchStartAddr = 0;
s_cmdring._cmdRingOffset = 0;
s_cmdring._lastBatchStartAddr = 0;
s_cmdring._cmdRingOffset = 0;
}
void xgi_cmdlist_cleanup(xgi_info_t *info)
void xgi_cmdlist_cleanup(xgi_info_t * info)
{
if (s_cmdring._cmdRingBuffer != 0)
{
xgi_pcie_free(info, s_cmdring._cmdRingBusAddr);
s_cmdring._cmdRingBuffer = 0;
s_cmdring._cmdRingOffset = 0;
s_cmdring._cmdRingSize = 0;
}
if (s_cmdring._cmdRingBuffer != 0) {
xgi_pcie_free(info, s_cmdring._cmdRingBusAddr);
s_cmdring._cmdRingBuffer = 0;
s_cmdring._cmdRingOffset = 0;
s_cmdring._cmdRingSize = 0;
}
}
static void triggerHWCommandList(xgi_info_t *info, U32 triggerCounter)
static void triggerHWCommandList(xgi_info_t * info, U32 triggerCounter)
{
static U32 s_triggerID = 1;
static U32 s_triggerID = 1;
//Fix me, currently we just trigger one time
while (triggerCounter--)
{
dwWriteReg(BASE_3D_ENG + M2REG_PCI_TRIGGER_REGISTER_ADDRESS,
0x05000000 + (0xffff & s_triggerID++));
// xgi_waitfor_pci_idle(info);
}
//Fix me, currently we just trigger one time
while (triggerCounter--) {
dwWriteReg(BASE_3D_ENG + M2REG_PCI_TRIGGER_REGISTER_ADDRESS,
0x05000000 + (0xffff & s_triggerID++));
// xgi_waitfor_pci_idle(info);
}
}
static U32 getCurBatchBeginPort(xgi_cmd_info_t *pCmdInfo)
static U32 getCurBatchBeginPort(xgi_cmd_info_t * pCmdInfo)
{
// Convert the batch type to begin port ID
switch(pCmdInfo->_firstBeginType)
{
case BTYPE_2D:
return 0x30;
case BTYPE_3D:
return 0x40;
case BTYPE_FLIP:
return 0x50;
case BTYPE_CTRL:
return 0x20;
default:
//ASSERT(0);
// Convert the batch type to begin port ID
switch (pCmdInfo->_firstBeginType) {
case BTYPE_2D:
return 0x30;
case BTYPE_3D:
return 0x40;
case BTYPE_FLIP:
return 0x50;
case BTYPE_CTRL:
return 0x20;
default:
//ASSERT(0);
return 0xff;
}
}
}
static void addFlush2D(xgi_info_t *info)
static void addFlush2D(xgi_info_t * info)
{
U32 *flushBatchVirtAddr;
U32 flushBatchHWAddr;
U32 *flushBatchVirtAddr;
U32 flushBatchHWAddr;
U32 *lastBatchVirtAddr;
U32 *lastBatchVirtAddr;
/* check buf is large enough to contain a new flush batch */
if ((s_cmdring._cmdRingOffset + 0x20) >= s_cmdring._cmdRingSize)
{
s_cmdring._cmdRingOffset = 0;
}
/* check buf is large enough to contain a new flush batch */
if ((s_cmdring._cmdRingOffset + 0x20) >= s_cmdring._cmdRingSize) {
s_cmdring._cmdRingOffset = 0;
}
flushBatchHWAddr = s_cmdring._cmdRingBuffer + s_cmdring._cmdRingOffset;
flushBatchVirtAddr = (U32*) xgi_find_pcie_virt(info, flushBatchHWAddr);
flushBatchHWAddr = s_cmdring._cmdRingBuffer + s_cmdring._cmdRingOffset;
flushBatchVirtAddr = (U32 *) xgi_find_pcie_virt(info, flushBatchHWAddr);
/* not using memcpy for I assume the address is discrete */
*(flushBatchVirtAddr + 0) = 0x10000000;
*(flushBatchVirtAddr + 1) = 0x80000004; /* size = 0x04 dwords */
*(flushBatchVirtAddr + 2) = 0x00000000;
*(flushBatchVirtAddr + 3) = 0x00000000;
*(flushBatchVirtAddr + 4) = FLUSH_2D;
*(flushBatchVirtAddr + 5) = FLUSH_2D;
*(flushBatchVirtAddr + 6) = FLUSH_2D;
*(flushBatchVirtAddr + 7) = FLUSH_2D;
/* not using memcpy for I assume the address is discrete */
*(flushBatchVirtAddr + 0) = 0x10000000;
*(flushBatchVirtAddr + 1) = 0x80000004; /* size = 0x04 dwords */
*(flushBatchVirtAddr + 2) = 0x00000000;
*(flushBatchVirtAddr + 3) = 0x00000000;
*(flushBatchVirtAddr + 4) = FLUSH_2D;
*(flushBatchVirtAddr + 5) = FLUSH_2D;
*(flushBatchVirtAddr + 6) = FLUSH_2D;
*(flushBatchVirtAddr + 7) = FLUSH_2D;
// ASSERT(s_cmdring._lastBatchStartAddr != NULL);
lastBatchVirtAddr = (U32*) xgi_find_pcie_virt(info, s_cmdring._lastBatchStartAddr);
// ASSERT(s_cmdring._lastBatchStartAddr != NULL);
lastBatchVirtAddr =
(U32 *) xgi_find_pcie_virt(info, s_cmdring._lastBatchStartAddr);
lastBatchVirtAddr[1] = BEGIN_LINK_ENABLE_MASK + 0x08;
lastBatchVirtAddr[2] = flushBatchHWAddr >> 4;
lastBatchVirtAddr[3] = 0;
lastBatchVirtAddr[1] = BEGIN_LINK_ENABLE_MASK + 0x08;
lastBatchVirtAddr[2] = flushBatchHWAddr >> 4;
lastBatchVirtAddr[3] = 0;
//barrier();
//barrier();
// BTYPE_CTRL & NO debugID
lastBatchVirtAddr[0] = (0x20<<22) + (BEGIN_VALID_MASK);
// BTYPE_CTRL & NO debugID
lastBatchVirtAddr[0] = (0x20 << 22) + (BEGIN_VALID_MASK);
triggerHWCommandList(info, 1);
triggerHWCommandList(info, 1);
s_cmdring._cmdRingOffset += 0x20;
s_cmdring._lastBatchStartAddr = flushBatchHWAddr;
s_cmdring._cmdRingOffset += 0x20;
s_cmdring._lastBatchStartAddr = flushBatchHWAddr;
}

View File

@ -42,38 +42,35 @@
#define BEGIN_LINK_ENABLE_MASK (ONE_BIT_MASK<<31)
#define M2REG_PCI_TRIGGER_REGISTER_ADDRESS 0x14
typedef enum
{
FLUSH_2D = M2REG_FLUSH_2D_ENGINE_MASK,
FLUSH_3D = M2REG_FLUSH_3D_ENGINE_MASK,
FLUSH_FLIP = M2REG_FLUSH_FLIP_ENGINE_MASK
}FLUSH_CODE;
typedef enum {
FLUSH_2D = M2REG_FLUSH_2D_ENGINE_MASK,
FLUSH_3D = M2REG_FLUSH_3D_ENGINE_MASK,
FLUSH_FLIP = M2REG_FLUSH_FLIP_ENGINE_MASK
} FLUSH_CODE;
typedef enum
{
AGPCMDLIST_SCRATCH_SIZE = 0x100,
AGPCMDLIST_BEGIN_SIZE = 0x004,
AGPCMDLIST_3D_SCRATCH_CMD_SIZE = 0x004,
AGPCMDLIST_2D_SCRATCH_CMD_SIZE = 0x00c,
AGPCMDLIST_FLUSH_CMD_LEN = 0x004,
AGPCMDLIST_DUMY_END_BATCH_LEN = AGPCMDLIST_BEGIN_SIZE
}CMD_SIZE;
typedef enum {
AGPCMDLIST_SCRATCH_SIZE = 0x100,
AGPCMDLIST_BEGIN_SIZE = 0x004,
AGPCMDLIST_3D_SCRATCH_CMD_SIZE = 0x004,
AGPCMDLIST_2D_SCRATCH_CMD_SIZE = 0x00c,
AGPCMDLIST_FLUSH_CMD_LEN = 0x004,
AGPCMDLIST_DUMY_END_BATCH_LEN = AGPCMDLIST_BEGIN_SIZE
} CMD_SIZE;
typedef struct xgi_cmdring_info_s
{
U32 _cmdRingSize;
U32 _cmdRingBuffer;
U32 _cmdRingBusAddr;
U32 _lastBatchStartAddr;
U32 _cmdRingOffset;
}xgi_cmdring_info_t;
typedef struct xgi_cmdring_info_s {
U32 _cmdRingSize;
U32 _cmdRingBuffer;
U32 _cmdRingBusAddr;
U32 _lastBatchStartAddr;
U32 _cmdRingOffset;
} xgi_cmdring_info_t;
extern int xgi_cmdlist_initialize(xgi_info_t *info, U32 size);
extern int xgi_cmdlist_initialize(xgi_info_t * info, U32 size);
extern void xgi_submit_cmdlist(xgi_info_t *info, xgi_cmd_info_t * pCmdInfo);
extern void xgi_submit_cmdlist(xgi_info_t * info, xgi_cmd_info_t * pCmdInfo);
extern void xgi_state_change(xgi_info_t *info, xgi_state_info_t * pStateInfo);
extern void xgi_state_change(xgi_info_t * info, xgi_state_info_t * pStateInfo);
extern void xgi_cmdlist_cleanup(xgi_info_t *info);
extern void xgi_cmdlist_cleanup(xgi_info_t * info);
#endif /* _XGI_CMDLIST_H_ */
#endif /* _XGI_CMDLIST_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -94,167 +94,165 @@
#define XGI_CONTROL_DEVICE_NUMBER 100
typedef struct {
U32 base; // pcie base is different from fb base
U32 size;
U8 *vbase;
U32 base; // pcie base is different from fb base
U32 size;
U8 *vbase;
} xgi_aperture_t;
typedef struct xgi_screen_info_s {
U32 scrn_start;
U32 scrn_xres;
U32 scrn_yres;
U32 scrn_bpp;
U32 scrn_pitch;
U32 scrn_start;
U32 scrn_xres;
U32 scrn_yres;
U32 scrn_bpp;
U32 scrn_pitch;
} xgi_screen_info_t;
typedef struct xgi_sarea_info_s {
U32 bus_addr;
U32 size;
U32 bus_addr;
U32 size;
} xgi_sarea_info_t;
typedef struct xgi_info_s {
struct pci_dev *dev;
int flags;
int device_number;
int bus; /* PCI config info */
int slot;
int vendor_id;
U32 device_id;
U8 revision_id;
struct pci_dev *dev;
int flags;
int device_number;
int bus; /* PCI config info */
int slot;
int vendor_id;
U32 device_id;
U8 revision_id;
/* physical characteristics */
xgi_aperture_t mmio;
xgi_aperture_t fb;
xgi_aperture_t pcie;
xgi_screen_info_t scrn_info;
xgi_sarea_info_t sarea_info;
/* physical characteristics */
xgi_aperture_t mmio;
xgi_aperture_t fb;
xgi_aperture_t pcie;
xgi_screen_info_t scrn_info;
xgi_sarea_info_t sarea_info;
/* look up table parameters */
U32 *lut_base;
U32 lutPageSize;
U32 lutPageOrder;
U32 isLUTInLFB;
U32 sdfbPageSize;
/* look up table parameters */
U32 *lut_base;
U32 lutPageSize;
U32 lutPageOrder;
U32 isLUTInLFB;
U32 sdfbPageSize;
U32 pcie_config;
U32 pcie_status;
U32 irq;
U32 pcie_config;
U32 pcie_status;
U32 irq;
atomic_t use_count;
atomic_t use_count;
/* keep track of any pending bottom halfes */
struct tasklet_struct tasklet;
/* keep track of any pending bottom halfes */
struct tasklet_struct tasklet;
spinlock_t info_lock;
spinlock_t info_lock;
struct semaphore info_sem;
struct semaphore fb_sem;
struct semaphore pcie_sem;
struct semaphore info_sem;
struct semaphore fb_sem;
struct semaphore pcie_sem;
} xgi_info_t;
typedef struct xgi_ioctl_post_vbios {
U32 bus;
U32 slot;
U32 bus;
U32 slot;
} xgi_ioctl_post_vbios_t;
typedef enum xgi_mem_location_s
{
NON_LOCAL = 0,
LOCAL = 1,
INVALID = 0x7fffffff
typedef enum xgi_mem_location_s {
NON_LOCAL = 0,
LOCAL = 1,
INVALID = 0x7fffffff
} xgi_mem_location_t;
enum PcieOwner
{
PCIE_2D = 0,
/*
PCIE_3D should not begin with 1,
2D alloc pcie memory will use owner 1.
*/
PCIE_3D = 11,/*vetex buf*/
PCIE_3D_CMDLIST = 12,
PCIE_3D_SCRATCHPAD = 13,
PCIE_3D_TEXTURE = 14,
PCIE_INVALID = 0x7fffffff
enum PcieOwner {
PCIE_2D = 0,
/*
PCIE_3D should not begin with 1,
2D alloc pcie memory will use owner 1.
*/
PCIE_3D = 11, /*vetex buf */
PCIE_3D_CMDLIST = 12,
PCIE_3D_SCRATCHPAD = 13,
PCIE_3D_TEXTURE = 14,
PCIE_INVALID = 0x7fffffff
};
typedef struct xgi_mem_req_s {
xgi_mem_location_t location;
unsigned long size;
unsigned long is_front;
enum PcieOwner owner;
unsigned long pid;
xgi_mem_location_t location;
unsigned long size;
unsigned long is_front;
enum PcieOwner owner;
unsigned long pid;
} xgi_mem_req_t;
typedef struct xgi_mem_alloc_s {
xgi_mem_location_t location;
unsigned long size;
unsigned long bus_addr;
unsigned long hw_addr;
unsigned long pid;
xgi_mem_location_t location;
unsigned long size;
unsigned long bus_addr;
unsigned long hw_addr;
unsigned long pid;
} xgi_mem_alloc_t;
typedef struct xgi_chip_info_s {
U32 device_id;
char device_name[32];
U32 vendor_id;
U32 curr_display_mode; //Singe, DualView(Contained), MHS
U32 fb_size;
U32 sarea_bus_addr;
U32 sarea_size;
U32 device_id;
char device_name[32];
U32 vendor_id;
U32 curr_display_mode; //Singe, DualView(Contained), MHS
U32 fb_size;
U32 sarea_bus_addr;
U32 sarea_size;
} xgi_chip_info_t;
typedef struct xgi_opengl_cmd_s {
U32 cmd;
U32 cmd;
} xgi_opengl_cmd_t;
typedef struct xgi_mmio_info_s {
xgi_opengl_cmd_t cmd_head;
void *mmioBase;
int size;
xgi_opengl_cmd_t cmd_head;
void *mmioBase;
int size;
} xgi_mmio_info_t;
typedef enum {
BTYPE_2D = 0,
BTYPE_3D = 1,
BTYPE_FLIP = 2,
BTYPE_CTRL = 3,
BTYPE_NONE = 0x7fffffff
}BATCH_TYPE;
BTYPE_2D = 0,
BTYPE_3D = 1,
BTYPE_FLIP = 2,
BTYPE_CTRL = 3,
BTYPE_NONE = 0x7fffffff
} BATCH_TYPE;
typedef struct xgi_cmd_info_s {
BATCH_TYPE _firstBeginType;
U32 _firstBeginAddr;
U32 _firstSize;
U32 _curDebugID;
U32 _lastBeginAddr;
U32 _beginCount;
BATCH_TYPE _firstBeginType;
U32 _firstBeginAddr;
U32 _firstSize;
U32 _curDebugID;
U32 _lastBeginAddr;
U32 _beginCount;
} xgi_cmd_info_t;
typedef struct xgi_state_info_s {
U32 _fromState;
U32 _toState;
U32 _fromState;
U32 _toState;
} xgi_state_info_t;
typedef struct cpu_info_s {
U32 _eax;
U32 _ebx;
U32 _ecx;
U32 _edx;
U32 _eax;
U32 _ebx;
U32 _ecx;
U32 _edx;
} cpu_info_t;
typedef struct xgi_mem_pid_s {
struct list_head list;
xgi_mem_location_t location;
unsigned long bus_addr;
unsigned long pid;
struct list_head list;
xgi_mem_location_t location;
unsigned long bus_addr;
unsigned long pid;
} xgi_mem_pid_t;
/*
* Ioctl definitions
*/
#define XGI_IOCTL_MAGIC 'x' /* use 'x' as magic number */
#define XGI_IOCTL_MAGIC 'x' /* use 'x' as magic number */
#define XGI_IOCTL_BASE 0
#define XGI_ESC_DEVICE_INFO (XGI_IOCTL_BASE + 0)
@ -340,25 +338,27 @@ typedef struct xgi_mem_pid_s {
(((offset) >= (info)->pcie.base) \
&& (((offset) + (length)) <= (info)->pcie.base + (info)->pcie.size))
extern int xgi_fb_heap_init(xgi_info_t *info);
extern void xgi_fb_heap_cleanup(xgi_info_t *info);
extern int xgi_fb_heap_init(xgi_info_t * info);
extern void xgi_fb_heap_cleanup(xgi_info_t * info);
extern void xgi_fb_alloc(xgi_info_t *info, xgi_mem_req_t *req, xgi_mem_alloc_t *alloc);
extern void xgi_fb_free(xgi_info_t *info, unsigned long offset);
extern void xgi_mem_collect(xgi_info_t *info, unsigned int *pcnt);
extern void xgi_fb_alloc(xgi_info_t * info, xgi_mem_req_t * req,
xgi_mem_alloc_t * alloc);
extern void xgi_fb_free(xgi_info_t * info, unsigned long offset);
extern void xgi_mem_collect(xgi_info_t * info, unsigned int *pcnt);
extern int xgi_pcie_heap_init(xgi_info_t *info);
extern void xgi_pcie_heap_cleanup(xgi_info_t *info);
extern int xgi_pcie_heap_init(xgi_info_t * info);
extern void xgi_pcie_heap_cleanup(xgi_info_t * info);
extern void xgi_pcie_alloc(xgi_info_t *info, unsigned long size, enum PcieOwner owner, xgi_mem_alloc_t *alloc);
extern void xgi_pcie_free(xgi_info_t *info, unsigned long offset);
extern void xgi_pcie_alloc(xgi_info_t * info, unsigned long size,
enum PcieOwner owner, xgi_mem_alloc_t * alloc);
extern void xgi_pcie_free(xgi_info_t * info, unsigned long offset);
extern void xgi_pcie_heap_check(void);
extern void *xgi_find_pcie_block(xgi_info_t *info, unsigned long address);
extern void *xgi_find_pcie_virt(xgi_info_t *info, unsigned long address);
extern void *xgi_find_pcie_block(xgi_info_t * info, unsigned long address);
extern void *xgi_find_pcie_virt(xgi_info_t * info, unsigned long address);
extern void xgi_read_pcie_mem(xgi_info_t *info, xgi_mem_req_t *req);
extern void xgi_write_pcie_mem(xgi_info_t *info, xgi_mem_req_t *req);
extern void xgi_read_pcie_mem(xgi_info_t * info, xgi_mem_req_t * req);
extern void xgi_write_pcie_mem(xgi_info_t * info, xgi_mem_req_t * req);
extern void xgi_test_rwinkernel(xgi_info_t *info, unsigned long address);
extern void xgi_test_rwinkernel(xgi_info_t * info, unsigned long address);
#endif

View File

@ -33,496 +33,459 @@
#define XGI_FB_HEAP_START 0x1000000
static xgi_mem_heap_t *xgi_fb_heap;
static kmem_cache_t *xgi_fb_cache_block = NULL;
static xgi_mem_heap_t *xgi_fb_heap;
static kmem_cache_t *xgi_fb_cache_block = NULL;
extern struct list_head xgi_mempid_list;
static xgi_mem_block_t *xgi_mem_new_node(void);
static xgi_mem_block_t *xgi_mem_alloc(xgi_info_t *info, unsigned long size);
static xgi_mem_block_t *xgi_mem_free(xgi_info_t *info, unsigned long offset);
static xgi_mem_block_t *xgi_mem_alloc(xgi_info_t * info, unsigned long size);
static xgi_mem_block_t *xgi_mem_free(xgi_info_t * info, unsigned long offset);
void xgi_fb_alloc(xgi_info_t *info,
xgi_mem_req_t *req,
xgi_mem_alloc_t *alloc)
void xgi_fb_alloc(xgi_info_t * info,
xgi_mem_req_t * req, xgi_mem_alloc_t * alloc)
{
xgi_mem_block_t *block;
xgi_mem_pid_t *mempid_block;
xgi_mem_block_t *block;
xgi_mem_pid_t *mempid_block;
if (req->is_front)
{
alloc->location = LOCAL;
alloc->bus_addr = info->fb.base;
alloc->hw_addr = 0;
XGI_INFO("Video RAM allocation on front buffer successfully! \n");
}
else
{
xgi_down(info->fb_sem);
block = xgi_mem_alloc(info, req->size);
xgi_up(info->fb_sem);
if (req->is_front) {
alloc->location = LOCAL;
alloc->bus_addr = info->fb.base;
alloc->hw_addr = 0;
XGI_INFO
("Video RAM allocation on front buffer successfully! \n");
} else {
xgi_down(info->fb_sem);
block = xgi_mem_alloc(info, req->size);
xgi_up(info->fb_sem);
if (block == NULL)
{
alloc->location = LOCAL;
alloc->size = 0;
alloc->bus_addr = 0;
alloc->hw_addr = 0;
XGI_ERROR("Video RAM allocation failed\n");
}
else
{
XGI_INFO("Video RAM allocation succeeded: 0x%p\n",
(char *) block->offset);
alloc->location = LOCAL;
alloc->size = block->size;
alloc->bus_addr = info->fb.base + block->offset;
alloc->hw_addr = block->offset;
if (block == NULL) {
alloc->location = LOCAL;
alloc->size = 0;
alloc->bus_addr = 0;
alloc->hw_addr = 0;
XGI_ERROR("Video RAM allocation failed\n");
} else {
XGI_INFO("Video RAM allocation succeeded: 0x%p\n",
(char *)block->offset);
alloc->location = LOCAL;
alloc->size = block->size;
alloc->bus_addr = info->fb.base + block->offset;
alloc->hw_addr = block->offset;
/* manage mempid */
mempid_block = kmalloc(sizeof(xgi_mem_pid_t), GFP_KERNEL);
mempid_block->location = LOCAL;
mempid_block->bus_addr = alloc->bus_addr;
mempid_block->pid = alloc->pid;
/* manage mempid */
mempid_block =
kmalloc(sizeof(xgi_mem_pid_t), GFP_KERNEL);
mempid_block->location = LOCAL;
mempid_block->bus_addr = alloc->bus_addr;
mempid_block->pid = alloc->pid;
if (!mempid_block)
XGI_ERROR("mempid_block alloc failed\n");
if (!mempid_block)
XGI_ERROR("mempid_block alloc failed\n");
XGI_INFO("Memory ProcessID add one fb block pid:%ld successfully! \n", mempid_block->pid);
list_add(&mempid_block->list, &xgi_mempid_list);
}
}
XGI_INFO
("Memory ProcessID add one fb block pid:%ld successfully! \n",
mempid_block->pid);
list_add(&mempid_block->list, &xgi_mempid_list);
}
}
}
void xgi_fb_free(xgi_info_t *info, unsigned long bus_addr)
void xgi_fb_free(xgi_info_t * info, unsigned long bus_addr)
{
xgi_mem_block_t *block;
unsigned long offset = bus_addr - info->fb.base;
xgi_mem_pid_t *mempid_block;
xgi_mem_pid_t *mempid_freeblock = NULL;
struct list_head *mempid_list;
xgi_mem_block_t *block;
unsigned long offset = bus_addr - info->fb.base;
xgi_mem_pid_t *mempid_block;
xgi_mem_pid_t *mempid_freeblock = NULL;
struct list_head *mempid_list;
if (offset < 0)
{
XGI_INFO("free onscreen frame buffer successfully !\n");
}
else
{
xgi_down(info->fb_sem);
block = xgi_mem_free(info, offset);
xgi_up(info->fb_sem);
if (offset < 0) {
XGI_INFO("free onscreen frame buffer successfully !\n");
} else {
xgi_down(info->fb_sem);
block = xgi_mem_free(info, offset);
xgi_up(info->fb_sem);
if (block == NULL)
{
XGI_ERROR("xgi_mem_free() failed at base 0x%lx\n", offset);
}
if (block == NULL) {
XGI_ERROR("xgi_mem_free() failed at base 0x%lx\n",
offset);
}
/* manage mempid */
mempid_list = xgi_mempid_list.next;
while (mempid_list != &xgi_mempid_list)
{
mempid_block = list_entry(mempid_list, struct xgi_mem_pid_s, list);
if (mempid_block->location == LOCAL && mempid_block->bus_addr == bus_addr)
{
mempid_freeblock = mempid_block;
break;
}
mempid_list = mempid_list->next;
}
if (mempid_freeblock)
{
list_del(&mempid_freeblock->list);
XGI_INFO("Memory ProcessID delete one fb block pid:%ld successfully! \n", mempid_freeblock->pid);
kfree(mempid_freeblock);
}
}
/* manage mempid */
mempid_list = xgi_mempid_list.next;
while (mempid_list != &xgi_mempid_list) {
mempid_block =
list_entry(mempid_list, struct xgi_mem_pid_s, list);
if (mempid_block->location == LOCAL
&& mempid_block->bus_addr == bus_addr) {
mempid_freeblock = mempid_block;
break;
}
mempid_list = mempid_list->next;
}
if (mempid_freeblock) {
list_del(&mempid_freeblock->list);
XGI_INFO
("Memory ProcessID delete one fb block pid:%ld successfully! \n",
mempid_freeblock->pid);
kfree(mempid_freeblock);
}
}
}
int xgi_fb_heap_init(xgi_info_t *info)
int xgi_fb_heap_init(xgi_info_t * info)
{
xgi_mem_block_t *block;
xgi_mem_block_t *block;
xgi_fb_heap = kmalloc(sizeof(xgi_mem_heap_t), GFP_KERNEL);
if (!xgi_fb_heap)
{
XGI_ERROR("xgi_fb_heap alloc failed\n");
return 0;
}
xgi_fb_heap = kmalloc(sizeof(xgi_mem_heap_t), GFP_KERNEL);
if (!xgi_fb_heap) {
XGI_ERROR("xgi_fb_heap alloc failed\n");
return 0;
}
INIT_LIST_HEAD(&xgi_fb_heap->free_list);
INIT_LIST_HEAD(&xgi_fb_heap->used_list);
INIT_LIST_HEAD(&xgi_fb_heap->sort_list);
INIT_LIST_HEAD(&xgi_fb_heap->free_list);
INIT_LIST_HEAD(&xgi_fb_heap->used_list);
INIT_LIST_HEAD(&xgi_fb_heap->sort_list);
xgi_fb_cache_block = kmem_cache_create("xgi_fb_block", sizeof(xgi_mem_block_t),
0, SLAB_HWCACHE_ALIGN, NULL, NULL);
xgi_fb_cache_block =
kmem_cache_create("xgi_fb_block", sizeof(xgi_mem_block_t), 0,
SLAB_HWCACHE_ALIGN, NULL, NULL);
if (NULL == xgi_fb_cache_block)
{
XGI_ERROR("Fail to creat xgi_fb_block\n");
goto fail1;
}
if (NULL == xgi_fb_cache_block) {
XGI_ERROR("Fail to creat xgi_fb_block\n");
goto fail1;
}
block = (xgi_mem_block_t *)kmem_cache_alloc(xgi_fb_cache_block, GFP_KERNEL);
if (!block)
{
XGI_ERROR("kmem_cache_alloc failed\n");
goto fail2;
}
block =
(xgi_mem_block_t *) kmem_cache_alloc(xgi_fb_cache_block,
GFP_KERNEL);
if (!block) {
XGI_ERROR("kmem_cache_alloc failed\n");
goto fail2;
}
block->offset = XGI_FB_HEAP_START;
block->size = info->fb.size - XGI_FB_HEAP_START;
block->offset = XGI_FB_HEAP_START;
block->size = info->fb.size - XGI_FB_HEAP_START;
list_add(&block->list, &xgi_fb_heap->free_list);
list_add(&block->list, &xgi_fb_heap->free_list);
xgi_fb_heap->max_freesize = info->fb.size - XGI_FB_HEAP_START;
xgi_fb_heap->max_freesize = info->fb.size - XGI_FB_HEAP_START;
XGI_INFO("fb start offset: 0x%lx, memory size : 0x%lx\n", block->offset, block->size);
XGI_INFO("xgi_fb_heap->max_freesize: 0x%lx \n", xgi_fb_heap->max_freesize);
XGI_INFO("fb start offset: 0x%lx, memory size : 0x%lx\n", block->offset,
block->size);
XGI_INFO("xgi_fb_heap->max_freesize: 0x%lx \n",
xgi_fb_heap->max_freesize);
return 1;
return 1;
fail2:
if (xgi_fb_cache_block)
{
kmem_cache_destroy(xgi_fb_cache_block);
xgi_fb_cache_block = NULL;
}
fail1:
if(xgi_fb_heap)
{
kfree(xgi_fb_heap);
xgi_fb_heap = NULL;
}
return 0;
fail2:
if (xgi_fb_cache_block) {
kmem_cache_destroy(xgi_fb_cache_block);
xgi_fb_cache_block = NULL;
}
fail1:
if (xgi_fb_heap) {
kfree(xgi_fb_heap);
xgi_fb_heap = NULL;
}
return 0;
}
void xgi_fb_heap_cleanup(xgi_info_t *info)
void xgi_fb_heap_cleanup(xgi_info_t * info)
{
struct list_head *free_list, *temp;
xgi_mem_block_t *block;
int i;
struct list_head *free_list, *temp;
xgi_mem_block_t *block;
int i;
if (xgi_fb_heap)
{
free_list = &xgi_fb_heap->free_list;
for (i = 0; i < 3; i++, free_list++)
{
temp = free_list->next;
while (temp != free_list)
{
block = list_entry(temp, struct xgi_mem_block_s, list);
temp = temp->next;
if (xgi_fb_heap) {
free_list = &xgi_fb_heap->free_list;
for (i = 0; i < 3; i++, free_list++) {
temp = free_list->next;
while (temp != free_list) {
block =
list_entry(temp, struct xgi_mem_block_s,
list);
temp = temp->next;
XGI_INFO("No. %d block->offset: 0x%lx block->size: 0x%lx \n",
i, block->offset, block->size);
//XGI_INFO("No. %d free block: 0x%p \n", i, block);
kmem_cache_free(xgi_fb_cache_block, block);
block = NULL;
}
}
XGI_INFO("xgi_fb_heap: 0x%p \n", xgi_fb_heap);
kfree(xgi_fb_heap);
xgi_fb_heap = NULL;
}
XGI_INFO
("No. %d block->offset: 0x%lx block->size: 0x%lx \n",
i, block->offset, block->size);
//XGI_INFO("No. %d free block: 0x%p \n", i, block);
kmem_cache_free(xgi_fb_cache_block, block);
block = NULL;
}
}
XGI_INFO("xgi_fb_heap: 0x%p \n", xgi_fb_heap);
kfree(xgi_fb_heap);
xgi_fb_heap = NULL;
}
if (xgi_fb_cache_block)
{
kmem_cache_destroy(xgi_fb_cache_block);
xgi_fb_cache_block = NULL;
}
if (xgi_fb_cache_block) {
kmem_cache_destroy(xgi_fb_cache_block);
xgi_fb_cache_block = NULL;
}
}
static xgi_mem_block_t * xgi_mem_new_node(void)
static xgi_mem_block_t *xgi_mem_new_node(void)
{
xgi_mem_block_t *block;
xgi_mem_block_t *block;
block = (xgi_mem_block_t *)kmem_cache_alloc(xgi_fb_cache_block, GFP_KERNEL);
if (!block)
{
XGI_ERROR("kmem_cache_alloc failed\n");
return NULL;
}
block =
(xgi_mem_block_t *) kmem_cache_alloc(xgi_fb_cache_block,
GFP_KERNEL);
if (!block) {
XGI_ERROR("kmem_cache_alloc failed\n");
return NULL;
}
return block;
return block;
}
#if 0
static void xgi_mem_insert_node_after(xgi_mem_list_t *list,
xgi_mem_block_t *current,
xgi_mem_block_t *block);
static void xgi_mem_insert_node_before(xgi_mem_list_t *list,
xgi_mem_block_t *current,
xgi_mem_block_t *block);
static void xgi_mem_insert_node_head(xgi_mem_list_t *list,
xgi_mem_block_t *block);
static void xgi_mem_insert_node_tail(xgi_mem_list_t *list,
xgi_mem_block_t *block);
static void xgi_mem_delete_node(xgi_mem_list_t *list,
xgi_mem_block_t *block);
static void xgi_mem_insert_node_after(xgi_mem_list_t * list,
xgi_mem_block_t * current,
xgi_mem_block_t * block);
static void xgi_mem_insert_node_before(xgi_mem_list_t * list,
xgi_mem_block_t * current,
xgi_mem_block_t * block);
static void xgi_mem_insert_node_head(xgi_mem_list_t * list,
xgi_mem_block_t * block);
static void xgi_mem_insert_node_tail(xgi_mem_list_t * list,
xgi_mem_block_t * block);
static void xgi_mem_delete_node(xgi_mem_list_t * list, xgi_mem_block_t * block);
/*
* insert node:block after node:current
*/
static void xgi_mem_insert_node_after(xgi_mem_list_t *list,
xgi_mem_block_t *current,
xgi_mem_block_t *block)
static void xgi_mem_insert_node_after(xgi_mem_list_t * list,
xgi_mem_block_t * current,
xgi_mem_block_t * block)
{
block->prev = current;
block->next = current->next;
current->next = block;
block->prev = current;
block->next = current->next;
current->next = block;
if (current == list->tail)
{
list->tail = block;
}
else
{
block->next->prev = block;
}
if (current == list->tail) {
list->tail = block;
} else {
block->next->prev = block;
}
}
/*
* insert node:block before node:current
*/
static void xgi_mem_insert_node_before(xgi_mem_list_t *list,
xgi_mem_block_t *current,
xgi_mem_block_t *block)
static void xgi_mem_insert_node_before(xgi_mem_list_t * list,
xgi_mem_block_t * current,
xgi_mem_block_t * block)
{
block->prev = current->prev;
block->next = current;
current->prev = block;
if (current == list->head)
{
list->head = block;
}
else
{
block->prev->next = block;
}
block->prev = current->prev;
block->next = current;
current->prev = block;
if (current == list->head) {
list->head = block;
} else {
block->prev->next = block;
}
}
void xgi_mem_insert_node_head(xgi_mem_list_t *list,
xgi_mem_block_t *block)
void xgi_mem_insert_node_head(xgi_mem_list_t * list, xgi_mem_block_t * block)
{
block->next = list->head;
block->prev = NULL;
block->next = list->head;
block->prev = NULL;
if (NULL == list->head)
{
list->tail = block;
}
else
{
list->head->prev = block;
}
list->head = block;
if (NULL == list->head) {
list->tail = block;
} else {
list->head->prev = block;
}
list->head = block;
}
static void xgi_mem_insert_node_tail(xgi_mem_list_t *list,
xgi_mem_block_t *block)
static void xgi_mem_insert_node_tail(xgi_mem_list_t * list,
xgi_mem_block_t * block)
{
block->next = NULL;
block->prev = list->tail;
if (NULL == list->tail)
{
list->head = block;
}
else
{
list->tail->next = block;
}
list->tail = block;
block->next = NULL;
block->prev = list->tail;
if (NULL == list->tail) {
list->head = block;
} else {
list->tail->next = block;
}
list->tail = block;
}
static void xgi_mem_delete_node(xgi_mem_list_t *list,
xgi_mem_block_t *block)
static void xgi_mem_delete_node(xgi_mem_list_t * list, xgi_mem_block_t * block)
{
if (block == list->head)
{
list->head = block->next;
}
if (block == list->tail)
{
list->tail = block->prev;
}
if (block == list->head) {
list->head = block->next;
}
if (block == list->tail) {
list->tail = block->prev;
}
if (block->prev)
{
block->prev->next = block->next;
}
if (block->next)
{
block->next->prev = block->prev;
}
if (block->prev) {
block->prev->next = block->next;
}
if (block->next) {
block->next->prev = block->prev;
}
block->next = block->prev = NULL;
block->next = block->prev = NULL;
}
#endif
static xgi_mem_block_t *xgi_mem_alloc(xgi_info_t *info, unsigned long originalSize)
static xgi_mem_block_t *xgi_mem_alloc(xgi_info_t * info,
unsigned long originalSize)
{
struct list_head *free_list;
xgi_mem_block_t *block, *free_block, *used_block;
struct list_head *free_list;
xgi_mem_block_t *block, *free_block, *used_block;
unsigned long size = (originalSize + PAGE_SIZE - 1) & PAGE_MASK;
unsigned long size = (originalSize + PAGE_SIZE - 1) & PAGE_MASK;
XGI_INFO("Original 0x%lx bytes requested, really 0x%lx allocated\n", originalSize, size);
XGI_INFO("Original 0x%lx bytes requested, really 0x%lx allocated\n",
originalSize, size);
if (size == 0)
{
XGI_ERROR("size == 0\n");
return (NULL);
}
XGI_INFO("max_freesize: 0x%lx \n", xgi_fb_heap->max_freesize);
if (size > xgi_fb_heap->max_freesize)
{
XGI_ERROR("size: 0x%lx is bigger than frame buffer total free size: 0x%lx !\n",
size, xgi_fb_heap->max_freesize);
return (NULL);
}
if (size == 0) {
XGI_ERROR("size == 0\n");
return (NULL);
}
XGI_INFO("max_freesize: 0x%lx \n", xgi_fb_heap->max_freesize);
if (size > xgi_fb_heap->max_freesize) {
XGI_ERROR
("size: 0x%lx is bigger than frame buffer total free size: 0x%lx !\n",
size, xgi_fb_heap->max_freesize);
return (NULL);
}
free_list = xgi_fb_heap->free_list.next;
free_list = xgi_fb_heap->free_list.next;
while (free_list != &xgi_fb_heap->free_list)
{
XGI_INFO("free_list: 0x%px \n", free_list);
block = list_entry(free_list, struct xgi_mem_block_s, list);
if (size <= block->size)
{
break;
}
free_list = free_list->next;
}
while (free_list != &xgi_fb_heap->free_list) {
XGI_INFO("free_list: 0x%px \n", free_list);
block = list_entry(free_list, struct xgi_mem_block_s, list);
if (size <= block->size) {
break;
}
free_list = free_list->next;
}
if (free_list == &xgi_fb_heap->free_list)
{
XGI_ERROR("Can't allocate %ldk size from frame buffer memory !\n", size/1024);
return (NULL);
}
if (free_list == &xgi_fb_heap->free_list) {
XGI_ERROR
("Can't allocate %ldk size from frame buffer memory !\n",
size / 1024);
return (NULL);
}
free_block = block;
XGI_INFO("alloc size: 0x%lx from offset: 0x%lx size: 0x%lx \n",
size, free_block->offset, free_block->size);
free_block = block;
XGI_INFO("alloc size: 0x%lx from offset: 0x%lx size: 0x%lx \n",
size, free_block->offset, free_block->size);
if (size == free_block->size)
{
used_block = free_block;
XGI_INFO("size == free_block->size: free_block = 0x%p\n", free_block);
list_del(&free_block->list);
}
else
{
used_block = xgi_mem_new_node();
if (size == free_block->size) {
used_block = free_block;
XGI_INFO("size == free_block->size: free_block = 0x%p\n",
free_block);
list_del(&free_block->list);
} else {
used_block = xgi_mem_new_node();
if (used_block == NULL) return (NULL);
if (used_block == NULL)
return (NULL);
if (used_block == free_block)
{
XGI_ERROR("used_block == free_block = 0x%p\n", used_block);
}
if (used_block == free_block) {
XGI_ERROR("used_block == free_block = 0x%p\n",
used_block);
}
used_block->offset = free_block->offset;
used_block->size = size;
used_block->offset = free_block->offset;
used_block->size = size;
free_block->offset += size;
free_block->size -= size;
}
free_block->offset += size;
free_block->size -= size;
}
xgi_fb_heap->max_freesize -= size;
xgi_fb_heap->max_freesize -= size;
list_add(&used_block->list, &xgi_fb_heap->used_list);
list_add(&used_block->list, &xgi_fb_heap->used_list);
return (used_block);
return (used_block);
}
static xgi_mem_block_t *xgi_mem_free(xgi_info_t *info, unsigned long offset)
static xgi_mem_block_t *xgi_mem_free(xgi_info_t * info, unsigned long offset)
{
struct list_head *free_list, *used_list;
xgi_mem_block_t *used_block = NULL, *block = NULL;
xgi_mem_block_t *prev, *next;
struct list_head *free_list, *used_list;
xgi_mem_block_t *used_block = NULL, *block = NULL;
xgi_mem_block_t *prev, *next;
unsigned long upper;
unsigned long lower;
unsigned long upper;
unsigned long lower;
used_list = xgi_fb_heap->used_list.next;
while (used_list != &xgi_fb_heap->used_list)
{
block = list_entry(used_list, struct xgi_mem_block_s, list);
if (block->offset == offset)
{
break;
}
used_list = used_list->next;
}
used_list = xgi_fb_heap->used_list.next;
while (used_list != &xgi_fb_heap->used_list) {
block = list_entry(used_list, struct xgi_mem_block_s, list);
if (block->offset == offset) {
break;
}
used_list = used_list->next;
}
if (used_list == &xgi_fb_heap->used_list)
{
XGI_ERROR("can't find block: 0x%lx to free!\n", offset);
return (NULL);
}
if (used_list == &xgi_fb_heap->used_list) {
XGI_ERROR("can't find block: 0x%lx to free!\n", offset);
return (NULL);
}
used_block = block;
XGI_INFO("used_block: 0x%p, offset = 0x%lx, size = 0x%lx\n",
used_block, used_block->offset, used_block->size);
used_block = block;
XGI_INFO("used_block: 0x%p, offset = 0x%lx, size = 0x%lx\n",
used_block, used_block->offset, used_block->size);
xgi_fb_heap->max_freesize += used_block->size;
xgi_fb_heap->max_freesize += used_block->size;
prev = next = NULL;
upper = used_block->offset + used_block->size;
lower = used_block->offset;
prev = next = NULL;
upper = used_block->offset + used_block->size;
lower = used_block->offset;
free_list = xgi_fb_heap->free_list.next;
while (free_list != &xgi_fb_heap->free_list)
{
block = list_entry(free_list, struct xgi_mem_block_s, list);
free_list = xgi_fb_heap->free_list.next;
while (free_list != &xgi_fb_heap->free_list) {
block = list_entry(free_list, struct xgi_mem_block_s, list);
if (block->offset == upper)
{
next = block;
}
else if ((block->offset + block->size) == lower)
{
prev = block;
}
free_list = free_list->next;
}
if (block->offset == upper) {
next = block;
} else if ((block->offset + block->size) == lower) {
prev = block;
}
free_list = free_list->next;
}
XGI_INFO("next = 0x%p, prev = 0x%p\n", next, prev);
list_del(&used_block->list);
XGI_INFO("next = 0x%p, prev = 0x%p\n", next, prev);
list_del(&used_block->list);
if (prev && next)
{
prev->size += (used_block->size + next->size);
list_del(&next->list);
XGI_INFO("free node 0x%p\n", next);
kmem_cache_free(xgi_fb_cache_block, next);
kmem_cache_free(xgi_fb_cache_block, used_block);
if (prev && next) {
prev->size += (used_block->size + next->size);
list_del(&next->list);
XGI_INFO("free node 0x%p\n", next);
kmem_cache_free(xgi_fb_cache_block, next);
kmem_cache_free(xgi_fb_cache_block, used_block);
next = NULL;
used_block = NULL;
return (prev);
}
next = NULL;
used_block = NULL;
return (prev);
}
if (prev)
{
prev->size += used_block->size;
XGI_INFO("free node 0x%p\n", used_block);
kmem_cache_free(xgi_fb_cache_block, used_block);
used_block = NULL;
return (prev);
}
if (prev) {
prev->size += used_block->size;
XGI_INFO("free node 0x%p\n", used_block);
kmem_cache_free(xgi_fb_cache_block, used_block);
used_block = NULL;
return (prev);
}
if (next)
{
next->size += used_block->size;
next->offset = used_block->offset;
XGI_INFO("free node 0x%p\n", used_block);
kmem_cache_free(xgi_fb_cache_block, used_block);
used_block = NULL;
return (next);
}
if (next) {
next->size += used_block->size;
next->offset = used_block->offset;
XGI_INFO("free node 0x%p\n", used_block);
kmem_cache_free(xgi_fb_cache_block, used_block);
used_block = NULL;
return (next);
}
list_add(&used_block->list, &xgi_fb_heap->free_list);
XGI_INFO("Recycled free node %p, offset = 0x%lx, size = 0x%lx\n",
used_block, used_block->offset, used_block->size);
list_add(&used_block->list, &xgi_fb_heap->free_list);
XGI_INFO("Recycled free node %p, offset = 0x%lx, size = 0x%lx\n",
used_block, used_block->offset, used_block->size);
return (used_block);
return (used_block);
}

View File

@ -30,42 +30,41 @@
#define _XGI_FB_H_
typedef struct xgi_mem_block_s {
struct list_head list;
unsigned long offset;
unsigned long size;
atomic_t use_count;
struct list_head list;
unsigned long offset;
unsigned long size;
atomic_t use_count;
} xgi_mem_block_t;
typedef struct xgi_mem_heap_s {
struct list_head free_list;
struct list_head used_list;
struct list_head sort_list;
unsigned long max_freesize;
spinlock_t lock;
struct list_head free_list;
struct list_head used_list;
struct list_head sort_list;
unsigned long max_freesize;
spinlock_t lock;
} xgi_mem_heap_t;
#if 0
typedef struct xgi_mem_block_s {
struct xgi_mem_block_s *next;
struct xgi_mem_block_s *prev;
unsigned long offset;
unsigned long size;
atomic_t use_count;
struct xgi_mem_block_s *next;
struct xgi_mem_block_s *prev;
unsigned long offset;
unsigned long size;
atomic_t use_count;
} xgi_mem_block_t;
typedef struct xgi_mem_list_s {
xgi_mem_block_t *head;
xgi_mem_block_t *tail;
xgi_mem_block_t *head;
xgi_mem_block_t *tail;
} xgi_mem_list_t;
typedef struct xgi_mem_heap_s {
xgi_mem_list_t *free_list;
xgi_mem_list_t *used_list;
xgi_mem_list_t *sort_list;
unsigned long max_freesize;
spinlock_t lock;
xgi_mem_list_t *free_list;
xgi_mem_list_t *used_list;
xgi_mem_list_t *sort_list;
unsigned long max_freesize;
spinlock_t lock;
} xgi_mem_heap_t;
#endif
#endif

View File

@ -26,7 +26,6 @@
* DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _XGI_LINUX_H_
#define _XGI_LINUX_H_
@ -36,7 +35,7 @@
#include <linux/version.h>
#endif
#ifndef KERNEL_VERSION /* pre-2.1.90 didn't have it */
#ifndef KERNEL_VERSION /* pre-2.1.90 didn't have it */
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#endif
@ -64,25 +63,25 @@
#include <linux/modversions.h>
#endif
#include <linux/kernel.h> /* printk */
#include <linux/kernel.h> /* printk */
#include <linux/module.h>
#include <linux/init.h> /* module_init, module_exit */
#include <linux/types.h> /* pic_t, size_t, __u32, etc */
#include <linux/errno.h> /* error codes */
#include <linux/list.h> /* circular linked list */
#include <linux/stddef.h> /* NULL, offsetof */
#include <linux/wait.h> /* wait queues */
#include <linux/init.h> /* module_init, module_exit */
#include <linux/types.h> /* pic_t, size_t, __u32, etc */
#include <linux/errno.h> /* error codes */
#include <linux/list.h> /* circular linked list */
#include <linux/stddef.h> /* NULL, offsetof */
#include <linux/wait.h> /* wait queues */
#include <linux/slab.h> /* kmalloc, kfree, etc */
#include <linux/vmalloc.h> /* vmalloc, vfree, etc */
#include <linux/slab.h> /* kmalloc, kfree, etc */
#include <linux/vmalloc.h> /* vmalloc, vfree, etc */
#include <linux/poll.h> /* poll_wait */
#include <linux/delay.h> /* mdelay, udelay */
#include <asm/msr.h> /* rdtsc rdtscl */
#include <linux/poll.h> /* poll_wait */
#include <linux/delay.h> /* mdelay, udelay */
#include <asm/msr.h> /* rdtsc rdtscl */
#include <linux/sched.h> /* suser(), capable() replacement
for_each_task, for_each_process */
#include <linux/sched.h> /* suser(), capable() replacement
for_each_task, for_each_process */
#ifdef for_each_process
#define XGI_SCAN_PROCESS(p) for_each_process(p)
#else
@ -90,21 +89,21 @@
#endif
#ifdef KERNEL_2_6
#include <linux/moduleparam.h> /* module_param() */
#include <linux/smp_lock.h> /* kernel_locked */
#include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */
#include <asm/kmap_types.h> /* page table entry lookup */
#include <linux/moduleparam.h> /* module_param() */
#include <linux/smp_lock.h> /* kernel_locked */
#include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */
#include <asm/kmap_types.h> /* page table entry lookup */
#endif
#include <linux/pci.h> /* pci_find_class, etc */
#include <linux/interrupt.h> /* tasklets, interrupt helpers */
#include <linux/pci.h> /* pci_find_class, etc */
#include <linux/interrupt.h> /* tasklets, interrupt helpers */
#include <linux/timer.h>
#include <asm/system.h> /* cli, sli, save_flags */
#include <asm/io.h> /* ioremap, virt_to_phys */
#include <asm/uaccess.h> /* access_ok */
#include <asm/page.h> /* PAGE_OFFSET */
#include <asm/pgtable.h> /* pte bit definitions */
#include <asm/system.h> /* cli, sli, save_flags */
#include <asm/io.h> /* ioremap, virt_to_phys */
#include <asm/uaccess.h> /* access_ok */
#include <asm/page.h> /* PAGE_OFFSET */
#include <asm/pgtable.h> /* pte bit definitions */
#include <linux/spinlock.h>
#include <asm/semaphore.h>
@ -264,10 +263,9 @@ EXPORT_NO_SYMBOLS;
#define XGI_PM_SUPPORT_APM
#endif
#if defined(CONFIG_DEVFS_FS)
#if defined(KERNEL_2_6)
typedef void* devfs_handle_t;
typedef void *devfs_handle_t;
#define XGI_DEVFS_REGISTER(_name, _minor) \
({ \
devfs_handle_t __handle = NULL; \
@ -283,7 +281,7 @@ typedef void* devfs_handle_t;
*/
#define XGI_DEVFS_REMOVE_CONTROL() devfs_remove("xgi_ctl")
#define XGI_DEVFS_REMOVE_DEVICE(i) devfs_remove("xgi")
#else // defined(KERNEL_2_4)
#else // defined(KERNEL_2_4)
#define XGI_DEVFS_REGISTER(_name, _minor) \
({ \
devfs_handle_t __handle = devfs_register(NULL, _name, DEVFS_FL_AUTO_DEVNUM, \
@ -306,8 +304,8 @@ typedef void* devfs_handle_t;
devfs_unregister(xgi_devfs_handles[0]); \
} \
})
#endif /* defined(KERNEL_2_4) */
#endif /* defined(CONFIG_DEVFS_FS) */
#endif /* defined(KERNEL_2_4) */
#endif /* defined(CONFIG_DEVFS_FS) */
#if defined(CONFIG_DEVFS_FS) && !defined(KERNEL_2_6)
#define XGI_REGISTER_CHRDEV(x...) devfs_register_chrdev(x)
@ -409,12 +407,12 @@ typedef void* devfs_handle_t;
#if !defined (pgprot_noncached)
static inline pgprot_t pgprot_noncached(pgprot_t old_prot)
{
pgprot_t new_prot = old_prot;
if (boot_cpu_data.x86 > 3)
new_prot = __pgprot(pgprot_val(old_prot) | _PAGE_PCD);
return new_prot;
}
{
pgprot_t new_prot = old_prot;
if (boot_cpu_data.x86 > 3)
new_prot = __pgprot(pgprot_val(old_prot) | _PAGE_PCD);
return new_prot;
}
#endif
#if defined(XGI_BUILD_XGI_PAT_SUPPORT) && !defined (pgprot_writecombined)
@ -425,15 +423,14 @@ static inline pgprot_t pgprot_noncached(pgprot_t old_prot)
#define PAGE_KERNEL_WRTCOMB MAKE_GLOBAL(__PAGE_KERNEL_WRTCOMB)
static inline pgprot_t pgprot_writecombined(pgprot_t old_prot)
{
pgprot_t new_prot = old_prot;
if (boot_cpu_data.x86 > 3)
{
pgprot_val(old_prot) &= ~(_PAGE_PCD | _PAGE_PWT);
new_prot = __pgprot(pgprot_val(old_prot) | _PAGE_WRTCOMB);
}
return new_prot;
}
{
pgprot_t new_prot = old_prot;
if (boot_cpu_data.x86 > 3) {
pgprot_val(old_prot) &= ~(_PAGE_PCD | _PAGE_PWT);
new_prot = __pgprot(pgprot_val(old_prot) | _PAGE_WRTCOMB);
}
return new_prot;
}
#endif
#if !defined(page_to_pfn)
@ -494,9 +491,9 @@ static inline pgprot_t pgprot_writecombined(pgprot_t old_prot)
free_pages(ptr, order); \
}
typedef struct xgi_pte_s {
unsigned long phys_addr;
unsigned long virt_addr;
typedef struct xgi_pte_s {
unsigned long phys_addr;
unsigned long virt_addr;
} xgi_pte_t;
/*
@ -507,16 +504,16 @@ typedef struct xgi_pte_s {
* page_attr API provides the means to solve the problem.
*/
#if defined(XGI_CHANGE_PAGE_ATTR_PRESENT)
static inline void XGI_SET_PAGE_ATTRIB_UNCACHED(xgi_pte_t *page_ptr)
{
struct page *page = virt_to_page(__va(page_ptr->phys_addr));
change_page_attr(page, 1, PAGE_KERNEL_NOCACHE);
}
static inline void XGI_SET_PAGE_ATTRIB_CACHED(xgi_pte_t *page_ptr)
{
struct page *page = virt_to_page(__va(page_ptr->phys_addr));
change_page_attr(page, 1, PAGE_KERNEL);
}
static inline void XGI_SET_PAGE_ATTRIB_UNCACHED(xgi_pte_t * page_ptr)
{
struct page *page = virt_to_page(__va(page_ptr->phys_addr));
change_page_attr(page, 1, PAGE_KERNEL_NOCACHE);
}
static inline void XGI_SET_PAGE_ATTRIB_CACHED(xgi_pte_t * page_ptr)
{
struct page *page = virt_to_page(__va(page_ptr->phys_addr));
change_page_attr(page, 1, PAGE_KERNEL);
}
#else
#define XGI_SET_PAGE_ATTRIB_UNCACHED(page_list)
#define XGI_SET_PAGE_ATTRIB_CACHED(page_list)
@ -549,17 +546,15 @@ static inline void XGI_SET_PAGE_ATTRIB_CACHED(xgi_pte_t *page_ptr)
#define XGIUnlockPage(page) ClearPageLocked(page)
#endif
/*
* hide a pointer to struct xgi_info_t in a file-private info
*/
typedef struct
{
void *info;
U32 num_events;
spinlock_t fp_lock;
wait_queue_head_t wait_queue;
typedef struct {
void *info;
U32 num_events;
spinlock_t fp_lock;
wait_queue_head_t wait_queue;
} xgi_file_private_t;
#define FILE_PRIVATE(filp) ((filp)->private_data)

File diff suppressed because it is too large Load Diff

View File

@ -26,24 +26,22 @@
* DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _XGI_MISC_H_
#define _XGI_MISC_H_
extern void xgi_dump_register(xgi_info_t *info);
extern void xgi_get_device_info(xgi_info_t *info, xgi_chip_info_t * req);
extern void xgi_get_mmio_info(xgi_info_t *info, xgi_mmio_info_t *req);
extern void xgi_get_screen_info(xgi_info_t *info, xgi_screen_info_t *req);
extern void xgi_put_screen_info(xgi_info_t *info, xgi_screen_info_t *req);
extern void xgi_ge_reset(xgi_info_t *info);
extern void xgi_sarea_info(xgi_info_t *info, xgi_sarea_info_t *req);
extern int xgi_get_cpu_id(struct cpu_info_s *arg);
extern void xgi_restore_registers(xgi_info_t *info);
extern BOOL xgi_ge_irq_handler(xgi_info_t *info);
extern BOOL xgi_crt_irq_handler(xgi_info_t *info);
extern BOOL xgi_dvi_irq_handler(xgi_info_t *info);
extern void xgi_waitfor_pci_idle(xgi_info_t *info);
extern void xgi_dump_register(xgi_info_t * info);
extern void xgi_get_device_info(xgi_info_t * info, xgi_chip_info_t * req);
extern void xgi_get_mmio_info(xgi_info_t * info, xgi_mmio_info_t * req);
extern void xgi_get_screen_info(xgi_info_t * info, xgi_screen_info_t * req);
extern void xgi_put_screen_info(xgi_info_t * info, xgi_screen_info_t * req);
extern void xgi_ge_reset(xgi_info_t * info);
extern void xgi_sarea_info(xgi_info_t * info, xgi_sarea_info_t * req);
extern int xgi_get_cpu_id(struct cpu_info_s *arg);
extern void xgi_restore_registers(xgi_info_t * info);
extern BOOL xgi_ge_irq_handler(xgi_info_t * info);
extern BOOL xgi_crt_irq_handler(xgi_info_t * info);
extern BOOL xgi_dvi_irq_handler(xgi_info_t * info);
extern void xgi_waitfor_pci_idle(xgi_info_t * info);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -30,44 +30,44 @@
#define _XGI_PCIE_H_
#ifndef XGI_PCIE_ALLOC_MAX_ORDER
#define XGI_PCIE_ALLOC_MAX_ORDER 1 /* 8K in Kernel 2.4.* */
#define XGI_PCIE_ALLOC_MAX_ORDER 1 /* 8K in Kernel 2.4.* */
#endif
typedef struct xgi_page_block_s {
struct xgi_page_block_s *next;
unsigned long phys_addr;
unsigned long virt_addr;
unsigned long page_count;
unsigned long page_order;
struct xgi_page_block_s *next;
unsigned long phys_addr;
unsigned long virt_addr;
unsigned long page_count;
unsigned long page_order;
} xgi_page_block_t;
typedef struct xgi_pcie_block_s {
struct list_head list;
unsigned long offset; /* block's offset in pcie memory, begin from 0 */
unsigned long size; /* The block size. */
unsigned long bus_addr; /* CPU access address/bus address */
unsigned long hw_addr; /* GE access address */
struct list_head list;
unsigned long offset; /* block's offset in pcie memory, begin from 0 */
unsigned long size; /* The block size. */
unsigned long bus_addr; /* CPU access address/bus address */
unsigned long hw_addr; /* GE access address */
unsigned long page_count;
unsigned long page_order;
xgi_page_block_t *page_block;
xgi_pte_t *page_table; /* list of physical pages allocated */
unsigned long page_count;
unsigned long page_order;
xgi_page_block_t *page_block;
xgi_pte_t *page_table; /* list of physical pages allocated */
atomic_t use_count;
enum PcieOwner owner;
unsigned long processID;
atomic_t use_count;
enum PcieOwner owner;
unsigned long processID;
} xgi_pcie_block_t;
typedef struct xgi_pcie_list_s {
xgi_pcie_block_t *head;
xgi_pcie_block_t *tail;
xgi_pcie_block_t *head;
xgi_pcie_block_t *tail;
} xgi_pcie_list_t;
typedef struct xgi_pcie_heap_s {
struct list_head free_list;
struct list_head used_list;
struct list_head sort_list;
unsigned long max_freesize;
struct list_head free_list;
struct list_head used_list;
struct list_head sort_list;
unsigned long max_freesize;
} xgi_pcie_heap_t;
#endif

View File

@ -26,12 +26,11 @@
* DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _XGI_REGS_H_
#define _XGI_REGS_H_
#ifndef XGI_MMIO
#define XGI_MMIO 1
#define XGI_MMIO 1
#endif
#if XGI_MMIO
@ -51,170 +50,172 @@
#endif
/* Hardware access functions */
static inline void OUT3C5B(xgi_info_t *info, u8 index, u8 data)
static inline void OUT3C5B(xgi_info_t * info, u8 index, u8 data)
{
OUTB(0x3C4, index);
OUTB(0x3C5, data);
OUTB(0x3C4, index);
OUTB(0x3C5, data);
}
static inline void OUT3X5B(xgi_info_t *info, u8 index, u8 data)
static inline void OUT3X5B(xgi_info_t * info, u8 index, u8 data)
{
OUTB(0x3D4, index);
OUTB(0x3D5, data);
OUTB(0x3D4, index);
OUTB(0x3D5, data);
}
static inline void OUT3CFB(xgi_info_t *info, u8 index, u8 data)
static inline void OUT3CFB(xgi_info_t * info, u8 index, u8 data)
{
OUTB(0x3CE, index);
OUTB(0x3CF, data);
OUTB(0x3CE, index);
OUTB(0x3CF, data);
}
static inline u8 IN3C5B(xgi_info_t *info, u8 index)
static inline u8 IN3C5B(xgi_info_t * info, u8 index)
{
volatile u8 data=0;
OUTB(0x3C4, index);
data = INB(0x3C5);
return data;
volatile u8 data = 0;
OUTB(0x3C4, index);
data = INB(0x3C5);
return data;
}
static inline u8 IN3X5B(xgi_info_t *info, u8 index)
static inline u8 IN3X5B(xgi_info_t * info, u8 index)
{
volatile u8 data=0;
OUTB(0x3D4, index);
data = INB(0x3D5);
return data;
volatile u8 data = 0;
OUTB(0x3D4, index);
data = INB(0x3D5);
return data;
}
static inline u8 IN3CFB(xgi_info_t *info, u8 index)
static inline u8 IN3CFB(xgi_info_t * info, u8 index)
{
volatile u8 data=0;
OUTB(0x3CE, index);
data = INB(0x3CF);
return data;
volatile u8 data = 0;
OUTB(0x3CE, index);
data = INB(0x3CF);
return data;
}
static inline void OUT3C5W(xgi_info_t *info, u8 index, u16 data)
static inline void OUT3C5W(xgi_info_t * info, u8 index, u16 data)
{
OUTB(0x3C4, index);
OUTB(0x3C5, data);
OUTB(0x3C4, index);
OUTB(0x3C5, data);
}
static inline void OUT3X5W(xgi_info_t *info, u8 index, u16 data)
static inline void OUT3X5W(xgi_info_t * info, u8 index, u16 data)
{
OUTB(0x3D4, index);
OUTB(0x3D5, data);
OUTB(0x3D4, index);
OUTB(0x3D5, data);
}
static inline void OUT3CFW(xgi_info_t *info, u8 index, u8 data)
static inline void OUT3CFW(xgi_info_t * info, u8 index, u8 data)
{
OUTB(0x3CE, index);
OUTB(0x3CF, data);
OUTB(0x3CE, index);
OUTB(0x3CF, data);
}
static inline u8 IN3C5W(xgi_info_t *info, u8 index)
static inline u8 IN3C5W(xgi_info_t * info, u8 index)
{
volatile u8 data=0;
OUTB(0x3C4, index);
data = INB(0x3C5);
return data;
volatile u8 data = 0;
OUTB(0x3C4, index);
data = INB(0x3C5);
return data;
}
static inline u8 IN3X5W(xgi_info_t *info, u8 index)
static inline u8 IN3X5W(xgi_info_t * info, u8 index)
{
volatile u8 data=0;
OUTB(0x3D4, index);
data = INB(0x3D5);
return data;
volatile u8 data = 0;
OUTB(0x3D4, index);
data = INB(0x3D5);
return data;
}
static inline u8 IN3CFW(xgi_info_t *info, u8 index)
static inline u8 IN3CFW(xgi_info_t * info, u8 index)
{
volatile u8 data=0;
OUTB(0x3CE, index);
data = INB(0x3CF);
return data;
volatile u8 data = 0;
OUTB(0x3CE, index);
data = INB(0x3CF);
return data;
}
static inline u8 readAttr(xgi_info_t *info, u8 index)
static inline u8 readAttr(xgi_info_t * info, u8 index)
{
INB(0x3DA); /* flip-flop to index */
OUTB(0x3C0, index);
return INB(0x3C1);
INB(0x3DA); /* flip-flop to index */
OUTB(0x3C0, index);
return INB(0x3C1);
}
static inline void writeAttr(xgi_info_t *info, u8 index, u8 value)
static inline void writeAttr(xgi_info_t * info, u8 index, u8 value)
{
INB(0x3DA); /* flip-flop to index */
OUTB(0x3C0, index);
OUTB(0x3C0, value);
INB(0x3DA); /* flip-flop to index */
OUTB(0x3C0, index);
OUTB(0x3C0, value);
}
/*
* Graphic engine register (2d/3d) acessing interface
*/
static inline void WriteRegDWord(xgi_info_t *info, u32 addr, u32 data)
static inline void WriteRegDWord(xgi_info_t * info, u32 addr, u32 data)
{
/* Jong 05/25/2006 */
XGI_INFO("Jong-WriteRegDWord()-Begin \n");
XGI_INFO("Jong-WriteRegDWord()-info->mmio.vbase=0x%lx \n", info->mmio.vbase);
XGI_INFO("Jong-WriteRegDWord()-addr=0x%lx \n", addr);
XGI_INFO("Jong-WriteRegDWord()-data=0x%lx \n", data);
XGI_INFO("Jong-WriteRegDWord()-Begin \n");
XGI_INFO("Jong-WriteRegDWord()-info->mmio.vbase=0x%lx \n",
info->mmio.vbase);
XGI_INFO("Jong-WriteRegDWord()-addr=0x%lx \n", addr);
XGI_INFO("Jong-WriteRegDWord()-data=0x%lx \n", data);
/* return; */
*(volatile u32*)(info->mmio.vbase + addr) = (data);
XGI_INFO("Jong-WriteRegDWord()-End \n");
*(volatile u32 *)(info->mmio.vbase + addr) = (data);
XGI_INFO("Jong-WriteRegDWord()-End \n");
}
static inline void WriteRegWord(xgi_info_t *info, u32 addr, u16 data)
static inline void WriteRegWord(xgi_info_t * info, u32 addr, u16 data)
{
*(volatile u16*)(info->mmio.vbase + addr) = (data);
*(volatile u16 *)(info->mmio.vbase + addr) = (data);
}
static inline void WriteRegByte(xgi_info_t *info, u32 addr, u8 data)
static inline void WriteRegByte(xgi_info_t * info, u32 addr, u8 data)
{
*(volatile u8*)(info->mmio.vbase + addr) = (data);
*(volatile u8 *)(info->mmio.vbase + addr) = (data);
}
static inline u32 ReadRegDWord(xgi_info_t *info, u32 addr)
static inline u32 ReadRegDWord(xgi_info_t * info, u32 addr)
{
volatile u32 data;
data = *(volatile u32*)(info->mmio.vbase + addr);
return data;
volatile u32 data;
data = *(volatile u32 *)(info->mmio.vbase + addr);
return data;
}
static inline u16 ReadRegWord(xgi_info_t *info, u32 addr)
static inline u16 ReadRegWord(xgi_info_t * info, u32 addr)
{
volatile u16 data;
data = *(volatile u16*)(info->mmio.vbase + addr);
return data;
volatile u16 data;
data = *(volatile u16 *)(info->mmio.vbase + addr);
return data;
}
static inline u8 ReadRegByte(xgi_info_t *info, u32 addr)
static inline u8 ReadRegByte(xgi_info_t * info, u32 addr)
{
volatile u8 data;
data = *(volatile u8*)(info->mmio.vbase + addr);
return data;
volatile u8 data;
data = *(volatile u8 *)(info->mmio.vbase + addr);
return data;
}
#if 0
extern void OUT3C5B(xgi_info_t *info, u8 index, u8 data);
extern void OUT3X5B(xgi_info_t *info, u8 index, u8 data);
extern void OUT3CFB(xgi_info_t *info, u8 index, u8 data);
extern u8 IN3C5B(xgi_info_t *info, u8 index);
extern u8 IN3X5B(xgi_info_t *info, u8 index);
extern u8 IN3CFB(xgi_info_t *info, u8 index);
extern void OUT3C5W(xgi_info_t *info, u8 index, u8 data);
extern void OUT3X5W(xgi_info_t *info, u8 index, u8 data);
extern void OUT3CFW(xgi_info_t *info, u8 index, u8 data);
extern u8 IN3C5W(xgi_info_t *info, u8 index);
extern u8 IN3X5W(xgi_info_t *info, u8 index);
extern u8 IN3CFW(xgi_info_t *info, u8 index);
extern void OUT3C5B(xgi_info_t * info, u8 index, u8 data);
extern void OUT3X5B(xgi_info_t * info, u8 index, u8 data);
extern void OUT3CFB(xgi_info_t * info, u8 index, u8 data);
extern u8 IN3C5B(xgi_info_t * info, u8 index);
extern u8 IN3X5B(xgi_info_t * info, u8 index);
extern u8 IN3CFB(xgi_info_t * info, u8 index);
extern void OUT3C5W(xgi_info_t * info, u8 index, u8 data);
extern void OUT3X5W(xgi_info_t * info, u8 index, u8 data);
extern void OUT3CFW(xgi_info_t * info, u8 index, u8 data);
extern u8 IN3C5W(xgi_info_t * info, u8 index);
extern u8 IN3X5W(xgi_info_t * info, u8 index);
extern u8 IN3CFW(xgi_info_t * info, u8 index);
extern void WriteRegDWord(xgi_info_t *info, u32 addr, u32 data);
extern void WriteRegWord(xgi_info_t *info, u32 addr, u16 data);
extern void WriteRegByte(xgi_info_t *info, u32 addr, u8 data);
extern u32 ReadRegDWord(xgi_info_t *info, u32 addr);
extern u16 ReadRegWord(xgi_info_t *info, u32 addr);
extern u8 ReadRegByte(xgi_info_t *info, u32 addr);
extern void WriteRegDWord(xgi_info_t * info, u32 addr, u32 data);
extern void WriteRegWord(xgi_info_t * info, u32 addr, u16 data);
extern void WriteRegByte(xgi_info_t * info, u32 addr, u8 data);
extern u32 ReadRegDWord(xgi_info_t * info, u32 addr);
extern u16 ReadRegWord(xgi_info_t * info, u32 addr);
extern u8 ReadRegByte(xgi_info_t * info, u32 addr);
extern void EnableProtect();
extern void DisableProtect();
@ -261,150 +262,143 @@ extern void DisableProtect();
#define wReadReg(addr) ReadRegWord(info, addr)
#define bReadReg(addr) ReadRegByte(info, addr)
static inline void xgi_protect_all(xgi_info_t *info)
static inline void xgi_protect_all(xgi_info_t * info)
{
OUTB(0x3C4, 0x11);
OUTB(0x3C5, 0x92);
OUTB(0x3C4, 0x11);
OUTB(0x3C5, 0x92);
}
static inline void xgi_unprotect_all(xgi_info_t *info)
static inline void xgi_unprotect_all(xgi_info_t * info)
{
OUTB(0x3C4, 0x11);
OUTB(0x3C5, 0x92);
OUTB(0x3C4, 0x11);
OUTB(0x3C5, 0x92);
}
static inline void xgi_enable_mmio(xgi_info_t *info)
static inline void xgi_enable_mmio(xgi_info_t * info)
{
u8 protect = 0;
u8 protect = 0;
/* Unprotect registers */
outb(0x11, 0x3C4);
protect = inb(0x3C5);
outb(0x92, 0x3C5);
/* Unprotect registers */
outb(0x11, 0x3C4);
protect = inb(0x3C5);
outb(0x92, 0x3C5);
outb(0x3A, 0x3D4);
outb(inb(0x3D5) | 0x20, 0x3D5);
outb(0x3A, 0x3D4);
outb(inb(0x3D5) | 0x20, 0x3D5);
/* Enable MMIO */
outb(0x39, 0x3D4);
outb(inb(0x3D5) | 0x01, 0x3D5);
/* Enable MMIO */
outb(0x39, 0x3D4);
outb(inb(0x3D5) | 0x01, 0x3D5);
OUTB(0x3C4, 0x11);
OUTB(0x3C5, protect);
OUTB(0x3C4, 0x11);
OUTB(0x3C5, protect);
}
static inline void xgi_disable_mmio(xgi_info_t *info)
static inline void xgi_disable_mmio(xgi_info_t * info)
{
u8 protect = 0;
u8 protect = 0;
/* unprotect registers */
OUTB(0x3C4, 0x11);
protect = INB(0x3C5);
OUTB(0x3C5, 0x92);
/* unprotect registers */
OUTB(0x3C4, 0x11);
protect = INB(0x3C5);
OUTB(0x3C5, 0x92);
/* Disable MMIO access */
OUTB(0x3D4, 0x39);
OUTB(0x3D5, INB(0x3D5) & 0xFE);
/* Disable MMIO access */
OUTB(0x3D4, 0x39);
OUTB(0x3D5, INB(0x3D5) & 0xFE);
/* Protect registers */
outb(0x11, 0x3C4);
outb(protect, 0x3C5);
/* Protect registers */
outb(0x11, 0x3C4);
outb(protect, 0x3C5);
}
static inline void xgi_enable_ge(xgi_info_t *info)
static inline void xgi_enable_ge(xgi_info_t * info)
{
unsigned char bOld3cf2a = 0;
int wait = 0;
unsigned char bOld3cf2a = 0;
int wait = 0;
// Enable GE
OUTW(0x3C4, 0x9211);
// Enable GE
OUTW(0x3C4, 0x9211);
// Save and close dynamic gating
bOld3cf2a = bIn3cf(0x2a);
bOut3cf(0x2a, bOld3cf2a & 0xfe);
// Save and close dynamic gating
bOld3cf2a = bIn3cf(0x2a);
bOut3cf(0x2a, bOld3cf2a & 0xfe);
// Reset both 3D and 2D engine
bOut3x5(0x36, 0x84);
wait = 10;
while (wait--)
{
bIn(0x36);
}
bOut3x5(0x36, 0x94);
wait = 10;
while (wait--)
{
bIn(0x36);
}
bOut3x5(0x36, 0x84);
wait = 10;
while (wait--)
{
bIn(0x36);
}
// Enable 2D engine only
bOut3x5(0x36, 0x80);
// Reset both 3D and 2D engine
bOut3x5(0x36, 0x84);
wait = 10;
while (wait--) {
bIn(0x36);
}
bOut3x5(0x36, 0x94);
wait = 10;
while (wait--) {
bIn(0x36);
}
bOut3x5(0x36, 0x84);
wait = 10;
while (wait--) {
bIn(0x36);
}
// Enable 2D engine only
bOut3x5(0x36, 0x80);
// Enable 2D+3D engine
bOut3x5(0x36, 0x84);
bOut3x5(0x36, 0x84);
// Restore dynamic gating
bOut3cf(0x2a, bOld3cf2a);
// Restore dynamic gating
bOut3cf(0x2a, bOld3cf2a);
}
static inline void xgi_disable_ge(xgi_info_t *info)
static inline void xgi_disable_ge(xgi_info_t * info)
{
int wait = 0;
int wait = 0;
// Reset both 3D and 2D engine
bOut3x5(0x36, 0x84);
// Reset both 3D and 2D engine
bOut3x5(0x36, 0x84);
wait = 10;
while (wait--)
{
bIn(0x36);
}
bOut3x5(0x36, 0x94);
wait = 10;
while (wait--) {
bIn(0x36);
}
bOut3x5(0x36, 0x94);
wait = 10;
while (wait--)
{
bIn(0x36);
}
bOut3x5(0x36, 0x84);
wait = 10;
while (wait--) {
bIn(0x36);
}
bOut3x5(0x36, 0x84);
wait = 10;
while (wait--)
{
bIn(0x36);
}
wait = 10;
while (wait--) {
bIn(0x36);
}
// Disable 2D engine only
bOut3x5(0x36, 0);
// Disable 2D engine only
bOut3x5(0x36, 0);
}
static inline void xgi_enable_dvi_interrupt(xgi_info_t *info)
static inline void xgi_enable_dvi_interrupt(xgi_info_t * info)
{
Out3cf(0x39, In3cf(0x39) & ~0x01); //Set 3cf.39 bit 0 to 0
Out3cf(0x39, In3cf(0x39) | 0x01); //Set 3cf.39 bit 0 to 1
Out3cf(0x39, In3cf(0x39) | 0x02);
Out3cf(0x39, In3cf(0x39) & ~0x01); //Set 3cf.39 bit 0 to 0
Out3cf(0x39, In3cf(0x39) | 0x01); //Set 3cf.39 bit 0 to 1
Out3cf(0x39, In3cf(0x39) | 0x02);
}
static inline void xgi_disable_dvi_interrupt(xgi_info_t *info)
static inline void xgi_disable_dvi_interrupt(xgi_info_t * info)
{
Out3cf(0x39,In3cf(0x39) & ~0x02);
Out3cf(0x39, In3cf(0x39) & ~0x02);
}
static inline void xgi_enable_crt1_interrupt(xgi_info_t *info)
static inline void xgi_enable_crt1_interrupt(xgi_info_t * info)
{
Out3cf(0x3d,In3cf(0x3d) | 0x04);
Out3cf(0x3d,In3cf(0x3d) & ~0x04);
Out3cf(0x3d,In3cf(0x3d) | 0x08);
Out3cf(0x3d, In3cf(0x3d) | 0x04);
Out3cf(0x3d, In3cf(0x3d) & ~0x04);
Out3cf(0x3d, In3cf(0x3d) | 0x08);
}
static inline void xgi_disable_crt1_interrupt(xgi_info_t *info)
static inline void xgi_disable_crt1_interrupt(xgi_info_t * info)
{
Out3cf(0x3d,In3cf(0x3d) & ~0x08);
Out3cf(0x3d, In3cf(0x3d) & ~0x08);
}
#endif

View File

@ -33,27 +33,27 @@
* Typedefs *
***************************************************************************/
typedef unsigned char V8; /* "void": enumerated or multiple fields */
typedef unsigned short V16; /* "void": enumerated or multiple fields */
typedef unsigned char U8; /* 0 to 255 */
typedef unsigned short U16; /* 0 to 65535 */
typedef signed char S8; /* -128 to 127 */
typedef signed short S16; /* -32768 to 32767 */
typedef float F32; /* IEEE Single Precision (S1E8M23) */
typedef double F64; /* IEEE Double Precision (S1E11M52) */
typedef unsigned long BOOL;
typedef unsigned char V8; /* "void": enumerated or multiple fields */
typedef unsigned short V16; /* "void": enumerated or multiple fields */
typedef unsigned char U8; /* 0 to 255 */
typedef unsigned short U16; /* 0 to 65535 */
typedef signed char S8; /* -128 to 127 */
typedef signed short S16; /* -32768 to 32767 */
typedef float F32; /* IEEE Single Precision (S1E8M23) */
typedef double F64; /* IEEE Double Precision (S1E11M52) */
typedef unsigned long BOOL;
/*
* mainly for 64-bit linux, where long is 64 bits
* and win9x, where int is 16 bit.
*/
#if defined(vxworks)
typedef unsigned int V32; /* "void": enumerated or multiple fields */
typedef unsigned int U32; /* 0 to 4294967295 */
typedef signed int S32; /* -2147483648 to 2147483647 */
typedef unsigned int V32; /* "void": enumerated or multiple fields */
typedef unsigned int U32; /* 0 to 4294967295 */
typedef signed int S32; /* -2147483648 to 2147483647 */
#else
typedef unsigned long V32; /* "void": enumerated or multiple fields */
typedef unsigned long U32; /* 0 to 4294967295 */
typedef signed long S32; /* -2147483648 to 2147483647 */
typedef unsigned long V32; /* "void": enumerated or multiple fields */
typedef unsigned long U32; /* 0 to 4294967295 */
typedef signed long S32; /* -2147483648 to 2147483647 */
#endif
#ifndef TRUE
@ -65,4 +65,3 @@ typedef signed long S32; /* -2147483648 to 2147483647 */
#endif
#endif