Skip to content

Commit

Permalink
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/paulus/powerpc

* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
  [POWERPC] Fix building of COFF zImages
  [POWERPC] spufs: Fix error handling in spufs_fill_dir()
  [POWERPC] Add table of contents to booting-without-of.txt
  [POWERPC] spufs: Don't yield nosched context
  [POWERPC] Fix typo in booting-without-of-txt section numbering
  [POWERPC] scc_sio: Fix link failure
  [POWERPC] cbe_cpufreq: Limit frequency via cpufreq notifier chain
  [POWERPC] Fix pci_setup_phb_io_dynamic for pci_iomap
  [POWERPC] spufs scheduler: Fix wakeup races
  [POWERPC] spufs: Synchronize pte invalidation vs ps close
  [POWERPC] spufs: Free mm if spufs_fill_dir() failed
  [POWERPC] spufs: Fix gang destroy leaks
  [POWERPC] spufs: Hook up spufs_release_mem
  [POWERPC] spufs: Refuse to load the module when not running on cell
  [POWERPC] pasemi: Fix iommu + 64K PAGE_SIZE bug
  • Loading branch information
Linus Torvalds committed Jun 7, 2007
2 parents b74d0de + f40e524 commit 143a275
Show file tree
Hide file tree
Showing 11 changed files with 224 additions and 167 deletions.
59 changes: 57 additions & 2 deletions Documentation/powerpc/booting-without-of.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,69 @@
Booting the Linux/ppc kernel without Open Firmware
--------------------------------------------------


(c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>,
IBM Corp.
(c) 2005 Becky Bruce <becky.bruce at freescale.com>,
Freescale Semiconductor, FSL SOC and 32-bit additions
(c) 2006 MontaVista Software, Inc.
Flash chip node definition

Table of Contents
=================

I - Introduction
1) Entry point for arch/powerpc
2) Board support

II - The DT block format
1) Header
2) Device tree generalities
3) Device tree "structure" block
4) Device tree "strings" block

III - Required content of the device tree
1) Note about cells and address representation
2) Note about "compatible" properties
3) Note about "name" properties
4) Note about node and property names and character set
5) Required nodes and properties
a) The root node
b) The /cpus node
c) The /cpus/* nodes
d) the /memory node(s)
e) The /chosen node
f) the /soc<SOCname> node

IV - "dtc", the device tree compiler

V - Recommendations for a bootloader

VI - System-on-a-chip devices and nodes
1) Defining child nodes of an SOC
2) Representing devices without a current OF specification
a) MDIO IO device
c) PHY nodes
b) Gianfar-compatible ethernet nodes
d) Interrupt controllers
e) I2C
f) Freescale SOC USB controllers
g) Freescale SOC SEC Security Engines
h) Board Control and Status (BCSR)
i) Freescale QUICC Engine module (QE)
g) Flash chip nodes

VII - Specifying interrupt information for devices
1) interrupts property
2) interrupt-parent property
3) OpenPIC Interrupt Controllers
4) ISA Interrupt Controllers

Appendix A - Sample SOC node for MPC8540


Revision Information
====================

May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet.

May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or
Expand Down Expand Up @@ -1687,7 +1742,7 @@ platforms are moved over to use the flattened-device-tree model.
};
};

g) Flash chip nodes
j) Flash chip nodes

Flash chips (Memory Technology Devices) are often used for solid state
file systems on embedded devices.
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/boot/crt0.S
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

.text
/* a procedure descriptor used when booting this as a COFF file */
.globl _zimage_start_opd
_zimage_start_opd:
.long _zimage_start, 0, 0, 0

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/of_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ static int __devinit of_pci_phb_probe(struct of_device *dev,
* Note also that we don't do ISA, this will also be fixed with a
* more massive rework.
*/
pci_setup_phb_io(phb, 0);
pci_setup_phb_io(phb, pci_io_base == 0);

/* Init pci_dn data structures */
pci_devs_phb_init_dynamic(phb);
Expand Down
33 changes: 27 additions & 6 deletions arch/powerpc/platforms/cell/cbe_cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ static u64 MIC_Slow_Next_Timer_table[] = {
0x00003FC000000000ull,
};

static unsigned int pmi_frequency_limit = 0;
/*
* hardware specific functions
*/
Expand Down Expand Up @@ -164,7 +165,6 @@ static int set_pmode(int cpu, unsigned int slow_mode) {

static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg)
{
struct cpufreq_policy policy;
u8 cpu;
u8 cbe_pmode_new;

Expand All @@ -173,15 +173,27 @@ static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg)
cpu = cbe_node_to_cpu(pmi_msg.data1);
cbe_pmode_new = pmi_msg.data2;

cpufreq_get_policy(&policy, cpu);
pmi_frequency_limit = cbe_freqs[cbe_pmode_new].frequency;

policy.max = min(policy.max, cbe_freqs[cbe_pmode_new].frequency);
policy.min = min(policy.min, policy.max);
pr_debug("cbe_handle_pmi: max freq=%d\n", pmi_frequency_limit);
}

static int pmi_notifier(struct notifier_block *nb,
unsigned long event, void *data)
{
struct cpufreq_policy *policy = data;

pr_debug("cbe_handle_pmi: new policy.min=%d policy.max=%d\n", policy.min, policy.max);
cpufreq_set_policy(&policy);
if (event != CPUFREQ_INCOMPATIBLE)
return 0;

cpufreq_verify_within_limits(policy, 0, pmi_frequency_limit);
return 0;
}

static struct notifier_block pmi_notifier_block = {
.notifier_call = pmi_notifier,
};

static struct pmi_handler cbe_pmi_handler = {
.type = PMI_TYPE_FREQ_CHANGE,
.handle_pmi_message = cbe_cpufreq_handle_pmi,
Expand Down Expand Up @@ -238,12 +250,21 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)

cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);

if (pmi_dev) {
/* frequency might get limited later, initialize limit with max_freq */
pmi_frequency_limit = max_freq;
cpufreq_register_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER);
}

/* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */
return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs);
}

static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy)
{
if (pmi_dev)
cpufreq_unregister_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER);

cpufreq_frequency_table_put_attr(policy->cpu);
return 0;
}
Expand Down
4 changes: 3 additions & 1 deletion arch/powerpc/platforms/cell/spufs/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
if (spu_init_csa(&ctx->csa))
goto out_free;
spin_lock_init(&ctx->mmio_lock);
spin_lock_init(&ctx->mapping_lock);
mutex_init(&ctx->mapping_lock);
kref_init(&ctx->kref);
mutex_init(&ctx->state_mutex);
mutex_init(&ctx->run_mutex);
Expand Down Expand Up @@ -103,6 +103,7 @@ void spu_forget(struct spu_context *ctx)

void spu_unmap_mappings(struct spu_context *ctx)
{
mutex_lock(&ctx->mapping_lock);
if (ctx->local_store)
unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1);
if (ctx->mfc)
Expand All @@ -117,6 +118,7 @@ void spu_unmap_mappings(struct spu_context *ctx)
unmap_mapping_range(ctx->mss, 0, 0x1000, 1);
if (ctx->psmap)
unmap_mapping_range(ctx->psmap, 0, 0x20000, 1);
mutex_unlock(&ctx->mapping_lock);
}

/**
Expand Down
57 changes: 29 additions & 28 deletions arch/powerpc/platforms/cell/spufs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ spufs_mem_open(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
file->private_data = ctx;
if (!i->i_openers++)
ctx->local_store = inode->i_mapping;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return 0;
}

Expand All @@ -59,10 +59,10 @@ spufs_mem_release(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->local_store = NULL;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return 0;
}

Expand Down Expand Up @@ -217,6 +217,7 @@ unsigned long spufs_get_unmapped_area(struct file *file, unsigned long addr,

static const struct file_operations spufs_mem_fops = {
.open = spufs_mem_open,
.release = spufs_mem_release,
.read = spufs_mem_read,
.write = spufs_mem_write,
.llseek = generic_file_llseek,
Expand Down Expand Up @@ -309,11 +310,11 @@ static int spufs_cntl_open(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
file->private_data = ctx;
if (!i->i_openers++)
ctx->cntl = inode->i_mapping;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return simple_attr_open(inode, file, spufs_cntl_get,
spufs_cntl_set, "0x%08lx");
}
Expand All @@ -326,10 +327,10 @@ spufs_cntl_release(struct inode *inode, struct file *file)

simple_attr_close(inode, file);

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->cntl = NULL;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return 0;
}

Expand Down Expand Up @@ -812,11 +813,11 @@ static int spufs_signal1_open(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
file->private_data = ctx;
if (!i->i_openers++)
ctx->signal1 = inode->i_mapping;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return nonseekable_open(inode, file);
}

Expand All @@ -826,10 +827,10 @@ spufs_signal1_release(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->signal1 = NULL;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return 0;
}

Expand Down Expand Up @@ -936,11 +937,11 @@ static int spufs_signal2_open(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
file->private_data = ctx;
if (!i->i_openers++)
ctx->signal2 = inode->i_mapping;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return nonseekable_open(inode, file);
}

Expand All @@ -950,10 +951,10 @@ spufs_signal2_release(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->signal2 = NULL;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return 0;
}

Expand Down Expand Up @@ -1154,10 +1155,10 @@ static int spufs_mss_open(struct inode *inode, struct file *file)

file->private_data = i->i_ctx;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
if (!i->i_openers++)
ctx->mss = inode->i_mapping;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return nonseekable_open(inode, file);
}

Expand All @@ -1167,10 +1168,10 @@ spufs_mss_release(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->mss = NULL;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return 0;
}

Expand Down Expand Up @@ -1211,11 +1212,11 @@ static int spufs_psmap_open(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
file->private_data = i->i_ctx;
if (!i->i_openers++)
ctx->psmap = inode->i_mapping;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return nonseekable_open(inode, file);
}

Expand All @@ -1225,10 +1226,10 @@ spufs_psmap_release(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->psmap = NULL;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return 0;
}

Expand Down Expand Up @@ -1281,11 +1282,11 @@ static int spufs_mfc_open(struct inode *inode, struct file *file)
if (atomic_read(&inode->i_count) != 1)
return -EBUSY;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
file->private_data = ctx;
if (!i->i_openers++)
ctx->mfc = inode->i_mapping;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return nonseekable_open(inode, file);
}

Expand All @@ -1295,10 +1296,10 @@ spufs_mfc_release(struct inode *inode, struct file *file)
struct spufs_inode_info *i = SPUFS_I(inode);
struct spu_context *ctx = i->i_ctx;

spin_lock(&ctx->mapping_lock);
mutex_lock(&ctx->mapping_lock);
if (!--i->i_openers)
ctx->mfc = NULL;
spin_unlock(&ctx->mapping_lock);
mutex_unlock(&ctx->mapping_lock);
return 0;
}

Expand Down
Loading

0 comments on commit 143a275

Please sign in to comment.