patch-2.3.20 linux/arch/ppc/kernel/prom.c
Next file: linux/arch/ppc/kernel/qspan_pci.c
Previous file: linux/arch/ppc/kernel/process.c
Back to the patch index
Back to the overall index
- Lines: 332
- Date:
Thu Oct 7 10:17:08 1999
- Orig file:
v2.3.19/linux/arch/ppc/kernel/prom.c
- Orig date:
Fri Sep 10 23:57:28 1999
diff -u --recursive --new-file v2.3.19/linux/arch/ppc/kernel/prom.c linux/arch/ppc/kernel/prom.c
@@ -1,5 +1,5 @@
/*
- * $Id: prom.c,v 1.73 1999/09/05 11:56:32 paulus Exp $
+ * $Id: prom.c,v 1.77 1999/09/14 01:13:19 cort Exp $
*
* Procedures for interfacing to the Open Firmware PROM on
* Power Macintosh computers.
@@ -109,9 +109,9 @@
#ifdef CONFIG_BOOTX_TEXT
-static void drawchar(char c);
+void drawchar(char c);
+void drawstring(const char *c);
static void drawhex(unsigned long v);
-static void drawstring(const char *c);
static void scrollscreen(void);
static void draw_byte(unsigned char c, long locX, long locY);
@@ -138,7 +138,6 @@
unsigned long, struct device_node ***);
static unsigned long finish_node(struct device_node *, unsigned long,
interpret_func *);
-static void relocate_nodes(void);
static unsigned long check_display(unsigned long);
static int prom_next_node(phandle *);
static void *early_get_property(unsigned long, unsigned long, char *);
@@ -287,7 +286,7 @@
gemini_prom_init();
return;
#endif /* CONFIG_GEMINI */
-
+
/* check if we're apus, return if we are */
if ( r3 == 0x61707573 )
return;
@@ -304,6 +303,8 @@
#endif
RELOC(boot_infos) = PTRUNRELOC(bi);
+ if (!BOOT_INFO_IS_V2_COMPATIBLE(bi))
+ bi->logicalDisplayBase = 0;
clearscreen();
@@ -357,9 +358,13 @@
}
}
- space = bi->deviceTreeOffset + bi->deviceTreeSize;
- if (bi->ramDisk)
- space = bi->ramDisk + bi->ramDiskSize;
+ /* Move klimit to enclose device tree, args, ramdisk, etc... */
+ if (bi->version < 5) {
+ space = bi->deviceTreeOffset + bi->deviceTreeSize;
+ if (bi->ramDisk)
+ space = bi->ramDisk + bi->ramDiskSize;
+ } else
+ space = bi->totalParamsSize;
RELOC(klimit) = PTRUNRELOC((char *) bi + space);
/* New BootX will have flushed all TLBs and enters kernel with
@@ -748,8 +753,6 @@
{
unsigned long mem = (unsigned long) klimit;
- if (boot_infos)
- relocate_nodes();
mem = finish_node(allnodes, mem, NULL);
printk(KERN_INFO "device tree used %lu bytes\n",
mem - (unsigned long) allnodes);
@@ -843,7 +846,7 @@
* This procedure updates the pointers.
*/
__init
-static void relocate_nodes(void)
+void relocate_nodes(void)
{
unsigned long base;
struct device_node *np;
@@ -1183,6 +1186,23 @@
return 0;
}
+
+/*
+ * Indicates whether the root node has a given value in its
+ * compatible property.
+ */
+__openfirmware
+int
+machine_is_compatible(const char *compat)
+{
+ struct device_node *root;
+
+ root = find_path_device("/");
+ if (root == 0)
+ return 0;
+ return device_is_compatible(root, compat);
+}
+
/*
* Construct and return a list of the device_nodes with a given type
* and compatible property.
@@ -1316,7 +1336,8 @@
unsigned long *outputs, ...)
{
va_list list;
- int i, s;
+ int i;
+ unsigned long s;
struct device_node *rtas;
int *tokp;
union {
@@ -1361,19 +1382,41 @@
prom_exit();
}
+#ifdef CONFIG_XMON
+__init
+void
+map_bootx_text(void)
+{
+ if (boot_infos == 0)
+ return;
+ boot_infos->logicalDisplayBase =
+ ioremap((unsigned long) boot_infos->dispDeviceBase,
+ boot_infos->dispDeviceRowBytes * boot_infos->dispDeviceRect[3]);
+}
+#endif /* CONFIG_XMON */
+
/* Calc the base address of a given point (x,y) */
-#define CALC_BASE(x,y) ((BOOT_INFO_IS_V2_COMPATIBLE(bi) ? bi->logicalDisplayBase : \
- bi->dispDeviceBase) + (bi->dispDeviceRect[0] + (x)) * \
- (bi->dispDeviceDepth >> 3) + bi->dispDeviceRowBytes * \
- ((y) + bi->dispDeviceRect[1]))
+__pmac
+static unsigned char *
+calc_base(boot_infos_t *bi, int x, int y)
+{
+ unsigned char *base;
-__init
+ base = bi->logicalDisplayBase;
+ if (base == 0)
+ base = bi->dispDeviceBase;
+ base += (x + bi->dispDeviceRect[0]) * (bi->dispDeviceDepth >> 3);
+ base += (y + bi->dispDeviceRect[1]) * bi->dispDeviceRowBytes;
+ return base;
+}
+
+__pmac
static void
clearscreen(void)
{
unsigned long offset = reloc_offset();
boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
- unsigned long *base = (unsigned long *)CALC_BASE(0,0);
+ unsigned long *base = (unsigned long *)calc_base(bi, 0, 0);
unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
(bi->dispDeviceDepth >> 3)) >> 2;
int i,j;
@@ -1392,13 +1435,13 @@
__asm__ __volatile__ ("dcbst 0,%0" :: "r" (addr));
}
-__init
+__pmac
static void
flushscreen(void)
{
unsigned long offset = reloc_offset();
boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
- unsigned long *base = (unsigned long *)CALC_BASE(0,0);
+ unsigned long *base = (unsigned long *)calc_base(bi, 0, 0);
unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
(bi->dispDeviceDepth >> 3)) >> 2;
int i,j;
@@ -1416,14 +1459,14 @@
#ifdef CONFIG_BOOTX_TEXT
-__init
+__pmac
static void
scrollscreen(void)
{
unsigned long offset = reloc_offset();
boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
- unsigned long *src = (unsigned long *)CALC_BASE(0,16);
- unsigned long *dst = (unsigned long *)CALC_BASE(0,0);
+ unsigned long *src = (unsigned long *)calc_base(bi,0,16);
+ unsigned long *dst = (unsigned long *)calc_base(bi,0,0);
unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
(bi->dispDeviceDepth >> 3)) >> 2;
int i,j;
@@ -1446,21 +1489,33 @@
}
}
-__init
-static void
+__pmac
+void
drawchar(char c)
{
unsigned long offset = reloc_offset();
- switch(c) {
- case '\r': RELOC(g_loc_X) = 0; break;
- case '\n': RELOC(g_loc_X) = 0; RELOC(g_loc_Y)++; break;
- default:
- draw_byte(c, RELOC(g_loc_X)++, RELOC(g_loc_Y));
- if (RELOC(g_loc_X) >= RELOC(g_max_loc_X)) {
- RELOC(g_loc_X) = 0;
- RELOC(g_loc_Y)++;
- }
+ switch (c) {
+ case '\b':
+ if (RELOC(g_loc_X) > 0)
+ --RELOC(g_loc_X);
+ break;
+ case '\t':
+ RELOC(g_loc_X) = (RELOC(g_loc_X) & -8) + 8;
+ break;
+ case '\r':
+ RELOC(g_loc_X) = 0;
+ break;
+ case '\n':
+ RELOC(g_loc_X) = 0;
+ RELOC(g_loc_Y)++;
+ break;
+ default:
+ draw_byte(c, RELOC(g_loc_X)++, RELOC(g_loc_Y));
+ }
+ if (RELOC(g_loc_X) >= RELOC(g_max_loc_X)) {
+ RELOC(g_loc_X) = 0;
+ RELOC(g_loc_Y)++;
}
while (RELOC(g_loc_Y) >= RELOC(g_max_loc_Y)) {
scrollscreen();
@@ -1468,15 +1523,15 @@
}
}
-__init
-static void
+__pmac
+void
drawstring(const char *c)
{
- while(*c)
- drawchar(*(c++));
+ while (*c)
+ drawchar(*c++);
}
-__init
+__pmac
static void
drawhex(unsigned long v)
{
@@ -1494,13 +1549,13 @@
}
-__init
+__pmac
static void
draw_byte(unsigned char c, long locX, long locY)
{
unsigned long offset = reloc_offset();
boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
- unsigned char *base = CALC_BASE(locX << 3, locY << 4);
+ unsigned char *base = calc_base(bi, locX << 3, locY << 4);
unsigned char *font = &RELOC(vga_font)[((unsigned long)c) * 16];
switch(bi->dispDeviceDepth) {
@@ -1518,7 +1573,7 @@
}
}
-__init
+__pmac
static unsigned long expand_bits_8[16] = {
0x00000000,
0x000000ff,
@@ -1538,7 +1593,7 @@
0xffffffff
};
-__init
+__pmac
static unsigned long expand_bits_16[4] = {
0x00000000,
0x0000ffff,
@@ -1547,7 +1602,7 @@
};
-__init
+__pmac
static void
draw_byte_32(unsigned char *font, unsigned long *base)
{
@@ -1573,7 +1628,7 @@
}
}
-__init
+__pmac
static void
draw_byte_16(unsigned char *font, unsigned long *base)
{
@@ -1595,7 +1650,7 @@
}
}
-__init
+__pmac
static void
draw_byte_8(unsigned char *font, unsigned long *base)
{
@@ -1615,7 +1670,7 @@
}
}
-__init
+__pmac
static unsigned char vga_font[cmapsz] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd,
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)