Use the correct type for physical addresses.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37219 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6a76b51960
commit
3553f1894d
@ -105,11 +105,12 @@ AHCIController::Init()
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *addr = (void *)pciInfo.u.h0.base_registers[5];
|
phys_addr_t addr = pciInfo.u.h0.base_registers[5];
|
||||||
size_t size = pciInfo.u.h0.base_register_sizes[5];
|
size_t size = pciInfo.u.h0.base_register_sizes[5];
|
||||||
|
|
||||||
TRACE("registers at %p, size %#lx\n", addr, size);
|
TRACE("registers at %#" B_PRIxPHYSADDR ", size %#" B_PRIxSIZE "\n", addr,
|
||||||
if (!addr) {
|
size);
|
||||||
|
if (addr == 0) {
|
||||||
TRACE("PCI base address register 5 not assigned\n");
|
TRACE("PCI base address register 5 not assigned\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -75,9 +75,9 @@ AHCIPort::Init1()
|
|||||||
+ sizeof(prd) * PRD_TABLE_ENTRY_COUNT;
|
+ sizeof(prd) * PRD_TABLE_ENTRY_COUNT;
|
||||||
|
|
||||||
char *virtAddr;
|
char *virtAddr;
|
||||||
char *physAddr;
|
phys_addr_t physAddr;
|
||||||
|
|
||||||
fArea = alloc_mem((void **)&virtAddr, (void **)&physAddr, size, 0,
|
fArea = alloc_mem((void **)&virtAddr, &physAddr, size, 0,
|
||||||
"some AHCI port");
|
"some AHCI port");
|
||||||
if (fArea < B_OK) {
|
if (fArea < B_OK) {
|
||||||
TRACE("failed allocating memory for port %d\n", fIndex);
|
TRACE("failed allocating memory for port %d\n", fIndex);
|
||||||
|
@ -22,10 +22,9 @@ round_to_pagesize(uint32 size)
|
|||||||
|
|
||||||
|
|
||||||
area_id
|
area_id
|
||||||
alloc_mem(void **virt, void **phy, size_t size, uint32 protection,
|
alloc_mem(void **virt, phys_addr_t *phy, size_t size, uint32 protection,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
// TODO: phy should be phys_addr_t*!
|
|
||||||
physical_entry pe;
|
physical_entry pe;
|
||||||
void * virtadr;
|
void * virtadr;
|
||||||
area_id areaid;
|
area_id areaid;
|
||||||
@ -49,7 +48,7 @@ alloc_mem(void **virt, void **phy, size_t size, uint32 protection,
|
|||||||
if (virt)
|
if (virt)
|
||||||
*virt = virtadr;
|
*virt = virtadr;
|
||||||
if (phy)
|
if (phy)
|
||||||
*phy = (void*)(addr_t)pe.address;
|
*phy = pe.address;
|
||||||
TRACE("area = %ld, size = %ld, virt = %p, phy = %#" B_PRIxPHYSADDR "\n",
|
TRACE("area = %ld, size = %ld, virt = %p, phy = %#" B_PRIxPHYSADDR "\n",
|
||||||
areaid, size, virtadr, pe.address);
|
areaid, size, virtadr, pe.address);
|
||||||
return areaid;
|
return areaid;
|
||||||
@ -57,20 +56,21 @@ alloc_mem(void **virt, void **phy, size_t size, uint32 protection,
|
|||||||
|
|
||||||
|
|
||||||
area_id
|
area_id
|
||||||
map_mem(void **virt, void *phy, size_t size, uint32 protection,
|
map_mem(void **virt, phys_addr_t phy, size_t size, uint32 protection,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
uint32 offset;
|
uint32 offset;
|
||||||
void *phyadr;
|
phys_addr_t phyadr;
|
||||||
void *mapadr;
|
void *mapadr;
|
||||||
area_id area;
|
area_id area;
|
||||||
|
|
||||||
TRACE("mapping physical address %p with %ld bytes for %s\n", phy, size, name);
|
TRACE("mapping physical address %#" B_PRIxPHYSADDR " with %" B_PRIuSIZE
|
||||||
|
" bytes for %s\n", phy, size, name);
|
||||||
|
|
||||||
offset = (uint32)phy & (B_PAGE_SIZE - 1);
|
offset = phy & (B_PAGE_SIZE - 1);
|
||||||
phyadr = (char *)phy - offset;
|
phyadr = phy - offset;
|
||||||
size = round_to_pagesize(size + offset);
|
size = round_to_pagesize(size + offset);
|
||||||
area = map_physical_memory(name, (addr_t)phyadr, size,
|
area = map_physical_memory(name, phyadr, size,
|
||||||
B_ANY_KERNEL_BLOCK_ADDRESS, protection, &mapadr);
|
B_ANY_KERNEL_BLOCK_ADDRESS, protection, &mapadr);
|
||||||
if (area < B_OK) {
|
if (area < B_OK) {
|
||||||
ERROR("mapping '%s' failed, error 0x%lx (%s)\n", name, area, strerror(area));
|
ERROR("mapping '%s' failed, error 0x%lx (%s)\n", name, area, strerror(area));
|
||||||
@ -79,8 +79,9 @@ map_mem(void **virt, void *phy, size_t size, uint32 protection,
|
|||||||
|
|
||||||
*virt = (char *)mapadr + offset;
|
*virt = (char *)mapadr + offset;
|
||||||
|
|
||||||
TRACE("physical = %p, virtual = %p, offset = %ld, phyadr = %p, mapadr = %p, size = %ld, area = 0x%08lx\n",
|
TRACE("physical = %#" B_PRIxPHYSADDR ", virtual = %p, offset = %ld, "
|
||||||
phy, *virt, offset, phyadr, mapadr, size, area);
|
"phyadr = %#" B_PRIxPHYSADDR ", mapadr = %p, size = %ld, area = "
|
||||||
|
"0x%08lx\n", phy, *virt, offset, phyadr, mapadr, size, area);
|
||||||
|
|
||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,10 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
area_id alloc_mem(void **virt, void **phy, size_t size, uint32 protection, const char *name);
|
area_id alloc_mem(void **virt, phys_addr_t *phy, size_t size, uint32 protection,
|
||||||
area_id map_mem(void **virt, void *phy, size_t size, uint32 protection, const char *name);
|
const char *name);
|
||||||
|
area_id map_mem(void **virt, phys_addr_t phy, size_t size, uint32 protection,
|
||||||
|
const char *name);
|
||||||
|
|
||||||
status_t sg_memcpy(const physical_entry *sgTable, int sgCount, const void *data, size_t dataSize);
|
status_t sg_memcpy(const physical_entry *sgTable, int sgCount, const void *data, size_t dataSize);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user