本文整理汇总了C++中prom_printf函数的典型用法代码示例。如果您正苦于以下问题:C++ prom_printf函数的具体用法?C++ prom_printf怎么用?C++ prom_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prom_printf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: prom_getmdesc
struct prom_pmemblock * __init prom_getmdesc(void)
{
char *memsize_str;
unsigned int memsize;
char tmp_cmdline[COMMAND_LINE_SIZE];
char *tmp_str;
strlcpy(tmp_cmdline, arcs_cmdline, COMMAND_LINE_SIZE);
tmp_str = find_args(tmp_cmdline, "debug_ros");
if (tmp_str) {
sscanf(tmp_str, "%x", &audio_addr);
debug_flag = 1;
}
if (audio_addr == 0) {
audio_addr = *((unsigned int *)0xa00000d8);
audio_addr = reverseInt(audio_addr);
}
if ((audio_addr < 0x81000000) || (audio_addr >= 0x82000000)) {
printk("**************************************************************\n");
printk("You didn't specify audio image address, use default instead...\n");
printk("**************************************************************\n");
audio_addr = 0;
}
memsize_str = prom_getenv("memsize");
if (!memsize_str) {
prom_printf("memsize not set in boot prom, set to default (32Mb)\n");
memsize = 0x02000000;
} else {
#ifdef DEBUG
prom_printf("prom_memsize = %s\n", memsize_str);
#endif
memsize = simple_strtol(memsize_str, NULL, 0);
if (memsize < 0x02000000) {
panic("memsize cannot be less then 32Mb.\n");
}
}
memset(mdesc, 0, sizeof(mdesc));
#ifdef CONFIG_REALTEK_MARS_RESERVE_LAST_48MB
if (memsize == 0x10000000)
memsize -= 0x03000000;
#endif
// The last page is used to store the DRAM calibration parameter;
// Jacky says that this page can be included in his RTOS memory region.
// mdesc[4].type = yamon_dontuse;
// mdesc[4].base = memsize - 4096;
// mdesc[4].size = 4096;
#if CONFIG_REALTEK_RTOS_MEMORY_SIZE
// If memsize is over 32Mb
if(memsize > 0x02000000) {
mdesc[4].type = yamon_free;
mdesc[4].base = 0x02000000;
mdesc[4].size = memsize - 0x02000000;
}
// This memory region is used by RTOS.
mdesc[3].type = yamon_dontuse;
// mdesc[3].base = mdesc[4].base - CONFIG_REALTEK_RTOS_MEMORY_SIZE;
if (audio_addr != 0) {
audio_addr = audio_addr-0x80000000;
mdesc[3].base = audio_addr;
mdesc[3].size = 0x02000000 - audio_addr;
} else {
mdesc[3].base = 0x02000000 - CONFIG_REALTEK_RTOS_MEMORY_SIZE;
mdesc[3].size = CONFIG_REALTEK_RTOS_MEMORY_SIZE;
}
printk("audio addr: %x \n", audio_addr);
// Kernel image is stored in 0x100000 - CPHYSADDR(PFN_ALIGN(&_end)).
mdesc[2].type = yamon_free;
mdesc[2].base = CPHYSADDR(PFN_ALIGN(&_end));
mdesc[2].size = mdesc[3].base - CPHYSADDR(PFN_ALIGN(&_end));
#else
// Kernel image is stored in 0x100000 - CPHYSADDR(PFN_ALIGN(&_end)).
mdesc[2].type = yamon_free;
mdesc[2].base = CPHYSADDR(PFN_ALIGN(&_end));
mdesc[2].size = memsize - CPHYSADDR(PFN_ALIGN(&_end));
#endif
mdesc[1].type = yamon_dontuse;
mdesc[1].base = 0x100000;
mdesc[1].size = CPHYSADDR(PFN_ALIGN(&_end))-0x100000;
mdesc[0].type = yamon_free;
mdesc[0].base = 0x0;
mdesc[0].size = 0x100000;
return &mdesc[0];
}
开发者ID:erdoukki,项目名称:linux-xtr,代码行数:94,代码来源:memory.c
示例2: prom_callback
/* Pretty sick eh? */
int prom_callback(long *args)
{
struct console *cons, *saved_console = NULL;
unsigned long flags;
char *cmd;
extern spinlock_t prom_entry_lock;
if (!args)
return -1;
if (!(cmd = (char *)args[0]))
return -1;
/*
* The callback can be invoked on the cpu that first dropped
* into prom_cmdline after taking the serial interrupt, or on
* a slave processor that was smp_captured() if the
* administrator has done a switch-cpu inside obp. In either
* case, the cpu is marked as in-interrupt. Drop IRQ locks.
*/
irq_exit(smp_processor_id(), 0);
save_and_cli(flags);
spin_unlock(&prom_entry_lock);
cons = console_drivers;
while (cons) {
unregister_console(cons);
cons->flags &= ~(CON_PRINTBUFFER);
cons->next = saved_console;
saved_console = cons;
cons = console_drivers;
}
register_console(&prom_console);
if (!strcmp(cmd, "sync")) {
prom_printf("PROM `%s' command...\n", cmd);
show_free_areas();
if(current->pid != 0) {
sti();
sys_sync();
cli();
}
args[2] = 0;
args[args[1] + 3] = -1;
prom_printf("Returning to PROM\n");
} else if (!strcmp(cmd, "va>tte-data")) {
unsigned long ctx, va;
unsigned long tte = 0;
long res = PROM_FALSE;
ctx = args[3];
va = args[4];
if (ctx) {
/*
* Find process owning ctx, lookup mapping.
*/
struct task_struct *p;
struct mm_struct *mm = NULL;
pgd_t *pgdp;
pmd_t *pmdp;
pte_t *ptep;
for_each_task(p) {
mm = p->mm;
if (CTX_HWBITS(mm->context) == ctx)
break;
}
if (!mm ||
CTX_HWBITS(mm->context) != ctx)
goto done;
pgdp = pgd_offset(mm, va);
if (pgd_none(*pgdp))
goto done;
pmdp = pmd_offset(pgdp, va);
if (pmd_none(*pmdp))
goto done;
ptep = pte_offset(pmdp, va);
if (!pte_present(*ptep))
goto done;
tte = pte_val(*ptep);
res = PROM_TRUE;
goto done;
}
if ((va >= KERNBASE) && (va < (KERNBASE + (4 * 1024 * 1024)))) {
/* Spitfire Errata #32 workaround */
__asm__ __volatile__("stxa %0, [%1] %2\n\t"
"flush %%g6"
: /* No outputs */
: "r" (0),
"r" (PRIMARY_CONTEXT), "i" (ASI_DMMU));
/*
* Locked down tlb entry.
*/
if (tlb_type == spitfire)
tte = spitfire_get_dtlb_data(SPITFIRE_HIGHEST_LOCKED_TLBENT);
else if (tlb_type == cheetah || tlb_type == cheetah_plus)
tte = cheetah_get_ldtlb_data(CHEETAH_HIGHEST_LOCKED_TLBENT);
//.........这里部分代码省略.........
开发者ID:romanalexander,项目名称:Trickles,代码行数:101,代码来源:setup.c
示例3: promcon_puts
static __inline__ void
promcon_puts(char *buf, int cnt)
{
prom_printf("%*.*s", cnt, cnt, buf);
}
开发者ID:wxlong,项目名称:Test,代码行数:5,代码来源:promcon.c
示例4: dr_resume_devices
static void
dr_resume_devices(dev_info_t *start, dr_sr_handle_t *srh)
{
dr_handle_t *handle;
dev_info_t *dip, *next, *last = NULL;
major_t major;
char *bn;
int circ;
major = (major_t)-1;
/* attach in reverse device tree order */
while (last != start) {
dip = start;
next = ddi_get_next_sibling(dip);
while (next != last && dip != srh->sr_failed_dip) {
dip = next;
next = ddi_get_next_sibling(dip);
}
if (dip == srh->sr_failed_dip) {
/* release hold acquired in dr_suspend_devices() */
srh->sr_failed_dip = NULL;
ndi_rele_devi(dip);
} else if (dr_is_real_device(dip) &&
srh->sr_failed_dip == NULL) {
if ((bn = ddi_binding_name(dip)) != NULL) {
major = ddi_name_to_major(bn);
} else {
bn = "<null>";
}
if (!dr_bypass_device(bn) &&
!drmach_verify_sr(dip, 0)) {
char d_name[40], d_alias[40], *d_info;
d_name[0] = 0;
d_info = ddi_get_name_addr(dip);
if (d_info == NULL)
d_info = "<null>";
if (!dr_resolve_devname(dip, d_name, d_alias)) {
if (d_alias[0] != 0) {
prom_printf("\tresuming "
"%[email protected]%s (aka %s)\n", d_name,
d_info, d_alias);
} else {
prom_printf("\tresuming "
"%[email protected]%s\n", d_name, d_info);
}
} else {
prom_printf("\tresuming %[email protected]%s\n", bn,
d_info);
}
if (devi_attach(dip, DDI_RESUME) !=
DDI_SUCCESS) {
/*
* Print a console warning,
* set an e_code of ESBD_RESUME,
* and save the driver major
* number in the e_rsc.
*/
prom_printf("\tFAILED to resume %[email protected]%s",
d_name[0] ? d_name : bn, d_info);
srh->sr_err_idx =
dr_add_int(srh->sr_err_ints,
srh->sr_err_idx, DR_MAX_ERR_INT,
(uint64_t)major);
handle = srh->sr_dr_handlep;
dr_op_err(CE_IGNORE, handle,
ESBD_RESUME, "%[email protected]%s",
d_name[0] ? d_name : bn, d_info);
}
}
}
/* Hold parent busy while walking its children */
ndi_devi_enter(dip, &circ);
dr_resume_devices(ddi_get_child(dip), srh);
ndi_devi_exit(dip, circ);
last = dip;
}
}
开发者ID:bahamas10,项目名称:openzfs,代码行数:86,代码来源:dr_quiesce.c
示例5: dr_suspend
int
dr_suspend(dr_sr_handle_t *srh)
{
dr_handle_t *handle;
int force;
int dev_errs_idx;
uint64_t dev_errs[DR_MAX_ERR_INT];
int rc = DDI_SUCCESS;
handle = srh->sr_dr_handlep;
force = dr_cmd_flags(handle) & SBD_FLAG_FORCE;
/*
* update the signature block
*/
CPU_SIGNATURE(OS_SIG, SIGST_QUIESCE_INPROGRESS, SIGSUBST_NULL,
CPU->cpu_id);
prom_printf("\nDR: suspending user threads...\n");
srh->sr_suspend_state = DR_SRSTATE_USER;
if (((rc = dr_stop_user_threads(srh)) != DDI_SUCCESS) &&
dr_check_user_stop_result) {
dr_resume(srh);
return (rc);
}
if (!force) {
struct dr_ref drc = {0};
prom_printf("\nDR: checking devices...\n");
dev_errs_idx = 0;
drc.arr = dev_errs;
drc.idx = &dev_errs_idx;
drc.len = DR_MAX_ERR_INT;
/*
* Since the root node can never go away, it
* doesn't have to be held.
*/
ddi_walk_devs(ddi_root_node(), dr_check_unsafe_major, &drc);
if (dev_errs_idx) {
handle->h_err = drerr_int(ESBD_UNSAFE, dev_errs,
dev_errs_idx, 1);
dr_resume(srh);
return (DDI_FAILURE);
}
PR_QR("done\n");
} else {
prom_printf("\nDR: dr_suspend invoked with force flag\n");
}
#ifndef SKIP_SYNC
/*
* This sync swap out all user pages
*/
vfs_sync(SYNC_ALL);
#endif
/*
* special treatment for lock manager
*/
lm_cprsuspend();
#ifndef SKIP_SYNC
/*
* sync the file system in case we never make it back
*/
sync();
#endif
/*
* now suspend drivers
*/
prom_printf("DR: suspending drivers...\n");
srh->sr_suspend_state = DR_SRSTATE_DRIVER;
srh->sr_err_idx = 0;
/* No parent to hold busy */
if ((rc = dr_suspend_devices(ddi_root_node(), srh)) != DDI_SUCCESS) {
if (srh->sr_err_idx && srh->sr_dr_handlep) {
(srh->sr_dr_handlep)->h_err = drerr_int(ESBD_SUSPEND,
srh->sr_err_ints, srh->sr_err_idx, 1);
}
dr_resume(srh);
return (rc);
}
drmach_suspend_last();
/*
* finally, grab all cpus
*/
srh->sr_suspend_state = DR_SRSTATE_FULL;
/*
* if watchdog was activated, disable it
*/
if (watchdog_activated) {
mutex_enter(&tod_lock);
//.........这里部分代码省略.........
开发者ID:bahamas10,项目名称:openzfs,代码行数:101,代码来源:dr_quiesce.c
示例6: breakout_cerrd
static inline void breakout_cerrd(unsigned int val)
{
switch (val & CP0_CERRD_CAUSES) {
case CP0_CERRD_LOAD:
prom_printf(" load,");
break;
case CP0_CERRD_STORE:
prom_printf(" store,");
break;
case CP0_CERRD_FILLWB:
prom_printf(" fill/wb,");
break;
case CP0_CERRD_COHERENCY:
prom_printf(" coherency,");
break;
case CP0_CERRD_DUPTAG:
prom_printf(" duptags,");
break;
default:
prom_printf(" NO CAUSE,");
break;
}
if (!(val & CP0_CERRD_TYPES))
prom_printf(" NO TYPE");
else {
if (val & CP0_CERRD_MULTIPLE)
prom_printf(" multi-err");
if (val & CP0_CERRD_TAG_STATE)
prom_printf(" tag-state");
if (val & CP0_CERRD_TAG_ADDRESS)
prom_printf(" tag-address");
if (val & CP0_CERRD_DATA_SBE)
prom_printf(" data-SBE");
if (val & CP0_CERRD_DATA_DBE)
prom_printf(" data-DBE");
if (val & CP0_CERRD_EXTERNAL)
prom_printf(" external");
}
prom_printf("\n");
}
开发者ID:12019,项目名称:hg556a_source,代码行数:40,代码来源:cerr-sb1.c
示例7: rt2880_setup
void __init rt2880_setup(void)
{
#ifdef CONFIG_KGDB
int rs_putDebugChar(char);
char rs_getDebugChar(void);
int saa9730_putDebugChar(char);
char saa9730_getDebugChar(void);
extern int (*generic_putDebugChar)(char);
extern char (*generic_getDebugChar)(void);
#endif
char *argptr;
iomem_resource.start = 0;
iomem_resource.end= ~0;
ioport_resource.start= 0;
ioport_resource.end = ~0;
#ifdef CONFIG_SERIAL_CONSOLE
argptr = prom_getcmdline();
if ((argptr = strstr(argptr, "console=ttyS")) == NULL) {
int i = 0;
char *s = prom_getenv("modetty0");
while(s[i] >= '0' && s[i] <= '9')
i++;
strcpy(serial_console, "ttyS0,");
strncpy(serial_console + 6, s, i);
prom_printf("Config serial console: %s\n", serial_console);
console_setup(serial_console, NULL);
}
#endif
#ifdef CONFIG_KGDB
argptr = prom_getcmdline();
if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
int line;
argptr += strlen("kgdb=ttyS");
if (*argptr != '0' && *argptr != '1')
printk("KGDB: Uknown serial line /dev/ttyS%c, "
"falling back to /dev/ttyS1\n", *argptr);
line = *argptr == '0' ? 0 : 1;
printk("KGDB: Using serial line /dev/ttyS%d for session\n",
line ? 1 : 0);
if(line == 0) {
rs_kgdb_hook(line);
generic_putDebugChar = rs_putDebugChar;
generic_getDebugChar = rs_getDebugChar;
} else {
saa9730_kgdb_hook();
generic_putDebugChar = saa9730_putDebugChar;
generic_getDebugChar = saa9730_getDebugChar;
}
prom_printf("KGDB: Using serial line /dev/ttyS%d for session, "
"please connect your debugger\n", line ? 1 : 0);
remote_debug = 1;
/* Breakpoints and stuff are in surfboard_irq_setup() */
}
#endif
argptr = prom_getcmdline();
if ((argptr = strstr(argptr, "nofpu")) != NULL)
cpu_data[0].options &= ~MIPS_CPU_FPU;
//rtc_ops = &no_rtc_ops;
board_time_init = mips_time_init;
//board_timer_setup = mips_timer_setup;
mips_reboot_setup();
}
开发者ID:420GrayFox,项目名称:dsl-n55u-bender,代码行数:70,代码来源:setup.c
示例8: __initfunc
__initfunc(void sgi_setup(void))
{
#ifdef CONFIG_SERIAL_CONSOLE
char *ctype;
#endif
#ifdef CONFIG_REMOTE_DEBUG
char *kgdb_ttyd;
#endif
irq_setup = sgi_irq_setup;
/* Init the INDY HPC I/O controller. Need to call this before
* fucking with the memory controller because it needs to know the
* boardID and whether this is a Guiness or a FullHouse machine.
*/
sgihpc_init();
/* Init INDY memory controller. */
sgimc_init();
/* Now enable boardcaches, if any. */
indy_sc_init();
#ifdef CONFIG_SERIAL_CONSOLE
/* ARCS console environment variable is set to "g?" for
* graphics console, it is set to "d" for the first serial
* line and "d2" for the second serial line.
*/
ctype = prom_getenv("console");
if(*ctype == 'd') {
if(*(ctype+1)=='2')
console_setup ("ttyS1", NULL);
else
console_setup ("ttyS0", NULL);
}
#endif
#ifdef CONFIG_REMOTE_DEBUG
kgdb_ttyd = prom_getcmdline();
if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) {
int line;
kgdb_ttyd += strlen("kgdb=ttyd");
if (*kgdb_ttyd != '1' && *kgdb_ttyd != '2')
printk("KGDB: Uknown serial line /dev/ttyd%c, "
"falling back to /dev/ttyd1\n", *kgdb_ttyd);
line = *kgdb_ttyd == '2' ? 0 : 1;
printk("KGDB: Using serial line /dev/ttyd%d for session\n",
line ? 1 : 2);
rs_kgdb_hook(line);
prom_printf("KGDB: Using serial line /dev/ttyd%d for session, "
"please connect your debugger\n", line ? 1 : 2);
remote_debug = 1;
/* Breakpoints and stuff are in sgi_irq_setup() */
}
#endif
#ifdef CONFIG_SGI_PROM_CONSOLE
console_setup("ttyS0", NULL);
#endif
sgi_volume_set(simple_strtoul(prom_getenv("volume"), NULL, 10));
#ifdef CONFIG_VT
#ifdef CONFIG_SGI_NEWPORT_CONSOLE
conswitchp = &newport_con;
#else
conswitchp = &dummy_con;
#endif
#endif
rtc_ops = &indy_rtc_ops;
kbd_ops = &sgi_kbd_ops;
#ifdef CONFIG_PSMOUSE
aux_device_present = 0xaa;
#endif
#ifdef CONFIG_VIDEO_VINO
init_vino();
#endif
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:82,代码来源:setup.c
示例9: fputs
int fputs(const char *s, FILE *stream)
{
prom_printf("%s", s);
return 0;
}
开发者ID:NHellFire,项目名称:dban-yaboot,代码行数:6,代码来源:nonstd.c
示例10: fill_ebus_child
static void __init fill_ebus_child(struct device_node *dp,
struct linux_ebus_child *dev,
int non_standard_regs)
{
struct of_device *op;
int *regs;
int i, len;
dev->prom_node = dp;
printk(" (%s)", dp->name);
regs = of_get_property(dp, "reg", &len);
if (!regs)
dev->num_addrs = 0;
else
dev->num_addrs = len / sizeof(regs[0]);
if (non_standard_regs) {
/* This is to handle reg properties which are not
* in the parent relative format. One example are
* children of the i2c device on CompactPCI systems.
*
* So, for such devices we just record the property
* raw in the child resources.
*/
for (i = 0; i < dev->num_addrs; i++)
dev->resource[i].start = regs[i];
} else {
for (i = 0; i < dev->num_addrs; i++) {
int rnum = regs[i];
if (rnum >= dev->parent->num_addrs) {
prom_printf("UGH: property for %s was %d, need < %d\n",
dp->name, len, dev->parent->num_addrs);
prom_halt();
}
dev->resource[i].start = dev->parent->resource[i].start;
dev->resource[i].end = dev->parent->resource[i].end;
dev->resource[i].flags = IORESOURCE_MEM;
dev->resource[i].name = dp->name;
}
}
op = of_find_device_by_node(dp);
if (!op) {
dev->num_irqs = 0;
} else {
dev->num_irqs = op->num_irqs;
for (i = 0; i < dev->num_irqs; i++)
dev->irqs[i] = op->irqs[i];
}
if (!dev->num_irqs) {
/*
* Oh, well, some PROMs don't export interrupts
* property to children of EBus devices...
*
* Be smart about PS/2 keyboard and mouse.
*/
if (!strcmp(dev->parent->prom_node->name, "8042")) {
if (!strcmp(dev->prom_node->name, "kb_ps2")) {
dev->num_irqs = 1;
dev->irqs[0] = dev->parent->irqs[0];
} else {
dev->num_irqs = 1;
dev->irqs[0] = dev->parent->irqs[1];
}
}
}
}
开发者ID:420GrayFox,项目名称:dsl-n55u-bender,代码行数:69,代码来源:ebus.c
示例11: pca9556_ioctl
static int
pca9556_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp,
int *rvalp)
{
pca9556_unit_t *pcap;
int err = 0;
int instance = MINOR_TO_INST(getminor(dev));
int port;
i2c_gpio_t g_buf;
uchar_t temp;
boolean_t write_io = B_FALSE;
_NOTE(ARGUNUSED(credp, rvalp))
pcap = (pca9556_unit_t *)
ddi_get_soft_state(pca9556_soft_statep, instance);
if (pcap->pca9555_device) {
port = MINOR_TO_PORT(getminor(dev));
}
if (pca9556_debug) {
prom_printf("pca9556_ioctl: instance=%d\n", instance);
}
/*
* We serialize here and block any pending transacations.
*/
mutex_enter(&pcap->pca9556_mutex);
while ((pcap->pca9556_flags & PCA9556_BUSYFLAG) == PCA9556_BUSYFLAG) {
if (cv_wait_sig(&pcap->pca9556_cv,
&pcap->pca9556_mutex) <= 0) {
mutex_exit(&pcap->pca9556_mutex);
return (EINTR);
}
}
pcap->pca9556_flags |= PCA9556_BUSYFLAG;
mutex_exit(&pcap->pca9556_mutex);
if (ddi_copyin((caddr_t)arg, &g_buf,
sizeof (i2c_gpio_t), mode) != DDI_SUCCESS) {
err = EFAULT;
goto cleanup;
}
pcap->pca9556_transfer->i2c_flags = I2C_WR_RD;
pcap->pca9556_transfer->i2c_wlen = 1;
pcap->pca9556_transfer->i2c_rlen = 1;
/*
* Evaluate which register is to be read or modified
*/
switch (cmd) {
case GPIO_GET_INPUT:
if (pcap->pca9555_device)
pcap->pca9556_transfer->i2c_wbuf[0] =
PCA9555_INPUT_REG + port;
else
pcap->pca9556_transfer->i2c_wbuf[0] =
PCA9556_INPUT_REG;
break;
case GPIO_SET_OUTPUT:
write_io = B_TRUE;
/*FALLTHROUGH*/
case GPIO_GET_OUTPUT:
if (pcap->pca9555_device)
pcap->pca9556_transfer->i2c_wbuf[0] =
PCA9555_OUTPUT_REG + port;
else
pcap->pca9556_transfer->i2c_wbuf[0] =
PCA9556_OUTPUT_REG;
break;
case GPIO_SET_POLARITY:
write_io = B_TRUE;
/*FALLTHROUGH*/
case GPIO_GET_POLARITY:
if (pcap->pca9555_device)
pcap->pca9556_transfer->i2c_wbuf[0] =
PCA9555_POLARITY_REG + port;
else
pcap->pca9556_transfer->i2c_wbuf[0] =
PCA9556_POLARITY_REG;
break;
case GPIO_SET_CONFIG:
write_io = B_TRUE;
/*FALLTHROUGH*/
case GPIO_GET_CONFIG:
if (pcap->pca9555_device)
pcap->pca9556_transfer->i2c_wbuf[0] =
PCA9555_CONFIG_REG + port;
else
pcap->pca9556_transfer->i2c_wbuf[0] =
PCA9556_CONFIG_REG;
break;
//.........这里部分代码省略.........
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:101,代码来源:pca9556.c
示例12: sbus_init
void __init sbus_init(void)
{
int nd, this_sbus, sbus_devs, topnd, iommund;
unsigned int sbus_clock;
struct sbus_bus *sbus;
struct sbus_dev *this_dev;
int num_sbus = 0; /* How many did we find? */
#ifndef __sparc_v9__
register_proc_sparc_ioport();
#endif
#ifdef CONFIG_SUN4
return sun4_dvma_init();
#endif
topnd = prom_getchild(prom_root_node);
/* Finding the first sbus is a special case... */
iommund = 0;
if(sparc_cpu_model == sun4u) {
nd = prom_searchsiblings(topnd, "sbus");
if(nd == 0) {
#ifdef CONFIG_PCI
if (!pcic_present()) {
prom_printf("Neither SBUS nor PCI found.\n");
prom_halt();
} else {
#ifdef __sparc_v9__
firetruck_init();
#endif
}
return;
#else
prom_printf("YEEE, UltraSparc sbus not found\n");
prom_halt();
#endif
}
} else if(sparc_cpu_model == sun4d) {
if((iommund = prom_searchsiblings(topnd, "io-unit")) == 0 ||
(nd = prom_getchild(iommund)) == 0 ||
(nd = prom_searchsiblings(nd, "sbi")) == 0) {
panic("sbi not found");
}
} else if((nd = prom_searchsiblings(topnd, "sbus")) == 0) {
if((iommund = prom_searchsiblings(topnd, "iommu")) == 0 ||
(nd = prom_getchild(iommund)) == 0 ||
(nd = prom_searchsiblings(nd, "sbus")) == 0) {
#ifdef CONFIG_PCI
if (!pcic_present()) {
prom_printf("Neither SBUS nor PCI found.\n");
prom_halt();
}
return;
#else
/* No reason to run further - the data access trap will occur. */
panic("sbus not found");
#endif
}
}
/* Ok, we've found the first one, allocate first SBus struct
* and place in chain.
*/
sbus = sbus_root = kmalloc(sizeof(struct sbus_bus), GFP_ATOMIC);
sbus->next = NULL;
sbus->prom_node = nd;
this_sbus = nd;
if(iommund && sparc_cpu_model != sun4u && sparc_cpu_model != sun4d)
iommu_init(iommund, sbus);
/* Loop until we find no more SBUS's */
while(this_sbus) {
#ifdef __sparc_v9__
/* IOMMU hides inside SBUS/SYSIO prom node on Ultra. */
if(sparc_cpu_model == sun4u) {
extern void sbus_iommu_init(int prom_node, struct sbus_bus *sbus);
sbus_iommu_init(this_sbus, sbus);
}
#endif
#ifndef __sparc_v9__
if (sparc_cpu_model == sun4d)
iounit_init(this_sbus, iommund, sbus);
#endif
printk("sbus%d: ", num_sbus);
sbus_clock = prom_getint(this_sbus, "clock-frequency");
if(sbus_clock == -1)
sbus_clock = (25*1000*1000);
printk("Clock %d.%d MHz\n", (int) ((sbus_clock/1000)/1000),
(int) (((sbus_clock/1000)%1000 != 0) ?
(((sbus_clock/1000)%1000) + 1000) : 0));
prom_getstring(this_sbus, "name",
sbus->prom_name, sizeof(sbus->prom_name));
sbus->clock_freq = sbus_clock;
#ifndef __sparc_v9__
if (sparc_cpu_model == sun4d) {
sbus->devid = prom_getint(iommund, "device-id");
//.........这里部分代码省略.........
开发者ID:romanalexander,项目名称:Trickles,代码行数:101,代码来源:sbus.c
示例13: sgimc_init
void __init sgimc_init(void)
{
unsigned long tmpreg;
mcmisc_regs = (struct sgimc_misc_ctrl *)(KSEG1+0x1fa00000);
rpsscounter = (u32 *) (KSEG1 + 0x1fa01004);
dmactrlregs = (struct sgimc_dma_ctrl *) (KSEG1+0x1fa02000);
printk("MC: SGI memory controller Revision %d\n",
(int) mcmisc_regs->systemid & SGIMC_SYSID_MASKREV);
#if 0 /* XXX Until I figure out what this bit really indicates XXX */
/* XXX Is this systemid bit reliable? */
if(mcmisc_regs->systemid & SGIMC_SYSID_EPRESENT) {
EISA_bus = 1;
printk("with EISA\n");
} else {
EISA_bus = 0;
printk("no EISA\n");
}
#endif
#ifdef DEBUG_SGIMC
prom_printf("sgimc_init: memconfig0<%s> mconfig1<%s>\n",
mconfig_string(mcmisc_regs->mconfig0),
mconfig_string(mcmisc_regs->mconfig1));
prom_printf("mcdump: cpuctrl0<%08lx> cpuctrl1<%08lx>\n",
mcmisc_regs->cpuctrl0, mcmisc_regs->cpuctrl1);
prom_printf("mcdump: divider<%08lx>, gioparm<%04x>\n",
mcmisc_regs->divider, mcmisc_regs->gioparm);
#endif
/* Place the MC into a known state. This must be done before
* interrupts are first enabled etc.
*/
/* Step 1: The CPU/GIO error status registers will not latch
* up a new error status until the register has been
* cleared by the cpu. These status registers are
* cleared by writing any value to them.
*/
mcmisc_regs->cstat = mcmisc_regs->gstat = 0;
/* Step 2: Enable all parity checking in cpu control register
* zero.
*/
tmpreg = mcmisc_regs->cpuctrl0;
tmpreg |= (SGIMC_CCTRL0_EPERRGIO | SGIMC_CCTRL0_EPERRMEM |
SGIMC_CCTRL0_R4KNOCHKPARR);
mcmisc_regs->cpuctrl0 = tmpreg;
/* Step 3: Setup the MC write buffer depth, this is controlled
* in cpu control register 1 in the lower 4 bits.
*/
tmpreg = mcmisc_regs->cpuctrl1;
tmpreg &= ~0xf;
tmpreg |= 0xd;
mcmisc_regs->cpuctrl1 = tmpreg;
/* Step 4: Initialize the RPSS divider register to run as fast
* as it can correctly operate. The register is laid
* out as follows:
*
* ----------------------------------------
* | RESERVED | INCREMENT | DIVIDER |
* ----------------------------------------
* 31 16 15 8 7 0
*
* DIVIDER determines how often a 'tick' happens,
* INCREMENT determines by how the RPSS increment
* registers value increases at each 'tick'. Thus,
* for IP22 we get INCREMENT=1, DIVIDER=1 == 0x101
*/
mcmisc_regs->divider = 0x101;
/* Step 5: Initialize GIO64 arbitrator configuration register.
*
* NOTE: If you dork with startup code the HPC init code in
* sgihpc_init() must run before us because of how we
* need to know Guiness vs. FullHouse and the board
* revision on this machine. You have been warned.
*/
/* First the basic invariants across all gio64 implementations. */
tmpreg = SGIMC_GIOPARM_HPC64; /* All 1st HPC's interface at 64bits. */
tmpreg |= SGIMC_GIOPARM_ONEBUS; /* Only one physical GIO bus exists. */
if(sgi_guiness) {
/* Guiness specific settings. */
tmpreg |= SGIMC_GIOPARM_EISA64; /* MC talks to EISA at 64bits */
tmpreg |= SGIMC_GIOPARM_MASTEREISA; /* EISA bus can act as master */
} else {
/* Fullhouse specific settings. */
if(sgi_boardid < 2) {
tmpreg |= SGIMC_GIOPARM_HPC264; /* 2nd HPC at 64bits */
tmpreg |= SGIMC_GIOPARM_PLINEEXP0; /* exp0 pipelines */
tmpreg |= SGIMC_GIOPARM_MASTEREXP1;/* exp1 masters */
tmpreg |= SGIMC_GIOPARM_RTIMEEXP0; /* exp0 is realtime */
} else {
//.........这里部分代码省略.........
开发者ID:TitaniumBoy,项目名称:lin,代码行数:101,代码来源:ip22-mc.c
示例14: fill_sbus_device
static void __init fill_sbus_device(int prom_node, struct sbus_dev *sdev)
{
unsigned long address, base;
int len;
sdev->prom_node = prom_node;
prom_getstring(prom_node, "name",
sdev->prom_name, sizeof(sdev->prom_name));
address = prom_getint(prom_node, "address");
len = prom_getproperty(prom_node, "reg",
(char *) sdev->reg_addrs,
sizeof(sdev->reg_addrs));
if (len == -1) {
sdev->num_registers = 0;
goto no_regs;
}
if (len % sizeof(struct linux_prom_registers)) {
prom_printf("fill_sbus_device: proplen for regs of %s "
" was %d, need multiple of %d\n",
sdev->prom_name, len,
(int) sizeof(struct linux_prom_registers));
prom_halt();
}
if (len > (sizeof(struct linux_prom_registers) * PROMREG_MAX)) {
prom_printf("fill_sbus_device: Too many register properties "
"for device %s, len=%d\n",
sdev->prom_name, len);
prom_halt();
}
sdev->num_registers = len / sizeof(struct linux_prom_registers);
sdev->ranges_applied = 0;
base = (unsigned long) sdev->reg_addrs[0].phys_addr;
/* Compute the slot number. */
if (base >= SUN_SBUS_BVADDR && sparc_cpu_model == sun4m) {
sdev->slot = sbus_dev_slot(base);
} else {
sdev->slot = sdev->reg_addrs[0].which_io;
}
no_regs:
len = prom_getproperty(prom_node, "ranges",
(char *)sdev->device_ranges,
sizeof(sdev->device_ranges));
if (len == -1) {
sdev->num_device_ranges = 0;
goto no_ranges;
}
if (len % sizeof(struct linux_prom_ranges)) {
prom_printf("fill_sbus_device: proplen for ranges of %s "
" was %d, need multiple of %d\n",
sdev->prom_name, len,
(int) sizeof(struct linux_prom_ranges));
prom_halt();
}
if (len > (sizeof(struct linux_prom_ranges) * PROMREG_MAX)) {
prom_printf("fill_sbus_device: Too many range properties "
"for device %s, len=%d\n",
sdev->prom_name, len);
prom_halt();
}
sdev->num_device_ranges =
len / sizeof(struct linux_prom_ranges);
no_ranges:
/* XXX Unfortunately, IRQ issues are very arch specific.
* XXX Pull this crud out into an arch specific area
* XXX at some point. -DaveM
*/
#ifdef __sparc_v9__
len = prom_getproperty(prom_node, "interrupts",
(char *) irqs, sizeof(irqs));
if (len == -1 || len == 0) {
sdev->irqs[0] = 0;
sdev->num_irqs = 0;
} else {
unsigned int pri = irqs[0].pri;
sdev->num_irqs = 1;
if (pri < 0x20)
pri += sdev->slot * 8;
sdev->irqs[0] = sbus_build_irq(sdev->bus, pri);
}
#else
len = prom_getproperty(prom_node, "intr",
(char *)irqs, sizeof(irqs));
if (len != -1) {
sdev->num_irqs = len / 8;
if (sdev->num_irqs == 0) {
sdev->irqs[0] = 0;
} else if (sparc_cpu_model == sun4d) {
extern unsigned int sun4d_build_irq(struct sbus_dev *sdev, int irq);
for (len = 0; len < sdev->num_irqs; len++)
sdev->irqs[len] = sun4d_build_irq(sdev, irqs[len].pri);
} else {
for (len = 0; len < sdev->num_irqs; len++)
//.........这里部分代码省略.........
开发者ID:romanalexander,项目名称:Trickles,代码行数:101,代码来源:sbus.c
示例15: acebus_config
static int
acebus_config(ebus_devstate_t *ebus_p)
{
ddi_acc_handle_t conf_handle;
uint16_t comm;
#ifdef ACEBUS_HOTPLUG
int tcr_reg;
caddr_t csr_io;
ddi_device_acc_attr_t csr_attr = { /* CSR map attributes */
DDI_DEVICE_ATTR_V0,
DDI_STRUCTURE_LE_ACC,
DDI_STRICTORDER_ACC
};
ddi_acc_handle_t csr_handle;
#endif
/*
* Make sure the master enable and memory access enable
* bits are set in the config command register.
*/
if (pci_config_setup(ebus_p->dip, &conf_handle) != DDI_SUCCESS)
return (0);
comm = pci_config_get16(conf_handle, PCI_CONF_COMM),
#ifdef DEBUG
DBG1(D_ATTACH, ebus_p, "command register was 0x%x\n", comm);
#endif
comm |= (PCI_COMM_ME|PCI_COMM_MAE|PCI_COMM_SERR_ENABLE|
PCI_COMM_PARITY_DETECT);
pci_config_put16(conf_handle, PCI_CONF_COMM, comm),
#ifdef DEBUG
DBG1(D_MAP, ebus_p, "command register is now 0x%x\n",
pci_config_get16(conf_handle, PCI_CONF_COMM));
#endif
pci_config_put8(conf_handle, PCI_CONF_CACHE_LINESZ,
(uchar_t)acebus_cache_line_size);
pci_config_put8(conf_handle, PCI_CONF_LATENCY_TIMER,
(uchar_t)acebus_latency_timer);
pci_config_teardown(&conf_handle);
#ifdef ACEBUS_HOTPLUG
if (acebus_update_props(ebus_p) != DDI_SUCCESS) {
cmn_err(CE_WARN, "%s%d: Could not update special properties.",
ddi_driver_name(ebus_p->dip),
ddi_get_instance(ebus_p->dip));
return (0);
}
if (ddi_regs_map_setup(ebus_p->dip, CSR_IO_RINDEX,
(caddr_t *)&csr_io, 0, CSR_SIZE, &csr_attr,
&csr_handle) != DDI_SUCCESS) {
cmn_err(CE_WARN, "%s%d: Could not map Ebus CSR.",
ddi_driver_name(ebus_p->dip),
ddi_get_instance(ebus_p->dip));
}
#ifdef DEBUG
if (acebus_debug_flags) {
DBG3(D_ATTACH, ebus_p, "tcr[123] = %x,%x,%x\n",
ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io +
TCR1_OFF)),
ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io +
TCR2_OFF)),
ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io +
TCR3_OFF)));
DBG2(D_ATTACH, ebus_p, "pmd-aux=%x, freq-aux=%x\n",
ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io +
PMD_AUX_OFF)),
ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io +
FREQ_AUX_OFF)));
#ifdef ACEBUS_DEBUG
for (comm = 0; comm < 4; comm++)
prom_printf("dcsr%d=%x, dacr%d=%x, dbcr%d=%x\n", comm,
ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io +
0x700000+(0x2000*comm))), comm,
ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io +
0x700000+(0x2000*comm)+4)), comm,
ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io +
0x700000+(0x2000*comm)+8)));
#endif
} /* acebus_debug_flags */
#endif
/* If TCR registers are not initialized, initialize them here */
tcr_reg = ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io +
TCR1_OFF));
if ((tcr_reg == 0) || (tcr_reg == -1))
ddi_put32(csr_handle, (uint32_t *)((caddr_t)csr_io + TCR1_OFF),
TCR1_REGVAL);
tcr_reg = ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io +
TCR2_OFF));
if ((tcr_reg == 0) || (tcr_reg == -1))
ddi_put32(csr_handle, (uint32_t *)((caddr_t)csr_io + TCR2_OFF),
TCR2_REGVAL);
tcr_reg = ddi_get32(csr_handle, (uint32_t *)((caddr_t)csr_io +
TCR3_OFF));
if ((tcr_reg == 0) || (tcr_reg == -1))
ddi_put32(csr_handle, (uint32_t *)((caddr_t)csr_io + TCR3_OFF),
TCR3_REGVAL);
#ifdef DEBUG
if (acebus_debug_flags) {
DBG3(D_ATTACH, ebus_p, "wrote tcr[123] = %x,%x,%x\n",
//.........这里部分代码省略.........
开发者ID:apprisi,项目名称:illumos-gate,代码行数:101,代码来源:acebus.c
示例16: cfg_set
static int cfg_set (char *item, char *value)
{
CONFIG *walk;
if (!strncasecmp (item, "image", 5)) {
struct IMAGES **p = &images;
int ignore = 0;
if (item[5] == '[' && item[strlen(item) - 1] == ']') {
char *s, *q = item;
/* Get rid of braces */
item[strlen(item) - 1] = 0;
item[5] = 0;
for (s = item + 6; q; s = q) {
q = strchr(s, '|');
if (q)
*q++ = 0;
if (match_arch(s))
goto cfg_set_cont;
}
/* This just creates an unused table. It will get ignored */
ignore = 1;
} else if (item[5])
goto cfg_set_redo;
cfg_set_cont:
while (*p)
p = &((*p)->next);
*p = (struct IMAGES *)malloc (sizeof (struct IMAGES));
if (*p == NULL) {
prom_printf("malloc error in cfg_set\n");
return -1;
}
(*p)->next = 0;
(*p)->obsolete = ignore;
curr_table = ((*p)->table);
memcpy (curr_table, cf_image, sizeof (cf_image));
}
cfg_set_redo:
for (walk = curr_table; walk->type != cft_end; walk++) {
if (walk->name && !strcasecmp (walk->name, item)) {
if (value && walk->type != cft_strg)
cfg_warn ("'%s' doesn't have a value", walk->name);
else if (!value && walk->type == cft_strg)
cfg_warn ("Value expected for '%s'", walk->name);
else {
if (!strcasecmp (item, "label"))
check_for_obsolete(value);
if (walk->data)
cfg_warn ("Duplicate entry '%s'", walk->name);
if (walk->type == cft_flag)
walk->data = &flag_set;
else if (walk->type == cft_strg)
walk->data = value;
}
break;
}
}
if (walk->type != cft_end)
return 1;
//cfg_return (item, value);
return 0;
}
开发者ID:arnew,项目名称:yaboot,代码行数:70,代码来源:cfg.c
示例17: dr_suspend_devices
/*
* The "dip" argument's parent (if it exists) must be held busy.
*/
static int
dr_suspend_devices(dev_info_t *dip, dr_sr_handle_t *srh)
{
dr_handle_t *handle;
major_t major;
char *dname;
int circ;
/*
* If dip is the root node, it has no siblings and it is
* always held. If dip is not the root node, dr_suspend_devices()
* will be invoked with the parent held busy.
*/
for (; dip != NULL; dip = ddi_get_next_sibling(dip)) {
char d_name[40], d_alias[40], *d_info;
ndi_devi_enter(dip, &circ);
if (dr_suspend_devices(ddi_get_child(dip), srh)) {
ndi_devi_exit(dip, circ);
return (ENXIO);
}
ndi_devi_exit(dip, circ);
if (!dr_is_real_device(dip))
continue;
major = (major_t)-1;
if ((dname = ddi_binding_name(dip)) != NULL)
major = ddi_name_to_major(dname);
if (dr_bypass_device(dname)) {
PR_QR(" bypassed suspend of %s (major# %d)\n", dname,
major);
continue;
}
if (drmach_verify_sr(dip, 1)) {
PR_QR(" bypassed suspend of %s (major# %d)\n", dname,
major);
continue;
}
if ((d_info = ddi_get_name_addr(dip)) == NULL)
d_info = "<null>";
d_name[0] = 0;
if (dr_resolve_devname(dip, d_name, d_alias) == 0) {
if (d_alias[0] != 0) {
prom_printf("\tsuspending %[email protected]%s (aka %s)\n",
d_name, d_info, d_alias);
} else {
prom_printf("\tsuspending %[email protected]%s\n", d_name,
d_info);
}
} else {
prom_printf("\tsuspending %[email protected]%s\n", dname, d_info);
}
if (devi_detach(dip, DDI_SUSPEND) != DDI_SUCCESS) {
prom_printf("\tFAILED to suspend %[email protected]%s\n",
d_name[0] ? d_name : dname, d_info);
srh->sr_err_idx = dr_add_int(srh->sr_err_ints,
srh->sr_err_idx, DR_MAX_ERR_INT, (uint64_t)major);
ndi_hold_devi(dip);
srh->sr_failed_dip = dip;
handle = srh->sr_dr_handlep;
dr_op_err(CE_IGNORE, handle, ESBD_SUSPEND, "%[email protected]%s",
d_name[0] ? d_name : dname, d_info);
return (DDI_FAILURE);
}
}
return (DDI_SUCCESS);
}
开发者ID:bahamas10,项目名称:openzfs,代码行数:81,代码来源:dr_quiesce.c
示例18: plat_setup
void __init plat_setup(void)
{
int i;
char* argptr;
board_setup(); /* board specific setup */
_machine_restart = pnx8550_machine_restart;
_machine_halt = pnx8550_machine_halt;
pm_power_off = pnx8550_machine_power_off;
board_time_init = pnx8550_time_init;
board_timer_setup = pnx8550_timer_setup;
/* Clear the Global 2 Register, PCI Inta Output Enable Registers
Bit 1:Enable DAC Powerdown
-> 0:DACs are enabled and are working normally
1:DACs are powerdown
Bit 0:Enable of PCI inta output
-> 0 = Disable PCI inta output
1 = Enable PCI inta output
*/
PNX8550_GLB2_ENAB_INTA_O = 0;
/* IO/MEM resources. */
set_io_port_base(KSEG1);
ioport_resource.start = 0;
ioport_resource.end = ~0;
iomem_resource.start = 0;
iomem_resource.end = ~0;
/* Request I/O space for devices on this board */
for (i = 0; i < STANDARD_IO_RESOURCES; i++)
request_resource(&ioport_resource, standard_io_resources + i);
/* Place the Mode Control bit for GPIO pin 16 in primary function */
/* Pin 16 is used by UART1, UA1_TX */
outl((PNX8550_GPIO_MODE_PRIMOP << PNX8550_GPIO_MC_16_BIT) |
(PNX8550_GPIO_MODE_PRIMOP << PNX8550_GPIO_MC_17_BIT),
PNX8550_GPIO_MC1);
argptr = prom_getcmdline();
if ((argptr = strstr(argptr, "console=ttyS")) != NULL) {
argptr += strlen("console=ttyS");
pnx8550_console_port = *argptr == '0' ? 0 : 1;
/* We must initialize the UART (console) before prom_printf */
/* Set LCR to 8-bit
|
请发表评论