Cleaned the memory initialization up, moved some defines from the framebuffer

to an include file.

Reviewed by:		imp
Approved by:		imp (mentor)
This commit is contained in:
rink 2006-02-10 18:48:22 +00:00
parent 170467b114
commit 34f7cafe2a
3 changed files with 18 additions and 20 deletions

View File

@ -1637,10 +1637,8 @@ getmemsize(int first)
* We queried the memory size before, so chop off 4MB for
* the framebuffer and inform the OS of this.
*/
extmem = (arch_i386_xbox_memsize - 4) * 1024;
basemem = 0;
physmap[0] = 0;
physmap[1] = extmem * 1024;
physmap[1] = (arch_i386_xbox_memsize * 1024 * 1024) - XBOX_FB_SIZE;
physmap_idx = 0;
goto physmap_done;
}

View File

@ -34,6 +34,11 @@
#define XBOX_LED_FLASHRED 0xa0
#define XBOX_LED_FLASHGREEN 0x03
#define XBOX_RAM_SIZE (arch_i386_xbox_memsize * 1024 * 1024)
#define XBOX_FB_SIZE (0x400000)
#define XBOX_FB_START (0xf0000000 | (XBOX_RAM_SIZE - XBOX_FB_SIZE))
#define XBOX_FB_START_PTR (0xFD600800)
extern int arch_i386_is_xbox;
extern uint32_t arch_i386_xbox_memsize; /* Megabytes */

View File

@ -69,11 +69,6 @@
#define CHAR_HEIGHT 16
#define CHAR_WIDTH 10
#define RAM_SIZE (arch_i386_xbox_memsize * 1024 * 1024)
#define FB_SIZE (0x400000)
#define FB_START (0xf0000000 | (RAM_SIZE - FB_SIZE))
#define FB_START_PTR (0xFD600800)
/* colours */
#define CONSOLE_COL 0xFF88FF88 /* greenish */
#define NORM_COL 0xFFAAAAAA /* grayish */
@ -179,14 +174,14 @@ xcon_real_putc(int basecol, int c)
}
scroll:
if (((xcon_yoffs + CHAR_HEIGHT) * SCREEN_WIDTH * SCREEN_BPP) > (FB_SIZE - SCREEN_SIZE)) {
if (((xcon_yoffs + CHAR_HEIGHT) * SCREEN_WIDTH * SCREEN_BPP) > (XBOX_FB_SIZE - SCREEN_SIZE)) {
/* we are about to run out of video memory, so move everything
* back to the beginning of the video memory */
memcpy ((char*)xcon_map,
(char*)(xcon_map + (xcon_yoffs * SCREEN_WIDTH * SCREEN_BPP)),
SCREEN_SIZE);
xcon_y -= xcon_yoffs; xcon_yoffs = 0;
*xcon_memstartptr = FB_START;
*xcon_memstartptr = XBOX_FB_START;
}
/* we achieve much faster scrolling by just altering the video memory
@ -195,7 +190,7 @@ xcon_real_putc(int basecol, int c)
while ((xcon_y - xcon_yoffs) >= SCREEN_HEIGHT) {
xcon_yoffs += CHAR_HEIGHT;
memset ((char*)(xcon_map + (xcon_y * SCREEN_WIDTH * SCREEN_BPP)), 0, CHAR_HEIGHT * SCREEN_WIDTH * SCREEN_BPP);
*xcon_memstartptr = FB_START + (xcon_yoffs * SCREEN_WIDTH * SCREEN_BPP);
*xcon_memstartptr = XBOX_FB_START + (xcon_yoffs * SCREEN_WIDTH * SCREEN_BPP);
}
}
@ -226,12 +221,12 @@ xcon_init(struct consdev* cp)
* and stored in a more sensible location ... but since we're not fully
* initialized, this is our only way to go :-(
*/
for (i = 0; i < (FB_SIZE / PAGE_SIZE); i++) {
pmap_kenter (((i + 1) * PAGE_SIZE), FB_START + (i * PAGE_SIZE));
for (i = 0; i < (XBOX_FB_SIZE / PAGE_SIZE); i++) {
pmap_kenter (((i + 1) * PAGE_SIZE), XBOX_FB_START + (i * PAGE_SIZE));
}
pmap_kenter ((i + 1) * PAGE_SIZE, FB_START_PTR - FB_START_PTR % PAGE_SIZE);
pmap_kenter ((i + 1) * PAGE_SIZE, XBOX_FB_START_PTR - XBOX_FB_START_PTR % PAGE_SIZE);
xcon_map = (char*)PAGE_SIZE;
xcon_memstartptr = (int*)((i + 1) * PAGE_SIZE + FB_START_PTR % PAGE_SIZE);
xcon_memstartptr = (int*)((i + 1) * PAGE_SIZE + XBOX_FB_START_PTR % PAGE_SIZE);
/* clear the screen */
iptr = (int*)xcon_map;
@ -310,15 +305,15 @@ xboxfb_drvinit (void* unused)
* mapping for us.
*/
dev = make_dev (&xboxfb_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "%s", "xboxfb");
xcon_map = pmap_mapdev (FB_START, FB_SIZE);
xcon_memstartptr = (int*)pmap_mapdev (FB_START_PTR, PAGE_SIZE);
*xcon_memstartptr = FB_START;
xcon_map = pmap_mapdev (XBOX_FB_START, XBOX_FB_SIZE);
xcon_memstartptr = (int*)pmap_mapdev (XBOX_FB_START_PTR, PAGE_SIZE);
*xcon_memstartptr = XBOX_FB_START;
/* ditch all ugly previous mappings */
for (i = 0; i < (FB_SIZE / PAGE_SIZE); i++) {
for (i = 0; i < (XBOX_FB_SIZE / PAGE_SIZE); i++) {
pmap_kremove (((i + 1) * PAGE_SIZE));
}
pmap_kremove (PAGE_SIZE + FB_SIZE);
pmap_kremove (PAGE_SIZE + XBOX_FB_SIZE);
/* probe for a keyboard */
xboxfb_timer (NULL);