Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/acorn32/stand/boot32 KNF doesn't apply to Reinoud -...
details: https://anonhg.NetBSD.org/src/rev/76588c6bf99d
branches: trunk
changeset: 546110:76588c6bf99d
user: bjh21 <bjh21%NetBSD.org@localhost>
date: Sun Apr 20 18:50:38 2003 +0000
description:
KNF doesn't apply to Reinoud -- back out my last two changes.
diffstat:
sys/arch/acorn32/stand/boot32/boot32.c | 656 ++++++++++++--------------------
1 files changed, 247 insertions(+), 409 deletions(-)
diffs (truncated from 1161 to 300 lines):
diff -r f5ff64866401 -r 76588c6bf99d sys/arch/acorn32/stand/boot32/boot32.c
--- a/sys/arch/acorn32/stand/boot32/boot32.c Sun Apr 20 18:31:16 2003 +0000
+++ b/sys/arch/acorn32/stand/boot32/boot32.c Sun Apr 20 18:50:38 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot32.c,v 1.13 2003/04/20 15:57:12 bjh21 Exp $ */
+/* $NetBSD: boot32.c,v 1.14 2003/04/20 18:50:38 bjh21 Exp $ */
/*-
* Copyright (c) 2002 Reinoud Zandijk
@@ -48,7 +48,7 @@
/* constants */
-#define PODRAM_START (512*1024*1024) /* XXX Kinetic cards XXX */
+#define PODRAM_START (512*1024*1024) /* XXX Kinetic cards XXX */
#define MAX_RELOCPAGES 4096
@@ -61,68 +61,63 @@
/* booter variables */
-char scrap[80], twirl_cnt; /* misc */
+char scrap[80], twirl_cnt; /* misc */
char booted_file[80];
-struct bootconfig *bconfig; /* bootconfig passing */
-u_long bconfig_new_phys; /* physical address its bound */
+struct bootconfig *bconfig; /* bootconfig passing */
+u_long bconfig_new_phys; /* physical address its bound */
-/* Computer knowledge */
-u_int monitor_type, monitor_sync, ioeb_flags, lcd_flags;
+u_int monitor_type, monitor_sync, ioeb_flags, lcd_flags; /* computer knowledge */
u_int superio_flags, superio_flags_basic, superio_flags_extra;
-
-int nbpp, memory_table_size, memory_image_size; /* sizes */
-u_long reloc_tablesize, *reloc_instruction_table; /* relocate info */
-u_long *reloc_pos; /* current empty entry */
-int reloc_entries; /* number of relocations */
-int first_mapped_DRAM_page_index; /* offset in RISC OS blob */
-int first_mapped_PODRAM_page_index;/* offset in RISC OS blob */
+int nbpp, memory_table_size, memory_image_size; /* sizes */
+u_long reloc_tablesize, *reloc_instruction_table; /* relocate info */
+u_long *reloc_pos; /* current empty entry */
+int reloc_entries; /* number of relocations */
+int first_mapped_DRAM_page_index; /* offset in RISC OS blob */
+int first_mapped_PODRAM_page_index; /* offset in RISC OS blob */
-struct page_info *mem_pages_info; /* {nr, virt, phys}* */
-struct page_info *free_relocation_page; /* points to the page_info chain*/
-struct page_info *relocate_table_pages; /* points to seq. relocate info */
-struct page_info *relocate_code_page; /* points to the copied code */
-struct page_info *bconfig_page; /* page for passing on settings */
+struct page_info *mem_pages_info; /* {nr, virt, phys}* */
+struct page_info *free_relocation_page; /* points to the page_info chain*/
+struct page_info *relocate_table_pages; /* points to seq. relocate info */
+struct page_info *relocate_code_page; /* points to the copied code */
+struct page_info *bconfig_page; /* page for passing on settings */
-unsigned char *memory_page_types; /* packed array of 4 bit typeId */
+unsigned char *memory_page_types; /* packed array of 4 bit typeId */
-u_long *initial_page_tables; /* pagetables to be booted from */
+u_long *initial_page_tables; /* pagetables to be booted from */
/* XXX rename *_BLOCKS to MEM_BLOCKS */
/* DRAM/VRAM/ROM/IO info */
-u_long videomem_start, videomem_pages, display_size;/* where the display is*/
+u_long videomem_start, videomem_pages, display_size; /* where the display is */
-u_long pv_offset, top_physdram; /* kernel_base - phys. diff */
-u_long top_1Mb_dram; /* the lower mapped top 1Mb */
-u_long new_L1_pages_phys; /* physical address of L1 pages */
+u_long pv_offset, top_physdram; /* kernel_base - phys. diff */
+u_long top_1Mb_dram; /* the lower mapped top 1Mb */
+u_long new_L1_pages_phys; /* physical address of L1 pages */
-/* for bootconfig passing*/
-u_long total_podram_pages, total_dram_pages, total_vram_pages;
-int dram_blocks, podram_blocks; /* number of mem. objects/type */
+u_long total_podram_pages, total_dram_pages, total_vram_pages;/* for bootconfig passing */
+int dram_blocks, podram_blocks; /* number of mem. objects/type */
int vram_blocks, rom_blocks, io_blocks;
u_long DRAM_addr[DRAM_BLOCKS], DRAM_pages[DRAM_BLOCKS];
-/* processor only RAM */
-u_long PODRAM_addr[PODRAM_BLOCKS], PODRAM_pages[PODRAM_BLOCKS];
+u_long PODRAM_addr[PODRAM_BLOCKS], PODRAM_pages[PODRAM_BLOCKS]; /* processor only RAM */
u_long VRAM_addr[VRAM_BLOCKS], VRAM_pages[VRAM_BLOCKS];
u_long ROM_addr[ROM_BLOCKS], ROM_pages[ROM_BLOCKS];
u_long IO_addr[IO_BLOCKS], IO_pages[IO_BLOCKS];
/* RISC OS memory pages we claimed */
-u_long firstpage, lastpage, totalpages;/* RISC OS pagecounters */
-char *memory_image, *bottom_memory, *top_memory;/* RISC OS memory */
+u_long firstpage, lastpage, totalpages; /* RISC OS pagecounters */
+char *memory_image, *bottom_memory, *top_memory; /* RISC OS memory */
-u_long videomem_start_ro; /* for debugging mainly */
+u_long videomem_start_ro; /* for debugging mainly */
/* kernel info */
-u_long marks[MARK_MAX]; /* loader mark pointers */
-u_long kernel_physical_start; /* where does it get relocated */
-u_long kernel_free_vm_start; /* where does the free VM start */
-/* some free space to mess with */
-u_long scratch_virtualbase, scratch_physicalbase;
+u_long marks[MARK_MAX]; /* loader mark pointers */
+u_long kernel_physical_start; /* where does it get relocated */
+u_long kernel_free_vm_start; /* where does the free VM start */
+u_long scratch_virtualbase, scratch_physicalbase; /* some free space to mess with */
/* bootprogram identifiers */
@@ -144,8 +139,7 @@
void prepare_and_check_relocation_system(void);
void twirl(void);
int vdu_var(int);
-void process_args(int argc, char **argv, int *howto, char *file,
- int *start_args);
+void process_args(int argc, char **argv, int *howto, char *file, int *start_args);
char *sprint0(int width, char prefix, char base, int value);
struct page_info *get_relocated_page(u_long destination, int size);
@@ -161,17 +155,13 @@
/* the loader itself */
-void
-init_datastructures(void)
-{
-
+void init_datastructures(void) {
/* Get number of pages and the memorytablesize */
osmemory_read_arrangement_table_size(&memory_table_size, &nbpp);
/* reserve some space for heap etc... 512 might be bigish though */
memory_image_size = (int) HIMEM - 512*1024;
- if (memory_image_size <= 256*1024)
- panic("I need more memory to boot up; increase Wimp slot");
+ if (memory_image_size <= 256*1024) panic("I need more memory to boot up; increase Wimp slot");
memory_image = alloc(memory_image_size);
if (!memory_image) panic("Can't alloc get my memory image ?");
@@ -182,46 +172,33 @@
lastpage = ((int) top_memory / nbpp) - 1;
totalpages = lastpage - firstpage;
- printf("Got %ld memory pages each %d kilobytes to mess with.\n\n",
- totalpages, nbpp>>10);
+ printf("Got %ld memory pages each %d kilobytes to mess with.\n\n", totalpages, nbpp>>10);
/* allocate some space for the relocation table */
- /* 3 entry table */
- reloc_tablesize = (MAX_RELOCPAGES+1)*3*sizeof(u_long);
+ reloc_tablesize = (MAX_RELOCPAGES+1)*3*sizeof(u_long); /* 3 entry table */
reloc_instruction_table = alloc(reloc_tablesize);
- if (reloc_instruction_table == NULL)
- panic("Can't alloc my relocate instructions pages");
+ if (!reloc_instruction_table) panic("Can't alloc my relocate instructions pages");
- /*
- * set up relocation table. First word gives number of
- * relocations to be done
- */
+ /* set up relocation table. First word gives number of relocations to be done */
reloc_entries = 0;
reloc_pos = reloc_instruction_table;
*reloc_pos++ = 0;
- /*
- * set up the memory translation info structure; alloc one
- * more for end of list marker; see get_memory_map
- */
+ /* set up the memory translation info structure; alloc one more for *
+ * end of list marker; see get_memory_map */
mem_pages_info = alloc((totalpages + 1)*sizeof(struct page_info));
- if (mem_pages_info == NULL)
- panic("Can't alloc my phys->virt page info");
+ if (!mem_pages_info) panic("Can't alloc my phys->virt page info");
/* allocate memory for the memory arrangement table */
memory_page_types = alloc(memory_table_size);
- if (memory_page_types == NULL)
- panic("Can't alloc my memory page type block");
+ if (!memory_page_types) panic("Can't alloc my memory page type block");
- initial_page_tables = alloc(16*1024);/* size is 16 kb per definition */
- if (initial_page_tables == NULL)
- panic("Can't alloc my initial page tables");
+ initial_page_tables = alloc(16*1024); /* size is 16 kb per definition */
+ if (!initial_page_tables) panic("Can't alloc my initial page tables");
}
-void
-prepare_and_check_relocation_system(void)
-{
+void prepare_and_check_relocation_system(void) {
int relocate_size, relocate_pages;
int bank, pages, found;
u_long dst, src, base, destination, extend;
@@ -230,13 +207,8 @@
/* set the number of relocation entries in the 1st word */
*reloc_instruction_table = reloc_entries;
- /*
- * the relocate information needs to be in one sequential
- * physical space
- */
- /* round space up */
- relocate_size = (reloc_tablesize + nbpp-1) & ~(nbpp-1);
-
+ /* the relocate information needs to be in one sequential physical space */
+ relocate_size = (reloc_tablesize + nbpp-1) & ~(nbpp-1); /* round space up */
printf("\nPreparing for booting %s ... ", booted_file);
relocate_pages = relocate_size / nbpp;
@@ -247,22 +219,17 @@
dst = (relocate_table_pages + pages)->logical;
memcpy((void *) dst, (void *) src, nbpp);
- if (pages < relocate_pages - 1) {
+ if (pages < relocate_pages-1) {
/* check if next page is sequential physically */
- if ((relocate_table_pages + pages + 1)->physical -
- (relocate_table_pages + pages)->physical != nbpp) {
- /*
- * Ieee! non contigunous relocate area
- * -> try again
- */
+ if ((relocate_table_pages+pages+1)->physical - (relocate_table_pages+pages)->physical != nbpp) {
+ /* Ieee! non contigunous relocate area -> try again */
printf("*");
relocate_table_pages += pages;
- /* will be incremented till zero later */
- pages = -1;
- }
- }
+ pages = -1; /* will be incremented till zero later */
+ };
+ };
pages++;
- }
+ };
free_relocation_page = relocate_table_pages + pages;
/* copy the relocation code into this page in start_kernel */
@@ -285,9 +252,7 @@
length = reloc_entry[2];
/* paranoia check */
- if ((long) (src - last_src) <= 0)
- printf("relocation sequence challenged -- "
- "booting might fail ");
+ if ((long) (src - last_src) <= 0) printf("relocation sequence challenged -- booting might fail ");
last_src = src;
/* check if its gonna be relocated into (PO)DRAM ! */
@@ -295,32 +260,27 @@
found = 0;
for (bank = 0; (bank < dram_blocks) && !found; bank++) {
base = DRAM_addr[bank];
- found = (destination >= base) &&
- (extend <= base + DRAM_pages[bank]*nbpp);
- }
+ found = (destination >= base) && (extend <= base + DRAM_pages[bank]*nbpp);
+ };
for (bank = 0; (bank < podram_blocks) && !found; bank++) {
base = PODRAM_addr[bank];
- found = (destination >= base) &&
- (extend <= base + PODRAM_pages[bank]*nbpp);
- }
+ found = (destination >= base) && (extend <= base + PODRAM_pages[bank]*nbpp);
+ };
if (!found || (extend > top_physdram)) {
- panic( "Internal error: relocating range "
- "[%lx +%lx => %lx] outside (PO)DRAM banks!",
- src, length, destination);
- }
+ panic( "Internal error: relocating range [%lx +%lx => %lx] outside (PO)DRAM banks!",
+ src, length, destination
+ );
+ };
reloc_entry+=3;
- }
- if (reloc_entry != reloc_pos)
- panic("Relocation instruction table is corrupted");
+ };
+ if (reloc_entry != reloc_pos) panic("Relocation instruction table is corrupted");
printf("OK!\n");
}
Home |
Main Index |
Thread Index |
Old Index