mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-21 11:13:30 +00:00
Remove local devmap code and use the essentially identical common code
that got moved from imx_machdep.c to arm/devmap.c.
This commit is contained in:
parent
0f7191e8ad
commit
81acdf3f63
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=257678
@ -34,26 +34,58 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/bus.h>
|
||||
#include <sys/reboot.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/devmap.h>
|
||||
#include <machine/machdep.h>
|
||||
|
||||
#include <arm/freescale/imx/imx_machdep.h>
|
||||
|
||||
vm_offset_t
|
||||
initarm_lastaddr(void)
|
||||
{
|
||||
|
||||
return (arm_devmap_lastaddr());
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
/* XXX - Get rid of this stuff soon. */
|
||||
boothowto |= RB_VERBOSE|RB_MULTIPLE;
|
||||
bootverbose = 1;
|
||||
}
|
||||
|
||||
void
|
||||
initarm_gpio_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
initarm_late_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up static device mappings. This is hand-optimized platform-specific
|
||||
* config data which covers most of the common on-chip devices with a few 1MB
|
||||
* section mappings.
|
||||
*
|
||||
* Notably missing are entries for GPU, IPU, in general anything video related.
|
||||
*
|
||||
* Note that for imx this is called from initarm_lastaddr() so that the lowest
|
||||
* kva address used for static device mapping can be known at that point.
|
||||
*/
|
||||
void
|
||||
imx_devmap_init(void)
|
||||
int
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
|
||||
imx_devmap_addentry(0x70000000, 0x00100000);
|
||||
imx_devmap_addentry(0x73f00000, 0x00100000);
|
||||
imx_devmap_addentry(0x83f00000, 0x00100000);
|
||||
arm_devmap_add_entry(0x70000000, 0x00100000);
|
||||
arm_devmap_add_entry(0x73f00000, 0x00100000);
|
||||
arm_devmap_add_entry(0x83f00000, 0x00100000);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -34,26 +34,57 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/bus.h>
|
||||
#include <sys/reboot.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/devmap.h>
|
||||
#include <machine/machdep.h>
|
||||
#include <arm/freescale/imx/imx_machdep.h>
|
||||
|
||||
vm_offset_t
|
||||
initarm_lastaddr(void)
|
||||
{
|
||||
|
||||
return (arm_devmap_lastaddr());
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
/* XXX - Get rid of this stuff soon. */
|
||||
boothowto |= RB_VERBOSE|RB_MULTIPLE;
|
||||
bootverbose = 1;
|
||||
}
|
||||
|
||||
void
|
||||
initarm_gpio_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
initarm_late_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up static device mappings. This is hand-optimized platform-specific
|
||||
* config data which covers most of the common on-chip devices with a few 1MB
|
||||
* section mappings.
|
||||
*
|
||||
* Notably missing are entries for GPU, IPU, in general anything video related.
|
||||
*
|
||||
* Note that for imx this is called from initarm_lastaddr() so that the lowest
|
||||
* kva address used for static device mapping can be known at that point.
|
||||
*/
|
||||
void
|
||||
imx_devmap_init(void)
|
||||
int
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
|
||||
imx_devmap_addentry(0x50000000, 0x00100000);
|
||||
imx_devmap_addentry(0x53f00000, 0x00100000);
|
||||
imx_devmap_addentry(0x63f00000, 0x00100000);
|
||||
arm_devmap_add_entry(0x50000000, 0x00100000);
|
||||
arm_devmap_add_entry(0x53f00000, 0x00100000);
|
||||
arm_devmap_add_entry(0x63f00000, 0x00100000);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -35,19 +35,45 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/reboot.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/devmap.h>
|
||||
#include <machine/machdep.h>
|
||||
|
||||
#include <arm/freescale/imx/imx6_anatopreg.h>
|
||||
#include <arm/freescale/imx/imx6_anatopvar.h>
|
||||
#include <arm/freescale/imx/imx_machdep.h>
|
||||
|
||||
vm_offset_t
|
||||
initarm_lastaddr(void)
|
||||
{
|
||||
|
||||
return (arm_devmap_lastaddr());
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
/* XXX - Get rid of this stuff soon. */
|
||||
boothowto |= RB_VERBOSE|RB_MULTIPLE;
|
||||
bootverbose = 1;
|
||||
}
|
||||
|
||||
void
|
||||
initarm_gpio_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
initarm_late_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up static device mappings. Note that for imx this is called from
|
||||
* initarm_lastaddr() so that it can return the lowest address used for static
|
||||
* device mapping, maximizing kva space.
|
||||
* Set up static device mappings.
|
||||
*
|
||||
* This attempts to cover the most-used devices with 1MB section mappings, which
|
||||
* is good for performance (uses fewer TLB entries for device access).
|
||||
@ -62,8 +88,8 @@ __FBSDID("$FreeBSD$");
|
||||
* static map some of that area. Be careful with other things in that area such
|
||||
* as OCRAM that probably shouldn't be mapped as PTE_DEVICE memory.
|
||||
*/
|
||||
void
|
||||
imx_devmap_init(void)
|
||||
int
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
const uint32_t IMX6_ARMMP_PHYS = 0x00a00000;
|
||||
const uint32_t IMX6_ARMMP_SIZE = 0x00100000;
|
||||
@ -72,9 +98,11 @@ imx_devmap_init(void)
|
||||
const uint32_t IMX6_AIPS2_PHYS = 0x02100000;
|
||||
const uint32_t IMX6_AIPS2_SIZE = 0x00100000;
|
||||
|
||||
imx_devmap_addentry(IMX6_ARMMP_PHYS, IMX6_ARMMP_SIZE);
|
||||
imx_devmap_addentry(IMX6_AIPS1_PHYS, IMX6_AIPS1_SIZE);
|
||||
imx_devmap_addentry(IMX6_AIPS2_PHYS, IMX6_AIPS2_SIZE);
|
||||
arm_devmap_add_entry(IMX6_ARMMP_PHYS, IMX6_ARMMP_SIZE);
|
||||
arm_devmap_add_entry(IMX6_AIPS1_PHYS, IMX6_AIPS1_SIZE);
|
||||
arm_devmap_add_entry(IMX6_AIPS2_PHYS, IMX6_AIPS2_SIZE);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -45,99 +45,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <arm/freescale/imx/imx_machdep.h>
|
||||
#include <arm/freescale/imx/imx_wdogreg.h>
|
||||
|
||||
#define IMX_MAX_DEVMAP_ENTRIES 8
|
||||
|
||||
static struct arm_devmap_entry devmap_entries[IMX_MAX_DEVMAP_ENTRIES];
|
||||
static u_int devmap_idx;
|
||||
static vm_offset_t devmap_vaddr = ARM_VECTORS_HIGH;
|
||||
|
||||
void
|
||||
imx_devmap_addentry(vm_paddr_t pa, vm_size_t sz)
|
||||
{
|
||||
struct arm_devmap_entry *m;
|
||||
|
||||
/*
|
||||
* The last table entry is the all-zeroes end-of-table marker. If we're
|
||||
* about to overwrite it the world is coming to an end. This code runs
|
||||
* too early for the panic to be printed unless a special early-debug
|
||||
* console is in use, but there's nothing else we can do.
|
||||
*/
|
||||
if (devmap_idx == (IMX_MAX_DEVMAP_ENTRIES - 1))
|
||||
panic("IMX_MAX_DEVMAP_ENTRIES is too small!\n");
|
||||
|
||||
/*
|
||||
* Allocate virtual address space from the top of kva downwards. If the
|
||||
* range being mapped is aligned and sized to 1MB boundaries then also
|
||||
* align the virtual address to the next-lower 1MB boundary so that we
|
||||
* end up with a section mapping.
|
||||
*/
|
||||
if ((pa & 0x000fffff) == 0 && (sz & 0x000fffff) == 0) {
|
||||
devmap_vaddr = (devmap_vaddr - sz) & ~0x000fffff;
|
||||
} else {
|
||||
devmap_vaddr = (devmap_vaddr - sz) & ~0x00000fff;
|
||||
}
|
||||
m = &devmap_entries[devmap_idx++];
|
||||
m->pd_va = devmap_vaddr;
|
||||
m->pd_pa = pa;
|
||||
m->pd_size = sz;
|
||||
m->pd_prot = VM_PROT_READ | VM_PROT_WRITE;
|
||||
m->pd_cache = PTE_DEVICE;
|
||||
}
|
||||
|
||||
vm_offset_t
|
||||
initarm_lastaddr(void)
|
||||
{
|
||||
|
||||
return (devmap_vaddr);
|
||||
}
|
||||
|
||||
void
|
||||
initarm_early_init(void)
|
||||
{
|
||||
|
||||
/* XXX - Get rid of this stuff soon. */
|
||||
boothowto |= RB_VERBOSE|RB_MULTIPLE;
|
||||
bootverbose = 1;
|
||||
}
|
||||
|
||||
int
|
||||
initarm_devmap_init(void)
|
||||
{
|
||||
|
||||
imx_devmap_init();
|
||||
arm_devmap_register_table(devmap_entries);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set initial values of GPIO output ports
|
||||
*/
|
||||
void
|
||||
initarm_gpio_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
initarm_late_init(void)
|
||||
{
|
||||
struct arm_devmap_entry *m;
|
||||
|
||||
/*
|
||||
* We did the static devmap setup earlier, during initarm_lastaddr(),
|
||||
* but now the console should be working and we can be verbose about
|
||||
* what we did.
|
||||
*/
|
||||
if (bootverbose) {
|
||||
for (m = devmap_entries; m->pd_va != 0; ++m) {
|
||||
printf("Devmap: phys 0x%08x virt 0x%08x size %uK\n",
|
||||
m->pd_pa, m->pd_va, m->pd_size / 1024);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
struct arm32_dma_range *
|
||||
bus_dma_get_range(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user