[OpenBIOS] [commit] r671 - in trunk/openbios-devel: arch/sparc64 include/sparc64
repository service
svn at openbios.org
Fri Jan 29 19:46:38 CET 2010
Author: blueswirl
Date: Fri Jan 29 19:46:38 2010
New Revision: 671
URL: http://tracker.coreboot.org/trac/openbios/changeset/671
Log:
QEMU changed PCI/IO port byte swapping, adapt OpenBIOS to new way
This requires an updated QEMU.
Also use little endian access ASIs.
Signed-off-by: Blue Swirl <blauwirbel at gmail.com>
Modified:
trunk/openbios-devel/arch/sparc64/entry.S
trunk/openbios-devel/include/sparc64/io.h
trunk/openbios-devel/include/sparc64/pci.h
Modified: trunk/openbios-devel/arch/sparc64/entry.S
==============================================================================
--- trunk/openbios-devel/arch/sparc64/entry.S Thu Jan 28 14:20:14 2010 (r670)
+++ trunk/openbios-devel/arch/sparc64/entry.S Fri Jan 29 19:46:38 2010 (r671)
@@ -59,7 +59,7 @@
! Check signature "QEMU"
setx CFG_ADDR, %g2, %g5
mov FW_CFG_SIGNATURE, %g2
- stha %g2, [%g5] ASI_PHYS_BYPASS_EC_E
+ stha %g2, [%g5] ASI_PHYS_BYPASS_EC_E_L
inc %g5
lduba [%g5] ASI_PHYS_BYPASS_EC_E, %g2
cmp %g2, 'Q'
@@ -99,7 +99,7 @@
! NB: little endian format
mov FW_CFG_RAM_SIZE, %g2
dec %g5
- stha %g2, [%g5] ASI_PHYS_BYPASS_EC_E
+ stha %g2, [%g5] ASI_PHYS_BYPASS_EC_E_L
inc %g5
lduba [%g5] ASI_PHYS_BYPASS_EC_E, %g4
Modified: trunk/openbios-devel/include/sparc64/io.h
==============================================================================
--- trunk/openbios-devel/include/sparc64/io.h Thu Jan 28 14:20:14 2010 (r670)
+++ trunk/openbios-devel/include/sparc64/io.h Fri Jan 29 19:46:38 2010 (r671)
@@ -56,6 +56,7 @@
/*
* 8, 16 and 32 bit, big and little endian I/O operations, with barrier.
+ * On Sparc64, BE versions must swap bytes using LE access ASI.
*/
static inline int in_8(volatile unsigned char *addr)
{
@@ -75,22 +76,19 @@
static inline int in_le16(volatile unsigned short *addr)
{
- int ret, tmp;
+ int ret;
- // XXX
__asm__ __volatile__("lduha [%1] 0x15, %0\n\t"
:"=r"(ret):"r"(addr):"memory");
- tmp = (ret << 8) & 0xff00;
- tmp |= (ret >> 8) & 0xff;
- return tmp;
+ return ret;
}
static inline int in_be16(volatile unsigned short *addr)
{
int ret;
- __asm__ __volatile__("lduha [%1] 0x15, %0\n\t"
+ __asm__ __volatile__("lduha [%1] 0x1d, %0\n\t"
:"=r"(ret):"r"(addr):"memory");
return ret;
@@ -98,61 +96,45 @@
static inline void out_le16(volatile unsigned short *addr, int val)
{
- unsigned tmp;
- // XXX
- tmp = (val << 8) & 0xff00;
- tmp |= (val >> 8) & 0xff;
__asm__ __volatile__("stha %0, [%1] 0x15\n\t"
- : : "r"(tmp), "r"(addr):"memory");
+ : : "r"(val), "r"(addr):"memory");
}
static inline void out_be16(volatile unsigned short *addr, int val)
{
- __asm__ __volatile__("stha %0, [%1] 0x15\n\t"
+ __asm__ __volatile__("stha %0, [%1] 0x1d\n\t"
: : "r"(val), "r"(addr):"memory");
}
static inline unsigned in_le32(volatile unsigned *addr)
{
- unsigned ret, tmp;
+ unsigned ret;
- // XXX
__asm__ __volatile__("lduwa [%1] 0x15, %0\n\t"
:"=r"(ret):"r"(addr):"memory");
- tmp = ret << 24;
- tmp |= (ret << 8) & 0xff0000;
- tmp |= (ret >> 8) & 0xff00;
- tmp |= (ret >> 24) & 0xff;
- return tmp;
+ return ret;
}
static inline unsigned in_be32(volatile unsigned *addr)
{
unsigned ret;
- __asm__ __volatile__("lduwa [%1] 0x15, %0\n\t"
+ __asm__ __volatile__("lduwa [%1] 0x1d, %0\n\t"
:"=r"(ret):"r"(addr):"memory");
-
return ret;
}
static inline void out_le32(volatile unsigned *addr, int val)
{
- unsigned tmp;
- // XXX
- tmp = val << 24;
- tmp |= (val << 8) & 0xff0000;
- tmp |= (val >> 8) & 0xff00;
- tmp |= (val >> 24) & 0xff;
__asm__ __volatile__("stwa %0, [%1] 0x15\n\t"
- : : "r"(tmp), "r"(addr):"memory");
+ : : "r"(val), "r"(addr):"memory");
}
static inline void out_be32(volatile unsigned *addr, int val)
{
- __asm__ __volatile__("stwa %0, [%1] 0x15\n\t"
+ __asm__ __volatile__("stwa %0, [%1] 0x1d\n\t"
: : "r"(val), "r"(addr):"memory");
}
Modified: trunk/openbios-devel/include/sparc64/pci.h
==============================================================================
--- trunk/openbios-devel/include/sparc64/pci.h Thu Jan 28 14:20:14 2010 (r670)
+++ trunk/openbios-devel/include/sparc64/pci.h Fri Jan 29 19:46:38 2010 (r671)
@@ -35,14 +35,14 @@
static inline uint16_t pci_config_read16(pci_addr dev, uint8_t reg)
{
uint16_t res;
- res = in_le16((uint16_t *)(PCI_CONFIG(dev) + reg));
+ res = in_be16((uint16_t *)(PCI_CONFIG(dev) + reg));
return res;
}
static inline uint32_t pci_config_read32(pci_addr dev, uint8_t reg)
{
uint32_t res;
- res = in_le32((uint32_t *)(PCI_CONFIG(dev) + reg));
+ res = in_be32((uint32_t *)(PCI_CONFIG(dev) + reg));
return res;
}
@@ -53,12 +53,12 @@
static inline void pci_config_write16(pci_addr dev, uint8_t reg, uint16_t val)
{
- out_le16((uint16_t *)(PCI_CONFIG(dev) + reg), val);
+ out_be16((uint16_t *)(PCI_CONFIG(dev) + reg), val);
}
static inline void pci_config_write32(pci_addr dev, uint8_t reg, uint32_t val)
{
- out_le32((uint32_t *)(PCI_CONFIG(dev) + reg), val);
+ out_be32((uint32_t *)(PCI_CONFIG(dev) + reg), val);
}
#else /* !PCI_CONFIG_1 */
#error PCI Configuration Mechanism is not specified or implemented
More information about the OpenBIOS
mailing list