summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons/scvtb.c
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2005-05-21 20:28:15 +0000
committermarius <marius@FreeBSD.org>2005-05-21 20:28:15 +0000
commit08a17e9d91cb875572f850999032edad28cd8078 (patch)
tree6cd5a23c2a52260a9391feec751cf360a6d0b9aa /sys/dev/syscons/scvtb.c
parentf02b55e3fecacb44f856504e9717479fe3e550c3 (diff)
downloadFreeBSD-src-08a17e9d91cb875572f850999032edad28cd8078.zip
FreeBSD-src-08a17e9d91cb875572f850999032edad28cd8078.tar.gz
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
Diffstat (limited to 'sys/dev/syscons/scvtb.c')
-rw-r--r--sys/dev/syscons/scvtb.c59
1 files changed, 41 insertions, 18 deletions
diff --git a/sys/dev/syscons/scvtb.c b/sys/dev/syscons/scvtb.c
index 898d7f7..8d2b224 100644
--- a/sys/dev/syscons/scvtb.c
+++ b/sys/dev/syscons/scvtb.c
@@ -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);
}
OpenPOWER on IntegriCloud