/*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "libvtsSUNWast.h"
int
register return_packet *const rp,
register int const test)
{
if (ast_get_pci_info() != 0) {
return (-1);
}
/*
* Map framebuffer
*/
if (ast_map_fb() != 0) {
return (-1);
}
/*
* Map MMIO
*/
if (ast_map_mmio() != 0) {
return (-1);
}
return (0);
}
int
void)
{
int i;
&pciconfig) != 0) {
return (-1);
}
for (i = 0; i < 6; i++) {
type[i] = 0;
mem_base[i] = 0;
io_base[i] = 0;
}
for (i = 0; i < 6; i++) {
if (bar != 0) {
if (bar & PCI_MAP_IO) {
} else {
if (PCI_MAP_IS64BITMEM(bar)) {
if (i == 5) {
mem_base[i] = 0;
} else {
mem_base[i] |=
++i;
}
}
}
}
}
ast_info.ast_fb_size = 0;
if (ast_open_key() != 0)
return (-1);
return (-1);
switch (pots & 0x03) {
case 0x00:
break;
case 0x01:
break;
case 0x02:
break;
case 0x03:
break;
}
if (gfx_vts_debug_mask & VTS_DEBUG) {
printf("ast_vendor = 0x%04x, ast_device = 0x%04x\n",
printf("ast_fb_addr 0x%llx, ast_fb_size 0x%lx\n",
(unsigned long long)ast_info.ast_fb_addr,
(unsigned long)ast_info.ast_fb_size);
printf("ast_mmio_addr 0x%llx, ast_mmio_size 0x%lx\n",
(unsigned long long)ast_info.ast_mmio_addr,
(unsigned long)ast_info.ast_mmio_size);
printf("ast_relocate_io 0x%llx\n",
(unsigned long long)ast_info.ast_relocate_io);
}
return (0);
}
int
void)
{
register void *ptr;
if (ptr == MAP_FAILED)
return (-1);
}
if (gfx_vts_debug_mask & VTS_DEBUG)
printf("ast_mmio_ptr = 0x%llx\n",
(unsigned long long)ast_info.ast_mmio_ptr);
return (0);
}
int
void)
{
register void *ptr;
if (ptr == MAP_FAILED)
return (-1);
}
if (gfx_vts_debug_mask & VTS_DEBUG)
printf("ast_fb_ptr = 0x%llx\n",
(unsigned long long)ast_info.ast_fb_ptr);
return (0);
}
int
register return_packet *const rp,
register int const test)
{
unsigned int status = 0;
/*
* first check if the hardware is already initialized.
* If not, abort
*/
"AST_GET_STATUS_FLAGS failed");
return (-1);
}
if (!(status & AST_STATUS_HW_INITIALIZED)) {
"AST_GET_STATUS_FLAGS not initialized");
return (-1);
}
if (ast_open_key() != 0) {
return (-1);
}
"unable to get the gctl index");
return (-1);
}
return (-1);
}
"unable to set the gctl index");
return (-1);
}
return (-1);
}
return (-1);
}
return (-1);
}
return (-1);
}
return (-1);
}
return (-1);
}
return (-1);
}
return (-1);
}
return (-1);
}
return (-1);
}
return (-1);
}
if (!(misc & 0x01)) {
if (!(ecm & 0x01)) {
depth = 4;
width /= 8;
height /= 16;
pixelsize = 2;
} else {
depth = 8;
pixelsize = 1;
}
} else {
switch (ecm & 0xf) {
case 0x01:
/* enable enhanced 256 color display mode */
depth = 8;
pixelsize = 1;
break;
case 0x02:
/* enable 15-bpp high color display mode (rgb:555) */
depth = 15;
pixelsize = 2;
break;
case 0x04:
/* enable 16-bpp high color display mode (rgb:565) */
depth = 16;
pixelsize = 2;
break;
case 0x08:
/* enable 32-bpp true color display mode (argb:8888) */
depth = 32;
pixelsize = 4;
break;
default:
return (-1);
}
}
switch (pcicr3 & 0xc0) {
case 0x00: /* little endian */
case 0x40:
ast_info.ast_endian = 0;
break;
case 0x80: /* big endian 32 */
break;
case 0xc0: /* big endian 16 */
break;
}
if (gfx_vts_debug_mask & VTS_DEBUG) {
printf("width=%d height=%d depth=%d pitch=%d\n",
}
return (0);
}
int
void)
{
unsigned int ulData;
register int status = 0;
/*
* Enable MMIO
*/
return (-1);
return (-1);
return (-1);
return (-1);
status = 1;
}
if (!ast_wait_idle())
return (-1);
status = 1;
}
if (!ast_store_mmio(MMIOREG_CLIP1,
((0 & MASK_CLIP) << 16) |
(0 & MASK_CLIP)))
return (-1);
if (!ast_store_mmio(MMIOREG_CLIP2,
return (-1);
return (status);
}
int
void)
{
register int status = 0;
status = -1;
else
status = 1;
}
status = -1;
return (status);
}
int
void)
{
status = -1;
status = -1;
status = -1;
status = -1;
status = -1;
status = -1;
status = -1;
status = -1;
}
return (status);
}
int
void)
{
return (-1);
case 8: /* 3, 3, 2 */
}
break;
case 15: /* 5, 5, 5 */
}
break;
case 16: /* 5, 6, 5 */
}
break;
default: /* 8, 8, 8 */
}
break;
}
/* Don't set the palet if it matches what we will set. */
break;
}
if (coloron == 256)
return (0);
status = -1;
status = -1;
status = -1;
status = -1;
status = -1;
status = -1;
status = -1;
status = -1;
}
return (status);
}
int
void)
{
if (!ast_info.ast_palet_changed)
return (0);
status = -1;
status = -1;
status = -1;
status = -1;
status = -1;
status = -1;
status = -1;
status = -1;
}
return (status);
}
{
case 8: /* 3, 3, 2 */
break;
case 15: /* 5, 5, 5 */
break;
case 16: /* 5, 6, 5 */
break;
default: /* 8, 8, 8 */
break;
}
return (value);
}
int
void)
{
return (-1);
return (0);
}
int
{
switch (ast_info.ast_pixelsize) {
case 1:
cmdreg |= CMD_COLOR_08;
break;
case 2:
cmdreg |= CMD_COLOR_16;
break;
case 3:
case 4:
default:
cmdreg |= CMD_COLOR_32;
break;
}
return (0);
return (0);
if (!ast_store_mmio(MMIOREG_DST_BASE, 0))
return (0);
if (!ast_store_mmio(MMIOREG_DST_XY,
return (0);
return (0);
return (0);
return (1);
}
int
{
switch (ast_info.ast_pixelsize) {
case 1:
cmdreg |= CMD_COLOR_08;
break;
case 2:
cmdreg |= CMD_COLOR_16;
break;
case 3:
case 4:
default:
cmdreg |= CMD_COLOR_32;
break;
}
return (0);
return (0);
return (0);
return (0);
return (0);
if (!ast_store_mmio(MMIOREG_DST_BASE, 0))
return (0);
if (!ast_store_mmio(MMIOREG_DST_XY,
return (0);
return (0);
return (0);
return (1);
}
int
{
register int err;
register int k1;
register int k2;
register int xm;
switch (ast_info.ast_pixelsize) {
case 1:
cmdreg |= CMD_COLOR_08;
break;
case 2:
cmdreg |= CMD_COLOR_16;
break;
case 3:
case 4:
default:
cmdreg |= CMD_COLOR_32;
break;
}
else
else
xm = 1;
} else {
xm = 0;
}
if (!ast_store_mmio(MMIOREG_DST_BASE, 0))
return (0);
return (0);
return (0);
return (0);
return (0);
return (0);
(k1 & MASK_LINE_K1)))
return (0);
(k2 & MASK_LINE_K2)))
return (0);
return (0);
return (1);
}
int
register return_packet *const rp,
register int const test)
{
if (ast_unmap_fb() != 0) {
return (-1);
}
if (ast_unmap_mmio() != 0) {
return (-1);
}
return (0);
}
int
void)
{
register int status;
return (0);
return (status);
}
int
void)
{
register int status;
return (0);
return (status);
}
int
{
return (1);
do {
count++;
return (1);
return (1);
return (0);
}
int
{
return (-1);
return (-1);
return (0);
}
int
{
return (-1);
return (-1);
return (0);
}
int
{
return (-1);
return (0);
}
int
{
return (-1);
return (0);
}
{
union {
uint_t l;
ushort_t w[2];
uchar_t b[4];
} data;
switch (ast_info.ast_endian) {
case 0: /* little endian */
break;
case 1: /* big endian 16 */
case 2: /* big endian 32 */
break;
}
return (value);
}
void
{
union {
uint_t l;
ushort_t w[2];
uchar_t b[4];
} data;
switch (ast_info.ast_endian) {
case 0: /* little endian */
break;
case 1: /* big endian 16 */
case 2: /* big endian 32 */
break;
}
}
int
void)
{
return (1);
do {
count++;
return (1);
return (1);
return (0);
}