]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
pseries: Consolidate hack for RTAS display-character usage
authorDavid Gibson <david@gibson.dropbear.id.au>
Wed, 4 Apr 2012 05:02:07 +0000 (15:02 +1000)
committerAndreas Färber <afaerber@suse.de>
Sun, 15 Apr 2012 15:07:19 +0000 (17:07 +0200)
Currently the pseries machine contains not one but two somewhat ugly hacks
to allow printing of early debug messages before the guest has properly
read the device tree.

First, we special case H_PUT_TERM_CHAR so that a vtermno of 0 (usually
invalid) will look for a suitable vty and use that.  This supports Linux's
early debug code which will use H_PUT_TERM_CHAR with vtermno==0 before
reading the device tree.  Second, we support the RTAS display-character call.
This takes no vtermno so we assume the address of the default first VTY.

This patch makes things more consistent by folding the second hack into the
first.  Now, display-character uses the existing vty_lookup() function to
do the same search for a suitable VTY.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
hw/spapr_rtas.c
hw/spapr_vio.h
hw/spapr_vty.c

index 480a4ae9e486147e1d222be9e8edfed8833796a9..ae18595150a2c3a7a9ca342b46da29bdbf73bb73 100644 (file)
@@ -44,8 +44,7 @@ static void rtas_display_character(sPAPREnvironment *spapr,
                                    uint32_t nret, target_ulong rets)
 {
     uint8_t c = rtas_ld(args, 0);
-    VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus,
-                                                 SPAPR_VTY_BASE_ADDRESS);
+    VIOsPAPRDevice *sdev = vty_lookup(spapr, 0);
 
     if (!sdev) {
         rtas_st(rets, 0, -1);
index ae3283c19f86c31b2667f4ef625e160ee3cd5f95..fd29c5e2822bbd14819baab48b61cb0930a0cb8f 100644 (file)
@@ -117,6 +117,7 @@ uint64_t ldq_tce(VIOsPAPRDevice *dev, uint64_t taddr);
 
 int spapr_vio_send_crq(VIOsPAPRDevice *dev, uint8_t *crq);
 
+VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg);
 void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len);
 void spapr_vty_create(VIOsPAPRBus *bus, uint32_t reg, CharDriverState *chardev);
 void spapr_vlan_create(VIOsPAPRBus *bus, uint32_t reg, NICInfo *nd);
index 60e22b1600954916dea29b26bfc2c113b4fc1f74..a30c040b979c9e857f3cf046ecc36896e131bbd9 100644 (file)
@@ -70,8 +70,6 @@ static int spapr_vty_init(VIOsPAPRDevice *sdev)
 }
 
 /* Forward declaration */
-static VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg);
-
 static target_ulong h_put_term_char(CPUPPCState *env, sPAPREnvironment *spapr,
                                     target_ulong opcode, target_ulong *args)
 {
@@ -195,7 +193,7 @@ VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus)
     return selected;
 }
 
-static VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg)
+VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg)
 {
     VIOsPAPRDevice *sdev;