return 0;
}
+#ifdef XEN
+
+#define MAX_LOCAL_SAPIC 255
+static u16 ia64_acpiid_to_sapicid[ MAX_LOCAL_SAPIC ] =
+ {[0 ... MAX_LOCAL_SAPIC - 1] = 0xffff };
+
+/* acpi id to cpu id */
+int get_cpu_id(u8 acpi_id)
+{
+ int i;
+ u16 apic_id;
+
+ apic_id = ia64_acpiid_to_sapicid[acpi_id];
+ if ( apic_id == 0xffff )
+ return -EINVAL;
+
+ for ( i = 0; i < NR_CPUS; i++ )
+ {
+ if ( apic_id == ia64_cpu_to_sapicid[i] )
+ return i;
+ }
+
+ return -1;
+}
+#endif
+
static int __init
acpi_parse_lsapic(struct acpi_subtable_header * header, const unsigned long end)
{
#ifdef CONFIG_SMP
smp_boot_data.cpu_phys_id[available_cpus] =
(lsapic->id << 8) | lsapic->eid;
+#endif
+#ifdef XEN
+ ia64_acpiid_to_sapicid[lsapic->processor_id] =
+ (lsapic->id << 8) | lsapic->eid;
#endif
++available_cpus;
}
return ret;
}
-__initcall(cpufreq_driver_init);
-
-int get_cpu_id(u8 acpi_id)
-{
- return -1;
-}
-int xenpf_copy_px_states(struct processor_performance *pxpt,
- struct xen_processor_performance *dom0_px_info)
-{
- return -ENOSYS;
-}
+__initcall(cpufreq_driver_init);
int cpufreq_cpu_init(unsigned int cpuid)
{
- return -ENOSYS;
+ return cpufreq_add_cpu(cpuid);
}
--- /dev/null
+/******************************************************************************
+ * platform_hypercall.c
+ *
+ * Hardware platform operations. Intended for use by domain-0 kernel.
+ *
+ * Copyright (c) 2002-2006, K Fraser
+ */
+
+#include <xen/config.h>
+#include <xen/types.h>
+#include <xen/lib.h>
+#include <xen/sched.h>
+#include <xen/guest_access.h>
+#include <xen/acpi.h>
+#include <public/platform.h>
+#include <acpi/cpufreq/processor_perf.h>
+
+DEFINE_SPINLOCK(xenpf_lock);
+
+extern int set_px_pminfo(uint32_t cpu, struct xen_processor_performance *perf);
+extern long set_cx_pminfo(uint32_t cpu, struct xen_processor_power *power);
+
+int xenpf_copy_px_states(struct processor_performance *pxpt,
+ struct xen_processor_performance *dom0_px_info)
+{
+ if (!pxpt || !dom0_px_info)
+ return -EINVAL;
+ return copy_from_guest(pxpt->states, dom0_px_info->states,
+ dom0_px_info->state_count);
+}
+
+long do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
+{
+ long ret = 0;
+ struct xen_platform_op curop, *op = &curop;
+
+ if ( !IS_PRIV(current->domain) )
+ return -EPERM;
+
+ if ( copy_from_guest(op, u_xenpf_op, 1) )
+ return -EFAULT;
+
+ if ( op->interface_version != XENPF_INTERFACE_VERSION )
+ return -EACCES;
+
+ switch ( op->cmd )
+ {
+ case XENPF_set_processor_pminfo:
+ spin_lock(&xenpf_lock);
+ switch ( op->u.set_pminfo.type )
+ {
+ case XEN_PM_PX:
+ ret = set_px_pminfo(op->u.set_pminfo.id,
+ &op->u.set_pminfo.perf);
+ break;
+
+ case XEN_PM_CX:
+ /* Place holder for Cx */
+ ret = -ENOSYS;
+ break;
+
+ default:
+ ret = -EINVAL;
+ break;
+ }
+ spin_unlock(&xenpf_lock);
+ break;
+
+ default:
+ printk("Unknown platform hypercall op 0x%x\n", op->cmd);
+ ret = -ENOSYS;
+ break;
+ }
+
+ return ret;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
+