summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorrink <rink@FreeBSD.org>2006-02-10 18:48:22 +0000
committerrink <rink@FreeBSD.org>2006-02-10 18:48:22 +0000
commit34f7cafe2af8138362b9854467056e596fde534b (patch)
tree273ee8c9d2de6064a1bd8c9af9a65d3058ed84a5 /sys/i386
parent170467b1149ad016ae3aa3184084c51e731a95cc (diff)
downloadFreeBSD-src-34f7cafe2af8138362b9854467056e596fde534b.zip
FreeBSD-src-34f7cafe2af8138362b9854467056e596fde534b.tar.gz
Cleaned the memory initialization up, moved some defines from the framebuffer
to an include file. Reviewed by: imp Approved by: imp (mentor)
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/machdep.c4
-rw-r--r--sys/i386/include/xbox.h5
-rw-r--r--sys/i386/xbox/xboxfb.c29
3 files changed, 18 insertions, 20 deletions
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 478231f..80a16a4 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -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;
}
diff --git a/sys/i386/include/xbox.h b/sys/i386/include/xbox.h
index 06db5df..09583f3 100644
--- a/sys/i386/include/xbox.h
+++ b/sys/i386/include/xbox.h
@@ -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 */
diff --git a/sys/i386/xbox/xboxfb.c b/sys/i386/xbox/xboxfb.c
index 3537491..624b7e5 100644
--- a/sys/i386/xbox/xboxfb.c
+++ b/sys/i386/xbox/xboxfb.c
@@ -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 @@ scroll:
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);
OpenPOWER on IntegriCloud