Rev 2246 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2246 | Rev 2398 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | #include <arch/byteorder.h> |
41 | #include <arch/byteorder.h> |
42 | #include <mm/frame.h> |
42 | #include <mm/frame.h> |
43 | #include <sysinfo/sysinfo.h> |
43 | #include <sysinfo/sysinfo.h> |
44 | #include <ddi/ddi.h> |
44 | #include <ddi/ddi.h> |
45 | #include <print.h> |
45 | #include <print.h> |
- | 46 | #include <align.h> |
|
46 | 47 | ||
47 | static parea_t rd_parea; /**< Physical memory area for rd. */ |
48 | static parea_t rd_parea; /**< Physical memory area for rd. */ |
48 | 49 | ||
49 | int init_rd(rd_header * header, size_t size) |
50 | int init_rd(rd_header * header, size_t size) |
50 | { |
51 | { |
Line 82... | Line 83... | ||
82 | printf("Header size %d\n",header->header_size); |
83 | printf("Header size %d\n",header->header_size); |
83 | printf("Data size %d\n",header->data_size); |
84 | printf("Data size %d\n",header->data_size); |
84 | printf("Size %d\n",size); |
85 | printf("Size %d\n",size); |
85 | 86 | ||
86 | //jelen: does this make any sense? (we don't even care about the header size, do we?) |
87 | //jelen: does this make any sense? (we don't even care about the header size, do we?) |
- | 88 | /* |
|
87 | /*if ((hsize % FRAME_SIZE) || (dsize % FRAME_SIZE)) |
89 | if ((hsize % FRAME_SIZE) || (dsize % FRAME_SIZE)) |
88 | return RE_UNSUPPORTED; |
90 | return RE_UNSUPPORTED; |
89 | */ |
91 | */ |
90 | if (dsize % FRAME_SIZE) |
92 | if (dsize % FRAME_SIZE) |
91 | return RE_UNSUPPORTED; |
93 | return RE_UNSUPPORTED; |
92 | 94 | ||
Line 94... | Line 96... | ||
94 | return RE_INVALID; |
96 | return RE_INVALID; |
95 | 97 | ||
96 | if ((uint64_t) hsize + dsize > size) |
98 | if ((uint64_t) hsize + dsize > size) |
97 | dsize = size - hsize; |
99 | dsize = size - hsize; |
98 | 100 | ||
- | 101 | ||
99 | rd_parea.pbase = KA2PA((void *) header + hsize); |
102 | rd_parea.pbase = ALIGN_DOWN((uintptr_t)KA2PA((void *) header + hsize), FRAME_SIZE); |
100 | rd_parea.vbase = (uintptr_t) ((void *) header + hsize); |
103 | rd_parea.vbase = (uintptr_t) ((void *) header + hsize); |
101 | rd_parea.frames = SIZE2FRAMES(dsize); |
104 | rd_parea.frames = SIZE2FRAMES(dsize); |
102 | rd_parea.cacheable = true; |
105 | rd_parea.cacheable = true; |
103 | ddi_parea_register(&rd_parea); |
106 | ddi_parea_register(&rd_parea); |
104 | 107 | ||
- | 108 | ||
105 | sysinfo_set_item_val("rd", NULL, true); |
109 | sysinfo_set_item_val("rd", NULL, true); |
- | 110 | sysinfo_set_item_val("rd.header_size", NULL, hsize); |
|
106 | sysinfo_set_item_val("rd.size", NULL, dsize); |
111 | sysinfo_set_item_val("rd.size", NULL, dsize); |
107 | sysinfo_set_item_val("rd.address.physical", NULL, (unative_t) |
112 | sysinfo_set_item_val("rd.address.physical", NULL, (unative_t) |
108 | KA2PA((void *) header + hsize)); |
113 | KA2PA((void *) header + hsize)); |
109 | sysinfo_set_item_val("rd.address.color", NULL, (unative_t) |
114 | sysinfo_set_item_val("rd.address.color", NULL, (unative_t) |
110 | PAGE_COLOR((uintptr_t) header + hsize)); |
115 | PAGE_COLOR((uintptr_t) header + hsize)); |