asmlinkage void ofw_init(ofw_handle_t o, int *nomr, int *pointer) { int phandle,i,mem_len,buffer[32]; char temp[12]; temp[0]='/'; temp[1]='m'; temp[2]='e'; temp[3]='m'; temp[4]='o'; temp[5]='r'; temp[6]='y'; temp[7]='\0'; phandle=OF_finddevice(o,temp); temp[0]='r'; temp[1]='e'; temp[2]='g'; temp[3]='\0'; mem_len = OF_getproplen(o,phandle, temp); OF_getprop(o,phandle, temp, buffer, mem_len); *nomr=mem_len >> 3; for (i=0; i<=mem_len/4; i++) pointer[i]=of_decode_int((const unsigned char *)&buffer[i]); temp[0]='/'; temp[1]='c'; temp[2]='h'; temp[3]='o'; temp[4]='s'; temp[5]='e'; temp[6]='n'; temp[7]='\0'; phandle=OF_finddevice(o,temp); temp[0]='b'; temp[1]='o'; temp[2]='o'; temp[3]='t'; temp[4]='a'; temp[5]='r'; temp[6]='g'; temp[7]='s'; temp[8]='\0'; mem_len = OF_getproplen(o,phandle, temp); OF_getprop(o,phandle, temp, buffer, mem_len); for (i=0; i<=mem_len/4; i++) pointer[i+32]=buffer[i]; }
int igsfb_ofbus_cnattach(bus_space_tag_t iot, bus_space_tag_t memt) { struct igsfb_devconfig *dc; int ret; int chosen_phandle, igs_node; int stdout_ihandle, stdout_phandle; uint32_t regs[16]; char mode_buffer[64]; stdout_phandle = 0; /* first find out if there's a CyberPro at all in this machine */ igs_node = OF_finddevice("/vlbus/display"); if (igs_node == -1) return ENXIO; if (of_compatible(igs_node, compat_strings) < 0) return ENXIO; /* * now we know there's a CyberPro in this machine so map it into * kernel space, even if it's not the console */ if (OF_getprop(igs_node, "reg", regs, sizeof(regs)) <= 0) return ENXIO; igsfb_mem_paddr = be32toh(regs[13]); /* 4MB VRAM aperture, bufferable and cacheable */ igsfb_mem_vaddr = ofw_map(igsfb_mem_paddr, 0x00400000, L2_B); /* MMIO registers */ igsfb_mmio_vaddr = ofw_map(igsfb_mem_paddr + IGS_MEM_MMIO_SELECT, 0x00100000, 0); memcpy(&igsfb_memt, memt, sizeof(struct bus_space)); igsfb_memt.bs_cookie = (void *)igsfb_mem_vaddr; memcpy(&igsfb_iot, memt, sizeof(struct bus_space)); igsfb_iot.bs_cookie = (void *)igsfb_mmio_vaddr; /* * check if the firmware output device is indeed the CyberPro */ if ((chosen_phandle = OF_finddevice("/chosen")) == -1 || OF_getprop(chosen_phandle, "stdout", &stdout_ihandle, sizeof(stdout_ihandle)) != sizeof(stdout_ihandle)) { return ENXIO; } stdout_ihandle = of_decode_int((void *)&stdout_ihandle); stdout_phandle = OF_instance_to_package(stdout_ihandle); if (stdout_phandle != igs_node) return ENXIO; /* ok, now setup and attach the console */ dc = &igsfb_console_dc; ret = igsfb_setup_dc(dc); if (ret) return ret; if (of_get_mode_string(mode_buffer, sizeof(mode_buffer))) { strcpy(dc->dc_modestring, mode_buffer); } ret = igsfb_cnattach_subr(dc); if (ret) return ret; igsfb_ofbus_console = 1; igsfb_ofbus_phandle = stdout_phandle; #if (NIGSFB_OFBUS > 0) || (NVGA_OFBUS > 0) console_ihandle = stdout_ihandle; #endif return 0; }