Port-ia64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: patch 20090202



Hi! Kochi-san,


I attached new patch to this mail.  Also temporary bus.h/bus_space.c too.
However you required com.h and opt_acpi.h into
arch/ia64/compile/GENERIC{,.SKI}/ now.

  # cd sys/arch/ia64/conf
  # config GENERIC
  # cd ../compile/GENERIC
  # touch opt_acpi.h
  # echo "#define NCOM 1" > com.h
  # nbmake-ia64 dependall

Maybe consinit supports only com-console.

Which next phase is bus_space or VGA-console?

Thanks,
--
kiyohara
? conf/GENERIC
? ia64/bus_space.c
? ia64/consinit.c
? include/bus.h
? stand/ia64/efi/efi
Index: conf/files.ia64
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/conf/files.ia64,v
retrieving revision 1.4
diff -u -r1.4 files.ia64
--- conf/files.ia64     17 Oct 2007 19:54:59 -0000      1.4
+++ conf/files.ia64     15 Feb 2009 11:23:19 -0000
@@ -41,6 +41,8 @@
 file   arch/ia64/ia64/support.S
 file   arch/ia64/ia64/setjmp.S
 file   arch/ia64/ia64/pal.S
+file   arch/ia64/ia64/consinit.c
+file   arch/ia64/ia64/bus_space.c
 file   dev/cons.c
 file   dev/cninit.c
 
@@ -65,6 +67,9 @@
 
 # console: XXX: Figure out how to make this conditional.
 defpseudo ssccons
-file   arch/ia64/ia64/ssc.c            ssccons
+file   arch/ia64/ia64/ssc.c            ssccons                 needs-flag
+
+
+file   dev/ic/com.c                    # XXXXX
 
 include "arch/ia64/conf/majors.ia64"
Index: ia64/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/ia64/machdep.c,v
retrieving revision 1.12
diff -u -r1.12 machdep.c
--- ia64/machdep.c      30 Nov 2008 18:21:34 -0000      1.12
+++ ia64/machdep.c      15 Feb 2009 11:23:19 -0000
@@ -341,12 +341,6 @@
 }
 
 void
-consinit()
-{
-       cninit();
-}
-
-void
 map_pal_code()
 {
        pt_entry_t pte;
@@ -764,6 +758,13 @@
        panic("Wheeee!!! main() returned!!! \n");
 }
 
+uint64_t
+ia64_get_hcdp(void)
+{
+
+       return bootinfo.bi_hcdp;
+}
+
 /*
  * Set registers on exec.
  */
@@ -853,11 +854,11 @@
 }
 
 void
-sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
+sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask)
 {
        return;
 }
- 
+
 void 
 cpu_upcall(struct lwp *l, int type, int nevents, int ninterrupted, void *sas, 
void *ap, void *sp, sa_upcall_t upcall)
 {
Index: ia64/pmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/ia64/pmap.c,v
retrieving revision 1.15
diff -u -r1.15 pmap.c
--- ia64/pmap.c 10 Dec 2008 11:10:18 -0000      1.15
+++ ia64/pmap.c 15 Feb 2009 11:23:21 -0000
@@ -155,7 +155,7 @@
 u_long         pmap_pages_stolen;      /* instrumentation */
 
 static struct pmap kernel_pmap_store;  /* the kernel's pmap (proc0) */
-struct pmap *const kernel_pmap_ptr = &kernel_map_store;
+struct pmap *const kernel_pmap_ptr = &kernel_pmap_store;
 
 static vaddr_t kernel_vm_end;  /* VA of last avail page ( end of kernel 
Address Space ) */
 
Index: ia64/ssc.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/ia64/ssc.c,v
retrieving revision 1.2
diff -u -r1.2 ssc.c
--- ia64/ssc.c  8 Apr 2006 14:52:09 -0000       1.2
+++ ia64/ssc.c  15 Feb 2009 11:23:21 -0000
@@ -29,43 +29,27 @@
  */
 
 #include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/tty.h>
-#include <sys/device.h>
 
-#include <machine/md_var.h>
 #include <machine/ssc.h>
 
 #include <dev/cons.h>
 
 
-#define SSC_GETCHAR                    21
-#define SSC_PUTCHAR                    31
-
 #define        SSC_POLL_HZ     50
 
-void sscconsattach(struct device *, struct device *, void *); 
-
-static void ssccnprobe(struct consdev *);
-static void ssccninit(struct consdev *);
-static void ssccnputc(dev_t, int);
-static int  ssccngetc(dev_t);
+void sscconsattach(struct device *, struct device *, void *);
 
-struct consdev constab[] = {
-       { ssccnprobe, ssccninit, ssccngetc, ssccnputc, nullcnpollc, 
-         NULL, NULL, NULL, NODEV, CN_NORMAL },
-       { NULL }
-};
+void ssccnprobe(struct consdev *);
+void ssccninit(struct consdev *);
+void ssccnputc(dev_t, int);
+int ssccngetc(dev_t);
+void ssccnpollc(dev_t, int);
 
 
-u_int64_t
-ssc(u_int64_t in0, u_int64_t in1, u_int64_t in2, u_int64_t in3, int which)
+uint64_t
+ssc(uint64_t in0, uint64_t in1, uint64_t in2, uint64_t in3, int which)
 {
-       register u_int64_t ret0 __asm("r8");
+       register uint64_t ret0 __asm("r8");
 
        __asm __volatile("mov r15=%1\n\t"
                         "break 0x80001"
@@ -74,42 +58,39 @@
        return ret0;
 }
 
-void sscconsattach(struct device *parent, struct device *self, void *aux) 
-{ 
+
+void
+sscconsattach(struct device *parent, struct device *self, void *aux)
+{
+       /* not yet */
 }
 
-static void
+void
 ssccnprobe(struct consdev *cp)
 {
+
+       cp->cn_dev = ~NODEV;            /* XXXX: And already exists */
        cp->cn_pri = CN_INTERNAL;
 }
 
-static void
+void
 ssccninit(struct consdev *cp)
 {
+       /* nothing */
 }
 
-/* void */
-/* ssccnattach(void *arg) */
-/* { */
-/*     static struct consdev ssccons = { */
-/*             ssccnprobe, ssccninit, ssccngetc, ssccnputc, nullcnpollc, */
-/*             NULL, NULL, NULL, NODEV, CN_NORMAL */
-/*     }; */
-
-/*     cn_tab = &ssccons; */
-/* } */
-
-static void
+void
 ssccnputc(dev_t dev, int c)
 {
+
        ssc(c, 0, 0, 0, SSC_PUTCHAR);
 }
 
-static int
+int
 ssccngetc(dev_t dev)
 {
        int c;
+
        do {
                c = ssc(0, 0, 0, 0, SSC_GETCHAR);
        } while (c == 0);
@@ -117,5 +98,10 @@
        return c;
 }
 
-/* XXX: integrate the rest of the ssc.c stuff from FreeBSD to plug into 
wsdisplay */
+void
+ssccnpollc(dev_t dev, int on)
+{
+       /* nothing */
+}
 
+/* XXX: integrate the rest of the ssc.c stuff from FreeBSD to plug into 
wsdisplay */
Index: include/dig64.h
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/include/dig64.h,v
retrieving revision 1.1
diff -u -r1.1 dig64.h
--- include/dig64.h     7 Apr 2006 14:21:18 -0000       1.1
+++ include/dig64.h     15 Feb 2009 11:23:21 -0000
@@ -31,6 +31,12 @@
 #ifndef _MACHINE_DIG64_H_
 #define        _MACHINE_DIG64_H_
 
+/*
+ * This header file written refer to 'DIG64 Desriptions for Primary Console &
+ * Debug Port Devices'.
+ */
+
+/* ACPI GAS (Generic Address Structure) */
 struct dig64_gas {
        uint8_t         addr_space;
        uint8_t         bit_width;
@@ -46,11 +52,19 @@
 
 struct dig64_hcdp_entry {
        uint8_t         type;
-#define        DIG64_HCDP_CONSOLE      0
-#define        DIG64_HCDP_DBGPORT      1
+#define        DIG64_HCDP_CONSOLE              DIG64_ENTRYTYPE_TYPE0
+#define        DIG64_HCDP_DBGPORT              DIG64_ENTRYTYPE_TYPE1
        uint8_t         databits;
        uint8_t         parity;
+#define        DIG64_HCDP_PARITY_NO            1
+#define        DIG64_HCDP_PARITY_EVEN          2
+#define        DIG64_HCDP_PARITY_ODD           3
+#define        DIG64_HCDP_PARITY_MARK          4
+#define        DIG64_HCDP_PARITY_SPACE         5
        uint8_t         stopbits;
+#define        DIG64_HCDP_STOPBITS_1           1
+#define        DIG64_HCDP_STOPBITS_15          2
+#define        DIG64_HCDP_STOPBITS_2           3
        uint8_t         pci_segment;
        uint8_t         pci_bus;
        uint8_t         pci_device:5;
@@ -74,19 +88,109 @@
        uint8_t         _reserved3_[7];
 };
 
+
+/* Device Specific Structures */
+
+struct dig64_vga_spec {
+       uint8_t         num;    /*Number of Extended Address Space Descriptors*/
+       struct {
+               uint8_t data[56];
+       } edesc[0];
+} __packed;
+
+
+/* Interconnect Specific Structure */
+
+#define DIG64_FLAGS_INTR_LEVEL         (0 << 0)        /* Level Triggered */
+#define DIG64_FLAGS_INTR_EDGE          (1 << 0)        /* Edge Triggered */
+#define DIG64_FLAGS_INTR_ACTH          (0 << 1)        /* Intr Active High */
+#define DIG64_FLAGS_INTR_ACTL          (1 << 1)        /* Intr Active Low */
+#define DIG64_FLAGS_TRANS_DENSE                (0 << 3)        /* Dense 
Transration */
+#define DIG64_FLAGS_TRANS_SPARSE       (1 << 3)        /* Sparse Transration */
+#define DIG64_FLAGS_TYPE_STATIC                (0 << 4)        /* Type Static 
*/
+#define DIG64_FLAGS_TYPE_TRANS         (1 << 4)        /* Type Translation */
+#define DIG64_FLAGS_INTR_SUPP          (1 << 6)        /* Intrrupt supported */
+#define DIG64_FLAGS_MMIO_TRA_VALID     (1 << 8)
+#define DIG64_FLAGS_IOPORT_TRA_VALID   (1 << 9)
+
+struct dig64_acpi_spec {
+       uint8_t         type;           /* = 0 indicating ACPI */
+       uint8_t         resv;           /* must be 0 */
+       uint16_t        length;         /* of the ACPI Specific Structure */
+       uint32_t        uid;
+       uint32_t        hid;
+       uint32_t        acpi_gsi;       /* ACPI Global System Interrupt */
+       uint64_t        mmio_tra;
+       uint64_t        ioport_tra;
+       uint16_t        flags;
+} __packed;
+
+struct dig64_pci_spec {
+       uint8_t         type;           /* = 1 indicating PCI */
+       uint8_t         resv;           /* must be 0 */
+       uint16_t        length;         /* of the PCI Specific Structure */
+       uint8_t         sgn;            /* PCI Segment Group Number */
+       uint8_t         bus;            /* PCI Bus Number */
+       uint8_t         device;         /* PCI Device Number */
+       uint8_t         function;       /* PCI Function Number */
+       uint16_t        device_id;
+       uint16_t        vendor_id;
+       uint32_t        acpi_gsi;       /* ACPI Global System Interrupt */
+       uint64_t        mmio_tra;
+       uint64_t        ioport_tra;
+       uint16_t        flags;
+} __packed;
+
+
+struct dig64_pcdp_entry {
+       uint8_t         type;
+       uint8_t         primary;
+       uint16_t        length;         /* in bytes */
+       uint16_t        index;
+#define        DIG64_PCDP_CONOUTDEV            0
+#define        DIG64_PCDP_NOT_VALID            1
+#define        DIG64_PCDP_CONOUTDEV2           2
+#define        DIG64_PCDP_CONINDEV             3
+
+       union {
+               /*
+                * Interconnect Specific Structure,
+                *   and Device Specific Structure(s)
+                */
+               uint8_t type;
+#define DIG64_PCDP_SPEC_ACPI           0
+               struct dig64_acpi_spec acpi;
+#define DIG64_PCDP_SPEC_PCI            1
+               struct dig64_pci_spec pci;
+       } specs;
+} __packed;
+
 struct dig64_hcdp_table {
        char            signature[4];
 #define        HCDP_SIGNATURE  "HCDP"
        uint32_t        length;
-       uint8_t         revision;
+       uint8_t         revision;       /* It is PCDP, if '3' or greater. */
        uint8_t         checksum;
        char            oem_id[6];
        char            oem_tbl_id[8];
        uint32_t        oem_rev;
        char            creator_id[4];
        uint32_t        creator_rev;
-       uint32_t        entries;
-       struct dig64_hcdp_entry entry[1];
+       uint32_t        entries;        /* Number of Type0 and Type1 Entries. */
+       union dev_desc {        /* Device Descriptor */
+               uint8_t type;
+#define        DIG64_ENTRYTYPE_TYPE0           0       /* (UART | Bidirect) */
+#define        DIG64_ENTRYTYPE_TYPE1           1       /* (UART | Debug Port) 
*/
+#define        DIG64_ENTRYTYPE_BIDIRECT        (0<<0)  /* bidirectional 
console */
+#define        DIG64_ENTRYTYPE_DEBUGPORT       (1<<0)  /* debug port */
+#define        DIG64_ENTRYTYPE_OUTONLY         (2<<0)  /* console output-only 
*/
+#define        DIG64_ENTRYTYPE_INONLY          (3<<0)  /* console input-only */
+#define        DIG64_ENTRYTYPE_UART            (0<<3)
+#define        DIG64_ENTRYTYPE_VGA             (1<<3)
+#define        DIG64_ENTRYTYPE_VENDOR          (1<<7)  /* Vendor specific */
+               struct dig64_hcdp_entry uart;
+               struct dig64_pcdp_entry pcdp;
+       } entry[0];
 };
 
 #endif
Index: include/param.h
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/include/param.h,v
retrieving revision 1.2
diff -u -r1.2 param.h
--- include/param.h     28 Aug 2006 13:43:35 -0000      1.2
+++ include/param.h     15 Feb 2009 11:23:21 -0000
@@ -146,6 +146,8 @@
 
 #include <machine/intr.h>
 
+static __inline void delay(unsigned int us) {} /* XXXXX */
+
 #endif /* _LOCORE */
 #endif /* _KERNEL */
 
Index: include/ssc.h
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/include/ssc.h,v
retrieving revision 1.1
diff -u -r1.1 ssc.h
--- include/ssc.h       7 Apr 2006 14:21:18 -0000       1.1
+++ include/ssc.h       15 Feb 2009 11:23:21 -0000
@@ -1,5 +1,8 @@
 /*     $NetBSD: ssc.h,v 1.1 2006/04/07 14:21:18 cherry Exp $   */
 
+#ifndef _SSC_H_
+#define _SSC_H_
+
 #define SSC_CONSOLE_INIT               20
 #define SSC_GETCHAR                    21
 #define SSC_PUTCHAR                    31
@@ -14,5 +17,6 @@
 #define SSC_LOAD_SYMBOLS               69
 #define        SSC_SAL_SET_VECTORS             120
 
-u_int64_t
-ssc(u_int64_t in0, u_int64_t in1, u_int64_t in2, u_int64_t in3, int which);
+uint64_t ssc(uint64_t, uint64_t, uint64_t, uint64_t, int);
+
+#endif /* _SSC_H_ */
Index: stand/common/boot.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/stand/common/boot.c,v
retrieving revision 1.3
diff -u -r1.3 boot.c
--- stand/common/boot.c 2 Jul 2006 17:28:11 -0000       1.3
+++ stand/common/boot.c 15 Feb 2009 11:23:21 -0000
@@ -106,7 +106,6 @@
        return(CMD_ERROR);
 
     /* Call the exec handler from the loader matching the kernel */
-    file_formats[fp->f_loader]->l_exec(fp);
     command_errmsg = strerror(file_formats[fp->f_loader]->l_exec(fp));
     return(CMD_ERROR);
 }
Index: stand/common/fileload.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/stand/common/fileload.c,v
retrieving revision 1.1
diff -u -r1.1 fileload.c
--- stand/common/fileload.c     7 Apr 2006 14:21:29 -0000       1.1
+++ stand/common/fileload.c     15 Feb 2009 11:23:21 -0000
@@ -34,7 +34,6 @@
 
 #include <lib/libsa/stand.h>
 #include <sys/param.h>
-#include <sys/lkm.h>
 #include <sys/queue.h>
 
 #include "bootstrap.h"
Index: stand/common/readdir.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/stand/common/readdir.c,v
retrieving revision 1.2
diff -u -r1.2 readdir.c
--- stand/common/readdir.c      2 Jul 2006 17:28:11 -0000       1.2
+++ stand/common/readdir.c      15 Feb 2009 11:23:22 -0000
@@ -42,7 +42,7 @@
        static struct dirent dir;               /* XXX not thread safe. eh ??? 
*/
        struct open_file *f = &files[fd];
 
-       if ((unsigned)fd >= SOPEN_MAX || !(f->f_flags & O_RDONLY)) {
+       if ((unsigned)fd >= SOPEN_MAX) {
                errno = EBADF;
                return (NULL);
        }
@@ -55,7 +55,6 @@
        errno = FS_READDIR(f, &dir); 
 
        if (errno)
-         printf("XXXdebugXXX: FS_READDIR returns NULL\n");
                return (NULL);
        return (&dir);
 }
Index: stand/ia64/efi/main.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/stand/ia64/efi/main.c,v
retrieving revision 1.4
diff -u -r1.4 main.c
--- stand/ia64/efi/main.c       6 Apr 2008 07:50:04 -0000       1.4
+++ stand/ia64/efi/main.c       15 Feb 2009 11:23:23 -0000
@@ -500,9 +500,8 @@
 command_hcdp(int argc, char *argv[])
 {
        struct dig64_hcdp_table *tbl;
-       struct dig64_hcdp_entry *ent;
-       struct dig64_gas *gas;
-       int i;
+       union dev_desc *desc;
+       int i, m, n;
 
        tbl = efi_get_table(&hcdp);
        if (tbl == NULL) {
@@ -513,11 +512,7 @@
                printf("HCDP table has invalid signature\n");
                return (CMD_OK);
        }
-       if (tbl->length < sizeof(*tbl) - sizeof(*tbl->entry)) {
-               printf("HCDP table too short\n");
-               return (CMD_OK);
-       }
-       printf("HCDP table at 0x%016lx\n", (u_long)tbl);
+       printf("HCDP table at 0x%lx\n", (u_long)tbl);
        printf("Signature  = %s\n", hcdp_string(tbl->signature, 4));
        printf("Length     = %u\n", tbl->length);
        printf("Revision   = %u\n", tbl->revision);
@@ -528,32 +523,95 @@
        printf("Creator Id = %s\n", hcdp_string(tbl->creator_id, 4));
        printf("Creator rev= %u\n", tbl->creator_rev);
        printf("Entries    = %u\n", tbl->entries);
-       for (i = 0; i < tbl->entries; i++) {
-               ent = tbl->entry + i;
-               printf("Entry #%d:\n", i + 1);
-               printf("    Type      = %u\n", ent->type);
-               printf("    Databits  = %u\n", ent->databits);
-               printf("    Parity    = %u\n", ent->parity);
-               printf("    Stopbits  = %u\n", ent->stopbits);
-               printf("    PCI seg   = %u\n", ent->pci_segment);
-               printf("    PCI bus   = %u\n", ent->pci_bus);
-               printf("    PCI dev   = %u\n", ent->pci_device);
-               printf("    PCI func  = %u\n", ent->pci_function);
-               printf("    Interrupt = %u\n", ent->interrupt);
-               printf("    PCI flag  = %u\n", ent->pci_flag);
-               printf("    Baudrate  = %lu\n",
-                   ((u_long)ent->baud_high << 32) + (u_long)ent->baud_low);
-               gas = &ent->address;
-               printf("    Addr space= %u\n", gas->addr_space);
-               printf("    Bit width = %u\n", gas->bit_width);
-               printf("    Bit offset= %u\n", gas->bit_offset);
-               printf("    Address   = 0x%016lx\n",
-                   ((u_long)gas->addr_high << 32) + (u_long)gas->addr_low);
-               printf("    PCI type  = %u\n", ent->pci_devid);
-               printf("    PCI vndr  = %u\n", ent->pci_vendor);
-               printf("    IRQ       = %u\n", ent->irq);
-               printf("    PClock    = %u\n", ent->pclock);
-               printf("    PCI iface = %u\n", ent->pci_interface);
+       n = 0;
+       m = tbl->length - sizeof(struct dig64_hcdp_table);
+       i = 1;
+       while (n < m) {
+               printf("Entry #%d:\n", i);
+               desc = (union dev_desc *)((char *)tbl->entry + n);
+               printf("    Type      = %u\n", desc->type);
+               if (desc->type == DIG64_ENTRYTYPE_TYPE0 ||
+                   desc->type == DIG64_ENTRYTYPE_TYPE1) {
+                       struct dig64_hcdp_entry *ent = &desc->uart;
+                       struct dig64_gas *gas;
+                       printf("    Databits  = %u\n", ent->databits);
+                       printf("    Parity    = %u\n", ent->parity);
+                       printf("    Stopbits  = %u\n", ent->stopbits);
+                       printf("    PCI seg   = %u\n", ent->pci_segment);
+                       printf("    PCI bus   = %u\n", ent->pci_bus);
+                       printf("    PCI dev   = %u\n", ent->pci_device);
+                       printf("    PCI func  = %u\n", ent->pci_function);
+                       printf("    Interrupt = %u\n", ent->interrupt);
+                       printf("    PCI flag  = %u\n", ent->pci_flag);
+                       printf("    Baudrate  = %lu\n",
+                           ((u_long)ent->baud_high << 32) +
+                           (u_long)ent->baud_low);
+                       gas = &ent->address;
+                       printf("    Addr space= %u\n", gas->addr_space);
+                       printf("    Bit width = %u\n", gas->bit_width);
+                       printf("    Bit offset= %u\n", gas->bit_offset);
+                       printf("    Address   = 0x%lx\n",
+                           ((u_long)gas->addr_high << 32) +
+                           (u_long)gas->addr_low);
+                       printf("    PCI type  = %u\n", ent->pci_devid);
+                       printf("    PCI vndr  = %u\n", ent->pci_vendor);
+                       printf("    IRQ       = %u\n", ent->irq);
+                       printf("    PClock    = %u\n", ent->pclock);
+                       printf("    PCI iface = %u\n", ent->pci_interface);
+
+                       n += sizeof(struct dig64_hcdp_entry);
+               } else {
+                       struct dig64_pcdp_entry *pcdp = &desc->pcdp;
+
+                       if (tbl->revision < 3) {
+                               printf("PCDP not support\n");
+                               return (CMD_OK);
+                       }
+
+                       printf("    Length    = %u\n", pcdp->length);
+                       printf("    Index EFI = %u\n", pcdp->index);
+                       printf("    Interconn = %u", pcdp->specs.type);
+
+                       switch (pcdp->specs.type) {
+                       case DIG64_PCDP_SPEC_ACPI:
+                       {
+                               struct dig64_acpi_spec *acpi =
+                                   &pcdp->specs.acpi;
+
+                               printf("(ACPI)\n");
+                               printf("    Length    = %u\n", acpi->length);
+                               printf("    ACPI_UID  = %x\n", acpi->uid);
+                               printf("    ACPI_HID  = %x\n", acpi->hid);
+                               printf("    ACPI GSI  = %x\n", acpi->acpi_gsi);
+                               printf("    MMIO_TRA  = %lx\n", acpi->mmio_tra);
+                               printf("    IOPort_TRA= %lx\n",
+                                   acpi->ioport_tra);
+                               printf("    Flags     = %x\n", acpi->flags);
+                               break;
+                       }
+                       case DIG64_PCDP_SPEC_PCI:
+                       {
+                               struct dig64_pci_spec *pci = &pcdp->specs.pci;
+
+                               printf("(PCI)\n");
+                               printf("    Length    = %u\n", pci->length);
+                               printf("    Seg GrpNum= %u\n", pci->sgn);
+                               printf("    Bus       = %u\n", pci->bus);
+                               printf("    Device    = %u\n", pci->device);
+                               printf("    Function  = %u\n", pci->function);
+                               printf("    Device ID = %u\n", pci->device_id);
+                               printf("    Vendor ID = %u\n", pci->vendor_id);
+                               printf("    ACPI GSI  = %x\n", pci->acpi_gsi);
+                               printf("    MMIO_TRA  = %lx\n", pci->mmio_tra);
+                               printf("    IOPort_TRA= %lx\n",
+                                   pci->ioport_tra);
+                               printf("    Flags     = %x\n", pci->flags);
+                               break;
+                       }
+                       }
+
+                       n += pcdp->length;
+               }
        }
        printf("<EOT>\n");
        return (CMD_OK);
Index: stand/ia64/ski/bootinfo.c
===================================================================
RCS file: /cvsroot/src/sys/arch/ia64/stand/ia64/ski/bootinfo.c,v
retrieving revision 1.2
diff -u -r1.2 bootinfo.c
--- stand/ia64/ski/bootinfo.c   22 Apr 2006 07:58:53 -0000      1.2
+++ stand/ia64/ski/bootinfo.c   15 Feb 2009 11:23:23 -0000
@@ -37,7 +37,6 @@
 #include <sys/boot_flag.h>
 #include <sys/exec_elf.h>
 #include <sys/lock.h>
-#include <sys/lkm.h>
 
 #include <machine/vmparam.h>
 #include <machine/elf_machdep.h>
--- conf/GENERIC.orig   1970-01-01 09:00:00.000000000 +0900
+++ conf/GENERIC        2009-02-08 17:15:52.000000000 +0900
@@ -0,0 +1,78 @@
+# $NetBSD: GENERIC.SKI,v 1.4 2008/02/29 14:42:32 jmmv Exp $
+#
+# GENERIC machine description file
+#
+# This machine description file is used to generate the default NetBSD
+# kernel.  The generic kernel does not include all options, subsystems
+# and device drivers, but should be useful for most applications.
+#
+# The machine description file can be customised for your specific
+# machine to reduce the kernel size and improve its performance.
+#
+# For further information on compiling NetBSD kernels, see the config(8)
+# man page.
+#
+# For further information on hardware support for this architecture, see
+# the intro(4) man page.  For further information about kernel options
+# for this architecture, see the options(4) man page.  For an explanation
+# of each device driver in this file see the section 4 man page for the
+# device.
+
+include        "arch/ia64/conf/std.ia64"
+
+options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
+
+#ident                 "GENERIC-$Revision: 1.4 $"
+
+maxusers       32              # estimated number of users
+
+# CPU support.  At least one is REQUIRED.
+#options       IA64_CPU
+
+# CPU-related options.
+
+# Standard system options
+
+options        USERCONF        # userconf(4) support
+
+# Diagnostic/debugging support options
+options        DIAGNOSTIC      # expensive kernel consistency checks
+options        DEBUG           # expensive debugging checks/support
+#options       KMEMSTATS       # kernel memory statistics (vmstat -m)
+options        DDB             # in-kernel debugger
+#options       DDB_ONPANIC=1   # see also sysctl(8): `ddb.onpanic'
+#options       DDB_HISTORY_SIZE=512    # enable history editing in DDB
+#options       KGDB            # remote debugger
+#options       KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
+#options               MALLOC_DEBUG
+#options               MALLOCLOG
+makeoptions    DEBUG="-g"      # compile full symbol table
+
+# File systems
+file-system    FFS             # UFS
+#file-system   MFS             # memory file system
+
+
+# Kernel root file system and dump configuration.
+config         netbsd  root on ? type ?
+
+#
+# Device configuration
+#
+
+mainbus0 at root
+
+cpu* at mainbus?
+#ioapic* at mainbus?
+
+# Advanced Configuration and Power Interface
+
+#acpi0         at mainbus0
+
+# ACPI devices
+
+# Mainboard devices
+#com*          at acpi?                # Serial communications interface
+
+# Pull in optional local configuration
+cinclude "arch/ia64/conf/GENERIC.local"
--- ia64/consinit.c.orig        1970-01-01 09:00:00.000000000 +0900
+++ ia64/consinit.c     2009-02-15 21:11:57.000000000 +0900
@@ -0,0 +1,225 @@
+/*     $NetBSD$        */
+/*
+ * Copyright (c) 2009 KIYOHARA Takashi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD$");
+
+#include <sys/device.h>
+#include <sys/termios.h>
+#include <sys/param.h>
+
+#include <machine/bus.h>
+#include <machine/dig64.h>
+#include <machine/md_var.h>
+
+#include <dev/acpi/acpica.h>
+
+#include "com.h"
+#include "vga.h"
+#include "ssccons.h"
+
+#include <dev/cons.h>
+#if NCOM > 0
+#include <dev/ic/comvar.h>
+#endif
+#if NVGA > 0
+#include <dev/ic/vgareg.h>
+#include <dev/ic/vgavar.h>
+#endif
+
+
+static void pcdp_cnprobe(struct consdev *);
+static void pcdp_cninit(struct consdev *);
+
+cons_decl(ssc);
+
+struct consdev constab[] = {
+       { pcdp_cnprobe, pcdp_cninit,
+         NULL, NULL, NULL, NULL, NULL, NULL, NODEV, CN_DEAD },
+#if NSSCCONS > 0
+       cons_init(ssc),
+#endif
+       { NULL }
+};
+
+
+void
+consinit()
+{
+
+       cninit();
+}
+
+static void
+pcdp_cnprobe(struct consdev *cn)
+{
+       struct dig64_hcdp_table *tbl;
+       union dev_desc *desc;
+       uint64_t hcdp;
+       int n, m;
+
+       hcdp = ia64_get_hcdp();
+       if (hcdp != 0) {
+               tbl = (void*)IA64_PHYS_TO_RR7(hcdp);
+               n = 0;
+               m = tbl->length - sizeof(struct dig64_hcdp_table);
+               while (n < m) {
+                       desc = (union dev_desc *)((char *)tbl->entry + n);
+#if NVGA > 0
+                       if (devdesc->type ==
+                           (DIG64_ENTRYTYPE_VGA | DIG64_ENTRYTYPE_OUTONLY)) {
+#if defined(DIAGNOSTIC)
+                               if (tbl->revision < 3)
+                                       panic("PCDP found in HCDP rev.%d."
+                                           " Maybe unsupport PCDP",
+                                           tbl->revision);
+#endif
+                               cn->cn_pri = CN_NORMAL;
+                               break;
+                       }
+#endif
+#if NCOM > 0
+                       if (desc->type == DIG64_HCDP_CONSOLE) {
+                               cn->cn_pri = CN_REMOTE;
+                               break;
+                       }
+#endif
+
+                       if (desc->type == DIG64_ENTRYTYPE_TYPE0 ||
+                           desc->type == DIG64_ENTRYTYPE_TYPE1)
+                               n += sizeof(struct dig64_hcdp_entry);
+                       else
+                               n += desc->pcdp.length;
+               }
+       }
+       if (cn->cn_pri != CN_DEAD)
+               cn->cn_dev = ~NODEV;    /* Shall we makedev()? */
+}
+
+static void
+pcdp_cninit(struct consdev *cn)
+{
+       struct dig64_hcdp_table *tbl;
+       union dev_desc *desc;
+       uint64_t hcdp;
+       int n, m;
+
+       hcdp = ia64_get_hcdp();
+       if (hcdp == 0)
+               panic("lost console...\n");
+
+       tbl = (void *)IA64_PHYS_TO_RR7(hcdp);
+       n = 0;
+       m = tbl->length - sizeof(struct dig64_hcdp_table);
+       while (n < m) {
+               desc = (union dev_desc *)((char *)tbl->entry + n);
+#if NVGA > 0
+
+/* not yet... */
+/* Our VGA is Framebuffer? */
+
+               if (cn->cn_pri == CN_NORMAL &&
+                   desc->type ==
+                           (DIG64_ENTRYTYPE_VGA | DIG64_ENTRYTYPE_OUTONLY)) {
+                       struct dig64_pcdp_entry *ent = &desc->pcdp;
+
+                       if (ent->specs.type == DIG64_PCDP_SPEC_PCI) {
+                               struct dig64_pci_spec *spec = ent->specs.pci;
+
+                               if (spec->flags & DIG64_FLAGS_MMIO_TRA_VALID)
+                                       (void*)spec->mmio_tra;
+                               if (spec->flags & DIG64_FLAGS_IOPORT_TRA_VALID)
+                                       (void*)spec->ioport_tra;
+                       }
+
+                       break;
+               }
+#endif
+#if NCOM > 0
+               if (cn->cn_pri == CN_REMOTE &&
+                   desc->type == DIG64_HCDP_CONSOLE) {
+                       struct dig64_hcdp_entry *ent = &desc->uart;
+                       bus_addr_t ioaddr;
+                       bus_space_tag_t iot;
+                       const uint64_t rate =
+                           ((uint64_t)ent->baud_high << 32) | ent->baud_low;
+                       tcflag_t cflag =
+                           TTYDEF_CFLAG & ~(CSIZE | PARENB | PARODD);
+
+                       switch (ent->databits) {
+                       case 5:
+                               cflag = CS5;
+                               break;
+                       case 6:
+                               cflag = CS6;
+                               break;
+                       case 7:
+                               cflag = CS7;
+                               break;
+                       case 8:
+                               cflag = CS8;
+                               break;
+                       default:
+                               panic("unsupported databits %d\n",
+                                   ent->databits);
+                       }
+                       switch (ent->parity) {
+                       case DIG64_HCDP_PARITY_NO:
+                               break;
+                       case DIG64_HCDP_PARITY_ODD:
+                               cflag |= PARODD;
+
+                               /* FALLTHROUGH */
+
+                       case DIG64_HCDP_PARITY_EVEN:
+                               cflag |= PARENB;
+                               break;
+                       case DIG64_HCDP_PARITY_MARK:
+                       case DIG64_HCDP_PARITY_SPACE:
+                       default:
+                               panic("unsupported parity type %d\n",
+                                   ent->parity);
+                       }
+                       if (ent->stopbits == DIG64_HCDP_STOPBITS_1)
+                               cflag &= ~CSTOPB;
+                       else if (ent->stopbits == DIG64_HCDP_STOPBITS_2)
+                               cflag |= CSTOPB;
+                       else
+                               panic("unsupported stopbits type %d\n",
+                                   ent->stopbits);
+                       iot = (ent->address.addr_space ==
+                                               ACPI_ADR_SPACE_SYSTEM_MEMORY) ?
+                           IA64_BUS_SPACE_MEM : IA64_BUS_SPACE_IO;
+                       ioaddr = ((uint64_t)ent->address.addr_high << 32) |
+                           ent->address.addr_low;
+                       comcnattach(iot, ioaddr, rate,
+                           (ent->pclock != 0) ? ent->pclock : COM_FREQ,
+                           COM_TYPE_NORMAL, cflag);
+                       break;
+               }
+#endif
+       }
+}
/*      $NetBSD$        */
/*
 * Copyright (c) 2009 KIYOHARA Takashi
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
#ifndef _IA64_BUS_H_
#define _IA64_BUS_H_

#include <machine/cpufunc.h>


/*
 * Values for the ia64 bus space tag, not to be used directly by MI code.
 */
#define IA64_BUS_SPACE_IO       0       /* space is i/o space */
#define IA64_BUS_SPACE_MEM      1       /* space is mem space */


typedef u_long bus_addr_t;
typedef u_long bus_size_t;

typedef int bus_space_tag_t;
typedef u_long bus_space_handle_t;


int bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
                  bus_space_handle_t *);
void bus_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);


static __inline uint8_t
bus_space_read_1(bus_space_tag_t space, bus_space_handle_t handle,
                 bus_size_t offset)
{
        uint8_t __volatile *bsp;

        bsp = (space == IA64_BUS_SPACE_IO) ? __PIO_ADDR(handle + offset) :
            __MEMIO_ADDR(handle + offset);
        return *bsp;
}

static __inline uint16_t
bus_space_read_2(bus_space_tag_t space, bus_space_handle_t handle,
                 bus_size_t offset)
{
        uint16_t __volatile *bsp;

        bsp = (space == IA64_BUS_SPACE_IO) ? __PIO_ADDR(handle + offset) :
            __MEMIO_ADDR(handle + offset);
        return *bsp;
}

static __inline void
bus_space_write_1(bus_space_tag_t space, bus_space_handle_t handle,
                  bus_size_t offset, uint8_t value)
{
        uint8_t __volatile *bsp;

        bsp = (space == IA64_BUS_SPACE_IO) ? __PIO_ADDR(handle + offset) :
            __MEMIO_ADDR(handle + offset);
        *bsp = value;
}

static __inline void
bus_space_write_2(bus_space_tag_t space, bus_space_handle_t handle,
                  bus_size_t offset, uint16_t value)
{
        uint16_t __volatile *bsp;

        bsp = (space == IA64_BUS_SPACE_IO) ? __PIO_ADDR(handle + offset) :
            __MEMIO_ADDR(handle + offset);
        *bsp = value;
}

/*
 * Bus read/write barrier method.
 */
#define BUS_SPACE_BARRIER_READ  0x01            /* force read barrier */
#define BUS_SPACE_BARRIER_WRITE 0x02            /* force write barrier */

static __inline void
bus_space_barrier(bus_space_tag_t space, bus_space_handle_t handle,
                  bus_size_t offset, bus_size_t length, int flags)
{
        ia64_mf_a();
        ia64_mf();
}

/*
 * Write count units of data to bus space described by the tag, handle and
 * ofs tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
 * data is read from the buffer passed by reference.
 */
static __inline void
bus_space_write_multi_1(bus_space_tag_t space, bus_space_handle_t handle,
                        bus_size_t offset, const uint8_t *datap,
                        bus_size_t count)
{
        uint8_t __volatile *bsp;

        bsp = (space == IA64_BUS_SPACE_IO) ? __PIO_ADDR(handle + offset) :
            __MEMIO_ADDR(handle + offset);
        while (count-- > 0)
                *bsp = *datap++;
}

#endif  /* _IA64_BUS_H_ */
/*      $NetBSD$        */
/*
 * Copyright (c) 2009 KIYOHARA Takashi
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD$");

#include <sys/bus.h>


int
bus_space_map(bus_space_tag_t space, bus_addr_t address, bus_size_t size,
              int flags, bus_space_handle_t *handlep)
{

        *handlep = address;
        return 0;
}

void
bus_space_unmap(bus_space_tag_t space, bus_space_handle_t handle,
                bus_size_t size)
{
        /* not yet ??? */
}


Home | Main Index | Thread Index | Old Index