Remove superfluous braces and add #ifndef __sparc64__ around the

VTB_FRAMEBUFFER specific code. On sparc64 we don't use a buffer of
type VTB_FRAMEBUFFER (see syscons.c) and excluding the respective
code here allows to compile syscons(4) without isa(4).

Requested by:	joerg, marcel, yongari
This commit is contained in:
Marius Strobl 2005-05-21 20:28:15 +00:00
parent 3b8c3ece32
commit ae240fafb2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=146476

View File

@ -74,10 +74,12 @@ sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait)
}
vtb->vtb_flags |= VTB_VALID;
break;
#ifndef __sparc64__
case VTB_FRAMEBUFFER:
vtb->vtb_buffer = (vm_offset_t)buf;
vtb->vtb_flags |= VTB_VALID;
break;
#endif
default:
break;
}
@ -117,36 +119,44 @@ sc_vtb_size(int cols, int rows)
int
sc_vtb_getc(sc_vtb_t *vtb, int at)
{
#ifndef __sparc64__
if (vtb->vtb_type == VTB_FRAMEBUFFER)
return (readw(sc_vtb_pointer(vtb, at)) & 0x00ff);
else
#endif
return (*(u_int16_t *)sc_vtb_pointer(vtb, at) & 0x00ff);
}
int
sc_vtb_geta(sc_vtb_t *vtb, int at)
{
#ifndef __sparc64__
if (vtb->vtb_type == VTB_FRAMEBUFFER)
return (readw(sc_vtb_pointer(vtb, at)) & 0xff00);
else
#endif
return (*(u_int16_t *)sc_vtb_pointer(vtb, at) & 0xff00);
}
void
sc_vtb_putc(sc_vtb_t *vtb, int at, int c, int a)
{
#ifndef __sparc64__
if (vtb->vtb_type == VTB_FRAMEBUFFER)
writew(sc_vtb_pointer(vtb, at), a | c);
else
#endif
*(u_int16_t *)sc_vtb_pointer(vtb, at) = a | c;
}
vm_offset_t
sc_vtb_putchar(sc_vtb_t *vtb, vm_offset_t p, int c, int a)
{
#ifndef __sparc64__
if (vtb->vtb_type == VTB_FRAMEBUFFER)
writew(p, a | c);
else
#endif
*(u_int16_t *)p = a | c;
return (p + sizeof(u_int16_t));
}
@ -166,29 +176,32 @@ sc_vtb_pos(sc_vtb_t *vtb, int pos, int offset)
void
sc_vtb_clear(sc_vtb_t *vtb, int c, int attr)
{
#ifndef __sparc64__
if (vtb->vtb_type == VTB_FRAMEBUFFER)
fillw_io(attr | c, sc_vtb_pointer(vtb, 0), vtb->vtb_size);
else
#endif
fillw(attr | c, (void *)sc_vtb_pointer(vtb, 0), vtb->vtb_size);
}
void
sc_vtb_copy(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, int to, int count)
{
#ifndef __sparc64__
/* XXX if both are VTB_VRAMEBUFFER... */
if (vtb2->vtb_type == VTB_FRAMEBUFFER) {
if (vtb2->vtb_type == VTB_FRAMEBUFFER)
bcopy_toio(sc_vtb_pointer(vtb1, from),
sc_vtb_pointer(vtb2, to),
count*sizeof(u_int16_t));
} else if (vtb1->vtb_type == VTB_FRAMEBUFFER) {
else if (vtb1->vtb_type == VTB_FRAMEBUFFER)
bcopy_fromio(sc_vtb_pointer(vtb1, from),
sc_vtb_pointer(vtb2, to),
count*sizeof(u_int16_t));
} else {
else
#endif
bcopy((void *)sc_vtb_pointer(vtb1, from),
(void *)sc_vtb_pointer(vtb2, to),
count*sizeof(u_int16_t));
}
}
void
@ -201,15 +214,16 @@ sc_vtb_append(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, int count)
while (count > 0) {
len = imin(count, vtb2->vtb_size - vtb2->vtb_tail);
if (vtb1->vtb_type == VTB_FRAMEBUFFER) {
#ifndef __sparc64__
if (vtb1->vtb_type == VTB_FRAMEBUFFER)
bcopy_fromio(sc_vtb_pointer(vtb1, from),
sc_vtb_pointer(vtb2, vtb2->vtb_tail),
len*sizeof(u_int16_t));
} else {
else
#endif
bcopy((void *)sc_vtb_pointer(vtb1, from),
(void *)sc_vtb_pointer(vtb2, vtb2->vtb_tail),
len*sizeof(u_int16_t));
}
from += len;
count -= len;
vtb2->vtb_tail = vtb_wrap(vtb2, vtb2->vtb_tail, len);
@ -227,9 +241,11 @@ sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr)
{
if (at + count > vtb->vtb_size)
count = vtb->vtb_size - at;
#ifndef __sparc64__
if (vtb->vtb_type == VTB_FRAMEBUFFER)
fillw_io(attr | c, sc_vtb_pointer(vtb, at), count);
else
#endif
fillw(attr | c, (void *)sc_vtb_pointer(vtb, at), count);
}
@ -242,13 +258,14 @@ sc_vtb_move(sc_vtb_t *vtb, int from, int to, int count)
count = vtb->vtb_size - to;
if (count <= 0)
return;
if (vtb->vtb_type == VTB_FRAMEBUFFER) {
#ifndef __sparc64__
if (vtb->vtb_type == VTB_FRAMEBUFFER)
bcopy_io(sc_vtb_pointer(vtb, from),
sc_vtb_pointer(vtb, to), count*sizeof(u_int16_t));
} else {
else
#endif
bcopy((void *)sc_vtb_pointer(vtb, from),
(void *)sc_vtb_pointer(vtb, to), count*sizeof(u_int16_t));
}
}
void
@ -260,20 +277,23 @@ sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr)
count = vtb->vtb_size - at;
len = vtb->vtb_size - at - count;
if (len > 0) {
if (vtb->vtb_type == VTB_FRAMEBUFFER) {
#ifndef __sparc64__
if (vtb->vtb_type == VTB_FRAMEBUFFER)
bcopy_io(sc_vtb_pointer(vtb, at + count),
sc_vtb_pointer(vtb, at),
len*sizeof(u_int16_t));
} else {
else
#endif
bcopy((void *)sc_vtb_pointer(vtb, at + count),
(void *)sc_vtb_pointer(vtb, at),
len*sizeof(u_int16_t));
}
}
#ifndef __sparc64__
if (vtb->vtb_type == VTB_FRAMEBUFFER)
fillw_io(attr | c, sc_vtb_pointer(vtb, at + len),
vtb->vtb_size - at - len);
else
#endif
fillw(attr | c, (void *)sc_vtb_pointer(vtb, at + len),
vtb->vtb_size - at - len);
}
@ -281,21 +301,24 @@ sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr)
void
sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr)
{
if (at + count > vtb->vtb_size) {
if (at + count > vtb->vtb_size)
count = vtb->vtb_size - at;
} else {
if (vtb->vtb_type == VTB_FRAMEBUFFER) {
else {
#ifndef __sparc64__
if (vtb->vtb_type == VTB_FRAMEBUFFER)
bcopy_io(sc_vtb_pointer(vtb, at),
sc_vtb_pointer(vtb, at + count),
(vtb->vtb_size - at - count)*sizeof(u_int16_t));
} else {
else
#endif
bcopy((void *)sc_vtb_pointer(vtb, at),
(void *)sc_vtb_pointer(vtb, at + count),
(vtb->vtb_size - at - count)*sizeof(u_int16_t));
}
}
#ifndef __sparc64__
if (vtb->vtb_type == VTB_FRAMEBUFFER)
fillw_io(attr | c, sc_vtb_pointer(vtb, at), count);
else
#endif
fillw(attr | c, (void *)sc_vtb_pointer(vtb, at), count);
}