This isn't 100% as command submission via PCI-e GART buffers doesn't work.
I've hacked around that for the time being. This is essentially the code
that was used at the POWER.org event to show Bimini.
Pass the master's file pointer, as supplied to xgi_bootstrap, to
xgi_cmdlist_initialize. Associate that pointer with the memory
allocated for the command list buffer. By doing this the memory will
be automatically cleaned up when the master closes the device. This
allows the removal of some clean up code.
When the GE is shut down, an empty command packet without a begin-link
must be sent. After this command is sent, wait for the hardware to go
idle. Finally, turn off the GE and disable MMIO.
There were numerous unnecessary fields in xgi_cmd_info. The remaining
fields had pretty crummy names. Cut out the cruft, and rename the
rest. As a result, the unused parameter "triggerCounter" to
triggerHWCommandList can be removed.
Generate the begin command once in a temporary buffer. Then,
depending on whether the command is to be written directly to the
hardware or to a secondary buffer, copy to command to the correct place.
Moved the getCurBatchBeginPort before its only caller. Modified
function to return the command ID instead of the port offset.
Function also now assumes input begin type is value.
Added code to ioctl handler to validate begin type.
xgi_cmdlist_initialize wasn't correctly checking for errors from
xgi_pcie_alloc. Furthermore, xgi_bootstrap, the one caller of
xgi_cmdlist_initialize, wasn't check its return value.
Most occurances of U32 were converted to u32. These are cases where
the data represents something that will be written to the hardware.
Other cases were converted to 'unsigned int'.
U32 was the last type in xgi_types.h, so that file is removed.
These two structures were used as the request and reply for certain
ioctls. Having a different type for an ioctl's input and output is
just wierd. In addition, each structure contained fields (e.g., pid)
that had no business being there.
This change requires updates to user-space.
Comment in the code explains it. Basically, I put an if-statement
around a block of code to prevent a NULL pointer dereference that
should never happen in the first place. Eventually, this will need to
come out.