Rev 3022 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3022 | Rev 4055 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | /** @addtogroup ppc32mm |
29 | /** @addtogroup ppc32mm |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | */ |
33 | */ |
34 | 34 | ||
Line 45... | Line 45... | ||
45 | } |
45 | } |
46 | 46 | ||
47 | 47 | ||
48 | uintptr_t hw_map(uintptr_t physaddr, size_t size) |
48 | uintptr_t hw_map(uintptr_t physaddr, size_t size) |
49 | { |
49 | { |
50 | if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) |
50 | if (last_frame + ALIGN_UP(size, PAGE_SIZE) > |
- | 51 | KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) |
|
51 | panic("Unable to map physical memory %p (%d bytes)", physaddr, size) |
52 | panic("Unable to map physical memory %p (%" PRIs " bytes).", |
- | 53 | physaddr, size) |
|
52 | 54 | ||
53 | uintptr_t virtaddr = PA2KA(last_frame); |
55 | uintptr_t virtaddr = PA2KA(last_frame); |
54 | pfn_t i; |
56 | pfn_t i; |
55 | for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) |
57 | for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) |
- | 58 | page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), |
|
56 | page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE | PAGE_WRITE); |
59 | physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE | PAGE_WRITE); |
57 | 60 | ||
58 | last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); |
61 | last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); |
59 | 62 | ||
60 | return virtaddr; |
63 | return virtaddr; |
61 | } |
64 | } |