[OpenBIOS] [commit] r1008 - in trunk/openbios-devel: arch/sparc32 drivers include/libopenbios
repository service
svn at openbios.org
Sun Jan 2 01:07:22 CET 2011
Author: mcayland
Date: Sun Jan 2 01:07:19 2011
New Revision: 1008
URL: http://tracker.coreboot.org/trac/openbios/changeset/1008
Log:
Switch all SPARC32 devices over from the private map_io() function over to OFMEM's ofmem_map_io() function.
The old map_io() function can now be removed. Also fill in ofmem_arch_early_map_pages() on SPARC32 which is
required for ofmem_map_io() to work correctly.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>
Tested-by: Blue Swirl <blauwirbel at gmail.com>
Reviewed-by: Blue Swirl <blauwirbel at gmail.com>
Modified:
trunk/openbios-devel/arch/sparc32/console.c
trunk/openbios-devel/arch/sparc32/lib.c
trunk/openbios-devel/drivers/escc.c
trunk/openbios-devel/drivers/esp.c
trunk/openbios-devel/drivers/fw_cfg.c
trunk/openbios-devel/drivers/iommu.c
trunk/openbios-devel/drivers/obio.c
trunk/openbios-devel/drivers/sbus.c
trunk/openbios-devel/include/libopenbios/ofmem.h
Modified: trunk/openbios-devel/arch/sparc32/console.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/console.c Sun Jan 2 01:06:59 2011 (r1007)
+++ trunk/openbios-devel/arch/sparc32/console.c Sun Jan 2 01:07:19 2011 (r1008)
@@ -46,8 +46,8 @@
void tcx_init(uint64_t base)
{
- vmem = map_io(base + VMEM_BASE, VMEM_SIZE);
- dac = map_io(base + DAC_BASE, DAC_SIZE);
+ vmem = (unsigned char *)ofmem_map_io(base + VMEM_BASE, VMEM_SIZE);
+ dac = (uint32_t *)ofmem_map_io(base + DAC_BASE, DAC_SIZE);
console_init();
}
Modified: trunk/openbios-devel/arch/sparc32/lib.c
==============================================================================
--- trunk/openbios-devel/arch/sparc32/lib.c Sun Jan 2 01:06:59 2011 (r1007)
+++ trunk/openbios-devel/arch/sparc32/lib.c Sun Jan 2 01:07:19 2011 (r1008)
@@ -218,29 +218,6 @@
}
/*
- * Create an I/O mapping to pa[size].
- * Returns va of the mapping or 0 if unsuccessful.
- */
-void *
-map_io(uint64_t pa, int size)
-{
- unsigned long va;
- unsigned int npages;
- unsigned int off;
-
- off = pa & (PAGE_SIZE - 1);
- npages = (off + size - 1) / PAGE_SIZE + 1;
- pa &= ~(PAGE_SIZE - 1);
-
- va = (unsigned long)mem_alloc(&cio, npages * PAGE_SIZE, PAGE_SIZE);
- if (va == 0)
- return NULL;
-
- map_pages(pa, va, npages * PAGE_SIZE, ofmem_arch_io_translation_mode(pa));
- return (void *)(va + off);
-}
-
-/*
* D5.3 pgmap@ ( va -- pte )
*/
static void
@@ -371,7 +348,7 @@
void ofmem_arch_early_map_pages(phys_addr_t phys, ucell virt, ucell size, ucell mode)
{
- /* Currently do nothing */
+ map_pages(phys, virt, size, mode);
}
char *obp_dumb_memalloc(char *va, unsigned int size)
Modified: trunk/openbios-devel/drivers/escc.c
==============================================================================
--- trunk/openbios-devel/drivers/escc.c Sun Jan 2 01:06:59 2011 (r1007)
+++ trunk/openbios-devel/drivers/escc.c Sun Jan 2 01:07:19 2011 (r1008)
@@ -105,7 +105,7 @@
int uart_init(phys_addr_t port, unsigned long speed)
{
#ifdef CONFIG_DRIVER_ESCC_SUN
- serial_dev = map_io(port & ~7ULL, ZS_REGS);
+ serial_dev = (unsigned char *)ofmem_map_io(port & ~7ULL, ZS_REGS);
serial_dev += port & 7ULL;
#else
serial_dev = (unsigned char *)(uintptr_t)port;
@@ -213,7 +213,7 @@
void kbd_init(phys_addr_t base)
{
- kbd_dev = map_io(base, 2 * 4);
+ kbd_dev = (unsigned char *)ofmem_map_io(base, 2 * 4);
kbd_dev += 4;
}
Modified: trunk/openbios-devel/drivers/esp.c
==============================================================================
--- trunk/openbios-devel/drivers/esp.c Sun Jan 2 01:06:59 2011 (r1007)
+++ trunk/openbios-devel/drivers/esp.c Sun Jan 2 01:07:19 2011 (r1008)
@@ -311,7 +311,7 @@
espdma_init(unsigned int slot, uint64_t base, unsigned long offset,
struct esp_dma *espdma)
{
- espdma->regs = (void *)map_io(base + (uint64_t)offset, 0x10);
+ espdma->regs = (void *)ofmem_map_io(base + (uint64_t)offset, 0x10);
if (espdma->regs == NULL) {
DPRINTF("espdma_init: cannot map registers\n");
@@ -445,7 +445,7 @@
return -1;
}
/* Get the IO region */
- esp->ll = (void *)map_io(base + (uint64_t)espoffset,
+ esp->ll = (void *)ofmem_map_io(base + (uint64_t)espoffset,
sizeof(struct esp_regs));
if (esp->ll == NULL) {
DPRINTF("Can't map ESP registers\n");
Modified: trunk/openbios-devel/drivers/fw_cfg.c
==============================================================================
--- trunk/openbios-devel/drivers/fw_cfg.c Sun Jan 2 01:06:59 2011 (r1007)
+++ trunk/openbios-devel/drivers/fw_cfg.c Sun Jan 2 01:07:19 2011 (r1008)
@@ -65,7 +65,7 @@
fw_cfg_init(void)
{
#if defined(CONFIG_SPARC32)
- fw_cfg_cmd = (void *)map_io(CONFIG_FW_CFG_ADDR, 2);
+ fw_cfg_cmd = (void *)ofmem_map_io(CONFIG_FW_CFG_ADDR, 2);
fw_cfg_data = (uint8_t *)fw_cfg_cmd + 2;
#elif defined(CONFIG_SPARC64)
// Nothing for the port version
Modified: trunk/openbios-devel/drivers/iommu.c
==============================================================================
--- trunk/openbios-devel/drivers/iommu.c Sun Jan 2 01:06:59 2011 (r1007)
+++ trunk/openbios-devel/drivers/iommu.c Sun Jan 2 01:07:19 2011 (r1008)
@@ -103,7 +103,7 @@
int ret;
unsigned long vasize;
- regs = map_io(base, IOMMU_REGS);
+ regs = (struct iommu_regs *)ofmem_map_io(base, IOMMU_REGS);
if (regs == NULL) {
DPRINTF("Cannot map IOMMU\n");
for (;;) { }
Modified: trunk/openbios-devel/drivers/obio.c
==============================================================================
--- trunk/openbios-devel/drivers/obio.c Sun Jan 2 01:06:59 2011 (r1007)
+++ trunk/openbios-devel/drivers/obio.c Sun Jan 2 01:07:19 2011 (r1008)
@@ -71,7 +71,7 @@
if (map) {
unsigned long addr;
- addr = (unsigned long)map_io(base + offset, size);
+ addr = (unsigned long)ofmem_map_io(base + offset, size);
PUSH(addr);
fword("encode-int");
@@ -251,7 +251,7 @@
power_reg = (void *)ob_reg(base, offset, AUXIO2_REGS, 1);
// Not in device tree
- reset_reg = map_io(base + (uint64_t)SLAVIO_RESET, RESET_REGS);
+ reset_reg = (unsigned int *)ofmem_map_io(base + (uint64_t)SLAVIO_RESET, RESET_REGS);
bind_func("sparc32-reset-all", sparc32_reset_all);
push_str("' sparc32-reset-all to reset-all");
@@ -297,7 +297,7 @@
fword("property");
- counter_regs = map_io(base + (uint64_t)offset, sizeof(*counter_regs));
+ counter_regs = (struct sun4m_timer_regs *)ofmem_map_io(base + (uint64_t)offset, sizeof(*counter_regs));
counter_regs->cfg = 0xffffffff;
counter_regs->l10_timer_limit = (((1000000/100) + 1) << 10);
counter_regs->cpu_timers[0].l14_timer_limit = 0;
@@ -352,7 +352,7 @@
push_str("reg");
fword("property");
- intregs = map_io(base | (uint64_t)offset, sizeof(*intregs));
+ intregs = (struct sun4m_intregs *)ofmem_map_io(base | (uint64_t)offset, sizeof(*intregs));
intregs->clear = ~SUN4M_INT_MASKALL;
intregs->cpu_intregs[0].clear = ~0x17fff;
@@ -403,7 +403,7 @@
ob_smp_init(unsigned long mem_size)
{
// See arch/sparc32/entry.S for memory layout
- smp_header = (struct smp_cfg *)map_io((uint64_t)(mem_size - 0x100),
+ smp_header = (struct smp_cfg *)ofmem_map_io((uint64_t)(mem_size - 0x100),
sizeof(struct smp_cfg));
}
Modified: trunk/openbios-devel/drivers/sbus.c
==============================================================================
--- trunk/openbios-devel/drivers/sbus.c Sun Jan 2 01:06:59 2011 (r1007)
+++ trunk/openbios-devel/drivers/sbus.c Sun Jan 2 01:07:19 2011 (r1008)
@@ -49,7 +49,7 @@
push_str("reg");
fword("property");
- regs = map_io(base, SBUS_REGS);
+ regs = (void *)ofmem_map_io(base, SBUS_REGS);
PUSH((unsigned long)regs);
fword("encode-int");
push_str("address");
Modified: trunk/openbios-devel/include/libopenbios/ofmem.h
==============================================================================
--- trunk/openbios-devel/include/libopenbios/ofmem.h Sun Jan 2 01:06:59 2011 (r1007)
+++ trunk/openbios-devel/include/libopenbios/ofmem.h Sun Jan 2 01:07:19 2011 (r1008)
@@ -136,7 +136,6 @@
void mem_init(struct mem *t, char *begin, char *limit);
void *mem_alloc(struct mem *t, int size, int align);
void map_pages(phys_addr_t phys, unsigned long virt, unsigned long size, unsigned long mode);
-void *map_io(uint64_t pa, int size);
#endif
#ifdef PAGE_SHIFT
More information about the OpenBIOS
mailing list