· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Asterisk Env

AsteriskEnv 2009 년 8 월

* install asterisk

* iptime
  • http://blog.tuffkid.net/11
  • reboot 시 device 가 load 되지 않음
  • insmod /lib/modules/2.6.18-53.1.4.el5/kernel/drivers/net/wireless/rt73.ko
  • ifconfig rausb0 inet 192.168.0.77 up
  • iwconfig rausb0 essid myLGNet key 123456789a
  • 아직도 확실히 되는지 모르겠음
  • /etc/sysconfig/network-scripts/ 밑의 network-functions 의 is_available 를 보아야 함.
  • ifup-eth
# now check the real state
is_available ${REALDEVICE} || {
      if [ -n "$alias" ]; then
         echo $"$alias device ${DEVICE} does not seem to be present, delaying initialization."
      else
         echo $"Device ${DEVICE} does not seem to be present, delaying initialization."
      fi
      exit 1
}


* iptime compile
  • CentOs disk 를 이용하여 yum repository 를 만듬.
  • /dev/sdb3 를 /mnt/sdb3 로 mount
  • mkdir centos5.1
  • cd centos5.1
  • mkdir 1 2 3 4 5 6
  • 각 disk 를 1 2 3 4 5 6 에 copy
  • centos5.1 에서 createrepo 수행
  • 커널 소스는 별도로 찾아서 다운로드 함.
  • rpm-build 설치
  • 이때 발생하는 문제를 해결하기 위해
  • glibc-common 을 rpm -ivh --force 를 이용하여 설치
  • glibc 를 rpm -ivh --force 를 이용하여 설치
  • redhat-rpm-config 도 설치
  • /usr/src/kernels/2.6.18-53.1.4.el5-i686/scripts/mod 밑에 modpost 가 있어야 함. kernel make 가 필요한가?

* /etc/yum.repos.d/CentOS-Media.repo
[c5-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/sda7/CentOS5.3/CentOS/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

* yum -y groupinstall "X Window System"
  • disk1 에 있는 comps.xml 을 이용하여 다시 createrepo
  • cd centos5.1/
  • createrepo -g comps.xml .
  • yum --disablerepo=\* --enablerepo=c5-media -y groupinstall "X Window System"

* yum -y groupinstall "GNOME Desktop Environment"
  • hal 과 dbus 를 --force option 을 사용하여 설치
  • rpm -ivh --force /mnt/sdb3/centos5.1/1/CentOS/hal-0.5.8.1-25.el5.i386.rpm
  • rpm -ivh --force /mnt/sdb3/centos5.1/1/CentOS/dbus-1.0.0-6.el5.i386.rpm
  • rpm -ivh --nodeps centos5.1/2/CentOS/nautilus-sendto-0.7-5.fc6.i386.rpm
  • yum --disablerepo=\* --enablerepo=c5-media -y groupinstall "GNOME Desktop Environment"

* yum -y groupinstall "Korean Support"

* change /etc/inittab

  637  rpm -ivh glibc-common-2.5-18.el5_1.1.i386.rpm 
  638  rpm -ivh --force glibc-common-2.5-18.el5_1.1.i386.rpm 
  639  rpm -ivh --force glibc-2.5-18.el5_1.1.i686.rpm 
  640  rpm -ivh --force hal-0.5.8.1-25.el5_1.1.i386.rpm 
  641  rpm -ivh --force dbus-1.0.0-6.3.el5_1.i386.rpm 

2009 년 9 월 4일

* AsteriskNOW 1.5.0 설치
  • 자동으로 mbr 에 grub 설치 version 0.97
  • 먼저 만들어진 partition 의 fc10, fc5 로 booting 을 할 수 없음.
  • Error 2: Bad file or directory type

* fc8 live cd 사용
  • grub-install --root-directory=/mnt/sda5 /dev/sda
  • The file /mnt/sda5/boot/grub/stage1 not read correctly
* chroot /mnt/sda5 /bin/bash
  • grub-install /dev/sda
  • /dev/sda not find or not a block device

* fc11 live cd 생성
  • grub-install --root-directory=/mnt/sda5 /dev/sda
  • 성공

* grub 의 문제일 것 같은데, version 은 같음.

* grub
  • stage2 error
  • Bad file or directory type
This error is returned if a file requested is not a regular file, but something like a symbolic link, directory, or FIFO.

Dell server

  • PowerEdge SC430
  • trixboxNow 설치
  •  # P A R T I T I O N   S P E C I F I C A T I O N
     # 
     # This is where you specify the partitions to be used in the install.
     # There are several sections that we'll cover in order.
     # 
     # If you are doing a kickstart install on a new drive, the partition table
     # will likely corrupt.  The zerombr command can be used to clear the
     # partition table if it is corrupt; otherwise it will take no action.  In
     # order to clear the partition table, follow the zerombr command with
     # "yes"; if followed by "no", no action will be taken.
     #
     # Example:
     #zerombr yes
     #
     # The clearpart command is used to control which partitions are to be wiped
     # from all drives.  Follow the clearpart command with "--all" to remove all
     # partitions from all drives, or "--linux" to remove all Linux-related
     # partitions (ie., partitions of type "Linux native" and "Linux swap") from
     # all drives.
     #
     # Example:
     #clearpart --linux
     # 
     # Next, specify the partitions that you'd like to create.  Partitions are
     # only created from free space available on the system.  Enter one
     # partition per line using the following format:
     #
     # part <mntpt> --size <size in megs> [--grow] [--maxsize <size in megs>]
     #
     # Where <mntpt> is the desired mount point for the partition (or "swap" for
     # swap partitions).  Add "--grow" to create a partition that will grow to
     # fill all remaining space on the drive.  To limit the affect of --grow,
     # you can add "--maxsize" followed by a size specification.
     # 
     # Examples:
     #part / --size 250
     #part swap --size 32
     #part /usr --size 500 --grow --maxsize 800
     #part /tmp --size 100 --grow
     

Dell system 4700

  • fc7, fc7 livecd
  • BIOS
    • Drive 0: SATA-0 , ST3160023AS 160GB
    • Drive 1: SATA-2
    • Drive 3: PATA-0 , HL-DT-ST DVDRAM
    • Drive 4: PATA-1 , SV4012H 40GB
  • kernel 2.6.21
    • hdX -> sdX
    • SATA-0: sdb
    • PATA-0: sr
    • PATA-1: sda
  • kernel 2.6.16
    • SATA-0: sda
    • PATA-0: hda
    • PATA-1: hdb
  • fc7 on hdb
    • downgrade kernel to 2.6.16
    • cp /lib/modules/version
    • change /etc/rc.d/rc.sysinit
    • change vmlinux-version, initrd-version.img, System.map-version
    • edit /boot/grub/menu.list
  • mkinitrd -f --with=sata_nv --with=sata_sis /boot/initrd-2.6.20-1.2948.fc6.img 2.6.20-1.2948.fc6
  • sata to ide cable 을 사용하여 SATA-2 에 ide hard disk 'SV4012H 40GB' 을 연결함.
  • BIOS
    • Drive 0: SATA-0 , ST3160023AS 160GB sda
    • Drive 1: SATA-2 , SV4012H 40GB sdb
    • Drive 3: PATA-0 , HL-DT-ST DVDRAM hda
    • Drive 4: PATA-1

2008. 07. 11 for install centos 5.1

  • 문제점
    • Loading ata_piix driver... 화면에서 오랫동안 멈추어 있음
    • Ctrl-Alt-F4 를 치면, text mode 로 변경됨
    • libata version 2.21 loaded
    • ata module 을 load 하면서, hardware setting 을 함.
    • 이때 문제가 생겨 setting 하지 못하고, 실패함
  •  ata1.00: qc timeout (cmd 0xec)
     ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
     ata1.00 revalidation failed (errno = -5)
     ata1.01: ata_hpa_resize 1: hpa sectors (0) is smaller than sectors (78242976)
     ata1.01: failed to set xfermode (err_mask=0x40)
     ata1: failed to recover some devices, retrying in 5 secs
     

  • 설치되어 있는 cent0s 4.2 로 부팅된 상황에서의 dmesg
     Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
     ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
     ICH6: IDE controller at PCI slot 0000:00:1f.1
     ACPI: PCI interrupt 0000:00:1f.1[A] -> GSI 11 (level, low) -> IRQ 11
     ICH6: chipset revision 3
     ICH6: not 100% native mode: will probe irqs later
         ide0: BM-DMA at 0xffa0-0xffa7, BIOS settings: hda:DMA, hdb:pio
     Probing IDE interface ide0...
     hda: HL-DT-ST DVDRAM GSA-4160B, ATAPI CD/DVD-ROM drive
     Using cfq io scheduler
     ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
     Probing IDE interface ide1...
     Probing IDE interface ide2...
     Probing IDE interface ide3...
     Probing IDE interface ide4...
     Probing IDE interface ide5...
     hda: ATAPI 40X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache, UDMA(33)
     Uniform CD-ROM driver Revision: 3.20
     

     SCSI subsystem initialized
     libata version 1.11 loaded.
     ata_piix version 1.03
     ACPI: PCI interrupt 0000:00:1f.2[C] -> GSI 9 (level, low) -> IRQ 9
     PCI: Setting latency timer of device 0000:00:1f.2 to 64
     ata1: SATA max UDMA/133 cmd 0xFE00 ctl 0xFE12 bmdma 0xFEA0 irq 9
     ata2: SATA max UDMA/133 cmd 0xFE20 ctl 0xFE32 bmdma 0xFEA8 irq 9
     ata1: dev 0 cfg 49:2f00 82:346b 83:7f01 84:4003 85:3469 86:3c01 87:4003 88:207f
     ata1: dev 0 ATA, max UDMA/133, 312500000 sectors: lba48
     ata1: dev 1 cfg 49:0b00 82:346b 83:5301 84:4003 85:3469 86:1001 87:4003 88:203f
     ata1: dev 1 ATA, max UDMA/100, 78242976 sectors:
     ata1: dev 0 configured for UDMA/100
     ata1: dev 1 configured for UDMA/100
     scsi0 : ata_piix
     ATA: abnormal status 0xFF on port 0xFE27
     ata2: disabling port
     scsi1 : ata_piix
       Vendor: ATA       Model: ST3160023AS       Rev: 8.12
       Type:   Direct-Access                      ANSI SCSI revision: 05
     SCSI device sda: 312500000 512-byte hdwr sectors (160000 MB)
     SCSI device sda: drive cache: write back
      sda: sda1 sda2 sda3 < sda5 sda6 sda7 sda8 sda9 sda10 > sda4
     Attached scsi disk sda at scsi0, channel 0, id 0, lun 0
       Vendor: ATA       Model: SAMSUNG SV4012H   Rev: RM10
       Type:   Direct-Access                      ANSI SCSI revision: 05
     SCSI device sdb: 78242976 512-byte hdwr sectors (40060 MB)
     SCSI device sdb: drive cache: write back
      sdb: sdb1 sdb2
     Attached scsi disk sdb at scsi0, channel 0, id 1, lun 0
     kjournald starting.  Commit interval 5 seconds
     EXT3-fs: mounted filesystem with ordered data mode.
     

  • boot 시에 커널 옵션 추가
    • linux irqpoll
      • Changes the way the kernel handles interrupt calls (set it to polling). Can be useful in case of hardware interrupt issues.
    • hard drive 의 제품명은 알아냄
    • sdb 를 setting 하는데 문제 발생
  •  sda: Write Protect is off
     sda: Mode Sense: 00 3a 00 00
     ata1: soft resetting port
     ata1.00: configured for UDMA/133
     ata1.01: configured for UDMA/66
     ata1: EH complete
     ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2
     ata1.00: cmd a0/01:00:00:00:00/00:00:00:00:00/a0 tag 0 cdb 0x25 data 8 in
              res 00/24:03:00:00:00/00:00:00:00:00/a0 Emask 0x2 (timeout)
     
     sd 0:0:0:0: SCSI error: return code = 0x8000002
     sdb: Current [descriptor]: sense key: Aborted Command
     
     end_request: I/O error, dev sdb, sector 0
     Buffer I/O error on device sdb, logical block 0
     

  • BIOS 에서 SATA-2 를 off 한 경우
    • sdb setting 하는데 문제 생김
    • centos 4.2 로 booting, dmesg
  •  SCSI subsystem initialized
     libata version 1.11 loaded.
     ata_piix version 1.03
     ACPI: PCI interrupt 0000:00:1f.2[C] -> GSI 9 (level, low) -> IRQ 9
     PCI: Setting latency timer of device 0000:00:1f.2 to 64
     ata1: SATA max UDMA/133 cmd 0xFE00 ctl 0xFE12 bmdma 0xFEA0 irq 9
     ata2: SATA max UDMA/133 cmd 0xFE20 ctl 0xFE32 bmdma 0xFEA8 irq 9
     ata1: dev 0 cfg 49:2f00 82:346b 83:7f01 84:4003 85:3469 86:3c01 87:4003 88:207f
     ata1: dev 0 ATA, max UDMA/133, 312500000 sectors: lba48
     ata1: dev 0 configured for UDMA/133
     scsi0 : ata_piix
     ATA: abnormal status 0xFF on port 0xFE27
     ata2: disabling port
     scsi1 : ata_piix
       Vendor: ATA       Model: ST3160023AS       Rev: 8.12
       Type:   Direct-Access                      ANSI SCSI revision: 05
     SCSI device sda: 312500000 512-byte hdwr sectors (160000 MB)
     SCSI device sda: drive cache: write back
      sda: sda1 sda2 sda3 < sda5 sda6 sda7 sda8 sda9 sda10 > sda4
     Attached scsi disk sda at scsi0, channel 0, id 0, lun 0
     kjournald starting.  Commit interval 5 seconds
     EXT3-fs: mounted filesystem with ordered data mode.
     

  • cable 을 뽑고 해 본다.
    • hard disk detection success
    • dvd 에서 rpm 파일을 열지 못하는 문제 발생
    • The file kernel-2.6.18-53.el5.i686.rpm cannot be opened
  • usb 로 설치 파일 이동후 booting
    • 성공함. sda9 에 설치
  •  SCSI subsystem initialized
     libata version 2.21 loaded.
     ata_piix 0000:00:1f.2: version 2.11
     ata_piix 0000:00:1f.2: MAP [ P0 P2 P1 P3 ]
     ACPI: PCI Interrupt 0000:00:1f.2[C] -> GSI 20 (level, low) -> IRQ 233
     PCI: Setting latency timer of device 0000:00:1f.2 to 64
     scsi0 : ata_piix
     scsi1 : ata_piix
     ata1: SATA max UDMA/133 cmd 0x0001fe00 ctl 0x0001fe12 bmdma 0x0001fea0 irq 233
     ata2: SATA max UDMA/133 cmd 0x0001fe20 ctl 0x0001fe32 bmdma 0x0001fea8 irq 233
     ata1.00: ATA-6: ST3160023AS, 8.12, max UDMA/133
     ata1.00: 312500000 sectors, multi 8: LBA48 NCQ (depth 0/32)
     ata1.00: configured for UDMA/133
     usb 1-1: configuration #1 chosen from 1 choice
       Vendor: ATA       Model: ST3160023AS       Rev: 8.12
       Type:   Direct-Access           ANSI SCSI revision: 05
     SCSI device sda: 312500000 512-byte hdwr sectors (160000 MB)
     sda: Write Protect is off
     sda: Mode Sense: 00 3a 00 00
     SCSI device sda: drive cache: write back
     SCSI device sda: 312500000 512-byte hdwr sectors (160000 MB)
     sda: Write Protect is off
     sda: Mode Sense: 00 3a 00 00
     SCSI device sda: drive cache: write back
      sda: sda1 sda2 sda3 < sda5 sda6 sda7 sda8 sda9 sda10 > sda4
     sd 0:0:0:0: Attached scsi disk sda
     
  • sata-2 cable 연결 후 어떤 문제가 생기는지 보아야 함
    • centos 5.1 livecd
  •  SCSI subsystem initialized
     hda: ATAPI 40X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache, UDMA(33)
     libata version 2.21 loaded.
     ata_piix 0000:00:1f.2: version 2.11
     ata_piix 0000:00:1f.2: MAP [ P0 P2 P1 P3 ]
     scsi0 : ata_piix
     scsi1 : ata_piix
     ata1: SATA max UDMA/133 cmd 0x0001fe00 ctl 0x0001fe12 bmdma 0x0001fea0 irq 233
     ata2: SATA max UDMA/133 cmd 0x0001fe20 ctl 0x0001fe32 bmdma 0x0001fea8 irq 233
     ata1.00: ATA-6: ST3160023AS, 8.12, max UDMA/133
     ata1.00: 312500000 sectors, multi 8: LBA48 NCQ (depth 0/32)
     ata1.01: qc timeout (cmd 0xf8)
     ata1.01: ata_hpa_resize 1: hpa sectors (0) is smaller than sectors (78242976)
     ata1.01: ATA-6: SAMSUNG SV4012H, RM100-05, max UDMA/100
     ata1.01: 78242976 sectors, multi 8: LBA
     ata1.01: applying bridge limits
     ata1.00: failed to set xfermode (err_mask=0x40)
     ata1: failed to recover some devices, retrying in 5 secs
     ata1.01: qc timeout (cmd 0xf8)
     ata1.01: ata_hpa_resize 1: hpa sectors (0) is smaller than sectors (78242976)
     ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
     ata1.00: revalidation failed (errno=-5)
     ata1.00: limiting speed to UDMA/133:PIO3
     ata1: failed to recover some devices, retrying in 5 secs
     ata1.01: qc timeout (cmd 0xf8)
     ata1.01: ata_hpa_resize 1: hpa sectors (0) is smaller than sectors (78242976)
     ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
     ata1.00: revalidation failed (errno=-5)
     ata1.00: disabled
     ata1: failed to recover some devices, retrying in 5 secs
     ata1.01: failed to set xfermode (err_mask=0x40)
     ata1: failed to recover some devices, retrying in 5 secs
     ata1.01: qc timeout (cmd 0xf8)
     ata1.01: ata_hpa_resize 1: hpa sectors (0) is smaller than sectors (78242976)
     ata1.01: failed to set xfermode (err_mask=0x40)
     ata1.01: limiting speed to UDMA/100:PIO3
     ata1: failed to recover some devices, retrying in 5 secs
     ata1.01: qc timeout (cmd 0xf8)
     ata1.01: ata_hpa_resize 1: hpa sectors (0) is smaller than sectors (78242976)
     ata1.01: failed to set xfermode (err_mask=0x40)
     ata1.01: disabled
     

kernel source

  • SCSI subsystem initialized
    • drivers/scsi/scsi.c
    • static int __init init_scsi(void)
    • printk(KERN_NOTICE "SCSI subsystem initialized\n");
  • libata version 2.21 loaded.
    • drivers/ata/libata-core.c
    • static int __init ata_init(void)
    • printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n");
  • ata_piix 0000:00:1f.2: version 2.11
    • drivers/ata/ata_piix.c
    • static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
    • dev_printk(KERN_DEBUG, &pdev->dev,"version " DRV_VERSION "\n");
  • ata_piix 0000:00:1f.2: MAP P0 P2 P1 P3
    • drivers/ata/ata_piix.c
    • static void __devinit piix_init_sata_map(struct pci_dev *pdev, struct ata_port_info *pinfo, const struct piix_map_db *map_db)
    • dev_printk(KERN_INFO, &pdev->dev, "MAP [");
    • printk(" P%d", mapi);
    • printk(" ]\n");
  • scsi0 : ata_piix
  • scsi1 : ata_piix
    • drivers/scsi/hosts.c
    • int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
    • printk(KERN_INFO "scsi%d : %s\n", shost->host_no, sht->info ? sht->info(shost) : sht->name);
  • ACPI: PCI Interrupt 0000:00:1f.2C -> GSI 20 (level, low) -> IRQ 66
    • drivers/acpi/pci_irq.c
    • int acpi_pci_irq_enable(struct pci_dev *dev)
    • acpi_bus.h:#define PREFIX "ACPI: "
    • printk(KERN_INFO PREFIX "PCI Interrupt %s%c -> ", pci_name(dev), 'A' + pin);
    • printk("GSI %u (%s, %s) -> IRQ %d\n", irq, (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
  • ata1: SATA max UDMA/133 cmd 0x0001fe00 ctl 0x0001fe12 bmdma 0x0001fea0 irq 66
  • ata2: SATA max UDMA/133 cmd 0x0001fe20 ctl 0x0001fe32 bmdma 0x0001fea8 irq 66
    • drivers/ata/libata-core.c
    • int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
    • ata_port_printk(ap, KERN_INFO, "%cATA max %s cmd 0x%p " "ctl 0x%p bmdma 0x%p irq %d\n", ap->cbl == ATA_CBL_SATA ? 'S' : 'P', ata_mode_string(xfer_mask), ap->ioaddr.cmd_addr, ap->ioaddr.ctl_addr, ap->ioaddr.bmdma_addr, irq_line);
  • ata1.00: ATA-7: WDC WD800JD-75MSA1, 10.01E01, max UDMA/133
  • ata1.00: 156250000 sectors, multi 8: LBA48 NCQ (depth 0/32)
    • drivers/ata/libata-core.c
    • int ata_dev_configure(struct ata_device *dev)
    • ata_dev_printk(dev, KERN_INFO, "%s: %s, %s, max %s\n", revbuf, modelbuf, fwrevbuf, ata_mode_string(xfer_mask));
    • ata_dev_printk(dev, KERN_INFO, "%Lu sectors, multi %u: %s %s\n", (unsigned long long)dev->n_sectors, dev->multi_count, lba_desc, ncq_desc);
  • ata1.00: configured for UDMA/133
    • drivers/ata/libata-core.c
    • static int ata_dev_set_mode(struct ata_device *dev)
    • ata_dev_printk(dev, KERN_INFO, "configured for %s\n", ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)));
  • SCSI device sda: 156250000 512-byte hdwr sectors (80000 MB)
    • drivers/scsi/sd.c
    • sd_read_capacity(struct scsi_disk *sdkp, char *diskname, unsigned char *buffer)
    • printk(KERN_NOTICE "SCSI device %s: " "%llu %d-byte hdwr sectors (%llu MB)\n", diskname, (unsigned long long)sdkp->capacity, hard_sector, (unsigned long long)mb);
  • sda: Write Protect is off
  • sda: Mode Sense: 00 3a 00 00
    • drivers/scsi/sd.c
    • sd_read_write_protect_flag(struct scsi_disk *sdkp, char *diskname, unsigned char *buffer)
    • printk(KERN_NOTICE "%s: Write Protect is %s\n", diskname, sdkp->write_prot ? "on" : "off");
    • printk(KERN_DEBUG "%s: Mode Sense: %02x %02x %02x %02x\n", diskname, buffer0, buffer1, buffer2, buffer3);
  • SCSI device sda: drive cache: write back
    • drivers/scsi/sd.c
    • sd_read_cache_type(struct scsi_disk *sdkp, char *diskname, unsigned char *buffer)
    • printk(KERN_NOTICE "SCSI device %s: drive cache: %s%s\n", diskname, sd_cache_typesct, sdkp->DPOFUA ? " w/ FUA" : "");
  • drivers/scsi/sd.c
    • static int __init init_sd(void)
    • static int sd_probe(struct device *dev)
    • static int sd_revalidate_disk(struct gendisk *disk)
      • if (sdkp->media_present)
        • sd_read_capacity(sdkp, disk->disk_name, buffer);
        • sd_read_write_protect_flag(sdkp, disk->disk_name, buffer);
        • sd_read_cache_type(sdkp, disk->disk_name, buffer);
  • sd_probe
     SCSI device sda: 312500000 512-byte hdwr sectors (160000 MB)
     sda: Write Protect is off
     sda: Mode Sense: 00 3a 00 00
     SCSI device sda: drive cache: write back
     SCSI device sda: 312500000 512-byte hdwr sectors (160000 MB)
     sda: Write Protect is off
     sda: Mode Sense: 00 3a 00 00
     SCSI device sda: drive cache: write back
      sda: sda1 sda2 sda3 < sda5 sda6 sda7 sda8 sda9 sda10 > sda4
     sd 0:0:0:0: Attached scsi disk sda
     

modules

  • scsi_mod
    • sd_mod
    • libata
      • ata_piix
  • scsi_mod
    • drivers/scsi/scsi.c
    • static int __init init_scsi(void)
    • printk(KERN_NOTICE "SCSI subsystem initialized\n");
  • libata
    • drivers/ata/libata-core.c
    • static int __init ata_init(void)
    • printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n");

sd_mod

  • drivers/scsi/sd.c
     http://www.ibm.com/developerworks/linux/library/l-scsi-subsystem/?S_TACT=105AGX55&S_CMP=EDU
     The SCSI disk driver is implemented in ./linux/drivers/scsi/sd.c. The SCSI disk driver initializes itself with a call to register_blkdev (as a block driver) and provides a common set of functions that represent all SCSI devices with scsi_register_driver. Two of interest here are sd_probe and sd_init_command. Whenever a new SCSI device is attached to a system, the sd_probe function is called from the SCSI mid layer. The sd_probe function determines whether the device will be managed by the SCSI disk driver and, if so, creates a new scsi_disk structure to represent it. The sd_init_command is the function that takes a request from the file system layer and turns the request into a SCSI read or write command (sd_rw_intr is called to complete this I/O request).
     
  • static int __init init_sd(void)
    • register_blkdev(sd_major(i), "sd")
    • class_register(&sd_disk_class);
    • return scsi_register_driver(&sd_template.gendrv);
  • int register_blkdev(unsigned int major, const char *name)
    • block/genhd.c
  • int class_register(struct class * cls)
    • drivers/base/class.c
    • error = subsystem_register(&cls->subsys);
  • int subsystem_register(struct subsystem * s)
    • lib/kobject.c
  • int scsi_register_driver(struct device_driver *drv)
    • drivers/scsi/scsi_sysfs.c
    • return driver_register(drv);
  • int driver_register(struct device_driver * drv)
    • drivers/base/driver.c
    • return bus_add_driver(drv);
  • int bus_add_driver(struct device_driver * drv)
    • drivers/base/bus.c
    • driver_attach(drv);
  • void driver_attach(struct device_driver * drv)
    • drivers/base/dd.c
    • bus_for_each_dev(drv->bus, NULL, drv, __driver_attach);
  • int bus_for_each_dev
    • drivers/base/bus.c
    • __driver_attach
  • static int __driver_attach(struct device * dev, void * data)
    • drivers/base/dd.c
    • driver_probe_device(drv, dev);
  • int driver_probe_device(struct device_driver * drv, struct device * dev)
    • drivers/base/dd.c
    • ret = drv->probe(dev);
  • static int sd_probe(struct device *dev)
    • drivers/scsi/sd.c
    • sd_revalidate_disk(gd);
    • add_disk(gd);
  • sd_revalidate_disk(gd);
    • if (sdkp->media_present)
      • sd_read_capacity(sdkp, disk->disk_name, buffer);
        • SCSI device sda: 156250000 512-byte hdwr sectors (80000 MB)
      • sd_read_write_protect_flag(sdkp, disk->disk_name, buffer);
        • sda: Write Protect is off
        • sda: Mode Sense: 00 3a 00 00
      • sd_read_cache_type(sdkp, disk->disk_name, buffer);
        • SCSI device sda: drive cache: write back
  • void add_disk(struct gendisk *disk)
    • block/genhd.c
    • register_disk(disk);
  • void register_disk(struct gendisk *disk)
    • fs/partitions/check.c
    • bdev = bdget_disk(disk, 0);
    • err = blkdev_get(bdev, FMODE_READ, 0);
  • static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
    • include/linux/genhd.h
    • return bdget(MKDEV(disk->major, disk->first_minor) + index);
  • struct block_device *bdget(dev_t dev)
    • fs/block_dev.c
    • inode = iget5_locked(bd_mnt->mnt_sb, hash(dev), bdev_test, bdev_set, &dev);
  • int blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags)
    • fs/block_dev.c
    • return __blkdev_get(bdev, mode, flags, 0);
      • return do_open(bdev, &fake_file, for_part);
        • disk = get_gendisk(bdev->bd_dev, &part);
  • do_initcalls
    • init_sd
    • scsi_register_driver
    • driver_register
    • bus_add_driver
    • driver_attach
    • bus_match
    • sd_probe
    • add_disk
    • register_disk
    • add_partition
  •  If the device is opened for the first time and there are partitions, it calls bdget_disk to get the block device structure for the whole disk and calls blkdev_get to open the disk. The open handler of the block device operations table
     
     [   74.683198] usb-storage: device found at 3
     [   74.685229] scsi 0:0:0:0: Direct-Access     UDISK    PDU01_1G 65G2.0  0.00 PQ: 0 ANSI: 2
     [   74.692196] usb-storage: device scan complete
     [   75.018341] sd 0:0:0:0: [sda] 1967616 512-byte hardware sectors (1007 MB)
     [   75.019465] sd 0:0:0:0: [sda] Write Protect is off
     [   75.019624] sd 0:0:0:0: [sda] Mode Sense: 00 00 00 00
     [   75.019745] sd 0:0:0:0: [sda] Assuming drive cache: write through
     [   75.019872] sd_probe: call add_disk
     [   75.019986] start of register_disk: 1
     [   75.020234] after device_add: 3
     [   75.020387] after disk_sysfs_add_subdirs: 5
     [   75.020519] after get_capacity: 5
     [   75.020672] after bdget_disk: 5
     [   75.023582] sd 0:0:0:0: [sda] 1967616 512-byte hardware sectors (1007 MB)
     [   75.024637] sd 0:0:0:0: [sda] Write Protect is off
     [   75.024905] sd 0:0:0:0: [sda] Mode Sense: 00 00 00 00
     [   75.025115] sd 0:0:0:0: [sda] Assuming drive cache: write through
     [   75.025264]  sda: sda1
     [   75.054655] after blkdev_get: 8
     [   75.054924] after blkdev_put: 7
     [   75.057048] end of register_disk: 7
     [   75.057628] after blk_register_queue: 9
     [   75.057871] sd 0:0:0:0: [sda] Attached SCSI removable disk
     [   75.464875] sd 0:0:0:0: Attached scsi generic sg0 type 0
     

ata_piix

  • static int __init piix_init(void)
    • drivers/ata/ata_piix.c
    • rc = pci_register_driver(&piix_pci_driver);
  •  static struct pci_driver piix_pci_driver = {
             .name                   = DRV_NAME,
             .id_table               = piix_pci_tbl,
             .probe                  = piix_init_one,
             .remove                 = ata_pci_remove_one,
     #ifdef CONFIG_PM
             .suspend                = ata_pci_device_suspend,
             .resume                 = ata_pci_device_resume,
     #endif
     };
     

  • static inline int pci_register_driver(struct pci_driver *driver)
    • include/linux/pci.h
    • return __pci_register_driver(driver, THIS_MODULE);
  • int __pci_register_driver(struct pci_driver *drv, struct module *owner)
    • drivers/pci/pci-driver.c
    • error = driver_register(&drv->driver);
    • error = pci_create_newid_file(drv);
  • int driver_register(struct device_driver * drv)
    • drivers/base/driver.c
    • return bus_add_driver(drv);
  • int bus_add_driver(struct device_driver * drv)
    • drivers/base/bus.c
        printk(KERN_ERR "bus: '%s': add driver %s\n", bus->name, drv->name);
  • driver_attach(drv);
  • void driver_attach(struct device_driver * drv)
    • drivers/base/dd.c
    • bus_for_each_dev(drv->bus, NULL, drv, __driver_attach);
  • int bus_for_each_dev
    • drivers/base/bus.c
    • __driver_attach
  • static int __driver_attach(struct device * dev, void * data)
    • drivers/base/dd.c
    • driver_probe_device(drv, dev);
  • int driver_probe_device(struct device_driver * drv, struct device * dev)
    • drivers/base/dd.c
    • ret = drv->probe(dev); piix_init_one
  • static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
    • drivers/ata/ata_piix.c
    • ata_piix 0000:00:1f.2: version 2.11
    • piix_init_sata_map(pdev, port_info, piix_map_db_tableent->driver_data);
      • ata_piix 0000:00:1f.2: MAP P0 P2 P1 P3
    • return ata_pci_init_one(pdev, ppi);
  • int ata_pci_init_one(struct pci_dev *pdev, const struct ata_port_info * const * ppi)
    • drivers/ata/libata-sff.c
    • rc = ata_host_register(host, pi->sht);
      • ata1: SATA max UDMA/133 cmd 0x0001fe00 ctl 0x0001fe12 bmdma 0x0001fea0 irq 66
      • ata2: SATA max UDMA/133 cmd 0x0001fe20 ctl 0x0001fe32 bmdma 0x0001fea8 irq 66
  • int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
    • drivers/ata/libata-core.c
    • rc = ata_bus_probe(ap);
      • goto ata_bus_probe :)
    • ata_scsi_scan_host(ap);
  • void ata_scsi_scan_host(struct ata_port *ap)
    • drivers/ata/libata-scsi.c
    • sdev = __scsi_add_device(ap->scsi_host, 0, i, 0, NULL);
  • struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, uint id, uint lun, void *hostdata)
    • drivers/scsi/scsi_scan.c
    • scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata);
  • static int scsi_probe_and_add_lun(struct scsi_target *starget, uint lun, int *bflagsp, struct scsi_device **sdevp, int rescan, void *hostdata)
    • drivers/scsi/scsi_scan.c
    • scsi_probe_lun(sdev, result, result_len, &bflags)
  • static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, int result_len, int *bflags)
    • drivers/scsi/scsi_scan.c
    • scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, inq_result, try_inquiry_len, &sshdr, HZ / 2 + HZ * scsi_inq_timeout, 3);
  • int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout, int retries)
    • drivers/scsi/scsi_lib.c
    • result = scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, timeout, retries, 0);
  • int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, int timeout, int retries, int flags)
    • drivers/scsi/scsi_lib.c
    • blk_execute_rq(req->q, NULL, req, 1);
  • int blk_execute_rq(request_queue_t *q, struct gendisk *bd_disk, struct request *rq, int at_head)
    • block/ll_rw_blk.c
    • blk_execute_rq_nowait(q, bd_disk, rq, at_head, blk_end_sync_rq);
  • void blk_execute_rq_nowait(request_queue_t *q, struct gendisk *bd_disk, struct request *rq, int at_head, rq_end_io_fn *done)
    • block/ll_rw_blk.c
    • __generic_unplug_device(q);
  • void __generic_unplug_device(request_queue_t *q)
    • block/ll_rw_blk.c
    • q->request_fn(q);
  • static int piix_init_one
    • ata_piix 0000:00:1f.2: version 2.11
    • piix_init_sata_map
      • ata_piix 0000:00:1f.2: MAP P0 P2 P1 P3
    • ata_pci_init_one(pdev, ppi);
  • int ata_pci_init_one
    • rc = ata_host_register(host, pi->sht);
      • int ata_bus_probe(struct ata_port *ap)
        • int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
          • return ata_do_set_mode(ap, r_failed_dev);
  •   [<c02d27e8>] scsi_request_fn+0x74/0x28e
      [<c020fd2e>] __generic_unplug_device+0x1d/0x20
      [<c0211bb4>] blk_execute_rq_nowait+0x50/0x5c
      [<c0211c26>] blk_execute_rq+0x66/0x83
      [<c0211c43>] ? blk_end_sync_rq+0x0/0x29
      [<c01151fd>] ? hide_addr+0x32/0x72
      [<c0115275>] ? kmemcheck_hide+0x38/0x67
      [<c0431650>] ? do_debug+0x3d/0x105
      [<c04312cf>] ? debug_stack_correct+0x27/0x2c
      [<c02d1e51>] scsi_execute+0xc0/0xed
      [<c02d1ece>] scsi_execute_req+0x50/0x9d
      [<c02d33dd>] scsi_probe_and_add_lun+0x1a3/0x7d1
      [<c0431650>] ? do_debug+0x3d/0x105
      [<c0270024>] ? hwrng_register+0xc3/0x147
      [<c02d465a>] __scsi_add_device+0x8a/0xb7
      [<c031e52d>] ata_scsi_scan_host+0x9d/0x2c3
      [<c031b577>] ata_host_register+0x21b/0x239
      [<c03201b2>] ata_pci_activate_sff_host+0x17c/0x1a6
      [<c031c764>] ? ata_interrupt+0x0/0x214
      [<c032061c>] ata_pci_init_one+0x9b/0xef
      [<c032e3d7>] amd_init_one+0x171/0x179
      [<c0226e82>] pci_device_probe+0x39/0x63
      [<c027d966>] driver_probe_device+0xb8/0x14d
      [<c027dafe>] __driver_attach+0x59/0x88
      [<c027ce3b>] bus_for_each_dev+0x41/0x64
      [<c027d7f3>] driver_attach+0x17/0x19
      [<c027daa5>] ? __driver_attach+0x0/0x88
      [<c027d5db>] bus_add_driver+0xa8/0x1ed
      [<c027dcbb>] driver_register+0x55/0xc4
      [<c0227036>] __pci_register_driver+0x2e/0x5c
     

ata_bus_probe

  • int ata_bus_probe(struct ata_port *ap)
    • drivers/ata/libata-core.c
    • rc = ata_dev_configure(dev);
      • ata1.00: ATA-7: WDC WD800JD-75MSA1, 10.01E01, max UDMA/133
      • ata1.00: 156250000 sectors, multi 8: LBA48 NCQ (depth 0/32)
      • goto ata_dev_configure :)
    • rc = ata_set_mode(ap, &dev);
    • if (rc)
      • goto fail;
    • fail: case -EIO:
      • sata_down_spd_limit(ap);
      • ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
        • ata1.00: limiting speed to UDMA/133:PIO3
    • if (!triesdev->devno)
      • ata_dev_disable(dev);
    • goto retry;
  • int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
    • drivers/ata/libata-core.c
    • return ata_do_set_mode(ap, r_failed_dev);
  • int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
    • drivers/ata/libata-core.c
    • rc = ata_dev_set_mode(dev);
      • ata1.00: configured for UDMA/133
  • static int ata_dev_set_mode(struct ata_device *dev)
    • drivers/ata/libata-core.c
    • err_mask = ata_dev_set_xfermode(dev);
    • if (err_mask)
      • ata_dev_printk(dev, KERN_ERR, "failed to set xfermode " "(err_mask=0x%x)\n", err_mask);
      • return -EIO;
  • static unsigned int ata_dev_set_xfermode(struct ata_device *dev)
    • drivers/ata/libata-core.c
    • err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
    • return err_mask;
  • unsigned ata_exec_internal(struct ata_device *dev, struct ata_taskfile *tf, const u8 *cdb, int dma_dir, void *buf, unsigned int buflen)
    • drivers/ata/libata-core.c
    • return ata_exec_internal_sg(dev, tf, cdb, dma_dir, psg, n_elem);
  • unsigned ata_exec_internal_sg(struct ata_device *dev, struct ata_taskfile *tf, const u8 *cdb, int dma_dir, struct scatterlist *sg, unsigned int n_elem)
    • drivers/ata/libata-core.c
    • ata_qc_issue(qc);
    • rc = wait_for_completion_timeout(&wait, ata_probe_timeout);
    • ata_dev_printk(dev, KERN_WARNING, "qc timeout (cmd 0x%x)\n", command);

ata_dev_configure

  • int ata_dev_configure(struct ata_device *dev)
    • drivers/ata/libata-core.c
    • dev->n_sectors = ata_hpa_resize(dev);
    • ata_dev_printk(dev, KERN_INFO, "%s: %s, %s, max %s\n", revbuf, modelbuf, fwrevbuf, ata_mode_string(xfer_mask));
    • ata_dev_printk(dev, KERN_INFO, "%Lu sectors, multi %u: %s %s\n", (unsigned long long)dev->n_sectors, dev->multi_count, lba_desc, ncq_desc);
    • ata_dev_printk(dev, KERN_INFO, "applying bridge limits\n");
  • static u64 ata_hpa_resize(struct ata_device *dev)
    • drivers/ata/libata-core.c
    • u64 sectors = dev->n_sectors;
    • hpa_sectors = ata_read_native_max_address_ext(dev);
    • or hpa_sectors = ata_read_native_max_address(dev);
    • if (hpa_sectors < sectors)
      • ata_dev_printk(dev, KERN_WARNING, "%s 1: hpa sectors (%lld) " "is smaller than sectors (%lld)\n", FUNCTION, (long long)hpa_sectors, (long long)sectors);
    • return sectors;

error

  • int ata_dev_configure(struct ata_device *dev)
    • ata1.01: ATA-6: WDC WD800JD-75MSA1, 10.01E01, max UDMA/133
    • ata1.01: 156250000 sectors, multi 8: LBA48 NCQ (depth 0/32)
    • ata1.01: applying bridge limits
  • static int ata_eh_recover
    • ata1: failed to recover some devices, retrying in 5 secs
  • int ata_dev_read_id
    • ata1.00: failed to IDENTIFY
  • int ata_dev_revalidate
    • ata1.00: revalidation failed
  • void ata_dev_disable(struct ata_device *dev)
    • ata1.00: disabled

solution

  • include/linux/ata.h
    • ATA_MAX_DEVICES = 1, /* per bus/port */
    • 2 를 1 로 수정
  • Makefile
    • EXTRAVERSION = -prep
    • EXTRAVERSION = -port1

dmesg0

Driver 'sd' needs updating - please use bus_type methods
Driver 'sr' needs updating - please use bus_type methods
ata_piix 0000:00:1f.1: version 2.12
ata_piix 0000:00:1f.1: PCI INT A -> GSI 16 (level, low) -> IRQ 16
ata_piix 0000:00:1f.1: setting latency timer to 64
scsi0 : ata_piix
scsi1 : ata_piix
ata1: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0xffa0 irq 14
ata2: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0xffa8 irq 15
ata1.00: ATAPI: HL-DT-ST DVDRAM GSA-4160B, A306, max UDMA/66
ata1.00: limited to UDMA/33 due to 40-wire cable
ata1.00: configured for UDMA/33
ata2: port disabled. ignoring.
scsi 0:0:0:0: CD-ROM            HL-DT-ST DVDRAM GSA-4160B A306 PQ: 0 ANSI: 5
sr0: scsi3-mmc drive: 40x/40x writer dvd-ram cd/rw xa/form2 cdda tray
Uniform CD-ROM driver Revision: 3.20
sr 0:0:0:0: Attached scsi CD-ROM sr0
sr 0:0:0:0: Attached scsi generic sg0 type 5

http://marc.info/?l=linux-scsi&m=121000463825804&w=2
Driver 'sd' needs updating - please use bus_type methods
Driver 'sr' needs updating - please use bus_type methods
* init_sd, init_sr: drivers/scsi/sd.c, sr.c
  • err = scsi_register_driver(&sd_template.gendrv);
    • int driver_register(struct device_driver *drv): drivers/vase/driver.c
                printk(KERN_WARNING "Driver '%s' needs updating - please use "
                        "bus_type methods\n", drv->name);

ata_piix 0000:00:1f.1: version 2.12
ata_piix 0000:00:1f.1: PCI INT A -> GSI 16 (level, low) -> IRQ 16
ata_piix 0000:00:1f.1: setting latency timer to 64

* static int __devinit piix_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                dev_printk(KERN_DEBUG, &pdev->dev,
                           "version " DRV_VERSION "\n");

dmesg1


ata_piix 0000:00:1f.2: PCI INT C -> GSI 20 (level, low) -> IRQ 20
ata_piix 0000:00:1f.2: MAP [ P0 P2 P1 P3 ]
ata_piix 0000:00:1f.2: setting latency timer to 64
scsi2 : ata_piix
scsi3 : ata_piix
ata3: SATA max UDMA/133 cmd 0xfe00 ctl 0xfe10 bmdma 0xfea0 irq 20
ata4: SATA max UDMA/133 cmd 0xfe20 ctl 0xfe30 bmdma 0xfea8 irq 20

* piix_init_one: ata_piix.c
  • c = pcim_enable_device(pdev);
  • hpriv->map = piix_init_sata_map(pdev, port_info,
  • rc = ata_pci_sff_prepare_host(pdev, ppi, &host);
  • pci_set_master(pdev);
  • return ata_pci_sff_activate_host(host, ata_sff_interrupt, &piix_sht);

ata_piix 0000:00:1f.1: PCI INT A -> GSI 16 (level, low) -> IRQ 16
* rc = pcim_enable_device(pdev); drivers/pci/pci.c
  • rc = pci_enable_device(pdev);
    • __pci_enable_device_flags(dev, IORESOURCE_MEM | IORESOURCE_IO);
      • do_pci_enable_device(dev, bars);
        • do_pci_enable_device(struct pci_dev *dev, int bars)

* pcibios_enable_device(struct pci_dev *dev, int mask): arch/x86/pci/common.c
return pcibios_enable_irq(dev);
* pci_acpi_init(void): arch/x86/pci/acpi.c
pcibios_enable_irq = acpi_pci_irq_enable;
  • acpi_pci_irq_enable(struct pci_dev *dev): drivers/acpi/pci_irq.c
        dev_info(&dev->dev, "PCI INT %c%s -> GSI %u (%s, %s) -> IRQ %d\n",
                 'A' + pin, link_desc, irq,
                 (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
                 (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);

ata_piix 0000:00:1f.2: MAP [ P0 P2 P1 P3 ]
* piix_init_sata_map
dev_printk(KERN_INFO, &pdev->dev, "MAP [");
...
                default:
                        printk(" P%d", map[i]);
                        if (i & 1)
                                pinfo[i / 2].flags |= ATA_FLAG_SLAVE_POSS;
                        break;

ata_piix 0000:00:1f.1: setting latency timer to 64
* pci_set_master(struct pci_dev *dev) pci/pci.c
  • void pcibios_set_master(struct pci_dev *dev): arch/x86/pci/i386.c
        dev_printk(KERN_DEBUG, &dev->dev, "setting latency timer to %d\n", lat);

scsi2 : ata_piix
scsi3 : ata_piix
* ata_pci_sff_activate_host: libata-sff.c
  • ata_host_register: libata-core.c
    • ata_scsi_add_hosts: libata-scsi.c
      • rc = scsi_add_host(ap->scsi_host, ap->host->dev); scsi/hosts.c
        printk(KERN_INFO "scsi%d : %s\n", shost->host_no,
                        sht->info ? sht->info(shost) : sht->name);

ata3: SATA max UDMA/133 cmd 0xfe00 ctl 0xfe10 bmdma 0xfea0 irq 20
ata4: SATA max UDMA/133 cmd 0xfe20 ctl 0xfe30 bmdma 0xfea8 irq 20
* ata_piix.c 의 piix_init_one 함수는 ata_pci_sff_prepare_host(pdev, ppi, &host); 를 call 한다.
  • ata_pci_sff_prepare_host 함수는 ata_pci_sff_init_host 함수를 call 하고, ata_pci_sff_init_host 함수는 ata_port_desc 를 call 하여 cmd, ctl 에 해당하는 부분을 문자열 sp 에 저장한다.
  • ata_pci_sff_prepare_host 함수는 ata_pci_bmdma_init(host) 함수를 call 하고, ata_pci_bmdma_init 함수는 ata_port_desc 함수를 call 하여 bmdma 에 해당하는 부분을 문자열 sp 에 저장한다.

* int ata_pci_sff_prepare_host: libata-sff.c
  • int ata_pci_sff_init_host(struct ata_host *host)
                ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx",
                        (unsigned long long)pci_resource_start(pdev, base),
                        (unsigned long long)pci_resource_start(pdev, base + 1));
  • int ata_pci_bmdma_init(struct ata_host *host)
                ata_port_desc(ap, "bmdma 0x%llx",
                        (unsigned long long)pci_resource_start(pdev, 4) + 8 * i);
* ata_piix.c 의 piix_init_one 함수는 ata_pci_sff_activate_host(host, ata_sff_interrupt, &piix_sht); 함수를 call 한다.
  • ata_pci_sff_activate_host 함수는 ata_port_desc 함수를 사용하여 irq 에 해당하는 부분을 host->ports0 문자열에 보관한다.
  • ata_pci_sff_activate_host 함수는 ata_host_register(host, sht); 함수를 call 하고, ata_host_register(host, sht); 함수는 ata_port_printk 를 call 하여 위의 문자열을 출력한다.
* int ata_pci_sff_activate_host
                ata_port_desc(host->ports[0], "irq %d", pdev->irq);
  • rc = ata_host_register(host, sht); libata-core.c
                        ata_port_printk(ap, KERN_INFO,
                                        "%cATA max %s %s\n",
                                        (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P',
                                        ata_mode_string(xfer_mask),
                                        ap->link.eh_info.desc);
* libata.h
extern void ata_port_desc(struct ata_port *ap, const char *fmt, ...)
        __attribute__ ((format (printf, 2, 3)));

#define ata_port_printk(ap, lv, fmt, args...) \
        printk("%sata%u: "fmt, lv, (ap)->print_id , ##args)

dmesg2

ata3.00: ATA-6: ST3160023AS, 8.12, max UDMA/133
ata3.00: 312500000 sectors, multi 8: LBA48 NCQ (depth 0/32)
ata3.00: configured for UDMA/133
scsi 2:0:0:0: Direct-Access     ATA      ST3160023AS      8.12 PQ: 0 ANSI: 5
sd 2:0:0:0: [sda] 312500000 512-byte hardware sectors (160000 MB)
sd 2:0:0:0: [sda] Write Protect is off
sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sd 2:0:0:0: [sda] 312500000 512-byte hardware sectors (160000 MB)
sd 2:0:0:0: [sda] Write Protect is off
sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 sda: sda1 sda2 sda3 < sda5 sda6 sda7 sda8 sda9 sda10 > sda4
sd 2:0:0:0: [sda] Attached SCSI disk
sd 2:0:0:0: Attached scsi generic sg1 type 0

* piix_init_one: ata_piix.c
  • ata_pci_sff_activate_host: libata-sff.c
    • ata_host_register: libata-core.c
      • int ata_bus_probe(struct ata_port *ap): libata-core.c
        • rc = ata_dev_configure(dev);
                        /* print device info to dmesg */
                        if (ata_msg_drv(ap) && print_info) {
                                ata_dev_printk(dev, KERN_INFO,
                                        "%s: %s, %s, max %s\n",
                                        revbuf, modelbuf, fwrevbuf,
                                        ata_mode_string(xfer_mask));
                                ata_dev_printk(dev, KERN_INFO,
                                        "%Lu sectors, multi %u: %s %s\n",
                                        (unsigned long long)dev->n_sectors,
                                        dev->multi_count, lba_desc, ncq_desc);
  • rc = ata_set_mode(&ap->link, &dev); : libata_eh.c
    • rc = ata_do_set_mode(link, r_failed_dev); : libata-core.c
      • rc = ata_dev_set_mode(dev);
        ata_dev_printk(dev, KERN_INFO, "configured for %s%s\n",
                       ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)),
                       dev_err_whine);

ata_bus_probe

* libata-core.c

* ata_link_for_each_dev
include/linux/libata.h
#define ata_link_for_each_dev(dev, link) \
        for ((dev) = (link)->device; \
             (dev) < (link)->device + ata_link_max_devices(link) || ((dev) = NULL); \
             (dev)++)

#define ata_link_for_each_dev_reverse(dev, link) \
        for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \
             (dev) >= (link)->device || ((dev) = NULL); (dev)--)

sd 관련

* sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer): scsi/sd.c
  • sd_print_result(sdkp, the_result);
static void sd_print_result(struct scsi_disk *sdkp, int result)
{
        sd_printk(KERN_INFO, sdkp, "");
        scsi_show_result(result);
}
* scsi/constants.c
#define NUM_SUGGEST_STRS ARRAY_SIZE(driversuggest_table)

void scsi_show_result(int result)
{
        int hb = host_byte(result);
        int db = (driver_byte(result) & DRIVER_MASK);
        int su = ((driver_byte(result) & SUGGEST_MASK) >> 4);

        printk("Result: hostbyte=%s driverbyte=%s,%s\n",
               (hb < NUM_HOSTBYTE_STRS ? hostbyte_table[hb]     : "invalid"),
               (db < NUM_DRIVERBYTE_STRS ? driverbyte_table[db] : "invalid"),
               (su < NUM_SUGGEST_STRS ? driversuggest_table[su] : "invalid"));
}

#else

void scsi_show_result(int result)
{
        printk("Result: hostbyte=0x%02x driverbyte=0x%02x\n",
               host_byte(result), driver_byte(result));
}

#endif

* sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer): scsi/sd.c
  • sd_print_sense_hdr
    • scsi_show_sense_hdr(struct scsi_sense_hdr *sshdr): scsi/constants.c
      • sense_txt = scsi_sense_key_string(sshdr->sense_key);
        • printk("Sense Key : %s ", sense_txt);
* scsi/constants.c
/* Get sense key string or NULL if not available */
const char *
scsi_sense_key_string(unsigned char key) {
#ifdef CONFIG_SCSI_CONSTANTS
        if (key <= 0xE)
                return snstext[key];
#endif
        return NULL;
}

/* description of the sense key values */
static const char * const snstext[] = {
        "No Sense",         /* 0: There is no sense information */
        "Recovered Error",  /* 1: The last command completed successfully
                                  but used error correction */
        "Not Ready",        /* 2: The addressed target is not ready */
        "Medium Error",     /* 3: Data error detected on the medium */
        "Hardware Error",   /* 4: Controller or device failure */
        "Illegal Request",  /* 5: Error in request */
        "Unit Attention",   /* 6: Removable medium was changed, or
                                  the target has been reset, or ... */
        "Data Protect",     /* 7: Access to the data is blocked */
        "Blank Check",      /* 8: Reached unexpected written or unwritten
                                  region of the medium */
        "Vendor Specific(9)",
        "Copy Aborted",     /* A: COPY or COMPARE was aborted */
        "Aborted Command",  /* B: The target aborted the command */
        "Equal",            /* C: A SEARCH DATA command found data equal */
        "Volume Overflow",  /* D: Medium full with still data to be written */
        "Miscompare",       /* E: Source data and data on the medium
                                  do not agree */
};

qc timeout

  • ata_exec_internal_sg
    • wait_for_completion_timeout 에 오류발생시
    • qc timeout
  • static u64 ata_hpa_resize(struct ata_device *dev)
    • hpa_sectors = ata_read_native_max_address(dev); 의 결과와 dev->n_sectors; 가 다르면
    • ata1.01: ata_hpa_resize 1: hpa sectors (0) is smaller than sectors (78242976)
  • ata_read_native_max_address_ext
  • ata_read_native_max_address
    • ata_exec_internal
      • ata_exec_internal_sg
  • int ata_dev_configure(struct ata_device *dev)
    • ata_hpa_resize(dev);
  • int ata_bus_probe(struct ata_port *ap)
  • int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags)
    • ata_dev_configure(dev);
  • static int ata_dev_set_mode(struct ata_device *dev)
    • int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags)
  • int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
    • int ata_bus_probe(struct ata_port *ap)

  • int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
    • rc = ata_dev_set_mode(dev);
      • err_mask = ata_dev_set_xfermode(dev);
      • rc = ata_dev_revalidate(dev, 0);
  • int ata_host_activate
    • int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
      • int ata_bus_probe(struct ata_port *ap)
        • int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
          • return ata_do_set_mode(ap, r_failed_dev);

ata3

bus_for_each_dev
bus: 'pci': driver_probe_device: matched device 0000:00:1f.2 with driver ata_piix
ata_piix 0000:00:1f.2: PCI INT C -> GSI 20 (level, low) -> IRQ 20
ata_piix 0000:00:1f.2: MAP [ P0 P2 P1 P3 ]
ata_host_alloc: ENTER
ata_port_alloc: ENTER
ata_port_alloc: ENTER
piix_init_pcs: updating PCS from 0x55 to 0x5f
ata_piix 0000:00:1f.2: setting latency timer to 64
__ata_port_freeze: ata4294967295 port frozen
__ata_port_freeze: ata4294967295 port frozen
scsi2 : ata_piix
scsi3 : ata_piix
ata3: SATA max UDMA/133 cmd 0xfe00 ctl 0xfe10 bmdma 0xfea0 irq 20
ata4: SATA max UDMA/133 cmd 0xfe20 ctl 0xfe30 bmdma 0xfea8 irq 20
ata_host_register: probe begin
ata_port_schedule_eh: port EH scheduled
ata3: ata_port_flush_task: EXIT
__ata_port_freeze: ata3 port frozen
ata_sff_softreset: ENTER
ata_sff_softreset: about to softreset, devmask=1
ata_bus_softreset: ata3: bus reset via SRST
ata_dev_classify: found ATA device by sig
ata_sff_softreset: EXIT, classes[0]=1 [1]=1
ata_eh_thaw_port: ata3 port thawed
ata_std_postreset: ENTER
ata_std_postreset: EXIT
ata3.00: ata_dev_read_id: ENTER
ata_pio_sector: data read
ata3: ata_port_flush_task: EXIT
ata3: ata_port_flush_task: EXIT
ata3.00: ATA-6: ST3160023AS, 8.12, max UDMA/133
ata3.00: 312500000 sectors, multi 8: LBA48 NCQ (depth 0/32)
ata_dev_set_xfermode: set features - xfer mode
ata3: ata_port_flush_task: EXIT
ata_dev_set_xfermode: EXIT, err_mask=0
ata3.00: ata_dev_read_id: ENTER
ata_pio_sector: data read
ata3: ata_port_flush_task: EXIT
ata3: ata_port_flush_task: EXIT
ata_dev_set_mode: xfer_shift=12, xfer_mode=0x46
ata3.00: configured for UDMA/133
ata_eh_recover: EXIT, rc=0
ata_scsi_error: EXIT
ata_port_schedule_eh: port EH scheduled
ata4: ata_port_flush_task: EXIT
__ata_port_freeze: ata4 port frozen
ata_sff_softreset: ENTER
ata_sff_softreset: about to softreset, devmask=0
ata_bus_softreset: ata4: bus reset via SRST
ata_sff_softreset: EXIT, classes[0]=9 [1]=1
ata_eh_thaw_port: ata4 port thawed
ata_std_postreset: ENTER
ata_std_postreset: EXIT
ata_eh_recover: EXIT, rc=0
ata_scsi_error: EXIT
ata_host_register: host probe begin
scsi 2:0:0:0: Direct-Access     ATA      ST3160023AS      8.12 PQ: 0 ANSI: 5
bus: 'scsi': driver_probe_device: matched device 2:0:0:0 with driver sd
sd 2:0:0:0: [sda] 312500000 512-byte hardware sectors (160000 MB)
sd 2:0:0:0: [sda] Write Protect is off
sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sd 2:0:0:0: [sda] 312500000 512-byte hardware sectors (160000 MB)
sd 2:0:0:0: [sda] Write Protect is off
sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 sda: sda1 sda2 sda3 < sda5 sda6 sda7 sda8 sda9 > sda4
sd 2:0:0:0: [sda] Attached SCSI disk
sd 2:0:0:0: Attached scsi generic sg1 type 0

ata_host_register

ata_host_register: probe begin
.....
ata_host_register: host probe begin
* * int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) : libata-core.c
  • DPRINTK("probe begin\n");
  • DPRINTK("host probe begin\n");
ata_host_register: host probe begin
scsi 2:0:0:0: Direct-Access     ATA      ST3160023AS      8.12 PQ: 0 ANSI: 5
* int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) : libata-core.c
  • DPRINTK("host probe begin\n");
  • ata_scsi_scan_host(ap, 1);
  • void ata_scsi_scan_host(struct ata_port *ap, int sync): libata-scsi.c
    • sdev = __scsi_add_device(ap->scsi_host, channel, id, 0, NULL); scsi/scsi_scan.c
      • scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata);
        • res = scsi_add_lun(sdev, result, &bflags, shost->async_scan);
* static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, int *bflags, int async)
        sdev_printk(KERN_NOTICE, sdev, "%s %.8s %.16s %.4s PQ: %d "
                        "ANSI: %d%s\n", scsi_device_type(sdev->type),
                        sdev->vendor, sdev->model, sdev->rev,
                        sdev->inq_periph_qual, inq_result[2] & 0x07,
                        (inq_result[3] & 0x0f) == 1 ? " CCS" : "");

kernel init

  • static int __init init(void * unused)
    • init/main.c
    • do_basic_setup();
      • driver_init();
      • do_initcalls();
  • void __init driver_init(void)
    • drivers/base/init.c
    • devices_init();
  • int __init devices_init(void)
    • drivers/base/core.c
    • subsystem_register(&devices_subsys);
  • int subsystem_register(struct subsystem * s)
    • lib/kobject.c
    • subsystem_init(s);
      • init_rwsem(&s->rwsem);
      • kset_init(&s->kset);
  • static void __init do_initcalls(void)
    • drivers/base/init.c

fedora core 9

  • include/linux/ata.h
     < 	ATA_MAX_DEVICES		= 1,	/* per bus/port */
     ---
     > 	ATA_MAX_DEVICES		= 2,	/* per bus/port */
     
int ata_bus_probe(struct ata_port *ap)
        unsigned int classes[ATA_MAX_DEVICES];
        int tries[ATA_MAX_DEVICES];

void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp)
        for (i = 0; i < ATA_MAX_DEVICES; i++) {
                ata_dev_init(dev);
  • include/linux/libata.h
     < 	ATA_FLAG_SLAVE_POSS	= 0, /* host supports slave dev */
     ---
     > 	ATA_FLAG_SLAVE_POSS	= (1 << 0), /* host supports slave dev */
     

fedora core 10

*무선랜 연결이 자동으로 됨

* grub 이 변한 것 같음.

* sata 2 를 disconnect 하고 install rescue 사용하여 grub 재설치

hangup

  • disconnect supervision
  • Under asterisk, remote disconnect supersion is known as Kewlstart
  • loopstart does not include hang-up notification unless specially done through forward-disconnect
  • groundstart does include hangup notification as do the E&M based protocol
  • E&M also provides answer supervision, which neither Groundstart nor Loopstart do
  • 극성반전신호, 극성반전펄스신호
    • busydetect=no
    • hanguponpolarityswitch=yes
  • Voicemail, Musiconhold, Meetme
    • not notice hangup
  • FXO analog ports don't detect busy signals
  • zapata.conf
    • busydetect=yes
    • callprogress=yes
  • zaptel.conf
    • signalling=fxs_ks
    • fxsks=n
  • voicemenu timeout
  • CPC (Calling party control)
    • Disconnect Clear Time
    • disconnect time
    • 90ms-130ms, 800ms
    • 500ms
  • fxo_mode
    • ohs: on-hook-speed
    • ohs2: misc DAA parameter
    • rz: ringer impedance
    • rt: ringer threshold
    • ilim: current limitation
    • dcv: voltage adjustment
    • mini: minimum operational current
    • acim: ac impedance
    • ring_osc
    • ring_x
  • http://www.sandman.com/cpcbull.html

zaptel

  • zaptel.c
    • zt_init
      • Zapata Telephony Interface Registered on major %d\n
      • Zaptel Version: %s Echo Canceller: %s\n
      • zt_conv_init();
      • tone_zone_init();
      • fasthdlc_precalc();
      • rotate_sums();
      • rwlock_init(&chan_lock);
      • watchdog_init();
  • wctcm.c
    • wctdm_hardware_init
      • Freshmaker version: %02x\n
      • Freshmaker passed register test\n
      • Module %d: Installed -- AUTO FXO (%s mode)\n
    • wctdm_init_one
      • Found a Wildcard TDM: %s (%d modules)\n
  • zaptel.c
    • zt_register_tone_zone
      • Registered tone zone %d (%s)\n
    • __zt_process_getaudio_chunk
      • zaptel Disabled echo canceller because of tone (tx) on channel %d\n

x100p

 [root@localhost ~]# ztcfg
 Notice: Configuration file is /etc/zaptel.conf
 line 0: Unable to open master device '/dev/zap/ctl'
 
 1 error(s) detected
 
 [root@localhost ~]# modprobe wcfxs
 Notice: Configuration file is /etc/zaptel.conf
 line 0: Unable to open master device '/dev/zap/ctl'
 
 1 error(s) detected
 
 FATAL: Error running install command for wctdm
 [root@localhost ~]#
 
  • dmesg
     Zapata Telephony Interface Registered on major 196
     Zaptel Version:  Echo Canceller: KB1
     
  • modprobe wcfxo
  • dmesg
     ACPI: PCI interrupt 0000:05:02.0[A] -> GSI 18 (level, low) -> IRQ 201
     wcfxo: DAA mode is 'FCC'
     Found a Wildcard FXO: Generic Clone
     Registered tone zone 0 (United States / North America)
     

  • Intel Ambient MD3200
    • Intel MD3200 56K V.92 PCI Data/Fax Modem 은 아님.
    • OEM 56K V.92 PCI Fax Modem 도 아님.
    • Intel 56K V.92 PCI Modem 도 아님.
    • INTEL Ambient MD3200 FXO para asterisk funcionando
  • dmesg
     Zapata Telephony Interface Registered on major 196
     Zaptel Version: 1.2.26
     Zaptel Echo Canceller: KB1
     ACPI: PCI Interrupt 0000:03:00.0[A] -> GSI 16 (level, low) -> IRQ 16
     wcfxo: DAA mode is 'FCC'
     Found a Wildcard FXO: Generic Clone
     
  • lspci
     03:00.0 Communication controller: Tiger Jet Network Inc. Tiger3XX Modem/ISDN interface
     
  • zaptel.conf
     fxoks=1
     loadzone=us
     defaultzone=us
     
  • zapata.conf
     [channels]
     context=test
     usecallerid=no
     hidecallerid=no
     immediate=no
     
     signalling=fxs_ks
     echocancel=yes
     group=1
     channel=1
     
  • extensions.conf
     [others]
     
     [my-phones]
     exten => 2000,1,Dial(SIP/2000,20)
     exten => 2000,2,VoiceMail(2000,u)
     
     exten => 2001,1,Dial(SIP/2001,20)
     exten => 2001,2,VoiceMail(2001,u)
     
     exten => 2999,1,VoiceMailMain(${CALLERID(num)},s)
     
     exten => _XXXXXXXXXX,1,Dial(Zap/g1/${EXTEN})
     exten => _XXXXXXXXXX,2,Congestion
     
     [incoming]
     exten => 1001,1,Dial(SIP/2001,10)
     exten => 1001,2,Playback(unavailable)
     exten => 1001,3,Hangup
     
     [test]
     exten => s,1,Dial(SIP/2000,20)
     exten => s,2,VoiceMail(2000,u)
     
  • sip.conf
     [general]
     port = 5060
     bindaddr = 0.0.0.0
     context = others
     
     [2000]
     type=friend
     context=my-phones
     secret=1234
     host=dynamic
     
     [2001]
     type=friend
     context=my-phones
     secret=1234
     host=dynamic
     

xinerama

  • xrandr 을 수행 후 login

To do

  • zaptel
    • zonedata.c

짜증

* piix_init+0x0/0x4e()
  • piix_init: pci_register_driver
  • rc = pci_register_driver(&piix_pci_driver);
# static inline int pci_register_driver(struct pci_driver *driver)
    * include/linux/pci.h
    * return __pci_register_driver(driver, THIS_MODULE);

# int __pci_register_driver(struct pci_driver *drv, struct module *owner)
    * drivers/pci/pci-driver.c
    * error = driver_register(&drv->driver); 
# int driver_register(struct device_driver * drv)
    * drivers/base/driver.c
    * return bus_add_driver(drv);
# int bus_add_driver(struct device_driver * drv)
    * drivers/base/bus.c
    • bus: 'pci': add driver ata_piix
    • error = driver_attach(drv);
int driver_attach(struct device_driver *drv)
{       
        return bus_for_each_dev(drv->bus, NULL, drv, __driver_attach);
}   
    * drivers/base/dd.c
int bus_for_each_dev(struct bus_type *bus, struct device *start,
                     void *data, int (*fn)(struct device *, void *))
        while ((dev = next_device(&i)) && !error)
                error = fn(dev, data);
    * drivers/base/bus.c
    * fn(dev, data)= __driver_attach
    • bus_for_each_dev
# static int __driver_attach(struct device * dev, void * data)
    * drivers/base/dd.c
    * driver_probe_device(drv, dev);
        printk(KERN_ERR "bus: '%s': %s: matched device %s with driver %s\n", drv->bus->name, __func__, dev->bus_id, drv->name);
    • bus: 'pci': driver_probe_device: matched device 0000:00:1f.1 with driver ata_piix
# int driver_probe_device(struct device_driver * drv, struct device * dev)
    * drivers/base/dd.c
    * ret = drv->probe(dev); piix_init_one
      • piix_init_one
      • ata_piix 0000:00:1f.1: version 2.12
      • ata_piix 0000:00:1f.1: PCI INT A -> GSI 16 (level, low) -> IRQ 16
      • ata_piix 0000:00:1f.1: setting latency timer to 64
        • bus: 'scsi': driver_probe_device: matched device 0:0:0:0 with driver sd
        • bus: 'scsi': driver_probe_device: matched device 0:0:0:0 with driver sr
        • ata1: ata_port_flush_task: EXIT
      • bus_for_each_dev
      • bus: 'pci': driver_probe_device: matched device 0000:00:1f.2 with driver ata_piix
        • piix_init_one
        • ata_piix 0000:00:1f.2: PCI INT C -> GSI 20 (level, low) -> IRQ 20

piix_init_one

ata_piix 0000:00:1f.1: version 2.12
  • c = pcim_enable_device(pdev);
ata_piix 0000:00:1f.1: PCI INT A -> GSI 16 (level, low) -> IRQ 16
  • rc = ata_pci_sff_prepare_host(pdev, ppi, &host);
  • pci_set_master(pdev);
ata_piix 0000:00:1f.1: setting latency timer to 64
  • return ata_pci_sff_activate_host(host, ata_sff_interrupt, &piix_sht);
    • rc = ata_host_register(host, sht);

ata_host_register

  • rc = ata_scsi_add_hosts(host, sht);
scsi0 : ata_piix
scsi1 : ata_piix

ata1: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0xffa0 irq 14
ata2: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0xffa8 irq 15
  • DPRINTK("probe begin\n");
  • DPRINTK("host probe begin\n");
  • ata_scsi_scan_host(ap, 1);
        for (i = 0; i < host->n_ports; i++) {
                struct ata_port *ap = host->ports[i];

                ata_scsi_scan_host(ap, 1);
        }
scsi 0:0:0:0: CD-ROM            HL-DT-ST DVDRAM GSA-4160B A306 PQ: 0 ANSI: 5
...
...
scsi 0:0:1:0: Direct-Access     ATA      SAMSUNG SP0802N  UR10 PQ: 0 ANSI: 5
....
....


* void ata_scsi_scan_host(struct ata_port *ap, int sync): libata-scsi.c
  • sdev = __scsi_add_device(ap->scsi_host, channel, id, 0, NULL); scsi/scsi_scan.c
    • scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata);
      • res = scsi_add_lun(sdev, result, &bflags, shost->async_scan);

scsi_add_lun


scsi 0:0:1:0: Direct-Access     ATA      SAMSUNG SP0802N  UR10 PQ: 0 ANSI: 5
  • scsi_sysfs_add_sdev(sdev): scsi/scsi_sysfs.c
    • device_add(&sdev->sdev_dev); : base/core.c
      • bus_attach_device(dev); base/bus.c
        • device_attach(dev); : base/dd.c
          • bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
            • return driver_probe_device(drv, dev);
bus: 'scsi': driver_probe_device: matched device 0:0:1:0 with driver sd

* ret = really_probe(dev, drv); base/dd.c

* static int sd_probe(struct device *dev)
  • sd_revalidate_disk(gd);
        if (sdkp->media_present) {
                sd_read_capacity(sdkp, buffer);
                sd_read_write_protect_flag(sdkp, buffer);
                sd_read_cache_type(sdkp, buffer);
                sd_read_app_tag_own(sdkp, buffer);
        }
sd 0:0:1:0: [sda] 156368016 512-byte hardware sectors (80060 MB)
sd 0:0:1:0: [sda] Write Protect is off
sd 0:0:1:0: [sda] Mode Sense: 00 3a 00 00
sd 0:0:1:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sd 0:0:1:0: [sda] 156368016 512-byte hardware sectors (80060 MB)
sd 0:0:1:0: [sda] Write Protect is off
sd 0:0:1:0: [sda] Mode Sense: 00 3a 00 00
sd 0:0:1:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
  • 오류가 발생하는 부분인듯함.
  • sd_read_app_tag_own(sdkp, buffer);
        res = scsi_mode_sense(sdp, 1, 0x0a, buffer, 36, SD_TIMEOUT,
                              SD_MAX_RETRIES, &data, &sshdr);
 sda: sda1
  • sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", sdp->removable ? "removable " : "");
sd 0:0:1:0: [sda] Attached SCSI disk
sd 0:0:1:0: Attached scsi generic sg1 type 0

add_disk

* sd_probe: drivers/scsi/sd.c
  • add_disk(gd); block/genhd.c
    • register_disk(disk); fs/partitions/check.c
      • device_add(&disk->dev) : drivers/base/core.c
        • printk(KERN_DEBUG "device: '%s': %s\n", dev->bus_id, func);
      • err = blkdev_get(bdev, FMODE_READ, 0);

* fs/block_dev.c
  • blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags)
    • return __blkdev_get(bdev, mode, flags, 0);
      • return do_open(bdev, &fake_file, for_part);
        • rescan_partitions(disk, bdev); : fs/partitions/check.c
          • disk->fops->revalidate_disk(disk);
          • state = check_partition(disk, bdev)

* check_partition(struct gendisk *hd, struct block_device *bdev)
  • printk(KERN_INFO " %s:", state->name);
  • while (!res && check_parti)
    • res = check_parti++(state, bdev);

* check_part0(state, bdev): efi_partition(struct parsed_partitions *state, struct block_device *bdev)
  • find_valid_gpt(bdev, &gpt, &ptes): fs/partitions/efi.c
    • read_lba(bdev, 0, (u8 *) legacymbr, sizeof (*legacymbr));
      • read_dev_sector(bdev, lba++, §); fs/partitions/check.c
* page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)), NULL); include/linux/pagemap.h
  • return read_cache_page(mapping, index, filler, data); mm/filemap.c
    • page = read_cache_page_async(mapping, index, filler, data);
      • page = __read_cache_page(mapping, index, filler, data);

ata_scsi_error

* libata-eh.c
  • DPRINTK("ENTER\n");
  • ata_port_flush_task(ap);
  • ap->ops->error_handler(ap);
libata-core.c
const struct ata_port_operations ata_base_port_ops = {
        .prereset               = ata_std_prereset,
        .postreset              = ata_std_postreset,
        .error_handler          = ata_std_error_handler,
};
  • void ata_std_error_handler(struct ata_port *ap)
    • ata_do_eh(ap, ops->prereset, ops->softreset, hardreset, ops->postreset);


* void ata_std_error_handler(struct ata_port *ap)
  • ata_do_eh(ap, ops->prereset, ops->softreset, hardreset, ops->postreset);
    • ata_eh_autopsy(ap);
    • ata_eh_report(ap);
    • rc = ata_eh_recover(ap, prereset, softreset, hardreset, postreset, NULL);
    • ata_eh_finish(ap);

* ata_eh_autopsy
  • ata_eh_link_autopsy(link);
    • ata_eh_analyze_tf(qc, &qc->result_tf);
      • atapi_eh_request_sense
        • ata_exec_internal
* ata_eh_recover
  • libata-eh.c
  • DPRINTK("ENTER\n");
  • rc = ata_eh_reset(link, ata_link_nr_vacant(link), prereset, softreset, hardreset, postreset);
    • ata_eh_freeze_port(ap);
    • rc = ata_do_reset(link, reset, classes, deadline);
      • return reset(link, classes, deadline);
      • softreset
      • .softreset = ata_sff_softreset,
        • libata-sff.c
    • ata_eh_thaw_port(ap);
    • postreset(link, classes);
  • rc = ata_eh_revalidate_and_attach(link, &dev);
  • rc = ata_set_mode(link, &dev);
    • rc = ata_do_set_mode(link, r_failed_dev);

ata_eh_revalidate_and_attach

* libata-eh.c
ata_eh_revalidate_and_attach: ENTER
ata3.01: ata_dev_read_id: ENTER
ata_pio_sector: data read
ata_port_flush_task: ENTER
ata3: ata_port_flush_task: EXIT
ata3.00: ata_dev_read_id: ENTER
ata_pio_sector: data read
ata_port_flush_task: ENTER
ata3: ata_port_flush_task: EXIT
ata_port_flush_task: ENTER
ata3: ata_port_flush_task: EXIT
ata3.00: ATA-6: ST3160023AS, 8.12, max UDMA/133
ata3.00: 312500000 sectors, multi 8: LBA48 NCQ (depth 0/32)
ata_port_flush_task: ENTER
ata3: ata_port_flush_task: EXIT
__ata_port_freeze: ata3 port frozen
ata3.01: qc timeout (cmd 0xf8)
ata3.01: failed to read native max address (err_mask=0x4)
ata3.01: HPA support seems broken, skipping HPA handling
ata_eh_revalidate_and_attach: EXIT rc=-5
  • DPRINTK("ENTER\n");
  • rc = ata_dev_read_id(dev, &dev->class, readid_flags, dev->id); libata-core.c
    • err_mask = ata_do_dev_read_id(dev, &tf, id);
      • return ata_exec_internal(dev, tf, NULL, DMA_FROM_DEVICE, id, sizeof(id0) * ATA_ID_WORDS, 0);
        • return ata_exec_internal_sg(dev, tf, cdb, dma_dir, psg, n_elem, timeout);

* ata_exec_internal_sg
  • ata_qc_issue(qc);
    • ata_sg_setup(qc)


* libata-core.c

* ata_do_set_mode
  • ata_dev_set_mode
    • err_mask = ata_dev_set_xfermode(dev);
        DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n",
                dev->xfer_shift, (int)dev->xfer_mode);

        ata_dev_printk(dev, KERN_INFO, "configured for %s%s\n",
                       ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)),
                       dev_err_whine);

ata_sff_softreset

error

Alex Gonzalez wrote:

:<6> sda:0:msdos_partition: sector_size=1 
0:read_dev_sector: mapping = 87946cac 0:__read_cache_page:cached_page=83a15580 
0:read_cache_page: page=83a15580 
0:lock_page 
0:sync_page on mm/filemap.c 
0:block_sync_page 
0:blk_run_backing_dev() 
0:blk_backing_dev_unplug() 
0:scsi_request_fn 
0:scsi_dispatch_cmd 
0:ata_scsi_queuecmd 
0:ata_scsi_translate 
0:***ata_qc_prep*** 
0:***ata_check_status*** 
0:***ata_std_dev_select*** 
0:***ata_check_status*** 
0:***ata_check_status*** 
0:***ata_tf_load 
0:***ata_bmdma_setup*** 
0:***ata_exec_command*** 
0:***ata_bmdma_start*** 
0:Dispatched cmd 8b64eba0 with rth 0

<PAUSE>

0:***sil_freeze()*** 
0:***ata_bmdma_error_handler***

This is libata error handling kicking in after detecting command timeout.

0:***ata_bmdma_status*** 
0:***ata_bmdma_stop***

And EH tries to stop the bmdma engine.

********************************************* 
cpu_0 received a bus/cache error ********************************************* 
Bridge: Phys Addr = 0x0000000000, Device_AERR = 0x00000000 
Bridge: The devices reporting AERR are: CPU: (XLR specific) Cache Error log = 0x0000007800004601, Phy Addr = 0x00f0000088 
CPU: epc = 0x83435dfc, errorepc = 0x835bf054, cacheerr = 0x00000000 Can not handle bus/cache error - Halting cpu

Which triggers bus/cache error. Hmmm... When the booting works, does the drive keep working after boot? ie. if you put the drive under stress test, does the system survive. Also, error handling shouldn't trigger bus/cache error. Do you know what the bus/cache error means? 

scsi_mode_sense

* scsi/scsi_lib.c
  • result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, sshdr, timeout, retries); scsi/scsi_lib.c
    • result = scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, timeout, retries, 0);
      • blk_execute_rq(req->q, NULL, req, 1);
        • blk_execute_rq_nowait(q, bd_disk, rq, at_head, blk_end_sync_rq);
        • wait_for_completion(&wait);

ata_scsi_scan_host

* ata_sff_interrupt
  • ata_sff_host_intr
    • ata_sff_hsm_move
      • atapi_pio_bytes(qc);
        • __atapi_pio_bytes(qc, bytes)
        DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");

* atapi_eh_request_sense
        DPRINTK("ATAPI request sense\n");
  • return ata_exec_internal(dev, &tf, cdb, DMA_FROM_DEVICE, sense_buf, SCSI_SENSE_BUFFERSIZE, 0);

* ata_sff_exec_command
        DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);

* ata_sff_hsm_move
        DPRINTK("ata%u: protocol %d task_state %d (dev_stat 0x%X)\n",
                ap->print_id, qc->tf.protocol, ap->hsm_task_state, status);

  • atapi_send_cdb(ap, qc);
        DPRINTK("send cdb\n");

ata2 unplug, ata2 off, driver combination




sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-09-06 12:16:25
Processing time 0.0896 sec