static void idepmac_sleep_interface(int i, unsigned base, int mediabay) { struct device_node* np = pmac_ide[i].node; /* We clear the timings */ pmac_ide[i].timings[0] = 0; pmac_ide[i].timings[1] = 0; /* The media bay will handle itself just fine */ if (mediabay) return; /* Disable and reset the bus */ feature_set(np, FEATURE_IDE0_reset); feature_clear(np, FEATURE_IDE0_enable); switch(pmac_ide[i].aapl_bus_id) { case 0: feature_set(np, FEATURE_IDE0_reset); feature_clear(np, FEATURE_IDE0_enable); break; case 1: feature_set(np, FEATURE_IDE1_reset); feature_clear(np, FEATURE_IDE1_enable); break; case 2: feature_set(np, FEATURE_IDE2_reset); break; } }
static void idepmac_sleep_disk(int i, unsigned long base) { struct device_node* np = pmac_ide[i].node; int j; /* FIXME: We only handle the master IDE */ if (ide_hwifs[i].drives[0].media == ide_disk) { /* Spin down the drive */ outb(0xa0, base+0x60); outb(0x0, base+0x30); outb(0x0, base+0x20); outb(0x0, base+0x40); outb(0x0, base+0x50); outb(0xe0, base+0x70); outb(0x2, base+0x160); for (j = 0; j < 10; j++) { int status; mdelay(100); status = inb(base+0x70); if (!(status & BUSY_STAT) && (status & DRQ_STAT)) break; } } feature_set(np, FEATURE_IDE0_reset); feature_clear(np, FEATURE_IDE0_enable); switch(pmac_ide[i].aapl_bus_id) { case 0: feature_set(np, FEATURE_IDE0_reset); feature_clear(np, FEATURE_IDE0_enable); break; case 1: feature_set(np, FEATURE_IDE1_reset); feature_clear(np, FEATURE_IDE1_enable); break; case 2: feature_set(np, FEATURE_IDE2_reset); break; } pmac_ide[i].timings[0] = 0; pmac_ide[i].timings[1] = 0; }
/* * param_tilt_set */ int param_tilt_set(dcam_state_t *softc_p, uint_t subparam, uint_t val) { int ret_val; uint_t feature_csr_offs; feature_csr_offs = DCAM1394_REG_OFFS_TILT_CSR; ret_val = feature_set(softc_p, feature_csr_offs, subparam, val); return (ret_val); }
/* * param_saturation_set */ int param_saturation_set(dcam_state_t *softc_p, uint_t subparam, uint_t val) { int ret_val; uint_t feature_csr_offs; feature_csr_offs = DCAM1394_REG_OFFS_SATURATION_CSR; ret_val = feature_set(softc_p, feature_csr_offs, subparam, val); return (ret_val); }
/* * param_white_balance_set */ int param_white_balance_set(dcam_state_t *softc_p, uint_t subparam, uint_t val) { int ret_val; uint_t feature_csr_offs; feature_csr_offs = DCAM1394_REG_OFFS_WHITE_BALANCE_CSR; ret_val = feature_set(softc_p, feature_csr_offs, subparam, val); return (ret_val); }
/* * param_sharpness_set */ int param_sharpness_set(dcam_state_t *softc_p, uint_t subparam, uint_t val) { int ret_val; uint_t feature_csr_offs; feature_csr_offs = DCAM1394_REG_OFFS_SHARPNESS_CSR; ret_val = feature_set(softc_p, feature_csr_offs, subparam, val); return (ret_val); }
int ms_set(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { struct Client *acptr; if (parc < 4) return need_more_params(sptr, "SET"); if (!(acptr = FindNServer(parv[1]))) return 0; if (!IsMe(acptr)) { sendcmdto_serv_butone(sptr, CMD_SET, cptr, "%C %s :%s", acptr, parv[2], parv[3]); return 0; } return feature_set(sptr, (const char* const*)parv + 2, parc - 2); }
inline int mb_content(volatile struct media_bay_info *bay) { if (bay->pismo) { unsigned char new_gpio = in_8(bay->extint_gpio + 0xe) & 2; if (new_gpio) { bay->gpio_cache = new_gpio; return MB_NO; } else if (bay->gpio_cache != new_gpio) { /* make sure content bits are set */ feature_set(bay->dev_node, FEATURE_Mediabay_content); udelay(5); bay->gpio_cache = new_gpio; } return (in_le32((unsigned*)bay->addr) >> 4) & 0xf; } else {
/* * param_iris_set */ int param_iris_set(dcam_state_t *softc_p, uint_t subparam, uint_t val) { int ret_val; uint_t feature_csr_offs; feature_csr_offs = DCAM1394_REG_OFFS_IRIS_CSR; if (subparam == DCAM1394_SUBPARAM_ON_OFF) { val = 1; } else if (subparam == DCAM1394_SUBPARAM_VALUE) { val = 4; } ret_val = feature_set(softc_p, feature_csr_offs, subparam, val); return (ret_val); }
static void idepmac_wake_disk(int i, unsigned long base) { struct device_node* np = pmac_ide[i].node; int j; /* Revive IDE disk and controller */ switch(pmac_ide[i].aapl_bus_id) { case 0: feature_set(np, FEATURE_IDE0_reset); feature_set(np, FEATURE_IOBUS_enable); mdelay(10); feature_set(np, FEATURE_IDE0_enable); mdelay(10); feature_clear(np, FEATURE_IDE0_reset); break; case 1: feature_set(np, FEATURE_IDE1_reset); feature_set(np, FEATURE_IOBUS_enable); mdelay(10); feature_set(np, FEATURE_IDE1_enable); mdelay(10); feature_clear(np, FEATURE_IDE1_reset); break; case 2: /* This one exists only for KL, I don't know about any enable bit */ feature_set(np, FEATURE_IDE2_reset); mdelay(10); feature_clear(np, FEATURE_IDE2_reset); break; } mdelay(IDE_WAKEUP_DELAY_MS); /* Reset timings */ pmac_ide_selectproc(&ide_hwifs[i].drives[0]); mdelay(10); /* Wait up to 10 seconds (enough for recent drives) */ for (j = 0; j < 100; j++) { int status; mdelay(100); status = inb(base + 0x70); if (!(status & BUSY_STAT)) break; } }
static void set_media_bay(int which, int id) { volatile struct media_bay_info* bay; bay = &media_bays[which]; bay->content_id = id; bay->last_value = id; switch (id) { case MB_CD: feature_clear(bay->dev_node, FEATURE_Mediabay_floppy_enable); feature_set(bay->dev_node, FEATURE_Mediabay_enable); feature_set(bay->dev_node, FEATURE_CD_power); feature_set(bay->dev_node, FEATURE_Mediabay_IDE_enable); printk(KERN_INFO "media bay %d contains a CD-ROM drive\n", which); break; case MB_FD: feature_clear(bay->dev_node, FEATURE_CD_power); feature_set(bay->dev_node, FEATURE_Mediabay_enable); feature_set(bay->dev_node, FEATURE_Mediabay_floppy_enable); feature_set(bay->dev_node, FEATURE_SWIM3_enable); printk(KERN_INFO "media bay %d contains a floppy disk drive\n", which); break; case MB_NO: feature_clear(bay->dev_node, FEATURE_Mediabay_floppy_enable); feature_clear(bay->dev_node, FEATURE_CD_power); printk(KERN_INFO "media bay %d is empty\n", which); break; default: feature_clear(bay->dev_node, FEATURE_Mediabay_floppy_enable); feature_clear(bay->dev_node, FEATURE_CD_power); feature_set(bay->dev_node, FEATURE_Mediabay_enable); printk(KERN_INFO "media bay %d contains an unknown device (%d)\n", which, id); break; } udelay(500); }
static void idepmac_wake_interface(int i, unsigned long base, int mediabay) { struct device_node* np = pmac_ide[i].node; if (!mediabay) { /* Revive IDE disk and controller */ switch(pmac_ide[i].aapl_bus_id) { case 0: feature_set(np, FEATURE_IDE0_reset); feature_set(np, FEATURE_IOBUS_enable); mdelay(10); feature_set(np, FEATURE_IDE0_enable); mdelay(10); feature_clear(np, FEATURE_IDE0_reset); break; case 1: feature_set(np, FEATURE_IDE1_reset); feature_set(np, FEATURE_IOBUS_enable); mdelay(10); feature_set(np, FEATURE_IDE1_enable); mdelay(10); feature_clear(np, FEATURE_IDE1_reset); break; case 2: /* This one exists only for KL, I don't know about any enable bit */ feature_set(np, FEATURE_IDE2_reset); mdelay(10); feature_clear(np, FEATURE_IDE2_reset); break; } } /* Reset timings */ pmac_ide_selectproc(&ide_hwifs[i].drives[0]); mdelay(10); }
/* * mo_set - oper message handler */ int mo_set(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { return feature_set(sptr, (const char* const*)parv + 1, parc - 1); }
void __init pmac_ide_probe(void) { struct device_node *np; int i; struct device_node *atas; struct device_node *p, **pp, *removables, **rp; unsigned long base; int irq, big_delay; ide_hwif_t *hwif; if (_machine != _MACH_Pmac) return; pp = &atas; rp = &removables; p = find_devices("ATA"); if (p == NULL) p = find_devices("IDE"); if (p == NULL) p = find_type_devices("ide"); if (p == NULL) p = find_type_devices("ata"); /* Move removable devices such as the media-bay CDROM on the PB3400 to the end of the list. */ for (; p != NULL; p = p->next) { if (p->parent && p->parent->type && strcasecmp(p->parent->type, "media-bay") == 0) { *rp = p; rp = &p->next; } else { *pp = p; pp = &p->next; } } *rp = NULL; *pp = removables; big_delay = 0; for (i = 0, np = atas; i < MAX_HWIFS && np != NULL; np = np->next) { struct device_node *tp; int *bidp; int in_bay = 0; /* * If this node is not under a mac-io or dbdma node, * leave it to the generic PCI driver. */ for (tp = np->parent; tp != 0; tp = tp->parent) if (tp->type && (strcmp(tp->type, "mac-io") == 0 || strcmp(tp->type, "dbdma") == 0)) break; if (tp == 0) continue; if (np->n_addrs == 0) { printk(KERN_WARNING "ide: no address for device %s\n", np->full_name); continue; } /* * If this slot is taken (e.g. by ide-pci.c) try the next one. */ while (i < MAX_HWIFS && ide_hwifs[i].io_ports[IDE_DATA_OFFSET] != 0) ++i; if (i >= MAX_HWIFS) break; base = (unsigned long) ioremap(np->addrs[0].address, 0x200) - _IO_BASE; /* XXX This is bogus. Should be fixed in the registry by checking the kind of host interrupt controller, a bit like gatwick fixes in irq.c */ if (np->n_intrs == 0) { printk(KERN_WARNING "ide: no intrs for device %s, using 13\n", np->full_name); irq = 13; } else { irq = np->intrs[0].line; } pmac_ide[i].regbase = base; pmac_ide[i].irq = irq; pmac_ide[i].node = np; if (device_is_compatible(np, "keylargo-ata")) { if (strcmp(np->name, "ata-4") == 0) pmac_ide[i].kind = controller_kl_ata4; else pmac_ide[i].kind = controller_kl_ata3; } else if (device_is_compatible(np, "heathrow-ata")) pmac_ide[i].kind = controller_heathrow; else pmac_ide[i].kind = controller_ohare; bidp = (int *)get_property(np, "AAPL,bus-id", NULL); pmac_ide[i].aapl_bus_id = bidp ? *bidp : 0; if (np->parent && np->parent->name && strcasecmp(np->parent->name, "media-bay") == 0) { #ifdef CONFIG_PMAC_PBOOK media_bay_set_ide_infos(np->parent,base,irq,i); #endif /* CONFIG_PMAC_PBOOK */ in_bay = 1; } else if (pmac_ide[i].kind == controller_ohare) { /* The code below is having trouble on some ohare machines * (timing related ?). Until I can put my hand on one of these * units, I keep the old way */ feature_set(np, FEATURE_IDE0_enable); } else { /* This is necessary to enable IDE when net-booting */ printk(KERN_INFO "pmac_ide: enabling IDE bus ID %d\n", pmac_ide[i].aapl_bus_id); switch(pmac_ide[i].aapl_bus_id) { case 0: feature_set(np, FEATURE_IDE0_reset); mdelay(10); feature_set(np, FEATURE_IDE0_enable); mdelay(10); feature_clear(np, FEATURE_IDE0_reset); break; case 1: feature_set(np, FEATURE_IDE1_reset); mdelay(10); feature_set(np, FEATURE_IDE1_enable); mdelay(10); feature_clear(np, FEATURE_IDE1_reset); break; case 2: /* This one exists only for KL, I don't know about any enable bit */ feature_set(np, FEATURE_IDE2_reset); mdelay(10); feature_clear(np, FEATURE_IDE2_reset); break; } big_delay = 1; } hwif = &ide_hwifs[i]; pmac_ide_init_hwif_ports(&hwif->hw, base, 0, &hwif->irq); memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); hwif->chipset = ide_pmac; hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || in_bay; #ifdef CONFIG_PMAC_PBOOK if (in_bay && check_media_bay_by_base(base, MB_CD) == 0) hwif->noprobe = 0; #endif /* CONFIG_PMAC_PBOOK */ #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC if (np->n_addrs >= 2) { /* has a DBDMA controller channel */ pmac_ide_setup_dma(np, i); } #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ ++i; } pmac_ide_count = i; if (big_delay) mdelay(IDE_WAKEUP_DELAY_MS); #ifdef CONFIG_PMAC_PBOOK pmu_register_sleep_notifier(&idepmac_sleep_notifier); #endif /* CONFIG_PMAC_PBOOK */ }
if(cib_save != NULL) { write_xml_file(cib_object, cib_save, FALSE); } status = get_object_root(XML_CIB_TAG_STATUS, cib_object); if(status == NULL) { create_xml_node(cib_object, XML_CIB_TAG_STATUS); } #if CRM_DEPRECATED_SINCE_2_0_4 xml_child_iter_filter(status, node_state, XML_CIB_TAG_STATE, xml_remove_prop(node_state, XML_CIB_TAG_LRM); ); #endif crm_notice("Required feature set: %s", feature_set(cib_object)); if(do_id_check(cib_object, NULL, FALSE, FALSE)) { crm_config_err("ID Check failed"); } if(validate_with_dtd(cib_object, FALSE, dtd_file) == FALSE) { crm_config_err("CIB did not pass DTD validation"); } if(USE_LIVE_CIB) { /* we will always have a status section and can do a full simulation */ do_calculations(&data_set, cib_object, NULL); } else { set_working_set_defaults(&data_set); data_set.now = new_ha_date(TRUE);
static void set_compile_options(int argc, char *argv[]) { int count, files = 0; char message[MAX_NAME]; /* AM: the following code is intended to deal with things like */ /* __CLK_TCK (see <time.h>) being different for different targets. */ /* It probably needs better amalgamation into Acorn's code for predefs */ #ifdef TARGET_PREDEFINES { static char *predefs[] = TARGET_PREDEFINES; int i; for (i=0; i < sizeof(predefs)/sizeof(predefs[0]); i++) /* note that the arg may be of the form "name" or "name=toks" */ /* the "name" for is equivalent to "name=1". */ pp_predefine(predefs[i]); } #endif for (count=1; count < argc; ++count) { char *current = argv[count]; if (current[0] == '-' && current[1] != 0) { switch (safe_toupper(current[1])) { case 'C': if (ccom_flags & FLG_PREPROCESS) feature |= FEATURE_PPCOMMENT; else ccom_flags |= FLG_NO_OBJECT_OUTPUT; break; case 'D': pp_predefine(current+2); break; case 'E': /* do we wish to fault -Exxx more generally? */ #ifdef DISABLE_ERRORS if (current[2]) { disable_errors(current+2); break; } #endif #ifdef COMPILING_ON_MVS if (current[2]) { cc_msg( "Obsolete use of '%s' to suppress errors -- use '-zu' for PCC mode\n", current); break; } #endif ccom_flags = (ccom_flags | FLG_PREPROCESS) & ~FLG_COMPILE; break; case 'F': feature_set(current+2); break; #ifdef TARGET_HAS_DEBUGGER case 'G': usrdbg_set(current+2); break; #endif case 'I': set_include_path(current+2, PE_USER); break; case 'J': ccom_flags &= ~FLG_INSTORE_FILES_IMPLICITLY; set_include_path(current+2, PE_SYS); break; case 'K': ccom_flags |= FLG_COUNTS; break; #ifndef NO_LISTING_OUTPUT case 'L': ccom_flags |= FLG_LISTING; listingfile = current + 2; break; #endif case 'M': ccom_flags |= FLG_MAKEFILE; if (current[2] == '<' || current[2] == 0) { ccom_flags &= ~(FLG_COMPILE+FLG_NOSYSINCLUDES); if (current[2] == '<') ccom_flags |= FLG_NOSYSINCLUDES; } else makefile = current+2; break; case 'O': /* * Hum, really we should never get here because this * this should be done by -zpz1. */ break; /* Paranoid define check. Tony 3/1/95 */ #ifdef TARGET_HAS_PROFILE #error Old style define TARGET_HAS_PROFILE (replaced by TARGET_HAS_PROFILER) #endif #ifdef TARGET_HAS_PROFILER case 'P': { int ch = safe_toupper(current[2]); int32 profile = 1L; if (ch == 0) /* do nothing */; else if (ch == 'G' || ch == 'X' && current[3] == 0) profile = 2L; else cc_msg("unknown profile option %s: -p assumed\n",current); var_profile_option = profile; } break; #endif /* TARGET_HAS_PROFILER */ case 'R': #ifdef PASCAL /*ECN*/ rtcheck_set(current+2); #else feature &= ~FEATURE_WR_STR_LITS; #endif break; case 'S': asmfile = current+2; /* "" for -S */ #ifdef COMPILING_ON_MVS /* pesky cc163 compatibility */ if (*asmfile == 0 && count+1<argc) asmfile = argv[++count]; #endif break; #ifdef TARGET_IS_XPUTER case 'T': /* -tn sets processor type == -tn */ pragma_set(current + 1); break; #endif case 'U': pp_preundefine(current+2); break; case 'W': disable_warnings(current+2); break; #ifdef TARGET_IS_MVS /* TARGET_USES_CCOM_INTERFACE ??? */ /* The following case provides -Xcsectname for CC 163 compatibility. */ /* It may be that the CCOM-style interface should stuff ALL unknown */ /* options to mcdep_config_option()? */ case 'X': if (!mcdep_config_option(current[1], current+2)) cc_msg("unknown option %s: ignored\n", current); break; #endif case 'Z': switch(safe_toupper(current[2])) { case 'B': target_lsbitfirst = !target_lsbytefirst; if (isdigit(current[3])) target_lsbitfirst = (current[3]-'0'); break; #ifdef TARGET_ENDIANNESS_CONFIGURABLE case 'E': { int lsbytefirst = current[3] - '0'; if (lsbytefirst) config &= ~CONFIG_BIG_ENDIAN; else config |= CONFIG_BIG_ENDIAN; target_lsbitfirst = lsbytefirst; } break; #endif case 'C': feature |= FEATURE_SIGNED_CHAR; break; case 'F': feature = (feature | FEATURE_FUSSY) & ~FEATURE_LIMITED_PCC; break; case 'I': pre_include(current+3); break; case 'J': config |= CONFIG_INDIRECT_SETJMP; /* related to -fR */ break; case 'P': pragma_set(current+3); break; case 'O': feature |= FEATURE_AOF_AREA_PER_FN; break; case 'Q': debug_set(current+3); break; #ifndef TARGET_IS_HELIOS case 'S': system_flavour = current+3; break; #endif case 'U': feature |= pcc_features(); break; #ifdef TARGET_IS_TRAN /* * Addition to remove C++ warnings (for fussy IGM people). * Tony 8/2/95. */ case 'W': feature |= FEATURE_NO_CPLUSPLUS_WARNINGS; break; #endif /* TARGET_IS_TRAN */ #ifdef PASCAL /*ECN*/ case 'Z': feature |= FEATURE_ISO; break; #endif default: if (!mcdep_config_option(current[2], current+3)) cc_msg("unknown option %s: ignored\n", current); break; } break; default: cc_msg("unknown option %s: ignored\n", current); break; } } else { switch (++files) { case 1: if (strcmp(current, "-") == 0) { /* then just leave as stdin */ #ifdef COMPILING_ON_RISC_OS # ifndef OBSOLETE_ARM_NAMES /* Hack round default no-buffering library. */ setvbuf(stdin, NULL, _IOLBF, 256); # endif #endif } else if (freopen(current,"r",stdin) != NULL) { UnparsedName unparse; char new_dir[MAX_NAME]; ccom_flags &= ~FLG_STDIN; sourcefile = current; /* * Add path name of source file to the -I list. */ translate_fname(current, &unparse, new_dir); new_dir[unparse.un_pathlen] = '\0'; path_hd = mk_path_element(path_hd, PE_USER, new_dir); /* Make sure path_tl is always the tail, even if file precedes -I */ if (path_hd->link == 0) path_tl = path_hd; } else { sprintf(message, "couldn't read file '%s'", current); driver_abort(message); } break; case 2: objectfile = current; break; default: driver_abort("too many file arguments"); } } } if (ccom_flags & FLG_STDIN) { path_hd = mk_path_element(path_hd, PE_USER, ""); if (path_hd->link == 0) path_tl = path_hd; } #ifdef TARGET_HAS_SEPARATE_CODE_DATA_SEGS /* On machines like amd29000 code and data buses are separate */ /* so that all non-instruction data must go in the data segment. */ #if defined TARGET_IS_C40 /* * Ho Hum * * The problem is that programs built with the -Zr option, (such as * the kernel and device drivers), do not have a static data area. * This means that strings MUST be placed into the code segment. BUT * on the C40 data pointers can only address 1/4 of the address map, and * so they may not be able to reach the code segment. (This is especially * true when you consider that the C40 has two address buses, and the plan * is to have data on one bus and code on the other). HENCE by default we * want to disable placing strings in the code segment, but for -Zr programs * we have no choice ... */ if (suppress_module != 1) { feature |= FEATURE_WR_STR_LITS; } else { feature &= ~FEATURE_WR_STR_LITS; } #else feature |= FEATURE_WR_STR_LITS; #endif /* TARGET_IS_C40 */ #endif /* TARGET_HAS_SEPARATE_CODE_DATA_SEGS */ if (ccom_flags & FLG_COMPILE) { /* under the driver.c interface at most one of the following is true */ #ifndef NO_OBJECT_OUTPUT if (objectfile[0] != '\0' && !(ccom_flags & FLG_NO_OBJECT_OUTPUT)) { objstream = cc_open(objectfile, BINARY_FILE); # ifdef COMPILING_ON_RISC_OS set_time_stamp(objectfile, NO); # endif } #endif #ifndef NO_ASSEMBLER_OUTPUT if (asmfile[0] != '\0') asmstream = cc_open(asmfile, TEXT_FILE); #endif if (objectfile[0] == '\0' && asmfile[0] == '\0') { asmstream = stdout; feature |= FEATURE_ANNOTATE; /* simple test use */ } #ifndef NO_LISTING_OUTPUT if (ccom_flags & FLG_LISTING) { if (listingfile[0] != '\0') { listingstream = cc_open(listingfile, TEXT_FILE); if (listingstream != stdout) /* @@@ get rid of this hack */ fprintf(listingstream, " 1 "); } else listingstream = stdout; if (ccom_flags & FLG_COUNTS) { FILE *map = fopen("counts", "rb"); if (map == NULL) driver_abort("couldn't read \"counts\" file"); if (!map_init(map)) driver_abort("malformed \"counts\" file"); } } #endif } if (ccom_flags & FLG_MAKEFILE) { if (makefile[0] == 0) makestream = stdout; else { makestream = cc_open(makefile, TEXT_FILE); } /* * Print out source file and object file for -M option */ fprintf(makestream, DEPEND_FORMAT, objectfile, sourcefile); } }