Commit c6bacd50 authored by Jesse Barnes's avatar Jesse Barnes Committed by David Mosberger

[PATCH] ia64: SGI SN update

parent f23ed56d
......@@ -82,9 +82,6 @@ config IA64_HP_ZX1
for the zx1 I/O MMU and makes root bus bridges appear in PCI config
space (required for zx1 agpgart support).
config IA64_SGI_SN1
bool "SGI-SN1"
config IA64_SGI_SN2
bool "SGI-SN2"
......@@ -288,7 +285,7 @@ config PM
config IOSAPIC
bool
depends on IA64_GENERIC || IA64_DIG || IA64_HP_ZX1
depends on IA64_GENERIC || IA64_DIG || IA64_HP_ZX1 || IA64_SGI_SN2
default y
config IA64_SGI_SN
......@@ -296,6 +293,11 @@ config IA64_SGI_SN
depends on IA64_SGI_SN1 || IA64_SGI_SN2
default y
config HWGFS_FS
bool
depends on IA64_SGI_SN1 || IA64_SGI_SN2
default y
config IA64_SGI_SN_DEBUG
bool "Enable extra debugging code"
depends on IA64_SGI_SN1 || IA64_SGI_SN2
......
......@@ -96,6 +96,9 @@ acpi_get_sysname (void)
if (!strcmp(hdr->oem_id, "HP")) {
return "hpzx1";
}
else if (!strcmp(hdr->oem_id, "SGI")) {
return "sn2";
}
return "dig";
#else
......@@ -103,8 +106,6 @@ acpi_get_sysname (void)
return "hpsim";
# elif defined (CONFIG_IA64_HP_ZX1)
return "hpzx1";
# elif defined (CONFIG_IA64_SGI_SN1)
return "sn1";
# elif defined (CONFIG_IA64_SGI_SN2)
return "sn2";
# elif defined (CONFIG_IA64_DIG)
......
......@@ -11,4 +11,4 @@
EXTRA_CFLAGS := -DLITTLE_ENDIAN
obj-y += kernel/ # io/
obj-y += kernel/ io/
......@@ -103,7 +103,7 @@ amount of memory present on nodes 0-3.
1GB*<dn>, where dn is the digit number. The amount of memory
is 8MB*2**<d>. (If <d> = 0, the memory size is 0).
SN1 doesnt support dimms this small but small memory systems
SN1 doesn't support dimms this small but small memory systems
boot faster on Medusa.
......
......@@ -13,7 +13,7 @@
* FPROM EFI memory descriptor build routines
*
* - Routines to build the EFI memory descriptor map
* - Should also be usable by the SGI SN1 prom to convert
* - Should also be usable by the SGI prom to convert
* klconfig to efi_memmap
*/
......@@ -53,10 +53,7 @@ sn_config_t *sn_config ;
#define KERNEL_SIZE (4*MB)
#define PROMRESERVED_SIZE (1*MB)
#ifdef CONFIG_IA64_SGI_SN1
#define PHYS_ADDRESS(_n, _x) (((long)_n<<33) | (long)_x)
#define MD_BANK_SHFT 30
#else
#ifdef SGI_SN2
#define PHYS_ADDRESS(_n, _x) (((long)_n<<38) | (long)_x | 0x3000000000UL)
#define MD_BANK_SHFT 34
#endif
......@@ -77,7 +74,7 @@ GetNumCpus(void)
return sn_config->cpus;
}
/* For SN1, get the index th nasid */
/* For SN, get the index th nasid */
int
GetNasid(int index)
......@@ -104,40 +101,7 @@ IsCpuPresent(int cnode, int cpu)
* actually disabled etc.
*/
#ifdef CONFIG_IA64_SGI_SN1
int
IsBankPresent(int index, node_memmap_t nmemmap)
{
switch (index) {
case 0:return nmemmap.b0;
case 1:return nmemmap.b1;
case 2:return nmemmap.b2;
case 3:return nmemmap.b3;
case 4:return nmemmap.b4;
case 5:return nmemmap.b5;
case 6:return nmemmap.b6;
case 7:return nmemmap.b7;
default:return -1 ;
}
}
int
GetBankSize(int index, node_memmap_t nmemmap)
{
switch (index) {
case 0:
case 1:return nmemmap.b01size;
case 2:
case 3:return nmemmap.b23size;
case 4:
case 5:return nmemmap.b45size;
case 6:
case 7:return nmemmap.b67size;
default:return -1 ;
}
}
#else
#ifdef SGI_SN2
int
IsBankPresent(int index, node_memmap_t nmemmap)
{
......@@ -192,12 +156,12 @@ build_efi_memmap(void *md, int mdsize)
for (cnode=0;cnode<numnodes;cnode++) {
nasid = GetNasid(cnode) ;
membank_info = GetMemBankInfo(cnode) ;
for (bank=0;bank<NR_BANKS_PER_NODE;bank++) {
for (bank=0;bank<MD_BANKS_PER_NODE;bank++) {
if (IsBankPresent(bank, membank_info)) {
bsize = GetBankSize(bank, membank_info) ;
paddr = PHYS_ADDRESS(nasid, (long)bank<<MD_BANK_SHFT);
numbytes = BankSizeBytes(bsize);
#ifdef CONFIG_IA64_SGI_SN2
#ifdef SGI_SN2
/*
* Ignore directory.
* Shorten memory chunk by 1 page - makes a better
......@@ -218,7 +182,7 @@ build_efi_memmap(void *md, int mdsize)
}
/*
* Check for the node 0 hole. Since banks can't
* Check for the node 0 hole. Since banks cant
* span the hole, we only need to check if the end of
* the range is the end of the hole.
*/
......@@ -226,7 +190,7 @@ build_efi_memmap(void *md, int mdsize)
numbytes -= NODE0_HOLE_SIZE;
/*
* UGLY hack - we must skip overr the kernel and
* PROM runtime services but we don't exactly where it is.
* PROM runtime services but we dont exactly where it is.
* So lets just reserve:
* node 0
* 0-1MB for PAL
......
......@@ -4,13 +4,13 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2000-2002 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
*/
#include <linux/config.h>
/*
* Structure of the mem config of the node as a SN1 MI reg
* Structure of the mem config of the node as a SN MI reg
* Medusa supports this reg config.
*
* BankSize nibble to bank size mapping
......@@ -24,32 +24,7 @@
#define MBSHIFT 20
#ifdef CONFIG_IA64_SGI_SN1
typedef struct node_memmap_s
{
unsigned int b0 :1, /* 0 bank 0 present */
b1 :1, /* 1 bank 1 present */
r01 :2, /* 2-3 reserved */
b01size :4, /* 4-7 Size of bank 0 and 1 */
b2 :1, /* 8 bank 2 present */
b3 :1, /* 9 bank 3 present */
r23 :2, /* 10-11 reserved */
b23size :4, /* 12-15 Size of bank 2 and 3 */
b4 :1, /* 16 bank 4 present */
b5 :1, /* 17 bank 5 present */
r45 :2, /* 18-19 reserved */
b45size :4, /* 20-23 Size of bank 4 and 5 */
b6 :1, /* 24 bank 6 present */
b7 :1, /* 25 bank 7 present */
r67 :2, /* 26-27 reserved */
b67size :4; /* 28-31 Size of bank 6 and 7 */
} node_memmap_t ;
/* Support the medusa hack for 8M/16M/32M nodes */
#define SN1_BANK_SIZE_SHIFT (MBSHIFT+6) /* 64 MB */
#define BankSizeBytes(bsize) ((bsize<6) ? (1<<((bsize-1)+SN1_BANK_SIZE_SHIFT)) :\
(1<<((bsize-9)+MBSHIFT)))
#else
#ifdef SGI_SN2
typedef struct node_memmap_s
{
unsigned int b0size :3, /* 0-2 bank 0 size */
......@@ -73,6 +48,8 @@ typedef struct node_memmap_s
#define SN2_BANK_SIZE_SHIFT (MBSHIFT+6) /* 64 MB */
#define BankPresent(bsize) (bsize<6)
#define BankSizeBytes(bsize) (BankPresent(bsize) ? 1UL<<((bsize)+SN2_BANK_SIZE_SHIFT) : 0)
#define MD_BANKS_PER_NODE 4
#define MD_BANKSIZE (1UL << 34)
#endif
typedef struct sn_memmap_s
......
......@@ -8,7 +8,7 @@
* Copyright (C) 1998-2000 Hewlett-Packard Co
* Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com>
*
* Copyright (C) 2000-2002 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
*/
......@@ -57,9 +57,7 @@
* be 0x00000ffffc000000, but on snia we use the (inverse swizzled)
* IOSPEC_BASE value
*/
#ifdef CONFIG_IA64_SGI_SN1
#define IOPB_PA 0xc0000FFFFC000000
#else
#ifdef SGI_SN2
#define IOPB_PA 0xc000000fcc000000
#endif
......@@ -84,10 +82,7 @@ _start:
// Isolate node number we are running on.
mov r6 = ip;;
#ifdef CONFIG_IA64_SGI_SN1
shr r5 = r6,33;; // r5 = node number
shl r6 = r5,33 // r6 = base memory address of node
#else
#ifdef SGI_SN2
shr r5 = r6,38 // r5 = node number
dep r6 = 0,r6,0,36 // r6 = base memory address of node
......@@ -99,7 +94,7 @@ _start:
or r1 = r1,r6 // Relocate to boot node
// Lets figure out who we are & put it in the LID register.
#ifdef CONFIG_IA64_SGI_SN2
#ifdef SGI_SN2
// On SN2, we (currently) pass the cpu number in r10 at boot
and r25=3,r10;;
movl r16=0x8000008110000400 // Allow IPIs
......@@ -324,10 +319,7 @@ static: cmp.eq p6,p7=6,r28 /* PAL_PTCE_INFO */
1: cmp.eq p6,p7=8,r28 /* PAL_VM_SUMMARY */
(p7) br.cond.sptk.few 1f
movl r8=0
#ifdef CONFIG_IA64_SGI_SN1
movl r9=0x0203083001151059
movl r10=0x1232
#else
#ifdef SGI_SN2
movl r9=0x0203083001151065
movl r10=0x183f
#endif
......
......@@ -5,7 +5,7 @@
* Copyright (C) 1998-2000 David Mosberger-Tang <davidm@hpl.hp.com>
*
*
* Copyright (C) 2000-2002 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License
......@@ -36,14 +36,13 @@
* http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#include <linux/config.h>
#include <asm/sn/pda.h>
#include <linux/efi.h>
#include <asm/pal.h>
#include <asm/sal.h>
#include <asm/sn/sn_sal.h>
#include <asm/processor.h>
#include <asm/sn/sn_cpuid.h>
#ifdef CONFIG_IA64_SGI_SN2
#ifdef SGI_SN2
#include <asm/sn/sn2/addrs.h>
#include <asm/sn/sn2/shub_mmr.h>
#endif
......@@ -69,10 +68,7 @@
#define ACPI_SLIT_REVISION 1
#define OEMID "SGI"
#ifdef CONFIG_IA64_SGI_SN1
#define PRODUCT "SN1"
#define PROXIMITY_DOMAIN(nasid) (nasid)
#else
#ifdef SGI_SN2
#define PRODUCT "SN2"
#define PROXIMITY_DOMAIN(nasid) (((nasid)>>1) & 255)
#endif
......@@ -100,12 +96,7 @@
typedef union ia64_nasid_va {
struct {
#if defined(CONFIG_IA64_SGI_SN1)
unsigned long off : 33; /* intra-region offset */
unsigned long nasid : 7; /* NASID */
unsigned long off2 : 21; /* fill */
unsigned long reg : 3; /* region number */
#elif defined(CONFIG_IA64_SGI_SN2)
#if defined(SGI_SN2)
unsigned long off : 36; /* intra-region offset */
unsigned long attr : 2;
unsigned long nasid : 11; /* NASID */
......@@ -125,9 +116,7 @@ typedef struct {
#define IS_VIRTUAL_MODE() ({struct ia64_psr psr; asm("mov %0=psr" : "=r"(psr)); psr.dt;})
#define ADDR_OF(p) (IS_VIRTUAL_MODE() ? ((void*)((long)(p)+PAGE_OFFSET)) : ((void*) (p)))
#if defined(CONFIG_IA64_SGI_SN1)
#define __fwtab_pa(n,x) ({ia64_nasid_va _v; _v.l = (long) (x); _v.f.nasid = (x) ? (n) : 0; _v.f.reg = 0; _v.l;})
#elif defined(CONFIG_IA64_SGI_SN2)
#if defined(SGI_SN2)
#define __fwtab_pa(n,x) ({ia64_nasid_va _v; _v.l = (long) (x); _v.f.nasid = (x) ? (n) : 0; _v.f.reg = 0; _v.f.attr = 3; _v.l;})
#endif
......@@ -208,7 +197,7 @@ efi_unimplemented (void)
return EFI_UNSUPPORTED;
}
#ifdef CONFIG_IA64_SGI_SN2
#ifdef SGI_SN2
#undef cpu_physical_id
#define cpu_physical_id(cpuid) ((ia64_get_lid() >> 16) & 0xffff)
......@@ -301,7 +290,7 @@ sal_emulator (long index, unsigned long in1, unsigned long in2,
;
} else if (index == SAL_UPDATE_PAL) {
;
#ifdef CONFIG_IA64_SGI_SN2
#ifdef SGI_SN2
} else if (index == SN_SAL_LOG_CE) {
#ifdef ajmtestcpei
fprom_send_cpei();
......@@ -501,9 +490,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
/*
* Pass the parameter base address to the build_efi_xxx routines.
*/
#if defined(CONFIG_IA64_SGI_SN1)
build_init(8LL*GB*base_nasid);
#else
#if defined(SGI_SN2)
build_init(0x3000000000UL | ((long)base_nasid<<38));
#endif
......@@ -559,7 +546,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
* You can also edit this line to pass other arguments to the kernel.
* Note: disable kernel text replication.
*/
strcpy(cmd_line, "init=/bin/bash ktreplicate=0");
strcpy(cmd_line, "init=/bin/bash console=ttyS0");
memset(efi_systab, 0, sizeof(efi_systab));
efi_systab->hdr.signature = EFI_SYSTEM_TABLE_SIGNATURE;
......@@ -625,10 +612,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
lsapic20->header.length = sizeof(struct acpi_table_lsapic);
lsapic20->acpi_id = cnode*4+cpu;
lsapic20->flags.enabled = 1;
#if defined(CONFIG_IA64_SGI_SN1)
lsapic20->eid = cpu;
lsapic20->id = nasid;
#else
#if defined(SGI_SN2)
lsapic20->eid = nasid&0xffff;
lsapic20->id = (cpu<<4) | (nasid>>16);
#endif
......@@ -649,12 +633,9 @@ sys_fw_init (const char *args, int arglen, int bsp)
srat_memory_affinity->proximity_domain = PROXIMITY_DOMAIN(nasid);
srat_memory_affinity->base_addr_lo = 0;
srat_memory_affinity->length_lo = 0;
#if defined(CONFIG_IA64_SGI_SN1)
srat_memory_affinity->base_addr_hi = nasid<<1;
srat_memory_affinity->length_hi = SN1_NODE_SIZE>>32;
#else
#if defined(SGI_SN2)
srat_memory_affinity->base_addr_hi = (nasid<<6) | (3<<4);
srat_memory_affinity->length_hi = SN2_NODE_SIZE>>32;
srat_memory_affinity->length_hi = (MD_BANKSIZE*MD_BANKS_PER_NODE)>>32;
#endif
srat_memory_affinity->memory_type = ACPI_ADDRESS_RANGE_MEMORY;
srat_memory_affinity->flags.enabled = 1;
......@@ -671,10 +652,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
srat_cpu_affinity->header.length = sizeof(struct acpi_table_processor_affinity);
srat_cpu_affinity->proximity_domain = PROXIMITY_DOMAIN(nasid);
srat_cpu_affinity->flags.enabled = 1;
#if defined(CONFIG_IA64_SGI_SN1)
srat_cpu_affinity->apic_id = nasid;
srat_cpu_affinity->lsapic_eid = cpu;
#else
#if defined(SGI_SN2)
srat_cpu_affinity->lsapic_eid = nasid&0xffff;
srat_cpu_affinity->apic_id = (cpu<<4) | (nasid>>16);
#endif
......@@ -708,7 +686,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
sal_systab->sal_b_rev_minor = 0x0; /* 1.00 */
strcpy(sal_systab->oem_id, "SGI");
strcpy(sal_systab->product_id, "SN1");
strcpy(sal_systab->product_id, "SN2");
/* fill in an entry point: */
sal_ed->type = SAL_DESC_ENTRY_POINT;
......@@ -757,7 +735,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
sal_systab->checksum = -checksum;
/* If the checksum is correct, the kernel tries to use the
* table. We don't build enough table & the kernel aborts.
* table. We dont build enough table & the kernel aborts.
* Note that the PROM hasd thhhe same problem!!
*/
......@@ -786,9 +764,7 @@ sys_fw_init (const char *args, int arglen, int bsp)
for(cpu=0; cpu<CPUS_PER_NODE; cpu++) {
if (!IsCpuPresent(cnode, cpu))
continue;
#ifdef CONFIG_IA64_SGI_SN1
bsp_lid = (GetNasid(cnode)<<24) | (cpu<<16);
#else
#ifdef SGI_SN2
bsp_lid = (GetNasid(cnode)<<16) | (cpu<<28);
#endif
if (bsp-- > 0)
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2000-2001 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
*/
......@@ -33,25 +33,9 @@ fmain(int lid, int bsp) {
* First lets figure out who we are. This is done from the
* LID passed to us.
*/
#ifdef CONFIG_IA64_SGI_SN1
nasid = (lid>>24);
syn = (lid>>17)&1;
cpu = (lid>>16)&1;
/*
* Now pick a synergy master to initialize synergy registers.
*/
if (test_and_set_bit(syn, &nasidmaster[nasid]) == 0) {
synergy_init(nasid, syn);
test_and_set_bit(syn+2, &nasidmaster[nasid]);
} else
while (get_bit(syn+2, &nasidmaster[nasid]) == 0);
#else
nasid = (lid>>16)&0xfff;
cpu = (lid>>28)&3;
syn = 0;
#endif
/*
* Now pick a nasid master to initialize Bedrock registers.
......
......@@ -7,7 +7,7 @@
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (c) 2001-2002 Silicon Graphics, Inc. All rights reserved.
# Copyright (c) 2001-2003 Silicon Graphics, Inc. All rights reserved.
#
help() {
......@@ -37,6 +37,7 @@ while getopts "$OPTS" c ; do
done
shift `expr $OPTIND - 1`
#OBJDUMP=/usr/bin/ia64-linux-objdump
LINUX=${1:-vmlinux}
TEXTSYM=${2:-${LINUX}.sym}
TMPSYM=${2:-${LINUX}.sym.tmp}
......@@ -130,6 +131,8 @@ END
awk '
/ _start$/ {start=1}
/ start_ap$/ {start=1}
/__start_gate_section/ {start=1}
/^'${dataprefix}\|${textprefix}'/ {
if ($4 == ".kdb")
......@@ -142,7 +145,7 @@ awk '
n = 0
s = $(NF-1)
while (length(s) > 0) {
n = n*16 + substr(s,1,1)
n = n*16 + (index("0123456789abcdef", substr(s,1,1)) - 1)
s = substr(s,2)
}
printf "GLOBAL | %s | DATA | %s | %d\n", $1, $NF, n
......
......@@ -9,18 +9,15 @@
# Makefile for the sn io routines.
#
EXTRA_CFLAGS := -DLITTLE_ENDIAN
EXTRA_CFLAGS := -DLITTLE_ENDIAN -DSHUB_SWAP_WAR
ifdef CONFIG_IA64_SGI_SN2
EXTRA_CFLAGS += -DSHUB_SWAP_WAR
endif
obj-$(CONFIG_IA64_SGI_SN) += stubs.o sgi_if.o xswitch.o klgraph_hack.o \
hcl.o labelcl.o invent.o sgi_io_sim.o \
klgraph_hack.o hcl_util.o cdl.o hubdev.o hubspc.o \
alenlist.o pci.o pci_dma.o ate_utils.o \
ifconfig_net.o io.o ioconfig_bus.o
obj-$(CONFIG_IA64_SGI_SN) += sgi_if.o xswitch.o sgi_io_sim.o cdl.o ate_utils.o \
io.o machvec/ drivers/ platform_init/
obj-$(CONFIG_IA64_SGI_SN2) += sn2/
obj-$(CONFIG_PCIBA) += pciba.o
ifdef CONFIG_HWGFS_FS
obj-$(CONFIG_HWGFS_FS) += hwgfs/
else
obj-$(CONFIG_DEVFS_FS) += hwgdfs/
endif
This diff is collapsed.
......@@ -4,7 +4,7 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1992 - 1997, 2000-2002 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
*/
#include <linux/types.h>
......@@ -27,7 +27,6 @@
#include <asm/sn/ioerror_handling.h>
#include <asm/sn/xtalk/xbow.h>
#include <asm/sn/ioc3.h>
#include <asm/sn/eeprom.h>
#include <asm/sn/sn_private.h>
#include <asm/sn/ate_utils.h>
......
......@@ -4,7 +4,7 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1992 - 1997, 2000-2002 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
*/
#include <linux/config.h>
......@@ -18,9 +18,9 @@
#include <asm/sn/xtalk/xbow.h>
/* these get called directly in cdl_add_connpt in fops bypass hack */
extern int pcibr_attach(devfs_handle_t);
extern int xbow_attach(devfs_handle_t);
extern int pic_attach(devfs_handle_t);
extern int pcibr_attach(vertex_hdl_t);
extern int xbow_attach(vertex_hdl_t);
extern int pic_attach(vertex_hdl_t);
/*
......@@ -32,74 +32,19 @@ extern int pic_attach(devfs_handle_t);
* IO Infrastructure Drivers e.g. pcibr.
*/
struct cdl {
int part_num;
int mfg_num;
int (*attach) (devfs_handle_t);
} dummy_reg;
#ifdef CONFIG_IA64_SGI_SN1
#define MAX_SGI_IO_INFRA_DRVR 4
#else
#define MAX_SGI_IO_INFRA_DRVR 7
#endif
static struct cdl sgi_infrastructure_drivers[MAX_SGI_IO_INFRA_DRVR] =
{
{ XBRIDGE_WIDGET_PART_NUM, XBRIDGE_WIDGET_MFGR_NUM, pcibr_attach /* &pcibr_fops */},
{ BRIDGE_WIDGET_PART_NUM, BRIDGE_WIDGET_MFGR_NUM, pcibr_attach /* &pcibr_fops */},
#ifndef CONFIG_IA64_SGI_SN1
{ PIC_WIDGET_PART_NUM_BUS0, PIC_WIDGET_MFGR_NUM, pic_attach /* &pic_fops */},
{ PIC_WIDGET_PART_NUM_BUS1, PIC_WIDGET_MFGR_NUM, pic_attach /* &pic_fops */},
#endif
{ XXBOW_WIDGET_PART_NUM, XXBOW_WIDGET_MFGR_NUM, xbow_attach /* &xbow_fops */},
{ XBOW_WIDGET_PART_NUM, XBOW_WIDGET_MFGR_NUM, xbow_attach /* &xbow_fops */},
#ifndef CONFIG_IA64_SGI_SN1
{ PXBOW_WIDGET_PART_NUM, XXBOW_WIDGET_MFGR_NUM, xbow_attach /* &xbow_fops */},
#endif
};
/*
* cdl_new: Called by pciio and xtalk.
*/
cdl_p
cdl_new(char *name, char *k1str, char *k2str)
{
/*
* Just return a dummy pointer.
*/
return((cdl_p)&dummy_reg);
}
/*
* cdl_del: Do nothing.
*/
void
cdl_del(cdl_p reg)
{
return;
}
/*
* cdl_add_driver: The driver part number and manufacturers number
* are statically initialized above.
*
Do nothing.
*/
int
cdl_add_driver(cdl_p reg, int key1, int key2, char *prefix, int flags, cdl_drv_f *func)
{
return 0;
}
/*
* cdl_del_driver: Not supported.
*/
void
cdl_del_driver(cdl_p reg, char *prefix, cdl_drv_f *func)
{
return;
}
/*
* cdl_add_connpt: We found a device and it's connect point. Call the
* attach routine of that driver.
......@@ -112,8 +57,8 @@ cdl_del_driver(cdl_p reg, char *prefix, cdl_drv_f *func)
* vertices.
*/
int
cdl_add_connpt(cdl_p reg, int part_num, int mfg_num,
devfs_handle_t connpt, int drv_flags)
cdl_add_connpt(int part_num, int mfg_num,
vertex_hdl_t connpt, int drv_flags)
{
int i;
......@@ -121,7 +66,6 @@ cdl_add_connpt(cdl_p reg, int part_num, int mfg_num,
* Find the driver entry point and call the attach routine.
*/
for (i = 0; i < MAX_SGI_IO_INFRA_DRVR; i++) {
if ( (part_num == sgi_infrastructure_drivers[i].part_num) &&
( mfg_num == sgi_infrastructure_drivers[i].mfg_num) ) {
/*
......@@ -139,73 +83,3 @@ cdl_add_connpt(cdl_p reg, int part_num, int mfg_num,
return (0);
}
/*
* cdl_del_connpt: Not implemented.
*/
int
cdl_del_connpt(cdl_p reg, int key1, int key2, devfs_handle_t connpt, int drv_flags)
{
return(0);
}
/*
* cdl_iterate: Not Implemented.
*/
void
cdl_iterate(cdl_p reg,
char *prefix,
cdl_iter_f * func)
{
return;
}
async_attach_t
async_attach_new(void)
{
return(0);
}
void
async_attach_free(async_attach_t aa)
{
return;
}
async_attach_t
async_attach_get_info(devfs_handle_t vhdl)
{
return(0);
}
void
async_attach_add_info(devfs_handle_t vhdl, async_attach_t aa)
{
return;
}
void
async_attach_del_info(devfs_handle_t vhdl)
{
return;
}
void async_attach_signal_start(async_attach_t aa)
{
return;
}
void async_attach_signal_done(async_attach_t aa)
{
return;
}
void async_attach_waitall(async_attach_t aa)
{
return;
}
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 2002-2003 Silicon Graphics, Inc. All Rights Reserved.
#
# Makefile for the sn2 io routines.
EXTRA_CFLAGS := -DLITTLE_ENDIAN
obj-y += hubdev.o ioconfig_bus.o ifconfig_net.o
obj-$(CONFIG_PCIBA) += pciba.o
/* $Id$
*
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1992 - 1997, 2000-2002 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 1992-1997,2000-2003 Silicon Graphics, Inc. All rights reserved.
*/
#include <linux/config.h>
......@@ -13,21 +12,20 @@
#include <asm/sn/sgi.h>
#include <asm/sn/io.h>
#include <asm/sn/iograph.h>
#include <asm/sn/sn1/hubdev.h>
#include <asm/sn/sn_private.h>
#include <asm/sn/invent.h>
#include <asm/sn/hcl.h>
#include <asm/sn/labelcl.h>
struct hubdev_callout {
int (*attach_method)(devfs_handle_t);
int (*attach_method)(vertex_hdl_t);
struct hubdev_callout *fp;
};
typedef struct hubdev_callout hubdev_callout_t;
mutex_t hubdev_callout_mutex;
hubdev_callout_t *hubdev_callout_list = NULL;
static hubdev_callout_t *hubdev_callout_list;
void
hubdev_init(void)
......@@ -37,7 +35,7 @@ hubdev_init(void)
}
void
hubdev_register(int (*attach_method)(devfs_handle_t))
hubdev_register(int (*attach_method)(vertex_hdl_t))
{
hubdev_callout_t *callout;
......@@ -57,7 +55,7 @@ hubdev_register(int (*attach_method)(devfs_handle_t))
}
int
hubdev_unregister(int (*attach_method)(devfs_handle_t))
hubdev_unregister(int (*attach_method)(vertex_hdl_t))
{
hubdev_callout_t **p;
......@@ -82,7 +80,7 @@ hubdev_unregister(int (*attach_method)(devfs_handle_t))
int
hubdev_docallouts(devfs_handle_t hub)
hubdev_docallouts(vertex_hdl_t hub)
{
hubdev_callout_t *p;
int errcode;
......@@ -100,33 +98,3 @@ hubdev_docallouts(devfs_handle_t hub)
mutex_unlock(&hubdev_callout_mutex);
return (0);
}
/*
* Given a hub vertex, return the base address of the Hspec space
* for that hub.
*/
#if defined(CONFIG_IA64_SGI_SN1)
caddr_t
hubdev_prombase_get(devfs_handle_t hub)
{
hubinfo_t hinfo = NULL;
hubinfo_get(hub, &hinfo);
ASSERT(hinfo);
return ((caddr_t)NODE_RBOOT_BASE(hinfo->h_nasid));
}
cnodeid_t
hubdev_cnodeid_get(devfs_handle_t hub)
{
hubinfo_t hinfo = NULL;
hubinfo_get(hub, &hinfo);
ASSERT(hinfo);
return hinfo->h_cnodeid;
}
#endif /* CONFIG_IA64_SGI_SN1 */
......@@ -6,7 +6,7 @@
*
* ifconfig_net - SGI's Persistent Network Device names.
*
* Copyright (C) 1992-1997, 2000-2002 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 1992-1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
*/
#include <linux/types.h>
......@@ -37,8 +37,8 @@
/*
* Some Global definitions.
*/
devfs_handle_t ifconfig_net_handle = NULL;
unsigned long ifconfig_net_debug = 0;
static devfs_handle_t ifconfig_net_handle;
static unsigned long ifconfig_net_debug;
/*
* ifconfig_net_open - Opens the special device node "/devhw/.ifconfig_net".
......
/* $Id$
*
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
......@@ -35,8 +34,8 @@
/*
* Some Global definitions.
*/
devfs_handle_t ioconfig_bus_handle = NULL;
unsigned long ioconfig_bus_debug = 0;
static vertex_hdl_t ioconfig_bus_handle;
static unsigned long ioconfig_bus_debug;
#ifdef IOCONFIG_BUS_DEBUG
#define DBG(x...) printk(x)
......@@ -44,22 +43,22 @@ unsigned long ioconfig_bus_debug = 0;
#define DBG(x...)
#endif
u64 ioconfig_file = 0;
u64 ioconfig_file_size = 0;
u64 ioconfig_activated = 0;
char ioconfig_kernopts[128];
static u64 ioconfig_file;
static u64 ioconfig_file_size;
static u64 ioconfig_activated;
static char ioconfig_kernopts[128];
/*
* For debugging purpose .. hardcode a table ..
*/
struct ascii_moduleid *ioconfig_bus_table;
u64 ioconfig_bus_table_size = 0;
u64 ioconfig_bus_table_size;
int free_entry = 0;
int new_entry = 0;
static int free_entry;
static int new_entry;
int next_basebus_number = 0;
int next_basebus_number;
void
ioconfig_get_busnum(char *io_moduleid, int *bus_num)
......@@ -96,8 +95,8 @@ ioconfig_get_busnum(char *io_moduleid, int *bus_num)
free_entry++;
}
void
dump_ioconfig_table()
static void
dump_ioconfig_table(void)
{
int index = 0;
......@@ -264,14 +263,14 @@ ioconfig_bus_init(void)
*/
DBG("ioconfig_bus_init: Kernel Options given.\n");
(void) build_moduleid_table((char *)ioconfig_kernopts, ioconfig_bus_table);
(void) dump_ioconfig_table(ioconfig_bus_table);
(void) dump_ioconfig_table();
return;
}
if (ioconfig_activated) {
DBG("ioconfig_bus_init: ioconfig file given.\n");
(void) build_moduleid_table((char *)ioconfig_file, ioconfig_bus_table);
(void) dump_ioconfig_table(ioconfig_bus_table);
(void) dump_ioconfig_table();
} else {
DBG("ioconfig_bus_init: ioconfig command not executed in prom\n");
}
......@@ -295,7 +294,7 @@ ioconfig_bus_new_entries(void)
index = new_entry;
temp = &ioconfig_bus_table[index];
while (index < free_entry) {
printk("%s\n", temp);
printk("%s\n", (char *)temp);
temp++;
index++;
}
......
......@@ -17,7 +17,7 @@
* Public License. See the file "COPYING" in the main directory of
* this archive for more details.
*
* Copyright (C) 2001-2002 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 2001-2003 Silicon Graphics, Inc. All rights reserved.
*
* 03262001 - Initial version by Chad Talbott
*/
......@@ -40,12 +40,12 @@
#include <linux/config.h>
#ifndef CONFIG_DEVFS_FS
# error PCIBA requires devfs
#endif
#include <linux/module.h>
#include <linux/devfs_fs_kernel.h>
#include <asm/sn/sgi.h>
#include <asm/sn/iograph.h>
#include <asm/sn/invent.h>
#include <asm/sn/hcl.h>
#include <asm/sn/labelcl.h>
#include <linux/pci.h>
#include <linux/list.h>
......@@ -58,6 +58,7 @@
#include <linux/capability.h>
#include <asm/uaccess.h>
#include <asm/sn/sgi.h>
#include <asm/io.h>
#include <asm/pgalloc.h>
#include <asm/page.h>
......@@ -139,7 +140,7 @@ struct node_data {
/* flat list of all the device nodes. makes it easy to free
them all when we're unregistered */
struct list_head global_node_list;
devfs_handle_t devfs_handle;
vertex_hdl_t devfs_handle;
void (* cleanup)(struct node_data *);
......@@ -183,7 +184,7 @@ void __exit pciba_exit(void);
static status __init register_with_devfs(void);
static void __exit unregister_with_devfs(void);
static status __init register_pci_device(devfs_handle_t device_dir_handle,
static status __init register_pci_device(vertex_hdl_t device_dir_handle,
struct pci_dev * dev);
/* file operations */
......@@ -281,52 +282,18 @@ free_nodes(void)
}
#endif
#if !defined(CONFIG_IA64_SGI_SN1)
static status __init
register_with_devfs(void)
{
struct pci_dev * dev;
devfs_handle_t device_dir_handle;
char devfs_path[40];
TRACE();
if (!devfs_mk_dir(NULL, "pci", NULL))
return failure;
/* FIXME: don't forget /dev/pci/mem & /dev/pci/io */
pci_for_each_dev(dev) {
sprintf(devfs_path, "pci/%02x/%02x.%x",
dev->bus->number,
PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn));
device_dir_handle =
devfs_mk_dir(NULL, devfs_path, NULL);
if (device_dir_handle == NULL)
return failure;
if (register_pci_device(device_dir_handle, dev) == failure) {
devfs_remove("pci");
return failure;
}
}
return success;
}
static vertex_hdl_t pciba_devfs_handle;
#else
extern devfs_handle_t
extern vertex_hdl_t
devfn_to_vertex(unsigned char busnum, unsigned int devfn);
static status __init
register_with_devfs(void)
{
struct pci_dev * dev;
devfs_handle_t device_dir_handle;
vertex_hdl_t device_dir_handle;
TRACE();
......@@ -339,7 +306,7 @@ register_with_devfs(void)
return failure;
if (register_pci_device(device_dir_handle, dev) == failure) {
devfs_remove("pci");
hwgraph_vertex_destroy(pciba_devfs_handle);
return failure;
}
}
......@@ -357,7 +324,7 @@ unregister_with_devfs(void)
list_for_each(lhp, &global_node_list) {
nd = list_entry(lhp, struct node_data, global_node_list);
devfs_unregister(nd->devfs_handle);
hwgraph_vertex_destroy(nd->devfs_handle);
}
}
......@@ -385,12 +352,12 @@ void dma_cleanup(struct node_data * dma_node)
#ifdef DEBUG_PCIBA
dump_allocations(&dma_node->u.dma.dma_allocs);
#endif
devfs_unregister(dma_node->devfs_handle);
hwgraph_vertex_destroy(dma_node->devfs_handle);
}
void init_dma_node(struct node_data * node,
struct pci_dev * dev, devfs_handle_t dh)
struct pci_dev * dev, vertex_hdl_t dh)
{
TRACE();
......@@ -409,12 +376,12 @@ void rom_cleanup(struct node_data * rom_node)
pci_write_config_dword(rom_node->u.rom.dev,
PCI_ROM_ADDRESS,
rom_node->u.rom.saved_rom_base_reg);
devfs_unregister(rom_node->devfs_handle);
hwgraph_vertex_destroy(rom_node->devfs_handle);
}
void init_rom_node(struct node_data * node,
struct pci_dev * dev, devfs_handle_t dh)
struct pci_dev * dev, vertex_hdl_t dh)
{
TRACE();
......@@ -426,11 +393,11 @@ void init_rom_node(struct node_data * node,
static status __init
register_pci_device(devfs_handle_t device_dir_handle, struct pci_dev * dev)
register_pci_device(vertex_hdl_t device_dir_handle, struct pci_dev * dev)
{
struct node_data * nd;
char devfs_path[20];
devfs_handle_t node_devfs_handle;
vertex_hdl_t node_devfs_handle;
int ri;
TRACE();
......@@ -440,10 +407,10 @@ register_pci_device(devfs_handle_t device_dir_handle, struct pci_dev * dev)
for (ri = 0; ri < PCI_ROM_RESOURCE; ri++) {
if (pci_resource_len(dev, ri) != 0) {
sprintf(devfs_path, "base/%d", ri);
if (devfs_register(device_dir_handle, devfs_path,
DEVFS_FL_NONE,
if (hwgraph_register(device_dir_handle, devfs_path,
0, DEVFS_FL_NONE,
0, 0,
S_IFREG | S_IRUSR | S_IWUSR,
S_IFCHR | S_IRUSR | S_IWUSR, 0, 0,
&base_fops,
&dev->resource[ri]) == NULL)
return failure;
......@@ -455,9 +422,9 @@ register_pci_device(devfs_handle_t device_dir_handle, struct pci_dev * dev)
for (ri = 0; ri < PCI_ROM_RESOURCE; ri++) {
if (dev->resource[ri].flags & IORESOURCE_MEM &&
pci_resource_len(dev, ri) != 0) {
if (devfs_register(device_dir_handle, "mem",
DEVFS_FL_NONE, 0, 0,
S_IFREG | S_IRUSR | S_IWUSR,
if (hwgraph_register(device_dir_handle, "mem",
0, DEVFS_FL_NONE, 0, 0,
S_IFCHR | S_IRUSR | S_IWUSR, 0, 0,
&base_fops,
&dev->resource[ri]) == NULL)
return failure;
......@@ -470,9 +437,9 @@ register_pci_device(devfs_handle_t device_dir_handle, struct pci_dev * dev)
for (ri = 0; ri < PCI_ROM_RESOURCE; ri++) {
if (dev->resource[ri].flags & IORESOURCE_IO &&
pci_resource_len(dev, ri) != 0) {
if (devfs_register(device_dir_handle, "io",
DEVFS_FL_NONE, 0, 0,
S_IFREG | S_IRUSR | S_IWUSR,
if (hwgraph_register(device_dir_handle, "io",
0, DEVFS_FL_NONE, 0, 0,
S_IFCHR | S_IRUSR | S_IWUSR, 0, 0,
&base_fops,
&dev->resource[ri]) == NULL)
return failure;
......@@ -486,9 +453,9 @@ register_pci_device(devfs_handle_t device_dir_handle, struct pci_dev * dev)
nd = new_node();
if (nd == NULL)
return failure;
node_devfs_handle = devfs_register(device_dir_handle, "rom",
DEVFS_FL_NONE, 0, 0,
S_IFREG | S_IRUSR,
node_devfs_handle = hwgraph_register(device_dir_handle, "rom",
0, DEVFS_FL_NONE, 0, 0,
S_IFCHR | S_IRUSR, 0, 0,
&rom_fops, nd);
if (node_devfs_handle == NULL)
return failure;
......@@ -497,8 +464,8 @@ register_pci_device(devfs_handle_t device_dir_handle, struct pci_dev * dev)
/* register a node that allows ioctl's to read and write to
the device's config space */
if (devfs_register(device_dir_handle, "config", DEVFS_FL_NONE,
0, 0, S_IFREG | S_IRUSR | S_IWUSR,
if (hwgraph_register(device_dir_handle, "config", 0, DEVFS_FL_NONE,
0, 0, S_IFCHR | S_IRUSR | S_IWUSR, 0, 0,
&config_fops, dev) == NULL)
return failure;
......@@ -510,8 +477,8 @@ register_pci_device(devfs_handle_t device_dir_handle, struct pci_dev * dev)
if (nd == NULL)
return failure;
node_devfs_handle =
devfs_register(device_dir_handle, "dma", DEVFS_FL_NONE,
0, 0, S_IFREG | S_IRUSR | S_IWUSR,
hwgraph_register(device_dir_handle, "dma", 0, DEVFS_FL_NONE,
0, 0, S_IFCHR | S_IRUSR | S_IWUSR, 0, 0,
&dma_fops, nd);
if (node_devfs_handle == NULL)
return failure;
......@@ -545,7 +512,11 @@ rom_mmap(struct file * file, struct vm_area_struct * vma)
TRACE();
#ifdef CONFIG_HWGFS_FS
nd = (struct node_data * )file->f_dentry->d_fsdata;
#else
nd = (struct node_data * )file->private_data;
#endif
pci_pa = pci_resource_start(nd->u.rom.dev, PCI_ROM_RESOURCE);
......@@ -575,7 +546,11 @@ rom_release(struct inode * inode, struct file * file)
TRACE();
#ifdef CONFIG_HWGFS_FS
nd = (struct node_data * )file->f_dentry->d_fsdata;
#else
nd = (struct node_data * )file->private_data;
#endif
if (nd->u.rom.mmapped) {
nd->u.rom.mmapped = false;
......@@ -594,7 +569,11 @@ base_mmap(struct file * file, struct vm_area_struct * vma)
TRACE();
#ifdef CONFIG_HWGFS_FS
resource = (struct resource *)file->f_dentry->d_fsdata;
#else
resource = (struct resource *)file->private_data;
#endif
return mmap_pci_address(vma, resource->start);
}
......@@ -622,7 +601,11 @@ config_ioctl(struct inode * inode, struct file * file,
_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), _IOC_SIZE(cmd));
DPRINTF("arg = %lx\n", arg);
#ifdef CONFIG_HWGFS_FS
dev = (struct pci_dev *)file->f_dentry->d_fsdata;
#else
dev = (struct pci_dev *)file->private_data;
#endif
/* PCIIOCCFG{RD,WR}: read and/or write PCI configuration
space. If both, the read happens first (this becomes a swap
......@@ -752,7 +735,11 @@ dma_ioctl(struct inode * inode, struct file * file,
DPRINTF("cmd = %x\n", cmd);
DPRINTF("arg = %lx\n", arg);
#ifdef CONFIG_HWGFS_FS
nd = (struct node_data *)file->f_dentry->d_fsdata;
#else
nd = (struct node_data *)file->private_data;
#endif
#ifdef DEBUG_PCIBA
DPRINTF("at dma_ioctl entry\n");
......@@ -849,7 +836,11 @@ dma_mmap(struct file * file, struct vm_area_struct * vma)
TRACE();
#ifdef CONFIG_HWGFS_FS
nd = (struct node_data *)file->f_dentry->d_fsdata;
#else
nd = (struct node_data *)file->private_data;
#endif
DPRINTF("vma->vm_start is %lx\n", vma->vm_start);
DPRINTF("vma->vm_end is %lx\n", vma->vm_end);
......
This diff is collapsed.
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2001 Silicon Graphics, Inc.
* Copyright (C) 2001 by Ralf Baechle
*/
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/errno.h>
#include <linux/efi.h>
#include <asm/sn/klclock.h>
/*
* No locking necessary when this is called from efirtc which protects us
* from racing by efi_rtc_lock.
*/
#define __swizzle(addr) ((u8 *)((unsigned long)(addr) ^ 3))
#define read_io_port(addr) (*(volatile u8 *) __swizzle(addr))
#define write_io_port(addr, data) (*(volatile u8 *) __swizzle(addr) = (data))
#define TOD_SGS_M48T35 1
#define TOD_DALLAS_DS1386 2
static unsigned long nvram_base = 0;
static int tod_chip_type;
static int
get_tod_chip_type(void)
{
unsigned char testval;
write_io_port(RTC_DAL_CONTROL_ADDR, RTC_DAL_UPDATE_DISABLE);
write_io_port(RTC_DAL_DAY_ADDR, 0xff);
write_io_port(RTC_DAL_CONTROL_ADDR, RTC_DAL_UPDATE_ENABLE);
testval = read_io_port(RTC_DAL_DAY_ADDR);
if (testval == 0xff)
return TOD_SGS_M48T35;
return TOD_DALLAS_DS1386;
}
efi_status_t
ioc3_get_time(efi_time_t *time, efi_time_cap_t *caps)
{
if (!nvram_base) {
printk(KERN_CRIT "nvram_base is zero\n");
return EFI_UNSUPPORTED;
}
memset(time, 0, sizeof(*time));
switch (tod_chip_type) {
case TOD_SGS_M48T35:
write_io_port(RTC_SGS_CONTROL_ADDR, RTC_SGS_READ_PROTECT);
time->year = BCD_TO_INT(read_io_port(RTC_SGS_YEAR_ADDR)) + YRREF;
time->month = BCD_TO_INT(read_io_port(RTC_SGS_MONTH_ADDR));
time->day = BCD_TO_INT(read_io_port(RTC_SGS_DATE_ADDR));
time->hour = BCD_TO_INT(read_io_port(RTC_SGS_HOUR_ADDR));
time->minute = BCD_TO_INT(read_io_port(RTC_SGS_MIN_ADDR));
time->second = BCD_TO_INT(read_io_port(RTC_SGS_SEC_ADDR));
time->nanosecond = 0;
write_io_port(RTC_SGS_CONTROL_ADDR, 0);
break;
case TOD_DALLAS_DS1386:
write_io_port(RTC_DAL_CONTROL_ADDR, RTC_DAL_UPDATE_DISABLE);
time->nanosecond = 0;
time->second = BCD_TO_INT(read_io_port(RTC_DAL_SEC_ADDR));
time->minute = BCD_TO_INT(read_io_port(RTC_DAL_MIN_ADDR));
time->hour = BCD_TO_INT(read_io_port(RTC_DAL_HOUR_ADDR));
time->day = BCD_TO_INT(read_io_port(RTC_DAL_DATE_ADDR));
time->month = BCD_TO_INT(read_io_port(RTC_DAL_MONTH_ADDR));
time->year = BCD_TO_INT(read_io_port(RTC_DAL_YEAR_ADDR)) + YRREF;
write_io_port(RTC_DAL_CONTROL_ADDR, RTC_DAL_UPDATE_ENABLE);
break;
default:
break;
}
if (caps) {
caps->resolution = 50000000; /* 50PPM */
caps->accuracy = 1000; /* 1ms */
caps->sets_to_zero = 0;
}
return EFI_SUCCESS;
}
static efi_status_t ioc3_set_time (efi_time_t *t)
{
if (!nvram_base) {
printk(KERN_CRIT "nvram_base is zero\n");
return EFI_UNSUPPORTED;
}
switch (tod_chip_type) {
case TOD_SGS_M48T35:
write_io_port(RTC_SGS_CONTROL_ADDR, RTC_SGS_WRITE_ENABLE);
write_io_port(RTC_SGS_YEAR_ADDR, INT_TO_BCD((t->year - YRREF)));
write_io_port(RTC_SGS_MONTH_ADDR,INT_TO_BCD(t->month));
write_io_port(RTC_SGS_DATE_ADDR, INT_TO_BCD(t->day));
write_io_port(RTC_SGS_HOUR_ADDR, INT_TO_BCD(t->hour));
write_io_port(RTC_SGS_MIN_ADDR, INT_TO_BCD(t->minute));
write_io_port(RTC_SGS_SEC_ADDR, INT_TO_BCD(t->second));
write_io_port(RTC_SGS_CONTROL_ADDR, 0);
break;
case TOD_DALLAS_DS1386:
write_io_port(RTC_DAL_CONTROL_ADDR, RTC_DAL_UPDATE_DISABLE);
write_io_port(RTC_DAL_SEC_ADDR, INT_TO_BCD(t->second));
write_io_port(RTC_DAL_MIN_ADDR, INT_TO_BCD(t->minute));
write_io_port(RTC_DAL_HOUR_ADDR, INT_TO_BCD(t->hour));
write_io_port(RTC_DAL_DATE_ADDR, INT_TO_BCD(t->day));
write_io_port(RTC_DAL_MONTH_ADDR,INT_TO_BCD(t->month));
write_io_port(RTC_DAL_YEAR_ADDR, INT_TO_BCD((t->year - YRREF)));
write_io_port(RTC_DAL_CONTROL_ADDR, RTC_DAL_UPDATE_ENABLE);
break;
default:
break;
}
return EFI_SUCCESS;
}
/* The following two are not supported atm. */
static efi_status_t
ioc3_get_wakeup_time (efi_bool_t *enabled, efi_bool_t *pending, efi_time_t *tm)
{
return EFI_UNSUPPORTED;
}
static efi_status_t
ioc3_set_wakeup_time (efi_bool_t enabled, efi_time_t *tm)
{
return EFI_UNSUPPORTED;
}
/*
* It looks like the master IOC3 is usually on bus 0, device 4. Hope
* that's right
*/
static __init int efi_ioc3_time_init(void)
{
struct pci_dev *dev;
static struct ioc3 *ioc3;
dev = pci_find_slot(0, PCI_DEVFN(4, 0));
if (!dev) {
printk(KERN_CRIT "Couldn't find master IOC3\n");
return -ENODEV;
}
ioc3 = ioremap(pci_resource_start(dev, 0), pci_resource_len(dev, 0));
nvram_base = (unsigned long) ioc3 + IOC3_BYTEBUS_DEV0;
tod_chip_type = get_tod_chip_type();
if (tod_chip_type == 1)
printk(KERN_NOTICE "TOD type is SGS M48T35\n");
else if (tod_chip_type == 2)
printk(KERN_NOTICE "TOD type is Dallas DS1386\n");
else
printk(KERN_CRIT "No or unknown TOD\n");
efi.get_time = ioc3_get_time;
efi.set_time = ioc3_set_time;
efi.get_wakeup_time = ioc3_get_wakeup_time;
efi.set_wakeup_time = ioc3_set_wakeup_time;
return 0;
}
module_init(efi_ioc3_time_init);
/* $Id$
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1992-1997, 2000-2002 Silicon Graphics, Inc. All rights reserved.
*/
/*
* hubspc.c - Hub Memory Space Management Driver
* This driver implements the managers for the following
* memory resources:
* 1) reference counters
*/
#include <linux/types.h>
#include <linux/config.h>
#include <linux/slab.h>
#include <asm/sn/sgi.h>
#include <asm/sn/io.h>
#include <asm/sn/sn_cpuid.h>
#include <linux/devfs_fs.h>
#include <linux/devfs_fs_kernel.h>
#include <asm/io.h>
#include <asm/sn/iograph.h>
#include <asm/sn/invent.h>
#include <asm/sn/hcl.h>
#include <asm/sn/labelcl.h>
#include <asm/sn/sn1/mem_refcnt.h>
#include <asm/sn/addrs.h>
#include <asm/sn/snconfig.h>
#include <asm/sn/sn1/hubspc.h>
#include <asm/sn/ksys/elsc.h>
#include <asm/sn/simulator.h>
/* Uncomment the following line for tracing */
/* #define HUBSPC_DEBUG 1 */
int hubspc_devflag = D_MP;
/***********************************************************************/
/* CPU Prom Space */
/***********************************************************************/
typedef struct cpuprom_info {
devfs_handle_t prom_dev;
devfs_handle_t nodevrtx;
struct cpuprom_info *next;
}cpuprom_info_t;
static cpuprom_info_t *cpuprom_head;
static spinlock_t cpuprom_spinlock;
#define PROM_LOCK() mutex_spinlock(&cpuprom_spinlock)
#define PROM_UNLOCK(s) mutex_spinunlock(&cpuprom_spinlock, (s))
/*
* Add prominfo to the linked list maintained.
*/
void
prominfo_add(devfs_handle_t hub, devfs_handle_t prom)
{
cpuprom_info_t *info;
unsigned long s;
info = kmalloc(sizeof(cpuprom_info_t), GFP_KERNEL);
ASSERT(info);
info->prom_dev = prom;
info->nodevrtx = hub;
s = PROM_LOCK();
info->next = cpuprom_head;
cpuprom_head = info;
PROM_UNLOCK(s);
}
void
prominfo_del(devfs_handle_t prom)
{
unsigned long s;
cpuprom_info_t *info;
cpuprom_info_t **prev;
s = PROM_LOCK();
prev = &cpuprom_head;
while ( (info = *prev) ) {
if (info->prom_dev == prom) {
*prev = info->next;
PROM_UNLOCK(s);
return;
}
prev = &info->next;
}
PROM_UNLOCK(s);
ASSERT(0);
}
devfs_handle_t
prominfo_nodeget(devfs_handle_t prom)
{
unsigned long s;
cpuprom_info_t *info;
s = PROM_LOCK();
info = cpuprom_head;
while (info) {
if(info->prom_dev == prom) {
PROM_UNLOCK(s);
return info->nodevrtx;
}
info = info->next;
}
PROM_UNLOCK(s);
return 0;
}
#if defined(CONFIG_IA64_SGI_SN1)
#define SN_PROMVERSION INV_IP35PROM
/* Add "detailed" labelled inventory information to the
* prom vertex
*/
void
cpuprom_detailed_inventory_info_add(devfs_handle_t prom_dev,devfs_handle_t node)
{
invent_miscinfo_t *cpuprom_inventory_info;
extern invent_generic_t *klhwg_invent_alloc(cnodeid_t cnode,
int class, int size);
cnodeid_t cnode = hubdev_cnodeid_get(node);
/* Allocate memory for the extra inventory information
* for the prom
*/
cpuprom_inventory_info = (invent_miscinfo_t *)
klhwg_invent_alloc(cnode, INV_PROM, sizeof(invent_miscinfo_t));
ASSERT(cpuprom_inventory_info);
/* Set the enabled flag so that the hinv interprets this
* information
*/
cpuprom_inventory_info->im_gen.ig_flag = INVENT_ENABLED;
cpuprom_inventory_info->im_type = SN_PROMVERSION;
/* Store prom revision into inventory information */
cpuprom_inventory_info->im_rev = IP27CONFIG.pvers_rev;
cpuprom_inventory_info->im_version = IP27CONFIG.pvers_vers;
/* Store this info as labelled information hanging off the
* prom device vertex
*/
hwgraph_info_add_LBL(prom_dev, INFO_LBL_DETAIL_INVENT,
(arbitrary_info_t) cpuprom_inventory_info);
/* Export this information so that user programs can get to
* this by using attr_get()
*/
hwgraph_info_export_LBL(prom_dev, INFO_LBL_DETAIL_INVENT,
sizeof(invent_miscinfo_t));
}
#endif /* CONFIG_IA64_SGI_SN1 */
/***********************************************************************/
/* Base Hub Space Driver */
/***********************************************************************/
/*
* hubspc_init
* Registration of the hubspc devices with the hub manager
*/
void
hubspc_init(void)
{
/*
* Register with the hub manager
*/
/* The reference counters */
#if defined(CONFIG_IA64_SGI_SN1)
hubdev_register(mem_refcnt_attach);
#endif
#ifdef CONFIG_IA64_SGI_SN1
/* L1 system controller link */
if ( !IS_RUNNING_ON_SIMULATOR() ) {
/* initialize the L1 link */
extern void l1_init(void);
l1_init();
}
#endif /* CONFIG_IA64_SGI_SN1 */
#ifdef HUBSPC_DEBUG
printk("hubspc_init: Completed\n");
#endif /* HUBSPC_DEBUG */
/* Initialize spinlocks */
mutex_spinlock_init(&cpuprom_spinlock);
}
/* ARGSUSED */
int
hubspc_open(devfs_handle_t *devp, mode_t oflag, int otyp, cred_t *crp)
{
return (0);
}
/* ARGSUSED */
int
hubspc_close(devfs_handle_t dev, int oflag, int otyp, cred_t *crp)
{
return (0);
}
/* ARGSUSED */
int
hubspc_map(devfs_handle_t dev, vhandl_t *vt, off_t off, size_t len, uint prot)
{
/*REFERENCED*/
int errcode = 0;
/* check validity of request */
if( len == 0 ) {
return -ENXIO;
}
return errcode;
}
/* ARGSUSED */
int
hubspc_unmap(devfs_handle_t dev, vhandl_t *vt)
{
return (0);
}
/* ARGSUSED */
int
hubspc_ioctl(devfs_handle_t dev,
int cmd,
void *arg,
int mode,
cred_t *cred_p,
int *rvalp)
{
return (0);
}
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 2002-2003 Silicon Graphics, Inc. All Rights Reserved.
#
# Makefile for the sn2 io routines.
EXTRA_CFLAGS := -DLITTLE_ENDIAN
obj-y += hcl.o labelcl.o hcl_util.o invent_stub.o
/* $Id$
/* $Id: hcl_util.c,v 1.3 2003/04/24 13:59:39 pfg Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1992 - 1997, 2000-2002 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 1992-1997,2000-2003 Silicon Graphics, Inc. All rights reserved.
*/
#include <linux/types.h>
......@@ -21,8 +21,8 @@
#include <asm/sn/hcl_util.h>
#include <asm/sn/nodepda.h>
static devfs_handle_t hwgraph_all_cnodes = GRAPH_VERTEX_NONE;
extern devfs_handle_t hwgraph_root;
static vertex_hdl_t hwgraph_all_cnodes = GRAPH_VERTEX_NONE;
extern vertex_hdl_t hwgraph_root;
/*
......@@ -30,11 +30,11 @@ extern devfs_handle_t hwgraph_root;
** controller or adapter or other piece of hardware that the given
** vertex passes through on the way to the rest of the system.
*/
devfs_handle_t
device_master_get(devfs_handle_t vhdl)
vertex_hdl_t
device_master_get(vertex_hdl_t vhdl)
{
graph_error_t rc;
devfs_handle_t master;
vertex_hdl_t master;
rc = hwgraph_edge_get(vhdl, EDGE_LBL_MASTER, &master);
if (rc == GRAPH_SUCCESS)
......@@ -48,7 +48,7 @@ device_master_get(devfs_handle_t vhdl)
** Returns 0 on success, non-0 indicates failure
*/
int
device_master_set(devfs_handle_t vhdl, devfs_handle_t master)
device_master_set(vertex_hdl_t vhdl, vertex_hdl_t master)
{
graph_error_t rc;
......@@ -63,10 +63,10 @@ device_master_set(devfs_handle_t vhdl, devfs_handle_t master)
** until we reach a vertex that represents a node.
*/
cnodeid_t
master_node_get(devfs_handle_t vhdl)
master_node_get(vertex_hdl_t vhdl)
{
cnodeid_t cnodeid;
devfs_handle_t master;
vertex_hdl_t master;
for (;;) {
cnodeid = nodevertex_to_cnodeid(vhdl);
......@@ -96,11 +96,11 @@ master_node_get(devfs_handle_t vhdl)
}
}
static devfs_handle_t hwgraph_all_cpuids = GRAPH_VERTEX_NONE;
static vertex_hdl_t hwgraph_all_cpuids = GRAPH_VERTEX_NONE;
extern int maxcpus;
void
mark_cpuvertex_as_cpu(devfs_handle_t vhdl, cpuid_t cpuid)
mark_cpuvertex_as_cpu(vertex_hdl_t vhdl, cpuid_t cpuid)
{
if (cpuid == CPU_NONE)
return;
......@@ -128,7 +128,7 @@ mark_cpuvertex_as_cpu(devfs_handle_t vhdl, cpuid_t cpuid)
** compact node ID; otherwise, return CNODEID_NONE.
*/
cnodeid_t
nodevertex_to_cnodeid(devfs_handle_t vhdl)
nodevertex_to_cnodeid(vertex_hdl_t vhdl)
{
int rv = 0;
arbitrary_info_t cnodeid = CNODEID_NONE;
......@@ -139,7 +139,7 @@ nodevertex_to_cnodeid(devfs_handle_t vhdl)
}
void
mark_nodevertex_as_node(devfs_handle_t vhdl, cnodeid_t cnodeid)
mark_nodevertex_as_node(vertex_hdl_t vhdl, cnodeid_t cnodeid)
{
if (cnodeid == CNODEID_NONE)
return;
......@@ -169,7 +169,7 @@ mark_nodevertex_as_node(devfs_handle_t vhdl, cnodeid_t cnodeid)
** otherwise, return CPU_NONE.
*/
cpuid_t
cpuvertex_to_cpuid(devfs_handle_t vhdl)
cpuvertex_to_cpuid(vertex_hdl_t vhdl)
{
arbitrary_info_t cpuid = CPU_NONE;
......@@ -180,9 +180,9 @@ cpuvertex_to_cpuid(devfs_handle_t vhdl)
/*
** dev_to_name converts a devfs_handle_t into a canonical name. If the devfs_handle_t
** dev_to_name converts a vertex_hdl_t into a canonical name. If the vertex_hdl_t
** represents a vertex in the hardware graph, it is converted in the
** normal way for vertices. If the devfs_handle_t is an old devfs_handle_t (one which
** normal way for vertices. If the vertex_hdl_t is an old vertex_hdl_t (one which
** does not represent a hwgraph vertex), we synthesize a name based
** on major/minor number.
**
......@@ -192,7 +192,7 @@ cpuvertex_to_cpuid(devfs_handle_t vhdl)
** returns "UnknownDevice".
*/
char *
dev_to_name(devfs_handle_t dev, char *buf, uint buflen)
dev_to_name(vertex_hdl_t dev, char *buf, uint buflen)
{
return(vertex_to_name(dev, buf, buflen));
}
......
......@@ -4,7 +4,7 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1992 - 1997, 2000-2002 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 1992-1997,2000-2003 Silicon Graphics, Inc. All rights reserved.
*/
/*
......@@ -32,11 +32,6 @@ replace_in_inventory(
inventory_t *pinv, int class, int type,
int controller, int unit, int state)
{
pinv->inv_class = class;
pinv->inv_type = type;
pinv->inv_controller = controller;
pinv->inv_unit = unit;
pinv->inv_state = state;
}
/*
......@@ -49,8 +44,6 @@ replace_in_inventory(
void
add_to_inventory(int class, int type, int controller, int unit, int state)
{
(void)device_inventory_add((devfs_handle_t)GRAPH_VERTEX_NONE, class, type,
controller, unit, state);
}
......@@ -67,27 +60,7 @@ add_to_inventory(int class, int type, int controller, int unit, int state)
inventory_t *
get_next_inventory(invplace_t *place)
{
inventory_t *pinv;
devfs_handle_t device = place->invplace_vhdl;
int rv;
while ((pinv = device_inventory_get_next(device, place)) == NULL) {
/*
* We've exhausted inventory items on the last device.
* Advance to next device.
*/
place->invplace_inv = NULL; /* Start from beginning invent on this device */
rv = hwgraph_vertex_get_next(&device, &place->invplace_vplace);
if (rv == LABELCL_SUCCESS) {
place->invplace_vhdl = device;
}
else {
place->invplace_vhdl = GRAPH_VERTEX_NONE;
return(NULL);
}
}
return(pinv);
return((inventory_t *) NULL);
}
/* ARGSUSED */
......@@ -101,17 +74,12 @@ get_sizeof_inventory(int abi)
void
start_scan_inventory(invplace_t *iplace)
{
*iplace = INVPLACE_NONE;
}
/* Must be called after last call to get_next_inventory */
void
end_scan_inventory(invplace_t *iplace)
{
devfs_handle_t vhdl = iplace->invplace_vhdl;
if (vhdl != GRAPH_VERTEX_NONE)
hwgraph_vertex_unref(vhdl);
*iplace = INVPLACE_NONE; /* paranoia */
}
/*
......@@ -123,20 +91,7 @@ end_scan_inventory(invplace_t *iplace)
int
scaninvent(int (*fun)(inventory_t *, void *), void *arg)
{
inventory_t *ie;
invplace_t iplace = { NULL,NULL, NULL };
int rc;
ie = 0;
rc = 0;
start_scan_inventory(&iplace);
while ((ie = (inventory_t *)get_next_inventory(&iplace))) {
rc = (*fun)(ie, arg);
if (rc)
break;
}
end_scan_inventory(&iplace);
return rc;
return 0;
}
/*
......@@ -150,31 +105,7 @@ inventory_t *
find_inventory(inventory_t *pinv, int class, int type, int controller,
int unit, int state)
{
invplace_t iplace = { NULL,NULL, NULL };
start_scan_inventory(&iplace);
while ((pinv = (inventory_t *)get_next_inventory(&iplace)) != NULL) {
if (class != -1 && pinv->inv_class != class)
continue;
if (type != -1 && pinv->inv_type != type)
continue;
/* XXXX - perhaps the "state" entry should be ignored so an
* an existing entry can be updated. See vino_init() and
* ml/IP22.c:add_ioboard() for an example.
*/
if (state != -1 && pinv->inv_state != state)
continue;
if (controller != -1
&& pinv->inv_controller != controller)
continue;
if (unit != -1 && pinv->inv_unit != unit)
continue;
break;
}
end_scan_inventory(&iplace);
return(pinv);
return((inventory_t *) NULL);
}
......@@ -182,17 +113,10 @@ find_inventory(inventory_t *pinv, int class, int type, int controller,
** Retrieve inventory data associated with a device.
*/
inventory_t *
device_inventory_get_next( devfs_handle_t device,
device_inventory_get_next( vertex_hdl_t device,
invplace_t *invplace)
{
inventory_t *pinv;
int rv;
rv = hwgraph_inventory_get_next(device, invplace, &pinv);
if (rv == LABELCL_SUCCESS)
return(pinv);
else
return(NULL);
return((inventory_t *) NULL);
}
......@@ -201,24 +125,22 @@ device_inventory_get_next( devfs_handle_t device,
** add it to the general inventory).
*/
void
device_inventory_add( devfs_handle_t device,
device_inventory_add( vertex_hdl_t device,
int class,
int type,
major_t controller,
minor_t unit,
int state)
{
hwgraph_inventory_add(device, class, type, controller, unit, state);
}
int
device_controller_num_get(devfs_handle_t device)
device_controller_num_get(vertex_hdl_t device)
{
return (hwgraph_controller_num_get(device));
return (0);
}
void
device_controller_num_set(devfs_handle_t device, int contr_num)
device_controller_num_set(vertex_hdl_t device, int contr_num)
{
hwgraph_controller_num_set(device, contr_num);
}
......@@ -4,7 +4,7 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (c) 2001-2002 Silicon Graphics, Inc. All rights reserved.
* Copyright (c) 2001-2003 Silicon Graphics, Inc. All rights reserved.
*/
#include <linux/types.h>
......@@ -219,7 +219,7 @@ labelcl_info_destroy(labelcl_info_t *labelcl_info)
* Error is returned if we find another label with the same name.
*/
int
labelcl_info_add_LBL(devfs_handle_t de,
labelcl_info_add_LBL(vertex_hdl_t de,
char *info_name,
arb_info_desc_t info_desc,
arbitrary_info_t info)
......@@ -275,7 +275,6 @@ labelcl_info_add_LBL(devfs_handle_t de,
if (!strcmp(info_name, old_label_list[i].name)) {
/* Not allowed to add duplicate labelled info names. */
kfree(new_label_list);
printk(KERN_WARNING "labelcl_info_add_LBL: Duplicate label name %s for vertex 0x%p\n", info_name, (void *)de);
return(-1);
}
new_label_list[i] = old_label_list[i]; /* structure copy */
......@@ -298,7 +297,7 @@ labelcl_info_add_LBL(devfs_handle_t de,
* labelcl_info_remove_LBL - Remove a label entry.
*/
int
labelcl_info_remove_LBL(devfs_handle_t de,
labelcl_info_remove_LBL(vertex_hdl_t de,
char *info_name,
arb_info_desc_t *info_desc,
arbitrary_info_t *info)
......@@ -388,7 +387,7 @@ labelcl_info_remove_LBL(devfs_handle_t de,
* Label entry must exist.
*/
int
labelcl_info_replace_LBL(devfs_handle_t de,
labelcl_info_replace_LBL(vertex_hdl_t de,
char *info_name,
arb_info_desc_t info_desc,
arbitrary_info_t info,
......@@ -446,7 +445,7 @@ labelcl_info_replace_LBL(devfs_handle_t de,
* given label entry.
*/
int
labelcl_info_get_LBL(devfs_handle_t de,
labelcl_info_get_LBL(vertex_hdl_t de,
char *info_name,
arb_info_desc_t *info_desc,
arbitrary_info_t *info)
......@@ -493,7 +492,7 @@ labelcl_info_get_LBL(devfs_handle_t de,
* labelcl_info_get_next_LBL - returns the next label entry on the list.
*/
int
labelcl_info_get_next_LBL(devfs_handle_t de,
labelcl_info_get_next_LBL(vertex_hdl_t de,
char *buffer,
arb_info_desc_t *info_descp,
arbitrary_info_t *infop,
......@@ -543,7 +542,7 @@ labelcl_info_get_next_LBL(devfs_handle_t de,
int
labelcl_info_replace_IDX(devfs_handle_t de,
labelcl_info_replace_IDX(vertex_hdl_t de,
int index,
arbitrary_info_t info,
arbitrary_info_t *old_info)
......@@ -607,7 +606,7 @@ labelcl_info_connectpt_set(struct devfs_entry *de,
*
*/
int
labelcl_info_get_IDX(devfs_handle_t de,
labelcl_info_get_IDX(vertex_hdl_t de,
int index,
arbitrary_info_t *info)
{
......
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 2002-2003 Silicon Graphics, Inc. All Rights Reserved.
#
# Makefile for the sn2 io routines.
EXTRA_CFLAGS := -DLITTLE_ENDIAN
obj-y += hcl.o labelcl.o hcl_util.o invent_stub.o \
ramfs.o interface.o
This diff is collapsed.
/* $Id$
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1992-1997,2000-2003 Silicon Graphics, Inc. All rights reserved.
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <asm/sn/sgi.h>
#include <asm/io.h>
#include <asm/sn/io.h>
#include <asm/sn/iograph.h>
#include <asm/sn/hwgfs.h>
#include <asm/sn/invent.h>
#include <asm/sn/hcl.h>
#include <asm/sn/labelcl.h>
#include <asm/sn/invent.h>
#include <asm/sn/hcl_util.h>
#include <asm/sn/nodepda.h>
static vertex_hdl_t hwgraph_all_cnodes = GRAPH_VERTEX_NONE;
extern vertex_hdl_t hwgraph_root;
/*
** Return the "master" for a given vertex. A master vertex is a
** controller or adapter or other piece of hardware that the given
** vertex passes through on the way to the rest of the system.
*/
vertex_hdl_t
device_master_get(vertex_hdl_t vhdl)
{
graph_error_t rc;
vertex_hdl_t master;
rc = hwgraph_edge_get(vhdl, EDGE_LBL_MASTER, &master);
if (rc == GRAPH_SUCCESS)
return(master);
else
return(GRAPH_VERTEX_NONE);
}
/*
** Set the master for a given vertex.
** Returns 0 on success, non-0 indicates failure
*/
int
device_master_set(vertex_hdl_t vhdl, vertex_hdl_t master)
{
graph_error_t rc;
rc = hwgraph_edge_add(vhdl, master, EDGE_LBL_MASTER);
return(rc != GRAPH_SUCCESS);
}
/*
** Return the compact node id of the node that ultimately "owns" the specified
** vertex. In order to do this, we walk back through masters and connect points
** until we reach a vertex that represents a node.
*/
cnodeid_t
master_node_get(vertex_hdl_t vhdl)
{
cnodeid_t cnodeid;
vertex_hdl_t master;
for (;;) {
cnodeid = nodevertex_to_cnodeid(vhdl);
if (cnodeid != CNODEID_NONE)
return(cnodeid);
master = device_master_get(vhdl);
/* Check for exceptional cases */
if (master == vhdl) {
/* Since we got a reference to the "master" thru
* device_master_get() we should decrement
* its reference count by 1
*/
return(CNODEID_NONE);
}
if (master == GRAPH_VERTEX_NONE) {
master = hwgraph_connectpt_get(vhdl);
if ((master == GRAPH_VERTEX_NONE) ||
(master == vhdl)) {
return(CNODEID_NONE);
}
}
vhdl = master;
}
}
static vertex_hdl_t hwgraph_all_cpuids = GRAPH_VERTEX_NONE;
extern int maxcpus;
void
mark_cpuvertex_as_cpu(vertex_hdl_t vhdl, cpuid_t cpuid)
{
if (cpuid == CPU_NONE)
return;
(void)labelcl_info_add_LBL(vhdl, INFO_LBL_CPUID, INFO_DESC_EXPORT,
(arbitrary_info_t)cpuid);
{
char cpuid_buffer[10];
if (hwgraph_all_cpuids == GRAPH_VERTEX_NONE) {
(void)hwgraph_path_add( hwgraph_root,
EDGE_LBL_CPUNUM,
&hwgraph_all_cpuids);
}
sprintf(cpuid_buffer, "%ld", cpuid);
(void)hwgraph_edge_add( hwgraph_all_cpuids,
vhdl,
cpuid_buffer);
}
}
/*
** If the specified device represents a node, return its
** compact node ID; otherwise, return CNODEID_NONE.
*/
cnodeid_t
nodevertex_to_cnodeid(vertex_hdl_t vhdl)
{
int rv = 0;
arbitrary_info_t cnodeid = CNODEID_NONE;
rv = labelcl_info_get_LBL(vhdl, INFO_LBL_CNODEID, NULL, &cnodeid);
return((cnodeid_t)cnodeid);
}
void
mark_nodevertex_as_node(vertex_hdl_t vhdl, cnodeid_t cnodeid)
{
if (cnodeid == CNODEID_NONE)
return;
cnodeid_to_vertex(cnodeid) = vhdl;
labelcl_info_add_LBL(vhdl, INFO_LBL_CNODEID, INFO_DESC_EXPORT,
(arbitrary_info_t)cnodeid);
{
char cnodeid_buffer[10];
if (hwgraph_all_cnodes == GRAPH_VERTEX_NONE) {
(void)hwgraph_path_add( hwgraph_root,
EDGE_LBL_NODENUM,
&hwgraph_all_cnodes);
}
sprintf(cnodeid_buffer, "%d", cnodeid);
(void)hwgraph_edge_add( hwgraph_all_cnodes,
vhdl,
cnodeid_buffer);
}
}
/*
** If the specified device represents a CPU, return its cpuid;
** otherwise, return CPU_NONE.
*/
cpuid_t
cpuvertex_to_cpuid(vertex_hdl_t vhdl)
{
arbitrary_info_t cpuid = CPU_NONE;
(void)labelcl_info_get_LBL(vhdl, INFO_LBL_CPUID, NULL, &cpuid);
return((cpuid_t)cpuid);
}
/*
** dev_to_name converts a vertex_hdl_t into a canonical name. If the vertex_hdl_t
** represents a vertex in the hardware graph, it is converted in the
** normal way for vertices. If the vertex_hdl_t is an old vertex_hdl_t (one which
** does not represent a hwgraph vertex), we synthesize a name based
** on major/minor number.
**
** Usually returns a pointer to the original buffer, filled in as
** appropriate. If the buffer is too small to hold the entire name,
** or if anything goes wrong while determining the name, dev_to_name
** returns "UnknownDevice".
*/
char *
dev_to_name(vertex_hdl_t dev, char *buf, uint buflen)
{
return(vertex_to_name(dev, buf, buflen));
}
typedef struct dentry *hwgfs_handle_t;
extern hwgfs_handle_t hwgfs_register(hwgfs_handle_t dir, const char *name,
unsigned int flags,
unsigned int major, unsigned int minor,
umode_t mode, void *ops, void *info);
extern int hwgfs_mk_symlink(hwgfs_handle_t dir, const char *name,
unsigned int flags, const char *link,
hwgfs_handle_t *handle, void *info);
extern hwgfs_handle_t hwgfs_mk_dir(hwgfs_handle_t dir, const char *name,
void *info);
extern void hwgfs_unregister(hwgfs_handle_t de);
extern hwgfs_handle_t hwgfs_find_handle(hwgfs_handle_t dir, const char *name,
unsigned int major,unsigned int minor,
char type, int traverse_symlinks);
extern hwgfs_handle_t hwgfs_get_parent(hwgfs_handle_t de);
extern int hwgfs_generate_path(hwgfs_handle_t de, char *path, int buflen);
extern void *hwgfs_get_info(hwgfs_handle_t de);
extern int hwgfs_set_info(hwgfs_handle_t de, void *info);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 2002-2003 Silicon Graphics, Inc. All Rights Reserved.
#
# Makefile for the sn2 io routines.
EXTRA_CFLAGS := -DLITTLE_ENDIAN
obj-y += pci.o pci_dma.o pci_bus_cvlink.o iomv.o
......@@ -65,7 +65,7 @@ EXPORT_SYMBOL(sn_io_addr);
void
sn_mmiob (void)
{
while ((((volatile unsigned long) (*pda.pio_write_status_addr)) & SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT_MASK) !=
while ((((volatile unsigned long) (*pda->pio_write_status_addr)) & SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT_MASK) !=
SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT_MASK)
udelay(1);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 2002-2003 Silicon Graphics, Inc. All Rights Reserved.
#
# Makefile for the sn2 io routines.
EXTRA_CFLAGS := -DLITTLE_ENDIAN
obj-y += sgi_io_init.o irix_io_init.o
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -11,10 +11,9 @@
EXTRA_CFLAGS := -DLITTLE_ENDIAN
obj-y += pcibr/ bte_error.o geo_op.o klconflib.o klgraph.o l1.o \
l1_command.o ml_iograph.o ml_SN_init.o ml_SN_intr.o module.o \
pci_bus_cvlink.o pciio.o pic.o sgi_io_init.o shub.o shuberror.o \
shub_intr.o shubio.o xbow.o xtalk.o
obj-y += pcibr/ ml_SN_intr.o shub_intr.o shuberror.o shub.o bte_error.o \
pic.o geo_op.o l1.o l1_command.o klconflib.o klgraph.o ml_SN_init.o \
ml_iograph.o module.o pciio.o xbow.o xtalk.o shubio.o
obj-$(CONFIG_KDB) += kdba_io.o
obj-$(CONFIG_SHUB_1_0_SPECIFIC) += efi-rtc.o
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -18,7 +18,6 @@
#include <asm/sn/xtalk/xbow.h>
#include <asm/sn/pci/bridge.h>
#include <asm/sn/klconfig.h>
#include <asm/sn/sn1/hubdev.h>
#include <asm/sn/module.h>
#include <asm/sn/pci/pcibr.h>
#include <asm/sn/xtalk/xswitch.h>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment